summaryrefslogtreecommitdiff
path: root/unotools
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2014-03-28 23:03:57 +0100
committerMichael Stahl <mstahl@redhat.com>2014-03-29 02:03:07 +0100
commit19bbfc0b39d79a90539fd3094d9b6d7d81619a45 (patch)
treeccac02c9c175f7254c08a108c5107d7f3ebed87f /unotools
parent655a39d8c0d151618d7c3b3fe0dcff508c2b53c5 (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
Diffstat (limited to 'unotools')
-rw-r--r--unotools/source/streaming/streamhelper.cxx9
-rw-r--r--unotools/source/ucbhelper/ucblockbytes.cxx6
2 files changed, 7 insertions, 8 deletions
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;