From 8456c2ba408b3bed160d3e5f050738301b225bd5 Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Fri, 12 Jan 2018 20:13:01 +0100 Subject: More loplugin:cstylecast: tools auto-rewrite with "Enable loplugin:cstylecast for some more cases" plus solenv/clang-format/reformat-formatted-files Change-Id: Ifb9ebc9623c8df14ea0d4c907001bd16c5b9ae59 --- tools/qa/cppunit/test_fract.cxx | 2 +- tools/source/datetime/tdate.cxx | 16 +++--- tools/source/datetime/ttime.cxx | 2 +- tools/source/generic/b3dtrans.cxx | 8 +-- tools/source/generic/bigint.cxx | 102 +++++++++++++++++++------------------- tools/source/generic/color.cxx | 46 ++++++++--------- tools/source/generic/point.cxx | 4 +- tools/source/generic/poly.cxx | 26 +++++----- tools/source/inet/inetmsg.cxx | 2 +- tools/source/memtools/mempool.cxx | 2 +- tools/source/ref/globname.cxx | 30 +++++------ tools/source/stream/stream.cxx | 48 +++++++++--------- tools/source/stream/strmunx.cxx | 12 ++--- tools/source/zcodec/zcodec.cxx | 6 +-- 14 files changed, 153 insertions(+), 153 deletions(-) (limited to 'tools') diff --git a/tools/qa/cppunit/test_fract.cxx b/tools/qa/cppunit/test_fract.cxx index 83794340ed51..774427915392 100644 --- a/tools/qa/cppunit/test_fract.cxx +++ b/tools/qa/cppunit/test_fract.cxx @@ -36,7 +36,7 @@ public: { const Fraction aFract(1082130431,1073741824); CPPUNIT_ASSERT_MESSAGE( "Fraction #1 not approximately equal to 1.007812499068677", - rtl::math::approxEqual((double)aFract,1.007812499068677) ); + rtl::math::approxEqual(static_cast(aFract),1.007812499068677) ); Fraction aFract2( aFract ); aFract2.ReduceInaccurate(8); diff --git a/tools/source/datetime/tdate.cxx b/tools/source/datetime/tdate.cxx index 93cf49b0ce9c..f6073b85451e 100644 --- a/tools/source/datetime/tdate.cxx +++ b/tools/source/datetime/tdate.cxx @@ -340,13 +340,13 @@ sal_uInt16 Date::GetWeekOfYear( DayOfWeek eStartDay, sal_Int16 nMinimumNumberOfDaysInWeek ) const { short nWeek; - short n1WDay = (short)Date( 1, 1, GetYear() ).GetDayOfWeek(); - short nDayOfYear = (short)GetDayOfYear(); + short n1WDay = static_cast(Date( 1, 1, GetYear() ).GetDayOfWeek()); + short nDayOfYear = static_cast(GetDayOfYear()); // weekdays start at 0, thus decrement one nDayOfYear--; // account for StartDay - n1WDay = (n1WDay+(7-(short)eStartDay)) % 7; + n1WDay = (n1WDay+(7-static_cast(eStartDay))) % 7; if (nMinimumNumberOfDaysInWeek < 1 || 7 < nMinimumNumberOfDaysInWeek) { @@ -363,9 +363,9 @@ sal_uInt16 Date::GetWeekOfYear( DayOfWeek eStartDay, nWeek = 1; else if ( nWeek == 53 ) { - short nDaysInYear = (short)GetDaysInYear(); - short nDaysNextYear = (short)Date( 1, 1, GetNextYear() ).GetDayOfWeek(); - nDaysNextYear = (nDaysNextYear+(7-(short)eStartDay)) % 7; + short nDaysInYear = static_cast(GetDaysInYear()); + short nDaysNextYear = static_cast(Date( 1, 1, GetNextYear() ).GetDayOfWeek()); + nDaysNextYear = (nDaysNextYear+(7-static_cast(eStartDay))) % 7; if ( nDayOfYear > (nDaysInYear-nDaysNextYear-1) ) nWeek = 1; } @@ -413,13 +413,13 @@ sal_uInt16 Date::GetWeekOfYear( DayOfWeek eStartDay, // == still the same week! sal_Int32 nTempDays = GetAsNormalizedDays(); - nTempDays += 6 - (GetDayOfWeek()+(7-(short)eStartDay)) % 7; + nTempDays += 6 - (GetDayOfWeek()+(7-static_cast(eStartDay))) % 7; nWeek = lcl_DaysToDate( nTempDays ).GetWeekOfYear( eStartDay, nMinimumNumberOfDaysInWeek ); } } } - return (sal_uInt16)nWeek; + return static_cast(nWeek); } sal_uInt16 Date::GetDaysInMonth() const diff --git a/tools/source/datetime/ttime.cxx b/tools/source/datetime/ttime.cxx index cf8108306e06..d74c7659235f 100644 --- a/tools/source/datetime/ttime.cxx +++ b/tools/source/datetime/ttime.cxx @@ -407,7 +407,7 @@ Time tools::Time::GetUTCOffset() } nTempTime = abs( nCacheSecOffset ); - tools::Time aTime( 0, (sal_uInt16)nTempTime ); + tools::Time aTime( 0, static_cast(nTempTime) ); if ( nCacheSecOffset < 0 ) aTime = -aTime; return aTime; diff --git a/tools/source/generic/b3dtrans.cxx b/tools/source/generic/b3dtrans.cxx index 1162f24993f6..f2210705112a 100644 --- a/tools/source/generic/b3dtrans.cxx +++ b/tools/source/generic/b3dtrans.cxx @@ -214,8 +214,8 @@ void B3dTransformationSet::CalcViewport() if(GetRatio() != 0.0) { // Compute current aspect ratio of boundaries - double fBoundWidth = (double)(maViewportRectangle.GetWidth() + 1); - double fBoundHeight = (double)(maViewportRectangle.GetHeight() + 1); + double fBoundWidth = static_cast(maViewportRectangle.GetWidth() + 1); + double fBoundHeight = static_cast(maViewportRectangle.GetHeight() + 1); double fActRatio = 1; double fFactor; @@ -270,8 +270,8 @@ void B3dTransformationSet::CalcViewport() // fill parameters for ViewportTransformation // Translation - maTranslate.setX((double)maSetBound.Left() + ((maSetBound.GetWidth() - 1) / 2.0)); - maTranslate.setY((double)maSetBound.Top() + ((maSetBound.GetHeight() - 1) / 2.0)); + maTranslate.setX(static_cast(maSetBound.Left()) + ((maSetBound.GetWidth() - 1) / 2.0)); + maTranslate.setY(static_cast(maSetBound.Top()) + ((maSetBound.GetHeight() - 1) / 2.0)); maTranslate.setZ(ZBUFFER_DEPTH_RANGE / 2.0); // Scaling diff --git a/tools/source/generic/bigint.cxx b/tools/source/generic/bigint.cxx index 6fa9a2c472f0..e80a513496c4 100644 --- a/tools/source/generic/bigint.cxx +++ b/tools/source/generic/bigint.cxx @@ -65,8 +65,8 @@ void BigInt::MakeBigInt( const BigInt& rVal ) nTmp = nVal; } - nNum[0] = (sal_uInt16)(nTmp & 0xffffL); - nNum[1] = (sal_uInt16)(nTmp >> 16); + nNum[0] = static_cast(nTmp & 0xffffL); + nNum[1] = static_cast(nTmp >> 16); if ( nTmp & 0xffff0000L ) nLen = 2; else @@ -88,7 +88,7 @@ void BigInt::Normalize() else if ( nNum[1] & 0x8000 ) return; else - nVal = ((sal_Int32)nNum[1] << 16) + nNum[0]; + nVal = (static_cast(nNum[1]) << 16) + nNum[0]; bIsBig = false; @@ -109,9 +109,9 @@ void BigInt::Mult( const BigInt &rVal, sal_uInt16 nMul ) sal_uInt16 nK = 0; for ( int i = 0; i < rVal.nLen; i++ ) { - sal_uInt32 nTmp = (sal_uInt32)rVal.nNum[i] * (sal_uInt32)nMul + nK; - nK = (sal_uInt16)(nTmp >> 16); - nNum[i] = (sal_uInt16)nTmp; + sal_uInt32 nTmp = static_cast(rVal.nNum[i]) * static_cast(nMul) + nK; + nK = static_cast(nTmp >> 16); + nNum[i] = static_cast(nTmp); } if ( nK ) @@ -131,11 +131,11 @@ void BigInt::Div( sal_uInt16 nDiv, sal_uInt16& rRem ) sal_uInt32 nK = 0; for ( int i = nLen - 1; i >= 0; i-- ) { - sal_uInt32 nTmp = (sal_uInt32)nNum[i] + (nK << 16); - nNum[i] = (sal_uInt16)(nTmp / nDiv); + sal_uInt32 nTmp = static_cast(nNum[i]) + (nK << 16); + nNum[i] = static_cast(nTmp / nDiv); nK = nTmp % nDiv; } - rRem = (sal_uInt16)nK; + rRem = static_cast(nK); if ( nNum[nLen-1] == 0 ) nLen -= 1; @@ -181,12 +181,12 @@ void BigInt::AddLong( BigInt& rB, BigInt& rErg ) sal_Int32 k; sal_Int32 nZ = 0; for (i = 0, k = 0; i < len; i++) { - nZ = (sal_Int32)nNum[i] + (sal_Int32)rB.nNum[i] + k; + nZ = static_cast(nNum[i]) + static_cast(rB.nNum[i]) + k; if (nZ & 0xff0000L) k = 1; else k = 0; - rErg.nNum[i] = (sal_uInt16)(nZ & 0xffffL); + rErg.nNum[i] = static_cast(nZ & 0xffffL); } // If an overflow occurred, add to solution if (nZ & 0xff0000L) // or if(k) @@ -241,12 +241,12 @@ void BigInt::SubLong( BigInt& rB, BigInt& rErg ) { for (i = 0, k = 0; i < len; i++) { - nZ = (sal_Int32)nNum[i] - (sal_Int32)rB.nNum[i] + k; + nZ = static_cast(nNum[i]) - static_cast(rB.nNum[i]) + k; if (nZ < 0) k = -1; else k = 0; - rErg.nNum[i] = (sal_uInt16)(nZ & 0xffffL); + rErg.nNum[i] = static_cast(nZ & 0xffffL); } rErg.bIsNeg = bIsNeg; } @@ -254,12 +254,12 @@ void BigInt::SubLong( BigInt& rB, BigInt& rErg ) { for (i = 0, k = 0; i < len; i++) { - nZ = (sal_Int32)rB.nNum[i] - (sal_Int32)nNum[i] + k; + nZ = static_cast(rB.nNum[i]) - static_cast(nNum[i]) + k; if (nZ < 0) k = -1; else k = 0; - rErg.nNum[i] = (sal_uInt16)(nZ & 0xffffL); + rErg.nNum[i] = static_cast(nZ & 0xffffL); } // if a < b, revert sign rErg.bIsNeg = !bIsNeg; @@ -300,12 +300,12 @@ void BigInt::MultLong( const BigInt& rB, BigInt& rErg ) const { for (i = 0, k = 0; i < nLen; i++) { - nZ = (sal_uInt32)nNum[i] * (sal_uInt32)rB.nNum[j] + - (sal_uInt32)rErg.nNum[i + j] + k; - rErg.nNum[i + j] = (sal_uInt16)(nZ & 0xffffU); + nZ = static_cast(nNum[i]) * static_cast(rB.nNum[j]) + + static_cast(rErg.nNum[i + j]) + k; + rErg.nNum[i + j] = static_cast(nZ & 0xffffU); k = nZ >> 16; } - rErg.nNum[i + j] = (sal_uInt16)k; + rErg.nNum[i + j] = static_cast(k); } } @@ -317,7 +317,7 @@ void BigInt::DivLong( const BigInt& rB, BigInt& rErg ) const sal_uInt16 nLenB1 = rB.nLen - 1; BigInt aTmpA, aTmpB; - nMult = (sal_uInt16)(0x10000L / ((sal_Int32)rB.nNum[nLenB1] + 1)); + nMult = static_cast(0x10000L / (static_cast(rB.nNum[nLenB1]) + 1)); aTmpA.Mult( *this, nMult ); if ( aTmpA.nLen == nLen ) @@ -330,26 +330,26 @@ void BigInt::DivLong( const BigInt& rB, BigInt& rErg ) const for (j = aTmpA.nLen - 1; j >= nLenB; j--) { // guess divisor - sal_uInt32 nTmp = ( (sal_uInt32)aTmpA.nNum[j] << 16 ) + aTmpA.nNum[j - 1]; + sal_uInt32 nTmp = ( static_cast(aTmpA.nNum[j]) << 16 ) + aTmpA.nNum[j - 1]; if (aTmpA.nNum[j] == aTmpB.nNum[nLenB1]) nQ = 0xFFFF; else - nQ = (sal_uInt16)(nTmp / aTmpB.nNum[nLenB1]); + nQ = static_cast(nTmp / aTmpB.nNum[nLenB1]); - if ( ((sal_uInt32)aTmpB.nNum[nLenB1 - 1] * nQ) > - ((nTmp - (sal_uInt32)aTmpB.nNum[nLenB1] * nQ) << 16) + aTmpA.nNum[j - 2]) + if ( (static_cast(aTmpB.nNum[nLenB1 - 1]) * nQ) > + ((nTmp - static_cast(aTmpB.nNum[nLenB1]) * nQ) << 16) + aTmpA.nNum[j - 2]) nQ--; // Start division nK = 0; for (i = 0; i < nLenB; i++) { - nTmp = (sal_uInt32)aTmpA.nNum[j - nLenB + i] - - ((sal_uInt32)aTmpB.nNum[i] * nQ) + nTmp = static_cast(aTmpA.nNum[j - nLenB + i]) + - (static_cast(aTmpB.nNum[i]) * nQ) - nK; - aTmpA.nNum[j - nLenB + i] = (sal_uInt16)nTmp; - nK = (sal_uInt16) (nTmp >> 16); + aTmpA.nNum[j - nLenB + i] = static_cast(nTmp); + nK = static_cast(nTmp >> 16); if ( nK ) - nK = (sal_uInt16)(0x10000U - nK); + nK = static_cast(0x10000U - nK); } sal_uInt16& rNum( aTmpA.nNum[j - nLenB + i] ); rNum -= nK; @@ -362,7 +362,7 @@ void BigInt::DivLong( const BigInt& rB, BigInt& rErg ) const for (i = 0; i < nLenB; i++) { nTmp = aTmpA.nNum[j - nLenB + i] + aTmpB.nNum[i] + nK; - aTmpA.nNum[j - nLenB + i] = (sal_uInt16)(nTmp & 0xFFFFL); + aTmpA.nNum[j - nLenB + i] = static_cast(nTmp & 0xFFFFL); if (nTmp & 0xFFFF0000L) nK = 1; else @@ -384,7 +384,7 @@ void BigInt::ModLong( const BigInt& rB, BigInt& rErg ) const sal_Int16 nLenB1 = rB.nLen - 1; BigInt aTmpA, aTmpB; - nMult = (sal_uInt16)(0x10000L / ((sal_Int32)rB.nNum[nLenB1] + 1)); + nMult = static_cast(0x10000L / (static_cast(rB.nNum[nLenB1]) + 1)); aTmpA.Mult( *this, nMult); if ( aTmpA.nLen == nLen ) @@ -397,26 +397,26 @@ void BigInt::ModLong( const BigInt& rB, BigInt& rErg ) const for (j = aTmpA.nLen - 1; j >= nLenB; j--) { // Guess divisor - sal_uInt32 nTmp = ( (sal_uInt32)aTmpA.nNum[j] << 16 ) + aTmpA.nNum[j - 1]; + sal_uInt32 nTmp = ( static_cast(aTmpA.nNum[j]) << 16 ) + aTmpA.nNum[j - 1]; if (aTmpA.nNum[j] == aTmpB.nNum[nLenB1]) nQ = 0xFFFF; else - nQ = (sal_uInt16)(nTmp / aTmpB.nNum[nLenB1]); + nQ = static_cast(nTmp / aTmpB.nNum[nLenB1]); - if ( ((sal_uInt32)aTmpB.nNum[nLenB1 - 1] * nQ) > + if ( (static_cast(aTmpB.nNum[nLenB1 - 1]) * nQ) > ((nTmp - aTmpB.nNum[nLenB1] * nQ) << 16) + aTmpA.nNum[j - 2]) nQ--; // Start division nK = 0; for (i = 0; i < nLenB; i++) { - nTmp = (sal_uInt32)aTmpA.nNum[j - nLenB + i] - - ((sal_uInt32)aTmpB.nNum[i] * nQ) + nTmp = static_cast(aTmpA.nNum[j - nLenB + i]) + - (static_cast(aTmpB.nNum[i]) * nQ) - nK; - aTmpA.nNum[j - nLenB + i] = (sal_uInt16)nTmp; - nK = (sal_uInt16) (nTmp >> 16); + aTmpA.nNum[j - nLenB + i] = static_cast(nTmp); + nK = static_cast(nTmp >> 16); if ( nK ) - nK = (sal_uInt16)(0x10000U - nK); + nK = static_cast(0x10000U - nK); } sal_uInt16& rNum( aTmpA.nNum[j - nLenB + i] ); rNum = rNum - nK; @@ -428,7 +428,7 @@ void BigInt::ModLong( const BigInt& rB, BigInt& rErg ) const nK = 0; for (i = 0; i < nLenB; i++) { nTmp = aTmpA.nNum[j - nLenB + i] + aTmpB.nNum[i] + nK; - aTmpA.nNum[j - nLenB + i] = (sal_uInt16)(nTmp & 0xFFFFL); + aTmpA.nNum[j - nLenB + i] = static_cast(nTmp & 0xFFFFL); if (nTmp & 0xFFFF0000L) nK = 1; else @@ -541,13 +541,13 @@ BigInt::BigInt( double nValue ) while ( ( nValue > 65536.0 ) && ( i < MAX_DIGITS ) ) { - nNum[i] = (sal_uInt16) fmod( nValue, 65536.0 ); + nNum[i] = static_cast(fmod( nValue, 65536.0 )); nValue -= nNum[i]; nValue /= 65536.0; i++; } if ( i < MAX_DIGITS ) - nNum[i++] = (sal_uInt16) nValue; + nNum[i++] = static_cast(nValue); nLen = i; @@ -564,8 +564,8 @@ BigInt::BigInt( sal_uInt32 nValue ) { bIsBig = true; bIsNeg = false; - nNum[0] = (sal_uInt16)(nValue & 0xffffU); - nNum[1] = (sal_uInt16)(nValue >> 16); + nNum[0] = static_cast(nValue & 0xffffU); + nNum[1] = static_cast(nValue >> 16); nLen = 2; } else @@ -605,17 +605,17 @@ BigInt::BigInt( sal_Int64 nValue ) BigInt::operator double() const { if ( !bIsBig ) - return (double) nVal; + return static_cast(nVal); else { int i = nLen-1; - double nRet = (double) ((sal_uInt32)nNum[i]); + double nRet = static_cast(static_cast(nNum[i])); while ( i ) { nRet *= 65536.0; i--; - nRet += (double) ((sal_uInt32)nNum[i]); + nRet += static_cast(static_cast(nNum[i])); } if ( bIsNeg ) @@ -748,11 +748,11 @@ BigInt& BigInt::operator/=( const BigInt& rVal ) sal_uInt16 nTmp; if ( rVal.nVal < 0 ) { - nTmp = (sal_uInt16) -rVal.nVal; + nTmp = static_cast(-rVal.nVal); bIsNeg = !bIsNeg; } else - nTmp = (sal_uInt16) rVal.nVal; + nTmp = static_cast(rVal.nVal); Div( nTmp, nTmp ); Normalize(); @@ -798,11 +798,11 @@ BigInt& BigInt::operator%=( const BigInt& rVal ) sal_uInt16 nTmp; if ( rVal.nVal < 0 ) { - nTmp = (sal_uInt16) -rVal.nVal; + nTmp = static_cast(-rVal.nVal); bIsNeg = !bIsNeg; } else - nTmp = (sal_uInt16) rVal.nVal; + nTmp = static_cast(rVal.nVal); Div( nTmp, nTmp ); *this = BigInt( nTmp ); diff --git a/tools/source/generic/color.cxx b/tools/source/generic/color.cxx index 86689502a7c4..f11f6fd564eb 100644 --- a/tools/source/generic/color.cxx +++ b/tools/source/generic/color.cxx @@ -30,25 +30,25 @@ sal_uInt8 Color::GetColorError( const Color& rCompareColor ) const { - const long nErrAbs = labs( (long) rCompareColor.GetRed() - GetRed() ) + - labs( (long) rCompareColor.GetGreen() - GetGreen() ) + - labs( (long) rCompareColor.GetBlue() - GetBlue() ); + const long nErrAbs = labs( static_cast(rCompareColor.GetRed()) - GetRed() ) + + labs( static_cast(rCompareColor.GetGreen()) - GetGreen() ) + + labs( static_cast(rCompareColor.GetBlue()) - GetBlue() ); - return (sal_uInt8) FRound( nErrAbs * 0.3333333333 ); + return static_cast(FRound( nErrAbs * 0.3333333333 )); } void Color::IncreaseLuminance( sal_uInt8 cLumInc ) { - SetRed( (sal_uInt8) SAL_BOUND( (long) COLORDATA_RED( mnColor ) + cLumInc, 0L, 255L ) ); - SetGreen( (sal_uInt8) SAL_BOUND( (long) COLORDATA_GREEN( mnColor ) + cLumInc, 0L, 255L ) ); - SetBlue( (sal_uInt8) SAL_BOUND( (long) COLORDATA_BLUE( mnColor ) + cLumInc, 0L, 255L ) ); + SetRed( static_cast(SAL_BOUND( static_cast(COLORDATA_RED( mnColor )) + cLumInc, 0L, 255L )) ); + SetGreen( static_cast(SAL_BOUND( static_cast(COLORDATA_GREEN( mnColor )) + cLumInc, 0L, 255L )) ); + SetBlue( static_cast(SAL_BOUND( static_cast(COLORDATA_BLUE( mnColor )) + cLumInc, 0L, 255L )) ); } void Color::DecreaseLuminance( sal_uInt8 cLumDec ) { - SetRed( (sal_uInt8) SAL_BOUND( (long) COLORDATA_RED( mnColor ) - cLumDec, 0L, 255L ) ); - SetGreen( (sal_uInt8) SAL_BOUND( (long) COLORDATA_GREEN( mnColor ) - cLumDec, 0L, 255L ) ); - SetBlue( (sal_uInt8) SAL_BOUND( (long) COLORDATA_BLUE( mnColor ) - cLumDec, 0L, 255L ) ); + SetRed( static_cast(SAL_BOUND( static_cast(COLORDATA_RED( mnColor )) - cLumDec, 0L, 255L )) ); + SetGreen( static_cast(SAL_BOUND( static_cast(COLORDATA_GREEN( mnColor )) - cLumDec, 0L, 255L )) ); + SetBlue( static_cast(SAL_BOUND( static_cast(COLORDATA_BLUE( mnColor )) - cLumDec, 0L, 255L )) ); } void Color::DecreaseContrast( sal_uInt8 cContDec ) @@ -58,9 +58,9 @@ void Color::DecreaseContrast( sal_uInt8 cContDec ) const double fM = ( 128.0 - 0.4985 * cContDec ) / 128.0; const double fOff = 128.0 - fM * 128.0; - SetRed( (sal_uInt8) SAL_BOUND( FRound( COLORDATA_RED( mnColor ) * fM + fOff ), 0L, 255L ) ); - SetGreen( (sal_uInt8) SAL_BOUND( FRound( COLORDATA_GREEN( mnColor ) * fM + fOff ), 0L, 255L ) ); - SetBlue( (sal_uInt8) SAL_BOUND( FRound( COLORDATA_BLUE( mnColor ) * fM + fOff ), 0L, 255L ) ); + SetRed( static_cast(SAL_BOUND( FRound( COLORDATA_RED( mnColor ) * fM + fOff ), 0L, 255L )) ); + SetGreen( static_cast(SAL_BOUND( FRound( COLORDATA_GREEN( mnColor ) * fM + fOff ), 0L, 255L )) ); + SetBlue( static_cast(SAL_BOUND( FRound( COLORDATA_BLUE( mnColor ) * fM + fOff ), 0L, 255L )) ); } } @@ -123,29 +123,29 @@ void Color::RGBtoHSB( sal_uInt16& nHue, sal_uInt16& nSat, sal_uInt16& nBri ) con if( c[0] == cMax ) { - dHue = (double)( c[1] - c[2] ) / (double)cDelta; + dHue = static_cast( c[1] - c[2] ) / static_cast(cDelta); } else if( c[1] == cMax ) { - dHue = 2.0 + (double)( c[2] - c[0] ) / (double)cDelta; + dHue = 2.0 + static_cast( c[2] - c[0] ) / static_cast(cDelta); } else if ( c[2] == cMax ) { - dHue = 4.0 + (double)( c[0] - c[1] ) / (double)cDelta; + dHue = 4.0 + static_cast( c[0] - c[1] ) / static_cast(cDelta); } dHue *= 60.0; if( dHue < 0.0 ) dHue += 360.0; - nHue = (sal_uInt16) dHue; + nHue = static_cast(dHue); } } ColorData Color::HSBtoRGB( sal_uInt16 nHue, sal_uInt16 nSat, sal_uInt16 nBri ) { sal_uInt8 cR=0,cG=0,cB=0; - sal_uInt8 nB = (sal_uInt8) ( nBri * 255 / 100 ); + sal_uInt8 nB = static_cast( nBri * 255 / 100 ); if( nSat == 0 ) { @@ -162,12 +162,12 @@ ColorData Color::HSBtoRGB( sal_uInt16 nHue, sal_uInt16 nSat, sal_uInt16 nBri ) dH = 0.0; dH /= 60.0; - n = (sal_uInt16) dH; + n = static_cast(dH); f = dH - n; - sal_uInt8 a = (sal_uInt8) ( nB * ( 100 - nSat ) / 100 ); - sal_uInt8 b = (sal_uInt8) ( nB * ( 100 - ( (double)nSat * f ) ) / 100 ); - sal_uInt8 c = (sal_uInt8) ( nB * ( 100 - ( (double)nSat * ( 1.0 - f ) ) ) / 100 ); + sal_uInt8 a = static_cast( nB * ( 100 - nSat ) / 100 ); + sal_uInt8 b = static_cast( nB * ( 100 - ( static_cast(nSat) * f ) ) / 100 ); + sal_uInt8 c = static_cast( nB * ( 100 - ( static_cast(nSat) * ( 1.0 - f ) ) ) / 100 ); switch( n ) { @@ -202,7 +202,7 @@ OUString Color::AsRGBHexString() const return OUString::createFromAscii(ss.str().c_str()); } -#define COL_NAME_USER ((sal_uInt16)0x8000) +#define COL_NAME_USER (sal_uInt16(0x8000)) SvStream& ReadColor( SvStream& rIStream, Color& rColor ) { diff --git a/tools/source/generic/point.cxx b/tools/source/generic/point.cxx index 6d4dc2e1e3ec..0b3d06c4753b 100644 --- a/tools/source/generic/point.cxx +++ b/tools/source/generic/point.cxx @@ -71,8 +71,8 @@ void Point::RotateAround( long& rX, long& rY, long nY = rY-nOriginY; // Rotation... - rX = +((long)(nCos*nX + nSin*nY)) + nOriginX; - rY = -((long)(nSin*nX - nCos*nY)) + nOriginY; + rX = + static_cast(nCos*nX + nSin*nY) + nOriginX; + rY = - static_cast(nSin*nX - nCos*nY) + nOriginY; } } diff --git a/tools/source/generic/poly.cxx b/tools/source/generic/poly.cxx index 36cb5c69e90d..ce1156bac990 100644 --- a/tools/source/generic/poly.cxx +++ b/tools/source/generic/poly.cxx @@ -177,10 +177,10 @@ ImplPolygon::ImplPolygon( const Point& rCenter, long nRadX, long nRadY ) const bool bOverflow = o3tl::checked_multiply(nRadX, nRadY, nRadXY); if (!bOverflow) { - nPoints = (sal_uInt16) MinMax( + nPoints = static_cast(MinMax( ( F_PI * ( 1.5 * ( nRadX + nRadY ) - - sqrt( (double) labs(nRadXY) ) ) ), - 32, 256 ); + sqrt( static_cast(labs(nRadXY)) ) ) ), + 32, 256 )); } else { @@ -240,10 +240,10 @@ ImplPolygon::ImplPolygon( const tools::Rectangle& rBound, const Point& rStart, c const bool bOverflow = o3tl::checked_multiply(nRadX, nRadY, nRadXY); if (!bOverflow) { - nPoints = (sal_uInt16) MinMax( + nPoints = static_cast(MinMax( ( F_PI * ( 1.5 * ( nRadX + nRadY ) - - sqrt( (double) labs(nRadXY) ) ) ), - 32, 256 ); + sqrt( static_cast(labs(nRadXY)) ) ) ), + 32, 256 )); } else { @@ -273,7 +273,7 @@ ImplPolygon::ImplPolygon( const tools::Rectangle& rBound, const Point& rStart, c fDiff = F_2PI; // Proportionally shrink number of points( fDiff / (2PI) ); - nPoints = std::max( (sal_uInt16) ( ( fDiff * 0.1591549 ) * nPoints ), (sal_uInt16) 16 ); + nPoints = std::max( static_cast( ( fDiff * 0.1591549 ) * nPoints ), sal_uInt16(16) ); fStep = fDiff / ( nPoints - 1 ); if( PolyStyle::Pie == eStyle ) @@ -771,7 +771,7 @@ Point ImplEdgePointFilter::EdgeSection( const Point& rPoint, int nEdge ) const else ady += mn/2; ady /= mn; - nNewX = (long)ady + lx; + nNewX = static_cast(ady) + lx; } } else @@ -797,7 +797,7 @@ Point ImplEdgePointFilter::EdgeSection( const Point& rPoint, int nEdge ) const else adx += md/2; adx /= md; - nNewY = (long)adx + ly; + nNewY = static_cast(adx) + ly; } } @@ -1229,7 +1229,7 @@ void Polygon::AdaptiveSubdivide( Polygon& rResult, const double d ) const } // fill result polygon - rResult = tools::Polygon( (sal_uInt16)aPoints.size() ); // ensure sufficient size for copy + rResult = tools::Polygon( static_cast(aPoints.size()) ); // ensure sufficient size for copy ::std::copy(aPoints.begin(), aPoints.end(), rResult.mpImplPolygon->mxPointAry.get()); } } @@ -1333,7 +1333,7 @@ void Polygon::ImplReduceEdges( tools::Polygon& rPoly, const double& rArea, sal_u else if( fRelLen > 1.0 ) fRelLen = 1.0; - if( ( (sal_uInt32) ( ( ( fLenFact - 1.0 ) * 1000000.0 ) + 0.5 ) < fBound ) && + if( ( static_cast( ( ( fLenFact - 1.0 ) * 1000000.0 ) + 0.5 ) < fBound ) && ( fabs( fGradB ) <= ( fRelLen * fBound * 0.01 ) ) ) { bDeletePoint = true; @@ -1388,8 +1388,8 @@ void Polygon::Scale( double fScaleX, double fScaleY ) for ( sal_uInt16 i = 0, nCount = mpImplPolygon->mnPoints; i < nCount; i++ ) { Point& rPnt = mpImplPolygon->mxPointAry[i]; - rPnt.X() = (long) ( fScaleX * rPnt.X() ); - rPnt.Y() = (long) ( fScaleY * rPnt.Y() ); + rPnt.X() = static_cast( fScaleX * rPnt.X() ); + rPnt.Y() = static_cast( fScaleY * rPnt.Y() ); } } diff --git a/tools/source/inet/inetmsg.cxx b/tools/source/inet/inetmsg.cxx index 82b23232441f..a3c3a88800a7 100644 --- a/tools/source/inet/inetmsg.cxx +++ b/tools/source/inet/inetmsg.cxx @@ -64,7 +64,7 @@ static sal_uInt16 ParseNumber(const OString& rStr, sal_Int32& nIndex) OString aNum(rStr.copy(nIndex, (n - nIndex))); nIndex = n; - return (sal_uInt16)(aNum.toInt32()); + return static_cast(aNum.toInt32()); } static sal_uInt16 ParseMonth(const OString& rStr, sal_Int32& nIndex) diff --git a/tools/source/memtools/mempool.cxx b/tools/source/memtools/mempool.cxx index 7c1c08002b8a..f38ab6925079 100644 --- a/tools/source/memtools/mempool.cxx +++ b/tools/source/memtools/mempool.cxx @@ -27,7 +27,7 @@ FixedMemPool::FixedMemPool(char const * pTypeName, sal_uInt16 nTypeSize) : m_pTypeName (pTypeName) { char name[RTL_CACHE_NAME_LENGTH + 1]; - snprintf (name, sizeof(name), "FixedMemPool_%d", (int)nTypeSize); + snprintf (name, sizeof(name), "FixedMemPool_%d", static_cast(nTypeSize)); m_pImpl = reinterpret_cast(rtl_cache_create (name, nTypeSize, 0, nullptr, nullptr, nullptr, nullptr, nullptr, 0)); SAL_INFO("tools.memtools","FixedMemPool::ctor(\"" << m_pTypeName << "\"): " << m_pImpl); } diff --git a/tools/source/ref/globname.cxx b/tools/source/ref/globname.cxx index 3d8ea7b155ef..47f1da1577e5 100644 --- a/tools/source/ref/globname.cxx +++ b/tools/source/ref/globname.cxx @@ -84,11 +84,11 @@ SvGlobalName::SvGlobalName( const css::uno::Sequence < sal_Int8 >& aSeq ) memset( &aResult, 0, sizeof( aResult ) ); if ( aSeq.getLength() == 16 ) { - aResult.Data1 = ( ( ( ( ( ( sal_uInt8 )aSeq[0] << 8 ) + ( sal_uInt8 )aSeq[1] ) << 8 ) + ( sal_uInt8 )aSeq[2] ) << 8 ) + ( sal_uInt8 )aSeq[3]; - aResult.Data2 = ( ( sal_uInt8 )aSeq[4] << 8 ) + ( sal_uInt8 )aSeq[5]; - aResult.Data3 = ( ( sal_uInt8 )aSeq[6] << 8 ) + ( sal_uInt8 )aSeq[7]; + aResult.Data1 = ( ( ( ( ( static_cast(aSeq[0]) << 8 ) + static_cast(aSeq[1]) ) << 8 ) + static_cast(aSeq[2]) ) << 8 ) + static_cast(aSeq[3]); + aResult.Data2 = ( static_cast(aSeq[4]) << 8 ) + static_cast(aSeq[5]); + aResult.Data3 = ( static_cast(aSeq[6]) << 8 ) + static_cast(aSeq[7]); for( int nInd = 0; nInd < 8; nInd++ ) - aResult.Data4[nInd] = ( sal_uInt8 )aSeq[nInd+8]; + aResult.Data4[nInd] = static_cast(aSeq[nInd+8]); } pImp = ::o3tl::cow_wrapper< ImpSvGlobalName >(aResult); @@ -186,7 +186,7 @@ bool SvGlobalName::MakeId( const OUString & rIdStr ) if( rtl::isAsciiDigit( *pStr ) ) nSec = nSec * 16 + (*pStr - '0'); else - nSec = nSec * 16 + (sal_uInt16)(rtl::toAsciiUpperCase( *pStr ) - 'A' + 10 ); + nSec = nSec * 16 + static_cast(rtl::toAsciiUpperCase( *pStr ) - 'A' + 10 ); else return false; pStr++; @@ -200,7 +200,7 @@ bool SvGlobalName::MakeId( const OUString & rIdStr ) if( rtl::isAsciiDigit( *pStr ) ) nThird = nThird * 16 + (*pStr - '0'); else - nThird = nThird * 16 + (sal_uInt16)(rtl::toAsciiUpperCase( *pStr ) - 'A' + 10 ); + nThird = nThird * 16 + static_cast(rtl::toAsciiUpperCase( *pStr ) - 'A' + 10 ); else return false; pStr++; @@ -215,7 +215,7 @@ bool SvGlobalName::MakeId( const OUString & rIdStr ) if( rtl::isAsciiDigit( *pStr ) ) szRemain[i/2] = szRemain[i/2] * 16 + (*pStr - '0'); else - szRemain[i/2] = szRemain[i/2] * 16 + (sal_Int8)(rtl::toAsciiUpperCase( *pStr ) - 'A' + 10 ); + szRemain[i/2] = szRemain[i/2] * 16 + static_cast(rtl::toAsciiUpperCase( *pStr ) - 'A' + 10 ); else return false; pStr++; @@ -266,14 +266,14 @@ css::uno::Sequence < sal_Int8 > SvGlobalName::GetByteSequence() const // maybe transported remotely css::uno::Sequence< sal_Int8 > aResult( 16 ); - aResult[ 0] = (sal_Int8) (pImp->szData.Data1 >> 24); - aResult[ 1] = (sal_Int8) ((pImp->szData.Data1 << 8 ) >> 24); - aResult[ 2] = (sal_Int8) ((pImp->szData.Data1 << 16 ) >> 24); - aResult[ 3] = (sal_Int8) ((pImp->szData.Data1 << 24 ) >> 24); - aResult[ 4] = (sal_Int8) (pImp->szData.Data2 >> 8); - aResult[ 5] = (sal_Int8) ((pImp->szData.Data2 << 8 ) >> 8); - aResult[ 6] = (sal_Int8) (pImp->szData.Data3 >> 8); - aResult[ 7] = (sal_Int8) ((pImp->szData.Data3 << 8 ) >> 8); + aResult[ 0] = static_cast(pImp->szData.Data1 >> 24); + aResult[ 1] = static_cast((pImp->szData.Data1 << 8 ) >> 24); + aResult[ 2] = static_cast((pImp->szData.Data1 << 16 ) >> 24); + aResult[ 3] = static_cast((pImp->szData.Data1 << 24 ) >> 24); + aResult[ 4] = static_cast(pImp->szData.Data2 >> 8); + aResult[ 5] = static_cast((pImp->szData.Data2 << 8 ) >> 8); + aResult[ 6] = static_cast(pImp->szData.Data3 >> 8); + aResult[ 7] = static_cast((pImp->szData.Data3 << 8 ) >> 8); aResult[ 8] = pImp->szData.Data4[ 0 ]; aResult[ 9] = pImp->szData.Data4[ 1 ]; aResult[10] = pImp->szData.Data4[ 2 ]; diff --git a/tools/source/stream/stream.cxx b/tools/source/stream/stream.cxx index c7d1e3f8414a..3a9f767880dd 100644 --- a/tools/source/stream/stream.cxx +++ b/tools/source/stream/stream.cxx @@ -1252,10 +1252,10 @@ std::size_t SvStream::ReadBytes( void* pData, std::size_t nCount ) { // => yes if (nCount != 0) - memcpy(pData, m_pBufPos, (size_t) nCount); - m_nBufActualPos = m_nBufActualPos + (sal_uInt16)nCount; + memcpy(pData, m_pBufPos, static_cast(nCount)); + m_nBufActualPos = m_nBufActualPos + static_cast(nCount); m_pBufPos += nCount; - m_nBufFree = m_nBufFree - (sal_uInt16)nCount; + m_nBufFree = m_nBufFree - static_cast(nCount); } else { @@ -1290,13 +1290,13 @@ std::size_t SvStream::ReadBytes( void* pData, std::size_t nCount ) std::size_t nCountTmp = GetData( m_pRWBuf.get(), m_nBufSize ); if (m_nCryptMask) EncryptBuffer(m_pRWBuf.get(), nCountTmp); - m_nBufActualLen = (sal_uInt16)nCountTmp; + m_nBufActualLen = static_cast(nCountTmp); if( nCount > nCountTmp ) { nCount = nCountTmp; // trim count back, EOF see below } - memcpy( pData, m_pRWBuf.get(), (size_t)nCount ); - m_nBufActualPos = (sal_uInt16)nCount; + memcpy( pData, m_pRWBuf.get(), static_cast(nCount) ); + m_nBufActualPos = static_cast(nCount); m_pBufPos = m_pRWBuf.get() + nCount; } } @@ -1337,8 +1337,8 @@ std::size_t SvStream::WriteBytes( const void* pData, std::size_t nCount ) m_isIoWrite = true; if (nCount <= static_cast(m_nBufSize - m_nBufActualPos)) { - memcpy( m_pBufPos, pData, (size_t)nCount ); - m_nBufActualPos = m_nBufActualPos + (sal_uInt16)nCount; + memcpy( m_pBufPos, pData, static_cast(nCount) ); + m_nBufActualPos = m_nBufActualPos + static_cast(nCount); // Update length if buffer was updated if (m_nBufActualPos > m_nBufActualLen) m_nBufActualLen = m_nBufActualPos; @@ -1368,13 +1368,13 @@ std::size_t SvStream::WriteBytes( const void* pData, std::size_t nCount ) else { // Copy block to buffer - memcpy( m_pRWBuf.get(), pData, (size_t)nCount ); + memcpy( m_pRWBuf.get(), pData, static_cast(nCount) ); // Mind the order! m_nBufFilePos += m_nBufActualPos; - m_nBufActualPos = (sal_uInt16)nCount; + m_nBufActualPos = static_cast(nCount); m_pBufPos = m_pRWBuf.get() + nCount; - m_nBufActualLen = (sal_uInt16)nCount; + m_nBufActualLen = static_cast(nCount); m_isDirty = true; } } @@ -1396,7 +1396,7 @@ sal_uInt64 SvStream::Seek(sal_uInt64 const nFilePos) // Is seek position within buffer? if (nFilePos >= m_nBufFilePos && nFilePos <= (m_nBufFilePos + m_nBufActualLen)) { - m_nBufActualPos = (sal_uInt16)(nFilePos - m_nBufFilePos); + m_nBufActualPos = static_cast(nFilePos - m_nBufFilePos); m_pBufPos = m_pRWBuf.get() + m_nBufActualPos; // Update m_nBufFree to avoid crash upon PutBack m_nBufFree = m_nBufActualLen - m_nBufActualPos; @@ -1441,11 +1441,11 @@ void SvStream::RefreshBuffer() { FlushBuffer(m_isConsistent); SeekPos(m_nBufFilePos); - m_nBufActualLen = (sal_uInt16)GetData( m_pRWBuf.get(), m_nBufSize ); + m_nBufActualLen = static_cast(GetData( m_pRWBuf.get(), m_nBufSize )); if (m_nBufActualLen && m_nError == ERRCODE_IO_PENDING) m_nError = ERRCODE_NONE; if (m_nCryptMask) - EncryptBuffer(m_pRWBuf.get(), (std::size_t)m_nBufActualLen); + EncryptBuffer(m_pRWBuf.get(), static_cast(m_nBufActualLen)); m_isConsistent = true; m_isIoRead = m_isIoWrite = false; } @@ -1483,7 +1483,7 @@ std::size_t SvStream::CryptAndWriteBuffer( const void* pStart, std::size_t nLen) else nBufCount = nLen; nLen -= nBufCount; - memcpy( pTemp, pDataPtr, (sal_uInt16)nBufCount ); + memcpy( pTemp, pDataPtr, static_cast(nBufCount) ); // ******** Encrypt ******** for (unsigned char & rn : pTemp) { @@ -1700,7 +1700,7 @@ std::size_t SvMemoryStream::GetData( void* pData, std::size_t nCount ) nCount = nMaxCount; if (nCount != 0) { - memcpy( pData, pBuf+nPos, (size_t)nCount ); + memcpy( pData, pBuf+nPos, static_cast(nCount) ); } nPos += nCount; return nCount; @@ -1753,7 +1753,7 @@ std::size_t SvMemoryStream::PutData( const void* pData, std::size_t nCount ) } } assert(pBuf && "Possibly Reallocate failed"); - memcpy( pBuf+nPos, pData, (size_t)nCount); + memcpy( pBuf+nPos, pData, static_cast(nCount)); nPos += nCount; if( nPos > nEndOfData ) @@ -1778,8 +1778,8 @@ sal_uInt64 SvMemoryStream::SeekPos(sal_uInt64 const nNewPos) { if( nResize ) // Is extension possible? { - long nDiff = (long)(nNewPos - nSize + 1); - nDiff += (long)nResize; + long nDiff = static_cast(nNewPos - nSize + 1); + nDiff += static_cast(nResize); ReAllocateMemory( nDiff ); nPos = nNewPos; nEndOfData = nNewPos; @@ -1821,9 +1821,9 @@ bool SvMemoryStream::ReAllocateMemory( long nDiff ) return false; bool bRetVal = false; - long nTemp = (long)nSize; + long nTemp = static_cast(nSize); nTemp += nDiff; - std::size_t nNewSize = (std::size_t)nTemp; + std::size_t nNewSize = static_cast(nTemp); if( nNewSize ) { @@ -1832,7 +1832,7 @@ bool SvMemoryStream::ReAllocateMemory( long nDiff ) bRetVal = true; // Success! if( nNewSize < nSize ) // Are we shrinking? { - memcpy( pNewBuf, pBuf, (size_t)nNewSize ); + memcpy( pNewBuf, pBuf, static_cast(nNewSize) ); if( nPos > nNewSize ) nPos = 0; if( nEndOfData >= nNewSize ) @@ -1842,7 +1842,7 @@ bool SvMemoryStream::ReAllocateMemory( long nDiff ) { if (nSize != 0) { - memcpy( pNewBuf, pBuf, (size_t)nSize ); + memcpy( pNewBuf, pBuf, static_cast(nSize) ); } memset(pNewBuf + nSize, 0x00, nNewSize - nSize); } @@ -1909,7 +1909,7 @@ void SvMemoryStream::SetSize(sal_uInt64 const nNewSize) return; } - long nDiff = (long)nNewSize - (long)nSize; + long nDiff = static_cast(nNewSize) - static_cast(nSize); ReAllocateMemory( nDiff ); } diff --git a/tools/source/stream/strmunx.cxx b/tools/source/stream/strmunx.cxx index d06544e72031..86a296b1d598 100644 --- a/tools/source/stream/strmunx.cxx +++ b/tools/source/stream/strmunx.cxx @@ -211,7 +211,7 @@ static ErrCode GetSvError( int nErrno ) { ETXTBSY, SVSTREAM_ACCESS_DENIED }, { EEXIST, SVSTREAM_CANNOT_MAKE }, { ENOSPC, SVSTREAM_DISK_FULL }, - { (int)0xFFFF, SVSTREAM_GENERALERROR } + { int(0xFFFF), SVSTREAM_GENERALERROR } }; ErrCode nRetVal = SVSTREAM_GENERALERROR; // default error @@ -306,14 +306,14 @@ std::size_t SvFileStream::GetData( void* pData, std::size_t nSize ) sal_uInt64 nRead = 0; if ( IsOpen() ) { - oslFileError rc = osl_readFile(pInstanceData->rHandle,pData,(sal_uInt64)nSize,&nRead); + oslFileError rc = osl_readFile(pInstanceData->rHandle,pData,static_cast(nSize),&nRead); if ( rc != osl_File_E_None ) { SetError( ::GetSvError( rc )); return -1; } } - return (std::size_t)nRead; + return static_cast(nRead); } std::size_t SvFileStream::PutData( const void* pData, std::size_t nSize ) @@ -323,7 +323,7 @@ std::size_t SvFileStream::PutData( const void* pData, std::size_t nSize ) sal_uInt64 nWrite = 0; if ( IsOpen() ) { - oslFileError rc = osl_writeFile(pInstanceData->rHandle,pData,(sal_uInt64)nSize,&nWrite); + oslFileError rc = osl_writeFile(pInstanceData->rHandle,pData,static_cast(nSize),&nWrite); if ( rc != osl_File_E_None ) { SetError( ::GetSvError( rc ) ); @@ -332,13 +332,13 @@ std::size_t SvFileStream::PutData( const void* pData, std::size_t nSize ) else if( !nWrite ) SetError( SVSTREAM_DISK_FULL ); } - return (std::size_t)nWrite; + return static_cast(nWrite); } sal_uInt64 SvFileStream::SeekPos(sal_uInt64 const nPos) { // check if a truncated STREAM_SEEK_TO_END was passed - assert(nPos != (sal_uInt64)(sal_uInt32)STREAM_SEEK_TO_END); + assert(nPos != sal_uInt64(sal_uInt32(STREAM_SEEK_TO_END))); if ( IsOpen() ) { oslFileError rc; diff --git a/tools/source/zcodec/zcodec.cxx b/tools/source/zcodec/zcodec.cxx index 258677952a3d..174753bac248 100644 --- a/tools/source/zcodec/zcodec.cxx +++ b/tools/source/zcodec/zcodec.cxx @@ -166,7 +166,7 @@ long ZCodec::Decompress( SvStream& rIStm, SvStream& rOStm ) while ( ( err != Z_STREAM_END) && ( PZSTREAM->avail_in || mnInToRead ) ); ImplWriteBack(); - return ( mbStatus ) ? (long)(PZSTREAM->total_out - nOldTotal_Out) : -1; + return ( mbStatus ) ? static_cast(PZSTREAM->total_out - nOldTotal_Out) : -1; } void ZCodec::Write( SvStream& rOStm, const sal_uInt8* pData, sal_uInt32 nSize ) @@ -235,7 +235,7 @@ long ZCodec::Read( SvStream& rIStm, sal_uInt8* pData, sal_uInt32 nSize ) if ( err == Z_STREAM_END ) mbFinish = true; - return (mbStatus ? (long)(nSize - PZSTREAM->avail_out) : -1); + return (mbStatus ? static_cast(nSize - PZSTREAM->avail_out) : -1); } long ZCodec::ReadAsynchron( SvStream& rIStm, sal_uInt8* pData, sal_uInt32 nSize ) @@ -288,7 +288,7 @@ long ZCodec::ReadAsynchron( SvStream& rIStm, sal_uInt8* pData, sal_uInt32 nSize if ( err == Z_STREAM_END ) mbFinish = true; - return (mbStatus ? (long)(nSize - PZSTREAM->avail_out) : -1); + return (mbStatus ? static_cast(nSize - PZSTREAM->avail_out) : -1); } void ZCodec::ImplWriteBack() -- cgit