tools: support 64-bit file positions in SvStream

Bump stream positions to 64 bits on:

SvLockBytes::SetSize()
SvStream::SeekPos()
SvStream::SetSize()
SvStream::SetStreamSize()
SvStream::Seek()
SvStream::SeekRel()
SvStream::Tell()
SvStream::remainingSize()
SvStream::nActPos
SvStream::nBufFilePos

Change-Id: I0521fd60d31d1a33e5634cbf51dd42edc46ad919
TODO: adapt callers of Seek()/SeekRel()/Tell()/remainingSize()
This commit is contained in:
Michael Stahl
2014-03-29 01:19:24 +01:00
parent 19bbfc0b39
commit 1258b576ae
20 changed files with 124 additions and 124 deletions

View File

@@ -50,7 +50,7 @@ public:
virtual ErrCode ReadAt( sal_uInt64 nPos, void* pBuffer, sal_Size nCount, sal_Size * pRead ) const SAL_OVERRIDE;
virtual ErrCode WriteAt( sal_uInt64 nPos, const void* pBuffer, sal_Size nCount, sal_Size * pWritten ) SAL_OVERRIDE;
virtual ErrCode Flush() const SAL_OVERRIDE;
virtual ErrCode SetSize( sal_Size nSize ) SAL_OVERRIDE;
virtual ErrCode SetSize( sal_uInt64 nSize ) SAL_OVERRIDE;
virtual ErrCode Stat( SvLockBytesStat*, SvLockBytesStatFlag ) const SAL_OVERRIDE;
};
@@ -145,7 +145,7 @@ ErrCode ImgProdLockBytes::Flush() const
ErrCode ImgProdLockBytes::SetSize( sal_Size nSize )
ErrCode ImgProdLockBytes::SetSize(sal_uInt64 const nSize)
{
if( GetStream() )
return SvLockBytes::SetSize( nSize );

View File

@@ -56,7 +56,7 @@ friend class SotStorage;
protected:
virtual sal_uLong GetData( void* pData, sal_uLong nSize ) SAL_OVERRIDE;
virtual sal_uLong PutData( const void* pData, sal_uLong nSize ) SAL_OVERRIDE;
virtual sal_uLong SeekPos( sal_uLong nPos ) SAL_OVERRIDE;
virtual sal_uInt64 SeekPos(sal_uInt64 nPos) SAL_OVERRIDE;
virtual void FlushData() SAL_OVERRIDE;
~SotStorageStream();
public:
@@ -77,13 +77,13 @@ public:
virtual void ResetError() SAL_OVERRIDE;
virtual void SetSize( sal_uLong nNewSize ) SAL_OVERRIDE;
virtual void SetSize( sal_uInt64 nNewSize ) SAL_OVERRIDE;
sal_uInt32 GetSize() const;
bool CopyTo( SotStorageStream * pDestStm );
virtual bool Commit();
virtual bool Revert();
bool SetProperty( const OUString& rName, const ::com::sun::star::uno::Any& rValue );
virtual sal_Size remainingSize() SAL_OVERRIDE;
virtual sal_uInt64 remainingSize() SAL_OVERRIDE;
};
#ifndef SOT_DECL_SOTSTORAGESTREAM_DEFINED

View File

@@ -47,11 +47,11 @@ class SVL_DLLPUBLIC SvInputStream: public SvStream
SVL_DLLPRIVATE virtual sal_uLong PutData(void const *, sal_uLong) SAL_OVERRIDE;
SVL_DLLPRIVATE virtual sal_uLong SeekPos(sal_uLong nPos) SAL_OVERRIDE;
SVL_DLLPRIVATE virtual sal_uInt64 SeekPos(sal_uInt64 nPos) SAL_OVERRIDE;
SVL_DLLPRIVATE virtual void FlushData() SAL_OVERRIDE;
SVL_DLLPRIVATE virtual void SetSize(sal_uLong) SAL_OVERRIDE;
SVL_DLLPRIVATE virtual void SetSize(sal_uInt64) SAL_OVERRIDE;
public:
SvInputStream(

View File

@@ -38,11 +38,11 @@ class SVL_DLLPUBLIC SvOutputStream: public SvStream
SVL_DLLPRIVATE virtual sal_uLong PutData(void const * pData, sal_uLong nSize) SAL_OVERRIDE;
SVL_DLLPRIVATE virtual sal_uLong SeekPos(sal_uLong) SAL_OVERRIDE;
SVL_DLLPRIVATE virtual sal_uInt64 SeekPos(sal_uInt64) SAL_OVERRIDE;
SVL_DLLPRIVATE virtual void FlushData() SAL_OVERRIDE;
SVL_DLLPRIVATE virtual void SetSize(sal_uLong) SAL_OVERRIDE;
SVL_DLLPRIVATE virtual void SetSize(sal_uInt64) SAL_OVERRIDE;
public:
SvOutputStream(com::sun::star::uno::Reference<

View File

@@ -50,7 +50,7 @@ public:
virtual ErrCode Flush() const SAL_OVERRIDE;
virtual ErrCode SetSize(sal_uLong) SAL_OVERRIDE;
virtual ErrCode SetSize(sal_uInt64) SAL_OVERRIDE;
virtual ErrCode Stat(SvLockBytesStat * pStat, SvLockBytesStatFlag) const SAL_OVERRIDE;

View File

@@ -197,7 +197,7 @@ class TOOLS_DLLPUBLIC SvPersistStream : public SvStream
virtual sal_uIntPtr GetData( void* pData, sal_uIntPtr nSize ) SAL_OVERRIDE;
virtual sal_uIntPtr PutData( const void* pData, sal_uIntPtr nSize ) SAL_OVERRIDE;
virtual sal_uIntPtr SeekPos( sal_uIntPtr nPos ) SAL_OVERRIDE;
virtual sal_uInt64 SeekPos(sal_uInt64 nPos) SAL_OVERRIDE;
virtual void FlushData() SAL_OVERRIDE;
protected:

View File

@@ -70,7 +70,7 @@ typedef sal_uInt16 StreamMode;
#define STREAM_STD_READWRITE (STREAM_READWRITE | STREAM_SHARE_DENYALL)
#define STREAM_SEEK_TO_BEGIN 0L
#define STREAM_SEEK_TO_END ULONG_MAX
#define STREAM_SEEK_TO_END SAL_MAX_UINT64
#define NUMBERFORMAT_INT_BIGENDIAN (sal_uInt16)0x0000
#define NUMBERFORMAT_INT_LITTLEENDIAN (sal_uInt16)0xFFFF
@@ -136,7 +136,7 @@ public:
virtual ErrCode Flush() const;
virtual ErrCode SetSize(sal_Size nSize);
virtual ErrCode SetSize(sal_uInt64 nSize);
virtual ErrCode Stat(SvLockBytesStat * pStat, SvLockBytesStatFlag) const;
};
@@ -204,7 +204,7 @@ private:
// LockBytes Interface
void* pImp; // unused
SvLockBytesRef xLockBytes; // Default implementation
sal_Size nActPos;
sal_uInt64 m_nActPos;
// Puffer-Verwaltung
sal_uInt8* pRWBuf; // Points to read/write buffer
@@ -244,15 +244,15 @@ private:
SvStream& operator=( const SvStream& rStream ); // not implemented
protected:
sal_Size nBufFilePos;///< File position of pBuf[0]
sal_uInt64 m_nBufFilePos; ///< File position of pBuf[0]
sal_uInt16 eStreamMode;
bool bIsWritable;
virtual sal_Size GetData( void* pData, sal_Size nSize );
virtual sal_Size PutData( const void* pData, sal_Size nSize );
virtual sal_Size SeekPos( sal_Size nPos );
virtual sal_uInt64 SeekPos( sal_uInt64 nPos );
virtual void FlushData();
virtual void SetSize( sal_Size nSize );
virtual void SetSize(sal_uInt64 nSize);
void ClearError();
void ClearBuffer();
@@ -339,15 +339,15 @@ public:
sal_Size Read( void* pData, sal_Size nSize );
sal_Size Write( const void* pData, sal_Size nSize );
sal_Size Seek( sal_Size nPos );
sal_Size SeekRel( sal_sSize nPos );
sal_Size Tell() const { return nBufFilePos+nBufActualPos; }
sal_uInt64 Seek( sal_uInt64 nPos );
sal_uInt64 SeekRel( sal_Int64 nPos );
sal_uInt64 Tell() const { return m_nBufFilePos + nBufActualPos; }
// length between current (Tell()) pos and end of stream
virtual sal_Size remainingSize();
virtual sal_uInt64 remainingSize();
void Flush();
bool IsEof() const { return bIsEof; }
// next Tell() <= nSize
bool SetStreamSize( sal_Size nSize );
bool SetStreamSize( sal_uInt64 nSize );
/** Read a line of bytes.
@@ -662,8 +662,8 @@ private:
protected:
virtual sal_Size GetData( void* pData, sal_Size nSize ) SAL_OVERRIDE;
virtual sal_Size PutData( const void* pData, sal_Size nSize ) SAL_OVERRIDE;
virtual sal_Size SeekPos( sal_Size nPos ) SAL_OVERRIDE;
virtual void SetSize( sal_Size nSize ) SAL_OVERRIDE;
virtual sal_uInt64 SeekPos( sal_uInt64 nPos ) SAL_OVERRIDE;
virtual void SetSize( sal_uInt64 nSize ) SAL_OVERRIDE;
virtual void FlushData() SAL_OVERRIDE;
public:
@@ -703,8 +703,8 @@ protected:
virtual sal_Size GetData( void* pData, sal_Size nSize ) SAL_OVERRIDE;
virtual sal_Size PutData( const void* pData, sal_Size nSize ) SAL_OVERRIDE;
virtual sal_Size SeekPos( sal_Size nPos ) SAL_OVERRIDE;
virtual void SetSize( sal_Size nSize ) SAL_OVERRIDE;
virtual sal_uInt64 SeekPos( sal_uInt64 nPos ) SAL_OVERRIDE;
virtual void SetSize( sal_uInt64 nSize ) SAL_OVERRIDE;
virtual void FlushData() SAL_OVERRIDE;
/// AllocateMemory must update pBuf accordingly
@@ -747,7 +747,7 @@ public:
bool IsObjectMemoryOwner() { return bOwnsData; }
void SetResizeOffset( sal_Size nNewResize ) { nResize = nNewResize; }
sal_Size GetResizeOffset() const { return nResize; }
virtual sal_Size remainingSize() SAL_OVERRIDE { return GetBufSize() - Tell(); }
virtual sal_uInt64 remainingSize() SAL_OVERRIDE { return GetBufSize() - Tell(); }
};
class TOOLS_DLLPUBLIC SvScriptStream: public SvStream

View File

@@ -134,8 +134,8 @@ public:
virtual void SetSynchronMode (bool bSynchron) SAL_OVERRIDE;
virtual ErrCode ReadAt(sal_uInt64 nPos, void *pBuffer, sal_uLong nCount, sal_uLong *pRead) const SAL_OVERRIDE;
virtual ErrCode WriteAt(sal_uInt64, const void*, sal_uLong, sal_uLong *pWritten) SAL_OVERRIDE;
virtual ErrCode Flush (void) const SAL_OVERRIDE;
virtual ErrCode SetSize (sal_uLong) SAL_OVERRIDE;
virtual ErrCode Flush() const SAL_OVERRIDE;
virtual ErrCode SetSize(sal_uInt64) SAL_OVERRIDE;
virtual ErrCode Stat ( SvLockBytesStat *pStat, SvLockBytesStatFlag) const SAL_OVERRIDE;
void SetError( ErrCode nError )

View File

@@ -190,8 +190,8 @@ protected: // Overridden methods
virtual sal_uLong GetData( void* pData, sal_uLong nSize ) SAL_OVERRIDE;
virtual sal_uLong PutData( const void* pData, sal_uLong nSize ) SAL_OVERRIDE;
virtual sal_uLong SeekPos( sal_uLong nPos ) SAL_OVERRIDE;
virtual void SetSize( sal_uLong nSize ) SAL_OVERRIDE;
virtual sal_uInt64 SeekPos( sal_uInt64 nPos ) SAL_OVERRIDE;
virtual void SetSize( sal_uInt64 nSize ) SAL_OVERRIDE;
virtual void FlushData() SAL_OVERRIDE;
private: // Data

View File

@@ -97,7 +97,7 @@ sal_uLong LtcUtBenValueStream::PutData( const void* /*pData*/, sal_uLong nSize
* @param position in value stream
* @return current position in value stream
*/
sal_uLong LtcUtBenValueStream::SeekPos( sal_uLong nPos )
sal_uInt64 LtcUtBenValueStream::SeekPos(sal_uInt64 const nPos)
{
if (nPos <= m_ulValueLength)
cCurrentPosition = nPos;
@@ -111,7 +111,7 @@ sal_uLong LtcUtBenValueStream::PutData( const void* /*pData*/, sal_uLong nSize
* @param size of buffer
* @return
*/
void LtcUtBenValueStream::SetSize( sal_uLong /*nSize*/ )
void LtcUtBenValueStream::SetSize( sal_uInt64 /*nSize*/ )
{
//pLtcBenContainer pContainer = cpValue->GetContainer();
//pContainer->GetStream()->SetStreamSize(nSize);

View File

@@ -68,7 +68,7 @@ sal_uLong StgInternalStream::PutData( const void* pData, sal_uLong nSize )
return 0;
}
sal_uLong StgInternalStream::SeekPos( sal_uLong nPos )
sal_uInt64 StgInternalStream::SeekPos(sal_uInt64 const nPos)
{
return pStrm ? pStrm->Seek( nPos ) : 0;
}

View File

@@ -1187,7 +1187,7 @@ sal_uLong StgTmpStrm::GetSize() const
return n;
}
void StgTmpStrm::SetSize( sal_uLong n )
void StgTmpStrm::SetSize(sal_uInt64 n)
{
if( pStrm )
pStrm->SetStreamSize( n );
@@ -1241,7 +1241,7 @@ void StgTmpStrm::SetSize( sal_uLong n )
{
if( n > nEndOfData )
{
sal_uLong nCur = Tell();
sal_uInt64 nCur = Tell();
Seek( nEndOfData - 1 );
WriteUChar( (sal_uInt8) 0 );
Seek( nCur );
@@ -1284,7 +1284,7 @@ sal_uLong StgTmpStrm::PutData( const void* pData, sal_uLong n )
return nNew;
}
sal_uLong StgTmpStrm::SeekPos( sal_uLong n )
sal_uInt64 StgTmpStrm::SeekPos(sal_uInt64 n)
{
if( n == STREAM_SEEK_TO_END )
n = GetSize();

View File

@@ -160,7 +160,7 @@ sal_uLong SotStorageStream::PutData( const void* pData, sal_uLong nSize )
return nRet;
}
sal_uLong SotStorageStream::SeekPos( sal_uLong nPos )
sal_uInt64 SotStorageStream::SeekPos(sal_uInt64 nPos)
{
sal_uLong nRet = 0;
@@ -186,9 +186,9 @@ void SotStorageStream::FlushData()
SvStream::FlushData();
}
void SotStorageStream::SetSize( sal_uLong nNewSize )
void SotStorageStream::SetSize(sal_uInt64 const nNewSize)
{
sal_uLong nPos = Tell();
sal_uInt64 const nPos = Tell();
if( pOwnStm )
{
pOwnStm->SetSize( nNewSize );
@@ -211,7 +211,7 @@ sal_uInt32 SotStorageStream::GetSize() const
return nSize;
}
sal_Size SotStorageStream::remainingSize()
sal_uInt64 SotStorageStream::remainingSize()
{
if (pOwnStm)
return pOwnStm->GetSize() - Tell();

View File

@@ -407,8 +407,8 @@ public:
virtual sal_uLong GetData( void* pData, sal_uLong nSize ) SAL_OVERRIDE;
virtual sal_uLong PutData( const void* pData, sal_uLong nSize ) SAL_OVERRIDE;
virtual sal_uLong SeekPos( sal_uLong nPos ) SAL_OVERRIDE;
virtual void SetSize( sal_uLong nSize ) SAL_OVERRIDE;
virtual sal_uInt64 SeekPos( sal_uInt64 nPos ) SAL_OVERRIDE;
virtual void SetSize( sal_uInt64 nSize ) SAL_OVERRIDE;
virtual void FlushData() SAL_OVERRIDE;
virtual void ResetError() SAL_OVERRIDE;
@@ -447,7 +447,7 @@ public:
BaseStorage* CreateStorage();// create an OLE Storage on the UCBStorageStream
sal_uLong GetSize();
sal_uLong ReadSourceWriteTemporary( sal_uLong aLength ); // read aLength from source and copy to temporary,
sal_uInt64 ReadSourceWriteTemporary( sal_uInt64 aLength ); // read aLength from source and copy to temporary,
// no seeking is produced
sal_uLong ReadSourceWriteTemporary(); // read source till the end and copy to temporary,
@@ -827,12 +827,12 @@ sal_uLong UCBStorageStream_Impl::ReadSourceWriteTemporary()
}
sal_uLong UCBStorageStream_Impl::ReadSourceWriteTemporary( sal_uLong aLength )
sal_uInt64 UCBStorageStream_Impl::ReadSourceWriteTemporary(sal_uInt64 aLength)
{
// read aLength bite from the source stream and copy them to the current
// position of the temporary stream
sal_uLong aResult = 0;
sal_uInt64 aResult = 0;
if( m_bSourceRead )
{
@@ -843,7 +843,7 @@ sal_uLong UCBStorageStream_Impl::ReadSourceWriteTemporary( sal_uLong aLength )
sal_uLong aReaded = 32000;
for( sal_uLong pInd = 0; pInd < aLength && aReaded == 32000 ; pInd += 32000 )
for (sal_uInt64 pInd = 0; pInd < aLength && aReaded == 32000 ; pInd += 32000)
{
sal_uLong aToCopy = min( aLength - pInd, 32000 );
aReaded = m_rSource->readBytes( aData, aToCopy );
@@ -939,12 +939,12 @@ sal_uLong UCBStorageStream_Impl::PutData( const void* pData, sal_uLong nSize )
}
sal_uLong UCBStorageStream_Impl::SeekPos( sal_uLong nPos )
sal_uInt64 UCBStorageStream_Impl::SeekPos(sal_uInt64 const nPos)
{
if( !Init() )
return 0;
sal_uLong aResult;
sal_uInt64 aResult;
if( nPos == STREAM_SEEK_TO_END )
{
@@ -996,7 +996,7 @@ sal_uLong UCBStorageStream_Impl::SeekPos( sal_uLong nPos )
return aResult;
}
void UCBStorageStream_Impl::SetSize( sal_uLong nSize )
void UCBStorageStream_Impl::SetSize(sal_uInt64 const nSize)
{
if ( !(m_nMode & STREAM_WRITE) )
{
@@ -1011,7 +1011,7 @@ void UCBStorageStream_Impl::SetSize( sal_uLong nSize )
if( m_bSourceRead )
{
sal_uLong aPos = m_pStream->Tell();
sal_uInt64 const aPos = m_pStream->Tell();
m_pStream->Seek( STREAM_SEEK_TO_END );
if( m_pStream->Tell() < nSize )
ReadSourceWriteTemporary( nSize - m_pStream->Tell() );

View File

@@ -170,7 +170,7 @@ ErrCode SvOutputStreamOpenLockBytes::Flush() const
}
// virtual
ErrCode SvOutputStreamOpenLockBytes::SetSize(sal_uLong)
ErrCode SvOutputStreamOpenLockBytes::SetSize(sal_uInt64)
{
return ERRCODE_IO_NOTSUPPORTED;
}
@@ -547,7 +547,7 @@ void SvInputStream::FlushData()
{}
// virtual
sal_uLong SvInputStream::SeekPos(sal_uLong nPos)
sal_uInt64 SvInputStream::SeekPos(sal_uInt64 const nPos)
{
if (open())
{
@@ -614,7 +614,7 @@ sal_uLong SvInputStream::SeekPos(sal_uLong nPos)
}
// virtual
void SvInputStream::SetSize(sal_uLong)
void SvInputStream::SetSize(sal_uInt64)
{
SetError(ERRCODE_IO_NOTSUPPORTED);
}
@@ -712,7 +712,7 @@ sal_uLong SvOutputStream::PutData(void const * pData, sal_uLong nSize)
}
// virtual
sal_uLong SvOutputStream::SeekPos(sal_uLong)
sal_uInt64 SvOutputStream::SeekPos(sal_uInt64)
{
SetError(ERRCODE_IO_NOTSUPPORTED);
return 0;
@@ -736,7 +736,7 @@ void SvOutputStream::FlushData()
}
// virtual
void SvOutputStream::SetSize(sal_uLong)
void SvOutputStream::SetSize(sal_uInt64)
{
SetError(ERRCODE_IO_NOTSUPPORTED);
}

View File

@@ -216,10 +216,10 @@ sal_uIntPtr SvPersistStream::PutData( const void* pData, sal_uIntPtr nSize )
return nRet;
}
sal_uIntPtr SvPersistStream::SeekPos( sal_uIntPtr nPos )
sal_uInt64 SvPersistStream::SeekPos(sal_uInt64 const nPos)
{
DBG_ASSERT( pStm, "stream not set" );
sal_uIntPtr nRet = pStm->Seek( nPos );
sal_uInt64 nRet = pStm->Seek( nPos );
SetError( pStm->GetError() );
return nRet;
}

View File

@@ -220,7 +220,7 @@ ErrCode SvLockBytes::Flush() const
}
// virtual
ErrCode SvLockBytes::SetSize(sal_Size nSize)
ErrCode SvLockBytes::SetSize(sal_uInt64 const nSize)
{
if (!m_pStream)
{
@@ -242,7 +242,7 @@ ErrCode SvLockBytes::Stat(SvLockBytesStat * pStat, SvLockBytesStatFlag) const
if (pStat)
{
sal_Size nPos = m_pStream->Tell();
sal_uInt64 const nPos = m_pStream->Tell();
pStat->nSize = m_pStream->Seek(STREAM_SEEK_TO_END);
m_pStream->Seek(nPos);
}
@@ -319,8 +319,8 @@ sal_Size SvStream::GetData( void* pData, sal_Size nSize )
{
DBG_ASSERT( xLockBytes.Is(), "pure virtual function" );
sal_Size nRet;
nError = xLockBytes->ReadAt( nActPos, pData, nSize, &nRet );
nActPos += nRet;
nError = xLockBytes->ReadAt(m_nActPos, pData, nSize, &nRet);
m_nActPos += nRet;
return nRet;
}
else return 0;
@@ -332,25 +332,25 @@ sal_Size SvStream::PutData( const void* pData, sal_Size nSize )
{
DBG_ASSERT( xLockBytes.Is(), "pure virtual function" );
sal_Size nRet;
nError = xLockBytes->WriteAt( nActPos, pData, nSize, &nRet );
nActPos += nRet;
nError = xLockBytes->WriteAt(m_nActPos, pData, nSize, &nRet);
m_nActPos += nRet;
return nRet;
}
else return 0;
}
sal_Size SvStream::SeekPos( sal_Size nPos )
sal_uInt64 SvStream::SeekPos(sal_uInt64 const nPos)
{
if( !GetError() && nPos == STREAM_SEEK_TO_END )
{
DBG_ASSERT( xLockBytes.Is(), "pure virtual function" );
SvLockBytesStat aStat;
xLockBytes->Stat( &aStat, SVSTATFLAG_DEFAULT );
nActPos = aStat.nSize;
m_nActPos = aStat.nSize;
}
else
nActPos = nPos;
return nActPos;
m_nActPos = nPos;
return m_nActPos;
}
void SvStream::FlushData()
@@ -362,7 +362,7 @@ void SvStream::FlushData()
}
}
void SvStream::SetSize( sal_Size nSize )
void SvStream::SetSize(sal_uInt64 const nSize)
{
DBG_ASSERT( xLockBytes.Is(), "pure virtual function" );
nError = xLockBytes->SetSize( nSize );
@@ -370,7 +370,7 @@ void SvStream::SetSize( sal_Size nSize )
void SvStream::ImpInit()
{
nActPos = 0;
m_nActPos = 0;
nCompressMode = COMPRESSMODE_NONE;
eStreamCharSet = osl_getThreadTextEncoding();
nCryptMask = 0;
@@ -383,7 +383,7 @@ void SvStream::ImpInit()
SetNumberFormatInt( NUMBERFORMAT_INT_LITTLEENDIAN );
nBufFilePos = 0;
m_nBufFilePos = 0;
nBufActualPos = 0;
bIsDirty = false;
bIsConsistent = true;
@@ -463,7 +463,7 @@ void SvStream::SetNumberFormatInt( sal_uInt16 nNewFormat )
void SvStream::SetBufferSize( sal_uInt16 nBufferSize )
{
sal_Size nActualFilePos = Tell();
sal_uInt64 const nActualFilePos = Tell();
bool bDontSeek = (pRWBuf == 0);
if( bIsDirty && bIsConsistent && bIsWritable ) // due to Windows NT: Access denied
@@ -472,7 +472,7 @@ void SvStream::SetBufferSize( sal_uInt16 nBufferSize )
if( nBufSize )
{
delete[] pRWBuf;
nBufFilePos += nBufActualPos;
m_nBufFilePos += nBufActualPos;
}
pRWBuf = 0;
@@ -492,7 +492,7 @@ void SvStream::ClearBuffer()
{
nBufActualLen = 0;
nBufActualPos = 0;
nBufFilePos = 0;
m_nBufFilePos = 0;
pBufPos = pRWBuf;
bIsDirty = false;
bIsConsistent = true;
@@ -519,7 +519,7 @@ bool SvStream::ReadLine( OString& rStr, sal_Int32 nMaxBytesToRead )
{
sal_Char buf[256+1];
bool bEnd = false;
sal_Size nOldFilePos = Tell();
sal_uInt64 nOldFilePos = Tell();
sal_Char c = 0;
sal_Size nTotalLen = 0;
@@ -593,7 +593,7 @@ bool SvStream::ReadUniStringLine( OUString& rStr, sal_Int32 nMaxCodepointsToRead
{
sal_Unicode buf[256+1];
bool bEnd = false;
sal_Size nOldFilePos = Tell();
sal_uInt64 nOldFilePos = Tell();
sal_Unicode c = 0;
sal_Size nTotalLen = 0;
@@ -690,7 +690,7 @@ OString read_zeroTerminated_uInt8s_ToOString(SvStream& rStream)
sal_Char buf[ 256 + 1 ];
bool bEnd = false;
sal_Size nFilePos = rStream.Tell();
sal_uInt64 nFilePos = rStream.Tell();
while( !bEnd && !rStream.GetError() )
{
@@ -857,18 +857,18 @@ bool SvStream::StartReadingUnicodeText( rtl_TextEncoding eReadBomCharSet )
return nError == SVSTREAM_OK;
}
sal_Size SvStream::SeekRel( sal_sSize nPos )
sal_uInt64 SvStream::SeekRel(sal_Int64 const nPos)
{
sal_Size nActualPos = Tell();
sal_uInt64 nActualPos = Tell();
if ( nPos >= 0 )
{
if ( SAL_MAX_SIZE - nActualPos > (sal_Size)nPos )
if (SAL_MAX_UINT64 - nActualPos > static_cast<sal_uInt64>(nPos))
nActualPos += nPos;
}
else
{
sal_Size nAbsPos = (sal_Size)-nPos;
sal_uInt64 const nAbsPos = static_cast<sal_uInt64>(-nPos);
if ( nActualPos >= nAbsPos )
nActualPos -= nAbsPos;
}
@@ -1262,7 +1262,7 @@ sal_Size SvStream::Read( void* pData, sal_Size nCount )
nCount = GetData( (char*)pData,nCount);
if( nCryptMask )
EncryptBuffer(pData, nCount);
nBufFilePos += nCount;
m_nBufFilePos += nCount;
}
else
{
@@ -1281,7 +1281,7 @@ sal_Size SvStream::Read( void* pData, sal_Size nCount )
{
if( bIsDirty ) // Does stream require a flush?
{
SeekPos( nBufFilePos );
SeekPos(m_nBufFilePos);
if( nCryptMask )
CryptAndWriteBuffer(pRWBuf, nBufActualLen);
else
@@ -1297,22 +1297,22 @@ sal_Size SvStream::Read( void* pData, sal_Size nCount )
bIoRead = false;
SeekPos( nBufFilePos + nBufActualPos );
SeekPos(m_nBufFilePos + nBufActualPos);
nBufActualLen = 0;
pBufPos = pRWBuf;
nCount = GetData( (char*)pData, nCount );
if( nCryptMask )
EncryptBuffer(pData, nCount);
nBufFilePos += nCount;
nBufFilePos += nBufActualPos;
m_nBufFilePos += nCount;
m_nBufFilePos += nBufActualPos;
nBufActualPos = 0;
}
else
{
// => Yes. Fill buffer first, then copy to target area
nBufFilePos += nBufActualPos;
SeekPos( nBufFilePos );
m_nBufFilePos += nBufActualPos;
SeekPos(m_nBufFilePos);
// TODO: Typecast before GetData, sal_uInt16 nCountTmp
sal_Size nCountTmp = GetData( pRWBuf, nBufSize );
@@ -1356,7 +1356,7 @@ sal_Size SvStream::Write( const void* pData, sal_Size nCount )
nCount = CryptAndWriteBuffer( pData, nCount );
else
nCount = PutData( (char*)pData, nCount );
nBufFilePos += nCount;
m_nBufFilePos += nCount;
return nCount;
}
@@ -1378,7 +1378,7 @@ sal_Size SvStream::Write( const void* pData, sal_Size nCount )
// Does stream require flushing?
if( bIsDirty )
{
SeekPos( nBufFilePos );
SeekPos(m_nBufFilePos);
if( nCryptMask )
CryptAndWriteBuffer( pRWBuf, (sal_Size)nBufActualLen );
else
@@ -1390,16 +1390,16 @@ sal_Size SvStream::Write( const void* pData, sal_Size nCount )
if( nCount > nBufSize )
{
bIoWrite = false;
nBufFilePos += nBufActualPos;
m_nBufFilePos += nBufActualPos;
nBufActualLen = 0;
nBufActualPos = 0;
pBufPos = pRWBuf;
SeekPos( nBufFilePos );
SeekPos(m_nBufFilePos);
if( nCryptMask )
nCount = CryptAndWriteBuffer( pData, nCount );
else
nCount = PutData( (char*)pData, nCount );
nBufFilePos += nCount;
m_nBufFilePos += nCount;
}
else
{
@@ -1407,7 +1407,7 @@ sal_Size SvStream::Write( const void* pData, sal_Size nCount )
memcpy( pRWBuf, pData, (size_t)nCount );
// Mind the order!
nBufFilePos += nBufActualPos;
m_nBufFilePos += nBufActualPos;
nBufActualPos = (sal_uInt16)nCount;
pBufPos = pRWBuf + nCount;
nBufActualLen = (sal_uInt16)nCount;
@@ -1418,21 +1418,21 @@ sal_Size SvStream::Write( const void* pData, sal_Size nCount )
return nCount;
}
sal_Size SvStream::Seek( sal_Size nFilePos )
sal_uInt64 SvStream::Seek(sal_uInt64 const nFilePos)
{
bIoRead = bIoWrite = false;
bIsEof = false;
if( !pRWBuf )
{
nBufFilePos = SeekPos( nFilePos );
DBG_ASSERT(Tell()==nBufFilePos,"Out Of Sync!");
return nBufFilePos;
m_nBufFilePos = SeekPos( nFilePos );
DBG_ASSERT(Tell() == m_nBufFilePos,"Out Of Sync!");
return m_nBufFilePos;
}
// Is seek position within buffer?
if( nFilePos >= nBufFilePos && nFilePos <= (nBufFilePos + nBufActualLen))
if (nFilePos >= m_nBufFilePos && nFilePos <= (m_nBufFilePos + nBufActualLen))
{
nBufActualPos = (sal_uInt16)(nFilePos - nBufFilePos);
nBufActualPos = (sal_uInt16)(nFilePos - m_nBufFilePos);
pBufPos = pRWBuf + nBufActualPos;
// Update nBufFree to avoid crash upon PutBack
nBufFree = nBufActualLen - nBufActualPos;
@@ -1441,7 +1441,7 @@ sal_Size SvStream::Seek( sal_Size nFilePos )
{
if( bIsDirty && bIsConsistent)
{
SeekPos( nBufFilePos );
SeekPos(m_nBufFilePos);
if( nCryptMask )
CryptAndWriteBuffer( pRWBuf, nBufActualLen );
else
@@ -1451,25 +1451,25 @@ sal_Size SvStream::Seek( sal_Size nFilePos )
nBufActualLen = 0;
nBufActualPos = 0;
pBufPos = pRWBuf;
nBufFilePos = SeekPos( nFilePos );
m_nBufFilePos = SeekPos( nFilePos );
}
#ifdef OV_DEBUG
{
sal_Size nDebugTemp = nBufFilePos + nBufActualPos;
sal_uInt64 nDebugTemp = m_nBufFilePos + nBufActualPos;
DBG_ASSERT(Tell()==nDebugTemp,"Sync?");
}
#endif
return nBufFilePos + nBufActualPos;
return m_nBufFilePos + nBufActualPos;
}
//STREAM_SEEK_TO_END in the some of the Seek backends is special cased to be
//efficient, in others e.g. SotStorageStream it's really horribly slow, and in
//those this should be overridden
sal_Size SvStream::remainingSize()
sal_uInt64 SvStream::remainingSize()
{
sal_Size nCurr = Tell();
sal_Size nEnd = Seek(STREAM_SEEK_TO_END);
sal_Size nMaxAvailable = nEnd-nCurr;
sal_uInt64 const nCurr = Tell();
sal_uInt64 const nEnd = Seek(STREAM_SEEK_TO_END);
sal_uInt64 nMaxAvailable = nEnd-nCurr;
Seek(nCurr);
return nMaxAvailable;
}
@@ -1478,7 +1478,7 @@ void SvStream::Flush()
{
if( bIsDirty && bIsConsistent )
{
SeekPos( nBufFilePos );
SeekPos(m_nBufFilePos);
if( nCryptMask )
CryptAndWriteBuffer( pRWBuf, (sal_Size)nBufActualLen );
else
@@ -1494,14 +1494,14 @@ void SvStream::RefreshBuffer()
{
if( bIsDirty && bIsConsistent )
{
SeekPos( nBufFilePos );
SeekPos(m_nBufFilePos);
if( nCryptMask )
CryptAndWriteBuffer( pRWBuf, (sal_Size)nBufActualLen );
else
PutData( pRWBuf, nBufActualLen );
bIsDirty = false;
}
SeekPos( nBufFilePos );
SeekPos(m_nBufFilePos);
nBufActualLen = (sal_uInt16)GetData( pRWBuf, nBufSize );
if( nBufActualLen && nError == ERRCODE_IO_PENDING )
nError = ERRCODE_NONE;
@@ -1621,7 +1621,7 @@ void SvStream::SetCryptMaskKey(const OString& rCryptMaskKey)
void SvStream::SyncSvStream( sal_Size nNewStreamPos )
{
ClearBuffer();
SvStream::nBufFilePos = nNewStreamPos;
SvStream::m_nBufFilePos = nNewStreamPos;
}
void SvStream::SyncSysStream()
@@ -1630,10 +1630,10 @@ void SvStream::SyncSysStream()
SeekPos( Tell() );
}
bool SvStream::SetStreamSize( sal_Size nSize )
bool SvStream::SetStreamSize(sal_uInt64 const nSize)
{
#ifdef DBG_UTIL
sal_Size nFPos = Tell();
sal_uInt64 nFPos = Tell();
#endif
sal_uInt16 nBuf = nBufSize;
SetBufferSize( 0 );
@@ -1740,8 +1740,8 @@ const void* SvMemoryStream::GetBuffer()
sal_uIntPtr SvMemoryStream::GetSize()
{
Flush();
sal_uIntPtr nTemp = Tell();
sal_uIntPtr nLength = Seek( STREAM_SEEK_TO_END );
sal_uInt64 const nTemp = Tell();
sal_uInt64 const nLength = Seek( STREAM_SEEK_TO_END );
Seek( nTemp );
return nLength;
}
@@ -1842,7 +1842,7 @@ sal_Size SvMemoryStream::PutData( const void* pData, sal_Size nCount )
return nCount;
}
sal_Size SvMemoryStream::SeekPos( sal_Size nNewPos )
sal_uInt64 SvMemoryStream::SeekPos(sal_uInt64 const nNewPos)
{
// nEndOfData: First position in stream not allowed to read from
// nSize: Size of allocated buffer
@@ -1975,7 +1975,7 @@ void* SvMemoryStream::SwitchBuffer( sal_Size nInitSize, sal_Size nResizeOffset)
return pRetVal;
}
void SvMemoryStream::SetSize( sal_Size nNewSize )
void SvMemoryStream::SetSize(sal_uInt64 const nNewSize)
{
long nDiff = (long)nNewSize - (long)nSize;
ReAllocateMemory( nDiff );

View File

@@ -361,7 +361,7 @@ sal_Size SvFileStream::PutData( const void* pData, sal_Size nSize )
return (sal_Size)nWrite;
}
sal_Size SvFileStream::SeekPos( sal_Size nPos )
sal_uInt64 SvFileStream::SeekPos(sal_uInt64 const nPos)
{
if ( IsOpen() )
{
@@ -593,7 +593,7 @@ void SvFileStream::ResetError()
SvStream::ClearError();
}
void SvFileStream::SetSize (sal_Size nSize)
void SvFileStream::SetSize (sal_uInt64 const nSize)
{
if (IsOpen())
{

View File

@@ -165,7 +165,7 @@ sal_Size SvFileStream::PutData( const void* pData, sal_Size nSize )
return nCount;
}
sal_Size SvFileStream::SeekPos( sal_Size nPos )
sal_uInt64 SvFileStream::SeekPos(sal_uInt64 const nPos)
{
DWORD nNewPos = 0;
if( IsOpen() )
@@ -184,7 +184,7 @@ sal_Size SvFileStream::SeekPos( sal_Size nPos )
}
else
SetError( SVSTREAM_GENERALERROR );
return (sal_Size)nNewPos;
return static_cast<sal_uInt64>(nNewPos);
}
void SvFileStream::FlushData()
@@ -410,7 +410,7 @@ void SvFileStream::ResetError()
SvStream::ClearError();
}
void SvFileStream::SetSize( sal_Size nSize )
void SvFileStream::SetSize(sal_uInt64 const nSize)
{
if( IsOpen() )

View File

@@ -1502,7 +1502,7 @@ ErrCode UcbLockBytes::Flush() const
}
ErrCode UcbLockBytes::SetSize (sal_uLong nNewSize)
ErrCode UcbLockBytes::SetSize (sal_uInt64 const nNewSize)
{
SvLockBytesStat aStat;
Stat( &aStat, (SvLockBytesStatFlag) 0 );