[Libreoffice-commits] core.git: include/vcl vcl/qa vcl/source

Tomaž Vajngerl (via logerrit) logerrit at kemper.freedesktop.org
Thu Apr 4 13:04:29 UTC 2019


 include/vcl/bitmap.hxx                                    |    6 ++--
 vcl/qa/cppunit/BitmapTest.cxx                             |   20 +++++---------
 vcl/source/bitmap/BitmapColorQuantizationFilter.cxx       |    2 -
 vcl/source/bitmap/BitmapSimpleColorQuantizationFilter.cxx |    2 -
 4 files changed, 13 insertions(+), 17 deletions(-)

New commits:
commit dc7fdd7e75ba4089e3c385479fd6b303d518efe5
Author:     Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Thu Apr 4 17:53:47 2019 +0900
Commit:     Tomaž Vajngerl <quikee at gmail.com>
CommitDate: Thu Apr 4 15:04:01 2019 +0200

    change GetColorCount to use sal_Int64
    
    Hopefully fixes problems on 32-bit linux.
    
    Change-Id: I1fc22f1bb37c8297bd3bd6828206d1ffa9ae722d
    Reviewed-on: https://gerrit.libreoffice.org/70241
    Tested-by: Jenkins
    Reviewed-by: Tomaž Vajngerl <quikee at gmail.com>

diff --git a/include/vcl/bitmap.hxx b/include/vcl/bitmap.hxx
index 16dad0e6601d..71007c86b33d 100644
--- a/include/vcl/bitmap.hxx
+++ b/include/vcl/bitmap.hxx
@@ -131,7 +131,7 @@ public:
     Size                    GetSizePixel() const;
 
     sal_uInt16              GetBitCount() const;
-    inline sal_uLong        GetColorCount() const;
+    inline sal_Int64        GetColorCount() const;
     inline sal_uLong        GetSizeBytes() const;
     bool                    HasGreyPalette() const;
     /** get system dependent bitmap data
@@ -574,9 +574,9 @@ inline void Bitmap::SetPrefSize( const Size& rSize )
     maPrefSize = rSize;
 }
 
-inline sal_uLong Bitmap::GetColorCount() const
+inline sal_Int64 Bitmap::GetColorCount() const
 {
-    return( sal_uLong(1) << static_cast<sal_uLong>(GetBitCount()) );
+    return sal_Int64(1) << sal_Int64(GetBitCount());
 }
 
 inline sal_uLong Bitmap::GetSizeBytes() const
diff --git a/vcl/qa/cppunit/BitmapTest.cxx b/vcl/qa/cppunit/BitmapTest.cxx
index 11cfea33f2d6..632a243af0cf 100644
--- a/vcl/qa/cppunit/BitmapTest.cxx
+++ b/vcl/qa/cppunit/BitmapTest.cxx
@@ -77,8 +77,7 @@ void BitmapTest::testCreation()
         CPPUNIT_ASSERT_MESSAGE("Not empty", aBmp.IsEmpty());
         CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong bit count", static_cast<sal_uInt16>(0),
                                      aBmp.GetBitCount());
-        CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong color count", static_cast<sal_uLong>(1),
-                                     aBmp.GetColorCount());
+        CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong color count", sal_Int64(1), aBmp.GetColorCount());
         CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong byte size", static_cast<sal_uLong>(0),
                                      aBmp.GetSizeBytes());
     }
@@ -92,8 +91,7 @@ void BitmapTest::testCreation()
         CPPUNIT_ASSERT_MESSAGE("Empty bitmap", !aBmp.IsEmpty());
         CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong bit count", static_cast<sal_uInt16>(1),
                                      aBmp.GetBitCount());
-        CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong color count", static_cast<sal_uLong>(2),
-                                     aBmp.GetColorCount());
+        CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong color count", sal_Int64(2), aBmp.GetColorCount());
         CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong byte size", static_cast<sal_uLong>(12),
                                      aBmp.GetSizeBytes());
     }
@@ -107,8 +105,7 @@ void BitmapTest::testCreation()
         CPPUNIT_ASSERT_MESSAGE("Empty bitmap", !aBmp.IsEmpty());
         CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong bit count", static_cast<sal_uInt16>(4),
                                      aBmp.GetBitCount());
-        CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong color count", static_cast<sal_uLong>(16),
-                                     aBmp.GetColorCount());
+        CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong color count", sal_Int64(16), aBmp.GetColorCount());
         CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong byte size", static_cast<sal_uLong>(50),
                                      aBmp.GetSizeBytes());
     }
@@ -122,8 +119,7 @@ void BitmapTest::testCreation()
         CPPUNIT_ASSERT_MESSAGE("Empty bitmap", !aBmp.IsEmpty());
         CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong bit count", static_cast<sal_uInt16>(8),
                                      aBmp.GetBitCount());
-        CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong color count", static_cast<sal_uLong>(256),
-                                     aBmp.GetColorCount());
+        CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong color count", sal_Int64(256), aBmp.GetColorCount());
         CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong byte size", static_cast<sal_uLong>(100),
                                      aBmp.GetSizeBytes());
     }
@@ -137,7 +133,7 @@ void BitmapTest::testCreation()
         CPPUNIT_ASSERT_MESSAGE("Empty bitmap", !aBmp.IsEmpty());
         CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong bit count", static_cast<sal_uInt16>(24),
                                      aBmp.GetBitCount());
-        CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong color count", static_cast<sal_uLong>(16777216),
+        CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong color count", sal_Int64(16777216),
                                      aBmp.GetColorCount());
         CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong byte size", static_cast<sal_uLong>(300),
                                      aBmp.GetSizeBytes());
@@ -152,7 +148,7 @@ void BitmapTest::testCreation()
         CPPUNIT_ASSERT_MESSAGE("Empty bitmap", !aBmp.IsEmpty());
         CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong bit count", static_cast<sal_uInt16>(24),
                                      aBmp.GetBitCount());
-        CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong color count", static_cast<sal_uLong>(16777216),
+        CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong color count", sal_Int64(16777216),
                                      aBmp.GetColorCount());
         CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong byte size", static_cast<sal_uLong>(300),
                                      aBmp.GetSizeBytes());
@@ -171,8 +167,8 @@ void BitmapTest::testCreation()
         CPPUNIT_ASSERT_MESSAGE("Empty bitmap", !aBmp.IsEmpty());
 
         CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong bit count", sal_uInt16(32), aBmp.GetBitCount());
-        CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong color count", sal_Int64(4294967296U),
-                                     sal_Int64(aBmp.GetColorCount()));
+        CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong color count", sal_Int64(4294967296ull),
+                                     aBmp.GetColorCount());
         CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong byte size", sal_uLong(400), aBmp.GetSizeBytes());
     }
 }
diff --git a/vcl/source/bitmap/BitmapColorQuantizationFilter.cxx b/vcl/source/bitmap/BitmapColorQuantizationFilter.cxx
index c877dd4adb66..390319d8ad9e 100644
--- a/vcl/source/bitmap/BitmapColorQuantizationFilter.cxx
+++ b/vcl/source/bitmap/BitmapColorQuantizationFilter.cxx
@@ -27,7 +27,7 @@ BitmapEx BitmapColorQuantizationFilter::execute(BitmapEx const& aBitmapEx) const
 
     bool bRet = false;
 
-    if (aBitmap.GetColorCount() <= static_cast<sal_uLong>(mnNewColorCount))
+    if (aBitmap.GetColorCount() <= sal_Int64(mnNewColorCount))
     {
         bRet = true;
     }
diff --git a/vcl/source/bitmap/BitmapSimpleColorQuantizationFilter.cxx b/vcl/source/bitmap/BitmapSimpleColorQuantizationFilter.cxx
index 1885308275e5..2f1fb9906a1f 100644
--- a/vcl/source/bitmap/BitmapSimpleColorQuantizationFilter.cxx
+++ b/vcl/source/bitmap/BitmapSimpleColorQuantizationFilter.cxx
@@ -24,7 +24,7 @@ BitmapEx BitmapSimpleColorQuantizationFilter::execute(BitmapEx const& aBitmapEx)
 
     bool bRet = false;
 
-    if (aBitmap.GetColorCount() <= static_cast<sal_uLong>(mnNewColorCount))
+    if (aBitmap.GetColorCount() <= sal_Int64(mnNewColorCount))
     {
         bRet = true;
     }


More information about the Libreoffice-commits mailing list