diff options
author | Michael Stahl <mstahl@redhat.com> | 2014-03-28 23:03:57 +0100 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2014-03-29 02:03:07 +0100 |
commit | 19bbfc0b39d79a90539fd3094d9b6d7d81619a45 (patch) | |
tree | ccac02c9c175f7254c08a108c5107d7f3ebed87f | |
parent | 655a39d8c0d151618d7c3b3fe0dcff508c2b53c5 (diff) |
tools: allow 64-bit positions on SvLockBytes
Bump stream positions to 64 bits on:
SvLockBytes::ReadAt()
SvLockBytes::WriteAt()
SvAsyncLockBytes::m_nSize
SvOpenLockBytes::Seek()
SvOpenLockBytes::Tell()
SvOutputStreamOpenLockBytes::m_nPosition
OInputStreamHelper::m_nActPos
Change-Id: Ica3b674e0ab23a756260a51475e97a5396ecdddb
-rw-r--r-- | forms/source/component/imgprod.cxx | 14 | ||||
-rw-r--r-- | include/svl/strmadpt.hxx | 12 | ||||
-rw-r--r-- | include/tools/stream.hxx | 18 | ||||
-rw-r--r-- | include/unotools/streamhelper.hxx | 4 | ||||
-rw-r--r-- | include/unotools/ucblockbytes.hxx | 4 | ||||
-rw-r--r-- | sd/source/ui/app/sdmod1.cxx | 2 | ||||
-rw-r--r-- | svl/source/misc/strmadpt.cxx | 13 | ||||
-rw-r--r-- | tools/source/stream/stream.cxx | 10 | ||||
-rw-r--r-- | unotools/source/streaming/streamhelper.cxx | 9 | ||||
-rw-r--r-- | unotools/source/ucbhelper/ucblockbytes.cxx | 6 |
10 files changed, 44 insertions, 48 deletions
diff --git a/forms/source/component/imgprod.cxx b/forms/source/component/imgprod.cxx index aca7b5e0351f..6af16453f153 100644 --- a/forms/source/component/imgprod.cxx +++ b/forms/source/component/imgprod.cxx @@ -47,8 +47,8 @@ public: ImgProdLockBytes( ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > & rStreamRef ); virtual ~ImgProdLockBytes(); - virtual ErrCode ReadAt( sal_Size nPos, void* pBuffer, sal_Size nCount, sal_Size* pRead ) const SAL_OVERRIDE; - virtual ErrCode WriteAt( sal_Size nPos, const void* pBuffer, sal_Size nCount, sal_Size* pWritten ) SAL_OVERRIDE; + 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 Stat( SvLockBytesStat*, SvLockBytesStatFlag ) const SAL_OVERRIDE; @@ -94,9 +94,8 @@ ImgProdLockBytes::~ImgProdLockBytes() { } - - -ErrCode ImgProdLockBytes::ReadAt( sal_Size nPos, void* pBuffer, sal_Size nCount, sal_Size* pRead ) const +ErrCode ImgProdLockBytes::ReadAt(sal_uInt64 const nPos, + void* pBuffer, sal_Size nCount, sal_Size * pRead) const { if( GetStream() ) { @@ -125,9 +124,8 @@ ErrCode ImgProdLockBytes::ReadAt( sal_Size nPos, void* pBuffer, sal_Size nCount, } } - - -ErrCode ImgProdLockBytes::WriteAt( sal_Size nPos, const void* pBuffer, sal_Size nCount, sal_Size* pWritten ) +ErrCode ImgProdLockBytes::WriteAt(sal_uInt64 const nPos, + const void* pBuffer, sal_Size nCount, sal_Size * pWritten) { if( GetStream() ) return SvLockBytes::WriteAt( nPos, pBuffer, nCount, pWritten ); diff --git a/include/svl/strmadpt.hxx b/include/svl/strmadpt.hxx index 7117a6e54e5a..5f540566db92 100644 --- a/include/svl/strmadpt.hxx +++ b/include/svl/strmadpt.hxx @@ -32,7 +32,7 @@ class SVL_DLLPUBLIC SvOutputStreamOpenLockBytes: public SvOpenLockBytes { com::sun::star::uno::Reference< com::sun::star::io::XOutputStream > m_xOutputStream; - sal_uInt32 m_nPosition; + sal_uInt64 m_nPosition; public: TYPEINFO_OVERRIDE(); @@ -43,10 +43,10 @@ public: rTheOutputStream): m_xOutputStream(rTheOutputStream), m_nPosition(0) {} - virtual ErrCode ReadAt(sal_uLong, void *, sal_uLong, sal_uLong *) const SAL_OVERRIDE; + virtual ErrCode ReadAt(sal_uInt64, void *, sal_uLong, sal_uInt64 *) const SAL_OVERRIDE; - virtual ErrCode WriteAt(sal_uLong nPos, const void * pBuffer, sal_uLong nCount, - sal_uLong * pWritten) SAL_OVERRIDE; + virtual ErrCode WriteAt(sal_uInt64 nPos, const void * pBuffer, sal_uLong nCount, + sal_uInt64 * pWritten) SAL_OVERRIDE; virtual ErrCode Flush() const SAL_OVERRIDE; @@ -57,9 +57,9 @@ public: virtual ErrCode FillAppend(const void * pBuffer, sal_uLong nCount, sal_uLong * pWritten) SAL_OVERRIDE; - virtual sal_uLong Tell() const SAL_OVERRIDE; + virtual sal_uInt64 Tell() const SAL_OVERRIDE; - virtual sal_uLong Seek(sal_uLong) SAL_OVERRIDE; + virtual sal_uInt64 Seek(sal_uInt64) SAL_OVERRIDE; virtual void Terminate() SAL_OVERRIDE; }; diff --git a/include/tools/stream.hxx b/include/tools/stream.hxx index 929432a88650..448b4811865d 100644 --- a/include/tools/stream.hxx +++ b/include/tools/stream.hxx @@ -129,9 +129,9 @@ public: virtual void SetSynchronMode(bool bTheSync = true) { m_bSync = bTheSync; } virtual bool IsSynchronMode() const { return m_bSync; } - virtual ErrCode ReadAt(sal_Size nPos, void * pBuffer, sal_Size nCount, + virtual ErrCode ReadAt(sal_uInt64 nPos, void * pBuffer, sal_Size nCount, sal_Size * pRead) const; - virtual ErrCode WriteAt(sal_Size nPos, const void * pBuffer, sal_Size nCount, + virtual ErrCode WriteAt(sal_uInt64 nPos, const void * pBuffer, sal_Size nCount, sal_Size * pWritten); virtual ErrCode Flush() const; @@ -157,9 +157,9 @@ public: virtual ErrCode FillAppend(const void * pBuffer, sal_Size nCount, sal_Size * pWritten) = 0; - virtual sal_Size Tell() const = 0; + virtual sal_uInt64 Tell() const = 0; - virtual sal_Size Seek(sal_Size nPos) = 0; + virtual sal_uInt64 Seek(sal_uInt64 nPos) = 0; virtual void Terminate() = 0; }; @@ -170,7 +170,7 @@ SV_DECL_IMPL_REF(SvOpenLockBytes); class SvAsyncLockBytes: public SvOpenLockBytes { - sal_Size m_nSize; + sal_uInt64 m_nSize; bool m_bTerminated; public: @@ -179,17 +179,17 @@ public: SvAsyncLockBytes(SvStream * pStream, bool bOwner): SvOpenLockBytes(pStream, bOwner), m_nSize(0), m_bTerminated(false) {} - virtual ErrCode ReadAt(sal_Size nPos, void * pBuffer, sal_Size nCount, + virtual ErrCode ReadAt(sal_uInt64 nPos, void * pBuffer, sal_Size nCount, sal_Size * pRead) const SAL_OVERRIDE; - virtual ErrCode WriteAt(sal_Size nPos, const void * pBuffer, sal_Size nCount, + virtual ErrCode WriteAt(sal_uInt64 nPos, const void * pBuffer, sal_Size nCount, sal_Size * pWritten) SAL_OVERRIDE; virtual ErrCode FillAppend(const void * pBuffer, sal_Size nCount, sal_Size * pWritten) SAL_OVERRIDE; - virtual sal_Size Tell() const SAL_OVERRIDE { return m_nSize; } + virtual sal_uInt64 Tell() const SAL_OVERRIDE { return m_nSize; } - virtual sal_Size Seek(sal_Size nPos) SAL_OVERRIDE; + virtual sal_uInt64 Seek(sal_uInt64 nPos) SAL_OVERRIDE; virtual void Terminate() SAL_OVERRIDE { m_bTerminated = true; } }; diff --git a/include/unotools/streamhelper.hxx b/include/unotools/streamhelper.hxx index 7f4d19dac859..6cf186070e3e 100644 --- a/include/unotools/streamhelper.hxx +++ b/include/unotools/streamhelper.hxx @@ -43,13 +43,13 @@ class UNOTOOLS_DLLPUBLIC OInputStreamHelper : public InputStreamHelper_Base { ::osl::Mutex m_aMutex; SvLockBytesRef m_xLockBytes; - sal_uInt32 m_nActPos; + sal_uInt64 m_nActPos; sal_Int32 m_nAvailable; // this is typically the chunk(buffer) size public: OInputStreamHelper(const SvLockBytesRef& _xLockBytes, sal_uInt32 _nAvailable, - sal_uInt32 _nPos = 0) + sal_uInt64 _nPos = 0) :m_xLockBytes(_xLockBytes) ,m_nActPos(_nPos) ,m_nAvailable(_nAvailable){} diff --git a/include/unotools/ucblockbytes.hxx b/include/unotools/ucblockbytes.hxx index 049ca69e6828..8bb15e77dc28 100644 --- a/include/unotools/ucblockbytes.hxx +++ b/include/unotools/ucblockbytes.hxx @@ -132,8 +132,8 @@ public: // SvLockBytes virtual void SetSynchronMode (bool bSynchron) SAL_OVERRIDE; - virtual ErrCode ReadAt ( sal_uLong nPos, void *pBuffer, sal_uLong nCount, sal_uLong *pRead) const SAL_OVERRIDE; - virtual ErrCode WriteAt ( sal_uLong, const void*, sal_uLong, sal_uLong *pWritten) 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 Stat ( SvLockBytesStat *pStat, SvLockBytesStatFlag) const SAL_OVERRIDE; diff --git a/sd/source/ui/app/sdmod1.cxx b/sd/source/ui/app/sdmod1.cxx index 61f4030c8c50..143c41dd3e99 100644 --- a/sd/source/ui/app/sdmod1.cxx +++ b/sd/source/ui/app/sdmod1.cxx @@ -931,7 +931,7 @@ OutlineToImpressFinalizer::OutlineToImpressFinalizer ( static const sal_Size nBufferSize = 4096; ::boost::scoped_array<sal_Int8> pBuffer (new sal_Int8[nBufferSize]); - sal_Size nReadPosition (0); + sal_uInt64 nReadPosition(0); bool bLoop (true); while (bLoop) { diff --git a/svl/source/misc/strmadpt.cxx b/svl/source/misc/strmadpt.cxx index d5820185d5f6..31d7275139f3 100644 --- a/svl/source/misc/strmadpt.cxx +++ b/svl/source/misc/strmadpt.cxx @@ -138,14 +138,14 @@ inline sal_uInt32 SvDataPipe_Impl::getReadPosition() const TYPEINIT1(SvOutputStreamOpenLockBytes, SvOpenLockBytes) // virtual -ErrCode SvOutputStreamOpenLockBytes::ReadAt(sal_uLong, void *, sal_uLong, sal_uLong *) +ErrCode SvOutputStreamOpenLockBytes::ReadAt(sal_uInt64, void *, sal_uLong, sal_uLong*) const { return ERRCODE_IO_CANTREAD; } // virtual -ErrCode SvOutputStreamOpenLockBytes::WriteAt(sal_uLong nPos, void const * pBuffer, +ErrCode SvOutputStreamOpenLockBytes::WriteAt(sal_uInt64 const nPos, void const * pBuffer, sal_uLong nCount, sal_uLong * pWritten) { if (nPos != m_nPosition) @@ -215,13 +215,13 @@ ErrCode SvOutputStreamOpenLockBytes::FillAppend(void const * pBuffer, } // virtual -sal_uLong SvOutputStreamOpenLockBytes::Tell() const +sal_uInt64 SvOutputStreamOpenLockBytes::Tell() const { return m_nPosition; } // virtual -sal_uLong SvOutputStreamOpenLockBytes::Seek(sal_uLong) +sal_uInt64 SvOutputStreamOpenLockBytes::Seek(sal_uInt64) { return m_nPosition; } @@ -293,8 +293,7 @@ SvLockBytesInputStream::readBytes(uno::Sequence< sal_Int8 > & rData, while (nSize < nBytesToRead) { sal_Size nCount; - ErrCode nError = m_xLockBytes->ReadAt(static_cast<sal_Size>( - m_nPosition), + ErrCode nError = m_xLockBytes->ReadAt(m_nPosition, rData.getArray() + nSize, nBytesToRead - nSize, &nCount); if (nError != ERRCODE_NONE && nError != ERRCODE_IO_PENDING) @@ -327,7 +326,7 @@ SvLockBytesInputStream::readSomeBytes(uno::Sequence< sal_Int8 > & rData, ErrCode nError; do { - nError = m_xLockBytes->ReadAt(static_cast<sal_Size>(m_nPosition), + nError = m_xLockBytes->ReadAt(m_nPosition, rData.getArray(), nMaxBytesToRead < 0 ? 0 : nMaxBytesToRead, diff --git a/tools/source/stream/stream.cxx b/tools/source/stream/stream.cxx index 71a06de0050c..ea2e18678bbf 100644 --- a/tools/source/stream/stream.cxx +++ b/tools/source/stream/stream.cxx @@ -173,7 +173,7 @@ void SvLockBytes::close() TYPEINIT0(SvLockBytes); // virtual -ErrCode SvLockBytes::ReadAt(sal_Size nPos, void * pBuffer, sal_Size nCount, +ErrCode SvLockBytes::ReadAt(sal_uInt64 const nPos, void * pBuffer, sal_Size nCount, sal_Size * pRead) const { if (!m_pStream) @@ -190,7 +190,7 @@ ErrCode SvLockBytes::ReadAt(sal_Size nPos, void * pBuffer, sal_Size nCount, } // virtual -ErrCode SvLockBytes::WriteAt(sal_Size nPos, const void * pBuffer, sal_Size nCount, +ErrCode SvLockBytes::WriteAt(sal_uInt64 const nPos, const void * pBuffer, sal_Size nCount, sal_Size * pWritten) { if (!m_pStream) @@ -258,7 +258,7 @@ TYPEINIT1(SvOpenLockBytes, SvLockBytes); TYPEINIT1(SvAsyncLockBytes, SvOpenLockBytes); // virtual -ErrCode SvAsyncLockBytes::ReadAt(sal_Size nPos, void * pBuffer, sal_Size nCount, +ErrCode SvAsyncLockBytes::ReadAt(sal_uInt64 const nPos, void * pBuffer, sal_Size nCount, sal_Size * pRead) const { if (m_bTerminated) @@ -274,7 +274,7 @@ ErrCode SvAsyncLockBytes::ReadAt(sal_Size nPos, void * pBuffer, sal_Size nCount, } // virtual -ErrCode SvAsyncLockBytes::WriteAt(sal_Size nPos, const void * pBuffer, +ErrCode SvAsyncLockBytes::WriteAt(sal_uInt64 const nPos, const void * pBuffer, sal_Size nCount, sal_Size * pWritten) { if (m_bTerminated) @@ -304,7 +304,7 @@ ErrCode SvAsyncLockBytes::FillAppend(const void * pBuffer, sal_Size nCount, } // virtual -sal_Size SvAsyncLockBytes::Seek(sal_Size nPos) +sal_uInt64 SvAsyncLockBytes::Seek(sal_uInt64 const nPos) { if (nPos != STREAM_SEEK_TO_END) m_nSize = nPos; diff --git a/unotools/source/streaming/streamhelper.cxx b/unotools/source/streaming/streamhelper.cxx index 519e6c7455ad..569d6e180dd0 100644 --- a/unotools/source/streaming/streamhelper.cxx +++ b/unotools/source/streaming/streamhelper.cxx @@ -47,10 +47,9 @@ sal_Int32 SAL_CALL OInputStreamHelper::readBytes(staruno::Sequence< sal_Int8 >& ::osl::MutexGuard aGuard( m_aMutex ); aData.realloc(nBytesToRead); - sal_Size nRead; + sal_Size nRead(0); ErrCode nError = m_xLockBytes->ReadAt(m_nActPos, (void*)aData.getArray(), nBytesToRead, &nRead); - // FIXME nRead could be truncated on 64-bit arches - m_nActPos += (sal_uInt32)nRead; + m_nActPos += nRead; if (nError != ERRCODE_NONE) throw stario::IOException(OUString(), static_cast<staruno::XWeak*>(this)); @@ -65,9 +64,7 @@ sal_Int32 SAL_CALL OInputStreamHelper::readBytes(staruno::Sequence< sal_Int8 >& void SAL_CALL OInputStreamHelper::seek( sal_Int64 location ) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException, std::exception) { ::osl::MutexGuard aGuard( m_aMutex ); - // cast is truncating, but position would be truncated as soon as - // put into SvLockBytes anyway - m_nActPos = sal::static_int_cast<sal_uInt32>(location); + m_nActPos = location; } sal_Int64 SAL_CALL OInputStreamHelper::getPosition( ) throw(::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException, std::exception) diff --git a/unotools/source/ucbhelper/ucblockbytes.cxx b/unotools/source/ucbhelper/ucblockbytes.cxx index 7253efff8a3d..4d49bc177812 100644 --- a/unotools/source/ucbhelper/ucblockbytes.cxx +++ b/unotools/source/ucbhelper/ucblockbytes.cxx @@ -1374,7 +1374,8 @@ void UcbLockBytes::SetSynchronMode (bool bSynchron) } -ErrCode UcbLockBytes::ReadAt ( sal_uLong nPos, void *pBuffer, sal_uLong nCount, sal_uLong *pRead) const +ErrCode UcbLockBytes::ReadAt(sal_uInt64 const nPos, + void *pBuffer, sal_uLong nCount, sal_uLong *pRead) const { if ( IsSynchronMode() ) { @@ -1442,7 +1443,8 @@ ErrCode UcbLockBytes::ReadAt ( sal_uLong nPos, void *pBuffer, sal_uLong nCount, } -ErrCode UcbLockBytes::WriteAt ( sal_uLong nPos, const void *pBuffer, sal_uLong nCount, sal_uLong *pWritten) +ErrCode UcbLockBytes::WriteAt(sal_uInt64 const nPos, const void *pBuffer, + sal_uLong nCount, sal_uLong *pWritten) { if ( pWritten ) *pWritten = 0; |