[Libreoffice-commits] core.git: vcl/unx

Stephan Bergmann (via logerrit) logerrit at kemper.freedesktop.org
Sat Jan 25 17:27:21 UTC 2020


 vcl/unx/generic/print/genprnpsp.cxx |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit 681872593c83dbab9a98352f9a1a74a0d059e5ec
Author:     Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Sat Jan 25 13:32:31 2020 +0100
Commit:     Stephan Bergmann <sbergman at redhat.com>
CommitDate: Sat Jan 25 18:26:47 2020 +0100

    Avoid explicit cast to smaller sal_uInt16 from larger int
    
    ...in what might be an attempt to avoid warnings about signed vs. unsigned
    comparisons.
    
    Change-Id: Id175c2b29c094de5857a680243aebaf2fe10df99
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87394
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <sbergman at redhat.com>

diff --git a/vcl/unx/generic/print/genprnpsp.cxx b/vcl/unx/generic/print/genprnpsp.cxx
index e7570538070c..7b985ff425bc 100644
--- a/vcl/unx/generic/print/genprnpsp.cxx
+++ b/vcl/unx/generic/print/genprnpsp.cxx
@@ -35,6 +35,7 @@
 #include <sys/stat.h>
 
 #include <comphelper/fileurl.hxx>
+#include <o3tl/safeint.hxx>
 #include <rtl/ustring.hxx>
 #include <sal/log.hxx>
 
@@ -716,7 +717,7 @@ OUString PspSalInfoPrinter::GetPaperBinName( const ImplJobSetup* pJobSetup, sal_
     if( aData.m_pParser )
     {
         const PPDKey* pKey = aData.m_pParser ? aData.m_pParser->getKey( "InputSlot" ): nullptr;
-        if( ! pKey || nPaperBin >= static_cast<sal_uInt16>(pKey->countValues()) )
+        if( ! pKey || nPaperBin >= o3tl::make_unsigned(pKey->countValues()) )
             return aData.m_pParser->getDefaultInputSlot();
         const PPDValue* pValue = pKey->getValue( nPaperBin );
         if( pValue )


More information about the Libreoffice-commits mailing list