diff options
author | Noel Grandin <noelgrandin@gmail.com> | 2023-08-09 14:09:51 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2023-08-09 16:26:49 +0200 |
commit | c9da81db9684cc3d83bd25fcae5ed2bed5401550 (patch) | |
tree | 90c36c0d35ae302fdbc082c5ea790e0948477a5e /vcl | |
parent | b5a41467efdce02b80ffe3824fdefe9fbc01fc95 (diff) |
use sal_uInt64 when dealing with stream position
Change-Id: Ibb8637e4648f56d7f9895a31df006915df8f8fdf
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155517
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/source/bitmap/dibtools.cxx | 2 | ||||
-rw-r--r-- | vcl/source/filter/etiff/etiff.cxx | 8 | ||||
-rw-r--r-- | vcl/source/filter/graphicfilter2.cxx | 4 | ||||
-rw-r--r-- | vcl/source/filter/ieps/ieps.cxx | 2 | ||||
-rw-r--r-- | vcl/source/filter/ipdf/pdfcompat.cxx | 2 | ||||
-rw-r--r-- | vcl/source/filter/ipsd/ipsd.cxx | 4 | ||||
-rw-r--r-- | vcl/source/filter/jpeg/Exif.cxx | 10 | ||||
-rw-r--r-- | vcl/source/filter/wmf/emfwr.cxx | 10 | ||||
-rw-r--r-- | vcl/source/filter/wmf/emfwr.hxx | 4 | ||||
-rw-r--r-- | vcl/source/filter/wmf/wmf.cxx | 6 | ||||
-rw-r--r-- | vcl/source/gdi/pdfwriter_impl.cxx | 8 | ||||
-rw-r--r-- | vcl/source/treelist/transfer.cxx | 5 |
12 files changed, 34 insertions, 31 deletions
diff --git a/vcl/source/bitmap/dibtools.cxx b/vcl/source/bitmap/dibtools.cxx index d6ac43a403da..f5c393848b25 100644 --- a/vcl/source/bitmap/dibtools.cxx +++ b/vcl/source/bitmap/dibtools.cxx @@ -905,7 +905,7 @@ bool ImplReadDIBBody(SvStream& rIStm, Bitmap& rBmp, AlphaMask* pBmpAlpha, sal_uI // end of BITMAPINFOHEADER or 12 bytes further in case // of WinBMPv3-NT format. It is possible to seek forward // though because a gap may be there. - sal_Int32 nSeekRel = nOffset - (pIStm->Tell() - nStmPos); + sal_Int64 nSeekRel = nOffset - (pIStm->Tell() - nStmPos); if (nSeekRel > 0) pIStm->SeekRel(nSeekRel); } diff --git a/vcl/source/filter/etiff/etiff.cxx b/vcl/source/filter/etiff/etiff.cxx index f0da56c472af..1f3b2804b497 100644 --- a/vcl/source/filter/etiff/etiff.cxx +++ b/vcl/source/filter/etiff/etiff.cxx @@ -59,7 +59,7 @@ class TIFFWriter private: SvStream& m_rOStm; - sal_uInt32 mnStreamOfs; + sal_uInt64 mnStreamOfs; bool mbStatus; BitmapReadAccess* mpAcc; @@ -72,7 +72,7 @@ private: sal_uInt32 mnLatestIfdPos; sal_uInt16 mnTagCount; // number of tags already written - sal_uInt32 mnCurrentTagCountPos; // offset to the position where the current + sal_uInt64 mnCurrentTagCountPos; // offset to the position where the current // tag count is to insert sal_uInt32 mnXResPos; // if != 0 this DWORDs stores the @@ -204,7 +204,7 @@ bool TIFFWriter::WriteTIFF( const Graphic& rGraphic, FilterConfigItem const * pF ImplWritePalette(); ImplWriteBody(); } - sal_uInt32 nCurPos = m_rOStm.Tell(); + sal_uInt64 nCurPos = m_rOStm.Tell(); m_rOStm.Seek( mnCurrentTagCountPos ); m_rOStm.WriteUInt16( mnTagCount ); m_rOStm.Seek( nCurPos ); @@ -246,7 +246,7 @@ bool TIFFWriter::ImplWriteHeader( bool bMultiPage ) if ( mnWidth && mnHeight && mnBitsPerPixel && mbStatus ) { - sal_uInt32 nCurrentPos = m_rOStm.Tell(); + sal_uInt64 nCurrentPos = m_rOStm.Tell(); m_rOStm.Seek( mnLatestIfdPos ); m_rOStm.WriteUInt32( nCurrentPos - mnStreamOfs ); // offset to the IFD m_rOStm.Seek( nCurrentPos ); diff --git a/vcl/source/filter/graphicfilter2.cxx b/vcl/source/filter/graphicfilter2.cxx index f0f7950271d3..d7161b2808ea 100644 --- a/vcl/source/filter/graphicfilter2.cxx +++ b/vcl/source/filter/graphicfilter2.cxx @@ -151,7 +151,7 @@ bool GraphicDescriptor::ImpDetectJPG( SvStream& rStm, bool bExtendedInfo ) sal_uInt32 nTemp32 = 0; bool bRet = false; - sal_Int32 nStmPos = rStm.Tell(); + sal_uInt64 nStmPos = rStm.Tell(); rStm.SetEndian( SvStreamEndian::BIG ); rStm.ReadUInt32( nTemp32 ); @@ -208,7 +208,7 @@ bool GraphicDescriptor::ImpDetectJPG( SvStream& rStm, bool bExtendedInfo ) bScanFailure = true; else { - sal_uInt32 nNextMarkerPos = rStm.Tell() + nLength - 2; + sal_uInt64 nNextMarkerPos = rStm.Tell() + nLength - 2; switch( nMarker ) { case 0xe0 : // APP0 Marker diff --git a/vcl/source/filter/ieps/ieps.cxx b/vcl/source/filter/ieps/ieps.cxx index 3dbadda9b9bb..dd2c1597abaf 100644 --- a/vcl/source/filter/ieps/ieps.cxx +++ b/vcl/source/filter/ieps/ieps.cxx @@ -642,7 +642,7 @@ bool ImportEpsGraphic( SvStream & rStream, Graphic & rGraphic) } if (bOk) { - sal_uInt32 nBufStartPos = rStream.Tell(); + sal_uInt64 nBufStartPos = rStream.Tell(); BinaryDataContainer aBuf(rStream, nPSSize); if (!aBuf.isEmpty()) { diff --git a/vcl/source/filter/ipdf/pdfcompat.cxx b/vcl/source/filter/ipdf/pdfcompat.cxx index 6f431c25130f..7f324a386e39 100644 --- a/vcl/source/filter/ipdf/pdfcompat.cxx +++ b/vcl/source/filter/ipdf/pdfcompat.cxx @@ -97,7 +97,7 @@ BinaryDataContainer createBinaryDataContainer(SvStream& rStream) if (!getCompatibleStream(rStream, aMemoryStream)) return {}; - const sal_uInt32 nStreamLength = aMemoryStream.TellEnd(); + const sal_uInt64 nStreamLength = aMemoryStream.TellEnd(); aMemoryStream.Seek(STREAM_SEEK_TO_BEGIN); BinaryDataContainer aPdfData(aMemoryStream, nStreamLength); diff --git a/vcl/source/filter/ipsd/ipsd.cxx b/vcl/source/filter/ipsd/ipsd.cxx index 79ccda943dca..04446e728b84 100644 --- a/vcl/source/filter/ipsd/ipsd.cxx +++ b/vcl/source/filter/ipsd/ipsd.cxx @@ -267,7 +267,7 @@ bool PSDReader::ImplReadHeader() m_rPSD.ReadUInt32(nResourceLength); if (nResourceLength > m_rPSD.remainingSize()) return false; - sal_uInt32 nLayerPos = m_rPSD.Tell() + nResourceLength; + sal_uInt64 nLayerPos = m_rPSD.Tell() + nResourceLength; // this is a loop over the resource entries to get the resolution info while( m_rPSD.Tell() < nLayerPos ) @@ -286,7 +286,7 @@ bool PSDReader::ImplReadHeader() m_rPSD.ReadUInt32( nResEntryLen ); if ( nResEntryLen & 1 ) nResEntryLen++; // the resource entries are padded - sal_uInt32 nCurrentPos = m_rPSD.Tell(); + sal_uInt64 nCurrentPos = m_rPSD.Tell(); if (nCurrentPos > nLayerPos || nResEntryLen > (nLayerPos - nCurrentPos)) // check if size break; // is possible switch( nUniqueID ) diff --git a/vcl/source/filter/jpeg/Exif.cxx b/vcl/source/filter/jpeg/Exif.cxx index 53b55f69ad4f..469281bdcc85 100644 --- a/vcl/source/filter/jpeg/Exif.cxx +++ b/vcl/source/filter/jpeg/Exif.cxx @@ -65,7 +65,7 @@ Degree10 Exif::getRotation() const bool Exif::read(SvStream& rStream) { - sal_Int32 nStreamPosition = rStream.Tell(); + sal_uInt64 nStreamPosition = rStream.Tell(); bool result = processJpeg(rStream, false); rStream.Seek( nStreamPosition ); @@ -74,7 +74,7 @@ bool Exif::read(SvStream& rStream) void Exif::write(SvStream& rStream) { - sal_Int32 nStreamPosition = rStream.Tell(); + sal_uInt64 nStreamPosition = rStream.Tell(); processJpeg(rStream, true); rStream.Seek( nStreamPosition ); } @@ -84,7 +84,7 @@ bool Exif::processJpeg(SvStream& rStream, bool bSetValue) sal_uInt16 aMagic16; sal_uInt16 aLength; - sal_uInt32 aSize = rStream.TellEnd(); + sal_uInt64 aSize = rStream.TellEnd(); rStream.Seek(STREAM_SEEK_TO_BEGIN); rStream.SetEndian( SvStreamEndian::BIG ); @@ -133,7 +133,7 @@ bool Exif::processJpeg(SvStream& rStream, bool bSetValue) } else { - sal_uInt32 aCurrentPosition = rStream.SeekRel(aLength-1); + sal_uInt64 aCurrentPosition = rStream.SeekRel(aLength-1); if (aCurrentPosition == aPreviousPosition || aCurrentPosition > aSize) { return false; @@ -228,7 +228,7 @@ bool Exif::processExif(SvStream& rStream, sal_uInt16 aSectionLength, bool bSetVa sal_uInt16 aLength = aSectionLength - 6; // Length = Section - Header std::unique_ptr<sal_uInt8[]> aExifData(new sal_uInt8[aLength]); - sal_uInt32 aExifDataBeginPosition = rStream.Tell(); + sal_uInt64 aExifDataBeginPosition = rStream.Tell(); rStream.ReadBytes(aExifData.get(), aLength); diff --git a/vcl/source/filter/wmf/emfwr.cxx b/vcl/source/filter/wmf/emfwr.cxx index 8b2c7713bb11..6fcd294cdaad 100644 --- a/vcl/source/filter/wmf/emfwr.cxx +++ b/vcl/source/filter/wmf/emfwr.cxx @@ -118,7 +118,7 @@ void EMFWriter::ImplEndCommentRecord() { if( mbRecordOpen ) { - sal_Int32 nActPos = m_rStm.Tell(); + sal_uInt64 nActPos = m_rStm.Tell(); m_rStm.Seek( mnRecordPos + 8 ); m_rStm.WriteUInt32( nActPos - mnRecordPos - 0xc ); m_rStm.Seek( nActPos ); @@ -146,7 +146,7 @@ void EMFWriter::ImplEndPlusRecord() if( mbRecordPlusOpen ) { - sal_Int32 nActPos = m_rStm.Tell(); + sal_uInt64 nActPos = m_rStm.Tell(); sal_Int32 nSize = nActPos - mnRecordPlusPos; m_rStm.Seek( mnRecordPlusPos + 4 ); m_rStm.WriteUInt32( nSize ) // Size @@ -366,7 +366,8 @@ void EMFWriter::ImplEndRecord() if( !mbRecordOpen ) return; - sal_Int32 nFillBytes, nActPos = m_rStm.Tell(); + sal_Int32 nFillBytes; + sal_uInt64 nActPos = m_rStm.Tell(); m_rStm.Seek( mnRecordPos + 4 ); nFillBytes = nActPos - mnRecordPos; nFillBytes += 3; // each record has to be dword aligned @@ -821,7 +822,8 @@ void EMFWriter::ImplWriteBmpRecord( const Bitmap& rBmp, const Point& rPt, WriteDIB(rBmp, aMemStm, true, false); - sal_uInt32 nDIBSize = aMemStm.Tell(), nHeaderSize, nCompression, nColsUsed, nPalCount, nImageSize; + sal_uInt64 nDIBSize = aMemStm.Tell(); + sal_uInt32 nHeaderSize, nCompression, nColsUsed, nPalCount, nImageSize; sal_uInt16 nBitCount; // get DIB parameters diff --git a/vcl/source/filter/wmf/emfwr.hxx b/vcl/source/filter/wmf/emfwr.hxx index 4298096ff68c..75f7f3819604 100644 --- a/vcl/source/filter/wmf/emfwr.hxx +++ b/vcl/source/filter/wmf/emfwr.hxx @@ -36,8 +36,8 @@ private: std::vector<bool> mHandlesUsed; sal_uLong mnHandleCount; sal_uLong mnRecordCount; - sal_uLong mnRecordPos; - sal_uLong mnRecordPlusPos; + sal_uInt64 mnRecordPos; + sal_uInt64 mnRecordPlusPos; bool mbRecordOpen; bool mbRecordPlusOpen; bool mbLineChanged; diff --git a/vcl/source/filter/wmf/wmf.cxx b/vcl/source/filter/wmf/wmf.cxx index c8e4e7d7d9cb..db615410c1dc 100644 --- a/vcl/source/filter/wmf/wmf.cxx +++ b/vcl/source/filter/wmf/wmf.cxx @@ -32,8 +32,8 @@ bool ReadWindowMetafile( SvStream& rStream, GDIMetaFile& rMTF ) // SwWw6ReadMetaStream, so do *not* ignore. OTOH XclImpDrawing::ReadWmf // is nice enough to copy to an own MemStream to avoid that indirect // parameter passing...) - const sal_uInt32 nStreamStart(rStream.Tell()); - const sal_uInt32 nStreamEnd(rStream.TellEnd()); + const sal_uInt64 nStreamStart(rStream.Tell()); + const sal_uInt64 nStreamEnd(rStream.TellEnd()); if (nStreamStart >= nStreamEnd) { @@ -41,7 +41,7 @@ bool ReadWindowMetafile( SvStream& rStream, GDIMetaFile& rMTF ) } // Read binary data to mem array - const sal_uInt32 nStreamLength(nStreamEnd - nStreamStart); + const sal_uInt64 nStreamLength(nStreamEnd - nStreamStart); BinaryDataContainer aDataContainer(rStream, nStreamLength); rStream.Seek(nStreamStart); diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx index 24e87ead042e..429efe3aa639 100644 --- a/vcl/source/gdi/pdfwriter_impl.cxx +++ b/vcl/source/gdi/pdfwriter_impl.cxx @@ -2952,10 +2952,10 @@ sal_Int32 PDFWriterImpl::createToUnicodeCMap( sal_uInt8 const * pEncoding, OStringBuffer aLine( 40 ); aLine.append( OString::number(nStream ) + " 0 obj\n<</Length " ); - sal_Int32 nLen = 0; + sal_uInt64 nLen = 0; if (!g_bDebugDisableCompression) { - nLen = static_cast<sal_Int32>(aStream.Tell()); + nLen = aStream.Tell(); aStream.Seek( 0 ); aLine.append( OString::number(nLen) + "/Filter/FlateDecode" ); } @@ -8981,7 +8981,7 @@ void PDFWriterImpl::writeJPG( const JPGEmit& rObject ) CHECK_RETURN2( rObject.m_pStream ); CHECK_RETURN2( updateObject( rObject.m_nObject ) ); - sal_Int32 nLength = rObject.m_pStream->TellEnd(); + sal_uInt64 nLength = rObject.m_pStream->TellEnd(); rObject.m_pStream->Seek( STREAM_SEEK_TO_BEGIN ); sal_Int32 nMaskObject = 0; @@ -9016,7 +9016,7 @@ void PDFWriterImpl::writeJPG( const JPGEmit& rObject ) else aLine.append( "/ColorSpace/DeviceGray" ); aLine.append( "/Filter/DCTDecode/Length " ); - aLine.append( nLength ); + aLine.append( static_cast<sal_Int64>(nLength) ); if( nMaskObject ) { aLine.append(" /SMask "); diff --git a/vcl/source/treelist/transfer.cxx b/vcl/source/treelist/transfer.cxx index 54f2381b8aa4..bb13861b9815 100644 --- a/vcl/source/treelist/transfer.cxx +++ b/vcl/source/treelist/transfer.cxx @@ -85,7 +85,8 @@ using namespace std::literals::string_view_literals; SvStream& WriteTransferableObjectDescriptor( SvStream& rOStm, const TransferableObjectDescriptor& rObjDesc ) { - const sal_uInt32 nFirstPos = rOStm.Tell(), nViewAspect = rObjDesc.mnViewAspect; + const sal_uInt64 nFirstPos = rOStm.Tell(); + const sal_uInt32 nViewAspect = rObjDesc.mnViewAspect; const sal_uInt32 nSig1 = TOD_SIG1, nSig2 = TOD_SIG2; rOStm.SeekRel( 4 ); @@ -99,7 +100,7 @@ SvStream& WriteTransferableObjectDescriptor( SvStream& rOStm, const Transferable rOStm.WriteUniOrByteString( rObjDesc.maDisplayName, osl_getThreadTextEncoding() ); rOStm.WriteUInt32( nSig1 ).WriteUInt32( nSig2 ); - const sal_uInt32 nLastPos = rOStm.Tell(); + const sal_uInt64 nLastPos = rOStm.Tell(); rOStm.Seek( nFirstPos ); rOStm.WriteUInt32( nLastPos - nFirstPos ); |