diff options
author | Michael Stahl <mstahl@redhat.com> | 2016-09-14 17:01:50 +0200 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2016-09-15 12:01:11 +0200 |
commit | b647996a9babbee7b33cf45192e57df6a124628b (patch) | |
tree | ddc6dfe8a62ec53fbacc4eeccfeb20019f3ef4f0 /basic | |
parent | a19a67e20e847a42063559694ec5beec71abcfb3 (diff) |
replace sal_Size with std::size_t (or sal_uInt64 for SvStream pos)
... except in include/rtl, include/sal, include/uno, where sal_Size is
retained for compatibility, and where callers of rtl functions pass in
pointers that are incompatible on MSVC.
Change-Id: I8344453780689f5120ba0870e44965b6d292450c
Diffstat (limited to 'basic')
-rw-r--r-- | basic/source/basmgr/basmgr.cxx | 5 | ||||
-rw-r--r-- | basic/source/runtime/iosys.cxx | 16 | ||||
-rw-r--r-- | basic/source/runtime/methods.cxx | 20 | ||||
-rw-r--r-- | basic/source/runtime/methods1.cxx | 10 | ||||
-rw-r--r-- | basic/source/sbx/sbxbase.cxx | 8 | ||||
-rw-r--r-- | basic/source/sbx/sbxobj.cxx | 8 | ||||
-rw-r--r-- | basic/source/uno/scriptcont.cxx | 6 |
7 files changed, 39 insertions, 34 deletions
diff --git a/basic/source/basmgr/basmgr.cxx b/basic/source/basmgr/basmgr.cxx index cfbcd5613f11..55ccad287424 100644 --- a/basic/source/basmgr/basmgr.cxx +++ b/basic/source/basmgr/basmgr.cxx @@ -987,7 +987,7 @@ bool BasicManager::ImpLoadLibrary( BasicLibInfo* pLibInfo, SotStorage* pCurStora bool BasicManager::ImplEncryptStream( SvStream& rStrm ) { - sal_Size nPos = rStrm.Tell(); + sal_uInt64 const nPos = rStrm.Tell(); sal_uInt32 nCreator; rStrm.ReadUInt32( nCreator ); rStrm.Seek( nPos ); @@ -1832,7 +1832,8 @@ uno::Sequence< sal_Int8 > implGetDialogData( SbxObject* pDialog ) { SvMemoryStream aMemStream; pDialog->Store( aMemStream ); - sal_Size nLen = aMemStream.Tell(); + sal_Int32 nLen = aMemStream.Tell(); + if (nLen < 0) { abort(); } uno::Sequence< sal_Int8 > aData( nLen ); sal_Int8* pDestData = aData.getArray(); const sal_Int8* pSrcData = static_cast<const sal_Int8*>(aMemStream.GetData()); diff --git a/basic/source/runtime/iosys.cxx b/basic/source/runtime/iosys.cxx index fa68d4d4f4d7..05020f6082ce 100644 --- a/basic/source/runtime/iosys.cxx +++ b/basic/source/runtime/iosys.cxx @@ -213,8 +213,8 @@ class OslStream : public SvStream public: OslStream( const OUString& rName, StreamMode nStrmMode ); virtual ~OslStream() override; - virtual sal_Size GetData( void* pData, sal_Size nSize ) override; - virtual sal_Size PutData( const void* pData, sal_Size nSize ) override; + virtual std::size_t GetData(void* pData, std::size_t nSize) override; + virtual std::size_t PutData(const void* pData, std::size_t nSize) override; virtual sal_uInt64 SeekPos( sal_uInt64 nPos ) override; virtual void FlushData() override; virtual void SetSize( sal_uInt64 nSize) override; @@ -257,14 +257,14 @@ OslStream::~OslStream() maFile.close(); } -sal_Size OslStream::GetData(void* pData, sal_Size nSize) +std::size_t OslStream::GetData(void* pData, std::size_t nSize) { sal_uInt64 nBytesRead = nSize; maFile.read( pData, nBytesRead, nBytesRead ); return nBytesRead; } -sal_Size OslStream::PutData(const void* pData, sal_Size nSize) +std::size_t OslStream::PutData(const void* pData, std::size_t nSize) { sal_uInt64 nBytesWritten; maFile.write( pData, nSize, nBytesWritten ); @@ -309,8 +309,8 @@ public: explicit UCBStream( Reference< XInputStream > & xIS ); explicit UCBStream( Reference< XStream > & xS ); virtual ~UCBStream() override; - virtual sal_Size GetData( void* pData, sal_Size nSize ) override; - virtual sal_Size PutData( const void* pData, sal_Size nSize ) override; + virtual std::size_t GetData( void* pData, std::size_t nSize ) override; + virtual std::size_t PutData( const void* pData, std::size_t nSize ) override; virtual sal_uInt64 SeekPos( sal_uInt64 nPos ) override; virtual void FlushData() override; virtual void SetSize( sal_uInt64 nSize ) override; @@ -352,7 +352,7 @@ UCBStream::~UCBStream() } } -sal_Size UCBStream::GetData(void* pData, sal_Size nSize) +std::size_t UCBStream::GetData(void* pData, std::size_t nSize) { try { @@ -383,7 +383,7 @@ sal_Size UCBStream::GetData(void* pData, sal_Size nSize) return 0; } -sal_Size UCBStream::PutData(const void* pData, sal_Size nSize) +std::size_t UCBStream::PutData(const void* pData, std::size_t nSize) { try { diff --git a/basic/source/runtime/methods.cxx b/basic/source/runtime/methods.cxx index 8671417131c0..5d0da4276806 100644 --- a/basic/source/runtime/methods.cxx +++ b/basic/source/runtime/methods.cxx @@ -905,7 +905,7 @@ RTLFUNC(InStr) (void)pBasic; (void)bWrite; - sal_Size nArgCount = rPar.Count()-1; + std::size_t nArgCount = rPar.Count()-1; if ( nArgCount < 2 ) StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT ); else @@ -978,7 +978,7 @@ RTLFUNC(InStrRev) (void)pBasic; (void)bWrite; - sal_Size nArgCount = rPar.Count()-1; + std::size_t nArgCount = rPar.Count()-1; if ( nArgCount < 2 ) { StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT ); @@ -1340,7 +1340,7 @@ RTLFUNC(Replace) (void)pBasic; (void)bWrite; - sal_Size nArgCount = rPar.Count()-1; + std::size_t nArgCount = rPar.Count()-1; if ( nArgCount < 3 || nArgCount > 6 ) { StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT ); @@ -3388,7 +3388,7 @@ RTLFUNC(Loc) return; } SvStream* pSvStrm = pSbStrm->GetStrm(); - sal_Size nPos; + std::size_t nPos; if( pSbStrm->IsRandom()) { short nBlockLen = pSbStrm->GetBlockLen(); @@ -3436,8 +3436,8 @@ RTLFUNC(Lof) return; } SvStream* pSvStrm = pSbStrm->GetStrm(); - sal_Size nOldPos = pSvStrm->Tell(); - sal_Size nLen = pSvStrm->Seek( STREAM_SEEK_TO_END ); + sal_uInt64 const nOldPos = pSvStrm->Tell(); + sal_uInt64 const nLen = pSvStrm->Seek( STREAM_SEEK_TO_END ); pSvStrm->Seek( nOldPos ); rPar.Get(0)->PutLong( (sal_Int32)nLen ); } @@ -3468,7 +3468,7 @@ RTLFUNC(Seek) if ( nArgs == 2 ) // Seek-Function { - sal_Size nPos = pStrm->Tell(); + sal_uInt64 nPos = pStrm->Tell(); if( pSbStrm->IsRandom() ) { nPos = nPos / pSbStrm->GetBlockLen(); @@ -3490,7 +3490,7 @@ RTLFUNC(Seek) { nPos *= pSbStrm->GetBlockLen(); } - pStrm->Seek( (sal_Size)nPos ); + pStrm->Seek( static_cast<sal_uInt64>(nPos) ); pSbStrm->SetExpandOnWriteTo( nPos ); } } @@ -3602,7 +3602,7 @@ RTLFUNC(Shell) (void)pBasic; (void)bWrite; - sal_Size nArgCount = rPar.Count(); + std::size_t nArgCount = rPar.Count(); if ( nArgCount < 2 || nArgCount > 5 ) { rPar.Get(0)->PutLong(0); @@ -4247,7 +4247,7 @@ RTLFUNC(StrConv) (void)pBasic; (void)bWrite; - sal_Size nArgCount = rPar.Count()-1; + std::size_t nArgCount = rPar.Count()-1; if( nArgCount < 2 || nArgCount > 3 ) { StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT ); diff --git a/basic/source/runtime/methods1.cxx b/basic/source/runtime/methods1.cxx index 93183d289e17..a60b16d1c79d 100644 --- a/basic/source/runtime/methods1.cxx +++ b/basic/source/runtime/methods1.cxx @@ -984,7 +984,7 @@ RTLFUNC(FindPropertyObject) static bool lcl_WriteSbxVariable( const SbxVariable& rVar, SvStream* pStrm, bool bBinary, short nBlockLen, bool bIsArray ) { - sal_Size nFPos = pStrm->Tell(); + sal_uInt64 const nFPos = pStrm->Tell(); bool bIsVariant = !rVar.IsFixed(); SbxDataType eType = rVar.GetType(); @@ -1091,7 +1091,7 @@ static bool lcl_ReadSbxVariable( SbxVariable& rVar, SvStream* pStrm, double aDouble; - sal_Size nFPos = pStrm->Tell(); + sal_uInt64 const nFPos = pStrm->Tell(); bool bIsVariant = !rVar.IsFixed(); SbxDataType eVarType = rVar.GetType(); @@ -1261,7 +1261,9 @@ void PutGet( SbxArray& rPar, bool bPut ) if( bHasRecordNo ) { - sal_Size nFilePos = bRandom ? (sal_Size)(nBlockLen * nRecordNo) : (sal_Size)nRecordNo; + sal_uInt64 const nFilePos = bRandom + ? static_cast<sal_uInt64>(nBlockLen * nRecordNo) + : static_cast<sal_uInt64>(nRecordNo); pStrm->Seek( nFilePos ); } @@ -1277,7 +1279,7 @@ void PutGet( SbxArray& rPar, bool bPut ) if( pArr ) { - sal_Size nFPos = pStrm->Tell(); + sal_uInt64 const nFPos = pStrm->Tell(); short nDims = pArr->GetDims(); std::unique_ptr<short[]> pDims(new short[ nDims ]); bRet = lcl_WriteReadSbxArray(*pArr,pStrm,!bRandom,nDims,pDims.get(),bPut); diff --git a/basic/source/sbx/sbxbase.cxx b/basic/source/sbx/sbxbase.cxx index d0296fcf4c5f..1204e9ff7fb5 100644 --- a/basic/source/sbx/sbxbase.cxx +++ b/basic/source/sbx/sbxbase.cxx @@ -198,7 +198,7 @@ SbxBase* SbxBase::Load( SvStream& rStrm ) if( nFlags & SbxFlagBits::Reserved ) nFlags = ( nFlags & ~SbxFlagBits::Reserved ) | SbxFlagBits::GlobalSearch; - sal_Size nOldPos = rStrm.Tell(); + sal_uInt64 nOldPos = rStrm.Tell(); rStrm.ReadUInt32( nSize ); SbxBase* p = Create( nSbxId, nCreator ); if( p ) @@ -206,7 +206,7 @@ SbxBase* SbxBase::Load( SvStream& rStrm ) p->nFlags = nFlags; if( p->LoadData( rStrm, nVer ) ) { - sal_Size nNewPos = rStrm.Tell(); + sal_uInt64 const nNewPos = rStrm.Tell(); nOldPos += nSize; DBG_ASSERT( nOldPos >= nNewPos, "SBX: Too much data loaded" ); if( nOldPos != nNewPos ) @@ -239,10 +239,10 @@ bool SbxBase::Store( SvStream& rStrm ) .WriteUInt16( GetSbxId() ) .WriteUInt16( static_cast<sal_uInt16>(GetFlags()) ) .WriteUInt16( GetVersion() ); - sal_Size nOldPos = rStrm.Tell(); + sal_uInt64 const nOldPos = rStrm.Tell(); rStrm.WriteUInt32( 0 ); bool bRes = StoreData( rStrm ); - sal_Size nNewPos = rStrm.Tell(); + sal_uInt64 const nNewPos = rStrm.Tell(); rStrm.Seek( nOldPos ); rStrm.WriteUInt32( nNewPos - nOldPos ); rStrm.Seek( nNewPos ); diff --git a/basic/source/sbx/sbxobj.cxx b/basic/source/sbx/sbxobj.cxx index d1b4ad92899d..5382b499cc18 100644 --- a/basic/source/sbx/sbxobj.cxx +++ b/basic/source/sbx/sbxobj.cxx @@ -603,9 +603,9 @@ bool SbxObject::LoadData( SvStream& rStrm, sal_uInt16 nVer ) OUString aDfltProp; aClassName = read_uInt16_lenPrefixed_uInt8s_ToOUString(rStrm, RTL_TEXTENCODING_ASCII_US); aDfltProp = read_uInt16_lenPrefixed_uInt8s_ToOUString(rStrm, RTL_TEXTENCODING_ASCII_US); - sal_Size nPos = rStrm.Tell(); + sal_uInt64 nPos = rStrm.Tell(); rStrm.ReadUInt32( nSize ); - sal_Size nNewPos = rStrm.Tell(); + sal_uInt64 const nNewPos = rStrm.Tell(); nPos += nSize; DBG_ASSERT( nPos >= nNewPos, "SBX: Loaded too much data" ); if( nPos != nNewPos ) @@ -640,9 +640,9 @@ bool SbxObject::StoreData( SvStream& rStrm ) const } write_uInt16_lenPrefixed_uInt8s_FromOUString(rStrm, aClassName, RTL_TEXTENCODING_ASCII_US); write_uInt16_lenPrefixed_uInt8s_FromOUString(rStrm, aDfltProp, RTL_TEXTENCODING_ASCII_US); - sal_Size nPos = rStrm.Tell(); + sal_uInt64 const nPos = rStrm.Tell(); rStrm.WriteUInt32( 0 ); - sal_Size nNew = rStrm.Tell(); + sal_uInt64 const nNew = rStrm.Tell(); rStrm.Seek( nPos ); rStrm.WriteUInt32( nNew - nPos ); rStrm.Seek( nNew ); diff --git a/basic/source/uno/scriptcont.cxx b/basic/source/uno/scriptcont.cxx index ff1b567b22f1..29ace2433bfd 100644 --- a/basic/source/uno/scriptcont.cxx +++ b/basic/source/uno/scriptcont.cxx @@ -634,7 +634,8 @@ bool SfxScriptLibraryContainer::implStorePasswordLibrary( SfxLibrary* pLib, cons SvMemoryStream aMemStream; /*sal_Bool bStore = */pMod->StoreBinaryData( aMemStream, B_CURVERSION ); - sal_Size nSize = aMemStream.Tell(); + sal_Int32 const nSize = aMemStream.Tell(); + if (nSize < 0) { abort(); } Sequence< sal_Int8 > aBinSeq( nSize ); sal_Int8* pData = aBinSeq.getArray(); memcpy( pData, aMemStream.GetData(), nSize ); @@ -775,7 +776,8 @@ bool SfxScriptLibraryContainer::implStorePasswordLibrary( SfxLibrary* pLib, cons SvMemoryStream aMemStream; /*sal_Bool bStore = */pMod->StoreBinaryData( aMemStream, B_CURVERSION ); - sal_Size nSize = aMemStream.Tell(); + sal_Int32 const nSize = aMemStream.Tell(); + if (nSize < 0) { abort(); } Sequence< sal_Int8 > aBinSeq( nSize ); sal_Int8* pData = aBinSeq.getArray(); memcpy( pData, aMemStream.GetData(), nSize ); |