diff options
author | shashikdm <shashikant.123kadam@gmail.com> | 2019-12-08 19:46:45 +0530 |
---|---|---|
committer | Michael Stahl <michael.stahl@cib.de> | 2020-01-15 19:12:37 +0100 |
commit | cf82475c785c47327cdc9d591d63d7a82dd1ac53 (patch) | |
tree | ed639a7a4b241be91fa7edcaffc3a58cc21c4c06 /filter | |
parent | 797e0170f31ef10df0841e1cfae5c39903b6a316 (diff) |
tdf#114441 Changing sal_uLong to appropriate integer type in filters module
changed sal_uLong to one of {size_t, sal_uInt64, sal_uInt32, sal_uInt16, sal_uInt8} in flash/impswfdialog.cxx and graphicsfilter
changed PS_* in file filter/source/eps/eps.cxx to enum and overloaded bitwise or (|)
made types of nSize, nParseThis, nComp and nBytesRead to sal_uInt32 as Michael Stahl suggested
changes suggested by Michael Stahl
changed x, y, j to sal_uInt32 in filter/source/graphicfilter/etiff/etiff.cxx
changed nMinPercent, nMaxPercent, nLastPercent, nMainEntitiesCount to sal_uInt16 in filter/source/graphicfilter/idxf/dxf2mtf.hxx
removed nGcount variable from filter/source/graphicfilter/idxf/dxfgrprd.hxx and filter/source/graphicfilter/idxf/dxfgrprd.cxx
removed static_cast in filter/source/graphicfilter/idxf/dxf2mtf.cxx
changed nComp in filter/source/graphicfilter/ieps/ieps.cxx to size_t
changed mnCol to sal_uInt16 in filter/source/graphicfilter/ipbm/ipbm.cxx
revised a number of datatypes as suggested by michael stahl in his reviews
removed redundant static casts which caused test to fail
Change-Id: Id892ee7e9c1ef3cf75c9d768b790ced9c2ce3f3b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/84726
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@cib.de>
Diffstat (limited to 'filter')
20 files changed, 191 insertions, 198 deletions
diff --git a/filter/source/flash/impswfdialog.cxx b/filter/source/flash/impswfdialog.cxx index a1ad4c7ea5ff..baf498139fd8 100644 --- a/filter/source/flash/impswfdialog.cxx +++ b/filter/source/flash/impswfdialog.cxx @@ -37,7 +37,7 @@ ImpSWFDialog::ImpSWFDialog(weld::Window* pParent, Sequence< PropertyValue >& rFi , mxCheckExportOLEAsJPEG(m_xBuilder->weld_check_button("exportoleasjpeg")) , mxCheckExportMultipleFiles(m_xBuilder->weld_check_button("exportmultiplefiles")) { - const sal_uLong nCompressMode = maConfigItem.ReadInt32( "CompressMode", 75 ); + const sal_Int32 nCompressMode = maConfigItem.ReadInt32( "CompressMode", 75 ); mxNumFldQuality->set_value(nCompressMode); mxCheckExportAll->set_active(true); diff --git a/filter/source/graphicfilter/eps/eps.cxx b/filter/source/graphicfilter/eps/eps.cxx index d5d38625761d..a96a40ef62ec 100644 --- a/filter/source/graphicfilter/eps/eps.cxx +++ b/filter/source/graphicfilter/eps/eps.cxx @@ -52,11 +52,6 @@ using namespace ::com::sun::star::uno; #define PS_LINESIZE 70 // maximum number of characters a line in the output -#define PS_NONE 0 // formatting mode: action which is inserted behind the output -#define PS_SPACE 1 -#define PS_RET 2 -#define PS_WRAP 4 - // -----------------------------field-types------------------------------ namespace { @@ -92,6 +87,12 @@ struct PSLZWCTreeNode sal_uInt16 nValue; // the pixel value }; +enum NMode {PS_NONE = 0x00, PS_SPACE = 0x01, PS_RET = 0x02, PS_WRAP = 0x04}; // formatting mode: action which is inserted behind the output +inline NMode operator|(NMode a, NMode b) +{ + return static_cast<NMode>(static_cast<sal_uInt8>(a) | static_cast<sal_uInt8>(b)); +} + class PSWriter { private: @@ -116,7 +117,7 @@ private: double nBoundingY2; StackMember* pGDIStack; - sal_uLong mnCursorPos; // current cursor position in output + sal_uInt32 mnCursorPos; // current cursor position in output Color aColor; // current color which is used for output bool bLineColor; Color aLineColor; // current GDIMetafile color settings @@ -156,33 +157,33 @@ private: // this method makes LF's, space inserting and word wrapping as used in all nMode // parameters - inline void ImplExecMode( sal_uLong nMode ); + inline void ImplExecMode( NMode nMode ); // writes char[] + LF to stream - inline void ImplWriteLine( const char*, sal_uLong nMode = PS_RET ); + inline void ImplWriteLine( const char*, NMode nMode = PS_RET ); // writes ( nNumb / 10^nCount ) in ASCII format to stream - void ImplWriteF( sal_Int32 nNumb, sal_uLong nCount = 3, sal_uLong nMode = PS_SPACE ); + void ImplWriteF( sal_Int32 nNumb, sal_uInt8 nCount = 3, NMode nMode = PS_SPACE ); // writes a double in ASCII format to stream void ImplWriteDouble( double ); // writes a long in ASCII format to stream - void ImplWriteLong( sal_Int32 nNumb, sal_uLong nMode = PS_SPACE ); + void ImplWriteLong( sal_Int32 nNumb, NMode nMode = PS_SPACE ); // writes a byte in ASCII format to stream - void ImplWriteByte( sal_uInt8 nNumb, sal_uLong nMode = PS_SPACE ); + void ImplWriteByte( sal_uInt8 nNumb, NMode nMode = PS_SPACE ); // writes a byte in ASCII (hex) format to stream - void ImplWriteHexByte( sal_uInt8 nNumb, sal_uLong nMode = PS_WRAP ); + void ImplWriteHexByte( sal_uInt8 nNumb, NMode nMode = PS_WRAP ); // writes nNumb as number from 0.000 till 1.000 in ASCII format to stream void ImplWriteB1( sal_uInt8 nNumb ); inline void ImplWritePoint( const Point& ); void ImplMoveTo( const Point& ); - void ImplLineTo( const Point&, sal_uInt32 nMode = PS_SPACE ); - void ImplCurveTo( const Point& rP1, const Point& rP2, const Point& rP3, sal_uInt32 nMode ); + void ImplLineTo( const Point&, NMode nMode = PS_SPACE ); + void ImplCurveTo( const Point& rP1, const Point& rP2, const Point& rP3, NMode nMode ); void ImplTranslate( const double& fX, const double& fY ); void ImplScale( const double& fX, const double& fY ); @@ -208,15 +209,15 @@ private: void ImplClosePathDraw(); void ImplPathDraw(); - inline void ImplWriteLineColor( sal_uLong nMode ); - inline void ImplWriteFillColor( sal_uLong nMode ); - inline void ImplWriteTextColor( sal_uLong nMode ); - void ImplWriteColor( sal_uLong nMode ); + inline void ImplWriteLineColor( NMode nMode ); + inline void ImplWriteFillColor( NMode nMode ); + inline void ImplWriteTextColor( NMode nMode ); + void ImplWriteColor( NMode nMode ); static double ImplGetScaling( const MapMode& ); void ImplGetMapMode( const MapMode& ); - static bool ImplGetBoundingBox( double* nNumb, sal_uInt8* pSource, sal_uLong nSize ); - static sal_uInt8* ImplSearchEntry( sal_uInt8* pSource, sal_uInt8 const * pDest, sal_uLong nComp, sal_uLong nSize ); + static bool ImplGetBoundingBox( double* nNumb, sal_uInt8* pSource, sal_uInt32 nSize ); + static sal_uInt8* ImplSearchEntry( sal_uInt8* pSource, sal_uInt8 const * pDest, sal_uInt32 nComp, sal_uInt32 nSize ); // LZW methods void StartCompression(); void Compress( sal_uInt8 nSrc ); @@ -1102,8 +1103,8 @@ void PSWriter::ImplWriteActions( const GDIMetaFile& rMtf, VirtualDevice& rVDev ) bool bLevelConflict = false; sal_uInt8* pSource = const_cast<sal_uInt8*>(aGfxLink.GetData()); - sal_uLong nSize = aGfxLink.GetDataSize(); - sal_uLong nParseThis = POSTSCRIPT_BOUNDINGSEARCH; + sal_uInt32 nSize = aGfxLink.GetDataSize(); + sal_uInt32 nParseThis = POSTSCRIPT_BOUNDINGSEARCH; if ( nSize < 64 ) // assuming eps is larger than 64 bytes pSource = nullptr; if ( nParseThis > nSize ) @@ -1412,14 +1413,14 @@ void PSWriter::ImplMoveTo( const Point& rPoint ) ImplExecMode( PS_SPACE ); } -void PSWriter::ImplLineTo( const Point& rPoint, sal_uInt32 nMode ) +void PSWriter::ImplLineTo( const Point& rPoint, NMode nMode ) { ImplWritePoint( rPoint ); ImplWriteByte( 'l' ); ImplExecMode( nMode ); } -void PSWriter::ImplCurveTo( const Point& rP1, const Point& rP2, const Point& rP3, sal_uInt32 nMode ) +void PSWriter::ImplCurveTo( const Point& rP1, const Point& rP2, const Point& rP3, NMode nMode ) { ImplWritePoint( rP1 ); ImplWritePoint( rP2 ); @@ -2131,7 +2132,7 @@ void PSWriter::ImplPathDraw() } -inline void PSWriter::ImplWriteLineColor( sal_uLong nMode ) +inline void PSWriter::ImplWriteLineColor( NMode nMode ) { if ( aColor != aLineColor ) { @@ -2140,7 +2141,7 @@ inline void PSWriter::ImplWriteLineColor( sal_uLong nMode ) } } -inline void PSWriter::ImplWriteFillColor( sal_uLong nMode ) +inline void PSWriter::ImplWriteFillColor( NMode nMode ) { if ( aColor != aFillColor ) { @@ -2149,7 +2150,7 @@ inline void PSWriter::ImplWriteFillColor( sal_uLong nMode ) } } -inline void PSWriter::ImplWriteTextColor( sal_uLong nMode ) +inline void PSWriter::ImplWriteTextColor( NMode nMode ) { if ( aColor != aTextColor ) { @@ -2158,7 +2159,7 @@ inline void PSWriter::ImplWriteTextColor( sal_uLong nMode ) } } -void PSWriter::ImplWriteColor( sal_uLong nMode ) +void PSWriter::ImplWriteColor( NMode nMode ) { if ( mbGrayScale ) { @@ -2187,7 +2188,7 @@ void PSWriter::ImplGetMapMode( const MapMode& rMapMode ) ImplScale( fScaleX, fScaleY ); } -inline void PSWriter::ImplExecMode( sal_uLong nMode ) +inline void PSWriter::ImplExecMode( NMode nMode ) { if ( nMode & PS_WRAP ) { @@ -2210,9 +2211,9 @@ inline void PSWriter::ImplExecMode( sal_uLong nMode ) } } -inline void PSWriter::ImplWriteLine( const char* pString, sal_uLong nMode ) +inline void PSWriter::ImplWriteLine( const char* pString, NMode nMode ) { - sal_uLong i = 0; + sal_uInt32 i = 0; while ( pString[ i ] ) { mpPS->WriteUChar( pString[ i++ ] ); @@ -2359,7 +2360,7 @@ void PSWriter::ImplWriteLineInfo( const LineInfo& rLineInfo ) ImplWriteLineInfo( fLWidth, fMiterLimit, aCapType, aJoinType, l_aDashArray ); } -void PSWriter::ImplWriteLong(sal_Int32 nNumber, sal_uLong nMode) +void PSWriter::ImplWriteLong(sal_Int32 nNumber, NMode nMode) { const OString aNumber(OString::number(nNumber)); mnCursorPos += aNumber.getLength(); @@ -2410,7 +2411,7 @@ void PSWriter::ImplWriteDouble( double fNumber ) } /// Writes the number to stream: nNumber / ( 10^nCount ) -void PSWriter::ImplWriteF( sal_Int32 nNumber, sal_uLong nCount, sal_uLong nMode ) +void PSWriter::ImplWriteF( sal_Int32 nNumber, sal_uInt8 nCount, NMode nMode ) { if ( nNumber < 0 ) { @@ -2419,7 +2420,7 @@ void PSWriter::ImplWriteF( sal_Int32 nNumber, sal_uLong nCount, sal_uLong nMode mnCursorPos++; } const OString aScaleFactor(OString::number(nNumber)); - sal_uLong nLen = aScaleFactor.getLength(); + sal_uInt32 nLen = aScaleFactor.getLength(); long nStSize = ( nCount + 1 ) - nLen; if ( nStSize >= 1 ) { @@ -2436,7 +2437,7 @@ void PSWriter::ImplWriteF( sal_Int32 nNumber, sal_uLong nCount, sal_uLong nMode } } mnCursorPos += nLen; - for( sal_uLong n = 0; n < nLen; n++ ) + for( sal_uInt32 n = 0; n < nLen; n++ ) { if ( n == nLen - nCount ) { @@ -2448,14 +2449,14 @@ void PSWriter::ImplWriteF( sal_Int32 nNumber, sal_uLong nCount, sal_uLong nMode ImplExecMode( nMode ); } -void PSWriter::ImplWriteByte( sal_uInt8 nNumb, sal_uLong nMode ) +void PSWriter::ImplWriteByte( sal_uInt8 nNumb, NMode nMode ) { mpPS->WriteUChar( nNumb ); mnCursorPos++; ImplExecMode( nMode ); } -void PSWriter::ImplWriteHexByte( sal_uInt8 nNumb, sal_uLong nMode ) +void PSWriter::ImplWriteHexByte( sal_uInt8 nNumb, NMode nMode ) { if ( ( nNumb >> 4 ) > 9 ) mpPS->WriteUChar( ( nNumb >> 4 ) + 'A' - 10 ); @@ -2577,11 +2578,11 @@ void PSWriter::EndCompression() pTable.reset(); } -sal_uInt8* PSWriter::ImplSearchEntry( sal_uInt8* pSource, sal_uInt8 const * pDest, sal_uLong nComp, sal_uLong nSize ) +sal_uInt8* PSWriter::ImplSearchEntry( sal_uInt8* pSource, sal_uInt8 const * pDest, sal_uInt32 nComp, sal_uInt32 nSize ) { while ( nComp-- >= nSize ) { - sal_uLong i; + sal_uInt64 i; for ( i = 0; i < nSize; i++ ) { if ( ( pSource[i]&~0x20 ) != ( pDest[i]&~0x20 ) ) @@ -2594,10 +2595,10 @@ sal_uInt8* PSWriter::ImplSearchEntry( sal_uInt8* pSource, sal_uInt8 const * pDes return nullptr; } -bool PSWriter::ImplGetBoundingBox( double* nNumb, sal_uInt8* pSource, sal_uLong nSize ) +bool PSWriter::ImplGetBoundingBox( double* nNumb, sal_uInt8* pSource, sal_uInt32 nSize ) { bool bRetValue = false; - sal_uLong nBytesRead; + sal_uInt32 nBytesRead; if ( nSize < 256 ) // we assume that the file is greater than 256 bytes return false; diff --git a/filter/source/graphicfilter/etiff/etiff.cxx b/filter/source/graphicfilter/etiff/etiff.cxx index aaccd16bf73a..76c4a8f8ee05 100644 --- a/filter/source/graphicfilter/etiff/etiff.cxx +++ b/filter/source/graphicfilter/etiff/etiff.cxx @@ -97,7 +97,7 @@ private: void ImplWritePalette(); void ImplWriteBody(); void ImplWriteTag( sal_uInt16 TagID, sal_uInt16 DataType, sal_uInt32 NumberOfItems, sal_uInt32 Value); - void ImplWriteResolution( sal_uLong nStreamPos, sal_uInt32 nResolutionUnit ); + void ImplWriteResolution( sal_uInt64 nStreamPos, sal_uInt32 nResolutionUnit ); void StartCompression(); void Compress( sal_uInt8 nSrc ); void EndCompression(); @@ -313,7 +313,7 @@ bool TIFFWriter::ImplWriteHeader( bool bMultiPage ) void TIFFWriter::ImplWritePalette() { - sal_uLong nCurrentPos = m_rOStm.Tell(); + sal_uInt64 nCurrentPos = m_rOStm.Tell(); m_rOStm.Seek( mnPalPos + 8 ); // the palette tag entry needs the offset m_rOStm.WriteUInt32( nCurrentPos - mnStreamOfs ); // to the palette colors m_rOStm.Seek( nCurrentPos ); @@ -340,9 +340,9 @@ void TIFFWriter::ImplWriteBody() { sal_uInt8 nTemp = 0; sal_uInt8 nShift; - sal_uLong j, x, y; + sal_uInt32 j, x, y; - sal_uLong nGfxBegin = m_rOStm.Tell(); + sal_uInt64 nGfxBegin = m_rOStm.Tell(); m_rOStm.Seek( mnBitmapPos + 8 ); // the strip offset tag entry needs the offset m_rOStm.WriteUInt32( nGfxBegin - mnStreamOfs ); // to the bitmap data m_rOStm.Seek( nGfxBegin ); @@ -438,7 +438,7 @@ void TIFFWriter::ImplWriteBody() if ( mnStripByteCountPos && mbStatus ) { - sal_uLong nGfxEnd = m_rOStm.Tell(); + sal_uInt64 nGfxEnd = m_rOStm.Tell(); m_rOStm.Seek( mnStripByteCountPos + 8 ); m_rOStm.WriteUInt32( nGfxEnd - nGfxBegin ); // mnStripByteCountPos needs the size of the compression data m_rOStm.Seek( nGfxEnd ); @@ -446,9 +446,9 @@ void TIFFWriter::ImplWriteBody() } -void TIFFWriter::ImplWriteResolution( sal_uLong nStreamPos, sal_uInt32 nResolutionUnit ) +void TIFFWriter::ImplWriteResolution( sal_uInt64 nStreamPos, sal_uInt32 nResolutionUnit ) { - sal_uLong nCurrentPos = m_rOStm.Tell(); + sal_uInt64 nCurrentPos = m_rOStm.Tell(); m_rOStm.Seek( nStreamPos + 8 ); m_rOStm.WriteUInt32( nCurrentPos - mnStreamOfs ); m_rOStm.Seek( nCurrentPos ); diff --git a/filter/source/graphicfilter/idxf/dxf2mtf.cxx b/filter/source/graphicfilter/idxf/dxf2mtf.cxx index 3c8ce673547a..c193961cff41 100644 --- a/filter/source/graphicfilter/idxf/dxf2mtf.cxx +++ b/filter/source/graphicfilter/idxf/dxf2mtf.cxx @@ -28,10 +28,10 @@ #include <math.h> -sal_uLong DXF2GDIMetaFile::CountEntities(const DXFEntities & rEntities) +sal_uInt64 DXF2GDIMetaFile::CountEntities(const DXFEntities & rEntities) { const DXFBasicEntity * pBE; - sal_uLong nRes; + sal_uInt64 nRes; nRes=0; for (pBE=rEntities.pFirst; pBE!=nullptr; pBE=pBE->pSucc) nRes++; @@ -784,8 +784,8 @@ bool DXF2GDIMetaFile::Convert(const DXFRepresentation & rDXF, GDIMetaFile & rMTF OptPointsPerCircle=50; - nMinPercent=static_cast<sal_uLong>(nminpercent); - nMaxPercent=static_cast<sal_uLong>(nmaxpercent); + nMinPercent=nminpercent; + nMaxPercent=nmaxpercent; nLastPercent=nMinPercent; nMainEntitiesCount=CountEntities(pDXF->aEntities); diff --git a/filter/source/graphicfilter/idxf/dxf2mtf.hxx b/filter/source/graphicfilter/idxf/dxf2mtf.hxx index 27ec1fbda76a..31ef84498056 100644 --- a/filter/source/graphicfilter/idxf/dxf2mtf.hxx +++ b/filter/source/graphicfilter/idxf/dxf2mtf.hxx @@ -37,10 +37,10 @@ private: sal_uInt16 OptPointsPerCircle; - sal_uLong nMinPercent; - sal_uLong nMaxPercent; - sal_uLong nLastPercent; - sal_uLong nMainEntitiesCount; + sal_uInt16 nMinPercent; + sal_uInt16 nMaxPercent; + sal_uInt16 nLastPercent; + sal_uInt16 nMainEntitiesCount; long nBlockColor; DXFLineInfo aBlockDXFLineInfo; @@ -51,7 +51,7 @@ private: vcl::Font aActFont; const LineInfo aDefaultLineInfo; // to share between lines to reduce memory - static sal_uLong CountEntities(const DXFEntities & rEntities); + static sal_uInt64 CountEntities(const DXFEntities & rEntities); Color ConvertColor(sal_uInt8 nColor); diff --git a/filter/source/graphicfilter/idxf/dxfgrprd.cxx b/filter/source/graphicfilter/idxf/dxfgrprd.cxx index 5d28a1b04c5e..9a65e560c57f 100644 --- a/filter/source/graphicfilter/idxf/dxfgrprd.cxx +++ b/filter/source/graphicfilter/idxf/dxfgrprd.cxx @@ -30,7 +30,7 @@ static OString DXFReadLine(SvStream& rIStm) { char buf[256 + 1]; bool bEnd = false; - sal_uLong nOldFilePos = rIStm.Tell(); + sal_uInt64 nOldFilePos = rIStm.Tell(); char c = 0; OStringBuffer aBuf(512); @@ -109,7 +109,6 @@ DXFGroupReader::DXFGroupReader(SvStream & rIStream) : rIS(rIStream) , bStatus(true) , nLastG(0) - , nGCount(0) , S() , I(0) { @@ -121,7 +120,6 @@ sal_uInt16 DXFGroupReader::Read() sal_uInt16 nG = 0; if ( bStatus ) { - nGCount++; nG = static_cast<sal_uInt16>(ReadI()); if ( bStatus ) { @@ -152,11 +150,6 @@ sal_uInt16 DXFGroupReader::Read() { nG = 0; S = "EOF"; - if ( nGCount != 0xffffffff ) - { - // InfoBox(NULL,String("Error in group # ")+String(nGCount)).Execute(); - nGCount=0xffffffff; - } } nLastG = nG; return nG; diff --git a/filter/source/graphicfilter/idxf/dxfgrprd.hxx b/filter/source/graphicfilter/idxf/dxfgrprd.hxx index 4ed4450d0017..d97f81a48e1b 100644 --- a/filter/source/graphicfilter/idxf/dxfgrprd.hxx +++ b/filter/source/graphicfilter/idxf/dxfgrprd.hxx @@ -69,7 +69,6 @@ private: SvStream & rIS; bool bStatus; sal_uInt16 nLastG; - sal_uLong nGCount; OString S; union { diff --git a/filter/source/graphicfilter/ieps/ieps.cxx b/filter/source/graphicfilter/ieps/ieps.cxx index 4ad7349149e3..7cf34b6493aa 100644 --- a/filter/source/graphicfilter/ieps/ieps.cxx +++ b/filter/source/graphicfilter/ieps/ieps.cxx @@ -50,11 +50,11 @@ class FilterConfigItem; |* *************************************************************************/ -static sal_uInt8* ImplSearchEntry( sal_uInt8* pSource, sal_uInt8 const * pDest, sal_uLong nComp, sal_uLong nSize ) +static sal_uInt8* ImplSearchEntry( sal_uInt8* pSource, sal_uInt8 const * pDest, size_t nComp, size_t nSize ) { while ( nComp-- >= nSize ) { - sal_uLong i; + size_t i; for ( i = 0; i < nSize; i++ ) { if ( ( pSource[i]&~0x20 ) != ( pDest[i]&~0x20 ) ) diff --git a/filter/source/graphicfilter/ipbm/ipbm.cxx b/filter/source/graphicfilter/ipbm/ipbm.cxx index 3e882aa3c884..d9049f43d1d4 100644 --- a/filter/source/graphicfilter/ipbm/ipbm.cxx +++ b/filter/source/graphicfilter/ipbm/ipbm.cxx @@ -37,12 +37,12 @@ private: bool mbStatus; bool mbRemark; // sal_False if the stream is in a comment bool mbRaw; // RAW/ASCII MODE - sal_uLong mnMode; // 0->PBM, 1->PGM, 2->PPM + sal_uInt8 mnMode; // 0->PBM, 1->PGM, 2->PPM std::unique_ptr<vcl::bitmap::RawBitmap> mpRawBmp; std::vector<Color> mvPalette; sal_Int32 mnWidth, mnHeight; // dimensions in pixel - sal_uLong mnCol; - sal_uLong mnMaxVal; // max value in the <missing comment> + sal_uInt16 mnCol; + sal_uInt64 mnMaxVal; // max value in the <missing comment> bool ImplReadBody(); bool ImplReadHeader(); @@ -113,9 +113,9 @@ bool PBMReader::ReadPBM(Graphic & rGraphic ) mnCol = 256; mvPalette.resize( 256 ); - for ( sal_uLong i = 0; i < mnCol; i++ ) + for ( sal_uInt16 i = 0; i < mnCol; i++ ) { - sal_uLong nCount = 255 * i / mnCol; + sal_uInt16 nCount = 255 * i / mnCol; mvPalette[i] = Color( static_cast<sal_uInt8>(nCount), static_cast<sal_uInt8>(nCount), static_cast<sal_uInt8>(nCount) ); } break; @@ -240,12 +240,12 @@ bool PBMReader::ImplReadHeader() } else if ( nCount == 2 ) { - if (mnMaxVal > std::numeric_limits<sal_uLong>::max() / 10) + if (mnMaxVal > std::numeric_limits<sal_uInt64>::max() / 10) { return false; } mnMaxVal *= 10; - if (nDat > std::numeric_limits<sal_uLong>::max() - mnMaxVal) + if (nDat > std::numeric_limits<sal_uInt64>::max() - mnMaxVal) { return false; } @@ -261,7 +261,7 @@ bool PBMReader::ImplReadHeader() bool PBMReader::ImplReadBody() { sal_uInt8 nDat = 0, nCount; - sal_uLong nGrey, nRGB[3]; + sal_uInt64 nGrey, nRGB[3]; sal_Int32 nWidth = 0; sal_Int32 nHeight = 0; @@ -319,12 +319,12 @@ bool PBMReader::ImplReadBody() return false; sal_uInt8 nR, nG, nB; - sal_uLong nRed, nGreen, nBlue; + sal_uInt8 nRed, nGreen, nBlue; mrPBM.ReadUChar( nR ).ReadUChar( nG ).ReadUChar( nB ); nRed = 255 * nR / mnMaxVal; nGreen = 255 * nG / mnMaxVal; nBlue = 255 * nB / mnMaxVal; - mpRawBmp->SetPixel( nHeight, nWidth++, Color( static_cast<sal_uInt8>(nRed), static_cast<sal_uInt8>(nGreen), static_cast<sal_uInt8>(nBlue) ) ); + mpRawBmp->SetPixel( nHeight, nWidth++, Color( nRed, nGreen, nBlue ) ); if ( nWidth == mnWidth ) { nWidth = 0; @@ -393,7 +393,7 @@ bool PBMReader::ImplReadBody() nCount--; if ( nGrey <= mnMaxVal ) nGrey = 255 * nGrey / mnMaxVal; - mpRawBmp->SetPixel( nHeight, nWidth++, mvPalette[static_cast<sal_uInt8>(nGrey)] ); + mpRawBmp->SetPixel( nHeight, nWidth++, mvPalette[nGrey] ); nGrey = 0; if ( nWidth == mnWidth ) { diff --git a/filter/source/graphicfilter/ipcd/ipcd.cxx b/filter/source/graphicfilter/ipcd/ipcd.cxx index 6da5f9c50f02..4aa33c116796 100644 --- a/filter/source/graphicfilter/ipcd/ipcd.cxx +++ b/filter/source/graphicfilter/ipcd/ipcd.cxx @@ -55,13 +55,13 @@ private: PCDResolution eResolution; // which resolution we want - sal_uLong nWidth; // width of the PCD picture - sal_uLong nHeight; // height of the PCD picture - sal_uLong nImagePos; // position of the picture within the PCD file + sal_uInt32 nWidth; // width of the PCD picture + sal_uInt32 nHeight; // height of the PCD picture + sal_uInt32 nImagePos; // position of the picture within the PCD file // temporary lLue-Green-Red-Bitmap - sal_uLong nBMPWidth; - sal_uLong nBMPHeight; + sal_uInt32 nBMPWidth; + sal_uInt32 nBMPHeight; void CheckPCDImagePacFile(); // checks whether it's a Photo-CD file with 'Image Pac' @@ -183,7 +183,7 @@ void PCDReader::ReadOrientation() void PCDReader::ReadImage() { - sal_uLong nx,ny,nW2,nH2,nYPair,ndy,nXPair; + sal_uInt32 nx,ny,nW2,nH2,nYPair,ndy,nXPair; long nL,nCb,nCr,nRed,nGreen,nBlue; sal_uInt8 * pt; sal_uInt8 * pL0; // luminance for each pixel of the 1st row of the current pair of rows diff --git a/filter/source/graphicfilter/ipcx/ipcx.cxx b/filter/source/graphicfilter/ipcx/ipcx.cxx index e4e4575618cd..67cbc947fefc 100644 --- a/filter/source/graphicfilter/ipcx/ipcx.cxx +++ b/filter/source/graphicfilter/ipcx/ipcx.cxx @@ -39,9 +39,9 @@ private: std::vector<Color> mvPalette; sal_uInt8 nVersion; // PCX-Version sal_uInt8 nEncoding; // compression type - sal_uLong nBitsPerPlanePix; // bits per plane per pixel - sal_uLong nPlanes; // no of planes - sal_uLong nBytesPerPlaneLin; // bytes per plane line + sal_uInt16 nBitsPerPlanePix; // bits per plane per pixel + sal_uInt16 nPlanes; // no of planes + sal_uInt16 nBytesPerPlaneLin; // bytes per plane line sal_uInt32 nWidth, nHeight; // dimension in pixel sal_uInt16 nResX, nResY; // resolution in pixel per inch or 0,0 @@ -52,7 +52,7 @@ private: void ImplReadBody(); - void ImplReadPalette( sal_uLong nCol ); + void ImplReadPalette( unsigned int nCol ); void ImplReadHeader(); public: @@ -160,7 +160,7 @@ void PCXReader::ImplReadHeader() } nbyte = 0; - m_rPCX.ReadUChar( nbyte ); nBitsPerPlanePix = static_cast<sal_uLong>(nbyte); + m_rPCX.ReadUChar( nbyte ); nBitsPerPlanePix = static_cast<sal_uInt16>(nbyte); sal_uInt16 nMinX(0),nMinY(0),nMaxX(0),nMaxY(0); m_rPCX.ReadUInt16( nMinX ).ReadUInt16( nMinY ).ReadUInt16( nMaxX ).ReadUInt16( nMaxY ); @@ -182,15 +182,15 @@ void PCXReader::ImplReadHeader() m_rPCX.SeekRel( 1 ); nbyte = 0; - m_rPCX.ReadUChar( nbyte ); nPlanes = static_cast<sal_uLong>(nbyte); + m_rPCX.ReadUChar( nbyte ); nPlanes = static_cast<sal_uInt16>(nbyte); sal_uInt16 nushort(0); - m_rPCX.ReadUInt16( nushort ); nBytesPerPlaneLin = static_cast<sal_uLong>(nushort); + m_rPCX.ReadUInt16( nushort ); nBytesPerPlaneLin = nushort; sal_uInt16 nPaletteInfo; m_rPCX.ReadUInt16( nPaletteInfo ); m_rPCX.SeekRel( 58 ); - nDestBitsPerPixel = static_cast<sal_uInt16>( nBitsPerPlanePix * nPlanes ); + nDestBitsPerPixel = nBitsPerPlanePix * nPlanes; if (nDestBitsPerPixel == 2 || nDestBitsPerPixel == 3) nDestBitsPerPixel = 4; if ( ( nDestBitsPerPixel != 1 && nDestBitsPerPixel != 4 && nDestBitsPerPixel != 8 && nDestBitsPerPixel != 24 ) @@ -213,8 +213,8 @@ void PCXReader::ImplReadBody() { std::unique_ptr<sal_uInt8[]> pPlane[ 4 ]; sal_uInt8 * pDest; - sal_uLong i, nx, ny, np, nCount, nPercent; - sal_uLong nLastPercent = 0; + sal_uInt32 i, ny, nLastPercent = 0, nPercent; + sal_uInt16 nCount, nx, np; sal_uInt8 nDat = 0, nCol = 0; for( np = 0; np < nPlanes; np++ ) @@ -252,7 +252,7 @@ void PCXReader::ImplReadBody() m_rPCX.ReadUChar( nDat ); if ( ( nDat & 0xc0 ) == 0xc0 ) { - nCount =static_cast<sal_uLong>(nDat) & 0x003f; + nCount =static_cast<sal_uInt64>(nDat) & 0x003f; m_rPCX.ReadUChar( nDat ); if ( nCount < nx ) { @@ -293,7 +293,7 @@ void PCXReader::ImplReadBody() case 0x101 : for ( i = 0; i < nWidth; i++ ) { - sal_uLong nShift = ( i & 7 ) ^ 7; + sal_uInt32 nShift = ( i & 7 ) ^ 7; if ( nShift == 0 ) mpBitmap->SetPixel( ny, i, mvPalette[*(pSource1++) & 1] ); else @@ -333,7 +333,7 @@ void PCXReader::ImplReadBody() case 0x301 : for ( i = 0; i < nWidth; i++ ) { - sal_uLong nShift = ( i & 7 ) ^ 7; + sal_uInt32 nShift = ( i & 7 ) ^ 7; if ( nShift == 0 ) { nCol = ( *pSource1++ & 1) + ( ( *pSource2++ << 1 ) & 2 ) + ( ( *pSource3++ << 2 ) & 4 ); @@ -352,7 +352,7 @@ void PCXReader::ImplReadBody() case 0x401 : for ( i = 0; i < nWidth; i++ ) { - sal_uLong nShift = ( i & 7 ) ^ 7; + sal_uInt32 nShift = ( i & 7 ) ^ 7; if ( nShift == 0 ) { nCol = ( *pSource1++ & 1) + ( ( *pSource2++ << 1 ) & 2 ) + ( ( *pSource3++ << 2 ) & 4 ) + @@ -383,11 +383,11 @@ void PCXReader::ImplReadBody() } } -void PCXReader::ImplReadPalette( sal_uLong nCol ) +void PCXReader::ImplReadPalette( unsigned int nCol ) { sal_uInt8 r, g, b; sal_uInt8* pPtr = pPalette.get(); - for ( sal_uLong i = 0; i < nCol; i++ ) + for ( unsigned int i = 0; i < nCol; i++ ) { m_rPCX.ReadUChar( r ).ReadUChar( g ).ReadUChar( b ); *pPtr++ = r; diff --git a/filter/source/graphicfilter/ipict/ipict.cxx b/filter/source/graphicfilter/ipict/ipict.cxx index 2a6f792c8883..b78fbbbca5a3 100644 --- a/filter/source/graphicfilter/ipict/ipict.cxx +++ b/filter/source/graphicfilter/ipict/ipict.cxx @@ -51,7 +51,7 @@ namespace PictReaderInternal { {} //! reads black/white pattern from SvStream - sal_uLong read(SvStream &stream); + sal_uInt8 read(SvStream &stream); //! sets the color void setColor(Color col) { isColor = true; color = col; } /** returns a color which can be "used" to replace the pattern, @@ -90,9 +90,9 @@ namespace PictReaderInternal { } - sal_uLong Pattern::read(SvStream &stream) { + sal_uInt8 Pattern::read(SvStream &stream) { unsigned char nbyte[8]; - sal_uLong nHiBytes, nLoBytes; + sal_uInt32 nHiBytes, nLoBytes; isColor = false; // count the no of bits in pattern which are set to 1: @@ -105,14 +105,14 @@ namespace PictReaderInternal { } // store pattern in 2 long words: - nHiBytes=(((((static_cast<sal_uLong>(nbyte[0])<<8)| - static_cast<sal_uLong>(nbyte[1]))<<8)| - static_cast<sal_uLong>(nbyte[2]))<<8)| - static_cast<sal_uLong>(nbyte[3]); - nLoBytes=(((((static_cast<sal_uLong>(nbyte[4])<<8)| - static_cast<sal_uLong>(nbyte[5]))<<8)| - static_cast<sal_uLong>(nbyte[6]))<<8)| - static_cast<sal_uLong>(nbyte[7]); + nHiBytes=(((((static_cast<sal_uInt32>(nbyte[0])<<8)| + static_cast<sal_uInt32>(nbyte[1]))<<8)| + static_cast<sal_uInt32>(nbyte[2]))<<8)| + static_cast<sal_uInt32>(nbyte[3]); + nLoBytes=(((((static_cast<sal_uInt32>(nbyte[4])<<8)| + static_cast<sal_uInt32>(nbyte[5]))<<8)| + static_cast<sal_uInt32>(nbyte[6]))<<8)| + static_cast<sal_uInt32>(nbyte[7]); // create a PenStyle: if (nBitCount<=0) penStyle=PEN_NULL; @@ -157,7 +157,7 @@ private: VclPtr<VirtualDevice> pVirDev; // Here the drawing method will be called. // A recording into the GDIMetaFile will take place. - sal_uLong nOrigPos; // Initial position in pPict. + sal_uInt64 nOrigPos; // Initial position in pPict. bool IsVersion2; // If it is a version 2 Pictfile. tools::Rectangle aBoundingRect; // Min/Max-Rectangle for the whole drawing. @@ -194,32 +194,32 @@ private: void ReadRectangle(tools::Rectangle & rRect); - sal_uLong ReadPolygon(tools::Polygon & rPoly); + sal_uInt64 ReadPolygon(tools::Polygon & rPoly); - sal_uLong ReadPixPattern(Pattern &pattern); + sal_uInt64 ReadPixPattern(Pattern &pattern); tools::Rectangle aLastRect; - sal_uLong ReadAndDrawRect(PictDrawingMethod eMethod); - sal_uLong ReadAndDrawSameRect(PictDrawingMethod eMethod); + sal_uInt8 ReadAndDrawRect(PictDrawingMethod eMethod); + sal_uInt8 ReadAndDrawSameRect(PictDrawingMethod eMethod); tools::Rectangle aLastRoundRect; - sal_uLong ReadAndDrawRoundRect(PictDrawingMethod eMethod); - sal_uLong ReadAndDrawSameRoundRect(PictDrawingMethod eMethod); + sal_uInt8 ReadAndDrawRoundRect(PictDrawingMethod eMethod); + sal_uInt8 ReadAndDrawSameRoundRect(PictDrawingMethod eMethod); tools::Rectangle aLastOval; - sal_uLong ReadAndDrawOval(PictDrawingMethod eMethod); - sal_uLong ReadAndDrawSameOval(PictDrawingMethod eMethod); + sal_uInt8 ReadAndDrawOval(PictDrawingMethod eMethod); + sal_uInt8 ReadAndDrawSameOval(PictDrawingMethod eMethod); tools::Polygon aLastPolygon; - sal_uLong ReadAndDrawPolygon(PictDrawingMethod eMethod); - sal_uLong ReadAndDrawSamePolygon(PictDrawingMethod eMethod); + sal_uInt64 ReadAndDrawPolygon(PictDrawingMethod eMethod); + sal_uInt8 ReadAndDrawSamePolygon(PictDrawingMethod eMethod); tools::Rectangle aLastArcRect; - sal_uLong ReadAndDrawArc(PictDrawingMethod eMethod); - sal_uLong ReadAndDrawSameArc(PictDrawingMethod eMethod); + sal_uInt8 ReadAndDrawArc(PictDrawingMethod eMethod); + sal_uInt8 ReadAndDrawSameArc(PictDrawingMethod eMethod); - sal_uLong ReadAndDrawRgn(PictDrawingMethod eMethod); - sal_uLong ReadAndDrawSameRgn(PictDrawingMethod eMethod); + sal_uInt64 ReadAndDrawRgn(PictDrawingMethod eMethod); + sal_uInt8 ReadAndDrawSameRgn(PictDrawingMethod eMethod); // returns true if there's no need to print the shape/text/frame bool IsInvisible( PictDrawingMethod eMethod ) const { @@ -230,16 +230,16 @@ private: void DrawingMethod(PictDrawingMethod eMethod); - sal_uLong ReadAndDrawText(); + sal_uInt64 ReadAndDrawText(); - sal_uLong ReadPixMapEtc(BitmapEx & rBitmap, bool bBaseAddr, bool bColorTable, + sal_uInt64 ReadPixMapEtc(BitmapEx & rBitmap, bool bBaseAddr, bool bColorTable, tools::Rectangle * pSrcRect, tools::Rectangle * pDestRect, bool bMode, bool bMaskRgn); void ReadHeader(); // Reads the header of the Pict file, set IsVersion and aBoundingRect - sal_uLong ReadData(sal_uInt16 nOpcode); + sal_uInt64 ReadData(sal_uInt16 nOpcode); // Reads the date of anOopcode and executes the operation. // The number of data bytes belonging to the opcode will be returned // in any case. @@ -459,12 +459,12 @@ void PictReader::ReadRectangle(tools::Rectangle & rRect) SAL_INFO("filter.pict", "ReadRectangle: " << rRect); } -sal_uLong PictReader::ReadPolygon(tools::Polygon & rPoly) +sal_uInt64 PictReader::ReadPolygon(tools::Polygon & rPoly) { sal_uInt16 nSize(0); pPict->ReadUInt16(nSize); pPict->SeekRel(8); - sal_uLong nDataSize = static_cast<sal_uLong>(nSize); + sal_uInt64 nDataSize = static_cast<sal_uInt64>(nSize); nSize=(nSize-10)/4; const size_t nMaxPossiblePoints = pPict->remainingSize() / 2 * sizeof(sal_uInt16); if (nSize > nMaxPossiblePoints) @@ -485,14 +485,14 @@ sal_uLong PictReader::ReadPolygon(tools::Polygon & rPoly) return nDataSize; } -sal_uLong PictReader::ReadPixPattern(PictReader::Pattern &pattern) +sal_uInt64 PictReader::ReadPixPattern(PictReader::Pattern &pattern) { // Don't know if this is correct because no picture which contains PixPatterns found. // Here again the attempt to calculate the size of the date to create simple StarView-Styles // from them. Luckily a PixPattern always contains a normal pattern. - sal_uLong nDataSize; + sal_uInt64 nDataSize; sal_uInt16 nPatType; BitmapEx aBMP; @@ -517,14 +517,14 @@ sal_uLong PictReader::ReadPixPattern(PictReader::Pattern &pattern) return nDataSize; } -sal_uLong PictReader::ReadAndDrawRect(PictDrawingMethod eMethod) +sal_uInt8 PictReader::ReadAndDrawRect(PictDrawingMethod eMethod) { ReadRectangle(aLastRect); ReadAndDrawSameRect(eMethod); return 8; } -sal_uLong PictReader::ReadAndDrawSameRect(PictDrawingMethod eMethod) +sal_uInt8 PictReader::ReadAndDrawSameRect(PictDrawingMethod eMethod) { if (IsInvisible(eMethod)) return 0; DrawingMethod(eMethod); @@ -532,14 +532,14 @@ sal_uLong PictReader::ReadAndDrawSameRect(PictDrawingMethod eMethod) return 0; } -sal_uLong PictReader::ReadAndDrawRoundRect(PictDrawingMethod eMethod) +sal_uInt8 PictReader::ReadAndDrawRoundRect(PictDrawingMethod eMethod) { ReadRectangle(aLastRoundRect); ReadAndDrawSameRoundRect(eMethod); return 8; } -sal_uLong PictReader::ReadAndDrawSameRoundRect(PictDrawingMethod eMethod) +sal_uInt8 PictReader::ReadAndDrawSameRoundRect(PictDrawingMethod eMethod) { if (IsInvisible(eMethod)) return 0; DrawingMethod(eMethod); @@ -547,14 +547,14 @@ sal_uLong PictReader::ReadAndDrawSameRoundRect(PictDrawingMethod eMethod) return 0; } -sal_uLong PictReader::ReadAndDrawOval(PictDrawingMethod eMethod) +sal_uInt8 PictReader::ReadAndDrawOval(PictDrawingMethod eMethod) { ReadRectangle(aLastOval); ReadAndDrawSameOval(eMethod); return 8; } -sal_uLong PictReader::ReadAndDrawSameOval(PictDrawingMethod eMethod) +sal_uInt8 PictReader::ReadAndDrawSameOval(PictDrawingMethod eMethod) { if (IsInvisible(eMethod)) return 0; DrawingMethod(eMethod); @@ -562,15 +562,15 @@ sal_uLong PictReader::ReadAndDrawSameOval(PictDrawingMethod eMethod) return 0; } -sal_uLong PictReader::ReadAndDrawPolygon(PictDrawingMethod eMethod) +sal_uInt64 PictReader::ReadAndDrawPolygon(PictDrawingMethod eMethod) { - sal_uLong nDataSize; + sal_uInt64 nDataSize; nDataSize=ReadPolygon(aLastPolygon); ReadAndDrawSamePolygon(eMethod); return nDataSize; } -sal_uLong PictReader::ReadAndDrawSamePolygon(PictDrawingMethod eMethod) +sal_uInt8 PictReader::ReadAndDrawSamePolygon(PictDrawingMethod eMethod) { if (IsInvisible(eMethod)) return 0; DrawingMethod(eMethod); @@ -579,14 +579,14 @@ sal_uLong PictReader::ReadAndDrawSamePolygon(PictDrawingMethod eMethod) } -sal_uLong PictReader::ReadAndDrawArc(PictDrawingMethod eMethod) +sal_uInt8 PictReader::ReadAndDrawArc(PictDrawingMethod eMethod) { ReadRectangle(aLastArcRect); ReadAndDrawSameArc(eMethod); return 12; } -sal_uLong PictReader::ReadAndDrawSameArc(PictDrawingMethod eMethod) +sal_uInt8 PictReader::ReadAndDrawSameArc(PictDrawingMethod eMethod) { short nstartAngle, narcAngle; double fAng1, fAng2; @@ -606,7 +606,7 @@ sal_uLong PictReader::ReadAndDrawSameArc(PictDrawingMethod eMethod) return 4; } -sal_uLong PictReader::ReadAndDrawRgn(PictDrawingMethod eMethod) +sal_uInt64 PictReader::ReadAndDrawRgn(PictDrawingMethod eMethod) { sal_uInt16 nSize; @@ -626,10 +626,10 @@ sal_uLong PictReader::ReadAndDrawRgn(PictDrawingMethod eMethod) // - takes M and inverts all values in [a_0,b_0-1], in [a_1,b_1-1] ... // - sets M = new y_i line mask ReadAndDrawSameRgn(eMethod); - return static_cast<sal_uLong>(nSize); + return static_cast<sal_uInt64>(nSize); } -sal_uLong PictReader::ReadAndDrawSameRgn(PictDrawingMethod eMethod) +sal_uInt8 PictReader::ReadAndDrawSameRgn(PictDrawingMethod eMethod) { if (IsInvisible(eMethod)) return 0; DrawingMethod(eMethod); @@ -691,13 +691,13 @@ void PictReader::DrawingMethod(PictDrawingMethod eMethod) eActMethod=eMethod; } -sal_uLong PictReader::ReadAndDrawText() +sal_uInt64 PictReader::ReadAndDrawText() { char nByteLen; sal_uInt32 nLen, nDataLen; char sText[256]; - pPict->ReadChar( nByteLen ); nLen=static_cast<sal_uLong>(nByteLen)&0x000000ff; + pPict->ReadChar( nByteLen ); nLen=static_cast<sal_uInt32>(nByteLen)&0x000000ff; nDataLen = nLen + 1; pPict->ReadBytes(&sText, nLen); @@ -713,7 +713,7 @@ sal_uLong PictReader::ReadAndDrawText() return nDataLen; } -sal_uLong PictReader::ReadPixMapEtc( BitmapEx &rBitmap, bool bBaseAddr, bool bColorTable, tools::Rectangle* pSrcRect, +sal_uInt64 PictReader::ReadPixMapEtc( BitmapEx &rBitmap, bool bBaseAddr, bool bColorTable, tools::Rectangle* pSrcRect, tools::Rectangle* pDestRect, bool bMode, bool bMaskRgn ) { std::unique_ptr<vcl::bitmap::RawBitmap> pBitmap; @@ -805,7 +805,7 @@ sal_uLong PictReader::ReadPixMapEtc( BitmapEx &rBitmap, bool bBaseAddr, bool bCo { sal_uInt16 nTop, nLeft, nBottom, nRight; pPict->ReadUInt16( nTop ).ReadUInt16( nLeft ).ReadUInt16( nBottom ).ReadUInt16( nRight ); - *pSrcRect = tools::Rectangle( static_cast<sal_uLong>(nLeft), static_cast<sal_uLong>(nTop), static_cast<sal_uLong>(nRight), static_cast<sal_uLong>(nBottom) ); + *pSrcRect = tools::Rectangle(nLeft, nTop, nRight, nBottom); nDataSize += 8; } @@ -832,7 +832,7 @@ sal_uLong PictReader::ReadPixMapEtc( BitmapEx &rBitmap, bool bBaseAddr, bool bCo sal_uInt16 nSize; pPict->ReadUInt16( nSize ); pPict->SeekRel( nSize - 2 ); - nDataSize += static_cast<sal_uLong>(nSize); + nDataSize += nSize; } // read and write Bitmap bits: @@ -882,14 +882,14 @@ sal_uLong PictReader::ReadPixMapEtc( BitmapEx &rBitmap, bool bBaseAddr, bool bCo if ( nRowBytes > 250 ) { pPict->ReadUInt16( nByteCount ); - nDataSize += 2 + static_cast<sal_uLong>(nByteCount); + nDataSize += 2 + static_cast<sal_uInt32>(nByteCount); } else { sal_uInt8 nByteCountAsByte(0); pPict->ReadUChar( nByteCountAsByte ); nByteCount = static_cast<sal_uInt16>(nByteCountAsByte) & 0x00ff; - nDataSize += 1 + static_cast<sal_uLong>(nByteCount); + nDataSize += 1 + nByteCount; } while (pPict->good() && nByteCount) @@ -926,7 +926,7 @@ sal_uLong PictReader::ReadPixMapEtc( BitmapEx &rBitmap, bool bBaseAddr, bool bCo { sal_uInt8 nByteCountAsByte, nFlagCounterByte; sal_uInt16 nByteCount, nCount, nD; - sal_uLong nSrcBitsPos; + sal_uInt64 nSrcBitsPos; if (nWidth > nRowBytes / 2) return 0xffffffff; @@ -958,7 +958,7 @@ sal_uLong PictReader::ReadPixMapEtc( BitmapEx &rBitmap, bool bBaseAddr, bool bCo nBlue = static_cast<sal_uInt8>( nD << 3 ); pBitmap->SetPixel(ny, nx++, Color(nRed, nGreen, nBlue)); } - nDataSize += static_cast<sal_uLong>(nWidth) * 2; + nDataSize += static_cast<sal_uInt32>(nWidth) * 2; } else { @@ -1015,8 +1015,8 @@ sal_uLong PictReader::ReadPixMapEtc( BitmapEx &rBitmap, bool bBaseAddr, bool bCo } } } - nDataSize+=static_cast<sal_uLong>(nByteCount); - pPict->Seek(nSrcBitsPos+static_cast<sal_uLong>(nByteCount)); + nDataSize += nByteCount; + pPict->Seek(nSrcBitsPos+nByteCount); } } } @@ -1024,7 +1024,7 @@ sal_uLong PictReader::ReadPixMapEtc( BitmapEx &rBitmap, bool bBaseAddr, bool bCo { sal_uInt16 nByteCount; size_t nCount; - sal_uLong nSrcBitsPos; + sal_uInt64 nSrcBitsPos; if ( nRowBytes != 4*nWidth ) return 0xffffffff; @@ -1048,7 +1048,7 @@ sal_uLong PictReader::ReadPixMapEtc( BitmapEx &rBitmap, bool bBaseAddr, bool bCo pPict->ReadUChar( nDummy ).ReadUChar( nRed ).ReadUChar( nGreen ).ReadUChar( nBlue ); pBitmap->SetPixel(ny, nx, Color(nRed, nGreen, nBlue)); } - nDataSize += static_cast<sal_uLong>(nWidth) * 4; + nDataSize += static_cast<sal_uInt32>(nWidth) * 4; } } else if ( nPackType == 2 ) @@ -1070,7 +1070,7 @@ sal_uLong PictReader::ReadPixMapEtc( BitmapEx &rBitmap, bool bBaseAddr, bool bCo pPict->ReadUChar( nRed ).ReadUChar( nGreen ).ReadUChar( nBlue ); pBitmap->SetPixel(ny, nx, Color(nRed, nGreen, nBlue)); } - nDataSize += static_cast<sal_uLong>(nWidth) * 3; + nDataSize += static_cast<sal_uInt32>(nWidth) * 3; } } else @@ -1135,8 +1135,8 @@ sal_uLong PictReader::ReadPixMapEtc( BitmapEx &rBitmap, bool bBaseAddr, bool bCo pTmp += nWidth; for (sal_uInt16 nx = 0; nx < nWidth; pTmp++) pBitmap->SetPixel(ny, nx++, Color(*pTmp, pTmp[ nWidth ], pTmp[ 2 * nWidth ])); - nDataSize += static_cast<sal_uLong>(nByteCount); - pPict->Seek( nSrcBitsPos + static_cast<sal_uLong>(nByteCount) ); + nDataSize += nByteCount; + pPict->Seek( nSrcBitsPos + nByteCount ); } } } @@ -1154,7 +1154,7 @@ void PictReader::ReadHeader() char sBuf[ 2 ]; // previous code considers pPict->Tell() as the normal starting position, // can we have nStartPos != 0 ? - sal_uLong nStartPos = pPict->Tell(); + sal_uInt64 nStartPos = pPict->Tell(); // Standard: // a picture file begins by 512 bytes (reserved to the application) followed by the picture data // while clipboard, pictures stored in a document often contain only the picture data. @@ -1309,11 +1309,11 @@ static const char* operationName(sal_uInt16 nOpcode) } #endif -sal_uLong PictReader::ReadData(sal_uInt16 nOpcode) +sal_uInt64 PictReader::ReadData(sal_uInt16 nOpcode) { sal_uInt16 nUSHORT; Point aPoint; - sal_uLong nDataSize=0; + sal_uInt64 nDataSize=0; PictDrawingMethod shapeDMethod = PictDrawingMethod::UNDEFINED; switch (nOpcode & 7) { case 0: shapeDMethod = PictDrawingMethod::FRAME; break; @@ -1896,7 +1896,7 @@ void PictReader::ReadPict( SvStream & rStreamPict, GDIMetaFile & rGDIMetaFile ) try { sal_uInt16 nOpcode; sal_uInt8 nOneByteOpcode; - sal_uLong nSize; + sal_uInt64 nSize; pPict = &rStreamPict; nOrigPos = pPict->Tell(); diff --git a/filter/source/graphicfilter/ipsd/ipsd.cxx b/filter/source/graphicfilter/ipsd/ipsd.cxx index 0f8f0dfa3b04..7c61ae350290 100644 --- a/filter/source/graphicfilter/ipsd/ipsd.cxx +++ b/filter/source/graphicfilter/ipsd/ipsd.cxx @@ -336,7 +336,7 @@ namespace bool PSDReader::ImplReadBody() { - sal_uLong nX, nY; + sal_uInt32 nX, nY; signed char nRunCount = 0; sal_uInt8 nDat = 0, nDummy, nRed, nGreen, nBlue; BitmapColor aBitmapColor; diff --git a/filter/source/graphicfilter/iras/iras.cxx b/filter/source/graphicfilter/iras/iras.cxx index 4bafe0fe8e9c..5205d6253e22 100644 --- a/filter/source/graphicfilter/iras/iras.cxx +++ b/filter/source/graphicfilter/iras/iras.cxx @@ -111,7 +111,7 @@ bool RASReader::ReadRAS(Graphic & rGraphic) if ( mnColorMapType == RAS_COLOR_RAW_MAP ) // RAW color map is skipped { - sal_uLong nCurPos = m_rRAS.Tell(); + sal_uInt64 nCurPos = m_rRAS.Tell(); bOk = checkSeek(m_rRAS, nCurPos + mnColorMapSize); } else if ( mnColorMapType == RAS_COLOR_RGB_MAP ) // we can read out the RGB @@ -148,8 +148,8 @@ bool RASReader::ReadRAS(Graphic & rGraphic) aPalette.resize(mnDstColors); for ( sal_uInt16 i = 0; i < mnDstColors; i++ ) { - sal_uLong nCount = 255 - ( 255 * i / ( mnDstColors - 1 ) ); - aPalette[i] = Color(static_cast<sal_uInt8>(nCount), static_cast<sal_uInt8>(nCount), static_cast<sal_uInt8>(nCount)); + sal_uInt8 nCount = 255 - ( 255 * i / ( mnDstColors - 1 ) ); + aPalette[i] = Color(nCount, nCount, nCount); } } } @@ -157,7 +157,7 @@ bool RASReader::ReadRAS(Graphic & rGraphic) { if ( mnColorMapType != RAS_COLOR_NO_MAP ) // when graphic has more than 256 colors and a color map we skip { // the colormap - sal_uLong nCurPos = m_rRAS.Tell(); + sal_uInt64 nCurPos = m_rRAS.Tell(); bOk = checkSeek(m_rRAS, nCurPos + mnColorMapSize); } } diff --git a/filter/source/graphicfilter/itga/itga.cxx b/filter/source/graphicfilter/itga/itga.cxx index 571237aef5f3..57c8a49bfc9b 100644 --- a/filter/source/graphicfilter/itga/itga.cxx +++ b/filter/source/graphicfilter/itga/itga.cxx @@ -98,7 +98,7 @@ private: bool mbStatus; - sal_uLong mnTGAVersion; // Enhanced TGA is defined as Version 2.0 + sal_uInt8 mnTGAVersion; // Enhanced TGA is defined as Version 2.0 sal_uInt16 mnDestBitDepth; bool mbIndexing; // sal_True if source contains indexing color values bool mbEncoding; // sal_True if source is compressed @@ -179,9 +179,9 @@ bool TGAReader::ImplReadHeader() mpFileFooter.reset( new TGAFileFooter ); // read the TGA-File-Footer to determine whether // we got an old TGA format or the new one - sal_uLong nCurStreamPos = m_rTGA.Tell(); + sal_uInt64 nCurStreamPos = m_rTGA.Tell(); m_rTGA.Seek( STREAM_SEEK_TO_END ); - sal_uLong nTemp = m_rTGA.Tell(); + sal_uInt64 nTemp = m_rTGA.Tell(); m_rTGA.Seek( nTemp - SizeOfTGAFileFooter ); m_rTGA.ReadUInt32( mpFileFooter->nExtensionFileOffset ).ReadUInt32( mpFileFooter->nDeveloperDirectoryOffset ). ReadUInt32( mpFileFooter->nSignature[0] ).ReadUInt32( mpFileFooter->nSignature[1] ).ReadUInt32( mpFileFooter->nSignature[2] ). ReadUInt32( mpFileFooter->nSignature[3] ).ReadUChar( mpFileFooter->nPadByte ).ReadUChar( mpFileFooter->nStringTerminator ); @@ -715,7 +715,7 @@ bool TGAReader::ImplReadPalette() { case 0x3f : { - for ( sal_uLong i = 0; i < nColors; i++ ) + for ( sal_uInt16 i = 0; i < nColors; i++ ) { mpColorMap[ i ] = ( i << 16 ) + ( i << 8 ) + i; } @@ -731,7 +731,7 @@ bool TGAReader::ImplReadPalette() case 24 : { - for ( sal_uLong i = 0; i < nColors; i++ ) + for ( sal_uInt16 i = 0; i < nColors; i++ ) { sal_uInt8 nBlue; sal_uInt8 nGreen; @@ -745,7 +745,7 @@ bool TGAReader::ImplReadPalette() case 15 : case 16 : { - for ( sal_uLong i = 0; i < nColors; i++ ) + for ( sal_uInt16 i = 0; i < nColors; i++ ) { sal_uInt16 nTemp; m_rTGA.ReadUInt16( nTemp ); diff --git a/filter/source/graphicfilter/itiff/ccidecom.cxx b/filter/source/graphicfilter/itiff/ccidecom.cxx index 82d6e0e89f74..9e3e37b42930 100644 --- a/filter/source/graphicfilter/itiff/ccidecom.cxx +++ b/filter/source/graphicfilter/itiff/ccidecom.cxx @@ -564,7 +564,7 @@ const CCIHuffmanTableEntry CCIUncompTableSave[CCIUncompTableSize]={ }; -CCIDecompressor::CCIDecompressor( sal_uLong nOpts, sal_uInt32 nImageWidth ) : +CCIDecompressor::CCIDecompressor( sal_uInt32 nOpts, sal_uInt32 nImageWidth ) : bTableBad ( false ), bStatus ( false ), pIStream ( nullptr ), @@ -611,7 +611,7 @@ void CCIDecompressor::StartDecompression( SvStream & rIStream ) return; } -DecompressStatus CCIDecompressor::DecompressScanline( sal_uInt8 * pTarget, sal_uLong nTargetBits, bool bLastLine ) +DecompressStatus CCIDecompressor::DecompressScanline( sal_uInt8 * pTarget, sal_uInt64 nTargetBits, bool bLastLine ) { //Read[1|2]DScanlineData take a sal_uInt16, so its either limit here or expand there if (nTargetBits > SAL_MAX_UINT16) @@ -774,7 +774,7 @@ bool CCIDecompressor::ReadEOL() if ( nOptions & CCI_OPTION_INVERSEBITORDER ) nByte = pByteSwap[ nByte ]; - nInputBitsBuf=(nInputBitsBuf<<8) | static_cast<sal_uLong>(nByte); + nInputBitsBuf=(nInputBitsBuf<<8) | static_cast<sal_uInt64>(nByte); nInputBitsBufSize += 8; } nCode = static_cast<sal_uInt16>( ( nInputBitsBuf >> ( nInputBitsBufSize - 12 ) ) & 0x0fff ); @@ -800,7 +800,7 @@ bool CCIDecompressor::Read2DTag() pIStream->ReadUChar( nByte ); if ( nOptions & CCI_OPTION_INVERSEBITORDER ) nByte = pByteSwap[ nByte ]; - nInputBitsBuf=static_cast<sal_uLong>(nByte); + nInputBitsBuf = nByte; nInputBitsBufSize=8; } nInputBitsBufSize--; @@ -817,7 +817,7 @@ sal_uInt8 CCIDecompressor::ReadBlackOrWhite() pIStream->ReadUChar( nByte ); if ( nOptions & CCI_OPTION_INVERSEBITORDER ) nByte = pByteSwap[ nByte ]; - nInputBitsBuf=static_cast<sal_uLong>(nByte); + nInputBitsBuf = nByte; nInputBitsBufSize=8; } nInputBitsBufSize--; @@ -836,7 +836,7 @@ sal_uInt16 CCIDecompressor::ReadCodeAndDecode(const CCILookUpTableEntry * pLookU pIStream->ReadUChar( nByte ); if ( nOptions & CCI_OPTION_INVERSEBITORDER ) nByte = pByteSwap[ nByte ]; - nInputBitsBuf=(nInputBitsBuf<<8) | static_cast<sal_uLong>(nByte); + nInputBitsBuf=(nInputBitsBuf<<8) | static_cast<sal_uInt64>(nByte); nInputBitsBufSize+=8; } sal_uInt16 nCode = static_cast<sal_uInt16>((nInputBitsBuf>>(nInputBitsBufSize-nMaxCodeBits)) @@ -930,7 +930,7 @@ bool CCIDecompressor::Read1DScanlineData(sal_uInt8 * pTarget, sal_uInt16 nBitsTo pIStream->ReadUChar( nByte ); if ( nOptions & CCI_OPTION_INVERSEBITORDER ) nByte = pByteSwap[ nByte ]; - nInputBitsBuf=(nInputBitsBuf<<8) | static_cast<sal_uLong>(nByte); + nInputBitsBuf=(nInputBitsBuf<<8) | static_cast<sal_uInt64>(nByte); nInputBitsBufSize+=8; } nCode=static_cast<sal_uInt16>((nInputBitsBuf>>(nInputBitsBufSize-13))&0x1fff); diff --git a/filter/source/graphicfilter/itiff/ccidecom.hxx b/filter/source/graphicfilter/itiff/ccidecom.hxx index baed40115c1b..fa2ae3bd31bd 100644 --- a/filter/source/graphicfilter/itiff/ccidecom.hxx +++ b/filter/source/graphicfilter/itiff/ccidecom.hxx @@ -61,12 +61,12 @@ class CCIDecompressor { public: - CCIDecompressor( sal_uLong nOptions, sal_uInt32 nImageWidth ); + CCIDecompressor( sal_uInt32 nOptions, sal_uInt32 nImageWidth ); ~CCIDecompressor(); void StartDecompression( SvStream & rIStream ); - DecompressStatus DecompressScanline(sal_uInt8 * pTarget, sal_uLong nTargetBits, bool bLastLine); + DecompressStatus DecompressScanline(sal_uInt8 * pTarget, sal_uInt64 nTargetBits, bool bLastLine); private: @@ -108,7 +108,7 @@ private: sal_uInt32 nWidth; - sal_uLong nOptions; + sal_uInt32 nOptions; bool bFirstEOL; @@ -117,11 +117,11 @@ private: std::array<CCILookUpTableEntry, 1<<10> p2DModeLookUp; std::array<CCILookUpTableEntry, 1<<11> pUncompLookUp; - sal_uLong nInputBitsBuf; + sal_uInt32 nInputBitsBuf; sal_uInt16 nInputBitsBufSize; std::unique_ptr<sal_uInt8[]> pLastLine; - sal_uLong nLastLineSize; + sal_uInt64 nLastLineSize; }; diff --git a/filter/source/graphicfilter/itiff/itiff.cxx b/filter/source/graphicfilter/itiff/itiff.cxx index d16410ad04c6..d5678db25dba 100644 --- a/filter/source/graphicfilter/itiff/itiff.cxx +++ b/filter/source/graphicfilter/itiff/itiff.cxx @@ -1580,7 +1580,7 @@ bool TIFFReader::ReadTIFF(SvStream & rTIFF, Graphic & rGraphic ) if (bStatus) { - sal_uLong nTargetBits = nImageWidth * nBitsPerSample * nSamplesPerPixel / nPlanes; + sal_uInt64 nTargetBits = nImageWidth * nBitsPerSample * nSamplesPerPixel / nPlanes; if (nTargetBits > SAL_MAX_UINT16) bStatus = false; } diff --git a/filter/source/graphicfilter/itiff/lzwdecom.cxx b/filter/source/graphicfilter/itiff/lzwdecom.cxx index f231ecd8ec6a..15784321b92e 100644 --- a/filter/source/graphicfilter/itiff/lzwdecom.cxx +++ b/filter/source/graphicfilter/itiff/lzwdecom.cxx @@ -73,9 +73,9 @@ void LZWDecompressor::StartDecompression(SvStream & rIStream) } -sal_uLong LZWDecompressor::Decompress(sal_uInt8 * pTarget, sal_uLong nMaxCount) +sal_uInt64 LZWDecompressor::Decompress(sal_uInt8 * pTarget, sal_uInt32 nMaxCount) { - sal_uLong nCount; + sal_uInt32 nCount; if (pIStream==nullptr) return 0; @@ -84,7 +84,7 @@ sal_uLong LZWDecompressor::Decompress(sal_uInt8 * pTarget, sal_uLong nMaxCount) if (pIStream->GetError()) break; - if (static_cast<sal_uLong>(nOutBufDataLen)>=nMaxCount) { + if (nOutBufDataLen>=nMaxCount) { nOutBufDataLen = nOutBufDataLen - static_cast<sal_uInt16>(nMaxCount); nCount+=nMaxCount; while (nMaxCount>0) { @@ -94,7 +94,7 @@ sal_uLong LZWDecompressor::Decompress(sal_uInt8 * pTarget, sal_uLong nMaxCount) break; } - nMaxCount-=static_cast<sal_uLong>(nOutBufDataLen); + nMaxCount-=static_cast<sal_uInt32>(nOutBufDataLen); nCount+=nOutBufDataLen; while (nOutBufDataLen>0) { *(pTarget++)=*(pOutBufData++); diff --git a/filter/source/graphicfilter/itiff/lzwdecom.hxx b/filter/source/graphicfilter/itiff/lzwdecom.hxx index c120c2f865e4..0d02e8833bcd 100644 --- a/filter/source/graphicfilter/itiff/lzwdecom.hxx +++ b/filter/source/graphicfilter/itiff/lzwdecom.hxx @@ -43,7 +43,7 @@ public: void StartDecompression(SvStream & rIStream); - sal_uLong Decompress(sal_uInt8 * pTarget, sal_uLong nMaxCount); + sal_uInt64 Decompress(sal_uInt8 * pTarget, sal_uInt32 nMaxCount); // Returns the number of written bytes. If < nMaxCount there is // no more data to be unpacked or an error occurred. |