include/tools/solar.h | 1 vcl/source/gdi/animate.cxx | 21 ++++++----- vcl/source/gdi/bitmapex.cxx | 5 +- vcl/source/gdi/gdimtf.cxx | 84 ++++++++++++++++++++++---------------------- 4 files changed, 58 insertions(+), 53 deletions(-)
New commits: commit 936308d3ef4f43d9c525401cb1cfca197df13b0f Author: Stephan Bergmann <sberg...@redhat.com> AuthorDate: Tue Mar 5 17:38:52 2019 +0100 Commit: Stephan Bergmann <sberg...@redhat.com> CommitDate: Wed Mar 6 08:28:58 2019 +0100 Introduce Int32ToSVBT32 for cases that apparently want to write a signed value ...and clean up some other (legitimate) uses of UInt32ToSVBT32 to not use a (somewhat misleading) static_cast<long>(...) Change-Id: Ifd0c3f771c3f6e20eef3413b9c27fd2514dc0c13 Reviewed-on: https://gerrit.libreoffice.org/68767 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sberg...@redhat.com> diff --git a/include/tools/solar.h b/include/tools/solar.h index 3fd676acbc2a..721573287685 100644 --- a/include/tools/solar.h +++ b/include/tools/solar.h @@ -94,6 +94,7 @@ inline void UInt32ToSVBT32 ( sal_uInt32 n, SVBT32 p ) p[2] = static_cast<sal_uInt8>(n >> 16); p[3] = static_cast<sal_uInt8>(n >> 24); } +inline void Int32ToSVBT32 ( sal_Int32 n, SVBT32 p ) { UInt32ToSVBT32(sal_uInt32(n), p); } #if defined OSL_LITENDIAN inline void DoubleToSVBT64( double n, SVBT64 p ) { p[0] = reinterpret_cast<sal_uInt8*>(&n)[0]; p[1] = reinterpret_cast<sal_uInt8*>(&n)[1]; diff --git a/vcl/source/gdi/animate.cxx b/vcl/source/gdi/animate.cxx index 7e3cb72ac9cf..25eceb595f39 100644 --- a/vcl/source/gdi/animate.cxx +++ b/vcl/source/gdi/animate.cxx @@ -17,6 +17,9 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include <sal/config.h> + +#include <o3tl/underlyingenumvalue.hxx> #include <tools/stream.hxx> #include <rtl/crc.h> #include <sal/log.hxx> @@ -38,25 +41,25 @@ BitmapChecksum AnimationBitmap::GetChecksum() const BitmapChecksum nCrc = aBmpEx.GetChecksum(); SVBT32 aBT32; - UInt32ToSVBT32( aPosPix.X(), aBT32 ); + Int32ToSVBT32( aPosPix.X(), aBT32 ); nCrc = vcl_get_checksum( nCrc, aBT32, 4 ); - UInt32ToSVBT32( aPosPix.Y(), aBT32 ); + Int32ToSVBT32( aPosPix.Y(), aBT32 ); nCrc = vcl_get_checksum( nCrc, aBT32, 4 ); - UInt32ToSVBT32( aSizePix.Width(), aBT32 ); + Int32ToSVBT32( aSizePix.Width(), aBT32 ); nCrc = vcl_get_checksum( nCrc, aBT32, 4 ); - UInt32ToSVBT32( aSizePix.Height(), aBT32 ); + Int32ToSVBT32( aSizePix.Height(), aBT32 ); nCrc = vcl_get_checksum( nCrc, aBT32, 4 ); - UInt32ToSVBT32( nWait, aBT32 ); + Int32ToSVBT32( nWait, aBT32 ); nCrc = vcl_get_checksum( nCrc, aBT32, 4 ); - UInt32ToSVBT32( static_cast<long>(eDisposal), aBT32 ); + UInt32ToSVBT32( o3tl::underlyingEnumValue(eDisposal), aBT32 ); nCrc = vcl_get_checksum( nCrc, aBT32, 4 ); - UInt32ToSVBT32( static_cast<long>(bUserInput), aBT32 ); + UInt32ToSVBT32( sal_uInt32(bUserInput), aBT32 ); nCrc = vcl_get_checksum( nCrc, aBT32, 4 ); return nCrc; @@ -195,10 +198,10 @@ BitmapChecksum Animation::GetChecksum() const UInt32ToSVBT32( maList.size(), aBT32 ); nCrc = vcl_get_checksum( nCrc, aBT32, 4 ); - UInt32ToSVBT32( maGlobalSize.Width(), aBT32 ); + Int32ToSVBT32( maGlobalSize.Width(), aBT32 ); nCrc = vcl_get_checksum( nCrc, aBT32, 4 ); - UInt32ToSVBT32( maGlobalSize.Height(), aBT32 ); + Int32ToSVBT32( maGlobalSize.Height(), aBT32 ); nCrc = vcl_get_checksum( nCrc, aBT32, 4 ); for(auto const & i : maList) diff --git a/vcl/source/gdi/bitmapex.cxx b/vcl/source/gdi/bitmapex.cxx index 3db94e9171f3..b3068db0c8bc 100644 --- a/vcl/source/gdi/bitmapex.cxx +++ b/vcl/source/gdi/bitmapex.cxx @@ -20,6 +20,7 @@ #include <rtl/crc.h> #include <rtl/strbuf.hxx> #include <sal/log.hxx> +#include <o3tl/underlyingenumvalue.hxx> #include <osl/diagnose.h> #include <tools/debug.hxx> #include <tools/stream.hxx> @@ -291,10 +292,10 @@ BitmapChecksum BitmapEx::GetChecksum() const SVBT32 aBT32; BitmapChecksumOctetArray aBCOA; - UInt32ToSVBT32( static_cast<long>(meTransparent), aBT32 ); + UInt32ToSVBT32( o3tl::underlyingEnumValue(meTransparent), aBT32 ); nCrc = vcl_get_checksum( nCrc, aBT32, 4 ); - UInt32ToSVBT32( static_cast<long>(mbAlpha), aBT32 ); + UInt32ToSVBT32( sal_uInt32(mbAlpha), aBT32 ); nCrc = vcl_get_checksum( nCrc, aBT32, 4 ); if( ( TransparentType::Bitmap == meTransparent ) && !maMask.IsEmpty() ) diff --git a/vcl/source/gdi/gdimtf.cxx b/vcl/source/gdi/gdimtf.cxx index 7038fb7c5244..0aa29bf55173 100644 --- a/vcl/source/gdi/gdimtf.cxx +++ b/vcl/source/gdi/gdimtf.cxx @@ -2229,10 +2229,10 @@ BitmapChecksum GDIMetaFile::GetChecksum() const BCToBCOA( pAct->GetBitmap().GetChecksum(), aBCOA ); nCrc = vcl_get_checksum( nCrc, aBCOA, BITMAP_CHECKSUM_SIZE ); - UInt32ToSVBT32( pAct->GetPoint().X(), aBT32 ); + Int32ToSVBT32( pAct->GetPoint().X(), aBT32 ); nCrc = vcl_get_checksum( nCrc, aBT32, 4 ); - UInt32ToSVBT32( pAct->GetPoint().Y(), aBT32 ); + Int32ToSVBT32( pAct->GetPoint().Y(), aBT32 ); nCrc = vcl_get_checksum( nCrc, aBT32, 4 ); } break; @@ -2247,16 +2247,16 @@ BitmapChecksum GDIMetaFile::GetChecksum() const BCToBCOA( pAct->GetBitmap().GetChecksum(), aBCOA ); nCrc = vcl_get_checksum( nCrc, aBCOA, BITMAP_CHECKSUM_SIZE ); - UInt32ToSVBT32( pAct->GetPoint().X(), aBT32 ); + Int32ToSVBT32( pAct->GetPoint().X(), aBT32 ); nCrc = vcl_get_checksum( nCrc, aBT32, 4 ); - UInt32ToSVBT32( pAct->GetPoint().Y(), aBT32 ); + Int32ToSVBT32( pAct->GetPoint().Y(), aBT32 ); nCrc = vcl_get_checksum( nCrc, aBT32, 4 ); - UInt32ToSVBT32( pAct->GetSize().Width(), aBT32 ); + Int32ToSVBT32( pAct->GetSize().Width(), aBT32 ); nCrc = vcl_get_checksum( nCrc, aBT32, 4 ); - UInt32ToSVBT32( pAct->GetSize().Height(), aBT32 ); + Int32ToSVBT32( pAct->GetSize().Height(), aBT32 ); nCrc = vcl_get_checksum( nCrc, aBT32, 4 ); } break; @@ -2271,28 +2271,28 @@ BitmapChecksum GDIMetaFile::GetChecksum() const BCToBCOA( pAct->GetBitmap().GetChecksum(), aBCOA ); nCrc = vcl_get_checksum( nCrc, aBCOA, BITMAP_CHECKSUM_SIZE ); - UInt32ToSVBT32( pAct->GetDestPoint().X(), aBT32 ); + Int32ToSVBT32( pAct->GetDestPoint().X(), aBT32 ); nCrc = vcl_get_checksum( nCrc, aBT32, 4 ); - UInt32ToSVBT32( pAct->GetDestPoint().Y(), aBT32 ); + Int32ToSVBT32( pAct->GetDestPoint().Y(), aBT32 ); nCrc = vcl_get_checksum( nCrc, aBT32, 4 ); - UInt32ToSVBT32( pAct->GetDestSize().Width(), aBT32 ); + Int32ToSVBT32( pAct->GetDestSize().Width(), aBT32 ); nCrc = vcl_get_checksum( nCrc, aBT32, 4 ); - UInt32ToSVBT32( pAct->GetDestSize().Height(), aBT32 ); + Int32ToSVBT32( pAct->GetDestSize().Height(), aBT32 ); nCrc = vcl_get_checksum( nCrc, aBT32, 4 ); - UInt32ToSVBT32( pAct->GetSrcPoint().X(), aBT32 ); + Int32ToSVBT32( pAct->GetSrcPoint().X(), aBT32 ); nCrc = vcl_get_checksum( nCrc, aBT32, 4 ); - UInt32ToSVBT32( pAct->GetSrcPoint().Y(), aBT32 ); + Int32ToSVBT32( pAct->GetSrcPoint().Y(), aBT32 ); nCrc = vcl_get_checksum( nCrc, aBT32, 4 ); - UInt32ToSVBT32( pAct->GetSrcSize().Width(), aBT32 ); + Int32ToSVBT32( pAct->GetSrcSize().Width(), aBT32 ); nCrc = vcl_get_checksum( nCrc, aBT32, 4 ); - UInt32ToSVBT32( pAct->GetSrcSize().Height(), aBT32 ); + Int32ToSVBT32( pAct->GetSrcSize().Height(), aBT32 ); nCrc = vcl_get_checksum( nCrc, aBT32, 4 ); } break; @@ -2307,10 +2307,10 @@ BitmapChecksum GDIMetaFile::GetChecksum() const BCToBCOA( pAct->GetBitmapEx().GetChecksum(), aBCOA ); nCrc = vcl_get_checksum( nCrc, aBCOA, BITMAP_CHECKSUM_SIZE ); - UInt32ToSVBT32( pAct->GetPoint().X(), aBT32 ); + Int32ToSVBT32( pAct->GetPoint().X(), aBT32 ); nCrc = vcl_get_checksum( nCrc, aBT32, 4 ); - UInt32ToSVBT32( pAct->GetPoint().Y(), aBT32 ); + Int32ToSVBT32( pAct->GetPoint().Y(), aBT32 ); nCrc = vcl_get_checksum( nCrc, aBT32, 4 ); } break; @@ -2325,16 +2325,16 @@ BitmapChecksum GDIMetaFile::GetChecksum() const BCToBCOA( pAct->GetBitmapEx().GetChecksum(), aBCOA ); nCrc = vcl_get_checksum( nCrc, aBCOA, BITMAP_CHECKSUM_SIZE ); - UInt32ToSVBT32( pAct->GetPoint().X(), aBT32 ); + Int32ToSVBT32( pAct->GetPoint().X(), aBT32 ); nCrc = vcl_get_checksum( nCrc, aBT32, 4 ); - UInt32ToSVBT32( pAct->GetPoint().Y(), aBT32 ); + Int32ToSVBT32( pAct->GetPoint().Y(), aBT32 ); nCrc = vcl_get_checksum( nCrc, aBT32, 4 ); - UInt32ToSVBT32( pAct->GetSize().Width(), aBT32 ); + Int32ToSVBT32( pAct->GetSize().Width(), aBT32 ); nCrc = vcl_get_checksum( nCrc, aBT32, 4 ); - UInt32ToSVBT32( pAct->GetSize().Height(), aBT32 ); + Int32ToSVBT32( pAct->GetSize().Height(), aBT32 ); nCrc = vcl_get_checksum( nCrc, aBT32, 4 ); } break; @@ -2349,28 +2349,28 @@ BitmapChecksum GDIMetaFile::GetChecksum() const BCToBCOA( pAct->GetBitmapEx().GetChecksum(), aBCOA ); nCrc = vcl_get_checksum( nCrc, aBCOA, BITMAP_CHECKSUM_SIZE ); - UInt32ToSVBT32( pAct->GetDestPoint().X(), aBT32 ); + Int32ToSVBT32( pAct->GetDestPoint().X(), aBT32 ); nCrc = vcl_get_checksum( nCrc, aBT32, 4 ); - UInt32ToSVBT32( pAct->GetDestPoint().Y(), aBT32 ); + Int32ToSVBT32( pAct->GetDestPoint().Y(), aBT32 ); nCrc = vcl_get_checksum( nCrc, aBT32, 4 ); - UInt32ToSVBT32( pAct->GetDestSize().Width(), aBT32 ); + Int32ToSVBT32( pAct->GetDestSize().Width(), aBT32 ); nCrc = vcl_get_checksum( nCrc, aBT32, 4 ); - UInt32ToSVBT32( pAct->GetDestSize().Height(), aBT32 ); + Int32ToSVBT32( pAct->GetDestSize().Height(), aBT32 ); nCrc = vcl_get_checksum( nCrc, aBT32, 4 ); - UInt32ToSVBT32( pAct->GetSrcPoint().X(), aBT32 ); + Int32ToSVBT32( pAct->GetSrcPoint().X(), aBT32 ); nCrc = vcl_get_checksum( nCrc, aBT32, 4 ); - UInt32ToSVBT32( pAct->GetSrcPoint().Y(), aBT32 ); + Int32ToSVBT32( pAct->GetSrcPoint().Y(), aBT32 ); nCrc = vcl_get_checksum( nCrc, aBT32, 4 ); - UInt32ToSVBT32( pAct->GetSrcSize().Width(), aBT32 ); + Int32ToSVBT32( pAct->GetSrcSize().Width(), aBT32 ); nCrc = vcl_get_checksum( nCrc, aBT32, 4 ); - UInt32ToSVBT32( pAct->GetSrcSize().Height(), aBT32 ); + Int32ToSVBT32( pAct->GetSrcSize().Height(), aBT32 ); nCrc = vcl_get_checksum( nCrc, aBT32, 4 ); } break; @@ -2388,10 +2388,10 @@ BitmapChecksum GDIMetaFile::GetChecksum() const UInt32ToSVBT32( sal_uInt32(pAct->GetColor()), aBT32 ); nCrc = vcl_get_checksum( nCrc, aBT32, 4 ); - UInt32ToSVBT32( pAct->GetPoint().X(), aBT32 ); + Int32ToSVBT32( pAct->GetPoint().X(), aBT32 ); nCrc = vcl_get_checksum( nCrc, aBT32, 4 ); - UInt32ToSVBT32( pAct->GetPoint().Y(), aBT32 ); + Int32ToSVBT32( pAct->GetPoint().Y(), aBT32 ); nCrc = vcl_get_checksum( nCrc, aBT32, 4 ); } break; @@ -2409,16 +2409,16 @@ BitmapChecksum GDIMetaFile::GetChecksum() const UInt32ToSVBT32( sal_uInt32(pAct->GetColor()), aBT32 ); nCrc = vcl_get_checksum( nCrc, aBT32, 4 ); - UInt32ToSVBT32( pAct->GetPoint().X(), aBT32 ); + Int32ToSVBT32( pAct->GetPoint().X(), aBT32 ); nCrc = vcl_get_checksum( nCrc, aBT32, 4 ); - UInt32ToSVBT32( pAct->GetPoint().Y(), aBT32 ); + Int32ToSVBT32( pAct->GetPoint().Y(), aBT32 ); nCrc = vcl_get_checksum( nCrc, aBT32, 4 ); - UInt32ToSVBT32( pAct->GetSize().Width(), aBT32 ); + Int32ToSVBT32( pAct->GetSize().Width(), aBT32 ); nCrc = vcl_get_checksum( nCrc, aBT32, 4 ); - UInt32ToSVBT32( pAct->GetSize().Height(), aBT32 ); + Int32ToSVBT32( pAct->GetSize().Height(), aBT32 ); nCrc = vcl_get_checksum( nCrc, aBT32, 4 ); } break; @@ -2436,28 +2436,28 @@ BitmapChecksum GDIMetaFile::GetChecksum() const UInt32ToSVBT32( sal_uInt32(pAct->GetColor()), aBT32 ); nCrc = vcl_get_checksum( nCrc, aBT32, 4 ); - UInt32ToSVBT32( pAct->GetDestPoint().X(), aBT32 ); + Int32ToSVBT32( pAct->GetDestPoint().X(), aBT32 ); nCrc = vcl_get_checksum( nCrc, aBT32, 4 ); - UInt32ToSVBT32( pAct->GetDestPoint().Y(), aBT32 ); + Int32ToSVBT32( pAct->GetDestPoint().Y(), aBT32 ); nCrc = vcl_get_checksum( nCrc, aBT32, 4 ); - UInt32ToSVBT32( pAct->GetDestSize().Width(), aBT32 ); + Int32ToSVBT32( pAct->GetDestSize().Width(), aBT32 ); nCrc = vcl_get_checksum( nCrc, aBT32, 4 ); - UInt32ToSVBT32( pAct->GetDestSize().Height(), aBT32 ); + Int32ToSVBT32( pAct->GetDestSize().Height(), aBT32 ); nCrc = vcl_get_checksum( nCrc, aBT32, 4 ); - UInt32ToSVBT32( pAct->GetSrcPoint().X(), aBT32 ); + Int32ToSVBT32( pAct->GetSrcPoint().X(), aBT32 ); nCrc = vcl_get_checksum( nCrc, aBT32, 4 ); - UInt32ToSVBT32( pAct->GetSrcPoint().Y(), aBT32 ); + Int32ToSVBT32( pAct->GetSrcPoint().Y(), aBT32 ); nCrc = vcl_get_checksum( nCrc, aBT32, 4 ); - UInt32ToSVBT32( pAct->GetSrcSize().Width(), aBT32 ); + Int32ToSVBT32( pAct->GetSrcSize().Width(), aBT32 ); nCrc = vcl_get_checksum( nCrc, aBT32, 4 ); - UInt32ToSVBT32( pAct->GetSrcSize().Height(), aBT32 ); + Int32ToSVBT32( pAct->GetSrcSize().Height(), aBT32 ); nCrc = vcl_get_checksum( nCrc, aBT32, 4 ); } break; _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits