diff options
Diffstat (limited to 'tools')
-rw-r--r-- | tools/inc/poly.h | 2 | ||||
-rw-r--r-- | tools/qa/cppunit/test_minmax.cxx | 8 | ||||
-rw-r--r-- | tools/qa/cppunit/test_rectangle.cxx | 24 | ||||
-rw-r--r-- | tools/source/generic/color.cxx | 13 | ||||
-rw-r--r-- | tools/source/generic/gen.cxx | 32 | ||||
-rw-r--r-- | tools/source/generic/point.cxx | 22 | ||||
-rw-r--r-- | tools/source/generic/poly.cxx | 64 | ||||
-rw-r--r-- | tools/source/generic/poly2.cxx | 4 | ||||
-rw-r--r-- | tools/source/stream/stream.cxx | 15 | ||||
-rw-r--r-- | tools/source/zcodec/zcodec.cxx | 19 |
10 files changed, 103 insertions, 100 deletions
diff --git a/tools/inc/poly.h b/tools/inc/poly.h index 708ebb69bd95..f621a73e223f 100644 --- a/tools/inc/poly.h +++ b/tools/inc/poly.h @@ -36,7 +36,7 @@ public: ImplPolygon( const ImplPolygon& rImplPoly ); ImplPolygon( const tools::Rectangle& rRect ); ImplPolygon( const tools::Rectangle& rRect, sal_uInt32 nHorzRound, sal_uInt32 nVertRound); - ImplPolygon( const Point& rCenter, long nRadX, long nRadY ); + ImplPolygon( const Point& rCenter, tools::Long nRadX, tools::Long nRadY ); ImplPolygon( const tools::Rectangle& rBound, const Point& rStart, const Point& rEnd, PolyStyle eStyle ); ImplPolygon( const Point& rBezPt1, const Point& rCtrlPt1, const Point& rBezPt2, diff --git a/tools/qa/cppunit/test_minmax.cxx b/tools/qa/cppunit/test_minmax.cxx index 93709def974e..509499910216 100644 --- a/tools/qa/cppunit/test_minmax.cxx +++ b/tools/qa/cppunit/test_minmax.cxx @@ -31,8 +31,8 @@ public: void testSignedMinMax() { sal_Int32 nSignedVal = -10; - long nMin = 1; - long nMax = 10; + tools::Long nMin = 1; + tools::Long nMax = 10; CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(nMin), static_cast<sal_Int32>(MinMax(nSignedVal, nMin, nMax))); @@ -50,8 +50,8 @@ public: void testUnsignedMinMax() { sal_uInt32 nUnsignedVal = 5; - long nMin = 1; - long nMax = 10; + tools::Long nMin = 1; + tools::Long nMax = 10; CPPUNIT_ASSERT_EQUAL(nUnsignedVal, static_cast<sal_uInt32>(MinMax(nUnsignedVal, nMin, nMax))); diff --git a/tools/qa/cppunit/test_rectangle.cxx b/tools/qa/cppunit/test_rectangle.cxx index 8b10ece6239b..76ab1827f622 100644 --- a/tools/qa/cppunit/test_rectangle.cxx +++ b/tools/qa/cppunit/test_rectangle.cxx @@ -30,28 +30,28 @@ void Test::test_rectangle() { tools::Rectangle aRect(1,1,1,1); - CPPUNIT_ASSERT_EQUAL(long(1), aRect.GetWidth()); - CPPUNIT_ASSERT_EQUAL(long(1), aRect.GetHeight()); + CPPUNIT_ASSERT_EQUAL(tools::Long(1), aRect.GetWidth()); + CPPUNIT_ASSERT_EQUAL(tools::Long(1), aRect.GetHeight()); - CPPUNIT_ASSERT_EQUAL(long(0), aRect.getWidth()); - CPPUNIT_ASSERT_EQUAL(long(0), aRect.getHeight()); + CPPUNIT_ASSERT_EQUAL(tools::Long(0), aRect.getWidth()); + CPPUNIT_ASSERT_EQUAL(tools::Long(0), aRect.getHeight()); } { tools::Rectangle aRect(Point(), Size(1,1)); - CPPUNIT_ASSERT_EQUAL(long(0), aRect.Left()); - CPPUNIT_ASSERT_EQUAL(long(0), aRect.Top()); - CPPUNIT_ASSERT_EQUAL(long(0), aRect.Right()); - CPPUNIT_ASSERT_EQUAL(long(0), aRect.Bottom()); + CPPUNIT_ASSERT_EQUAL(tools::Long(0), aRect.Left()); + CPPUNIT_ASSERT_EQUAL(tools::Long(0), aRect.Top()); + CPPUNIT_ASSERT_EQUAL(tools::Long(0), aRect.Right()); + CPPUNIT_ASSERT_EQUAL(tools::Long(0), aRect.Bottom()); - CPPUNIT_ASSERT_EQUAL(long(1), aRect.GetWidth()); - CPPUNIT_ASSERT_EQUAL(long(1), aRect.GetHeight()); + CPPUNIT_ASSERT_EQUAL(tools::Long(1), aRect.GetWidth()); + CPPUNIT_ASSERT_EQUAL(tools::Long(1), aRect.GetHeight()); aRect.setX(12); - CPPUNIT_ASSERT_EQUAL(long(1), aRect.GetHeight()); + CPPUNIT_ASSERT_EQUAL(tools::Long(1), aRect.GetHeight()); aRect.setY(12); - CPPUNIT_ASSERT_EQUAL(long(1), aRect.GetWidth()); + CPPUNIT_ASSERT_EQUAL(tools::Long(1), aRect.GetWidth()); } } diff --git a/tools/source/generic/color.cxx b/tools/source/generic/color.cxx index 061435ed61c9..5c43a051d609 100644 --- a/tools/source/generic/color.cxx +++ b/tools/source/generic/color.cxx @@ -26,20 +26,21 @@ #include <tools/color.hxx> #include <tools/helpers.hxx> +#include <tools/long.hxx> #include <basegfx/color/bcolortools.hxx> void Color::IncreaseLuminance(sal_uInt8 cLumInc) { - R = sal_uInt8(std::clamp(long(R) + cLumInc, 0L, 255L)); - G = sal_uInt8(std::clamp(long(G) + cLumInc, 0L, 255L)); - B = sal_uInt8(std::clamp(long(B) + cLumInc, 0L, 255L)); + R = sal_uInt8(std::clamp(tools::Long(R) + cLumInc, 0L, 255L)); + G = sal_uInt8(std::clamp(tools::Long(G) + cLumInc, 0L, 255L)); + B = sal_uInt8(std::clamp(tools::Long(B) + cLumInc, 0L, 255L)); } void Color::DecreaseLuminance(sal_uInt8 cLumDec) { - R = sal_uInt8(std::clamp(long(R) - cLumDec, 0L, 255L)); - G = sal_uInt8(std::clamp(long(G) - cLumDec, 0L, 255L)); - B = sal_uInt8(std::clamp(long(B) - cLumDec, 0L, 255L)); + R = sal_uInt8(std::clamp(tools::Long(R) - cLumDec, 0L, 255L)); + G = sal_uInt8(std::clamp(tools::Long(G) - cLumDec, 0L, 255L)); + B = sal_uInt8(std::clamp(tools::Long(B) - cLumDec, 0L, 255L)); } void Color::DecreaseContrast(sal_uInt8 nContDec) diff --git a/tools/source/generic/gen.cxx b/tools/source/generic/gen.cxx index 7a275eea3088..78025c459d07 100644 --- a/tools/source/generic/gen.cxx +++ b/tools/source/generic/gen.cxx @@ -39,10 +39,10 @@ OString Pair::toString() const tools::Rectangle tools::Rectangle::Justify( const Point& rLT, const Point& rRB ) { - long nLeft = std::min(rLT.X(), rRB.X()); - long nTop = std::min(rLT.Y(), rRB.Y()); - long nRight = std::max(rLT.X(), rRB.X()); - long nBottom = std::max(rLT.Y(), rRB.Y()); + tools::Long nLeft = std::min(rLT.X(), rRB.X()); + tools::Long nTop = std::min(rLT.Y(), rRB.Y()); + tools::Long nRight = std::max(rLT.X(), rRB.X()); + tools::Long nBottom = std::max(rLT.Y(), rRB.Y()); return Rectangle( nLeft, nTop, nRight, nBottom ); } @@ -80,14 +80,14 @@ void tools::Rectangle::SaturatingSetSize(const Size& rSize) nBottom = RECT_EMPTY; } -void tools::Rectangle::SaturatingSetX(long x) +void tools::Rectangle::SaturatingSetX(tools::Long x) { if (nRight != RECT_EMPTY) nRight = o3tl::saturating_add(nRight, x - nLeft); nLeft = x; } -void tools::Rectangle::SaturatingSetY(long y) +void tools::Rectangle::SaturatingSetY(tools::Long y) { if (nBottom != RECT_EMPTY) nBottom = o3tl::saturating_add(nBottom, y - nTop); @@ -202,7 +202,7 @@ OString tools::Rectangle::toString() const return ss.str().c_str(); } -void tools::Rectangle::expand(long nExpandBy) +void tools::Rectangle::expand(tools::Long nExpandBy) { nLeft -= nExpandBy; nTop -= nExpandBy; @@ -216,7 +216,7 @@ void tools::Rectangle::expand(long nExpandBy) nBottom += nExpandBy; } -void tools::Rectangle::shrink(long nShrinkBy) +void tools::Rectangle::shrink(tools::Long nShrinkBy) { nLeft += nShrinkBy; nTop += nShrinkBy; @@ -226,7 +226,7 @@ void tools::Rectangle::shrink(long nShrinkBy) nBottom -= nShrinkBy; } -long tools::Rectangle::AdjustRight(long nHorzMoveDelta) +tools::Long tools::Rectangle::AdjustRight(tools::Long nHorzMoveDelta) { if (nRight == RECT_EMPTY) nRight = nLeft + nHorzMoveDelta - 1; @@ -235,7 +235,7 @@ long tools::Rectangle::AdjustRight(long nHorzMoveDelta) return nRight; } -long tools::Rectangle::AdjustBottom( long nVertMoveDelta ) +tools::Long tools::Rectangle::AdjustBottom( tools::Long nVertMoveDelta ) { if (nBottom == RECT_EMPTY) nBottom = nTop + nVertMoveDelta - 1; @@ -244,38 +244,38 @@ long tools::Rectangle::AdjustBottom( long nVertMoveDelta ) return nBottom; } -void tools::Rectangle::setX( long x ) +void tools::Rectangle::setX( tools::Long x ) { if (nRight != RECT_EMPTY) nRight += x - nLeft; nLeft = x; } -void tools::Rectangle::setY( long y ) +void tools::Rectangle::setY( tools::Long y ) { if (nBottom != RECT_EMPTY) nBottom += y - nTop; nTop = y; } -long tools::Rectangle::Right() const +tools::Long tools::Rectangle::Right() const { return nRight == RECT_EMPTY ? nLeft : nRight; } -long tools::Rectangle::Bottom() const +tools::Long tools::Rectangle::Bottom() const { return nBottom == RECT_EMPTY ? nTop : nBottom; } /// Returns the difference between right and left, assuming the range includes one end, but not the other. -long tools::Rectangle::getWidth() const +tools::Long tools::Rectangle::getWidth() const { return nRight == RECT_EMPTY ? 0 : nRight - nLeft; } /// Returns the difference between bottom and top, assuming the range includes one end, but not the other. -long tools::Rectangle::getHeight() const +tools::Long tools::Rectangle::getHeight() const { return nBottom == RECT_EMPTY ? 0 : nBottom - nTop; } diff --git a/tools/source/generic/point.cxx b/tools/source/generic/point.cxx index f33fe9a28803..c38e0f183451 100644 --- a/tools/source/generic/point.cxx +++ b/tools/source/generic/point.cxx @@ -23,18 +23,18 @@ void Point::RotateAround( Point& rPoint, short nOrientation ) const { - long nX = rPoint.X(); - long nY = rPoint.Y(); + tools::Long nX = rPoint.X(); + tools::Long nY = rPoint.Y(); RotateAround(nX, nY, nOrientation); rPoint.setX(nX); rPoint.setY(nY); } -void Point::RotateAround( long& rX, long& rY, +void Point::RotateAround( tools::Long& rX, tools::Long& rY, short nOrientation ) const { - const long nOriginX = X(); - const long nOriginY = Y(); + const tools::Long nOriginX = X(); + const tools::Long nOriginY = Y(); if ( (nOrientation >= 0) && !(nOrientation % 900) ) { @@ -48,7 +48,7 @@ void Point::RotateAround( long& rX, long& rY, if ( nOrientation == 900 ) { - long nTemp = rX; + tools::Long nTemp = rX; rX = rY; rY = -nTemp; } @@ -59,7 +59,7 @@ void Point::RotateAround( long& rX, long& rY, } else /* ( nOrientation == 2700 ) */ { - long nTemp = rX; + tools::Long nTemp = rX; rX = -rY; rY = nTemp; } @@ -75,12 +75,12 @@ void Point::RotateAround( long& rX, long& rY, double nSin = sin( nRealOrientation ); // Translation... - long nX = rX-nOriginX; - long nY = rY-nOriginY; + tools::Long nX = rX-nOriginX; + tools::Long nY = rY-nOriginY; // Rotation... - rX = + static_cast<long>(nCos*nX + nSin*nY) + nOriginX; - rY = - static_cast<long>(nSin*nX - nCos*nY) + nOriginY; + rX = + static_cast<tools::Long>(nCos*nX + nSin*nY) + nOriginX; + rY = - static_cast<tools::Long>(nSin*nX - nCos*nY) + nOriginY; } } diff --git a/tools/source/generic/poly.cxx b/tools/source/generic/poly.cxx index eab7a81acc39..7e972714ad2a 100644 --- a/tools/source/generic/poly.cxx +++ b/tools/source/generic/poly.cxx @@ -55,7 +55,7 @@ static double ImplGetParameter( const Point& rCenter, const Point& rPt, double fWR, double fHR ) { - const long nDX = rPt.X() - rCenter.X(); + const tools::Long nDX = rPt.X() - rCenter.X(); double fAngle = atan2( -rPt.Y() + rCenter.Y(), ( ( nDX == 0 ) ? 0.000000001 : nDX ) ); return atan2(fWR*sin(fAngle), fHR*cos(fAngle)); @@ -167,13 +167,13 @@ ImplPolygon::ImplPolygon( const tools::Rectangle& rRect, sal_uInt32 nHorzRound, mnPoints = 0; } -ImplPolygon::ImplPolygon( const Point& rCenter, long nRadX, long nRadY ) +ImplPolygon::ImplPolygon( const Point& rCenter, tools::Long nRadX, tools::Long nRadY ) { if( nRadX && nRadY ) { sal_uInt16 nPoints; // Compute default (depends on size) - long nRadXY; + tools::Long nRadXY; const bool bOverflow = o3tl::checked_multiply(nRadX, nRadY, nRadXY); if (!bOverflow) { @@ -202,8 +202,8 @@ ImplPolygon::ImplPolygon( const Point& rCenter, long nRadX, long nRadY ) for( i=0, nAngle = 0.0; i < nPoints4; i++, nAngle += nAngleStep ) { - long nX = FRound( nRadX * cos( nAngle ) ); - long nY = FRound( -nRadY * sin( nAngle ) ); + tools::Long nX = FRound( nRadX * cos( nAngle ) ); + tools::Long nY = FRound( -nRadY * sin( nAngle ) ); Point* pPt = &(mxPointAry[i]); pPt->setX( nX + rCenter.X() ); @@ -226,17 +226,17 @@ ImplPolygon::ImplPolygon( const Point& rCenter, long nRadX, long nRadY ) ImplPolygon::ImplPolygon( const tools::Rectangle& rBound, const Point& rStart, const Point& rEnd, PolyStyle eStyle ) { - const long nWidth = rBound.GetWidth(); - const long nHeight = rBound.GetHeight(); + const tools::Long nWidth = rBound.GetWidth(); + const tools::Long nHeight = rBound.GetHeight(); if( ( nWidth > 1 ) && ( nHeight > 1 ) ) { const Point aCenter( rBound.Center() ); - const long nRadX = aCenter.X() - rBound.Left(); - const long nRadY = aCenter.Y() - rBound.Top(); + const tools::Long nRadX = aCenter.X() - rBound.Left(); + const tools::Long nRadY = aCenter.Y() - rBound.Top(); sal_uInt16 nPoints; - long nRadXY; + tools::Long nRadXY; const bool bOverflow = o3tl::checked_multiply(nRadX, nRadY, nRadXY); if (!bOverflow) { @@ -697,14 +697,14 @@ class ImplEdgePointFilter : public ImplPointFilter Point maFirstPoint; Point maLastPoint; ImplPointFilter& mrNextFilter; - const long mnLow; - const long mnHigh; + const tools::Long mnLow; + const tools::Long mnHigh; const int mnEdge; int mnLastOutside; bool mbFirst; public: - ImplEdgePointFilter( int nEdge, long nLow, long nHigh, + ImplEdgePointFilter( int nEdge, tools::Long nLow, tools::Long nHigh, ImplPointFilter& rNextFilter ) : mrNextFilter( rNextFilter ), mnLow( nLow ), @@ -744,17 +744,17 @@ inline int ImplEdgePointFilter::VisibleSide( const Point& rPoint ) const Point ImplEdgePointFilter::EdgeSection( const Point& rPoint, int nEdge ) const { - long lx = maLastPoint.X(); - long ly = maLastPoint.Y(); - long md = rPoint.X() - lx; - long mn = rPoint.Y() - ly; - long nNewX; - long nNewY; + tools::Long lx = maLastPoint.X(); + tools::Long ly = maLastPoint.Y(); + tools::Long md = rPoint.X() - lx; + tools::Long mn = rPoint.Y() - ly; + tools::Long nNewX; + tools::Long nNewY; if ( nEdge & EDGE_VERT ) { nNewY = (nEdge == EDGE_TOP) ? mnLow : mnHigh; - long dy = nNewY - ly; + tools::Long dy = nNewY - ly; if ( !md ) nNewX = lx; else if ( (LONG_MAX / std::abs(md)) >= std::abs(dy) ) @@ -774,13 +774,13 @@ Point ImplEdgePointFilter::EdgeSection( const Point& rPoint, int nEdge ) const else ady += mn/2; ady /= mn; - nNewX = static_cast<long>(ady) + lx; + nNewX = static_cast<tools::Long>(ady) + lx; } } else { nNewX = (nEdge == EDGE_LEFT) ? mnLow : mnHigh; - long dx = nNewX - lx; + tools::Long dx = nNewX - lx; if ( !mn ) nNewY = ly; else if ( (LONG_MAX / std::abs(mn)) >= std::abs(dx) ) @@ -800,7 +800,7 @@ Point ImplEdgePointFilter::EdgeSection( const Point& rPoint, int nEdge ) const else adx += md/2; adx /= md; - nNewY = static_cast<long>(adx) + ly; + nNewY = static_cast<tools::Long>(adx) + ly; } } @@ -893,7 +893,7 @@ Polygon::Polygon( const tools::Rectangle& rRect, sal_uInt32 nHorzRound, sal_uInt { } -Polygon::Polygon( const Point& rCenter, long nRadX, long nRadY ) +Polygon::Polygon( const Point& rCenter, tools::Long nRadX, tools::Long nRadY ) : mpImplPolygon(ImplPolygon(rCenter, nRadX, nRadY)) { } @@ -1363,7 +1363,7 @@ void Polygon::ImplReduceEdges( tools::Polygon& rPoly, const double& rArea, sal_u } } -void Polygon::Move( long nHorzMove, long nVertMove ) +void Polygon::Move( tools::Long nHorzMove, tools::Long nVertMove ) { // This check is required for DrawEngine if ( !nHorzMove && !nVertMove ) @@ -1390,8 +1390,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.setX( static_cast<long>( fScaleX * rPnt.X() ) ); - rPnt.setY( static_cast<long>( fScaleY * rPnt.Y() ) ); + rPnt.setX( static_cast<tools::Long>( fScaleX * rPnt.X() ) ); + rPnt.setY( static_cast<tools::Long>( fScaleY * rPnt.Y() ) ); } } @@ -1408,15 +1408,15 @@ void Polygon::Rotate( const Point& rCenter, sal_uInt16 nAngle10 ) void Polygon::Rotate( const Point& rCenter, double fSin, double fCos ) { - long nCenterX = rCenter.X(); - long nCenterY = rCenter.Y(); + tools::Long nCenterX = rCenter.X(); + tools::Long nCenterY = rCenter.Y(); for( sal_uInt16 i = 0, nCount = mpImplPolygon->mnPoints; i < nCount; i++ ) { Point& rPt = mpImplPolygon->mxPointAry[ i ]; - const long nX = rPt.X() - nCenterX; - const long nY = rPt.Y() - nCenterY; + const tools::Long nX = rPt.X() - nCenterX; + const tools::Long nY = rPt.Y() - nCenterY; rPt.setX( FRound( fCos * nX + fSin * nY ) + nCenterX ); rPt.setY( - FRound( fSin * nX - fCos * nY ) + nCenterY ); } @@ -1462,7 +1462,7 @@ tools::Rectangle Polygon::GetBoundRect() const if( ! nCount ) return tools::Rectangle(); - long nXMin, nXMax, nYMin, nYMax; + tools::Long nXMin, nXMax, nYMin, nYMax; const Point& pFirstPt = mpImplPolygon->mxPointAry[0]; nXMin = nXMax = pFirstPt.X(); diff --git a/tools/source/generic/poly2.cxx b/tools/source/generic/poly2.cxx index 5591ea4e6d83..a1c4fe0cbe69 100644 --- a/tools/source/generic/poly2.cxx +++ b/tools/source/generic/poly2.cxx @@ -228,7 +228,7 @@ sal_uInt16 PolyPolygon::Count() const return mpImplPolyPolygon->mvPolyAry.size(); } -void PolyPolygon::Move( long nHorzMove, long nVertMove ) +void PolyPolygon::Move( tools::Long nHorzMove, tools::Long nVertMove ) { // Required for DrawEngine if( nHorzMove || nVertMove ) @@ -293,7 +293,7 @@ void PolyPolygon::Clip( const tools::Rectangle& rRect ) tools::Rectangle PolyPolygon::GetBoundRect() const { - long nXMin=0, nXMax=0, nYMin=0, nYMax=0; + tools::Long nXMin=0, nXMax=0, nYMin=0, nYMax=0; bool bFirst = true; sal_uInt16 nPolyCount = mpImplPolyPolygon->mvPolyAry.size(); diff --git a/tools/source/stream/stream.cxx b/tools/source/stream/stream.cxx index 404b9eb67537..fe2470766be3 100644 --- a/tools/source/stream/stream.cxx +++ b/tools/source/stream/stream.cxx @@ -34,6 +34,7 @@ #include <rtl/strbuf.hxx> #include <rtl/ustrbuf.hxx> #include <sal/log.hxx> +#include <tools/long.hxx> #include <comphelper/fileformat.h> @@ -1517,7 +1518,7 @@ void SvStream::EncryptBuffer(void* pStart, std::size_t nLen) const } } -static unsigned char implGetCryptMask(const char* pStr, sal_Int32 nLen, long nVersion) +static unsigned char implGetCryptMask(const char* pStr, sal_Int32 nLen, tools::Long nVersion) { unsigned char nCryptMask = 0; @@ -1718,7 +1719,7 @@ std::size_t SvMemoryStream::PutData( const void* pData, std::size_t nCount ) } else { - long nNewResize; + tools::Long nNewResize; if( nSize && nSize > nResize ) nNewResize = nSize; else @@ -1772,8 +1773,8 @@ sal_uInt64 SvMemoryStream::SeekPos(sal_uInt64 const nNewPos) { if( nResize ) // Is extension possible? { - long nDiff = static_cast<long>(nNewPos - nSize + 1); - nDiff += static_cast<long>(nResize); + tools::Long nDiff = static_cast<tools::Long>(nNewPos - nSize + 1); + nDiff += static_cast<tools::Long>(nResize); ReAllocateMemory( nDiff ); nPos = nNewPos; nEndOfData = nNewPos; @@ -1808,13 +1809,13 @@ void SvMemoryStream::AllocateMemory( std::size_t nNewSize ) } // (using Bozo algorithm) -bool SvMemoryStream::ReAllocateMemory( long nDiff ) +bool SvMemoryStream::ReAllocateMemory( tools::Long nDiff ) { if (!m_isWritable || !bOwnsData) return false; bool bRetVal = false; - long nTemp = static_cast<long>(nSize); + tools::Long nTemp = static_cast<tools::Long>(nSize); nTemp += nDiff; std::size_t nNewSize = static_cast<std::size_t>(nTemp); @@ -1899,7 +1900,7 @@ void SvMemoryStream::SetSize(sal_uInt64 const nNewSize) return; } - long nDiff = static_cast<long>(nNewSize) - static_cast<long>(nSize); + tools::Long nDiff = static_cast<tools::Long>(nNewSize) - static_cast<tools::Long>(nSize); ReAllocateMemory( nDiff ); } diff --git a/tools/source/zcodec/zcodec.cxx b/tools/source/zcodec/zcodec.cxx index 36386b9bb498..1707793839c2 100644 --- a/tools/source/zcodec/zcodec.cxx +++ b/tools/source/zcodec/zcodec.cxx @@ -26,6 +26,7 @@ #include <zlib.h> #include <tools/zcodec.hxx> +#include <tools/long.hxx> /* gzip flag byte */ // GZ_ASCII_FLAG 0x01 /* bit 0 set: file probably ascii text */ @@ -77,9 +78,9 @@ void ZCodec::BeginCompression( int nCompressLevel, bool gzLib ) pStream->avail_out = pStream->avail_in = 0; } -long ZCodec::EndCompression() +tools::Long ZCodec::EndCompression() { - long retvalue = 0; + tools::Long retvalue = 0; auto pStream = static_cast<z_stream*>(mpsC_Stream); if (meState != STATE_INIT) @@ -135,12 +136,12 @@ void ZCodec::Compress( SvStream& rIStm, SvStream& rOStm ) }; } -long ZCodec::Decompress( SvStream& rIStm, SvStream& rOStm ) +tools::Long ZCodec::Decompress( SvStream& rIStm, SvStream& rOStm ) { int err; size_t nInToRead; auto pStream = static_cast<z_stream*>(mpsC_Stream); - long nOldTotal_Out = pStream->total_out; + tools::Long nOldTotal_Out = pStream->total_out; assert(meState == STATE_INIT); mpOStm = &rOStm; @@ -168,7 +169,7 @@ long ZCodec::Decompress( SvStream& rIStm, SvStream& rOStm ) while ( ( err != Z_STREAM_END) && ( pStream->avail_in || mnInToRead ) ); ImplWriteBack(); - return mbStatus ? static_cast<long>(pStream->total_out - nOldTotal_Out) : -1; + return mbStatus ? static_cast<tools::Long>(pStream->total_out - nOldTotal_Out) : -1; } void ZCodec::Write( SvStream& rOStm, const sal_uInt8* pData, sal_uInt32 nSize ) @@ -197,7 +198,7 @@ void ZCodec::Write( SvStream& rOStm, const sal_uInt8* pData, sal_uInt32 nSize ) } } -long ZCodec::Read( SvStream& rIStm, sal_uInt8* pData, sal_uInt32 nSize ) +tools::Long ZCodec::Read( SvStream& rIStm, sal_uInt8* pData, sal_uInt32 nSize ) { int err; size_t nInToRead; @@ -235,10 +236,10 @@ long ZCodec::Read( SvStream& rIStm, sal_uInt8* pData, sal_uInt32 nSize ) if ( err == Z_STREAM_END ) mbFinish = true; - return (mbStatus ? static_cast<long>(nSize - pStream->avail_out) : -1); + return (mbStatus ? static_cast<tools::Long>(nSize - pStream->avail_out) : -1); } -long ZCodec::ReadAsynchron( SvStream& rIStm, sal_uInt8* pData, sal_uInt32 nSize ) +tools::Long ZCodec::ReadAsynchron( SvStream& rIStm, sal_uInt8* pData, sal_uInt32 nSize ) { int err = 0; size_t nInToRead; @@ -285,7 +286,7 @@ long ZCodec::ReadAsynchron( SvStream& rIStm, sal_uInt8* pData, sal_uInt32 nSize if ( err == Z_STREAM_END ) mbFinish = true; - return (mbStatus ? static_cast<long>(nSize - pStream->avail_out) : -1); + return (mbStatus ? static_cast<tools::Long>(nSize - pStream->avail_out) : -1); } void ZCodec::ImplWriteBack() |