Kaydet (Commit) 54045cc8 authored tarafından Daniel Robertson's avatar Daniel Robertson Kaydeden (comit) Michael Stahl

tdf#94228 vcl: replace BOOST_PP with templates

Replace BOOST_PP macros in Bitmap Checksum to Bitmap Checksum Octet
Array with templates.

Change-Id: Ia7cbc20c90b4d99d54760580e3db10afac9020f3
Reviewed-on: https://gerrit.libreoffice.org/18597Reviewed-by: 's avatarMichael Stahl <mstahl@redhat.com>
Tested-by: 's avatarMichael Stahl <mstahl@redhat.com>
üst e4a8ae0b
...@@ -26,23 +26,22 @@ ...@@ -26,23 +26,22 @@
#include <tools/solar.h> #include <tools/solar.h>
#include <vcl/dllapi.h> #include <vcl/dllapi.h>
#include <boost/preprocessor/arithmetic/inc.hpp>
#include <boost/preprocessor/arithmetic/mul.hpp>
#include <boost/preprocessor/repetition/repeat_from_to.hpp>
#define BITMAP_CHECKSUM_SIZE 8 #define BITMAP_CHECKSUM_SIZE 8
#define BITMAP_CHECKSUM_BITS BOOST_PP_MUL(BITMAP_CHECKSUM_SIZE, 8)
typedef sal_uInt64 BitmapChecksum; typedef sal_uInt64 BitmapChecksum;
typedef sal_uInt8 BitmapChecksumOctetArray[BITMAP_CHECKSUM_SIZE]; typedef sal_uInt8 BitmapChecksumOctetArray[BITMAP_CHECKSUM_SIZE];
#define BITMAP_CHECKSUM_SET_OCTET(z, i, unused) \ template< sal_uInt8 N = 0 >
p[i] = (sal_uInt8)(n >> BOOST_PP_MUL(8, i)); inline void BCToBCOA( BitmapChecksum n, BitmapChecksumOctetArray p )
{
p[N] = (sal_uInt8)(n >> ( 8 * N ));
return BCToBCOA< N + 1 >( n, p );
}
inline void BCToBCOA( BitmapChecksum n , BitmapChecksumOctetArray p ) template<>
inline void BCToBCOA< BITMAP_CHECKSUM_SIZE >( BitmapChecksum, BitmapChecksumOctetArray )
{ {
BOOST_PP_REPEAT(BITMAP_CHECKSUM_SIZE , BITMAP_CHECKSUM_SET_OCTET, unused) return;
} }
#ifdef __cplusplus #ifdef __cplusplus
......
...@@ -134,7 +134,7 @@ OString GraphicID::GetIDString() const ...@@ -134,7 +134,7 @@ OString GraphicID::GetIDString() const
for( nShift = 28; nShift >= 0; nShift -= 4 ) for( nShift = 28; nShift >= 0; nShift -= 4 )
aHexStr[nIndex++] = aHexData[ ( mnID3 >> (sal_uInt32) nShift ) & 0xf ]; aHexStr[nIndex++] = aHexData[ ( mnID3 >> (sal_uInt32) nShift ) & 0xf ];
for( nShift = BITMAP_CHECKSUM_BITS - 4; nShift >= 0; nShift -= 4 ) for( nShift = ( 8 * BITMAP_CHECKSUM_SIZE ) - 4; nShift >= 0; nShift -= 4 )
aHexStr[nIndex++] = aHexData[ ( mnID4 >> (sal_uInt32) nShift ) & 0xf ]; aHexStr[nIndex++] = aHexData[ ( mnID4 >> (sal_uInt32) nShift ) & 0xf ];
return aHexStr.makeStringAndClear(); return aHexStr.makeStringAndClear();
......
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