Kaydet (Commit) 936308d3 authored tarafından Stephan Bergmann's avatar Stephan Bergmann

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: 's avatarStephan Bergmann <sbergman@redhat.com>
üst efcf8149
......@@ -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];
......
......@@ -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)
......
......@@ -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() )
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment