[Libreoffice-commits] core.git: 9 commits - filter/source include/vcl registry/source store/source unoidl/source vcl/inc vcl/source
Matteo Casalin
matteo.casalin at yahoo.com
Fri Aug 21 13:30:48 PDT 2015
filter/source/msfilter/util.cxx | 4
include/vcl/salbtype.hxx | 160 +++++++++++++++++++------------------
registry/source/reflcnst.hxx | 76 ++++++++---------
store/source/lockbyte.cxx | 4
store/source/storbase.hxx | 8 -
store/source/storbios.cxx | 8 -
store/source/storcach.cxx | 2
store/source/stordata.hxx | 22 ++---
store/source/stordir.cxx | 2
store/source/stortree.hxx | 4
unoidl/source/legacyprovider.cxx | 8 -
vcl/inc/canvasbitmap.hxx | 2
vcl/source/helper/canvasbitmap.cxx | 20 ++--
13 files changed, 163 insertions(+), 157 deletions(-)
New commits:
commit 6257ea7d925080c930748b5c1120971f3aabc44d
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date: Fri Aug 21 22:14:03 2015 +0200
sal_uLong to size_t
Change-Id: Ie1774045329f543c05316ba2acfa332e3b323c7c
diff --git a/include/vcl/salbtype.hxx b/include/vcl/salbtype.hxx
index ee3b0f2..2ad04bc 100644
--- a/include/vcl/salbtype.hxx
+++ b/include/vcl/salbtype.hxx
@@ -419,7 +419,7 @@ inline BitmapPalette::BitmapPalette( const BitmapPalette& rBitmapPalette ) :
{
if( mnCount )
{
- const sal_uLong nSize = mnCount * sizeof( BitmapColor );
+ const size_t nSize = mnCount * sizeof( BitmapColor );
mpBitmapColor = reinterpret_cast<BitmapColor*>(new sal_uInt8[ nSize ]);
memcpy( mpBitmapColor, rBitmapPalette.mpBitmapColor, nSize );
}
@@ -432,7 +432,7 @@ inline BitmapPalette::BitmapPalette( sal_uInt16 nCount ) :
{
if( mnCount )
{
- const sal_uLong nSize = mnCount * sizeof( BitmapColor );
+ const size_t nSize = mnCount * sizeof( BitmapColor );
mpBitmapColor = reinterpret_cast<BitmapColor*>(new sal_uInt8[ nSize ]);
memset( mpBitmapColor, 0, nSize );
}
@@ -452,7 +452,7 @@ inline BitmapPalette& BitmapPalette::operator=( const BitmapPalette& rBitmapPale
if( mnCount )
{
- const sal_uLong nSize = mnCount * sizeof( BitmapColor );
+ const size_t nSize = mnCount * sizeof( BitmapColor );
mpBitmapColor = reinterpret_cast<BitmapColor*>(new sal_uInt8[ nSize ]);
memcpy( mpBitmapColor, rBitmapPalette.mpBitmapColor, nSize );
}
@@ -508,8 +508,8 @@ inline void BitmapPalette::SetEntryCount( sal_uInt16 nCount )
}
else if( nCount != mnCount )
{
- const sal_uLong nNewSize = nCount * sizeof( BitmapColor );
- const sal_uLong nMinSize = std::min( mnCount, nCount ) * sizeof( BitmapColor );
+ const size_t nNewSize = nCount * sizeof( BitmapColor );
+ const size_t nMinSize = std::min( mnCount, nCount ) * sizeof( BitmapColor );
sal_uInt8* pNewColor = new sal_uInt8[ nNewSize ];
if ( nMinSize && mpBitmapColor )
commit adc5e7d554fb3ad1afc4fdd15021fb84be297147
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date: Wed Aug 19 22:47:51 2015 +0200
ColorMask: sal_uLong to better types, minor code rework
Change-Id: I426fa847038e7a6f788761242cb43e38cb355a36
diff --git a/include/vcl/salbtype.hxx b/include/vcl/salbtype.hxx
index dfbc59d..ee3b0f2 100644
--- a/include/vcl/salbtype.hxx
+++ b/include/vcl/salbtype.hxx
@@ -68,9 +68,9 @@ typedef const sal_uInt8* ConstScanline;
#define MASK_TO_COLOR( d_nVal, d_RM, d_GM, d_BM, d_RS, d_GS, d_BS, d_Col ) \
-sal_uLong _def_cR = (sal_uInt8) ( d_RS < 0L ? ( (d_nVal) & d_RM ) << -d_RS : ( (d_nVal) & d_RM ) >> d_RS ); \
-sal_uLong _def_cG = (sal_uInt8) ( d_GS < 0L ? ( (d_nVal) & d_GM ) << -d_GS : ( (d_nVal) & d_GM ) >> d_GS ); \
-sal_uLong _def_cB = (sal_uInt8) ( d_BS < 0L ? ( (d_nVal) & d_BM ) << -d_BS : ( (d_nVal) & d_BM ) >> d_BS ); \
+const sal_uInt8 _def_cR = static_cast<sal_uInt8>( d_RS < 0 ? ( (d_nVal) & d_RM ) << -d_RS : ( (d_nVal) & d_RM ) >> d_RS ); \
+const sal_uInt8 _def_cG = static_cast<sal_uInt8>( d_GS < 0 ? ( (d_nVal) & d_GM ) << -d_GS : ( (d_nVal) & d_GM ) >> d_GS ); \
+const sal_uInt8 _def_cB = static_cast<sal_uInt8>( d_BS < 0 ? ( (d_nVal) & d_BM ) << -d_BS : ( (d_nVal) & d_BM ) >> d_BS ); \
d_Col = BitmapColor( (sal_uInt8) ( _def_cR | ( ( _def_cR & mnROr ) >> mnROrShift ) ), \
(sal_uInt8) ( _def_cG | ( ( _def_cG & mnGOr ) >> mnGOrShift ) ), \
(sal_uInt8) ( _def_cB | ( ( _def_cB & mnBOr ) >> mnBOrShift ) ) );
@@ -184,33 +184,33 @@ public:
// - ColorMask -
class VCL_DLLPUBLIC ColorMask
{
- sal_uLong mnRMask;
- sal_uLong mnGMask;
- sal_uLong mnBMask;
- long mnRShift;
- long mnGShift;
- long mnBShift;
- sal_uLong mnROrShift;
- sal_uLong mnGOrShift;
- sal_uLong mnBOrShift;
- sal_uLong mnROr;
- sal_uLong mnGOr;
- sal_uLong mnBOr;
- sal_uLong mnAlphaChannel;
-
- SAL_DLLPRIVATE inline long ImplCalcMaskShift( sal_uLong nMask, sal_uLong& rOr, sal_uLong& rOrShift ) const;
+ sal_uInt32 mnRMask;
+ sal_uInt32 mnGMask;
+ sal_uInt32 mnBMask;
+ sal_uInt32 mnAlphaChannel;
+ int mnRShift;
+ int mnGShift;
+ int mnBShift;
+ int mnROrShift;
+ int mnGOrShift;
+ int mnBOrShift;
+ sal_uInt8 mnROr;
+ sal_uInt8 mnGOr;
+ sal_uInt8 mnBOr;
+
+ SAL_DLLPRIVATE inline int ImplCalcMaskShift( sal_uInt32 nMask, sal_uInt8 &rOr, int &rOrShift ) const;
public:
- inline ColorMask( sal_uLong nRedMask = 0UL,
- sal_uLong nGreenMask = 0UL,
- sal_uLong nBlueMask = 0UL,
- sal_uLong nAlphaChannel = 0UL );
+ inline ColorMask( sal_uInt32 nRedMask = 0,
+ sal_uInt32 nGreenMask = 0,
+ sal_uInt32 nBlueMask = 0,
+ sal_uInt32 nAlphaChannel = 0 );
inline ~ColorMask() {}
- inline sal_uLong GetRedMask() const;
- inline sal_uLong GetGreenMask() const;
- inline sal_uLong GetBlueMask() const;
+ inline sal_uInt32 GetRedMask() const;
+ inline sal_uInt32 GetGreenMask() const;
+ inline sal_uInt32 GetBlueMask() const;
inline void GetColorFor8Bit( BitmapColor& rColor, const sal_uInt8* pPixel ) const;
inline void SetColorFor8Bit( const BitmapColor& rColor, sal_uInt8* pPixel ) const;
@@ -566,63 +566,62 @@ inline sal_uInt16 BitmapPalette::GetBestIndex( const BitmapColor& rCol ) const
return nRetIndex;
}
-inline ColorMask::ColorMask( sal_uLong nRedMask,
- sal_uLong nGreenMask,
- sal_uLong nBlueMask,
- sal_uLong nAlphaChannel ) :
+inline ColorMask::ColorMask( sal_uInt32 nRedMask,
+ sal_uInt32 nGreenMask,
+ sal_uInt32 nBlueMask,
+ sal_uInt32 nAlphaChannel ) :
mnRMask( nRedMask ),
mnGMask( nGreenMask ),
mnBMask( nBlueMask ),
- mnROrShift( 0L ),
- mnGOrShift( 0L ),
- mnBOrShift( 0L ),
- mnROr( 0L ),
- mnGOr( 0L ),
- mnBOr( 0L ),
- mnAlphaChannel( nAlphaChannel )
+ mnAlphaChannel( nAlphaChannel ),
+ mnROrShift( 0 ),
+ mnGOrShift( 0 ),
+ mnBOrShift( 0 ),
+ mnROr( 0 ),
+ mnGOr( 0 ),
+ mnBOr( 0 )
{
- mnRShift = ( mnRMask ? ImplCalcMaskShift( mnRMask, mnROr, mnROrShift ) : 0L );
- mnGShift = ( mnGMask ? ImplCalcMaskShift( mnGMask, mnGOr, mnGOrShift ) : 0L );
- mnBShift = ( mnBMask ? ImplCalcMaskShift( mnBMask, mnBOr, mnBOrShift ) : 0L );
+ mnRShift = ( mnRMask ? ImplCalcMaskShift( mnRMask, mnROr, mnROrShift ) : 0 );
+ mnGShift = ( mnGMask ? ImplCalcMaskShift( mnGMask, mnGOr, mnGOrShift ) : 0 );
+ mnBShift = ( mnBMask ? ImplCalcMaskShift( mnBMask, mnBOr, mnBOrShift ) : 0 );
}
-inline long ColorMask::ImplCalcMaskShift( sal_uLong nMask, sal_uLong& rOr, sal_uLong& rOrShift ) const
+inline int ColorMask::ImplCalcMaskShift( sal_uInt32 nMask, sal_uInt8& rOr, int& rOrShift ) const
{
- long nShift;
- long nRet;
- sal_uLong nLen = 0UL;
-
// from which bit starts the mask?
- for( nShift = 31L; ( nShift >= 0L ) && !( nMask & ( (sal_uLong)1 << (sal_uLong) nShift ) ); nShift-- )
- {}
+ int nShift = 31;
+
+ while( nShift >= 0 && !( nMask & ( 1 << nShift ) ) )
+ --nShift;
- nRet = nShift;
+ const int nRet = nShift - 7;
+ int nLen = 0;
// XXX determine number of bits set => walk right until null
- while( ( nShift >= 0L ) && ( nMask & ( (sal_uLong)1 << (sal_uLong) nShift ) ) )
+ while( nShift >= 0 && ( nMask & ( 1 << nShift ) ) )
{
nShift--;
nLen++;
}
assert( nLen <= 8 ); // mask length must be 8 bits or less
- rOrShift = 8UL - nLen;
- rOr = (sal_uInt8) ( ( 0xffUL >> nLen ) << rOrShift );
+ rOrShift = 8 - nLen;
+ rOr = static_cast<sal_uInt8>( ( 0xFF >> nLen ) << rOrShift );
- return( nRet -= 7 );
+ return nRet;
}
-inline sal_uLong ColorMask::GetRedMask() const
+inline sal_uInt32 ColorMask::GetRedMask() const
{
return mnRMask;
}
-inline sal_uLong ColorMask::GetGreenMask() const
+inline sal_uInt32 ColorMask::GetGreenMask() const
{
return mnGMask;
}
-inline sal_uLong ColorMask::GetBlueMask() const
+inline sal_uInt32 ColorMask::GetBlueMask() const
{
return mnBMask;
}
diff --git a/vcl/inc/canvasbitmap.hxx b/vcl/inc/canvasbitmap.hxx
index 1a6300c..bd00fb7 100644
--- a/vcl/inc/canvasbitmap.hxx
+++ b/vcl/inc/canvasbitmap.hxx
@@ -57,7 +57,7 @@ namespace unotools
sal_Int8 m_nEndianness;
bool m_bPalette;
- SAL_DLLPRIVATE void setComponentInfo( sal_uLong redShift, sal_uLong greenShift, sal_uLong blueShift );
+ SAL_DLLPRIVATE void setComponentInfo( sal_uInt32 redShift, sal_uInt32 greenShift, sal_uInt32 blueShift );
virtual ~VclCanvasBitmap();
diff --git a/vcl/source/helper/canvasbitmap.cxx b/vcl/source/helper/canvasbitmap.cxx
index c532606..3efff8c 100644
--- a/vcl/source/helper/canvasbitmap.cxx
+++ b/vcl/source/helper/canvasbitmap.cxx
@@ -53,7 +53,7 @@ namespace
}
}
-void VclCanvasBitmap::setComponentInfo( sal_uLong redShift, sal_uLong greenShift, sal_uLong blueShift )
+void VclCanvasBitmap::setComponentInfo( sal_uInt32 redShift, sal_uInt32 greenShift, sal_uInt32 blueShift )
{
// sort channels in increasing order of appearance in the pixel
// (starting with the least significant bits)
@@ -89,9 +89,9 @@ void VclCanvasBitmap::setComponentInfo( sal_uLong redShift, sal_uLong greenShift
m_aComponentBitCounts.realloc(3);
sal_Int32* pCounts = m_aComponentBitCounts.getArray();
- pCounts[redPos] = bitcount(sal::static_int_cast<sal_uInt32>(redShift));
- pCounts[greenPos] = bitcount(sal::static_int_cast<sal_uInt32>(greenShift));
- pCounts[bluePos] = bitcount(sal::static_int_cast<sal_uInt32>(blueShift));
+ pCounts[redPos] = bitcount(redShift);
+ pCounts[greenPos] = bitcount(greenShift);
+ pCounts[bluePos] = bitcount(blueShift);
}
VclCanvasBitmap::VclCanvasBitmap( const BitmapEx& rBitmap ) :
@@ -206,9 +206,9 @@ VclCanvasBitmap::VclCanvasBitmap( const BitmapEx& rBitmap ) :
m_nBitsPerInputPixel = 24;
m_nEndianness = util::Endianness::LITTLE;
m_aLayout.IsMsbFirst = false; // doesn't matter
- setComponentInfo( 0xff0000LL,
- 0x00ff00LL,
- 0x0000ffLL );
+ setComponentInfo( static_cast<sal_uInt32>(0xff0000UL),
+ static_cast<sal_uInt32>(0x00ff00UL),
+ static_cast<sal_uInt32>(0x0000ffUL) );
break;
case BMP_FORMAT_24BIT_TC_RGB:
@@ -216,9 +216,9 @@ VclCanvasBitmap::VclCanvasBitmap( const BitmapEx& rBitmap ) :
m_nBitsPerInputPixel = 24;
m_nEndianness = util::Endianness::LITTLE;
m_aLayout.IsMsbFirst = false; // doesn't matter
- setComponentInfo( 0x0000ffLL,
- 0x00ff00LL,
- 0xff0000LL );
+ setComponentInfo( static_cast<sal_uInt32>(0x0000ffUL),
+ static_cast<sal_uInt32>(0x00ff00UL),
+ static_cast<sal_uInt32>(0xff0000UL) );
break;
case BMP_FORMAT_24BIT_TC_MASK:
commit aa62086495ecf3d5579ffc72df55698a9c943863
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date: Tue Aug 18 22:13:36 2015 +0200
sal_uLong to sal_uInt16 as return type of BitmapColor::GetColorError
Change-Id: I62c0d073d6b22346b65e3560303d7fc9373bfc7e
diff --git a/filter/source/msfilter/util.cxx b/filter/source/msfilter/util.cxx
index 3a2843e..f7e44c0 100644
--- a/filter/source/msfilter/util.cxx
+++ b/filter/source/msfilter/util.cxx
@@ -1392,8 +1392,8 @@ static bool HasSimilarScheme(const BitmapColor& rBitmapColor1, const BitmapColor
static sal_uInt16 GetBestIndex(const BitmapPalette& rPalette, const BitmapColor& rBitmapColor)
{
sal_uInt16 nReturn = 0;
+ sal_uInt16 nLastErr = SAL_MAX_UINT16;
bool bFound = false;
- sal_uLong nLastErr = 3 * 255 + 1;
// Prefer those colors which have similar scheme as the input
// Allow bigger and bigger variance of the schemes until we find
@@ -1404,7 +1404,7 @@ static sal_uInt16 GetBestIndex(const BitmapPalette& rPalette, const BitmapColor&
{
if( HasSimilarScheme(rBitmapColor, rPalette[i], nVariance) )
{
- sal_uLong nActErr = rBitmapColor.GetColorError( rPalette[i] );
+ const sal_uInt16 nActErr = rBitmapColor.GetColorError( rPalette[i] );
if( nActErr < nLastErr )
{
nLastErr = nActErr;
diff --git a/include/vcl/salbtype.hxx b/include/vcl/salbtype.hxx
index 15130a6..dfbc59d 100644
--- a/include/vcl/salbtype.hxx
+++ b/include/vcl/salbtype.hxx
@@ -138,7 +138,7 @@ public:
inline BitmapColor& Merge( const BitmapColor& rColor, sal_uInt8 cTransparency );
- inline sal_uLong GetColorError( const BitmapColor& rBitmapColor ) const;
+ inline sal_uInt16 GetColorError( const BitmapColor& rBitmapColor ) const;
};
// - BitmapPalette -
@@ -398,13 +398,14 @@ inline BitmapColor& BitmapColor::Merge( const BitmapColor& rBitmapColor, sal_uIn
-inline sal_uLong BitmapColor::GetColorError( const BitmapColor& rBitmapColor ) const
+inline sal_uInt16 BitmapColor::GetColorError( const BitmapColor& rBitmapColor ) const
{
DBG_ASSERT( !mbIndex, "Pixel represents index into colortable!" );
DBG_ASSERT( !rBitmapColor.mbIndex, "Pixel represents index into colortable!" );
- return( (sal_uLong) ( labs( mcBlueOrIndex - rBitmapColor.mcBlueOrIndex ) +
- labs( mcGreen - rBitmapColor.mcGreen ) +
- labs( mcRed - rBitmapColor.mcRed ) ) );
+ return static_cast<sal_uInt16>(
+ abs( static_cast<int>(mcBlueOrIndex) - static_cast<int>(rBitmapColor.mcBlueOrIndex) ) +
+ abs( static_cast<int>(mcGreen) - static_cast<int>(rBitmapColor.mcGreen) ) +
+ abs( static_cast<int>(mcRed) - static_cast<int>(rBitmapColor.mcRed) ) );
}
inline BitmapPalette::BitmapPalette() :
@@ -550,10 +551,10 @@ inline sal_uInt16 BitmapPalette::GetBestIndex( const BitmapColor& rCol ) const
return j;
}
- sal_uLong nLastErr = rCol.GetColorError( mpBitmapColor[ nRetIndex ] );
- for( sal_uInt16 i = 1; i < mnCount; ++i )
+ sal_uInt16 nLastErr = SAL_MAX_UINT16;
+ for( sal_uInt16 i = 0; i < mnCount; ++i )
{
- const sal_uLong nActErr = rCol.GetColorError( mpBitmapColor[ i ] );
+ const sal_uInt16 nActErr = rCol.GetColorError( mpBitmapColor[ i ] );
if ( nActErr < nLastErr )
{
nLastErr = nActErr;
commit e28c9ccb014df9616d7a3f3fa1f1b5866d836d94
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date: Tue Aug 18 08:15:38 2015 +0200
There's no need to loop backward, in the end
Change-Id: I2ef533fcc2ac29446a07b98ab34acf1887909c6b
diff --git a/include/vcl/salbtype.hxx b/include/vcl/salbtype.hxx
index fc94450..15130a6 100644
--- a/include/vcl/salbtype.hxx
+++ b/include/vcl/salbtype.hxx
@@ -550,22 +550,14 @@ inline sal_uInt16 BitmapPalette::GetBestIndex( const BitmapColor& rCol ) const
return j;
}
- nRetIndex = mnCount - 1;
- if( nRetIndex )
+ sal_uLong nLastErr = rCol.GetColorError( mpBitmapColor[ nRetIndex ] );
+ for( sal_uInt16 i = 1; i < mnCount; ++i )
{
- sal_uLong nLastErr = rCol.GetColorError( mpBitmapColor[ nRetIndex ] );
- sal_uInt16 i = nRetIndex - 1;
- for(;;)
+ const sal_uLong nActErr = rCol.GetColorError( mpBitmapColor[ i ] );
+ if ( nActErr < nLastErr )
{
- const sal_uLong nActErr = rCol.GetColorError( mpBitmapColor[ i ] );
- if ( nActErr < nLastErr )
- {
- nLastErr = nActErr;
- nRetIndex = i;
- }
- if (!i)
- break;
- --i;
+ nLastErr = nActErr;
+ nRetIndex = i;
}
}
}
commit 2c3fcc57ea38ad3e4fdd6808343e82321ec0028a
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date: Mon Aug 17 23:40:28 2015 +0200
Bail-out early and rework loops to use correct unsigned type
Change-Id: If70d600e1253e9d9271282c361e7edf01314eaa1
diff --git a/include/vcl/salbtype.hxx b/include/vcl/salbtype.hxx
index 11f263f..fc94450 100644
--- a/include/vcl/salbtype.hxx
+++ b/include/vcl/salbtype.hxx
@@ -544,28 +544,28 @@ inline sal_uInt16 BitmapPalette::GetBestIndex( const BitmapColor& rCol ) const
if( mpBitmapColor && mnCount )
{
- bool bFound = false;
-
- for( long j = 0L; ( j < mnCount ) && !bFound; j++ )
+ for( sal_uInt16 j = 0; j < mnCount; ++j )
if( rCol == mpBitmapColor[ j ] )
{
- nRetIndex = ( (sal_uInt16) j );
- bFound = true;
+ return j;
}
- if( !bFound )
+ nRetIndex = mnCount - 1;
+ if( nRetIndex )
{
- nRetIndex = mnCount - 1;
sal_uLong nLastErr = rCol.GetColorError( mpBitmapColor[ nRetIndex ] );
-
- for( long i = nRetIndex - 1; i >= 0L; i-- )
+ sal_uInt16 i = nRetIndex - 1;
+ for(;;)
{
const sal_uLong nActErr = rCol.GetColorError( mpBitmapColor[ i ] );
if ( nActErr < nLastErr )
{
nLastErr = nActErr;
- nRetIndex = (sal_uInt16) i;
+ nRetIndex = i;
}
+ if (!i)
+ break;
+ --i;
}
}
}
commit b6d799b5489918817c1ba7689b305cf21fd654ea
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date: Mon Aug 17 23:25:53 2015 +0200
Improve readability (minor code modification, formatting)
Change-Id: I2ce0087493f53579f155f8c399909cdb542aa8a3
diff --git a/include/vcl/salbtype.hxx b/include/vcl/salbtype.hxx
index 9528ffa..11f263f 100644
--- a/include/vcl/salbtype.hxx
+++ b/include/vcl/salbtype.hxx
@@ -548,15 +548,25 @@ inline sal_uInt16 BitmapPalette::GetBestIndex( const BitmapColor& rCol ) const
for( long j = 0L; ( j < mnCount ) && !bFound; j++ )
if( rCol == mpBitmapColor[ j ] )
- nRetIndex = ( (sal_uInt16) j ), bFound = true;
+ {
+ nRetIndex = ( (sal_uInt16) j );
+ bFound = true;
+ }
if( !bFound )
{
- long nActErr, nLastErr = rCol.GetColorError( mpBitmapColor[ nRetIndex = mnCount - 1 ] );
+ nRetIndex = mnCount - 1;
+ sal_uLong nLastErr = rCol.GetColorError( mpBitmapColor[ nRetIndex ] );
for( long i = nRetIndex - 1; i >= 0L; i-- )
- if ( ( nActErr = rCol.GetColorError( mpBitmapColor[ i ] ) ) < nLastErr )
- nLastErr = nActErr, nRetIndex = (sal_uInt16) i;
+ {
+ const sal_uLong nActErr = rCol.GetColorError( mpBitmapColor[ i ] );
+ if ( nActErr < nLastErr )
+ {
+ nLastErr = nActErr;
+ nRetIndex = (sal_uInt16) i;
+ }
+ }
}
}
@@ -674,7 +684,9 @@ inline void ColorMask::GetColorFor24Bit( BitmapColor& rColor, const sal_uInt8* p
inline void ColorMask::SetColorFor24Bit( const BitmapColor& rColor, sal_uInt8* pPixel ) const
{
const sal_uInt32 nVal = COLOR_TO_MASK( rColor, mnRMask, mnGMask, mnBMask, mnRShift, mnGShift, mnBShift, mnAlphaChannel );
- pPixel[ 0 ] = (sal_uInt8) nVal; pPixel[ 1 ] = (sal_uInt8) ( nVal >> 8UL ); pPixel[ 2 ] = (sal_uInt8) ( nVal >> 16UL );
+ pPixel[ 0 ] = (sal_uInt8) nVal;
+ pPixel[ 1 ] = (sal_uInt8) ( nVal >> 8UL );
+ pPixel[ 2 ] = (sal_uInt8) ( nVal >> 16UL );
}
inline void ColorMask::GetColorFor32Bit( BitmapColor& rColor, const sal_uInt8* pPixel ) const
@@ -697,8 +709,10 @@ inline void ColorMask::GetColorAndAlphaFor32Bit( BitmapColor& rColor, sal_uInt8&
inline void ColorMask::SetColorFor32Bit( const BitmapColor& rColor, sal_uInt8* pPixel ) const
{
const sal_uInt32 nVal = COLOR_TO_MASK( rColor, mnRMask, mnGMask, mnBMask, mnRShift, mnGShift, mnBShift, mnAlphaChannel );
- pPixel[ 0 ] = (sal_uInt8) nVal; pPixel[ 1 ] = (sal_uInt8) ( nVal >> 8UL );
- pPixel[ 2 ] = (sal_uInt8) ( nVal >> 16UL ); pPixel[ 3 ] = (sal_uInt8) ( nVal >> 24UL );
+ pPixel[ 0 ] = (sal_uInt8) nVal;
+ pPixel[ 1 ] = (sal_uInt8) ( nVal >> 8UL );
+ pPixel[ 2 ] = (sal_uInt8) ( nVal >> 16UL );
+ pPixel[ 3 ] = (sal_uInt8) ( nVal >> 24UL );
}
#endif // INCLUDED_VCL_SALBTYPE_HXX
commit a3b3da8d98d56527c6522bfefe1d52e27740e10e
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date: Sun Aug 16 21:17:00 2015 +0200
Force #defined constants to sal_uInt32 to reduce conversion warnings
Change-Id: I3968bcd55ab4d0ff6215f76be242acc17cf5ccab
diff --git a/registry/source/reflcnst.hxx b/registry/source/reflcnst.hxx
index 78fab51..ae1acd2 100644
--- a/registry/source/reflcnst.hxx
+++ b/registry/source/reflcnst.hxx
@@ -32,54 +32,54 @@ extern const sal_uInt16 minorVersion;
extern const sal_uInt16 majorVersion;
#define OFFSET_MAGIC 0
-#define OFFSET_SIZE (OFFSET_MAGIC + sizeof(magic))
-#define OFFSET_MINOR_VERSION (OFFSET_SIZE + sizeof(sal_uInt32))
-#define OFFSET_MAJOR_VERSION (OFFSET_MINOR_VERSION + sizeof(minorVersion))
-#define OFFSET_N_ENTRIES (OFFSET_MAJOR_VERSION + sizeof(sal_uInt16))
-#define OFFSET_TYPE_SOURCE (OFFSET_N_ENTRIES + sizeof(sal_uInt16))
-#define OFFSET_TYPE_CLASS (OFFSET_TYPE_SOURCE + sizeof(sal_uInt16))
-#define OFFSET_THIS_TYPE (OFFSET_TYPE_CLASS + sizeof(sal_uInt16))
-#define OFFSET_UIK (OFFSET_THIS_TYPE + sizeof(sal_uInt16))
-#define OFFSET_DOKU (OFFSET_UIK + sizeof(sal_uInt16))
-#define OFFSET_FILENAME (OFFSET_DOKU + sizeof(sal_uInt16))
-
-#define OFFSET_N_SUPERTYPES (OFFSET_FILENAME + sizeof(sal_uInt16))
-#define OFFSET_SUPERTYPES (OFFSET_N_SUPERTYPES + sizeof(sal_uInt16))
-
-#define OFFSET_CP_SIZE (OFFSET_SUPERTYPES + sizeof(sal_uInt16))
-#define OFFSET_CP (OFFSET_CP_SIZE + sizeof(sal_uInt16))
+#define OFFSET_SIZE static_cast<sal_uInt32>(OFFSET_MAGIC + sizeof(magic))
+#define OFFSET_MINOR_VERSION static_cast<sal_uInt32>(OFFSET_SIZE + sizeof(sal_uInt32))
+#define OFFSET_MAJOR_VERSION static_cast<sal_uInt32>(OFFSET_MINOR_VERSION + sizeof(minorVersion))
+#define OFFSET_N_ENTRIES static_cast<sal_uInt32>(OFFSET_MAJOR_VERSION + sizeof(majorVersion))
+#define OFFSET_TYPE_SOURCE static_cast<sal_uInt32>(OFFSET_N_ENTRIES + sizeof(sal_uInt16))
+#define OFFSET_TYPE_CLASS static_cast<sal_uInt32>(OFFSET_TYPE_SOURCE + sizeof(sal_uInt16))
+#define OFFSET_THIS_TYPE static_cast<sal_uInt32>(OFFSET_TYPE_CLASS + sizeof(sal_uInt16))
+#define OFFSET_UIK static_cast<sal_uInt32>(OFFSET_THIS_TYPE + sizeof(sal_uInt16))
+#define OFFSET_DOKU static_cast<sal_uInt32>(OFFSET_UIK + sizeof(sal_uInt16))
+#define OFFSET_FILENAME static_cast<sal_uInt32>(OFFSET_DOKU + sizeof(sal_uInt16))
+
+#define OFFSET_N_SUPERTYPES static_cast<sal_uInt32>(OFFSET_FILENAME + sizeof(sal_uInt16))
+#define OFFSET_SUPERTYPES static_cast<sal_uInt32>(OFFSET_N_SUPERTYPES + sizeof(sal_uInt16))
+
+#define OFFSET_CP_SIZE static_cast<sal_uInt32>(OFFSET_SUPERTYPES + sizeof(sal_uInt16))
+#define OFFSET_CP static_cast<sal_uInt32>(OFFSET_CP_SIZE + sizeof(sal_uInt16))
#define CP_OFFSET_ENTRY_SIZE 0
-#define CP_OFFSET_ENTRY_TAG (CP_OFFSET_ENTRY_SIZE + sizeof(sal_uInt32))
-#define CP_OFFSET_ENTRY_DATA (CP_OFFSET_ENTRY_TAG + sizeof(sal_uInt16))
-#define CP_OFFSET_ENTRY_UIK1 CP_OFFSET_ENTRY_DATA
-#define CP_OFFSET_ENTRY_UIK2 (CP_OFFSET_ENTRY_UIK1 + sizeof(sal_uInt32))
-#define CP_OFFSET_ENTRY_UIK3 (CP_OFFSET_ENTRY_UIK2 + sizeof(sal_uInt16))
-#define CP_OFFSET_ENTRY_UIK4 (CP_OFFSET_ENTRY_UIK3 + sizeof(sal_uInt16))
-#define CP_OFFSET_ENTRY_UIK5 (CP_OFFSET_ENTRY_UIK4 + sizeof(sal_uInt32))
+#define CP_OFFSET_ENTRY_TAG static_cast<sal_uInt32>(CP_OFFSET_ENTRY_SIZE + sizeof(sal_uInt32))
+#define CP_OFFSET_ENTRY_DATA static_cast<sal_uInt32>(CP_OFFSET_ENTRY_TAG + sizeof(sal_uInt16))
+#define CP_OFFSET_ENTRY_UIK1 static_cast<sal_uInt32>(CP_OFFSET_ENTRY_DATA)
+#define CP_OFFSET_ENTRY_UIK2 static_cast<sal_uInt32>(CP_OFFSET_ENTRY_UIK1 + sizeof(sal_uInt32))
+#define CP_OFFSET_ENTRY_UIK3 static_cast<sal_uInt32>(CP_OFFSET_ENTRY_UIK2 + sizeof(sal_uInt16))
+#define CP_OFFSET_ENTRY_UIK4 static_cast<sal_uInt32>(CP_OFFSET_ENTRY_UIK3 + sizeof(sal_uInt16))
+#define CP_OFFSET_ENTRY_UIK5 static_cast<sal_uInt32>(CP_OFFSET_ENTRY_UIK4 + sizeof(sal_uInt32))
#define FIELD_OFFSET_ACCESS 0
-#define FIELD_OFFSET_NAME (FIELD_OFFSET_ACCESS + sizeof(sal_uInt16))
-#define FIELD_OFFSET_TYPE (FIELD_OFFSET_NAME + sizeof(sal_uInt16))
-#define FIELD_OFFSET_VALUE (FIELD_OFFSET_TYPE + sizeof(sal_uInt16))
-#define FIELD_OFFSET_DOKU (FIELD_OFFSET_VALUE + sizeof(sal_uInt16))
-#define FIELD_OFFSET_FILENAME (FIELD_OFFSET_DOKU + sizeof(sal_uInt16))
+#define FIELD_OFFSET_NAME static_cast<sal_uInt32>(FIELD_OFFSET_ACCESS + sizeof(sal_uInt16))
+#define FIELD_OFFSET_TYPE static_cast<sal_uInt32>(FIELD_OFFSET_NAME + sizeof(sal_uInt16))
+#define FIELD_OFFSET_VALUE static_cast<sal_uInt32>(FIELD_OFFSET_TYPE + sizeof(sal_uInt16))
+#define FIELD_OFFSET_DOKU static_cast<sal_uInt32>(FIELD_OFFSET_VALUE + sizeof(sal_uInt16))
+#define FIELD_OFFSET_FILENAME static_cast<sal_uInt32>(FIELD_OFFSET_DOKU + sizeof(sal_uInt16))
#define PARAM_OFFSET_TYPE 0
-#define PARAM_OFFSET_MODE (PARAM_OFFSET_TYPE + sizeof(sal_uInt16))
-#define PARAM_OFFSET_NAME (PARAM_OFFSET_MODE + sizeof(sal_uInt16))
+#define PARAM_OFFSET_MODE static_cast<sal_uInt32>(PARAM_OFFSET_TYPE + sizeof(sal_uInt16))
+#define PARAM_OFFSET_NAME static_cast<sal_uInt32>(PARAM_OFFSET_MODE + sizeof(sal_uInt16))
#define METHOD_OFFSET_SIZE 0
-#define METHOD_OFFSET_MODE (METHOD_OFFSET_SIZE + sizeof(sal_uInt16))
-#define METHOD_OFFSET_NAME (METHOD_OFFSET_MODE + sizeof(sal_uInt16))
-#define METHOD_OFFSET_RETURN (METHOD_OFFSET_NAME + sizeof(sal_uInt16))
-#define METHOD_OFFSET_DOKU (METHOD_OFFSET_RETURN + sizeof(sal_uInt16))
-#define METHOD_OFFSET_PARAM_COUNT (METHOD_OFFSET_DOKU + sizeof(sal_uInt16))
+#define METHOD_OFFSET_MODE static_cast<sal_uInt32>(METHOD_OFFSET_SIZE + sizeof(sal_uInt16))
+#define METHOD_OFFSET_NAME static_cast<sal_uInt32>(METHOD_OFFSET_MODE + sizeof(sal_uInt16))
+#define METHOD_OFFSET_RETURN static_cast<sal_uInt32>(METHOD_OFFSET_NAME + sizeof(sal_uInt16))
+#define METHOD_OFFSET_DOKU static_cast<sal_uInt32>(METHOD_OFFSET_RETURN + sizeof(sal_uInt16))
+#define METHOD_OFFSET_PARAM_COUNT static_cast<sal_uInt32>(METHOD_OFFSET_DOKU + sizeof(sal_uInt16))
#define REFERENCE_OFFSET_TYPE 0
-#define REFERENCE_OFFSET_NAME (REFERENCE_OFFSET_TYPE + sizeof(sal_uInt16))
-#define REFERENCE_OFFSET_DOKU (REFERENCE_OFFSET_NAME + sizeof(sal_uInt16))
-#define REFERENCE_OFFSET_ACCESS (REFERENCE_OFFSET_DOKU + sizeof(sal_uInt16))
+#define REFERENCE_OFFSET_NAME static_cast<sal_uInt32>(REFERENCE_OFFSET_TYPE + sizeof(sal_uInt16))
+#define REFERENCE_OFFSET_DOKU static_cast<sal_uInt32>(REFERENCE_OFFSET_NAME + sizeof(sal_uInt16))
+#define REFERENCE_OFFSET_ACCESS static_cast<sal_uInt32>(REFERENCE_OFFSET_DOKU + sizeof(sal_uInt16))
enum CPInfoTag
{
commit c80833fd0e092dbac42bfb2e3f7dc61a50191695
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date: Sun Aug 16 16:59:34 2015 +0200
Use sal_uInt16, as required, and use < in for loop condition
Change-Id: Iae44d45d749c6f51be72c0b2d16639c7287c42b2
diff --git a/unoidl/source/legacyprovider.cxx b/unoidl/source/legacyprovider.cxx
index 9c0b21d..b9ee5e5 100644
--- a/unoidl/source/legacyprovider.cxx
+++ b/unoidl/source/legacyprovider.cxx
@@ -371,7 +371,7 @@ rtl::Reference< Entity > readEntity(
return new Module(manager, ucr, sub);
case RT_TYPE_STRUCT:
{
- sal_uInt32 n = reader.getReferenceCount();
+ sal_uInt16 n = reader.getReferenceCount();
if (n == 0) {
OUString base;
switch (reader.getSuperTypeCount()) {
@@ -390,7 +390,7 @@ rtl::Reference< Entity > readEntity(
}
std::vector< PlainStructTypeEntity::Member > mems;
n = reader.getFieldCount();
- for (sal_uInt32 j = 0; j != n; ++j) {
+ for (sal_uInt16 j = 0; j < n; ++j) {
mems.push_back(
PlainStructTypeEntity::Member(
reader.getFieldName(j),
@@ -411,13 +411,13 @@ rtl::Reference< Entity > readEntity(
" with key " + sub.getName()));
}
std::vector< OUString > params;
- for (sal_uInt32 j = 0; j != n; ++j) {
+ for (sal_uInt16 j = 0; j < n; ++j) {
params.push_back(
reader.getReferenceTypeName(j).replace('/', '.'));
}
std::vector< PolymorphicStructTypeTemplateEntity::Member > mems;
n = reader.getFieldCount();
- for (sal_uInt32 j = 0; j != n; ++j) {
+ for (sal_uInt16 j = 0; j < n; ++j) {
mems.push_back(
PolymorphicStructTypeTemplateEntity::Member(
reader.getFieldName(j),
commit eb4cbea657b9038c488f1b1bcf5107cc226a6681
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date: Sun Aug 16 16:32:13 2015 +0200
Silence some conversion warnings
Change-Id: I676ed010576f3a24b193ffc6c28a319bcc5ac968
diff --git a/store/source/lockbyte.cxx b/store/source/lockbyte.cxx
index 0992540..5521993 100644
--- a/store/source/lockbyte.cxx
+++ b/store/source/lockbyte.cxx
@@ -95,7 +95,7 @@ storeError ILockBytes::readAt (sal_uInt32 nOffset, void * pBuffer, sal_uInt32 nB
if (src_size > SAL_MAX_UINT32)
return store_E_CantSeek;
- return readAt_Impl (nOffset, dst_lo, (dst_hi - dst_lo));
+ return readAt_Impl (nOffset, dst_lo, nBytes);
}
storeError ILockBytes::writeAt (sal_uInt32 nOffset, void const * pBuffer, sal_uInt32 nBytes)
@@ -117,7 +117,7 @@ storeError ILockBytes::writeAt (sal_uInt32 nOffset, void const * pBuffer, sal_uI
if (dst_size > SAL_MAX_UINT32)
return store_E_CantSeek;
- return writeAt_Impl (nOffset, src_lo, (src_hi - src_lo));
+ return writeAt_Impl (nOffset, src_lo, nBytes);
}
storeError ILockBytes::getSize (sal_uInt32 & rnSize)
diff --git a/store/source/storbase.hxx b/store/source/storbase.hxx
index 395870f..78a51a1 100644
--- a/store/source/storbase.hxx
+++ b/store/source/storbase.hxx
@@ -512,9 +512,9 @@ struct PageData
void guard (sal_uInt32 nAddr)
{
sal_uInt32 nCRC32 = 0;
- nCRC32 = rtl_crc32 (nCRC32, &m_aGuard.m_nMagic, sizeof(sal_uInt32));
+ nCRC32 = rtl_crc32 (nCRC32, &m_aGuard.m_nMagic, static_cast<sal_uInt32>(sizeof(sal_uInt32)));
m_aDescr.m_nAddr = store::htonl(nAddr);
- nCRC32 = rtl_crc32 (nCRC32, &m_aDescr, theSize - sizeof(G));
+ nCRC32 = rtl_crc32 (nCRC32, &m_aDescr, static_cast<sal_uInt32>(theSize - sizeof(G)));
m_aGuard.m_nCRC32 = store::htonl(nCRC32);
}
@@ -523,8 +523,8 @@ struct PageData
storeError verify (sal_uInt32 nAddr) const
{
sal_uInt32 nCRC32 = 0;
- nCRC32 = rtl_crc32 (nCRC32, &m_aGuard.m_nMagic, sizeof(sal_uInt32));
- nCRC32 = rtl_crc32 (nCRC32, &m_aDescr, theSize - sizeof(G));
+ nCRC32 = rtl_crc32 (nCRC32, &m_aGuard.m_nMagic, static_cast<sal_uInt32>(sizeof(sal_uInt32)));
+ nCRC32 = rtl_crc32 (nCRC32, &m_aDescr, static_cast<sal_uInt32>(theSize - sizeof(G)));
if (m_aGuard.m_nCRC32 != store::htonl(nCRC32))
return store_E_InvalidChecksum;
if (m_aDescr.m_nAddr != store::htonl(nAddr))
diff --git a/store/source/storbios.cxx b/store/source/storbios.cxx
index 9f494f1..0b06795 100644
--- a/store/source/storbios.cxx
+++ b/store/source/storbios.cxx
@@ -120,8 +120,8 @@ struct OStoreSuperBlock
void guard()
{
sal_uInt32 nCRC32 = 0;
- nCRC32 = rtl_crc32 (nCRC32, &m_aGuard.m_nMagic, sizeof(sal_uInt32));
- nCRC32 = rtl_crc32 (nCRC32, &m_aDescr, theSize - sizeof(G));
+ nCRC32 = rtl_crc32 (nCRC32, &m_aGuard.m_nMagic, static_cast<sal_uInt32>(sizeof(sal_uInt32)));
+ nCRC32 = rtl_crc32 (nCRC32, &m_aDescr, static_cast<sal_uInt32>(theSize - sizeof(G)));
m_aGuard.m_nCRC32 = store::htonl(nCRC32);
}
@@ -134,8 +134,8 @@ struct OStoreSuperBlock
return store_E_WrongFormat;
sal_uInt32 nCRC32 = 0;
- nCRC32 = rtl_crc32 (nCRC32, &m_aGuard.m_nMagic, sizeof(sal_uInt32));
- nCRC32 = rtl_crc32 (nCRC32, &m_aDescr, theSize - sizeof(G));
+ nCRC32 = rtl_crc32 (nCRC32, &m_aGuard.m_nMagic, static_cast<sal_uInt32>(sizeof(sal_uInt32)));
+ nCRC32 = rtl_crc32 (nCRC32, &m_aDescr, static_cast<sal_uInt32>(theSize - sizeof(G)));
if (m_aGuard.m_nCRC32 != store::htonl(nCRC32))
return store_E_InvalidChecksum;
else
diff --git a/store/source/storcach.cxx b/store/source/storcach.cxx
index 072679c..1b7243d 100644
--- a/store/source/storcach.cxx
+++ b/store/source/storcach.cxx
@@ -244,7 +244,7 @@ class PageCache_Impl :
static inline int hash_Impl(sal_uInt32 a, size_t s, size_t q, size_t m)
{
- return ((((a) + ((a) >> (s)) + ((a) >> ((s) << 1))) >> (q)) & (m));
+ return static_cast<int>((((a) + ((a) >> (s)) + ((a) >> ((s) << 1))) >> (q)) & (m));
}
inline int hash_index_Impl (sal_uInt32 nOffset)
{
diff --git a/store/source/stordata.hxx b/store/source/stordata.hxx
index fa16664..17de3c3 100644
--- a/store/source/stordata.hxx
+++ b/store/source/stordata.hxx
@@ -63,7 +63,7 @@ struct OStoreDataPageData : public store::OStorePageData
*/
static sal_uInt16 capacity (const D& rDescr) // @see inode::ChunkDescriptor
{
- return (store::ntohs(rDescr.m_nSize) - self::thePageSize);
+ return static_cast<sal_uInt16>(store::ntohs(rDescr.m_nSize) - self::thePageSize);
}
sal_uInt16 capacity() const
{
@@ -149,7 +149,7 @@ struct OStoreIndirectionPageData : public store::OStorePageData
*/
static sal_uInt16 capacity (const D& rDescr)
{
- return (store::ntohs(rDescr.m_nSize) - self::thePageSize);
+ return static_cast<sal_uInt16>(store::ntohs(rDescr.m_nSize) - self::thePageSize);
}
sal_uInt16 capacity() const
{
@@ -320,8 +320,8 @@ struct OStorePageNameBlock
void guard()
{
sal_uInt32 nCRC32 = 0;
- nCRC32 = rtl_crc32 (nCRC32, &m_aGuard.m_nMagic, sizeof(sal_uInt32));
- nCRC32 = rtl_crc32 (nCRC32, &m_aKey, theSize - sizeof(G));
+ nCRC32 = rtl_crc32 (nCRC32, &m_aGuard.m_nMagic, static_cast<sal_uInt32>(sizeof(sal_uInt32)));
+ nCRC32 = rtl_crc32 (nCRC32, &m_aKey, static_cast<sal_uInt32>(theSize - sizeof(G)));
m_aGuard.m_nCRC32 = store::htonl(nCRC32);
}
@@ -330,8 +330,8 @@ struct OStorePageNameBlock
storeError verify() const
{
sal_uInt32 nCRC32 = 0;
- nCRC32 = rtl_crc32 (nCRC32, &m_aGuard.m_nMagic, sizeof(sal_uInt32));
- nCRC32 = rtl_crc32 (nCRC32, &m_aKey, theSize - sizeof(G));
+ nCRC32 = rtl_crc32 (nCRC32, &m_aGuard.m_nMagic, static_cast<sal_uInt32>(sizeof(sal_uInt32)));
+ nCRC32 = rtl_crc32 (nCRC32, &m_aKey, static_cast<sal_uInt32>(theSize - sizeof(G)));
if (m_aGuard.m_nCRC32 != store::htonl(nCRC32))
return store_E_InvalidChecksum;
else
@@ -424,8 +424,8 @@ struct OStoreDirectoryDataBlock
void guard()
{
sal_uInt32 nCRC32 = 0;
- nCRC32 = rtl_crc32 (nCRC32, &m_aGuard.m_nMagic, sizeof(sal_uInt32));
- nCRC32 = rtl_crc32 (nCRC32, &m_aTable, theSize - sizeof(G));
+ nCRC32 = rtl_crc32 (nCRC32, &m_aGuard.m_nMagic, static_cast<sal_uInt32>(sizeof(sal_uInt32)));
+ nCRC32 = rtl_crc32 (nCRC32, &m_aTable, static_cast<sal_uInt32>(theSize - sizeof(G)));
m_aGuard.m_nCRC32 = store::htonl(nCRC32);
}
@@ -434,8 +434,8 @@ struct OStoreDirectoryDataBlock
storeError verify() const
{
sal_uInt32 nCRC32 = 0;
- nCRC32 = rtl_crc32 (nCRC32, &m_aGuard.m_nMagic, sizeof(sal_uInt32));
- nCRC32 = rtl_crc32 (nCRC32, &m_aTable, theSize - sizeof(G));
+ nCRC32 = rtl_crc32 (nCRC32, &m_aGuard.m_nMagic, static_cast<sal_uInt32>(sizeof(sal_uInt32)));
+ nCRC32 = rtl_crc32 (nCRC32, &m_aTable, static_cast<sal_uInt32>(theSize - sizeof(G)));
if (m_aGuard.m_nCRC32 != store::htonl(nCRC32))
return store_E_InvalidChecksum;
else
@@ -547,7 +547,7 @@ struct OStoreDirectoryPageData : public store::OStorePageData
*/
sal_uInt16 capacity() const
{
- return (store::ntohs(base::m_aDescr.m_nSize) - self::thePageSize);
+ return static_cast<sal_uInt16>(store::ntohs(base::m_aDescr.m_nSize) - self::thePageSize);
}
/** Construction.
diff --git a/store/source/stordir.cxx b/store/source/stordir.cxx
index 77ea3f0..08233d0 100644
--- a/store/source/stordir.cxx
+++ b/store/source/stordir.cxx
@@ -191,7 +191,7 @@ storeError OStoreDirectory_Impl::iterate (storeFindData &rFindData)
memset (&rFindData.m_pszName[n], 0, k);
}
- rFindData.m_nLength = n;
+ rFindData.m_nLength = static_cast<sal_Int32>(n);
rFindData.m_nAttrib |= aPage.attrib();
rFindData.m_nSize = aPage.dataLength();
diff --git a/store/source/stortree.hxx b/store/source/stortree.hxx
index c3c5b6f..7c86563 100644
--- a/store/source/stortree.hxx
+++ b/store/source/stortree.hxx
@@ -128,7 +128,7 @@ struct OStoreBTreeNodeData : public store::OStorePageData
*/
sal_uInt16 capacity() const
{
- return (store::ntohs(base::m_aDescr.m_nSize) - self::thePageSize);
+ return static_cast<sal_uInt16>(store::ntohs(base::m_aDescr.m_nSize) - self::thePageSize);
}
/** capacityCount (must be even).
@@ -142,7 +142,7 @@ struct OStoreBTreeNodeData : public store::OStorePageData
*/
sal_uInt16 usage() const
{
- return (store::ntohs(base::m_aDescr.m_nUsed) - self::thePageSize);
+ return static_cast<sal_uInt16>(store::ntohs(base::m_aDescr.m_nUsed) - self::thePageSize);
}
/** usageCount.
More information about the Libreoffice-commits
mailing list