diff options
-rw-r--r-- | chart2/qa/extras/chart2export.cxx | 4 | ||||
-rw-r--r-- | connectivity/source/drivers/flat/ETable.cxx | 4 | ||||
-rw-r--r-- | extensions/source/plugin/base/context.cxx | 6 | ||||
-rw-r--r-- | filter/source/graphicfilter/icgm/cgm.cxx | 3 | ||||
-rw-r--r-- | filter/source/graphicfilter/ios2met/ios2met.cxx | 15 | ||||
-rw-r--r-- | filter/source/graphicfilter/ipict/ipict.cxx | 10 | ||||
-rw-r--r-- | forms/source/component/ImageControl.cxx | 3 | ||||
-rw-r--r-- | sc/source/ui/docshell/impex.cxx | 7 | ||||
-rw-r--r-- | sd/source/filter/eppt/epptso.cxx | 4 | ||||
-rw-r--r-- | sw/source/filter/ww8/wrtw8esh.cxx | 7 | ||||
-rw-r--r-- | tools/source/zcodec/zcodec.cxx | 7 | ||||
-rw-r--r-- | unotools/source/ucbhelper/xtempfile.cxx | 10 | ||||
-rw-r--r-- | vcl/source/gdi/dibtools.cxx | 6 | ||||
-rw-r--r-- | vcl/source/gdi/svgdata.cxx | 4 |
14 files changed, 27 insertions, 63 deletions
diff --git a/chart2/qa/extras/chart2export.cxx b/chart2/qa/extras/chart2export.cxx index fa1c90ce7cd4..b0cda222eb77 100644 --- a/chart2/qa/extras/chart2export.cxx +++ b/chart2/qa/extras/chart2export.cxx @@ -167,9 +167,7 @@ xmlDocPtr Chart2ExportTest::parseExport(const OUString& rDir, const OUString& rF uno::Reference<io::XInputStream> xInputStream(xNameAccess->getByName(findChartFile(rDir, xNameAccess)), uno::UNO_QUERY); CPPUNIT_ASSERT(xInputStream.is()); boost::shared_ptr<SvStream> pStream(utl::UcbStreamHelper::CreateStream(xInputStream, true)); - pStream->Seek(STREAM_SEEK_TO_END); - sal_Size nSize = pStream->Tell(); - pStream->Seek(0); + sal_uInt64 const nSize = pStream->remainingSize(); OStringBuffer aDocument(nSize); char ch; for (sal_Size i = 0; i < nSize; ++i) diff --git a/connectivity/source/drivers/flat/ETable.cxx b/connectivity/source/drivers/flat/ETable.cxx index e156b1d0563e..c58376a48711 100644 --- a/connectivity/source/drivers/flat/ETable.cxx +++ b/connectivity/source/drivers/flat/ETable.cxx @@ -455,9 +455,7 @@ void OFlatTable::construct() if(m_pFileStream) { - m_pFileStream->Seek(STREAM_SEEK_TO_END); - sal_Size nSize = m_pFileStream->Tell(); - m_pFileStream->Seek(STREAM_SEEK_TO_BEGIN); + sal_uInt64 const nSize = m_pFileStream->remainingSize(); // Buffersize is dependent on the file-size m_pFileStream->SetBufferSize(nSize > 1000000 ? 32768 : diff --git a/extensions/source/plugin/base/context.cxx b/extensions/source/plugin/base/context.cxx index f795dc2bcce8..91214b7f6073 100644 --- a/extensions/source/plugin/base/context.cxx +++ b/extensions/source/plugin/base/context.cxx @@ -209,10 +209,8 @@ void XPluginContext_Impl::postURL(const Reference< ::com::sun::star::plugin::XPl SvFileStream aStream( aFileName, STREAM_READ ); if( aStream.IsOpen() ) { - int nBytes = 0; - aStream.Seek( STREAM_SEEK_TO_END ); - aBuf = Sequence<sal_Int8>( nBytes = aStream.Tell() ); - aStream.Seek( STREAM_SEEK_TO_BEGIN ); + sal_Int64 const nBytes = aStream.remainingSize(); + aBuf = Sequence<sal_Int8>( nBytes ); aStream.Read( aBuf.getArray(), nBytes ); aStream.Close(); osl::FileBase::getFileURLFromSystemPath( aFileName, aFileName ); diff --git a/filter/source/graphicfilter/icgm/cgm.cxx b/filter/source/graphicfilter/icgm/cgm.cxx index cc3205c527b2..0b1882f2e3c5 100644 --- a/filter/source/graphicfilter/icgm/cgm.cxx +++ b/filter/source/graphicfilter/icgm/cgm.cxx @@ -719,8 +719,7 @@ ImportCGM( OUString& rFileName, uno::Reference< frame::XModel > & rXModel, sal_u if ( pIn ) { pIn->SetNumberFormatInt( NUMBERFORMAT_INT_BIGENDIAN ); - pIn->Seek( STREAM_SEEK_TO_END ); - sal_uInt32 nInSize = pIn->Tell(); + sal_uInt64 const nInSize = pIn->remainingSize(); pIn->Seek( 0 ); #ifdef CGM_EXPORT_IMPRESS diff --git a/filter/source/graphicfilter/ios2met/ios2met.cxx b/filter/source/graphicfilter/ios2met/ios2met.cxx index e0acde9d932b..2fcfdea5b144 100644 --- a/filter/source/graphicfilter/ios2met/ios2met.cxx +++ b/filter/source/graphicfilter/ios2met/ios2met.cxx @@ -2521,7 +2521,7 @@ void OS2METReader::ReadOS2MET( SvStream & rStreamOS2MET, GDIMetaFile & rGDIMetaF { sal_uInt16 nFieldSize; sal_uInt16 nFieldType; - sal_uLong nPos, nStartPos, nEndPos, nPercent, nLastPercent; + sal_uLong nPercent, nLastPercent; sal_uInt8 nMagicByte; ErrorCode=0; @@ -2586,20 +2586,15 @@ void OS2METReader::ReadOS2MET( SvStream & rStreamOS2MET, GDIMetaFile & rGDIMetaF pOS2MET->SetNumberFormatInt(NUMBERFORMAT_INT_LITTLEENDIAN); - nStartPos=pOS2MET->Tell(); - nEndPos=pOS2MET->Seek(STREAM_SEEK_TO_END); pOS2MET->Seek(nStartPos); + sal_uInt64 const nStartPos = pOS2MET->Tell(); + sal_uInt64 const nRemaining = pOS2MET->remainingSize(); Callback(0); nLastPercent=0; - nPos=pOS2MET->Tell(); - if ( nStartPos == nEndPos ) - { - nEndPos = 100; - nStartPos = 0; - } + sal_uInt64 nPos = pOS2MET->Tell(); for (;;) { - nPercent=(nPos-nStartPos)*100/(nEndPos-nStartPos); + nPercent = (nPos-nStartPos)*100 / nRemaining; if (nLastPercent+4<=nPercent) { if (Callback((sal_uInt16)nPercent)==sal_True) break; nLastPercent=nPercent; diff --git a/filter/source/graphicfilter/ipict/ipict.cxx b/filter/source/graphicfilter/ipict/ipict.cxx index 0292f0a700d5..43386722689f 100644 --- a/filter/source/graphicfilter/ipict/ipict.cxx +++ b/filter/source/graphicfilter/ipict/ipict.cxx @@ -1780,7 +1780,7 @@ void PictReader::ReadPict( SvStream & rStreamPict, GDIMetaFile & rGDIMetaFile ) { sal_uInt16 nOpcode; sal_uInt8 nOneByteOpcode; - sal_uLong nSize, nPos, nStartPos, nEndPos, nPercent, nLastPercent; + sal_uLong nSize, nPercent, nLastPercent; pPict = &rStreamPict; nOrigPos = pPict->Tell(); @@ -1806,8 +1806,8 @@ void PictReader::ReadPict( SvStream & rStreamPict, GDIMetaFile & rGDIMetaFile ) pPict->SetNumberFormatInt(NUMBERFORMAT_INT_BIGENDIAN); - nStartPos=pPict->Tell(); - nEndPos=pPict->Seek(STREAM_SEEK_TO_END); pPict->Seek(nStartPos); + sal_uInt64 const nStartPos=pPict->Tell(); + sal_uInt64 const nRemaining = pPict->remainingSize(); Callback(0); nLastPercent=0; ReadHeader(); @@ -1815,11 +1815,11 @@ void PictReader::ReadPict( SvStream & rStreamPict, GDIMetaFile & rGDIMetaFile ) aPenPosition=Point(-aBoundingRect.Left(),-aBoundingRect.Top()); aTextPosition=aPenPosition; - nPos=pPict->Tell(); + sal_uInt64 nPos=pPict->Tell(); for (;;) { - nPercent=(nPos-nStartPos)*100/(nEndPos-nStartPos); + nPercent = (nPos-nStartPos) * 100 / nRemaining; if (nLastPercent+4<=nPercent) { if (Callback((sal_uInt16)nPercent)==sal_True) break; nLastPercent=nPercent; diff --git a/forms/source/component/ImageControl.cxx b/forms/source/component/ImageControl.cxx index 26979a5a78a1..cfafdbb633ec 100644 --- a/forms/source/component/ImageControl.cxx +++ b/forms/source/component/ImageControl.cxx @@ -426,8 +426,7 @@ sal_Bool OImageControlModel::impl_updateStreamForURL_lck( const OUString& _rURL, if ( !bSetNull ) { // get the size of the stream - pImageStream->Seek(STREAM_SEEK_TO_END); - sal_Int32 nSize = (sal_Int32)pImageStream->Tell(); + sal_uInt64 const nSize = pImageStream->remainingSize(); if (pImageStream->GetBufferSize() < 8192) pImageStream->SetBufferSize(8192); pImageStream->Seek(STREAM_SEEK_TO_BEGIN); diff --git a/sc/source/ui/docshell/impex.cxx b/sc/source/ui/docshell/impex.cxx index e048ffef0f9a..773bec5a7be7 100644 --- a/sc/source/ui/docshell/impex.cxx +++ b/sc/source/ui/docshell/impex.cxx @@ -1267,11 +1267,10 @@ bool ScImportExport::ExtText2Doc( SvStream& rStrm ) if (!pExtOptions) return Text2Doc( rStrm ); - sal_uLong nOldPos = rStrm.Tell(); - rStrm.Seek( STREAM_SEEK_TO_END ); + sal_uInt64 const nOldPos = rStrm.Tell(); + sal_uInt64 const nRemaining = rStrm.remainingSize(); boost::scoped_ptr<ScProgress> xProgress( new ScProgress( pDocSh, - ScGlobal::GetRscString( STR_LOAD_DOC ), rStrm.Tell() - nOldPos )); - rStrm.Seek( nOldPos ); + ScGlobal::GetRscString( STR_LOAD_DOC ), nRemaining )); rStrm.StartReadingUnicodeText( rStrm.GetStreamCharSet() ); SCCOL nStartCol = aRange.aStart.Col(); diff --git a/sd/source/filter/eppt/epptso.cxx b/sd/source/filter/eppt/epptso.cxx index 05267f5767bd..52524e16b6c7 100644 --- a/sd/source/filter/eppt/epptso.cxx +++ b/sd/source/filter/eppt/epptso.cxx @@ -2506,9 +2506,7 @@ void PPTWriter::ImplWritePage( const PHLayout& rLayout, EscherSolverContainer& a SvStorageStreamRef xCompObj = xTemp->OpenSotStream( OUString( "\1CompObj" ), STREAM_READ | STREAM_NOCREATE | STREAM_SHARE_DENYALL ); - xCompObj->Seek( STREAM_SEEK_TO_END ); - sal_uInt32 nStreamLen = xCompObj->Tell(); - xCompObj->Seek( 0 ); + sal_uInt32 const nStreamLen = xCompObj->remainingSize(); sal_Int16 nVersion, nByteOrder; sal_Int32 nWinVersion, nVal, nStringLen; xCompObj->ReadInt16( nVersion ) diff --git a/sw/source/filter/ww8/wrtw8esh.cxx b/sw/source/filter/ww8/wrtw8esh.cxx index 9fd00e4881af..dfac4b3c1065 100644 --- a/sw/source/filter/ww8/wrtw8esh.cxx +++ b/sw/source/filter/ww8/wrtw8esh.cxx @@ -273,12 +273,7 @@ void SwBasicEscherEx::WriteHyperlinkWithinFly( SvMemoryStream& rStrm, const SwFm rStrm .WriteUInt32( sal_uInt32( 2 ) ) .WriteUInt32( mnFlags ); tmpStrm.Seek( STREAM_SEEK_TO_BEGIN ); - sal_uInt32 nStrmPos = tmpStrm.Tell(); - tmpStrm.Seek( STREAM_SEEK_TO_END ); - sal_uInt32 nStrmSize = tmpStrm.Tell(); - tmpStrm.Seek( nStrmPos ); - sal_uInt32 nLen; - nLen = nStrmSize - nStrmPos; + sal_uInt32 const nLen = tmpStrm.remainingSize(); if(nLen >0) { sal_uInt8* pBuffer = new sal_uInt8[ nLen ]; diff --git a/tools/source/zcodec/zcodec.cxx b/tools/source/zcodec/zcodec.cxx index ab50640092ce..ed6d8e4d5a08 100644 --- a/tools/source/zcodec/zcodec.cxx +++ b/tools/source/zcodec/zcodec.cxx @@ -284,11 +284,8 @@ long ZCodec::ReadAsynchron( SvStream& rIStm, sal_uInt8* pData, sal_uIntPtr nSize { nInToRead = (mnInBufSize > mnInToRead) ? mnInToRead : mnInBufSize; - sal_uIntPtr nStreamPos = rIStm.Tell(); - rIStm.Seek( STREAM_SEEK_TO_END ); - sal_uIntPtr nMaxPos = rIStm.Tell(); - rIStm.Seek( nStreamPos ); - if ( ( nMaxPos - nStreamPos ) < nInToRead ) + sal_uInt64 const nRemaining = rIStm.remainingSize(); + if (nRemaining < nInToRead) { rIStm.SetError( ERRCODE_IO_PENDING ); err= int(!Z_STREAM_END); // TODO What is appropriate code for this? diff --git a/unotools/source/ucbhelper/xtempfile.cxx b/unotools/source/ucbhelper/xtempfile.cxx index 4d4f4faed467..f09b94e8c96f 100644 --- a/unotools/source/ucbhelper/xtempfile.cxx +++ b/unotools/source/ucbhelper/xtempfile.cxx @@ -227,14 +227,8 @@ throw ( css::io::NotConnectedException, css::io::IOException, css::uno::RuntimeE checkConnected(); - sal_uInt32 nPos = mpStream->Tell(); - checkError(); - - mpStream->Seek(STREAM_SEEK_TO_END); - checkError(); - - sal_Int32 nAvailable = (sal_Int32)mpStream->Tell() - nPos; - mpStream->Seek(nPos); + sal_uInt32 const nAvailable = + static_cast<sal_uInt32>(mpStream->remainingSize()); checkError(); return nAvailable; diff --git a/vcl/source/gdi/dibtools.cxx b/vcl/source/gdi/dibtools.cxx index e46b7d3bf9e1..e67a7cb727f3 100644 --- a/vcl/source/gdi/dibtools.cxx +++ b/vcl/source/gdi/dibtools.cxx @@ -427,11 +427,7 @@ bool ImplReadDIBBits(SvStream& rIStm, DIBV5Header& rHeader, BitmapWriteAccess& r { if(!rHeader.nSizeImage) { - const sal_uLong nOldPos(rIStm.Tell()); - - rIStm.Seek(STREAM_SEEK_TO_END); - rHeader.nSizeImage = rIStm.Tell() - nOldPos; - rIStm.Seek(nOldPos); + rHeader.nSizeImage = rIStm.remainingSize(); } sal_uInt8* pBuffer = (sal_uInt8*)rtl_allocateMemory(rHeader.nSizeImage); diff --git a/vcl/source/gdi/svgdata.cxx b/vcl/source/gdi/svgdata.cxx index 4080f5d36d67..b844c502c689 100644 --- a/vcl/source/gdi/svgdata.cxx +++ b/vcl/source/gdi/svgdata.cxx @@ -173,12 +173,10 @@ SvgData::SvgData(const OUString& rPath): SvFileStream rIStm(rPath, STREAM_STD_READ); if(rIStm.GetError()) return; - const sal_uInt32 nStmPos(rIStm.Tell()); - const sal_uInt32 nStmLen(rIStm.Seek(STREAM_SEEK_TO_END) - nStmPos); + const sal_uInt32 nStmLen(rIStm.remainingSize()); if(nStmLen) { SvgDataArray aNewData(new sal_uInt8[nStmLen]); - rIStm.Seek(nStmPos); rIStm.Read(aNewData.get(), nStmLen); if(!rIStm.GetError()) |