diff options
author | Michael Stahl <mstahl@redhat.com> | 2016-06-03 14:45:59 +0200 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2016-06-06 18:09:11 +0000 |
commit | 62d270116bf34778bf581f21b27fa9cdbff7de0e (patch) | |
tree | 0402df0506ab8f6825ef497f27426f01d2e01850 | |
parent | d0bc637426060593046c8d3a4d01d0b05b052cc5 (diff) |
tools: rename SvStream::Read/Write to ReadBytes/WriteBytes
Change-Id: Ib788a30d413436aa03f813aa2fddcbc4d6cd2f9a
Reviewed-on: https://gerrit.libreoffice.org/25972
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Michael Stahl <mstahl@redhat.com>
173 files changed, 651 insertions, 651 deletions
diff --git a/avmedia/source/opengl/oglplayer.cxx b/avmedia/source/opengl/oglplayer.cxx index 883d0c2cdc81..61a980990bf1 100644 --- a/avmedia/source/opengl/oglplayer.cxx +++ b/avmedia/source/opengl/oglplayer.cxx @@ -54,7 +54,7 @@ static bool lcl_LoadFile( glTFFile* io_pFile, const OUString& rURL) const sal_Int64 nBytes = aStream.remainingSize(); char* pBuffer = new char[nBytes]; - aStream.Read( pBuffer, nBytes ); + aStream.ReadBytes(pBuffer, nBytes); aStream.Close(); io_pFile->buffer = pBuffer; diff --git a/basic/source/classes/image.cxx b/basic/source/classes/image.cxx index 4100a833ea1d..1e1feccd5b2f 100644 --- a/basic/source/classes/image.cxx +++ b/basic/source/classes/image.cxx @@ -178,7 +178,7 @@ bool SbiImage::Load( SvStream& r, sal_uInt32& nVersion ) if( bBadVer ) break; pCode = new char[ nLen ]; nCodeSize = nLen; - r.Read( pCode, nCodeSize ); + r.ReadBytes(pCode, nCodeSize); if ( bLegacy ) { ReleaseLegacyBuffer(); // release any previously held buffer @@ -231,7 +231,7 @@ bool SbiImage::Load( SvStream& r, sal_uInt32& nVersion ) nStringSize = (sal_uInt16) nLen; std::unique_ptr<char[]> pByteStrings(new char[ nLen ]); - r.Read( pByteStrings.get(), nStringSize ); + r.ReadBytes(pByteStrings.get(), nStringSize); for( short j = 0; j < nStrings; j++ ) { sal_uInt16 nOff2 = (sal_uInt16) pStringOff[ j ]; @@ -427,11 +427,11 @@ bool SbiImage::Save( SvStream& r, sal_uInt32 nVer ) aNewToLegacy.convert(); pLegacyPCode = reinterpret_cast<char*>(aNewToLegacy.GetBuffer()); nLegacyCodeSize = aNewToLegacy.GetSize(); - r.Write( pLegacyPCode, nLegacyCodeSize ); + r.WriteBytes(pLegacyPCode, nLegacyCodeSize); } else { - r.Write( pCode, nCodeSize ); + r.WriteBytes(pCode, nCodeSize); } SbiCloseRecord( r, nPos ); } @@ -456,7 +456,7 @@ bool SbiImage::Save( SvStream& r, sal_uInt32 nVer ) memcpy( pByteStrings.get() + nOff, aStr.getStr(), (aStr.getLength() + 1) * sizeof( char ) ); } r.WriteUInt32( nStringSize ); - r.Write( pByteStrings.get(), nStringSize ); + r.WriteBytes(pByteStrings.get(), nStringSize); pByteStrings.reset(); SbiCloseRecord( r, nPos ); diff --git a/basic/source/runtime/iosys.cxx b/basic/source/runtime/iosys.cxx index f08edc8d0061..b9b682358ca7 100644 --- a/basic/source/runtime/iosys.cxx +++ b/basic/source/runtime/iosys.cxx @@ -648,7 +648,7 @@ SbError SbiStream::Write( const OString& rBuf ) { return nError = ERRCODE_BASIC_BAD_RECORD_LENGTH; } - pStrm->Write(rBuf.getStr(), nLen); + pStrm->WriteBytes(rBuf.getStr(), nLen); MapError(); } return nError; diff --git a/connectivity/source/drivers/dbase/DIndex.cxx b/connectivity/source/drivers/dbase/DIndex.cxx index 423fd3a358bd..cb8d8a0831f5 100644 --- a/connectivity/source/drivers/dbase/DIndex.cxx +++ b/connectivity/source/drivers/dbase/DIndex.cxx @@ -357,14 +357,14 @@ void connectivity::dbase::ReadHeader( #endif rStream.ReadUInt32(rHeader.db_rootpage); rStream.ReadUInt32(rHeader.db_pagecount); - rStream.Read(&rHeader.db_frei, 4); + rStream.ReadBytes(&rHeader.db_frei, 4); rStream.ReadUInt16(rHeader.db_keylen); rStream.ReadUInt16(rHeader.db_maxkeys); rStream.ReadUInt16(rHeader.db_keytype); rStream.ReadUInt16(rHeader.db_keyrec); - rStream.Read(&rHeader.db_frei1, 3); + rStream.ReadBytes(&rHeader.db_frei1, 3); rStream.ReadUChar(rHeader.db_unique); - rStream.Read(&rHeader.db_name, 488); + rStream.ReadBytes(&rHeader.db_name, 488); assert(rStream.GetError() || rStream.Tell() == nOldPos + DINDEX_PAGE_SIZE); } @@ -383,14 +383,14 @@ SvStream& connectivity::dbase::WriteODbaseIndex(SvStream &rStream, ODbaseIndex& rStream.Seek(0); rStream.WriteUInt32(rIndex.m_aHeader.db_rootpage); rStream.WriteUInt32(rIndex.m_aHeader.db_pagecount); - rStream.Write(&rIndex.m_aHeader.db_frei, 4); + rStream.WriteBytes(&rIndex.m_aHeader.db_frei, 4); rStream.WriteUInt16(rIndex.m_aHeader.db_keylen); rStream.WriteUInt16(rIndex.m_aHeader.db_maxkeys); rStream.WriteUInt16(rIndex.m_aHeader.db_keytype); rStream.WriteUInt16(rIndex.m_aHeader.db_keyrec); - rStream.Write(&rIndex.m_aHeader.db_frei1, 3); + rStream.WriteBytes(&rIndex.m_aHeader.db_frei1, 3); rStream.WriteUChar(rIndex.m_aHeader.db_unique); - rStream.Write(&rIndex.m_aHeader.db_name, 488); + rStream.WriteBytes(&rIndex.m_aHeader.db_name, 488); assert(rStream.GetError() || rStream.Tell() == DINDEX_PAGE_SIZE); SAL_WARN_IF(rStream.GetError(), "connectivity.dbase", "write error"); return rStream; diff --git a/connectivity/source/drivers/dbase/DTable.cxx b/connectivity/source/drivers/dbase/DTable.cxx index 7dce6fe9beb1..52215a4eef80 100644 --- a/connectivity/source/drivers/dbase/DTable.cxx +++ b/connectivity/source/drivers/dbase/DTable.cxx @@ -201,7 +201,7 @@ void ODbaseTable::readHeader() if(ERRCODE_NONE != m_pFileStream->GetErrorCode()) throwInvalidDbaseFormat(); - m_pFileStream->Read(m_aHeader.db_aedat, 3*sizeof(sal_uInt8)); + m_pFileStream->ReadBytes(m_aHeader.db_aedat, 3); if(ERRCODE_NONE != m_pFileStream->GetErrorCode()) throwInvalidDbaseFormat(); (*m_pFileStream).ReadUInt32( m_aHeader.db_anz ); @@ -215,7 +215,7 @@ void ODbaseTable::readHeader() throwInvalidDbaseFormat(); if (m_aHeader.db_slng == 0) throwInvalidDbaseFormat(); - m_pFileStream->Read(m_aHeader.db_frei, 20*sizeof(sal_uInt8)); + m_pFileStream->ReadBytes(m_aHeader.db_frei, 20); if(ERRCODE_NONE != m_pFileStream->GetErrorCode()) throwInvalidDbaseFormat(); @@ -326,12 +326,12 @@ void ODbaseTable::fillColumns() #if !defined(NDEBUG) sal_uInt64 const nOldPos(m_pFileStream->Tell()); #endif - m_pFileStream->Read(aDBFColumn.db_fnm, 11); + m_pFileStream->ReadBytes(aDBFColumn.db_fnm, 11); m_pFileStream->ReadUChar(aDBFColumn.db_typ); m_pFileStream->ReadUInt32(aDBFColumn.db_adr); m_pFileStream->ReadUChar(aDBFColumn.db_flng); m_pFileStream->ReadUChar(aDBFColumn.db_dez); - m_pFileStream->Read(aDBFColumn.db_frei2, 14); + m_pFileStream->ReadBytes(aDBFColumn.db_frei2, 14); assert(m_pFileStream->GetError() || m_pFileStream->Tell() == nOldPos + sizeof(aDBFColumn)); if (m_pFileStream->GetError()) { @@ -593,7 +593,7 @@ bool ODbaseTable::ReadMemoHeader() // There are files using size specification, though they are dBase-files char sHeader[4]; m_pMemoStream->Seek(m_aMemoHeader.db_size); - m_pMemoStream->Read(sHeader,4); + m_pMemoStream->ReadBytes(sHeader, 4); if ((m_pMemoStream->GetErrorCode() != ERRCODE_NONE) || ((sal_uInt8)sHeader[0]) != 0xFF || ((sal_uInt8)sHeader[1]) != 0xFF || ((sal_uInt8)sHeader[2]) != 0x08) m_aMemoHeader.db_typ = MemodBaseIII; @@ -1227,7 +1227,7 @@ bool ODbaseTable::CreateFile(const INetURLObject& aFile, bool& bCreateMemo) (*m_pFileStream).WriteUInt16( (m_pColumns->getCount()+1) * 32 + 1 ); // header information, // pColumns contains always an additional column (*m_pFileStream).WriteUInt16( 0 ); // record length will be determined later - m_pFileStream->Write(aBuffer, 20); + m_pFileStream->WriteBytes(aBuffer, 20); sal_uInt16 nRecLength = 1; // Length 1 for deleted flag sal_Int32 nMaxFieldLength = m_pConnection->getMetaData()->getMaxColumnNameLength(); @@ -1255,7 +1255,7 @@ bool ODbaseTable::CreateFile(const INetURLObject& aFile, bool& bCreateMemo) } (*m_pFileStream).WriteCharPtr( aCol.getStr() ); - m_pFileStream->Write(aBuffer, 11 - aCol.getLength()); + m_pFileStream->WriteBytes(aBuffer, 11 - aCol.getLength()); sal_Int32 nPrecision = 0; xCol->getPropertyValue(sPropPrec) >>= nPrecision; @@ -1312,7 +1312,7 @@ bool ODbaseTable::CreateFile(const INetURLObject& aFile, bool& bCreateMemo) if ( nDbaseType == VisualFoxPro ) (*m_pFileStream).WriteUInt32( nRecLength-1 ); else - m_pFileStream->Write(aBuffer, 4); + m_pFileStream->WriteBytes(aBuffer, 4); switch(cTyp) { @@ -1378,7 +1378,7 @@ bool ODbaseTable::CreateFile(const INetURLObject& aFile, bool& bCreateMemo) default: throwInvalidColumnType(STR_INVALID_COLUMN_TYPE, aName); } - m_pFileStream->Write(aBuffer, 14); + m_pFileStream->WriteBytes(aBuffer, 14); aBuffer[0] = 0x00; } @@ -1564,7 +1564,7 @@ bool ODbaseTable::UpdateRow(OValueRefVector& rRow, OValueRefRow& pOrgRow, const // position on desired record: sal_Size nPos = m_aHeader.db_kopf + (long)(m_nFilePos-1) * m_aHeader.db_slng; m_pFileStream->Seek(nPos); - m_pFileStream->Read(m_pBuffer, m_aHeader.db_slng); + m_pFileStream->ReadBytes(m_pBuffer, m_aHeader.db_slng); sal_Size nMemoFileSize( 0 ); if (HasMemoFields() && m_pMemoStream) @@ -2049,7 +2049,7 @@ bool ODbaseTable::WriteMemo(const ORowSetValue& aVariable, sal_Size& rBlockNr) char sHeader[4]; m_pMemoStream->Seek(rBlockNr * m_aMemoHeader.db_size); m_pMemoStream->SeekRel(4L); - m_pMemoStream->Read(sHeader,4); + m_pMemoStream->ReadBytes(sHeader, 4); sal_Size nOldSize; if (m_aMemoHeader.db_typ == MemoFoxPro) @@ -2091,7 +2091,7 @@ bool ODbaseTable::WriteMemo(const ORowSetValue& aVariable, sal_Size& rBlockNr) { const char cEOF = (char) DBF_EOL; nSize++; - m_pMemoStream->Write( aStr.getStr(), aStr.getLength() ); + m_pMemoStream->WriteBytes(aStr.getStr(), aStr.getLength()); (*m_pMemoStream).WriteChar( cEOF ).WriteChar( cEOF ); } break; case MemoFoxPro: @@ -2124,11 +2124,11 @@ bool ODbaseTable::WriteMemo(const ORowSetValue& aVariable, sal_Size& rBlockNr) nHeader[i++] = (sal_uInt8) (nWriteSize % 256); } - m_pMemoStream->Write(nHeader,4); + m_pMemoStream->WriteBytes(nHeader, 4); if ( bBinary ) - m_pMemoStream->Write( aValue.getConstArray(), aValue.getLength() ); + m_pMemoStream->WriteBytes(aValue.getConstArray(), aValue.getLength()); else - m_pMemoStream->Write( aStr.getStr(), aStr.getLength() ); + m_pMemoStream->WriteBytes(aStr.getStr(), aStr.getLength()); m_pMemoStream->Flush(); } } @@ -2638,7 +2638,7 @@ bool ODbaseTable::seekRow(IResultSetHelper::Movement eCursorPosition, sal_Int32 if (m_pFileStream->GetError() != ERRCODE_NONE) goto Error; - sal_Size nRead = m_pFileStream->Read(m_pBuffer, nEntryLen); + sal_Size nRead = m_pFileStream->ReadBytes(m_pBuffer, nEntryLen); if (nRead != nEntryLen) { SAL_WARN("connectivity.drivers", "ODbaseTable::seekRow: short read!"); @@ -2690,7 +2690,7 @@ bool ODbaseTable::ReadMemo(sal_Size nBlockNo, ORowSetValue& aVariable) do { - m_pMemoStream->Read(&aBuf,512); + m_pMemoStream->ReadBytes(&aBuf, 512); sal_uInt16 i = 0; while (aBuf[i] != cEOF && ++i < 512) @@ -2711,7 +2711,7 @@ bool ODbaseTable::ReadMemo(sal_Size nBlockNo, ORowSetValue& aVariable) { bool bIsText = true; char sHeader[4]; - m_pMemoStream->Read(sHeader,4); + m_pMemoStream->ReadBytes(sHeader, 4); // Foxpro stores text and binary data if (m_aMemoHeader.db_typ == MemoFoxPro) { @@ -2741,7 +2741,7 @@ bool ODbaseTable::ReadMemo(sal_Size nBlockNo, ORowSetValue& aVariable) else { css::uno::Sequence< sal_Int8 > aData(nLength); - m_pMemoStream->Read(aData.getArray(),nLength); + m_pMemoStream->ReadBytes(aData.getArray(), nLength); aVariable = aData; } } // if ( nLength ) @@ -2778,7 +2778,7 @@ bool ODbaseTable::WriteBuffer() // position on desired record: sal_Size nPos = m_aHeader.db_kopf + (long)(m_nFilePos-1) * m_aHeader.db_slng; m_pFileStream->Seek(nPos); - return m_pFileStream->Write(m_pBuffer, m_aHeader.db_slng) > 0; + return m_pFileStream->WriteBytes(m_pBuffer, m_aHeader.db_slng) > 0; } sal_Int32 ODbaseTable::getCurrentLastPos() const diff --git a/connectivity/source/drivers/dbase/dindexnode.cxx b/connectivity/source/drivers/dbase/dindexnode.cxx index f50567d18472..3451cb9f8e18 100644 --- a/connectivity/source/drivers/dbase/dindexnode.cxx +++ b/connectivity/source/drivers/dbase/dindexnode.cxx @@ -707,7 +707,7 @@ void ONDXNode::Write(SvStream &rStream, const ONDXPage& rPage) const { sal_uInt8 buf[sizeof(double)]; memset(&buf[0], 0, sizeof(double)); - rStream.Write(&buf[0], sizeof(double)); + rStream.WriteBytes(&buf[0], sizeof(double)); } else rStream.WriteDouble( (double) aKey.getValue() ); @@ -724,7 +724,7 @@ void ONDXNode::Write(SvStream &rStream, const ONDXPage& rPage) const strncpy(reinterpret_cast<char *>(&pBuf[0]), aText.getStr(), std::min<size_t>(nLen, aText.getLength())); } - rStream.Write(&pBuf[0], nLen); + rStream.WriteBytes(&pBuf[0], nLen); } WriteONDXPagePtr( rStream, aChild ); } @@ -871,7 +871,7 @@ SvStream& connectivity::dbase::WriteONDXPage(SvStream &rStream, const ONDXPage& char aEmptyData[DINDEX_PAGE_SIZE]; memset(aEmptyData,0x00,DINDEX_PAGE_SIZE); - rStream.Write(aEmptyData, DINDEX_PAGE_SIZE); + rStream.WriteBytes(aEmptyData, DINDEX_PAGE_SIZE); } rStream.Seek(rPage.GetPagePos() * DINDEX_PAGE_SIZE); @@ -893,7 +893,7 @@ SvStream& connectivity::dbase::WriteONDXPage(SvStream &rStream, const ONDXPage& { std::unique_ptr<char[]> pEmptyData( new char[nRemainSize] ); memset(pEmptyData.get(), 0x00, nRemainSize); - rStream.Write(pEmptyData.get(), nRemainSize); + rStream.WriteBytes(pEmptyData.get(), nRemainSize); rStream.Seek(nTell); } } diff --git a/cppcanvas/source/mtfrenderer/emfplus.cxx b/cppcanvas/source/mtfrenderer/emfplus.cxx index 0b31a3a96a87..bc82c84c0609 100644 --- a/cppcanvas/source/mtfrenderer/emfplus.cxx +++ b/cppcanvas/source/mtfrenderer/emfplus.cxx @@ -1848,7 +1848,7 @@ namespace cppcanvas OSL_ENSURE(dataSize >= 4, "No room for TotalObjectSize in EmfPlusContinuedObjectRecord"); // 1st 4 bytes are TotalObjectSize - mMStream.Write (static_cast<const char *>(rMF.GetData()) + rMF.Tell() + 4, dataSize - 4); + mMStream.WriteBytes(static_cast<const char *>(rMF.GetData()) + rMF.Tell() + 4, dataSize - 4); SAL_INFO("cppcanvas.emf", "EMF+ read next object part size: " << size << " type: " << type << " flags: " << flags << " data size: " << dataSize); } else { if (mbMultipart) { diff --git a/desktop/source/migration/services/wordbookmigration.cxx b/desktop/source/migration/services/wordbookmigration.cxx index fa84fe35f36d..77b2ee68df42 100644 --- a/desktop/source/migration/services/wordbookmigration.cxx +++ b/desktop/source/migration/services/wordbookmigration.cxx @@ -123,7 +123,7 @@ bool IsUserWordbook( const OUString& rFile ) static sal_Size nVerOOo7Len = sal::static_int_cast< sal_Size >(strlen( pVerOOo7 )); sal_Char pMagicHeader[MAX_HEADER_LENGTH]; pMagicHeader[ nVerOOo7Len ] = '\0'; - if ((pStream->Read(static_cast<void *>(pMagicHeader), nVerOOo7Len) == nVerOOo7Len)) + if ((pStream->ReadBytes(static_cast<void *>(pMagicHeader), nVerOOo7Len) == nVerOOo7Len)) { if ( !strcmp(pMagicHeader, pVerOOo7) ) bRet = true; @@ -134,7 +134,7 @@ bool IsUserWordbook( const OUString& rFile ) pStream->ReadUInt16( nLen ); if ( nLen < MAX_HEADER_LENGTH ) { - pStream->Read(pMagicHeader, nLen); + pStream->ReadBytes(pMagicHeader, nLen); pMagicHeader[nLen] = '\0'; if ( !strcmp(pMagicHeader, "WBSWG2") || !strcmp(pMagicHeader, "WBSWG5") diff --git a/editeng/source/editeng/editobj.cxx b/editeng/source/editeng/editobj.cxx index 06ac06998e75..1ae6ff31fabc 100644 --- a/editeng/source/editeng/editobj.cxx +++ b/editeng/source/editeng/editobj.cxx @@ -1221,14 +1221,15 @@ void EditTextObjectImpl::StoreData( SvStream& rOStream ) const const ContentInfo& rC = *aContents[nPara].get(); sal_uInt16 nL = rC.GetText().getLength(); rOStream.WriteUInt16( nL ); - rOStream.Write(rC.GetText().getStr(), nL*sizeof(sal_Unicode)); + // FIXME this isn't endian safe, but presumably this is just used for copy/paste? + rOStream.WriteBytes(rC.GetText().getStr(), nL*sizeof(sal_Unicode)); // StyleSheetName must be Unicode too! // Copy/Paste from EA3 to BETA or from BETA to EA3 not possible, not needed... // If needed, change nL back to sal_uLong and increase version... nL = rC.GetStyle().getLength(); rOStream.WriteUInt16( nL ); - rOStream.Write(rC.GetStyle().getStr(), nL*sizeof(sal_Unicode)); + rOStream.WriteBytes(rC.GetStyle().getStr(), nL*sizeof(sal_Unicode)); } } } @@ -1495,7 +1496,8 @@ void EditTextObjectImpl::CreateData( SvStream& rIStream ) } rtl_uString *pStr = rtl_uString_alloc(nL); - rIStream.Read(pStr->buffer, nL*sizeof(sal_Unicode)); + // FIXME this isn't endian safe, but presumably this is just used for copy/paste? + rIStream.ReadBytes(pStr->buffer, nL*sizeof(sal_Unicode)); rC.SetText((OUString(pStr, SAL_NO_ACQUIRE))); nL = 0; @@ -1514,7 +1516,7 @@ void EditTextObjectImpl::CreateData( SvStream& rIStream ) } rtl_uString *pStr = rtl_uString_alloc(nL); - rIStream.Read(pStr->buffer, nL*sizeof(sal_Unicode) ); + rIStream.ReadBytes(pStr->buffer, nL*sizeof(sal_Unicode) ); rC.GetStyle() = OUString(pStr, SAL_NO_ACQUIRE); } } diff --git a/editeng/source/items/flditem.cxx b/editeng/source/items/flditem.cxx index 121dcf8625b0..4f2c03e4b23e 100644 --- a/editeng/source/items/flditem.cxx +++ b/editeng/source/items/flditem.cxx @@ -529,7 +529,7 @@ static void write_unicode( SvPersistStream & rStm, const OUString& rString ) sal_uInt16 nL = sal::static_int_cast<sal_uInt16>(rString.getLength()); rStm.WriteUInt16( nL ); //endian specific?, yipes! - rStm.Write( rString.getStr(), nL*sizeof(sal_Unicode) ); + rStm.WriteBytes( rString.getStr(), nL*sizeof(sal_Unicode) ); } static OUString read_unicode( SvPersistStream & rStm ) @@ -548,7 +548,7 @@ static OUString read_unicode( SvPersistStream & rStm ) { pStr = rtl_uString_alloc(nL); //endian specific?, yipes! - rStm.Read(pStr->buffer, nL*sizeof(sal_Unicode)); + rStm.ReadBytes(pStr->buffer, nL*sizeof(sal_Unicode)); } //take ownership of buffer and return, otherwise return empty string return pStr ? OUString(pStr, SAL_NO_ACQUIRE) : OUString(); diff --git a/extensions/source/scanner/sane.cxx b/extensions/source/scanner/sane.cxx index f1bff60c0552..99195750eaef 100644 --- a/extensions/source/scanner/sane.cxx +++ b/extensions/source/scanner/sane.cxx @@ -793,7 +793,7 @@ bool Sane::Start( BitmapTransporter& rBitmap ) SAL_WARN( "extensions.scanner", "short read, padding with zeros" ); memset(pBuffer + items_read, 0, aParams.bytes_per_line - items_read); } - aConverter.Write( pBuffer, aParams.bytes_per_line ); + aConverter.WriteBytes(pBuffer, aParams.bytes_per_line); } else if( eType == FrameStyle_Gray ) { diff --git a/extensions/source/scanner/scanunx.cxx b/extensions/source/scanner/scanunx.cxx index b92fb5539677..268ab107e91f 100644 --- a/extensions/source/scanner/scanunx.cxx +++ b/extensions/source/scanner/scanunx.cxx @@ -70,7 +70,7 @@ Sequence< sal_Int8 > BitmapTransporter::getDIB() throw(std::exception) m_aStream.Seek( 0 ); Sequence< sal_Int8 > aValue( nBytes ); - m_aStream.Read( aValue.getArray(), nBytes ); + m_aStream.ReadBytes( aValue.getArray(), nBytes ); m_aStream.Seek( nPreviousPos ); return aValue; diff --git a/filter/source/flash/swfwriter.cxx b/filter/source/flash/swfwriter.cxx index 7e58b2174cfe..b91c0f363c86 100644 --- a/filter/source/flash/swfwriter.cxx +++ b/filter/source/flash/swfwriter.cxx @@ -120,7 +120,7 @@ void ImplCopySvStreamToXOutputStream( SvStream& rIn, Reference< XOutputStream > aBuffer.realloc( nSize ); } - sal_uInt32 nRead = rIn.Read( aBuffer.getArray(), nBufferSize ); + sal_uInt32 nRead = rIn.ReadBytes(aBuffer.getArray(), nBufferSize); DBG_ASSERT( nRead == nBufferSize, "ImplCopySvStreamToXOutputStream failed!" ); xOut->writeBytes( aBuffer ); diff --git a/filter/source/flash/swfwriter1.cxx b/filter/source/flash/swfwriter1.cxx index 09246d6cc578..64c234b958bf 100644 --- a/filter/source/flash/swfwriter1.cxx +++ b/filter/source/flash/swfwriter1.cxx @@ -963,7 +963,7 @@ void Writer::Impl_writeBmp( sal_uInt16 nBitmapId, sal_uInt32 width, sal_uInt32 h mpTag->addUI16( uInt16_(width) ); mpTag->addUI16( uInt16_(height) ); - mpTag->Write( pCompressed, compressed_size ); + mpTag->WriteBytes(pCompressed, compressed_size); endTag(); } @@ -1030,8 +1030,8 @@ void Writer::Impl_writeJPEG(sal_uInt16 nBitmapId, const sal_uInt8* pJpgData, sal { case 0xD8: case 0xD9: - EncodingTableStream.Write( pJpgSearch, nLength ); - ImageBitsStream.Write( pJpgSearch, nLength ); + EncodingTableStream.WriteBytes(pJpgSearch, nLength); + ImageBitsStream.WriteBytes(pJpgSearch, nLength); break; case 0x01: @@ -1039,7 +1039,7 @@ void Writer::Impl_writeJPEG(sal_uInt16 nBitmapId, const sal_uInt8* pJpgData, sal case 0xDC: case 0xDD: case 0xC4: - EncodingTableStream.Write( pJpgSearch, nLength ); + EncodingTableStream.WriteBytes(pJpgSearch, nLength); break; case 0xC0: @@ -1058,7 +1058,7 @@ void Writer::Impl_writeJPEG(sal_uInt16 nBitmapId, const sal_uInt8* pJpgData, sal case 0xCF: case 0xDA: case 0xE0: - ImageBitsStream.Write( pJpgSearch, nLength ); + ImageBitsStream.WriteBytes(pJpgSearch, nLength); break; default: @@ -1084,10 +1084,10 @@ void Writer::Impl_writeJPEG(sal_uInt16 nBitmapId, const sal_uInt8* pJpgData, sal mpTag->addUI32( nEncodingTableSize + nImageBitsSize ); - mpTag->Write(EncodingTableStream.GetData(), nEncodingTableSize); - mpTag->Write(ImageBitsStream.GetData(), nImageBitsSize); + mpTag->WriteBytes(EncodingTableStream.GetData(), nEncodingTableSize); + mpTag->WriteBytes(ImageBitsStream.GetData(), nImageBitsSize); - mpTag->Write( pAlphaCompressed, alpha_compressed_size ); + mpTag->WriteBytes(pAlphaCompressed, alpha_compressed_size); endTag(); } @@ -1097,8 +1097,8 @@ void Writer::Impl_writeJPEG(sal_uInt16 nBitmapId, const sal_uInt8* pJpgData, sal mpTag->addUI16( nBitmapId ); - mpTag->Write(EncodingTableStream.GetData(), nEncodingTableSize); - mpTag->Write(ImageBitsStream.GetData(), nImageBitsSize); + mpTag->WriteBytes(EncodingTableStream.GetData(), nEncodingTableSize); + mpTag->WriteBytes(ImageBitsStream.GetData(), nImageBitsSize); endTag(); } diff --git a/filter/source/flash/swfwriter2.cxx b/filter/source/flash/swfwriter2.cxx index 4d6683eff79c..2b2e8c1d39e0 100644 --- a/filter/source/flash/swfwriter2.cxx +++ b/filter/source/flash/swfwriter2.cxx @@ -159,7 +159,7 @@ void Tag::write( SvStream &out ) } } - out.Write( GetData(), nSz ); + out.WriteBytes( GetData(), nSz ); } #if 0 diff --git a/filter/source/graphicfilter/egif/egif.cxx b/filter/source/graphicfilter/egif/egif.cxx index 8e26156e0f24..5955b8f1035f 100644 --- a/filter/source/graphicfilter/egif/egif.cxx +++ b/filter/source/graphicfilter/egif/egif.cxx @@ -286,7 +286,7 @@ void GIFWriter::WriteSignature( bool bGIF89a ) { if( bStatus ) { - m_rGIF.Write( bGIF89a ? "GIF89a" : "GIF87a" , 6 ); + m_rGIF.WriteBytes(bGIF89a ? "GIF89a" : "GIF87a" , 6); if( m_rGIF.GetError() ) bStatus = false; @@ -345,7 +345,7 @@ void GIFWriter::WriteLoopExtension( const Animation& rAnimation ) m_rGIF.WriteUChar( 0x21 ); m_rGIF.WriteUChar( 0xff ); m_rGIF.WriteUChar( 0x0b ); - m_rGIF.Write( "NETSCAPE2.0", 11 ); + m_rGIF.WriteBytes( "NETSCAPE2.0", 11 ); m_rGIF.WriteUChar( 0x03 ); m_rGIF.WriteUChar( 0x01 ); m_rGIF.WriteUChar( cLoByte ); @@ -363,7 +363,7 @@ void GIFWriter::WriteLogSizeExtension( const Size& rSize100 ) m_rGIF.WriteUChar( 0x21 ); m_rGIF.WriteUChar( 0xff ); m_rGIF.WriteUChar( 0x0b ); - m_rGIF.Write( "STARDIV 5.0", 11 ); + m_rGIF.WriteBytes( "STARDIV 5.0", 11 ); m_rGIF.WriteUChar( 0x09 ); m_rGIF.WriteUChar( 0x01 ); m_rGIF.WriteUInt32( rSize100.Width() ); diff --git a/filter/source/graphicfilter/egif/giflzwc.cxx b/filter/source/graphicfilter/egif/giflzwc.cxx index 7f5709a5ad62..3c2a62f46c26 100644 --- a/filter/source/graphicfilter/egif/giflzwc.cxx +++ b/filter/source/graphicfilter/egif/giflzwc.cxx @@ -94,7 +94,7 @@ void GIFImageDataOutputStream::FlushBlockBuf() if( nBlockBufSize ) { rStream.WriteUChar( nBlockBufSize ); - rStream.Write( pBlockBuf,nBlockBufSize ); + rStream.WriteBytes(pBlockBuf, nBlockBufSize); nBlockBufSize = 0; } } diff --git a/filter/source/graphicfilter/eps/eps.cxx b/filter/source/graphicfilter/eps/eps.cxx index c22e4695cf54..14a3c878ac22 100644 --- a/filter/source/graphicfilter/eps/eps.cxx +++ b/filter/source/graphicfilter/eps/eps.cxx @@ -1173,7 +1173,7 @@ void PSWriter::ImplWriteActions( const GDIMetaFile& rMtf, VirtualDevice& rVDev ) ImplWriteLine( "gs" ); ImplGetMapMode( aMapMode ); ImplWriteLine( "%%BeginDocument:" ); - mpPS->Write( pSource, aGfxLink.GetDataSize() ); + mpPS->WriteBytes(pSource, aGfxLink.GetDataSize()); ImplWriteLine( "%%EndDocument\ngr" ); } } diff --git a/filter/source/graphicfilter/icgm/cgm.cxx b/filter/source/graphicfilter/icgm/cgm.cxx index 30804b06845f..00d3ceca3567 100644 --- a/filter/source/graphicfilter/icgm/cgm.cxx +++ b/filter/source/graphicfilter/icgm/cgm.cxx @@ -675,7 +675,7 @@ bool CGM::Write( SvStream& rIStm ) mnParaSize = 0; mpSource = mpBuf; - if (rIStm.Read(mpSource, 2) != 2) + if (rIStm.ReadBytes(mpSource, 2) != 2) return false; mpEndValidSource = mpSource + 2; mnEscape = ImplGetUI16(); @@ -685,7 +685,7 @@ bool CGM::Write( SvStream& rIStm ) if ( mnElementSize == 31 ) { - if (rIStm.Read(mpSource + mnParaSize, 2) != 2) + if (rIStm.ReadBytes(mpSource + mnParaSize, 2) != 2) return false; mpEndValidSource = mpSource + mnParaSize + 2; mnElementSize = ImplGetUI16(); @@ -693,7 +693,7 @@ bool CGM::Write( SvStream& rIStm ) mnParaSize = 0; if (mnElementSize) { - if (rIStm.Read(mpSource, mnElementSize) != mnElementSize) + if (rIStm.ReadBytes(mpSource, mnElementSize) != mnElementSize) return false; mpEndValidSource = mpSource + mnElementSize; } diff --git a/filter/source/graphicfilter/idxf/dxfgrprd.cxx b/filter/source/graphicfilter/idxf/dxfgrprd.cxx index ac1ca2d994fc..44672ed5e29e 100644 --- a/filter/source/graphicfilter/idxf/dxfgrprd.cxx +++ b/filter/source/graphicfilter/idxf/dxfgrprd.cxx @@ -39,7 +39,7 @@ OString DXFReadLine(SvStream& rIStm) while( !bEnd && !rIStm.GetError() ) // !!! do not check for EOF // !!! because we read blockwise { - sal_uInt16 nLen = (sal_uInt16)rIStm.Read( buf, sizeof(buf)-1 ); + sal_uInt16 nLen = static_cast<sal_uInt16>(rIStm.ReadBytes(buf, sizeof(buf)-1)); if( !nLen ) { if( aBuf.isEmpty() ) @@ -76,7 +76,7 @@ OString DXFReadLine(SvStream& rIStm) if( bEnd && (c=='\r' || c=='\n')) // special treatment of DOS files { char cTemp(0); - rIStm.Read(&cTemp, 1); + rIStm.ReadBytes(&cTemp, 1); if( cTemp == c || (cTemp != '\n' && cTemp != '\r') ) rIStm.Seek( nOldFilePos ); } @@ -89,7 +89,7 @@ void DXFSkipLine(SvStream& rIStm) while (rIStm.good()) { char buf[256 + 1]; - sal_uInt16 nLen = (sal_uInt16)rIStm.Read(buf, sizeof(buf) - 1); + sal_uInt16 nLen = static_cast<sal_uInt16>(rIStm.ReadBytes(buf, sizeof(buf) - 1)); for (sal_uInt16 n = 0; n < nLen; n++) { char c = buf[n]; @@ -97,7 +97,7 @@ void DXFSkipLine(SvStream& rIStm) { rIStm.SeekRel(n-nLen+1); // return stream to next to current position char c1 = 0; - rIStm.Read(&c1, 1); + rIStm.ReadBytes(&c1, 1); if (c1 == c || (c1 != '\n' && c1!= '\r')) rIStm.SeekRel(-1); return; diff --git a/filter/source/graphicfilter/ieps/ieps.cxx b/filter/source/graphicfilter/ieps/ieps.cxx index 82d397e54166..d6ba321bfaad 100644 --- a/filter/source/graphicfilter/ieps/ieps.cxx +++ b/filter/source/graphicfilter/ieps/ieps.cxx @@ -203,7 +203,7 @@ static bool RenderAsEMF(const sal_uInt8* pBuf, sal_uInt32 nBytesRead, Graphic &r osl::FileBase::getSystemPathFromFileURL(aTempInput.GetURL(), input); SvStream* pInputStream = aTempInput.GetStream(StreamMode::WRITE); - sal_uInt64 nCount = pInputStream->Write(pBuf, nBytesRead); + sal_uInt64 nCount = pInputStream->WriteBytes(pBuf, nBytesRead); aTempInput.CloseStream(); //fdo#64161 pstoedit under non-windows uses libEMF to output the EMF, but @@ -316,7 +316,7 @@ static bool RenderAsBMPThroughHelper(const sal_uInt8* pBuf, sal_uInt32 nBytesRea oslFileError eFileErr = osl_readFile(pOut, aBuf, 32000, &nCount); while (eFileErr == osl_File_E_None && nCount) { - aMemStm.Write(aBuf, sal::static_int_cast< sal_Size >(nCount)); + aMemStm.WriteBytes(aBuf, sal::static_int_cast< sal_Size >(nCount)); eFileErr = osl_readFile(pOut, aBuf, 32000, &nCount); } @@ -420,15 +420,15 @@ void CreateMtfReplacementAction( GDIMetaFile& rMtf, SvStream& rStrm, sal_uInt32 { std::unique_ptr<sal_uInt8[]> pBuf(new sal_uInt8[ nSizeWMF ]); rStrm.Seek( nOrigPos + nPosWMF ); - rStrm.Read( pBuf.get(), nSizeWMF ); - aReplacement.Write( pBuf.get(), nSizeWMF ); + rStrm.ReadBytes(pBuf.get(), nSizeWMF); + aReplacement.WriteBytes(pBuf.get(), nSizeWMF); } if ( nSizeTIFF ) { std::unique_ptr<sal_uInt8[]> pBuf(new sal_uInt8[ nSizeTIFF ]); rStrm.Seek( nOrigPos + nPosTIFF ); - rStrm.Read( pBuf.get(), nSizeTIFF ); - aReplacement.Write( pBuf.get(), nSizeTIFF ); + rStrm.ReadBytes(pBuf.get(), nSizeTIFF); + aReplacement.WriteBytes(pBuf.get(), nSizeTIFF); } rMtf.AddAction( static_cast<MetaAction*>( new MetaCommentAction( aComment, 0, static_cast<const sal_uInt8*>(aReplacement.GetData()), aReplacement.Tell() ) ) ); } @@ -581,7 +581,7 @@ ipsGraphicImport( SvStream & rStream, Graphic & rGraphic, FilterConfigItem* ) } std::unique_ptr<sal_uInt8[]> pHeader( new sal_uInt8[ 22 ] ); rStream.Seek( nPSStreamPos ); - rStream.Read( pHeader.get(), 22 ); // check PostScript header + rStream.ReadBytes(pHeader.get(), 22); // check PostScript header if ( ImplSearchEntry( pHeader.get(), reinterpret_cast<sal_uInt8 const *>("%!PS-Adobe"), 10, 10 ) && ImplSearchEntry( &pHeader[ 15 ], reinterpret_cast<sal_uInt8 const *>("EPS"), 3, 3 ) ) { @@ -589,7 +589,7 @@ ipsGraphicImport( SvStream & rStream, Graphic & rGraphic, FilterConfigItem* ) std::unique_ptr<sal_uInt8[]> pBuf( new sal_uInt8[ nPSSize ] ); sal_uInt32 nBufStartPos = rStream.Tell(); - sal_uInt32 nBytesRead = rStream.Read( pBuf.get(), nPSSize ); + sal_uInt32 nBytesRead = rStream.ReadBytes(pBuf.get(), nPSSize); if ( nBytesRead == nPSSize ) { sal_uInt32 nSecurityCount = 32; diff --git a/filter/source/graphicfilter/ios2met/ios2met.cxx b/filter/source/graphicfilter/ios2met/ios2met.cxx index 253a5c8144ba..f97bd23b25b2 100644 --- a/filter/source/graphicfilter/ios2met/ios2met.cxx +++ b/filter/source/graphicfilter/ios2met/ios2met.cxx @@ -2260,7 +2260,7 @@ void OS2METReader::ReadImageData(sal_uInt16 nDataID, sal_uInt16 nDataLen) // OK, now the map data is being pushed. Unfortunately OS2 and BMP // do have a different RGB ordering when using 24-bit std::unique_ptr<sal_uInt8[]> pBuf(new sal_uInt8[nDataLen]); - pOS2MET->Read(pBuf.get(),nDataLen); + pOS2MET->ReadBytes(pBuf.get(), nDataLen); if (p->nBitsPerPixel==24) { sal_uLong i, j, nAlign, nBytesPerLine; sal_uInt8 nTemp; @@ -2278,7 +2278,7 @@ void OS2METReader::ReadImageData(sal_uInt16 nDataID, sal_uInt16 nDataLen) } } } - p->pBMP->Write(pBuf.get(),nDataLen); + p->pBMP->WriteBytes(pBuf.get(), nDataLen); p->nMapPos+=nDataLen; break; } @@ -2321,7 +2321,7 @@ void OS2METReader::ReadFont(sal_uInt16 nFieldSize) case 0x08: { // Font Typeface char str[33]; pOS2MET->SeekRel(1); - pOS2MET->Read( &str, 32 ); + pOS2MET->ReadBytes( &str, 32 ); str[ 32 ] = 0; OUString aStr( str, strlen(str), osl_getThreadTextEncoding() ); if ( aStr.compareToIgnoreAsciiCase( "Helv" ) == 0 ) @@ -2588,8 +2588,8 @@ void OS2METReader::ReadField(sal_uInt16 nFieldType, sal_uInt16 nFieldSize) pOrdFile->SetEndian(SvStreamEndian::LITTLE); } std::unique_ptr<sal_uInt8[]> pBuf(new sal_uInt8[nFieldSize]); - pOS2MET->Read(pBuf.get(),nFieldSize); - pOrdFile->Write(pBuf.get(),nFieldSize); + pOS2MET->ReadBytes(pBuf.get(), nFieldSize); + pOrdFile->WriteBytes(pBuf.get(), nFieldSize); break; } case MapCodFntMagic: diff --git a/filter/source/graphicfilter/ipcd/ipcd.cxx b/filter/source/graphicfilter/ipcd/ipcd.cxx index 42861ded4cde..7ae9f324775f 100644 --- a/filter/source/graphicfilter/ipcd/ipcd.cxx +++ b/filter/source/graphicfilter/ipcd/ipcd.cxx @@ -174,7 +174,7 @@ void PCDReader::CheckPCDImagePacFile() char Buf[ 8 ]; m_rPCD.Seek( 2048 ); - m_rPCD.Read( Buf, 7 ); + m_rPCD.ReadBytes(Buf, 7); Buf[ 7 ] = 0; if (OString(Buf) != "PCD_IPI") bStatus = false; @@ -235,10 +235,10 @@ void PCDReader::ReadImage() m_rPCD.Seek( nImagePos ); // next pair of rows := first pair of rows: - m_rPCD.Read( pL0N, nWidth ); - m_rPCD.Read( pL1N, nWidth ); - m_rPCD.Read( pCbN, nW2 ); - m_rPCD.Read( pCrN, nW2 ); + m_rPCD.ReadBytes( pL0N, nWidth ); + m_rPCD.ReadBytes( pL1N, nWidth ); + m_rPCD.ReadBytes( pCbN, nW2 ); + m_rPCD.ReadBytes( pCrN, nW2 ); pCbN[ nW2 ] = pCbN[ nW2 - 1 ]; pCrN[ nW2 ] = pCrN[ nW2 - 1 ]; @@ -253,10 +253,10 @@ void PCDReader::ReadImage() // get the next pair of rows: if ( nYPair < nH2 - 1 ) { - m_rPCD.Read( pL0N, nWidth ); - m_rPCD.Read( pL1N, nWidth ); - m_rPCD.Read( pCbN, nW2 ); - m_rPCD.Read( pCrN, nW2 ); + m_rPCD.ReadBytes( pL0N, nWidth ); + m_rPCD.ReadBytes( pL1N, nWidth ); + m_rPCD.ReadBytes( pCbN, nW2 ); + m_rPCD.ReadBytes( pCrN, nW2 ); pCbN[nW2]=pCbN[ nW2 - 1 ]; pCrN[nW2]=pCrN[ nW2 - 1 ]; } diff --git a/filter/source/graphicfilter/ipcx/ipcx.cxx b/filter/source/graphicfilter/ipcx/ipcx.cxx index b5cef0429929..2aa8c6f2a5df 100644 --- a/filter/source/graphicfilter/ipcx/ipcx.cxx +++ b/filter/source/graphicfilter/ipcx/ipcx.cxx @@ -237,7 +237,7 @@ void PCXReader::ImplReadBody(BitmapWriteAccess * pAcc) for ( np = 0; np < nPlanes; np++) { if ( nEncoding == 0) - m_rPCX.Read( static_cast<void *>(pPlane[ np ]), nBytesPerPlaneLin ); + m_rPCX.ReadBytes( static_cast<void *>(pPlane[ np ]), nBytesPerPlaneLin ); else { pDest = pPlane[ np ]; diff --git a/filter/source/graphicfilter/ipict/ipict.cxx b/filter/source/graphicfilter/ipict/ipict.cxx index 188595fedc5d..2cafb482d6eb 100644 --- a/filter/source/graphicfilter/ipict/ipict.cxx +++ b/filter/source/graphicfilter/ipict/ipict.cxx @@ -684,7 +684,7 @@ sal_uLong PictReader::ReadAndDrawText() pPict->ReadChar( nByteLen ); nLen=((sal_uLong)nByteLen)&0x000000ff; nDataLen = nLen + 1; - pPict->Read( &sText, nLen ); + pPict->ReadBytes(&sText, nLen); if (IsInvisible(PDM_TEXT)) return nDataLen; DrawingMethod(PDM_TEXT); @@ -1177,7 +1177,7 @@ void PictReader::ReadHeader() nOffset = 509+st; // illogical : more logical will be nStartPos+509+st or to consider that nStartPos=0 // a small test to check if versionOp code exists after the bdbox ( with no extra NOP codes) pPict->Seek(nOffset+10); - pPict->Read( sBuf, 2 ); + pPict->ReadBytes(sBuf, 2); if (pPict->IsEof() || pPict->GetError()) break; if (sBuf[0] == 0x11 || (sBuf[0] == 0x00 && sBuf[1] == 0x11)) ; // maybe ok else continue; @@ -1198,7 +1198,7 @@ void PictReader::ReadHeader() if (pPict->IsEof() || pPict->GetError()) continue; // read version - pPict->Read( sBuf, 2 ); + pPict->ReadBytes(sBuf, 2); // version 1 file if ( sBuf[ 0 ] == 0x11 && sBuf[ 1 ] == 0x01 ) { // pict v1 must be rare and we do only few tests @@ -1211,7 +1211,7 @@ void PictReader::ReadHeader() { numZero++; pPict->SeekRel(-1); - pPict->Read( sBuf, 2 ); + pPict->ReadBytes(sBuf, 2); } while ( sBuf[0] == 0x00 && numZero < 10); actualConfid -= (numZero-1); // extra nop are dubious @@ -1589,7 +1589,7 @@ sal_uLong PictReader::ReadData(sal_uInt16 nOpcode) else aActFont.SetFamily(FAMILY_ROMAN); aActFont.SetCharSet(GetTextEncoding(nUSHORT)); pPict->ReadChar( nByteLen ); nLen=((sal_uInt16)nByteLen)&0x00ff; - pPict->Read( &sFName, nLen ); + pPict->ReadBytes(&sFName, nLen); sFName[ nLen ] = 0; OUString aString( sFName, strlen(sFName), osl_getThreadTextEncoding() ); aActFont.SetFamilyName( aString ); diff --git a/filter/source/graphicfilter/ipsd/ipsd.cxx b/filter/source/graphicfilter/ipsd/ipsd.cxx index 5b68a175844a..7f763836f614 100644 --- a/filter/source/graphicfilter/ipsd/ipsd.cxx +++ b/filter/source/graphicfilter/ipsd/ipsd.cxx @@ -237,7 +237,7 @@ bool PSDReader::ImplReadHeader() if ( nColorLength != 768 ) // we need the color map return false; mpPalette = new sal_uInt8[ 768 ]; - m_rPSD.Read( mpPalette, 768 ); + m_rPSD.ReadBytes(mpPalette, 768); } break; diff --git a/filter/source/graphicfilter/itga/itga.cxx b/filter/source/graphicfilter/itga/itga.cxx index 6bf858c9e351..33464c5d349b 100644 --- a/filter/source/graphicfilter/itga/itga.cxx +++ b/filter/source/graphicfilter/itga/itga.cxx @@ -217,12 +217,12 @@ bool TGAReader::ImplReadHeader() { mnTGAVersion = 2; - m_rTGA.Read( mpExtension->sAuthorName, 41 ); - m_rTGA.Read( mpExtension->sAuthorComment, 324 ); - m_rTGA.Read( mpExtension->sDateTimeStamp, 12 ); - m_rTGA.Read( mpExtension->sJobNameID, 12 ); + m_rTGA.ReadBytes(mpExtension->sAuthorName, 41); + m_rTGA.ReadBytes(mpExtension->sAuthorComment, 324); + m_rTGA.ReadBytes(mpExtension->sDateTimeStamp, 12); + m_rTGA.ReadBytes(mpExtension->sJobNameID, 12); m_rTGA.ReadChar( mpExtension->sJobNameID[ 0 ] ).ReadChar( mpExtension->sJobNameID[ 1 ] ).ReadChar( mpExtension->sJobNameID[ 2 ] ); - m_rTGA.Read( mpExtension->sSoftwareID, 41 ); + m_rTGA.ReadBytes(mpExtension->sSoftwareID, 41); m_rTGA.ReadUInt16( mpExtension->nSoftwareVersionNumber ).ReadUChar( mpExtension->nSoftwareVersionLetter ) .ReadUInt32( mpExtension->nKeyColor ).ReadUInt16( mpExtension->nPixelAspectRatioNumerator ) .ReadUInt16( mpExtension->nPixelAspectRatioDeNumerator ).ReadUInt16( mpExtension->nGammaValueNumerator ) diff --git a/filter/source/graphicfilter/itiff/itiff.cxx b/filter/source/graphicfilter/itiff/itiff.cxx index d7a26ead6670..609786a6aad7 100644 --- a/filter/source/graphicfilter/itiff/itiff.cxx +++ b/filter/source/graphicfilter/itiff/itiff.cxx @@ -557,7 +557,7 @@ bool TIFFReader::ReadMap() pTIFF->Seek( pStripOffsets[ nStrip ] + ( ny % GetRowsPerStrip() ) * nStripBytesPerRow ); if (np >= SAL_N_ELEMENTS(pMap)) return false; - pTIFF->Read( pMap[ np ], nBytesPerRow ); + pTIFF->ReadBytes(pMap[ np ], nBytesPerRow); if (!pTIFF->good()) return false; } @@ -693,7 +693,7 @@ bool TIFFReader::ReadMap() nRecCount=0x00000001+((sal_uLong)nRecHeader); if ( nRecCount > nRowBytesLeft ) return false; - pTIFF->Read(pdst,nRecCount); + pTIFF->ReadBytes(pdst, nRecCount); if (!pTIFF->good()) return false; pdst+=nRecCount; diff --git a/filter/source/msfilter/escherex.cxx b/filter/source/msfilter/escherex.cxx index 3de4007fdf38..3c85227f8f4d 100644 --- a/filter/source/msfilter/escherex.cxx +++ b/filter/source/msfilter/escherex.cxx @@ -314,7 +314,7 @@ void EscherPropertyContainer::Commit( SvStream& rSt, sal_uInt16 nVersion, sal_uI for ( i = 0; i < nSortCount; i++ ) { if ( pSortStruct[ i ].pBuf ) - rSt.Write( pSortStruct[ i ].pBuf, pSortStruct[ i ].nPropSize ); + rSt.WriteBytes(pSortStruct[i].pBuf, pSortStruct[i].nPropSize); } } } @@ -4062,7 +4062,7 @@ void EscherBlibEntry::WriteBlibEntry( SvStream& rSt, bool bWritePictureOffset, s rSt.WriteUChar( meBlibType ); } - rSt.Write( &mnIdentifier[ 0 ], 16 ); + rSt.WriteBytes(&mnIdentifier[0], 16); rSt.WriteUInt16( 0 ) .WriteUInt32( mnSize + mnSizeExtra ) .WriteUInt32( mnRefCount ) @@ -4185,8 +4185,8 @@ void EscherGraphicProvider::WriteBlibStoreContainer( SvStream& rSt, SvStream* pM while ( nBlipSize ) { sal_uInt32 nBytes = ( nBlipSize > nBuf ? nBuf : nBlipSize ); - pMergePicStreamBSE->Read( pBuf.get(), nBytes ); - rSt.Write( pBuf.get(), nBytes ); + pMergePicStreamBSE->ReadBytes(pBuf.get(), nBytes); + rSt.WriteBytes(pBuf.get(), nBytes); nBlipSize -= nBytes; } } @@ -4303,7 +4303,7 @@ sal_uInt32 EscherGraphicProvider::GetBlibID( SvStream& rPicOutStrm, const OStrin GraphicFilter &rFilter = GraphicFilter::GetGraphicFilter(); SvMemoryStream aGIFStream; const char* pString = "MSOFFICE9.0"; - aGIFStream.Write( pString, strlen(pString) ); + aGIFStream.WriteBytes(pString, strlen(pString)); nErrCode = rFilter.ExportGraphic( aGraphic, OUString(), aGIFStream, rFilter.GetExportFormatNumberForShortName( "GIF" ) ); css::uno::Sequence< css::beans::PropertyValue > aFilterData( 1 ); @@ -4312,7 +4312,7 @@ sal_uInt32 EscherGraphicProvider::GetBlibID( SvStream& rPicOutStrm, const OStrin css::uno::Sequence< sal_Int8 > aGIFSeq( nGIFSreamLen ); sal_Int8* pSeq = aGIFSeq.getArray(); aGIFStream.Seek( STREAM_SEEK_TO_BEGIN ); - aGIFStream.Read( pSeq, nGIFSreamLen ); + aGIFStream.ReadBytes(pSeq, nGIFSreamLen); css::beans::PropertyValue aChunkProp, aFilterProp; aChunkProp.Name = "msOG"; aChunkProp.Value <<= aGIFSeq; @@ -4382,9 +4382,9 @@ sal_uInt32 EscherGraphicProvider::GetBlibID( SvStream& rPicOutStrm, const OStrin rPicOutStrm.WriteUInt32( nInstance ).WriteUInt32( p_EscherBlibEntry->mnSize + nExtra ); - rPicOutStrm.Write( p_EscherBlibEntry->mnIdentifier, 16 ); + rPicOutStrm.WriteBytes(p_EscherBlibEntry->mnIdentifier, 16); rPicOutStrm.WriteUChar( 0xff ); - rPicOutStrm.Write( pGraphicAry, p_EscherBlibEntry->mnSize ); + rPicOutStrm.WriteBytes(pGraphicAry, p_EscherBlibEntry->mnSize); } else { @@ -4403,8 +4403,8 @@ sal_uInt32 EscherGraphicProvider::GetBlibID( SvStream& rPicOutStrm, const OStrin nInstance = ( eBlibType == WMF ) ? 0xf01b2170 : 0xf01a3d40; // !EMF -> no change rPicOutStrm.WriteUInt32( nInstance ).WriteUInt32( p_EscherBlibEntry->mnSize + nExtra ); if ( eBlibType == WMF ) // !EMF -> no change - rPicOutStrm.Write( p_EscherBlibEntry->mnIdentifier, 16 ); - rPicOutStrm.Write( p_EscherBlibEntry->mnIdentifier, 16 ); + rPicOutStrm.WriteBytes(p_EscherBlibEntry->mnIdentifier, 16); + rPicOutStrm.WriteBytes(p_EscherBlibEntry->mnIdentifier, 16); /* ##913## @@ -4440,7 +4440,7 @@ sal_uInt32 EscherGraphicProvider::GetBlibID( SvStream& rPicOutStrm, const OStrin .WriteUInt32( nHeight ) .WriteUInt32( p_EscherBlibEntry->mnSize ) .WriteUInt16( 0xfe00 ); // compression Flags - rPicOutStrm.Write( pGraphicAry, p_EscherBlibEntry->mnSize ); + rPicOutStrm.WriteBytes(pGraphicAry, p_EscherBlibEntry->mnSize); } } if ( nAtomSize ) @@ -5063,9 +5063,9 @@ void EscherEx::InsertAtCurrentPos( sal_uInt32 nBytes ) nToCopy -= nBufSize; nSource -= nBufSize; mpOutStrm->Seek( nSource ); - mpOutStrm->Read( pBuf.get(), nBufSize ); + mpOutStrm->ReadBytes(pBuf.get(), nBufSize); mpOutStrm->Seek( nSource + nBytes ); - mpOutStrm->Write( pBuf.get(), nBufSize ); + mpOutStrm->WriteBytes(pBuf.get(), nBufSize); } mpOutStrm->Seek( nCurPos ); } diff --git a/filter/source/msfilter/msdffimp.cxx b/filter/source/msfilter/msdffimp.cxx index 996fa2803fd6..d547335db7cd 100644 --- a/filter/source/msfilter/msdffimp.cxx +++ b/filter/source/msfilter/msdffimp.cxx @@ -170,7 +170,7 @@ void Impl_OlePres::Write( SvStream & rStm ) WriteClipboardFormat( rStm, SotClipboardFormatId::GDIMETAFILE ); rStm.WriteInt32( nJobLen + 4 ); // a TargetDevice that's always empty if( nJobLen ) - rStm.Write( pJob, nJobLen ); + rStm.WriteBytes(pJob, nJobLen); rStm.WriteUInt32( nAspect ); rStm.WriteInt32( -1 ); //L-Index always -1 rStm.WriteInt32( nAdvFlags ); @@ -2708,7 +2708,7 @@ void DffPropertyReader::CheckAndCorrectExcelTextRotation( SvStream& rIn, SfxItem if ( nLen ) { css::uno::Sequence< sal_Int8 > aXMLDataSeq( nLen ); - rIn.Read( aXMLDataSeq.getArray(), nLen ); + rIn.ReadBytes(aXMLDataSeq.getArray(), nLen); css::uno::Reference< css::io::XInputStream > xInputStream ( new ::comphelper::SequenceInputStream( aXMLDataSeq ) ); try @@ -6520,7 +6520,7 @@ bool SvxMSDffManager::ProcessClientAnchor(SvStream& rStData, sal_uInt32 nDatLen, { rBuffLen = std::min(rStData.remainingSize(), static_cast<sal_uInt64>(nDatLen)); rpBuff = new char[rBuffLen]; - rBuffLen = rStData.Read(rpBuff, rBuffLen); + rBuffLen = rStData.ReadBytes(rpBuff, rBuffLen); } return true; } @@ -6532,7 +6532,7 @@ bool SvxMSDffManager::ProcessClientData(SvStream& rStData, sal_uInt32 nDatLen, { rBuffLen = std::min(rStData.remainingSize(), static_cast<sal_uInt64>(nDatLen)); rpBuff = new char[rBuffLen]; - rBuffLen = rStData.Read(rpBuff, rBuffLen); + rBuffLen = rStData.ReadBytes(rpBuff, rBuffLen); } return true; } @@ -6739,7 +6739,7 @@ bool SvxMSDffManager::ConvertToOle2( SvStream& rStm, sal_uInt32 nReadLen, if( 0x10000L > nStrLen ) { std::unique_ptr<sal_Char[]> pBuf(new sal_Char[ nStrLen ]); - rStm.Read( pBuf.get(), nStrLen ); + rStm.ReadBytes(pBuf.get(), nStrLen); aSvrName = OUString( pBuf.get(), (sal_uInt16) nStrLen-1, osl_getThreadTextEncoding() ); } else @@ -6759,11 +6759,11 @@ bool SvxMSDffManager::ConvertToOle2( SvStream& rStm, sal_uInt32 nReadLen, if( !pData ) return false; - rStm.Read( pData.get(), nDataLen ); + rStm.ReadBytes(pData.get(), nDataLen); // write to ole10 stream xOle10Stm->WriteUInt32( nDataLen ); - xOle10Stm->Write( pData.get(), nDataLen ); + xOle10Stm->WriteBytes(pData.get(), nDataLen); xOle10Stm = tools::SvRef<SotStorageStream>(); // set the compobj stream @@ -6791,7 +6791,7 @@ bool SvxMSDffManager::ConvertToOle2( SvStream& rStm, sal_uInt32 nReadLen, { sal_uLong nPos = rStm.Tell(); sal_uInt16 sz[4]; - rStm.Read( sz, 8 ); + rStm.ReadBytes( sz, 8 ); Graphic aGraphic; if( ERRCODE_NONE == GraphicConverter::Import( rStm, aGraphic ) && aGraphic.GetType() != GraphicType::NONE ) { @@ -7093,13 +7093,13 @@ SdrOle2Obj* SvxMSDffManager::CreateSdrOLEFromStorage( sal_uInt8 aTestA[10]; // exist the \1CompObj-Stream ? tools::SvRef<SotStorageStream> xSrcTst = xObjStg->OpenSotStream( "\1CompObj" ); bValidStorage = xSrcTst.Is() && sizeof( aTestA ) == - xSrcTst->Read( aTestA, sizeof( aTestA ) ); + xSrcTst->ReadBytes(aTestA, sizeof(aTestA)); if( !bValidStorage ) { // or the \1Ole-Stream ? xSrcTst = xObjStg->OpenSotStream( "\1Ole" ); bValidStorage = xSrcTst.Is() && sizeof(aTestA) == - xSrcTst->Read(aTestA, sizeof(aTestA)); + xSrcTst->ReadBytes(aTestA, sizeof(aTestA)); } } diff --git a/filter/source/msfilter/msoleexp.cxx b/filter/source/msfilter/msoleexp.cxx index 6660d7cd0f05..9c56db12c3e6 100644 --- a/filter/source/msfilter/msoleexp.cxx +++ b/filter/source/msfilter/msoleexp.cxx @@ -272,7 +272,7 @@ void SvxMSExportOLEObjects::ExportOLEObject( svt::EmbeddedObjectRef& rObj, SotSt } } - bExtentSuccess = ( xExtStm->Write( aWriteSet, 16 ) == 16 ); + bExtentSuccess = (xExtStm->WriteBytes(aWriteSet, 16) == 16); } } diff --git a/filter/source/msfilter/svdfppt.cxx b/filter/source/msfilter/svdfppt.cxx index 3b5670f0eb76..a68a19e0c5c0 100644 --- a/filter/source/msfilter/svdfppt.cxx +++ b/filter/source/msfilter/svdfppt.cxx @@ -310,7 +310,7 @@ SvStream& ReadPptSlideLayoutAtom( SvStream& rIn, PptSlideLayoutAtom& rAtom ) rIn.ReadInt32(nTmp); rAtom.eLayout = static_cast<PptSlideLayout>(nTmp); static_assert(sizeof(rAtom.aPlaceholderId) == 8, "wrong size of serialized array"); - rIn.Read( rAtom.aPlaceholderId, 8 ); + rIn.ReadBytes(rAtom.aPlaceholderId, 8); return rIn; } @@ -371,7 +371,7 @@ SvStream& ReadPptColorSchemeAtom( SvStream& rIn, PptColorSchemeAtom& rAtom ) { DffRecordHeader aHd; ReadDffRecordHeader( rIn, aHd ); - rIn.Read( rAtom.aData, 32 ); + rIn.ReadBytes(rAtom.aData, 32); aHd.SeekToEndOfRecord( rIn ); return rIn; } @@ -381,7 +381,7 @@ SvStream& ReadPptFontEntityAtom( SvStream& rIn, PptFontEntityAtom& rAtom ) DffRecordHeader aHd; ReadDffRecordHeader( rIn, aHd ); sal_Unicode nTemp, cData[ 32 ]; - rIn.Read( cData, 64 ); + rIn.ReadBytes(cData, 64); sal_uInt8 lfCharset, lfPitchAndFamily; @@ -1768,7 +1768,7 @@ bool SdrPowerPointOLEDecompress( SvStream& rOutput, SvStream& rInput, sal_uInt32 { sal_uInt32 nOldPos = rInput.Tell(); std::unique_ptr<char[]> pBuf(new char[ nInputSize ]); - rInput.Read( pBuf.get(), nInputSize ); + rInput.ReadBytes(pBuf.get(), nInputSize); ZCodec aZCodec( 0x8000, 0x8000 ); aZCodec.BeginCompression(); SvMemoryStream aSource( pBuf.get(), nInputSize, StreamMode::READ ); @@ -1857,11 +1857,12 @@ SdrObject* SdrPowerPointImport::ImportOLE( long nOLEId, if ( xSrcTst.Is() ) { sal_uInt8 aTestA[ 10 ]; - bool bGetItAsOle = ( sizeof( aTestA ) == xSrcTst->Read( aTestA, sizeof( aTestA ) ) ); + bool bGetItAsOle = (sizeof(aTestA) == xSrcTst->ReadBytes(aTestA, sizeof(aTestA))); if ( !bGetItAsOle ) { // maybe there is a contents stream in here xSrcTst = xObjStor->OpenSotStream( "Contents", STREAM_READWRITE | StreamMode::NOCREATE ); - bGetItAsOle = ( xSrcTst.Is() && sizeof( aTestA ) == xSrcTst->Read( aTestA, sizeof( aTestA ) ) ); + bGetItAsOle = (xSrcTst.Is() && + sizeof(aTestA) == xSrcTst->ReadBytes(aTestA, sizeof(aTestA))); } if ( bGetItAsOle ) { @@ -2065,8 +2066,8 @@ void SdrPowerPointImport::SeekOle( SfxObjectShell* pShell, sal_uInt32 nFilterOpt while ( nToCopy ) { nBufSize = ( nToCopy >= 0x40000 ) ? 0x40000 : nToCopy; - rStCtrl.Read( pBuf.get(), nBufSize ); - xOriginal->Write( pBuf.get(), nBufSize ); + rStCtrl.ReadBytes(pBuf.get(), nBufSize); + xOriginal->WriteBytes(pBuf.get(), nBufSize); nToCopy -= nBufSize; } } @@ -5239,7 +5240,7 @@ void PPTStyleTextPropReader::Init( SvStream& rIn, const DffRecordHeader& rTextHe sal_uInt32 i; sal_Unicode nChar; std::unique_ptr<sal_Unicode[]> pBuf(new sal_Unicode[ ( nMaxLen >> 1 ) + 1 ]); - rIn.Read( pBuf.get(), nMaxLen ); + rIn.ReadBytes(pBuf.get(), nMaxLen); nMaxLen >>= 1; pBuf[ nMaxLen ] = 0; sal_Unicode* pPtr = pBuf.get(); @@ -5275,7 +5276,7 @@ void PPTStyleTextPropReader::Init( SvStream& rIn, const DffRecordHeader& rTextHe { std::unique_ptr<sal_Char[]> pBuf(new sal_Char[ nMaxLen + 1 ]); pBuf[ nMaxLen ] = 0; - rIn.Read( pBuf.get(), nMaxLen ); + rIn.ReadBytes(pBuf.get(), nMaxLen); sal_Char* pPtr = pBuf.get(); for (;;) { diff --git a/forms/source/component/DatabaseForm.cxx b/forms/source/component/DatabaseForm.cxx index 55b2353d4af7..8d9dcf0b9595 100644 --- a/forms/source/component/DatabaseForm.cxx +++ b/forms/source/component/DatabaseForm.cxx @@ -550,7 +550,9 @@ Sequence<sal_Int8> ODatabaseForm::GetDataMultiPartEncoded(const Reference<XContr char* pBuf = new char[1025]; int nRead; while( (nRead = aMessStream.Read(pBuf, 1024)) > 0 ) - aMemStream.Write( pBuf, nRead ); + { + aMemStream.WriteBytes(pBuf, nRead); + } delete[] pBuf; aMemStream.Flush(); diff --git a/hwpfilter/source/hwpreader.cxx b/hwpfilter/source/hwpreader.cxx index 1588a7eba3cc..793c1db9cf8d 100644 --- a/hwpfilter/source/hwpreader.cxx +++ b/hwpfilter/source/hwpreader.cxx @@ -127,7 +127,7 @@ extern "C" SAL_DLLPUBLIC_EXPORT bool SAL_CALL TestImportHWP(const OUString &rURL while (true) { - nRead = aFileStream.Read(aData, nBlock); + nRead = aFileStream.ReadBytes(aData, nBlock); if (nRead == 0) break; stream->addData(aData, (int)nRead); diff --git a/idl/source/prj/svidl.cxx b/idl/source/prj/svidl.cxx index 4b8d4b9820f4..96c651e44271 100644 --- a/idl/source/prj/svidl.cxx +++ b/idl/source/prj/svidl.cxx @@ -41,8 +41,8 @@ bool FileMove_Impl( const OUString & rFile1, const OUString & rFile2, bool bImme { std::unique_ptr<sal_uInt8[]> pBuf1(new sal_uInt8[ BR ]); std::unique_ptr<sal_uInt8[]> pBuf2(new sal_uInt8[ BR ]); - nC1 = aOutStm1.Read( pBuf1.get(), BR ); - nC2 = aOutStm2.Read( pBuf2.get(), BR ); + nC1 = aOutStm1.ReadBytes(pBuf1.get(), BR); + nC2 = aOutStm2.ReadBytes(pBuf2.get(), BR); while( nC1 == nC2 ) { if( memcmp( pBuf1.get(), pBuf2.get(), nC1 ) ) @@ -54,8 +54,8 @@ bool FileMove_Impl( const OUString & rFile1, const OUString & rFile2, bool bImme { if( 0x8000 != nC1 ) break; - nC1 = aOutStm1.Read( pBuf1.get(), BR ); - nC2 = aOutStm2.Read( pBuf2.get(), BR ); + nC1 = aOutStm1.ReadBytes(pBuf1.get(), BR); + nC2 = aOutStm2.ReadBytes(pBuf2.get(), BR); } } } diff --git a/include/tools/stream.hxx b/include/tools/stream.hxx index c31bc8cc19da..1bae0a89458c 100644 --- a/include/tools/stream.hxx +++ b/include/tools/stream.hxx @@ -276,8 +276,8 @@ public: SvStream& WriteUInt32AsString( sal_uInt32 nUInt32 ); SvStream& WriteInt32AsString( sal_Int32 nInt32 ); - sal_Size Read( void* pData, sal_Size nSize ); - sal_Size Write( const void* pData, sal_Size nSize ); + sal_Size ReadBytes( void* pData, sal_Size nSize ); + sal_Size WriteBytes( const void* pData, sal_Size nSize ); sal_uInt64 Seek( sal_uInt64 nPos ); sal_uInt64 SeekRel( sal_Int64 nPos ); sal_uInt64 Tell() const { return m_nBufFilePos + m_nBufActualPos; } @@ -537,7 +537,7 @@ inline OUString read_uInt8_lenPrefixed_uInt8s_ToOUString(SvStream& rStrm, inline sal_Size write_uInt8s_FromOString(SvStream& rStrm, const OString& rStr, sal_Size nUnits) { - return rStrm.Write(rStr.getStr(), nUnits); + return rStrm.WriteBytes(rStr.getStr(), nUnits); } inline sal_Size write_uInt8s_FromOString(SvStream& rStrm, const OString& rStr) diff --git a/linguistic/source/dicimp.cxx b/linguistic/source/dicimp.cxx index 80e424d8cefc..272de85902ce 100644 --- a/linguistic/source/dicimp.cxx +++ b/linguistic/source/dicimp.cxx @@ -97,7 +97,7 @@ sal_Int16 ReadDicVersion( SvStreamPtr &rpStream, sal_uInt16 &nLng, bool &bNeg ) sal_Size nSniffPos = rpStream->Tell(); static sal_Size nVerOOo7Len = sal::static_int_cast< sal_Size >(strlen( pVerOOo7 )); pMagicHeader[ nVerOOo7Len ] = '\0'; - if ((rpStream->Read(static_cast<void *>(pMagicHeader), nVerOOo7Len) == nVerOOo7Len) && + if ((rpStream->ReadBytes(static_cast<void *>(pMagicHeader), nVerOOo7Len) == nVerOOo7Len) && !strcmp(pMagicHeader, pVerOOo7)) { bool bSuccess; @@ -151,7 +151,7 @@ sal_Int16 ReadDicVersion( SvStreamPtr &rpStream, sal_uInt16 &nLng, bool &bNeg ) if (nLen >= MAX_HEADER_LENGTH) return -1; - rpStream->Read(pMagicHeader, nLen); + rpStream->ReadBytes(pMagicHeader, nLen); pMagicHeader[nLen] = '\0'; // Check version magic @@ -291,7 +291,7 @@ sal_uLong DictionaryNeo::loadEntries(const OUString &rMainURL) return nErr; if ( nLen < BUFSIZE ) { - pStream->Read(aWordBuf, nLen); + pStream->ReadBytes(aWordBuf, nLen); if (0 != (nErr = pStream->GetError())) return nErr; *(aWordBuf + nLen) = 0; @@ -320,7 +320,7 @@ sal_uLong DictionaryNeo::loadEntries(const OUString &rMainURL) if (nLen < BUFSIZE) { - pStream->Read(aWordBuf, nLen); + pStream->ReadBytes(aWordBuf, nLen); if (0 != (nErr = pStream->GetError())) return nErr; } diff --git a/lotuswordpro/source/filter/bencont.cxx b/lotuswordpro/source/filter/bencont.cxx index 868d54caac7d..b126b4803911 100644 --- a/lotuswordpro/source/filter/bencont.cxx +++ b/lotuswordpro/source/filter/bencont.cxx @@ -331,13 +331,13 @@ void LtcBenContainer::CreateGraphicStream(SvStream * &pStream, const char *pObje char * pPointer = pBuf; if(pD) { - pD->Read(pPointer, nDLen); + pD->ReadBytes(pPointer, nDLen); delete pD; } pPointer += nDLen; if(pS) { - pS->Read(pPointer, nLen - nDLen); + pS->ReadBytes(pPointer, nLen - nDLen); delete pS; } diff --git a/lotuswordpro/source/filter/explode.cxx b/lotuswordpro/source/filter/explode.cxx index 356cc543fd51..87f40494c006 100644 --- a/lotuswordpro/source/filter/explode.cxx +++ b/lotuswordpro/source/filter/explode.cxx @@ -183,7 +183,7 @@ sal_uInt32 Decompression::ReadBits(sal_uInt16 iCount, sal_uInt32 & nBits) { if (m_nBytesLeft == 0) { - m_nBytesLeft = m_pInStream->Read(m_Buffer, CHUNK); + m_nBytesLeft = m_pInStream->ReadBytes(m_Buffer, CHUNK); m_pBuffer = m_Buffer; if (m_nBytesLeft == 0) return 1; } @@ -242,7 +242,7 @@ sal_Int32 Decompression::explode() m_Output[m_nOutputBufferPos++] = (sal_uInt8)symbol; if (m_nOutputBufferPos == MAXWIN) { - m_pOutStream->Write(m_Output, m_nOutputBufferPos); + m_pOutStream->WriteBytes(m_Output, m_nOutputBufferPos); m_nOutputBufferPos = 0; } continue; @@ -299,7 +299,7 @@ sal_Int32 Decompression::explode() // - now copy LENGTH bytes from (output_ptr-DISTANCE) to output_ptr // write current buffer to output - m_pOutStream->Write(m_Output, m_nOutputBufferPos); + m_pOutStream->WriteBytes(m_Output, m_nOutputBufferPos); m_nOutputBufferPos = 0; // remember current position @@ -312,7 +312,7 @@ sal_Int32 Decompression::explode() m_pOutStream->SeekRel(-(long)distance); sal_uInt8 sTemp[MAXWIN]; sal_uInt32 nRead = distance > Length? Length:distance; - m_pOutStream->Read(sTemp, nRead); + m_pOutStream->ReadBytes(sTemp, nRead); if (nRead != Length) { // fill the buffer with read content repeatly until full @@ -326,7 +326,7 @@ sal_Int32 Decompression::explode() m_pOutStream->Seek(nOutputPos); // write current buffer to output - m_pOutStream->Write(sTemp, Length); + m_pOutStream->WriteBytes(sTemp, Length); } return 0; } diff --git a/lotuswordpro/source/filter/lwpdrawobj.cxx b/lotuswordpro/source/filter/lwpdrawobj.cxx index cab4dd260125..8361e21cf64c 100644 --- a/lotuswordpro/source/filter/lwpdrawobj.cxx +++ b/lotuswordpro/source/filter/lwpdrawobj.cxx @@ -151,7 +151,7 @@ void LwpDrawObj::ReadClosedObjStyle() // fill style m_pStream->ReadUInt16( m_aClosedObjStyleRec.nFillType ); - m_pStream->Read(m_aClosedObjStyleRec.pFillPattern, + m_pStream->ReadBytes(m_aClosedObjStyleRec.pFillPattern, sizeof(m_aClosedObjStyleRec.pFillPattern)); } @@ -1036,7 +1036,7 @@ void LwpDrawTextBox::Read() m_aTextRec.nTextWidth = 1; m_pStream->ReadInt16( m_aTextRec.nTextHeight ); - m_pStream->Read(m_aTextRec.tmpTextFaceName, DRAW_FACESIZE); + m_pStream->ReadBytes(m_aTextRec.tmpTextFaceName, DRAW_FACESIZE); m_pStream->SeekRel(1);// PitchAndFamily m_pStream->ReadInt16( m_aTextRec.nTextSize ); @@ -1062,7 +1062,7 @@ void LwpDrawTextBox::Read() sal_Int16 TextLength = m_aObjHeader.nRecLen - 71; m_aTextRec.pTextString = new sal_uInt8 [TextLength]; - m_pStream->Read(m_aTextRec.pTextString, TextLength); + m_pStream->ReadBytes(m_aTextRec.pTextString, TextLength); } OUString LwpDrawTextBox::RegisterStyle() @@ -1242,7 +1242,7 @@ void LwpDrawTextArt::Read() m_pStream->SeekRel(1); - m_pStream->Read(m_aTextArtRec.tmpTextFaceName, DRAW_FACESIZE); + m_pStream->ReadBytes(m_aTextArtRec.tmpTextFaceName, DRAW_FACESIZE); m_pStream->SeekRel(1);// PitchAndFamily m_pStream->ReadInt16( m_aTextArtRec.nTextSize ); @@ -1265,7 +1265,7 @@ void LwpDrawTextArt::Read() throw BadRead(); m_aTextArtRec.pTextString = new sal_uInt8 [m_aTextArtRec.nTextLen]; - m_pStream->Read(m_aTextArtRec.pTextString, m_aTextArtRec.nTextLen); + m_pStream->ReadBytes(m_aTextArtRec.pTextString, m_aTextArtRec.nTextLen); m_aTextArtRec.pTextString[m_aTextArtRec.nTextLen-1] = 0; } @@ -1476,7 +1476,7 @@ void LwpDrawBitmap::Read() pPicData += 30*sizeof(sal_uInt8); } - m_pStream->Read(pPicData, nDIBRemaining); + m_pStream->ReadBytes(pPicData, nDIBRemaining); } OUString LwpDrawBitmap::RegisterStyle() diff --git a/lotuswordpro/source/filter/lwpfilter.cxx b/lotuswordpro/source/filter/lwpfilter.cxx index 05c8159f753a..0389ee3cbaf9 100644 --- a/lotuswordpro/source/filter/lwpfilter.cxx +++ b/lotuswordpro/source/filter/lwpfilter.cxx @@ -106,8 +106,8 @@ using namespace OpenStormBento; pCompressed->Seek(0); std::unique_ptr<SvStream> aDecompressed(new SvMemoryStream(4096, 4096)); unsigned char buffer[512]; - pCompressed->Read(buffer, 16); - aDecompressed->Write(buffer, 16); + pCompressed->ReadBytes(buffer, 16); + aDecompressed->WriteBytes(buffer, 16); std::unique_ptr<LwpSvStream> aLwpStream(new LwpSvStream(pCompressed)); LtcBenContainer* pBentoContainer; @@ -129,8 +129,8 @@ using namespace OpenStormBento; nPos += 0x10; pCompressed->Seek(nPos); - while (sal_uInt32 iRead = pCompressed->Read(buffer, 512)) - aDecompressed->Write(buffer, iRead); + while (sal_uInt32 iRead = pCompressed->ReadBytes(buffer, 512)) + aDecompressed->WriteBytes(buffer, iRead); //transfer ownership of aDecompressed's ptr pOutDecompressed = aDecompressed.release(); diff --git a/lotuswordpro/source/filter/lwpgrfobj.cxx b/lotuswordpro/source/filter/lwpgrfobj.cxx index bf04563f8732..df843a9f8703 100644 --- a/lotuswordpro/source/filter/lwpgrfobj.cxx +++ b/lotuswordpro/source/filter/lwpgrfobj.cxx @@ -367,7 +367,7 @@ sal_uInt32 LwpGraphicObject::GetRawGrafData(sal_uInt8*& pGrafData) // read image data sal_uInt32 nDataLen = pMemGrafStream->GetEndOfData(); pGrafData = new sal_uInt8 [nDataLen]; - pMemGrafStream->Read(pGrafData, nDataLen); + pMemGrafStream->ReadBytes(pGrafData, nDataLen); delete pMemGrafStream; pMemGrafStream = nullptr; @@ -418,7 +418,7 @@ sal_uInt32 LwpGraphicObject::GetGrafData(sal_uInt8*& pGrafData) pGrafStream->Seek(nPos); pGrafData = new sal_uInt8 [nDataLen]; - pMemGrafStream->Read(pGrafData, nDataLen); + pMemGrafStream->ReadBytes(pGrafData, nDataLen); delete pMemGrafStream; pMemGrafStream = nullptr; diff --git a/lotuswordpro/source/filter/lwpsdwfileloader.cxx b/lotuswordpro/source/filter/lwpsdwfileloader.cxx index ac2687ad7e9e..5f4cd9660f68 100644 --- a/lotuswordpro/source/filter/lwpsdwfileloader.cxx +++ b/lotuswordpro/source/filter/lwpsdwfileloader.cxx @@ -79,7 +79,7 @@ LwpSdwFileLoader::~LwpSdwFileLoader() void LwpSdwFileLoader::CreateDrawObjects(std::vector< rtl::Reference<XFFrame> >* pDrawObjVector) { unsigned char BinSignature[2]; - m_pStream->Read(BinSignature,2); + m_pStream->ReadBytes(BinSignature, 2); if (BinSignature[0] == 'S' && BinSignature[1] == 'M') { diff --git a/lotuswordpro/source/filter/lwpsdwgrouploaderv0102.cxx b/lotuswordpro/source/filter/lwpsdwgrouploaderv0102.cxx index 6d134a042438..51c8dec34ab2 100644 --- a/lotuswordpro/source/filter/lwpsdwgrouploaderv0102.cxx +++ b/lotuswordpro/source/filter/lwpsdwgrouploaderv0102.cxx @@ -98,7 +98,7 @@ void LwpSdwGroupLoaderV0102::BeginDrawObjects(std::vector< rtl::Reference<XFFram //flag unsigned char BinSignature[2]; - m_pStream->Read(BinSignature,2); + m_pStream->ReadBytes(BinSignature, 2); if (BinSignature[0] != 'S' || BinSignature[1] != 'M') { assert(false); @@ -243,7 +243,7 @@ XFDrawGroup* LwpSdwGroupLoaderV0102::CreateDrawGroupObject() { //flag unsigned char BinSignature[2]; - m_pStream->Read(BinSignature,2); + m_pStream->ReadBytes(BinSignature, 2); if (BinSignature[0] != 'S' || BinSignature[1] != 'M') { assert(false); diff --git a/lotuswordpro/source/filter/lwpsvstream.cxx b/lotuswordpro/source/filter/lwpsvstream.cxx index 055b23579220..7ad492e27926 100644 --- a/lotuswordpro/source/filter/lwpsvstream.cxx +++ b/lotuswordpro/source/filter/lwpsvstream.cxx @@ -68,7 +68,7 @@ LwpSvStream::LwpSvStream(SvStream* pStream, LwpSvStream * pCompressed) */ sal_Int32 LwpSvStream::Read(void* buf, sal_Int32 nBytesToRead) { - return m_pStream->Read(buf,nBytesToRead); + return m_pStream->ReadBytes(buf, nBytesToRead); } LwpSvStream& LwpSvStream::ReadUInt8( sal_uInt8& rUInt8 ) diff --git a/oox/source/export/vmlexport.cxx b/oox/source/export/vmlexport.cxx index 8cad39ebfe0c..b58f1adae669 100644 --- a/oox/source/export/vmlexport.cxx +++ b/oox/source/export/vmlexport.cxx @@ -586,7 +586,7 @@ void VMLExport::Commit( EscherPropertyContainer& rProps, const Rectangle& rRect { SvMemoryStream aStream; int nHeaderSize = 25; // The first bytes are WW8-specific, we're only interested in the PNG - aStream.Write(aStruct.pBuf + nHeaderSize, aStruct.nPropSize - nHeaderSize); + aStream.WriteBytes(aStruct.pBuf + nHeaderSize, aStruct.nPropSize - nHeaderSize); aStream.Seek(0); Graphic aGraphic; GraphicConverter::Import(aStream, aGraphic); @@ -796,7 +796,7 @@ void VMLExport::Commit( EscherPropertyContainer& rProps, const Rectangle& rRect if (rProps.GetOpt(ESCHER_Prop_gtextUNICODE, aUnicode)) { SvMemoryStream aStream; - aStream.Write(it->pBuf, it->nPropSize); + aStream.WriteBytes(it->pBuf, it->nPropSize); aStream.Seek(0); OUString aTextPathString = SvxMSDffManager::MSDFFReadZString(aStream, it->nPropSize, true); aStream.Seek(0); @@ -813,7 +813,7 @@ void VMLExport::Commit( EscherPropertyContainer& rProps, const Rectangle& rRect OUString aStyle; if (rProps.GetOpt(ESCHER_Prop_gtextFont, aFont)) { - aStream.Write(aFont.pBuf, aFont.nPropSize); + aStream.WriteBytes(aFont.pBuf, aFont.nPropSize); aStream.Seek(0); OUString aTextPathFont = SvxMSDffManager::MSDFFReadZString(aStream, aFont.nPropSize, true); aStyle += "font-family:\"" + aTextPathFont + "\""; @@ -844,7 +844,7 @@ void VMLExport::Commit( EscherPropertyContainer& rProps, const Rectangle& rRect case ESCHER_Prop_wzName: { SvMemoryStream aStream; - aStream.Write(it->pBuf, it->nPropSize); + aStream.WriteBytes(it->pBuf, it->nPropSize); aStream.Seek(0); OUString idStr = SvxMSDffManager::MSDFFReadZString(aStream, it->nPropSize, true); aStream.Seek(0); diff --git a/oox/source/ole/vbaexport.cxx b/oox/source/ole/vbaexport.cxx index 5beddc384061..d4e6a9f5716e 100644 --- a/oox/source/ole/vbaexport.cxx +++ b/oox/source/ole/vbaexport.cxx @@ -177,7 +177,7 @@ void VBACompressionChunk::write() sal_uInt16 nHeader = handleHeader(true); setUInt16(pCompressedChunkStream, 0, nHeader); // copy the compressed stream to our output stream - mrCompressedStream.Write(pCompressedChunkStream, mnCompressedCurrent); + mrCompressedStream.WriteBytes(pCompressedChunkStream, mnCompressedCurrent); } } @@ -356,7 +356,7 @@ void VBACompressionChunk::writeRawChunk() { // we need to use up to 4096 bytes of the original stream // and fill the rest with padding - mrCompressedStream.Write(mpUncompressedData, mnChunkSize); + mrCompressedStream.WriteBytes(mpUncompressedData, mnChunkSize); sal_Size nPadding = 4096 - mnChunkSize; for (size_t i = 0; i < nPadding; ++i) { diff --git a/opencl/inc/opencl_device_selection.h b/opencl/inc/opencl_device_selection.h index 19b74aba665f..d49974cf848a 100644 --- a/opencl/inc/opencl_device_selection.h +++ b/opencl/inc/opencl_device_selection.h @@ -244,7 +244,7 @@ private: static int funcWriteCallback(void* pContext, const char* sBuffer, int nLen) { SvStream* pStream = static_cast<SvStream*>(pContext); - return static_cast<int>(pStream->Write(sBuffer, nLen)); + return static_cast<int>(pStream->WriteBytes(sBuffer, nLen)); } static int funcCloseCallback(void* pContext) @@ -340,7 +340,7 @@ public: { sal_Size nSize = pStream->remainingSize(); std::vector<sal_uInt8> aBuffer(nSize + 1); - pStream->Read(aBuffer.data(), nSize); + pStream->ReadBytes(aBuffer.data(), nSize); aBuffer[nSize] = 0; mpDocPtr = xmlParseDoc(reinterpret_cast<xmlChar*>(aBuffer.data())); if (mpDocPtr == nullptr) diff --git a/sc/source/core/tool/autoform.cxx b/sc/source/core/tool/autoform.cxx index 5f03d87da5b5..f2f81e7b6222 100644 --- a/sc/source/core/tool/autoform.cxx +++ b/sc/source/core/tool/autoform.cxx @@ -97,7 +97,7 @@ namespace { blob.pData = new sal_uInt8[blobSize]; blob.size = static_cast<sal_Size>(blobSize); - stream.Read(blob.pData, blob.size); + stream.ReadBytes(blob.pData, blob.size); } return stream; @@ -109,7 +109,7 @@ namespace const sal_uInt64 endOfBlob = stream.Tell() + sizeof(sal_uInt64) + blob.size; stream.WriteUInt64( endOfBlob ); if (blob.size) - stream.Write(blob.pData, blob.size); + stream.WriteBytes(blob.pData, blob.size); return stream; } diff --git a/sc/source/core/tool/rechead.cxx b/sc/source/core/tool/rechead.cxx index dbf3bffda443..babe8a9755ae 100644 --- a/sc/source/core/tool/rechead.cxx +++ b/sc/source/core/tool/rechead.cxx @@ -49,7 +49,7 @@ ScMultipleReadHeader::ScMultipleReadHeader(SvStream& rNewStream) : sal_uInt32 nSizeTableLen; rStream.ReadUInt32( nSizeTableLen ); pBuf = new sal_uInt8[nSizeTableLen]; - rStream.Read( pBuf, nSizeTableLen ); + rStream.ReadBytes( pBuf, nSizeTableLen ); pMemStream = new SvMemoryStream( pBuf, nSizeTableLen, StreamMode::READ ); } @@ -122,7 +122,7 @@ ScMultipleWriteHeader::~ScMultipleWriteHeader() rStream.WriteUInt16( SCID_SIZES ); rStream.WriteUInt32( aMemStream.Tell() ); - rStream.Write( aMemStream.GetData(), aMemStream.Tell() ); + rStream.WriteBytes( aMemStream.GetData(), aMemStream.Tell() ); if ( nDataEnd - nDataPos != nDataSize ) // matched default ? { diff --git a/sc/source/filter/dif/difexp.cxx b/sc/source/filter/dif/difexp.cxx index b5c620f03007..a68c0d236f39 100644 --- a/sc/source/filter/dif/difexp.cxx +++ b/sc/source/filter/dif/difexp.cxx @@ -246,9 +246,9 @@ void ScFormatFilterPluginImpl::ScExportDif( SvStream& rOut, ScDocument* pDoc, aStrDelimEncoded, nPos+1+aStrDelimEncoded.getLength()); } // write byte encoded - rOut.Write(aStrDelimEncoded.getStr(), aStrDelimEncoded.getLength()); - rOut.Write(aStrEnc.getStr(), aStrEnc.getLength()); - rOut.Write(aStrDelimEncoded.getStr(), aStrDelimEncoded.getLength()); + rOut.WriteBytes(aStrDelimEncoded.getStr(), aStrDelimEncoded.getLength()); + rOut.WriteBytes(aStrEnc.getStr(), aStrEnc.getLength()); + rOut.WriteBytes(aStrDelimEncoded.getStr(), aStrDelimEncoded.getLength()); } rOut.WriteUniOrByteChar( '\n', eCharSet ); } diff --git a/sc/source/filter/excel/xeescher.cxx b/sc/source/filter/excel/xeescher.cxx index 8859baac227e..99ad68eea835 100644 --- a/sc/source/filter/excel/xeescher.cxx +++ b/sc/source/filter/excel/xeescher.cxx @@ -370,7 +370,7 @@ XclExpMsoDrawingGroup::XclExpMsoDrawingGroup( XclEscherEx& rEscherEx ) : 0x00, 0x08 }; mrEscherEx.AddAtom( sizeof( spnDffOpt ), ESCHER_OPT, 3, 3 ); - rDffStrm.Write( spnDffOpt, sizeof( spnDffOpt ) ); + rDffStrm.WriteBytes(spnDffOpt, sizeof(spnDffOpt)); // SPLITMENUCOLORS contains colors in toolbar static const sal_uInt8 spnDffSplitMenuColors[] = { @@ -378,7 +378,7 @@ XclExpMsoDrawingGroup::XclExpMsoDrawingGroup( XclEscherEx& rEscherEx ) : 0x17, 0x00, 0x00, 0x08, 0xF7, 0x00, 0x00, 0x10 }; mrEscherEx.AddAtom( sizeof( spnDffSplitMenuColors ), ESCHER_SplitMenuColors, 0, 4 ); - rDffStrm.Write( spnDffSplitMenuColors, sizeof( spnDffSplitMenuColors ) ); + rDffStrm.WriteBytes(spnDffSplitMenuColors, sizeof(spnDffSplitMenuColors)); // close the DGGCONTAINER mrEscherEx.CloseContainer(); diff --git a/sc/source/filter/excel/xestream.cxx b/sc/source/filter/excel/xestream.cxx index 171479c69cd0..99117a8ee119 100644 --- a/sc/source/filter/excel/xestream.cxx +++ b/sc/source/filter/excel/xestream.cxx @@ -231,7 +231,7 @@ sal_Size XclExpStream::Write( const void* pData, sal_Size nBytes ) } else { - nWriteRet = mrStrm.Write( pBuffer, nWriteLen ); + nWriteRet = mrStrm.WriteBytes(pBuffer, nWriteLen); bValid = (nWriteLen == nWriteRet); OSL_ENSURE( bValid, "XclExpStream::Write - stream write error" ); } @@ -242,7 +242,7 @@ sal_Size XclExpStream::Write( const void* pData, sal_Size nBytes ) } } else - nRet = mrStrm.Write( pData, nBytes ); + nRet = mrStrm.WriteBytes(pData, nBytes); } return nRet; } @@ -289,7 +289,7 @@ void XclExpStream::CopyFromStream(SvStream& rInStrm, sal_uInt64 const nBytes) while( bValid && (nBytesLeft > 0) ) { sal_Size nWriteLen = ::std::min<sal_Size>(nBytesLeft, nMaxBuffer); - rInStrm.Read( pBuffer.get(), nWriteLen ); + rInStrm.ReadBytes(pBuffer.get(), nWriteLen); sal_Size nWriteRet = Write( pBuffer.get(), nWriteLen ); bValid = (nWriteLen == nWriteRet); nBytesLeft -= nWriteRet; @@ -447,7 +447,7 @@ void XclExpStream::WriteRawZeroBytes( sal_Size nBytes ) nBytesLeft -= sizeof( nData ); } if( nBytesLeft ) - mrStrm.Write( &nData, nBytesLeft ); + mrStrm.WriteBytes(&nData, nBytesLeft); } XclExpBiff8Encrypter::XclExpBiff8Encrypter( const XclExpRoot& rRoot ) : @@ -623,7 +623,7 @@ void XclExpBiff8Encrypter::EncryptBytes( SvStream& rStrm, vector<sal_uInt8>& aBy OSL_ENSURE(bRet, "XclExpBiff8Encrypter::EncryptBytes: encryption failed!!"); (void) bRet; // to remove a silly compiler warning. - sal_Size nRet = rStrm.Write(&aBytes[nPos], nEncBytes); + sal_Size nRet = rStrm.WriteBytes(&aBytes[nPos], nEncBytes); OSL_ENSURE(nRet == nEncBytes, "XclExpBiff8Encrypter::EncryptBytes: fail to write to stream!!"); (void) nRet; // to remove a silly compiler warning. diff --git a/sc/source/filter/excel/xiescher.cxx b/sc/source/filter/excel/xiescher.cxx index 6d5421894e5f..aa32a829c74f 100644 --- a/sc/source/filter/excel/xiescher.cxx +++ b/sc/source/filter/excel/xiescher.cxx @@ -3675,9 +3675,9 @@ OUString XclImpDffConverter::ReadHlinkProperty( SvStream& rDffStrm ) const // copy from DFF stream to memory stream ::std::vector< sal_uInt8 > aBuffer( nBufferSize ); sal_uInt8* pnData = &aBuffer.front(); - if( rDffStrm.Read( pnData, nBufferSize ) == nBufferSize ) + if (rDffStrm.ReadBytes(pnData, nBufferSize) == nBufferSize) { - aMemStream.Write( pnData, nBufferSize ); + aMemStream.WriteBytes(pnData, nBufferSize); // create BIFF import stream to be able to use XclImpHyperlink class XclImpStream aXclStrm( aMemStream, GetRoot() ); diff --git a/sc/source/filter/excel/xiformula.cxx b/sc/source/filter/excel/xiformula.cxx index 9a919cbabc17..9a00004dd329 100644 --- a/sc/source/filter/excel/xiformula.cxx +++ b/sc/source/filter/excel/xiformula.cxx @@ -56,7 +56,7 @@ void XclImpFmlaCompImpl::CreateRangeList( { SvMemoryStream aMemStrm; aMemStrm.WriteUInt16( EXC_ID_EOF ).WriteUInt16( rXclTokArr.GetSize() ); - aMemStrm.Write( rXclTokArr.GetData(), rXclTokArr.GetSize() ); + aMemStrm.WriteBytes(rXclTokArr.GetData(), rXclTokArr.GetSize()); XclImpStream aFmlaStrm( aMemStrm, GetRoot() ); aFmlaStrm.StartNextRecord(); GetOldFmlaConverter().GetAbsRefs( rScRanges, aFmlaStrm, aFmlaStrm.GetRecSize() ); @@ -72,7 +72,7 @@ const ScTokenArray* XclImpFmlaCompImpl::CreateFormula( // evil hack! are we trying to phase out the old style formula converter ? SvMemoryStream aMemStrm; aMemStrm.WriteUInt16( EXC_ID_EOF ).WriteUInt16( rXclTokArr.GetSize() ); - aMemStrm.Write( rXclTokArr.GetData(), rXclTokArr.GetSize() ); + aMemStrm.WriteBytes(rXclTokArr.GetData(), rXclTokArr.GetSize()); XclImpStream aFmlaStrm( aMemStrm, GetRoot() ); aFmlaStrm.StartNextRecord(); const ScTokenArray* pArray = nullptr; diff --git a/sc/source/filter/excel/xistream.cxx b/sc/source/filter/excel/xistream.cxx index 7873eef9c3f4..51802a9fe091 100644 --- a/sc/source/filter/excel/xistream.cxx +++ b/sc/source/filter/excel/xistream.cxx @@ -98,7 +98,7 @@ sal_uInt16 XclImpDecrypter::Read( SvStream& rStrm, void* pData, sal_uInt16 nByte mnOldPos = rStrm.Tell(); } else - nRet = static_cast< sal_uInt16 >( rStrm.Read( pData, nBytes ) ); + nRet = static_cast<sal_uInt16>(rStrm.ReadBytes(pData, nBytes)); } return nRet; } @@ -187,7 +187,7 @@ void XclImpBiff5Decrypter::OnUpdate( sal_Size /*nOldStrmPos*/, sal_Size nNewStrm sal_uInt16 XclImpBiff5Decrypter::OnRead( SvStream& rStrm, sal_uInt8* pnData, sal_uInt16 nBytes ) { - sal_uInt16 nRet = static_cast< sal_uInt16 >( rStrm.Read( pnData, nBytes ) ); + sal_uInt16 nRet = static_cast<sal_uInt16>(rStrm.ReadBytes(pnData, nBytes)); maCodec.Decode( pnData, nRet ); return nRet; } @@ -291,7 +291,7 @@ sal_uInt16 XclImpBiff8Decrypter::OnRead( SvStream& rStrm, sal_uInt8* pnData, sal sal_uInt16 nDecBytes = ::std::min< sal_uInt16 >( nBytesLeft, nBlockLeft ); // read the block from stream - nRet = nRet + static_cast< sal_uInt16 >( rStrm.Read( pnCurrData, nDecBytes ) ); + nRet = nRet + static_cast<sal_uInt16>(rStrm.ReadBytes(pnCurrData, nDecBytes)); // decode the block inplace maCodec.Decode( pnCurrData, nDecBytes, pnCurrData, nDecBytes ); if( GetOffset( rStrm.Tell() ) == 0 ) @@ -734,7 +734,7 @@ sal_Size XclImpStream::CopyToStream( SvStream& rOutStrm, sal_Size nBytes ) nRet += Read( pnBuffer.get(), nReadSize ); // writing more bytes than read results in invalid memory access SAL_WARN_IF(nRet != nReadSize, "sc", "read less bytes than requested"); - rOutStrm.Write( pnBuffer.get(), nReadSize ); + rOutStrm.WriteBytes(pnBuffer.get(), nReadSize); nBytesLeft -= nReadSize; } } @@ -1047,7 +1047,7 @@ sal_uInt16 XclImpStream::ReadRawData( void* pData, sal_uInt16 nBytes ) if( mbUseDecr ) nRet = mxDecrypter->Read( mrStrm, pData, nBytes ); else - nRet = static_cast< sal_uInt16 >( mrStrm.Read( pData, nBytes ) ); + nRet = static_cast<sal_uInt16>(mrStrm.ReadBytes(pData, nBytes)); mnRawRecLeft = mnRawRecLeft - nRet; return nRet; } diff --git a/sc/source/filter/ftools/ftools.cxx b/sc/source/filter/ftools/ftools.cxx index 19616c52b664..4a2aafd38a4c 100644 --- a/sc/source/filter/ftools/ftools.cxx +++ b/sc/source/filter/ftools/ftools.cxx @@ -73,7 +73,7 @@ SEEEEEEE EEEEEEEE IMMMMMMM MMMMMMMM MMMMMMMM MMMMMMMM MMMMMMMM MMMMMMMM MMMMMMMM long double lfFakt = 256.0; sal_uInt8 pDouble10[ 10 ]; - rStrm.Read( pDouble10, 10 ); // Intel-10 in pDouble10 + rStrm.ReadBytes(pDouble10, 10); // Intel-10 in pDouble10 lfDouble = static_cast< long double >( pDouble10[ 7 ] ); // Byte 7 lfDouble *= lfFakt; diff --git a/sc/source/filter/lotus/filter.cxx b/sc/source/filter/lotus/filter.cxx index bc8780660297..be0bf63f509c 100644 --- a/sc/source/filter/lotus/filter.cxx +++ b/sc/source/filter/lotus/filter.cxx @@ -142,7 +142,7 @@ WKTYP ScanVersion(LotusContext &rContext, SvStream& aStream) if( nVersNr == 0x0004 && nRecLen == 26 ) { // 4 bytes of 26 read => skip 22 (read instead of seek to make IsEof() work just in case) sal_Char aDummy[22]; - aStream.Read( aDummy, 22 ); + aStream.ReadBytes(aDummy, 22); return aStream.IsEof() ? eWK_Error : eWK3; } break; diff --git a/sc/source/filter/lotus/lotform.cxx b/sc/source/filter/lotus/lotform.cxx index 1b80a498331f..29fe90997914 100644 --- a/sc/source/filter/lotus/lotform.cxx +++ b/sc/source/filter/lotus/lotform.cxx @@ -602,7 +602,7 @@ void LotusToSc::Convert( const ScTokenArray*& rpErg, sal_Int32& rRest ) std::unique_ptr<sal_Char[]> p(new (::std::nothrow) sal_Char[ nStrLen + 1 ]); if (p) { - aIn.Read( p.get(), nStrLen ); + aIn.ReadBytes(p.get(), nStrLen); p[ nStrLen ] = 0x00; DoFunc( ocNoName, nAnz, p.get() ); diff --git a/sc/source/filter/lotus/lotimpop.cxx b/sc/source/filter/lotus/lotimpop.cxx index fa937c510021..580fcd8fec3e 100644 --- a/sc/source/filter/lotus/lotimpop.cxx +++ b/sc/source/filter/lotus/lotimpop.cxx @@ -189,7 +189,7 @@ void ImportLotus::Userrange() Read( nRangeType ); sal_Char aBuffer[ 17 ]; - pIn->Read( aBuffer, 16 ); + pIn->ReadBytes(aBuffer, 16); aBuffer[ 16 ] = 0; OUString aName( aBuffer, strlen(aBuffer), eQuellChar ); diff --git a/sc/source/filter/lotus/op.cxx b/sc/source/filter/lotus/op.cxx index 56895530b5c4..9893dd3bd112 100644 --- a/sc/source/filter/lotus/op.cxx +++ b/sc/source/filter/lotus/op.cxx @@ -118,7 +118,7 @@ void OP_Label(LotusContext& rContext, SvStream& r, sal_uInt16 n) n -= (n > 5) ? 5 : n; std::unique_ptr<sal_Char[]> pText(new sal_Char[n + 1]); - r.Read( pText.get(), n ); + r.ReadBytes(pText.get(), n); pText[n] = 0; if (ValidColRow(nCol, nRow)) @@ -196,7 +196,7 @@ void OP_NamedRange(LotusContext& rContext, SvStream& r, sal_uInt16 /*n*/) sal_uInt16 nColSt, nRowSt, nColEnd, nRowEnd; sal_Char cPuffer[ 16+1 ]; - r.Read( cPuffer, 16 ); + r.ReadBytes(cPuffer, 16); cPuffer[ 16 ] = 0; r.ReadUInt16( nColSt ).ReadUInt16( nRowSt ).ReadUInt16( nColEnd ).ReadUInt16( nRowEnd ); @@ -235,7 +235,7 @@ void OP_SymphNamedRange(LotusContext& rContext, SvStream& r, sal_uInt16 /*n*/) sal_uInt8 nType; sal_Char cPuffer[ 16+1 ]; - r.Read( cPuffer, 16 ); + r.ReadBytes(cPuffer, 16); cPuffer[ 16 ] = 0; r.ReadUInt16( nColSt ).ReadUInt16( nRowSt ).ReadUInt16( nColEnd ).ReadUInt16( nRowEnd ).ReadUChar( nType ); @@ -357,7 +357,7 @@ void OP_Label123(LotusContext& rContext, SvStream& r, sal_uInt16 n) n -= (n > 4) ? 4 : n; std::unique_ptr<sal_Char[]> pText(new sal_Char[n + 1]); - r.Read( pText.get(), n ); + r.ReadBytes(pText.get(), n); pText[ n ] = 0; PutFormString(rContext, nCol, nRow, nTab, pText.get()); @@ -438,7 +438,7 @@ void OP_Note123(LotusContext& rContext, SvStream& r, sal_uInt16 n) n -= (n > 4) ? 4 : n; std::unique_ptr<sal_Char[]> pText(new sal_Char[n + 1]); - r.Read( pText.get(), n ); + r.ReadBytes(pText.get(), n); pText[ n ] = 0; OUString aNoteText(pText.get(), strlen(pText.get()), rContext.pLotusRoot->eCharsetQ); diff --git a/sc/source/filter/qpro/qpro.cxx b/sc/source/filter/qpro/qpro.cxx index 2cf780751233..153c693be79d 100644 --- a/sc/source/filter/qpro/qpro.cxx +++ b/sc/source/filter/qpro/qpro.cxx @@ -224,7 +224,7 @@ bool ScQProReader::nextRecord() void ScQProReader::readString( OUString &rString, sal_uInt16 nLength ) { std::unique_ptr<sal_Char[]> pText(new sal_Char[ nLength + 1 ]); - nLength = mpStream->Read(pText.get(), nLength); + nLength = mpStream->ReadBytes(pText.get(), nLength); pText[ nLength ] = 0; rString = OUString( pText.get(), strlen(pText.get()), mpStream->GetStreamCharSet() ); } diff --git a/sc/source/filter/starcalc/scflt.cxx b/sc/source/filter/starcalc/scflt.cxx index b4309cc76f8c..9c98fc4e115c 100644 --- a/sc/source/filter/starcalc/scflt.cxx +++ b/sc/source/filter/starcalc/scflt.cxx @@ -86,7 +86,7 @@ static void lcl_ReadFixedString( SvStream& rStream, void* pData, size_t nLen ) pBuf[0] = 0; else { - rStream.Read( pBuf, nLen); + rStream.ReadBytes(pBuf, nLen); pBuf[nLen-1] = 0; } } @@ -95,7 +95,7 @@ static void lcl_ReadFileHeader(SvStream& rStream, Sc10FileHeader& rFileHeader) { lcl_ReadFixedString( rStream, &rFileHeader.CopyRight, sizeof(rFileHeader.CopyRight)); rStream.ReadUInt16( rFileHeader.Version ); - rStream.Read(&rFileHeader.Reserved, sizeof(rFileHeader.Reserved)); + rStream.ReadBytes(&rFileHeader.Reserved, sizeof(rFileHeader.Reserved)); } static void lcl_ReadTabProtect(SvStream& rStream, Sc10TableProtect& rProtect) @@ -196,13 +196,13 @@ static void lcl_ReadPageFormat(SvStream& rStream, Sc10PageFormat& rFormat) rStream.ReadUChar( rFormat.TopBottomDir ); lcl_ReadFixedString( rStream, &rFormat.PrintAreaName, sizeof(rFormat.PrintAreaName)); lcl_ReadBlockRect(rStream, rFormat.PrintArea); - rStream.Read(&rFormat.PrnZoom, sizeof(rFormat.PrnZoom)); + rStream.ReadBytes(&rFormat.PrnZoom, sizeof(rFormat.PrnZoom)); rStream.ReadInt16( rFormat.FirstPageNo ); rStream.ReadInt16( rFormat.RowRepeatStart ); rStream.ReadInt16( rFormat.RowRepeatEnd ); rStream.ReadInt16( rFormat.ColRepeatStart ); rStream.ReadInt16( rFormat.ColRepeatEnd ); - rStream.Read(&rFormat.Reserved, sizeof(rFormat.Reserved)); + rStream.ReadBytes(&rFormat.Reserved, sizeof(rFormat.Reserved)); } static void lcl_ReadGraphHeader(SvStream& rStream, Sc10GraphHeader& rHeader) @@ -221,7 +221,7 @@ static void lcl_ReadGraphHeader(SvStream& rStream, Sc10GraphHeader& rHeader) rStream.ReadUChar( rHeader.IsTransparent ); lcl_ReadRGB(rStream, rHeader.FrameColor); lcl_ReadRGB(rStream, rHeader.BackColor); - rStream.Read(&rHeader.Reserved, sizeof(rHeader.Reserved)); + rStream.ReadBytes(&rHeader.Reserved, sizeof(rHeader.Reserved)); } static void lcl_ReadImageHeaer(SvStream& rStream, Sc10ImageHeader& rHeader) @@ -269,7 +269,7 @@ static void lcl_ReadChartSheetData(SvStream& rStream, Sc10ChartSheetData& rSheet rStream.ReadInt16( rSheetData.DataY1 ); rStream.ReadInt16( rSheetData.DataX2 ); rStream.ReadInt16( rSheetData.DataY2 ); - rStream.Read(&rSheetData.Reserved, sizeof(rSheetData.Reserved)); + rStream.ReadBytes(&rSheetData.Reserved, sizeof(rSheetData.Reserved)); } static void lcl_ReadChartTypeData(SvStream& rStream, Sc10ChartTypeData& rTypeData) @@ -311,7 +311,7 @@ static void lcl_ReadChartTypeData(SvStream& rStream, Sc10ChartTypeData& rTypeDat for (i = 0; i < 50; i++) lcl_ReadFixedString( rStream, &rTypeData.LabelText[i], sizeof(Sc10ChartText)); lcl_ReadFixedString( rStream, &rTypeData.LeftTitle, sizeof(rTypeData.LeftTitle)); - rStream.Read(&rTypeData.Reserved, sizeof(rTypeData.Reserved)); + rStream.ReadBytes(&rTypeData.Reserved, sizeof(rTypeData.Reserved)); } static double lcl_PascalToDouble(sal_Char* tp6) @@ -394,7 +394,7 @@ Sc10FontData::Sc10FontData(SvStream& rStream) sal_uInt16 nLen(0); rStream.ReadUInt16( nLen ); if (nLen < sizeof(FaceName)) - rStream.Read(FaceName, nLen); + rStream.ReadBytes(FaceName, nLen); else rStream.SetError(ERRCODE_IO_WRONGFORMAT); } @@ -427,17 +427,17 @@ Sc10NameData::Sc10NameData(SvStream& rStream) { sal_uInt8 nLen; rStream.ReadUChar( nLen ); - rStream.Read(Name, sizeof(Name) - 1); + rStream.ReadBytes(Name, sizeof(Name) - 1); if (nLen >= sizeof(Name)) nLen = sizeof(Name) - 1; Name[nLen] = 0; rStream.ReadUChar( nLen ); - rStream.Read(Reference, sizeof(Reference) - 1); + rStream.ReadBytes(Reference, sizeof(Reference) - 1); if (nLen >= sizeof(Reference)) nLen = sizeof(Reference) - 1; Reference[nLen] = 0; - rStream.Read(Reserved, sizeof(Reserved)); + rStream.ReadBytes(Reserved, sizeof(Reserved)); } Sc10NameCollection::Sc10NameCollection(SvStream& rStream) : @@ -487,7 +487,7 @@ Sc10PatternData::Sc10PatternData(SvStream& rStream) rStream.ReadUInt16( FrameColor ); rStream.ReadUInt16( Flags ); rStream.ReadUInt16( FormatFlags ); - rStream.Read(Reserved, sizeof(Reserved)); + rStream.ReadBytes(Reserved, sizeof(Reserved)); } Sc10PatternCollection::Sc10PatternCollection(SvStream& rStream) @@ -1012,10 +1012,10 @@ void Sc10Import::LoadFileHeader() void Sc10Import::LoadFileInfo() { Sc10FileInfo FileInfo; - rStream.Read(&FileInfo, sizeof(FileInfo)); + rStream.ReadBytes(&FileInfo, sizeof(FileInfo)); nError = rStream.GetError(); - // TODO: ? copy info + // TODO: ? copy info, byte swapping } void Sc10Import::LoadEditStateInfo() @@ -1033,7 +1033,7 @@ void Sc10Import::LoadEditStateInfo() rStream.ReadUInt16(EditStateInfo.DeltaY); rStream.ReadUInt16(EditStateInfo.DeltaZ); rStream.ReadUChar(EditStateInfo.DataBaseMode); - rStream.Read(EditStateInfo.Reserved, sizeof(EditStateInfo.Reserved)); + rStream.ReadBytes(EditStateInfo.Reserved, sizeof(EditStateInfo.Reserved)); assert(rStream.GetError() || rStream.Tell() == nOldPos + sizeof(Sc10EditStateInfo)); @@ -1066,7 +1066,7 @@ void Sc10Import::LoadScrZoom() { // TODO: unfortunately Zoom is a 6-byte TP real number (don't know how to translate that) sal_Char cZoom[6]; - rStream.Read(cZoom, sizeof(cZoom)); + rStream.ReadBytes(cZoom, sizeof(cZoom)); nError = rStream.GetError(); } @@ -1425,7 +1425,7 @@ void Sc10Import::LoadTables() sal_uInt8 nLen; rStream.ReadUChar( nLen ); - rStream.Read(TabName, sizeof(TabName) - 1); + rStream.ReadBytes(TabName, sizeof(TabName) - 1); if (nLen >= sizeof(TabName)) nLen = sizeof(TabName) - 1; TabName[nLen] = 0; @@ -1637,7 +1637,7 @@ void Sc10Import::LoadCol(SCCOL Col, SCTAB Tab) sal_uInt8 Len; sal_Char s[256]; rStream.ReadUChar( Len ); - rStream.Read(s, Len); + rStream.ReadBytes(s, Len); s[Len] = 0; pDoc->SetString( Col, static_cast<SCROW> (Row), Tab, SC10TOSTRING( s ) ); @@ -1649,7 +1649,7 @@ void Sc10Import::LoadCol(SCCOL Col, SCTAB Tab) sal_uInt8 Len; sal_Char s[256+1]; rStream.ReadUChar( Len ); - rStream.Read(&s[1], Len); + rStream.ReadBytes(&s[1], Len); s[0] = '='; s[Len + 1] = 0; ScFormulaCell* pCell = new ScFormulaCell( pDoc, ScAddress( Col, static_cast<SCROW> (Row), Tab ) ); @@ -1672,7 +1672,7 @@ void Sc10Import::LoadCol(SCCOL Col, SCTAB Tab) if (nNoteLen != 0) { std::unique_ptr<sal_Char[]> xNote(new sal_Char[nNoteLen+1]); - nNoteLen = rStream.Read(xNote.get(), nNoteLen); + nNoteLen = rStream.ReadBytes(xNote.get(), nNoteLen); xNote[nNoteLen] = 0; OUString aNoteText( SC10TOSTRING(xNote.get())); xNote.reset(); @@ -2308,7 +2308,7 @@ void Sc10Import::LoadObjects() sal_uInt16 nAnz; rStream.ReadUInt16( nAnz ); sal_Char Reserved[32]; - rStream.Read(Reserved, sizeof(Reserved)); + rStream.ReadBytes(Reserved, sizeof(Reserved)); nError = rStream.GetError(); if ((nAnz > 0) && (nError == 0)) { diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx index 163024e2d1b5..95bb72d16f6e 100644 --- a/sc/source/ui/docshell/docsh.cxx +++ b/sc/source/ui/docshell/docsh.cxx @@ -2138,11 +2138,11 @@ void ScDocShell::AsciiSave( SvStream& rStream, const ScImportOptions& rAsciiOpt // write byte encoded if ( bNeedQuotes ) - rStream.Write( + rStream.WriteBytes( aStrDelimEncoded.getStr(), aStrDelimEncoded.getLength()); - rStream.Write(aStrEnc.getStr(), aStrEnc.getLength()); + rStream.WriteBytes(aStrEnc.getStr(), aStrEnc.getLength()); if ( bNeedQuotes ) - rStream.Write( + rStream.WriteBytes( aStrDelimEncoded.getStr(), aStrDelimEncoded.getLength()); } } diff --git a/sc/source/ui/docshell/impex.cxx b/sc/source/ui/docshell/impex.cxx index 038a53dd3a01..193a6041b620 100644 --- a/sc/source/ui/docshell/impex.cxx +++ b/sc/source/ui/docshell/impex.cxx @@ -480,7 +480,7 @@ void ScImportExport::WriteUnicodeOrByteString( SvStream& rStrm, const OUString& if ( eEnc == RTL_TEXTENCODING_UNICODE ) { if ( !IsEndianSwap( rStrm ) ) - rStrm.Write( rString.getStr(), rString.getLength() * sizeof(sal_Unicode) ); + rStrm.WriteBytes(rString.getStr(), rString.getLength() * sizeof(sal_Unicode)); else { const sal_Unicode* p = rString.getStr(); diff --git a/sc/source/ui/unoobj/confuno.cxx b/sc/source/ui/unoobj/confuno.cxx index 129e0f29c40f..6f57f18264fc 100644 --- a/sc/source/ui/unoobj/confuno.cxx +++ b/sc/source/ui/unoobj/confuno.cxx @@ -424,7 +424,7 @@ uno::Any SAL_CALL ScDocumentConfiguration::getPropertyValue( const OUString& aPr sal_uInt32 nSize = aStream.Tell(); aStream.Seek ( STREAM_SEEK_TO_BEGIN ); uno::Sequence < sal_Int8 > aSequence( nSize ); - aStream.Read ( aSequence.getArray(), nSize ); + aStream.ReadBytes(aSequence.getArray(), nSize); aRet <<= aSequence; } else diff --git a/sd/source/filter/eppt/eppt.cxx b/sd/source/filter/eppt/eppt.cxx index 8c0871494e04..3ac5cfc5e647 100644 --- a/sd/source/filter/eppt/eppt.cxx +++ b/sd/source/filter/eppt/eppt.cxx @@ -180,7 +180,7 @@ void PPTWriter::ImplWriteSlide( sal_uInt32 nPageNum, sal_uInt32 nMasterNum, sal_ mpPptEscherEx->OpenContainer( EPP_Slide ); mpPptEscherEx->AddAtom( 24, EPP_SlideAtom, 2 ); mpStrm->WriteInt32( static_cast<sal_Int32>(rLayout.nLayout) ); - mpStrm->Write( rLayout.nPlaceHolder, 8 ); // placeholderIDs (8 parts) + mpStrm->WriteBytes(rLayout.nPlaceHolder, 8); // placeholderIDs (8 parts) mpStrm->WriteUInt32( nMasterNum | 0x80000000 ) // master ID (equals 0x80000000 on a master page) .WriteUInt32( nPageNum + 0x100 ) // notes ID (equals null if no notes are present) .WriteUInt16( nMode ) @@ -336,7 +336,7 @@ void PPTWriter::ImplWriteSlide( sal_uInt32 nPageNum, sal_uInt32 nMasterNum, sal_ EscherExAtom aMagic( aBinaryTagData10Atom, 0x2b00 ); aBinaryTagData10Atom.WriteUInt32( 0 ); } - aBinaryTagData10Atom.Write( amsofbtAnimGroup.GetData(), amsofbtAnimGroup.Tell() ); + aBinaryTagData10Atom.WriteBytes(amsofbtAnimGroup.GetData(), amsofbtAnimGroup.Tell()); { EscherExContainer aMagic2( aBinaryTagData10Atom, 0x2b02 ); } @@ -356,7 +356,7 @@ void PPTWriter::ImplWriteSlide( sal_uInt32 nPageNum, sal_uInt32 nMasterNum, sal_ } { EscherExAtom aBinaryTagData( *mpStrm, EPP_BinaryTagData ); - mpStrm->Write( aBinaryTagData10Atom.GetData(), aBinaryTagData10Atom.Tell() ); + mpStrm->WriteBytes(aBinaryTagData10Atom.GetData(), aBinaryTagData10Atom.Tell()); } } mpPptEscherEx->CloseContainer(); // EPP_Slide @@ -488,7 +488,7 @@ bool PPTWriter::ImplCreateCurrentUserStream() .WriteUChar( 0 ) // MinorVersion .WriteUInt16( 0 ); // Pad Word pUserName[ nLenOfUserName ] = 8; - mpCurUserStrm->Write( pUserName, nLenOfUserName + 1 ); + mpCurUserStrm->WriteBytes(pUserName, nLenOfUserName + 1); for ( sal_uInt32 i = 0x15 + nLenOfUserName; i < nSizeOfRecord; i++ ) { mpCurUserStrm->WriteUChar( 0 ); // pad bytes @@ -557,7 +557,7 @@ void PPTWriter::ImplWriteExtParaHeader( SvMemoryStream& rSt, sal_uInt32 nRef, sa .WriteUInt32( 8 ) .WriteUInt32( nSlideId ) .WriteUInt32( nInstance ); - aBuExOutlineStream.Write( rSt.GetData(), rSt.Tell() ); + aBuExOutlineStream.WriteBytes(rSt.GetData(), rSt.Tell()); } } @@ -1246,7 +1246,7 @@ void PPTWriter::ImplWriteVBA() nLen -= 8; mnVBAOleOfs = mpStrm->Tell(); mpPptEscherEx->BeginAtom(); - mpStrm->Write( static_cast<sal_Int8 const *>(mpVBA->GetData()) + 8, nLen ); + mpStrm->WriteBytes(static_cast<sal_Int8 const *>(mpVBA->GetData()) + 8, nLen); mpPptEscherEx->EndAtom( EPP_ExOleObjStg, 0, 1 ); } } @@ -1475,7 +1475,7 @@ extern "C" SAL_DLLPUBLIC_EXPORT sal_Bool SAL_CALL SaveVBA( SfxObjectShell& rDocS { char* pTemp = new char[ nLen ]; xTemp->Seek( STREAM_SEEK_TO_BEGIN ); - xTemp->Read( pTemp, nLen ); + xTemp->ReadBytes(pTemp, nLen); pBas = new SvMemoryStream( pTemp, nLen, StreamMode::READ ); pBas->ObjectOwnsMemory( true ); return true; diff --git a/sd/source/filter/eppt/epptso.cxx b/sd/source/filter/eppt/epptso.cxx index b12239b6986c..529be0030d54 100644 --- a/sd/source/filter/eppt/epptso.cxx +++ b/sd/source/filter/eppt/epptso.cxx @@ -251,12 +251,12 @@ sal_uInt32 PPTWriter::ImplProgBinaryTag( SvStream* pStrm ) if ( nPictureStreamSize ) { pStrm->WriteUInt32( 0xf | ( EPP_PST_ExtendedBuGraContainer << 16 ) ).WriteUInt32( nPictureStreamSize ); - pStrm->Write( aBuExPictureStream.GetData(), nPictureStreamSize ); + pStrm->WriteBytes(aBuExPictureStream.GetData(), nPictureStreamSize); } if ( nOutlineStreamSize ) { pStrm->WriteUInt32( 0xf | ( EPP_PST_ExtendedPresRuleContainer << 16 ) ).WriteUInt32( nOutlineStreamSize ); - pStrm->Write( aBuExOutlineStream.GetData(), nOutlineStreamSize ); + pStrm->WriteBytes(aBuExOutlineStream.GetData(), nOutlineStreamSize); } } return nSize; @@ -277,7 +277,7 @@ sal_uInt32 PPTWriter::ImplProgBinaryTagContainer( SvStream* pStrm, SvMemoryStrea sal_uInt32 nLen = pBinTagStrm->Tell(); nSize += nLen + 8; pStrm->WriteUInt32( EPP_BinaryTagData << 16 ).WriteUInt32( nLen ); - pStrm->Write( pBinTagStrm->GetData(), nLen ); + pStrm->WriteBytes(pBinTagStrm->GetData(), nLen); } else nSize += ImplProgBinaryTag( pStrm ); @@ -451,7 +451,7 @@ bool PPTWriter::ImplCloseDocument() .WriteUInt32( 4 ) .WriteUInt32( mnExEmbed ); mpPptEscherEx->InsertPersistOffset( EPP_Persist_ExObj, mpStrm->Tell() ); - mpStrm->Write( mpExEmbed->GetData(), nExEmbedSize ); + mpStrm->WriteBytes(mpExEmbed->GetData(), nExEmbedSize); } // CREATE ENVIRONMENT @@ -536,7 +536,7 @@ bool PPTWriter::ImplCloseDocument() .WriteUChar( 8 ) // ? .WriteInt16( 0 ); // ? - mpStrm->Write( aTxMasterStyleAtomStrm.GetData(), aTxMasterStyleAtomStrm.Tell() ); + mpStrm->WriteBytes(aTxMasterStyleAtomStrm.GetData(), aTxMasterStyleAtomStrm.Tell()); maSoundCollection.Write( *mpStrm ); mpPptEscherEx->WriteDrawingGroupContainer( *mpStrm ); ImplMasterSlideListContainer( mpStrm ); @@ -2122,7 +2122,7 @@ bool PPTWriter::ImplCreatePresentationPlaceholder( const bool bMasterPage, const mpStrm->WriteUInt32( ( ESCHER_ClientTextbox << 16 ) | 0xf ) .WriteUInt32( aClientTextBox.Tell() ); - mpStrm->Write( aClientTextBox.GetData(), aClientTextBox.Tell() ); + mpStrm->WriteBytes(aClientTextBox.GetData(), aClientTextBox.Tell()); } mpPptEscherEx->CloseContainer(); // ESCHER_SpContainer } @@ -3318,7 +3318,7 @@ void PPTWriter::ImplWritePage( const PHLayout& rLayout, EscherSolverContainer& a SvMemoryStream* pOut = aTextRule.pOut; if ( pOut ) { - pClientTextBox->Write( pOut->GetData(), pOut->Tell() ); + pClientTextBox->WriteBytes(pOut->GetData(), pOut->Tell()); delete pOut; aTextRule.pOut = nullptr; } @@ -3382,7 +3382,7 @@ void PPTWriter::ImplWritePage( const PHLayout& rLayout, EscherSolverContainer& a mpStrm->WriteUInt32( ( ESCHER_ClientData << 16 ) | 0xf ) .WriteUInt32( pClientData->Tell() ); - mpStrm->Write( pClientData->GetData(), pClientData->Tell() ); + mpStrm->WriteBytes(pClientData->GetData(), pClientData->Tell()); delete pClientData; pClientData = nullptr; } @@ -3391,7 +3391,7 @@ void PPTWriter::ImplWritePage( const PHLayout& rLayout, EscherSolverContainer& a mpStrm->WriteUInt32( ( ESCHER_ClientTextbox << 16 ) | 0xf ) .WriteUInt32( pClientTextBox->Tell() ); - mpStrm->Write( pClientTextBox->GetData(), pClientTextBox->Tell() ); + mpStrm->WriteBytes(pClientTextBox->GetData(), pClientTextBox->Tell()); delete pClientTextBox; pClientTextBox = nullptr; } @@ -3457,7 +3457,7 @@ void PPTWriter::ImplWritePage( const PHLayout& rLayout, EscherSolverContainer& a mpStrm->WriteUInt32( ( ESCHER_ClientTextbox << 16 ) | 0xf ) .WriteUInt32( pClientTextBox->Tell() ); - mpStrm->Write( pClientTextBox->GetData(), pClientTextBox->Tell() ); + mpStrm->WriteBytes(pClientTextBox->GetData(), pClientTextBox->Tell()); delete pClientTextBox; pClientTextBox = nullptr; @@ -3705,7 +3705,7 @@ void PPTWriter::ImplCreateTable( uno::Reference< drawing::XShape >& rXShape, Esc mpStrm->WriteUInt32( ( ESCHER_ClientData << 16 ) | 0xf ) .WriteUInt32( pClientData->Tell() ); - mpStrm->Write( pClientData->GetData(), pClientData->Tell() ); + mpStrm->WriteBytes(pClientData->GetData(), pClientData->Tell()); delete pClientData; pClientData = nullptr; } @@ -3720,7 +3720,7 @@ void PPTWriter::ImplCreateTable( uno::Reference< drawing::XShape >& rXShape, Esc mpStrm->WriteUInt32( ( ESCHER_ClientTextbox << 16 ) | 0xf ) .WriteUInt32( aClientTextBox.Tell() ); - mpStrm->Write( aClientTextBox.GetData(), aClientTextBox.Tell() ); + mpStrm->WriteBytes(aClientTextBox.GetData(), aClientTextBox.Tell()); xCellContainer.reset(); } } diff --git a/sd/source/filter/eppt/escherex.cxx b/sd/source/filter/eppt/escherex.cxx index 3365bcac51f8..580fbb2b2195 100644 --- a/sd/source/filter/eppt/escherex.cxx +++ b/sd/source/filter/eppt/escherex.cxx @@ -255,7 +255,7 @@ sal_uInt32 PptEscherEx::EnterGroup( Rectangle* pBoundRect, SvMemoryStream* pClie { mpOutStrm->WriteUInt32( ( ESCHER_ClientData << 16 ) | 0xf ) .WriteUInt32( nSize ); - mpOutStrm->Write( pClientData->GetData(), nSize ); + mpOutStrm->WriteBytes(pClientData->GetData(), nSize); } } CloseContainer(); // ESCHER_SpContainer diff --git a/sd/source/filter/eppt/pptexsoundcollection.cxx b/sd/source/filter/eppt/pptexsoundcollection.cxx index f7d8c160d860..5475c5ea175c 100644 --- a/sd/source/filter/eppt/pptexsoundcollection.cxx +++ b/sd/source/filter/eppt/pptexsoundcollection.cxx @@ -134,8 +134,8 @@ void ExSoundEntry::Write( SvStream& rSt, sal_uInt32 nId ) const while ( nBytesLeft ) { sal_uInt32 nToDo = ( nBytesLeft > 0x10000 ) ? 0x10000 : nBytesLeft; - pSourceFile->Read( pBuf, nToDo ); - rSt.Write( pBuf, nToDo ); + pSourceFile->ReadBytes(pBuf, nToDo); + rSt.WriteBytes(pBuf, nToDo); nBytesLeft -= nToDo; } delete pSourceFile; diff --git a/sd/source/filter/ppt/pptin.cxx b/sd/source/filter/ppt/pptin.cxx index bf856dbc923b..a8f38b4b5ced 100644 --- a/sd/source/filter/ppt/pptin.cxx +++ b/sd/source/filter/ppt/pptin.cxx @@ -1950,12 +1950,12 @@ OUString ImplSdPPTImport::ReadSound(sal_uInt32 nSoundRef) const sal_uInt32 nSoundDataLen = aSoundDataRecHd.nRecLen; sal_uInt8* pBuf = new sal_uInt8[ nSoundDataLen ]; - rStCtrl.Read( pBuf, nSoundDataLen ); + rStCtrl.ReadBytes(pBuf, nSoundDataLen); SvStream* pOStm = ::utl::UcbStreamHelper::CreateStream( aGalleryUserSound.GetMainURL( INetURLObject::NO_DECODE ), StreamMode::WRITE | StreamMode::TRUNC ); if( pOStm ) { - pOStm->Write( pBuf, nSoundDataLen ); + pOStm->WriteBytes(pBuf, nSoundDataLen); if( pOStm->GetError() == ERRCODE_NONE ) { diff --git a/sd/source/filter/ppt/propread.cxx b/sd/source/filter/ppt/propread.cxx index ad2b802fa843..9e7d16cb18a8 100644 --- a/sd/source/filter/ppt/propread.cxx +++ b/sd/source/filter/ppt/propread.cxx @@ -125,7 +125,7 @@ bool PropItem::Read( OUString& rString, sal_uInt32 nStringType, bool bAlign ) } else { - SvMemoryStream::Read( pString, nItemSize ); + SvMemoryStream::ReadBytes(pString, nItemSize); if ( pString[ nItemSize - 1 ] == 0 ) { if ( nItemSize > 1 ) @@ -201,7 +201,7 @@ PropItem& PropItem::operator=( PropItem& rPropItem ) mnTextEnc = rPropItem.mnTextEnc; sal_uInt32 nItemPos = rPropItem.Tell(); rPropItem.Seek( STREAM_SEEK_TO_END ); - SvMemoryStream::Write( rPropItem.GetData(), rPropItem.Tell() ); + SvMemoryStream::WriteBytes(rPropItem.GetData(), rPropItem.Tell()); rPropItem.Seek( nItemPos ); } return *this; @@ -238,7 +238,7 @@ bool Section::GetProperty( sal_uInt32 nId, PropItem& rPropItem ) { rPropItem.Clear(); rPropItem.SetTextEncoding( mnTextEnc ); - rPropItem.Write( (*iter)->mpBuf, (*iter)->mnSize ); + rPropItem.WriteBytes( (*iter)->mpBuf, (*iter)->mnSize ); rPropItem.Seek( STREAM_SEEK_TO_BEGIN ); return true; } @@ -311,7 +311,7 @@ void Section::GetDictionary(Dictionary& rDict) else { sal_Char* pString = new sal_Char[nSize]; - aStream.Read(pString, nSize); + aStream.ReadBytes(pString, nSize); aString = OUString(pString, lcl_getMaxSafeStrLen(nSize), mnTextEnc); delete[] pString; } @@ -461,7 +461,7 @@ void Section::Read( SotStorageStream *pStrm ) if( nPropSize > nSecSize - nSecOfs ) nPropSize = nSecSize - nSecOfs; sal_uInt8* pBuf = new sal_uInt8[ nPropSize ]; - nPropSize = pStrm->Read(pBuf, nPropSize); + nPropSize = pStrm->ReadBytes(pBuf, nPropSize); AddProperty( nPropId, pBuf, nPropSize ); delete[] pBuf; } @@ -522,7 +522,7 @@ void Section::Read( SotStorageStream *pStrm ) break; } sal_uInt8* pBuf = new sal_uInt8[ nSize ]; - nSize = pStrm->Read(pBuf, nSize); + nSize = pStrm->ReadBytes(pBuf, nSize); AddProperty( 0xffffffff, pBuf, nSize ); delete[] pBuf; } @@ -591,7 +591,7 @@ void PropRead::Read() if ( mnByteOrder == 0xfffe ) { sal_uInt8* pSectCLSID = new sal_uInt8[ 16 ]; - mpSvStream->Read( mApplicationCLSID, 16 ); + mpSvStream->ReadBytes(mApplicationCLSID, 16); mpSvStream->ReadUInt32( nSections ); if ( nSections > 2 ) // sj: PowerPoint documents are containing max 2 sections { @@ -599,7 +599,7 @@ void PropRead::Read() } else for ( sal_uInt32 i = 0; i < nSections; i++ ) { - mpSvStream->Read( pSectCLSID, 16 ); + mpSvStream->ReadBytes(pSectCLSID, 16); mpSvStream->ReadUInt32( nSectionOfs ); nCurrent = mpSvStream->Tell(); mpSvStream->Seek( nSectionOfs ); diff --git a/sd/source/filter/ppt/propread.hxx b/sd/source/filter/ppt/propread.hxx index 23115f0d500c..6f57574ab043 100644 --- a/sd/source/filter/ppt/propread.hxx +++ b/sd/source/filter/ppt/propread.hxx @@ -111,8 +111,6 @@ public: void SetTextEncoding( sal_uInt16 nTextEnc ){ mnTextEnc = nTextEnc; }; bool Read( OUString& rString, sal_uInt32 nType = VT_EMPTY, bool bDwordAlign = true ); PropItem& operator=( PropItem& rPropItem ); - - using SvStream::Read; }; class Section diff --git a/sd/source/ui/app/sdmod1.cxx b/sd/source/ui/app/sdmod1.cxx index 1e5dab96762a..9fe8646f35e5 100644 --- a/sd/source/ui/app/sdmod1.cxx +++ b/sd/source/ui/app/sdmod1.cxx @@ -807,7 +807,7 @@ OutlineToImpressFinalizer::OutlineToImpressFinalizer ( // Append the read bytes to the end of the memory stream. if (nReadByteCount > 0) { - mpStream->Write(pBuffer.get(), nReadByteCount); + mpStream->WriteBytes(pBuffer.get(), nReadByteCount); nReadPosition += nReadByteCount; } } diff --git a/sfx2/source/appl/xpackcreator.cxx b/sfx2/source/appl/xpackcreator.cxx index 9e952baf5696..49f34224a443 100644 --- a/sfx2/source/appl/xpackcreator.cxx +++ b/sfx2/source/appl/xpackcreator.cxx @@ -102,7 +102,7 @@ void SAL_CALL OPackageStructureCreator::convertToPackage( const OUString& aFolde if ( aSeq.getLength() < 32000 ) aSeq.realloc( 32000 ); - nRead = pTempStream->Read( aSeq.getArray(), 32000 ); + nRead = pTempStream->ReadBytes(aSeq.getArray(), 32000); if ( nRead < 32000 ) aSeq.realloc( nRead ); xTargetStream->writeBytes( aSeq ); diff --git a/sfx2/source/doc/docfile.cxx b/sfx2/source/doc/docfile.cxx index 2b6f96bb02a9..b64e8d317386 100644 --- a/sfx2/source/doc/docfile.cxx +++ b/sfx2/source/doc/docfile.cxx @@ -3418,9 +3418,9 @@ void SfxMedium::CreateTempFile( bool bReplace ) while( !pImpl->m_pInStream->IsEof() && nErr == ERRCODE_NONE ) { - sal_uInt32 nRead = pImpl->m_pInStream->Read( pBuf, 8192 ); + sal_uInt32 nRead = pImpl->m_pInStream->ReadBytes(pBuf, 8192); nErr = pImpl->m_pInStream->GetError(); - pImpl->m_pOutStream->Write( pBuf, nRead ); + pImpl->m_pOutStream->WriteBytes( pBuf, nRead ); } bTransferSuccess = true; diff --git a/sfx2/source/doc/oleprops.cxx b/sfx2/source/doc/oleprops.cxx index 2d1fe085654c..71e0e98b6bf7 100644 --- a/sfx2/source/doc/oleprops.cxx +++ b/sfx2/source/doc/oleprops.cxx @@ -277,7 +277,7 @@ OUString SfxOleStringHelper::ImplLoadString8( SvStream& rStrm ) const { // load character buffer ::std::vector< sal_Char > aBuffer( static_cast< size_t >( nSize + 1 ), 0 ); - rStrm.Read( &aBuffer.front(), static_cast< sal_Size >( nSize ) ); + rStrm.ReadBytes(&aBuffer.front(), static_cast<sal_Size>(nSize)); // create string from encoded character array aValue = OUString( &aBuffer.front(), strlen( &aBuffer.front() ), GetTextEncoding() ); } @@ -321,7 +321,7 @@ void SfxOleStringHelper::ImplSaveString8( SvStream& rStrm, const OUString& rValu sal_Int32 nSize = aEncoded.getLength() + 1; rStrm.WriteInt32( nSize ); // write character array with trailing NUL character - rStrm.Write(aEncoded.getStr(), aEncoded.getLength()); + rStrm.WriteBytes(aEncoded.getStr(), aEncoded.getLength()); rStrm.WriteUChar( 0 ); } @@ -629,7 +629,7 @@ void SfxOleThumbnailProperty::ImplSave( SvStream& rStrm ) // clipboard size: clip_format_tag + data_format_tag + bitmap_len sal_Int32 nClipSize = static_cast< sal_Int32 >( 4 + 4 + mData.getLength() ); rStrm.WriteInt32( nClipSize ).WriteInt32( CLIPFMT_WIN ).WriteInt32( CLIPDATAFMT_DIB ); - rStrm.Write( mData.getConstArray(), mData.getLength() ); + rStrm.WriteBytes(mData.getConstArray(), mData.getLength()); } else { @@ -655,7 +655,7 @@ void SfxOleBlobProperty::ImplLoad( SvStream& ) void SfxOleBlobProperty::ImplSave( SvStream& rStrm ) { if (IsValid()) { - rStrm.Write( mData.getConstArray(), mData.getLength() ); + rStrm.WriteBytes(mData.getConstArray(), mData.getLength()); } else { SAL_WARN( "sfx.doc", "SfxOleBlobProperty::ImplSave - invalid BLOB property" ); SetError( SVSTREAM_INVALID_ACCESS ); diff --git a/sfx2/source/doc/sfxbasemodel.cxx b/sfx2/source/doc/sfxbasemodel.cxx index 6be889c2b9dd..9f42bf8d7f81 100644 --- a/sfx2/source/doc/sfxbasemodel.cxx +++ b/sfx2/source/doc/sfxbasemodel.cxx @@ -1971,7 +1971,7 @@ Any SAL_CALL SfxBaseModel::getTransferData( const datatransfer::DataFlavor& aFla const sal_uInt32 nLen = pStream->Seek( STREAM_SEEK_TO_END ); Sequence< sal_Int8 > aSeq( nLen ); pStream->Seek( STREAM_SEEK_TO_BEGIN ); - pStream->Read( aSeq.getArray(), nLen ); + pStream->ReadBytes(aSeq.getArray(), nLen); delete pStream; if( aSeq.getLength() ) aAny <<= aSeq; diff --git a/sot/qa/cppunit/test_sot.cxx b/sot/qa/cppunit/test_sot.cxx index 8157bdf570e3..587f62c3afc4 100644 --- a/sot/qa/cppunit/test_sot.cxx +++ b/sot/qa/cppunit/test_sot.cxx @@ -62,7 +62,7 @@ namespace CPPUNIT_ASSERT_MESSAGE( "check size #2", xStream->remainingSize() == nSize ); // Read as much as we can, a corrupted FAT chain can cause real grief here - nReadableSize = xStream->Read( static_cast<void *>(pData), nSize ); + nReadableSize = xStream->ReadBytes(static_cast<void *>(pData), nSize); // fprintf(stderr, "readable size %d vs size %d remaining %d\n", nReadableSize, nSize, nReadableSize); } { // Read the data backwards as well @@ -73,7 +73,7 @@ namespace unsigned char c; xStream->Seek( i - 1 ); CPPUNIT_ASSERT_MESSAGE( "sot storage reading byte", - xStream->Read( &c, 1 ) == 1); + xStream->ReadBytes(&c, 1) == 1); CPPUNIT_ASSERT_MESSAGE( "mismatching data storage reading byte", pData[i - 1] == c ); } diff --git a/sot/source/sdstor/stgcache.cxx b/sot/source/sdstor/stgcache.cxx index 9360ce184f88..55f91f12bbb2 100644 --- a/sot/source/sdstor/stgcache.cxx +++ b/sot/source/sdstor/stgcache.cxx @@ -344,7 +344,7 @@ bool StgCache::Read( sal_Int32 nPage, void* pBuf ) { m_pStrm->Seek(nPos); } - m_pStrm->Read( pBuf, nBytes ); + m_pStrm->ReadBytes( pBuf, nBytes ); if ( 1 != nPg2 ) SetError( SVSTREAM_READ_ERROR ); else @@ -372,7 +372,7 @@ bool StgCache::Write( sal_Int32 nPage, void* pBuf ) { m_pStrm->Seek(nPos); } - sal_uLong nRes = m_pStrm->Write( pBuf, nBytes ); + sal_uLong nRes = m_pStrm->WriteBytes( pBuf, nBytes ); if( nRes != nBytes ) SetError( SVSTREAM_WRITE_ERROR ); else diff --git a/sot/source/sdstor/stgdir.cxx b/sot/source/sdstor/stgdir.cxx index 39845250c343..7f1230ccbbb1 100644 --- a/sot/source/sdstor/stgdir.cxx +++ b/sot/source/sdstor/stgdir.cxx @@ -443,9 +443,9 @@ sal_Int32 StgDirEntry::Read( void* p, sal_Int32 nLen ) if( nLen <= 0 ) return 0; if( m_pTmpStrm ) - nLen = m_pTmpStrm->Read( p, nLen ); + nLen = m_pTmpStrm->ReadBytes( p, nLen ); else if( m_pCurStrm ) - nLen = m_pCurStrm->Read( p, nLen ); + nLen = m_pCurStrm->ReadBytes( p, nLen ); else { OSL_ENSURE( m_pStgStrm, "The pointer may not be NULL!" ); @@ -479,7 +479,7 @@ sal_Int32 StgDirEntry::Write( const void* p, sal_Int32 nLen ) if( m_pTmpStrm ) { - nLen = m_pTmpStrm->Write( p, nLen ); + nLen = m_pTmpStrm->WriteBytes( p, nLen ); m_pStgStrm->GetIo().SetError( m_pTmpStrm->GetError() ); } else @@ -589,7 +589,7 @@ bool StgDirEntry::Strm2Tmp() nn = 4096; if( (sal_uLong) m_pStgStrm->Read( p, nn ) != nn ) break; - if( m_pTmpStrm->Write( p, nn ) != nn ) + if (m_pTmpStrm->WriteBytes( p, nn ) != nn) break; n -= nn; } @@ -647,7 +647,7 @@ bool StgDirEntry::Tmp2Strm() sal_uLong nn = n; if( nn > 4096 ) nn = 4096; - if( m_pTmpStrm->Read( p, nn ) != nn ) + if (m_pTmpStrm->ReadBytes( p, nn ) != nn) break; if( (sal_uLong) pNewStrm->Write( p, nn ) != nn ) break; diff --git a/sot/source/sdstor/stgelem.cxx b/sot/source/sdstor/stgelem.cxx index fc269006c334..12ed731d22bd 100644 --- a/sot/source/sdstor/stgelem.cxx +++ b/sot/source/sdstor/stgelem.cxx @@ -130,7 +130,7 @@ bool StgHeader::Load( StgIo& rIo ) bool StgHeader::Load( SvStream& r ) { r.Seek( 0L ); - r.Read( m_cSignature, 8 ); + r.ReadBytes( m_cSignature, 8 ); ReadClsId( r, m_aClsId ); // 08 Class ID r.ReadInt32( m_nVersion ) // 1A version number .ReadUInt16( m_nByteOrder ) // 1C Unicode byte order indicator @@ -158,7 +158,7 @@ bool StgHeader::Store( StgIo& rIo ) SvStream& r = *rIo.GetStrm(); r.Seek( 0L ); - r.Write( m_cSignature, 8 ); + r.WriteBytes( m_cSignature, 8 ); WriteClsId( r, m_aClsId ); // 08 Class ID r.WriteInt32( m_nVersion ) // 1A version number .WriteUInt16( m_nByteOrder ) // 1C Unicode byte order indicator diff --git a/sot/source/sdstor/stgole.cxx b/sot/source/sdstor/stgole.cxx index 886a7306822b..96769c9cd272 100644 --- a/sot/source/sdstor/stgole.cxx +++ b/sot/source/sdstor/stgole.cxx @@ -123,7 +123,7 @@ bool StgCompObjStream::Load() std::unique_ptr<sal_Char[]> p(new sal_Char[ nStrLen+1 ]); p[nStrLen] = 0; - if( Read( p.get(), nStrLen ) == nStrLen ) + if (ReadBytes( p.get(), nStrLen ) == nStrLen) { //The encoding here is "ANSI", which is pretty useless seeing as //the actual codepage used doesn't seem to be specified/stored diff --git a/sot/source/sdstor/stgstrms.cxx b/sot/source/sdstor/stgstrms.cxx index 4f749486c1cc..521c6cf5adde 100644 --- a/sot/source/sdstor/stgstrms.cxx +++ b/sot/source/sdstor/stgstrms.cxx @@ -1149,9 +1149,9 @@ bool StgTmpStrm::Copy( StgTmpStrm& rSrc ) while( n ) { const sal_uInt64 nn = std::min<sal_uInt64>(n, 4096); - if( rSrc.Read( p.get(), nn ) != nn ) + if (rSrc.ReadBytes( p.get(), nn ) != nn) break; - if( Write( p.get(), nn ) != nn ) + if (WriteBytes( p.get(), nn ) != nn) break; n -= nn; } @@ -1207,8 +1207,8 @@ void StgTmpStrm::SetSize(sal_uInt64 n) while( i ) { const sal_uInt64 nb = std::min<sal_uInt64>(i, 4096); - if( Read( p.get(), nb ) == nb - && s->Write( p.get(), nb ) == nb ) + if (ReadBytes(p.get(), nb) == nb + && s->WriteBytes(p.get(), nb) == nb) i -= nb; else break; @@ -1225,7 +1225,7 @@ void StgTmpStrm::SetSize(sal_uInt64 n) while (i) { const sal_uInt64 nb = std::min<sal_uInt64>(i, 4096); - if (s->Write(p.get(), nb) == nb) + if (s->WriteBytes(p.get(), nb) == nb) i -= nb; else break; // error @@ -1262,7 +1262,7 @@ sal_Size StgTmpStrm::GetData( void* pData, sal_Size n ) { if( m_pStrm ) { - n = m_pStrm->Read( pData, n ); + n = m_pStrm->ReadBytes( pData, n ); SetError( m_pStrm->GetError() ); return n; } @@ -1282,7 +1282,7 @@ sal_Size StgTmpStrm::PutData( const void* pData, sal_Size n ) } if( m_pStrm ) { - nNew = m_pStrm->Write( pData, n ); + nNew = m_pStrm->WriteBytes( pData, n ); SetError( m_pStrm->GetError() ); } else diff --git a/sot/source/sdstor/storage.cxx b/sot/source/sdstor/storage.cxx index b0ef715f8507..b332911cc7fa 100644 --- a/sot/source/sdstor/storage.cxx +++ b/sot/source/sdstor/storage.cxx @@ -201,9 +201,9 @@ void SotStorageStream::CopyTo( SotStorageStream * pDestStm ) std::unique_ptr<sal_uInt8[]> pMem(new sal_uInt8[ 8192 ]); sal_uLong nRead; - while( 0 != (nRead = Read( pMem.get(), 8192 )) ) + while (0 != (nRead = ReadBytes(pMem.get(), 8192))) { - if( nRead != pDestStm->Write( pMem.get(), nRead ) ) + if (nRead != pDestStm->WriteBytes(pMem.get(), nRead)) { SetError( SVSTREAM_GENERALERROR ); break; diff --git a/sot/source/sdstor/storinfo.cxx b/sot/source/sdstor/storinfo.cxx index d1ea728ec4d4..bfcd21410c49 100644 --- a/sot/source/sdstor/storinfo.cxx +++ b/sot/source/sdstor/storinfo.cxx @@ -36,7 +36,7 @@ SotClipboardFormatId ReadClipboardFormat( SvStream & rStm ) { // get a string name std::unique_ptr<sal_Char[]> p(new( ::std::nothrow ) sal_Char[ nLen ]); - if( p && rStm.Read( p.get(), nLen ) == (sal_uLong) nLen ) + if (p && rStm.ReadBytes(p.get(), nLen) == static_cast<sal_Size>(nLen)) { nFormat = SotExchange::RegisterFormatName(OUString(p.get(), nLen-1, RTL_TEXTENCODING_ASCII_US)); } diff --git a/sot/source/sdstor/ucbstorage.cxx b/sot/source/sdstor/ucbstorage.cxx index 0d2ef5d30850..d2badfed4f28 100644 --- a/sot/source/sdstor/ucbstorage.cxx +++ b/sot/source/sdstor/ucbstorage.cxx @@ -148,7 +148,7 @@ sal_Int32 SAL_CALL FileStreamWrapper_Impl::readBytes(Sequence< sal_Int8 >& aData if (aData.getLength() < nBytesToRead) aData.realloc(nBytesToRead); - sal_uInt32 nRead = m_pSvStream->Read(static_cast<void*>(aData.getArray()), nBytesToRead); + sal_uInt32 nRead = m_pSvStream->ReadBytes(static_cast<void*>(aData.getArray()), nBytesToRead); checkError(); // Wenn gelesene Zeichen < MaxLength, Sequence anpassen @@ -806,7 +806,7 @@ void UCBStorageStream_Impl::ReadSourceWriteTemporary() do { aReaded = m_rSource->readBytes( aData, 32000 ); - m_pStream->Write( aData.getArray(), aReaded ); + m_pStream->WriteBytes(aData.getArray(), aReaded); } while( aReaded == 32000 ); } catch (const Exception &e) @@ -839,7 +839,7 @@ sal_uInt64 UCBStorageStream_Impl::ReadSourceWriteTemporary(sal_uInt64 aLength) { sal_uLong aToCopy = min( aLength - nInd, 32000 ); aReaded = m_rSource->readBytes( aData, aToCopy ); - aResult += m_pStream->Write( aData.getArray(), aReaded ); + aResult += m_pStream->WriteBytes(aData.getArray(), aReaded); } if( aResult < aLength ) @@ -878,7 +878,7 @@ sal_uLong UCBStorageStream_Impl::GetData( void* pData, sal_uLong nSize ) // read data that is in temporary stream - aResult = m_pStream->Read( pData, nSize ); + aResult = m_pStream->ReadBytes( pData, nSize ); if( m_bSourceRead && aResult < nSize ) { // read the tail of the data from original stream @@ -891,7 +891,7 @@ sal_uLong UCBStorageStream_Impl::GetData( void* pData, sal_uLong nSize ) { Sequence<sal_Int8> aData( aToRead ); sal_uLong aReaded = m_rSource->readBytes( aData, aToRead ); - aResult += m_pStream->Write( static_cast<void*>(aData.getArray()), aReaded ); + aResult += m_pStream->WriteBytes(static_cast<void*>(aData.getArray()), aReaded); memcpy( pData, aData.getArray(), aReaded ); } catch (const Exception &e) @@ -918,7 +918,7 @@ sal_uLong UCBStorageStream_Impl::PutData( const void* pData, sal_uLong nSize ) if( !nSize || !Init() ) return 0; - sal_uLong aResult = m_pStream->Write( pData, nSize ); + sal_uLong aResult = m_pStream->WriteBytes( pData, nSize ); m_bModified = aResult > 0; diff --git a/starmath/source/mathtype.cxx b/starmath/source/mathtype.cxx index dd61e267fd63..a8add3b97762 100644 --- a/starmath/source/mathtype.cxx +++ b/starmath/source/mathtype.cxx @@ -1904,7 +1904,7 @@ bool MathType::ConvertFromStarMath( SfxMedium& rMedium ) 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; tools::SvRef<SotStorageStream> xStor( pStor->OpenSotStream("\1CompObj")); - xStor->Write(aCompObj,sizeof(aCompObj)); + xStor->WriteBytes(aCompObj, sizeof(aCompObj)); static sal_uInt8 const aOle[] = { 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, @@ -1912,7 +1912,7 @@ bool MathType::ConvertFromStarMath( SfxMedium& rMedium ) 0x00, 0x00, 0x00, 0x00 }; tools::SvRef<SotStorageStream> xStor2( pStor->OpenSotStream("\1Ole")); - xStor2->Write(aOle,sizeof(aOle)); + xStor2->WriteBytes(aOle, sizeof(aOle)); xStor.Clear(); xStor2.Clear(); diff --git a/starmath/source/smdetect.cxx b/starmath/source/smdetect.cxx index c16e4ded7ea0..058f387124b2 100644 --- a/starmath/source/smdetect.cxx +++ b/starmath/source/smdetect.cxx @@ -96,7 +96,7 @@ OUString SAL_CALL SmFilterDetect::detect( Sequence< PropertyValue >& lDescriptor aBuffer[nBufferSize] = 0; pInStrm->Seek( STREAM_SEEK_TO_BEGIN ); pInStrm->StartReadingUnicodeText( RTL_TEXTENCODING_DONTKNOW ); // avoid BOM marker - sal_uLong nBytesRead = pInStrm->Read( aBuffer, nBufferSize ); + sal_uLong nBytesRead = pInStrm->ReadBytes( aBuffer, nBufferSize ); if (nBytesRead >= 6) { bool bIsMathType = false; diff --git a/starmath/source/unomodel.cxx b/starmath/source/unomodel.cxx index 1207228d9bfc..2bd723eb489f 100644 --- a/starmath/source/unomodel.cxx +++ b/starmath/source/unomodel.cxx @@ -828,7 +828,7 @@ void SmModel::_getPropertyValues( const PropertyMapEntry **ppEntries, Any *pValu sal_uInt32 nSize = aStream.Tell(); aStream.Seek ( STREAM_SEEK_TO_BEGIN ); Sequence < sal_Int8 > aSequence ( nSize ); - aStream.Read ( aSequence.getArray(), nSize ); + aStream.ReadBytes(aSequence.getArray(), nSize); *pValue <<= aSequence; } } diff --git a/svgio/qa/cppunit/SvgImportTest.cxx b/svgio/qa/cppunit/SvgImportTest.cxx index 50bd744abc45..f98b6d6ec418 100644 --- a/svgio/qa/cppunit/SvgImportTest.cxx +++ b/svgio/qa/cppunit/SvgImportTest.cxx @@ -105,7 +105,7 @@ Primitive2DSequence Test::parseSvg(const char* aSource) SvFileStream aFileStream(aUrl, StreamMode::READ); sal_Size nSize = aFileStream.remainingSize(); std::unique_ptr<sal_Int8[]> pBuffer(new sal_Int8[nSize + 1]); - aFileStream.Read(pBuffer.get(), nSize); + aFileStream.ReadBytes(pBuffer.get(), nSize); pBuffer[nSize] = 0; Sequence<sal_Int8> aData(pBuffer.get(), nSize + 1); diff --git a/svl/source/filerec/filerec.cxx b/svl/source/filerec/filerec.cxx index b4febf724453..fcf83f3f1380 100644 --- a/svl/source/filerec/filerec.cxx +++ b/svl/source/filerec/filerec.cxx @@ -504,7 +504,7 @@ bool SfxMultiRecordReader::ReadHeader_Impl() _pContentOfs = new sal_uInt32[_nContentCount]; memset(_pContentOfs, 0, _nContentCount*sizeof(sal_uInt32)); #if defined(OSL_LITENDIAN) - _pStream->Read( _pContentOfs, sizeof(sal_uInt32)*_nContentCount ); + _pStream->ReadBytes( _pContentOfs, sizeof(sal_uInt32)*_nContentCount ); #else // (loop without braces) for ( sal_uInt16 n = 0; n < _nContentCount; ++n ) diff --git a/svl/source/items/lckbitem.cxx b/svl/source/items/lckbitem.cxx index e4bf31789ab4..9126580162e5 100644 --- a/svl/source/items/lckbitem.cxx +++ b/svl/source/items/lckbitem.cxx @@ -84,8 +84,8 @@ SfxPoolItem* SfxLockBytesItem::Create( SvStream &rStream, sal_uInt16 ) const nToRead = MAX_BUF; else nToRead = nSize - nActRead; - nActRead += rStream.Read( cTmpBuf, nToRead ); - aNewStream.Write( cTmpBuf, nToRead ); + nActRead += rStream.ReadBytes( cTmpBuf, nToRead ); + aNewStream.WriteBytes( cTmpBuf, nToRead ); } while( nSize > nActRead ); return new SfxLockBytesItem( Which(), aNewStream ); @@ -113,7 +113,7 @@ bool SfxLockBytesItem::PutValue( const css::uno::Any& rVal, sal_uInt8 ) if ( aSeq.getLength() ) { SvMemoryStream* pStream = new SvMemoryStream(); - pStream->Write( aSeq.getConstArray(), aSeq.getLength() ); + pStream->WriteBytes( aSeq.getConstArray(), aSeq.getLength() ); pStream->Seek(0); _xVal = new SvLockBytes( pStream, true ); diff --git a/svtools/source/graphic/provider.cxx b/svtools/source/graphic/provider.cxx index 321818fca2fe..fdfcbc50ae9a 100644 --- a/svtools/source/graphic/provider.cxx +++ b/svtools/source/graphic/provider.cxx @@ -830,7 +830,7 @@ void SAL_CALL GraphicProvider::storeGraphic( const uno::Reference< ::graphic::XG ( aFilterDataSeq.getLength() ? &aFilterDataSeq : nullptr ) ); } aMemStrm.Seek( STREAM_SEEK_TO_END ); - pOStm->Write( aMemStrm.GetData(), aMemStrm.Tell() ); + pOStm->WriteBytes( aMemStrm.GetData(), aMemStrm.Tell() ); } } } diff --git a/svtools/source/misc/embedhlp.cxx b/svtools/source/misc/embedhlp.cxx index 9c6d5d33b414..9a61bfc7cce0 100644 --- a/svtools/source/misc/embedhlp.cxx +++ b/svtools/source/misc/embedhlp.cxx @@ -584,7 +584,7 @@ SvStream* EmbeddedObjectRef::GetGraphicStream( bool bUpdate ) const do { nRead = xStream->readBytes ( aSequence, nConstBufferSize ); - pStream->Write( aSequence.getConstArray(), nRead ); + pStream->WriteBytes(aSequence.getConstArray(), nRead); } while ( nRead == nConstBufferSize ); pStream->Seek(0); diff --git a/svtools/source/misc/embedtransfer.cxx b/svtools/source/misc/embedtransfer.cxx index 2be8ce8779fb..f1a61847d4ac 100644 --- a/svtools/source/misc/embedtransfer.cxx +++ b/svtools/source/misc/embedtransfer.cxx @@ -135,7 +135,7 @@ bool SvEmbedTransferHelper::GetData( const css::datatransfer::DataFlavor& rFlavo css::uno::Sequence< sal_Int8 > aSeq( nLen ); pStream->Seek( STREAM_SEEK_TO_BEGIN ); - pStream->Read( aSeq.getArray(), nLen ); + pStream->ReadBytes(aSeq.getArray(), nLen); if ( bDeleteStream ) delete pStream; diff --git a/svtools/source/misc/imap.cxx b/svtools/source/misc/imap.cxx index 544a5ee22a9e..e37763b52a9a 100644 --- a/svtools/source/misc/imap.cxx +++ b/svtools/source/misc/imap.cxx @@ -953,7 +953,7 @@ void ImageMap::Read( SvStream& rIStm, const OUString& rBaseURL ) sal_uInt16 nCount; rIStm.SetEndian( SvStreamEndian::LITTLE ); - rIStm.Read( cMagic, sizeof( cMagic ) ); + rIStm.ReadBytes(cMagic, sizeof(cMagic)); if ( !memcmp( cMagic, IMAPMAGIC, sizeof( cMagic ) ) ) { diff --git a/svtools/source/misc/imap2.cxx b/svtools/source/misc/imap2.cxx index 282117562b42..01e534cf7507 100644 --- a/svtools/source/misc/imap2.cxx +++ b/svtools/source/misc/imap2.cxx @@ -505,7 +505,7 @@ sal_uLong ImageMap::ImpDetectFormat( SvStream& rIStm ) sal_uLong nRet = IMAP_FORMAT_BIN; char cMagic[6]; - rIStm.Read( cMagic, sizeof( cMagic ) ); + rIStm.ReadBytes(cMagic, sizeof(cMagic)); // if we do not have an internal formats // we check the format diff --git a/svtools/source/misc/transfer.cxx b/svtools/source/misc/transfer.cxx index 18305d8acd97..64e15ac6a4e4 100644 --- a/svtools/source/misc/transfer.cxx +++ b/svtools/source/misc/transfer.cxx @@ -864,7 +864,7 @@ bool TransferableHelper::SetObject( void* pUserObject, SotClipboardFormatId nUse Sequence< sal_Int8 > aSeq( nLen ); xStm->Seek( STREAM_SEEK_TO_BEGIN ); - xStm->Read( aSeq.getArray(), nLen ); + xStm->ReadBytes(aSeq.getArray(), nLen); if( nLen && ( SotExchange::GetFormat( rFlavor ) == SotClipboardFormatId::STRING ) ) { @@ -2037,7 +2037,7 @@ bool TransferableDataHelper::GetSotStorageStream( const DataFlavor& rFlavor, too if (aSeq.getLength()) { rxStream = new SotStorageStream( "" ); - rxStream->Write( aSeq.getConstArray(), aSeq.getLength() ); + rxStream->WriteBytes( aSeq.getConstArray(), aSeq.getLength() ); rxStream->Seek( 0 ); } diff --git a/svtools/source/urlobj/inetimg.cxx b/svtools/source/urlobj/inetimg.cxx index 4bcea5ae65d4..74b5beb1f728 100644 --- a/svtools/source/urlobj/inetimg.cxx +++ b/svtools/source/urlobj/inetimg.cxx @@ -43,9 +43,9 @@ void INetImage::Write( SvStream& rOStm, SotClipboardFormatId nFormat ) const OString sOut(OUStringToOString(sString, RTL_TEXTENCODING_UTF8)); - rOStm.Write(sOut.getStr(), sOut.getLength()); + rOStm.WriteBytes(sOut.getStr(), sOut.getLength()); static const sal_Char aEndChar[2] = { 0 }; - rOStm.Write( aEndChar, sizeof( aEndChar )); + rOStm.WriteBytes(aEndChar, sizeof(aEndChar)); } break; diff --git a/svx/source/gallery2/codec.cxx b/svx/source/gallery2/codec.cxx index 8357be0caa9c..aeb7a5dd0066 100644 --- a/svx/source/gallery2/codec.cxx +++ b/svx/source/gallery2/codec.cxx @@ -97,7 +97,7 @@ void GalleryCodec::Read( SvStream& rStmToRead ) if( 1 == nVersion ) { std::unique_ptr<sal_uInt8[]> pCompressedBuffer(new sal_uInt8[ nCompressedSize ]); - rStm.Read( pCompressedBuffer.get(), nCompressedSize ); + rStm.ReadBytes(pCompressedBuffer.get(), nCompressedSize); sal_uInt8* pInBuf = pCompressedBuffer.get(); std::unique_ptr<sal_uInt8[]> pOutBuf(new sal_uInt8[ nUnCompressedSize ]); sal_uInt8* pTmpBuf = pOutBuf.get(); @@ -137,7 +137,7 @@ void GalleryCodec::Read( SvStream& rStmToRead ) } while ( !bEndDecoding && ( pTmpBuf <= pLast ) ); - rStmToRead.Write( pOutBuf.get(), nUnCompressedSize ); + rStmToRead.WriteBytes(pOutBuf.get(), nUnCompressedSize); } else if( 2 == nVersion ) { diff --git a/svx/source/gallery2/galobj.cxx b/svx/source/gallery2/galobj.cxx index d83c1e747960..d4fc256e6ad1 100644 --- a/svx/source/gallery2/galobj.cxx +++ b/svx/source/gallery2/galobj.cxx @@ -297,7 +297,7 @@ void SgaObjectBmp::WriteData( SvStream& rOut, const OUString& rDestDir ) const // Set version SgaObject::WriteData( rOut, rDestDir ); char aDummy[ 10 ]; - rOut.Write( aDummy, 10 ); + rOut.WriteBytes(aDummy, 10); write_uInt16_lenPrefixed_uInt8s_FromOString(rOut, OString()); //dummy write_uInt16_lenPrefixed_uInt8s_FromOUString(rOut, aTitle, RTL_TEXTENCODING_UTF8); } diff --git a/svx/source/gallery2/galtheme.cxx b/svx/source/gallery2/galtheme.cxx index 02b3f3c3daa7..baa7ee1927c2 100644 --- a/svx/source/gallery2/galtheme.cxx +++ b/svx/source/gallery2/galtheme.cxx @@ -901,7 +901,7 @@ bool GalleryTheme::InsertGraphic( const Graphic& rGraphic, sal_uIntPtr nInsertPo { if( aGfxLink.GetDataSize() && aGfxLink.GetData() ) { - pOStm->Write( aGfxLink.GetData(), aGfxLink.GetDataSize() ); + pOStm->WriteBytes(aGfxLink.GetData(), aGfxLink.GetDataSize()); bRet = ( pOStm->GetError() == ERRCODE_NONE ); } else @@ -1360,7 +1360,7 @@ SvStream& GalleryTheme::WriteData( SvStream& rOStm ) const { std::unique_ptr<char[]> pReserve(new char[ nRest ]); memset( pReserve.get(), 0, nRest ); - rOStm.Write( pReserve.get(), nRest ); + rOStm.WriteBytes(pReserve.get(), nRest); } return rOStm; diff --git a/svx/source/svdraw/svdotxln.cxx b/svx/source/svdraw/svdotxln.cxx index 6ced8dc58c7f..b6846dbd81d3 100644 --- a/svx/source/svdraw/svdotxln.cxx +++ b/svx/source/svdraw/svdotxln.cxx @@ -227,7 +227,7 @@ bool SdrTextObj::LoadText(const OUString& rFileName, const OUString& /*rFilterNa char cRTF[5]; cRTF[4] = 0; - pIStm->Read(cRTF, 5); + pIStm->ReadBytes(cRTF, 5); bool bRTF = cRTF[0] == '{' && cRTF[1] == '\\' && cRTF[2] == 'r' && cRTF[3] == 't' && cRTF[4] == 'f'; diff --git a/svx/source/tbxctrls/Palette.cxx b/svx/source/tbxctrls/Palette.cxx index d5e2dd9b9505..9a5c76a7e610 100644 --- a/svx/source/tbxctrls/Palette.cxx +++ b/svx/source/tbxctrls/Palette.cxx @@ -78,7 +78,7 @@ void PaletteASE::LoadPalette() // Verify magic first 4 characters sal_Char cMagic[5] = {0}; - if ((aFile.Read(cMagic, 4) != 4) || (strncmp(cMagic, "ASEF", 4) != 0)) + if ((aFile.ReadBytes(cMagic, 4) != 4) || (strncmp(cMagic, "ASEF", 4) != 0)) { mbValidPalette = false; return; @@ -120,7 +120,7 @@ void PaletteASE::LoadPalette() } sal_Char cColorModel[5] = {0}; - aFile.Read(cColorModel, 4); + aFile.ReadBytes(cColorModel, 4); OString aColorModel(cColorModel); // r, g, and b are floats ranging from 0 to 1 float r = 0, g = 0, b = 0; diff --git a/svx/source/xml/xmlgrhlp.cxx b/svx/source/xml/xmlgrhlp.cxx index 9759e388aa8c..6422c161319e 100644 --- a/svx/source/xml/xmlgrhlp.cxx +++ b/svx/source/xml/xmlgrhlp.cxx @@ -114,7 +114,7 @@ SvXMLGraphicInputStream::SvXMLGraphicInputStream( const OUString& rGraphicId ) if( aGfxLink.GetDataSize() && aGfxLink.GetData() ) { - pStm->Write( aGfxLink.GetData(), aGfxLink.GetDataSize() ); + pStm->WriteBytes(aGfxLink.GetData(), aGfxLink.GetDataSize()); bRet = ( pStm->GetError() == 0 ); } else @@ -310,7 +310,7 @@ const GraphicObject& SvXMLGraphicOutputStream::GetGraphicObject() if( nStreamLen >= 2 ) { //read two byte - mpOStm->Read( sFirstBytes, 2 ); + mpOStm->ReadBytes(sFirstBytes, 2); if( sFirstBytes[0] == 0x1f && sFirstBytes[1] == 0x8b ) { @@ -563,7 +563,7 @@ bool SvXMLGraphicHelper::ImplWriteGraphic( const OUString& rPictureStorageName, std::unique_ptr<SvStream> pStream(utl::UcbStreamHelper::CreateStream( aStream.xStream )); if( bUseGfxLink && aGfxLink.GetDataSize() && aGfxLink.GetData() ) - pStream->Write( aGfxLink.GetData(), aGfxLink.GetDataSize() ); + pStream->WriteBytes(aGfxLink.GetData(), aGfxLink.GetDataSize()); else { if( aGraphic.GetType() == GraphicType::Bitmap ) @@ -592,12 +592,12 @@ bool SvXMLGraphicHelper::ImplWriteGraphic( const OUString& rPictureStorageName, sal_uInt32 nSize = pComment->GetDataSize(); const sal_uInt8* pData = pComment->GetData(); if ( nSize && pData ) - pStream->Write( pData, nSize ); + pStream->WriteBytes(pData, nSize); const MetaEPSAction* pAct = static_cast<const MetaEPSAction*>(rMtf.FirstAction()); const GfxLink& rLink = pAct->GetLink(); - pStream->Write( rLink.GetData(), rLink.GetDataSize() ); + pStream->WriteBytes(rLink.GetData(), rLink.GetDataSize()); } else rMtf.Write( *pStream ); diff --git a/svx/source/xoutdev/_xoutbmp.cxx b/svx/source/xoutdev/_xoutbmp.cxx index bbd06531fc45..7dea7331395d 100644 --- a/svx/source/xoutdev/_xoutbmp.cxx +++ b/svx/source/xoutdev/_xoutbmp.cxx @@ -162,7 +162,7 @@ sal_uInt16 XOutBitmap::WriteGraphic( const Graphic& rGraphic, OUString& rFileNam if(pOStm) { - pOStm->Write(aSvgDataPtr->getSvgDataArray().getConstArray(), aSvgDataPtr->getSvgDataArrayLength()); + pOStm->WriteBytes(aSvgDataPtr->getSvgDataArray().getConstArray(), aSvgDataPtr->getSvgDataArrayLength()); aMedium.Commit(); if(!aMedium.GetError()) @@ -207,7 +207,7 @@ sal_uInt16 XOutBitmap::WriteGraphic( const Graphic& rGraphic, OUString& rFileNam if( pOStm && aGfxLink.GetDataSize() && aGfxLink.GetData() ) { - pOStm->Write( aGfxLink.GetData(), aGfxLink.GetDataSize() ); + pOStm->WriteBytes(aGfxLink.GetData(), aGfxLink.GetDataSize()); aMedium.Commit(); if( !aMedium.GetError() ) diff --git a/sw/source/core/edit/edglss.cxx b/sw/source/core/edit/edglss.cxx index 52bd464c3f25..6f872ee5e1c6 100644 --- a/sw/source/core/edit/edglss.cxx +++ b/sw/source/core/edit/edglss.cxx @@ -320,7 +320,7 @@ bool SwEditShell::GetSelectedText( OUString &rBuf, int nHndlParaBrk ) aStream.Seek( 0 ); aStream.ResetError(); //endian specific?, yipes! - aStream.Read(pStr->buffer, nLen); + aStream.ReadBytes(pStr->buffer, nLen); rBuf = OUString(pStr, SAL_NO_ACQUIRE); } } diff --git a/sw/source/core/unocore/unoobj.cxx b/sw/source/core/unocore/unoobj.cxx index 658a5c219759..edd68067e43f 100644 --- a/sw/source/core/unocore/unoobj.cxx +++ b/sw/source/core/unocore/unoobj.cxx @@ -197,7 +197,7 @@ void SwUnoCursorHelper::GetTextFromPam(SwPaM & rPam, OUString & rBuffer) aStream.ResetError(); rtl_uString *pStr = rtl_uString_alloc(lUniLen); - aStream.Read(pStr->buffer, lUniLen * sizeof(sal_Unicode)); + aStream.ReadBytes(pStr->buffer, lUniLen * sizeof(sal_Unicode)); rBuffer = OUString(pStr, SAL_NO_ACQUIRE); } } diff --git a/sw/source/filter/ascii/parasc.cxx b/sw/source/filter/ascii/parasc.cxx index 8857990cbf33..090440a8d30d 100644 --- a/sw/source/filter/ascii/parasc.cxx +++ b/sw/source/filter/ascii/parasc.cxx @@ -264,7 +264,7 @@ sal_uLong SwASCIIParser::ReadChars() aEmpty.GetParaFlags() == rOpt.GetParaFlags()) { sal_uLong nLen, nOrig; - nOrig = nLen = rInput.Read(pArr, ASC_BUFFLEN); + nOrig = nLen = rInput.ReadBytes(pArr, ASC_BUFFLEN); rtl_TextEncoding eCharSet; bool bRet = SwIoSystem::IsDetectableText(pArr, nLen, &eCharSet, &bSwapUnicode); OSL_ENSURE(bRet, "Autodetect of text import without nag dialog must have failed"); @@ -310,7 +310,7 @@ sal_uLong SwASCIIParser::ReadChars() // Read a new block sal_uLong lGCount; if( SVSTREAM_OK != rInput.GetError() || 0 == (lGCount = - rInput.Read( pArr + nArrOffset, + rInput.ReadBytes( pArr + nArrOffset, ASC_BUFFLEN - nArrOffset ))) break; // break from the while loop diff --git a/sw/source/filter/ww8/WW8FFData.cxx b/sw/source/filter/ww8/WW8FFData.cxx index 59d011396c1b..a0cf156cb6dc 100644 --- a/sw/source/filter/ww8/WW8FFData.cxx +++ b/sw/source/filter/ww8/WW8FFData.cxx @@ -89,7 +89,7 @@ void WW8FFData::Write(SvStream * pDataStrm) 0,0,0,0,0,0,0,0,0,0,0,0,0,0 }; - pDataStrm->Write( aHeader, sizeof(aHeader) ); + pDataStrm->WriteBytes(aHeader, sizeof(aHeader)); sal_uInt8 aData[10] = { 0xff, 0xff, 0xff, 0xff, @@ -123,7 +123,7 @@ void WW8FFData::Write(SvStream * pDataStrm) aData[8] = ::sal::static_int_cast<sal_uInt8>(mnCheckboxHeight & 0xffff); aData[9] = ::sal::static_int_cast<sal_uInt8>(mnCheckboxHeight >> 8); - pDataStrm->Write(aData, sizeof(aData)); + pDataStrm->WriteBytes(aData, sizeof(aData)); WriteOUString(pDataStrm, msName, true); @@ -141,7 +141,7 @@ void WW8FFData::Write(SvStream * pDataStrm) if (mnType == 2) { sal_uInt8 aData1[2] = { 0xff, 0xff }; - pDataStrm->Write(aData1, sizeof(aData1)); + pDataStrm->WriteBytes(aData1, sizeof(aData1)); sal_uInt32 nListboxEntries = msListEntries.size(); pDataStrm->WriteUInt32( nListboxEntries ); diff --git a/sw/source/filter/ww8/WW8Sttbf.cxx b/sw/source/filter/ww8/WW8Sttbf.cxx index d5b24b21d5ff..c3d1132ca0b2 100644 --- a/sw/source/filter/ww8/WW8Sttbf.cxx +++ b/sw/source/filter/ww8/WW8Sttbf.cxx @@ -37,7 +37,7 @@ namespace ww8 sal_Size nRemainingSize = rSt.remainingSize(); nSize = std::min<sal_uInt32>(nRemainingSize, nSize); m_pData = o3tl::make_shared_array<sal_uInt8>(nSize); - mn_size = rSt.Read(m_pData.get(), nSize); + mn_size = rSt.ReadBytes(m_pData.get(), nSize); } OSL_ENSURE(mn_size == nSize, "short read in WW8Struct::WW8Struct"); } diff --git a/sw/source/filter/ww8/wrtw8esh.cxx b/sw/source/filter/ww8/wrtw8esh.cxx index 879f39a2d138..d1729a993c5e 100644 --- a/sw/source/filter/ww8/wrtw8esh.cxx +++ b/sw/source/filter/ww8/wrtw8esh.cxx @@ -230,11 +230,11 @@ void SwBasicEscherEx::WriteHyperlinkWithinFly( SvMemoryStream& rStrm, const SwFo nFlags |= WW8_HLINK_BODY; - tmpStrm.Write( aGuidFileMoniker,sizeof(aGuidFileMoniker) ); + tmpStrm.WriteBytes(aGuidFileMoniker, sizeof(aGuidFileMoniker)); tmpStrm.WriteUInt16( nLevel ); SwWW8Writer::WriteLong(tmpStrm, aFileName.getLength()+1); SwWW8Writer::WriteString8( tmpStrm, aFileName, true, RTL_TEXTENCODING_MS_1252 ); - tmpStrm.Write( aGuidFileTail,sizeof(aGuidFileTail) ); + tmpStrm.WriteBytes(aGuidFileTail, sizeof(aGuidFileTail)); //For UNICODE SwWW8Writer::WriteLong(tmpStrm, 2*aFileName.getLength()+6); @@ -244,7 +244,7 @@ void SwBasicEscherEx::WriteHyperlinkWithinFly( SvMemoryStream& rStrm, const SwFo } else if( eProtocol != INetProtocol::NotValid ) { - tmpStrm.Write( aGuidUrlMoniker,sizeof(aGuidUrlMoniker) ); + tmpStrm.WriteBytes(aGuidUrlMoniker, sizeof(aGuidUrlMoniker)); SwWW8Writer::WriteLong(tmpStrm, 2*(rUrl.getLength()+1)); SwWW8Writer::WriteString16(tmpStrm, rUrl, true); @@ -270,7 +270,7 @@ void SwBasicEscherEx::WriteHyperlinkWithinFly( SvMemoryStream& rStrm, const SwFo nFlags |= WW8_HLINK_MARK; } - rStrm.Write( aGuidStdLink,16 ); + rStrm.WriteBytes(aGuidStdLink, 16); rStrm .WriteUInt32( 2 ) .WriteUInt32( nFlags ); tmpStrm.Seek( STREAM_SEEK_TO_BEGIN ); @@ -278,8 +278,8 @@ void SwBasicEscherEx::WriteHyperlinkWithinFly( SvMemoryStream& rStrm, const SwFo if(nLen >0) { sal_uInt8* pBuffer = new sal_uInt8[ nLen ]; - tmpStrm.Read(pBuffer, nLen); - rStrm.Write( pBuffer, nLen ); + tmpStrm.ReadBytes(pBuffer, nLen); + rStrm.WriteBytes(pBuffer, nLen); delete[] pBuffer; } } diff --git a/sw/source/filter/ww8/wrtw8nds.cxx b/sw/source/filter/ww8/wrtw8nds.cxx index cb571892d4db..e0e70be32563 100644 --- a/sw/source/filter/ww8/wrtw8nds.cxx +++ b/sw/source/filter/ww8/wrtw8nds.cxx @@ -1022,13 +1022,13 @@ bool WW8AttributeOutput::StartURL( const OUString &rUrl, const OUString &rTarget 0x8C,0x82,0x00,0xAA,0x00,0x4B,0xA9,0x0B }; - m_rWW8Export.pDataStrm->Write( aURLData1, sizeof( aURLData1 ) ); + m_rWW8Export.pDataStrm->WriteBytes(aURLData1, sizeof(aURLData1)); /* Write HFD Structure */ sal_uInt8 nAnchor = 0x00; if ( !sMark.isEmpty() ) nAnchor = 0x08; - m_rWW8Export.pDataStrm->Write( &nAnchor, 1 ); // HFDBits - m_rWW8Export.pDataStrm->Write( MAGIC_A, sizeof(MAGIC_A) ); //clsid + m_rWW8Export.pDataStrm->WriteUChar(nAnchor); // HFDBits + m_rWW8Export.pDataStrm->WriteBytes(MAGIC_A, sizeof(MAGIC_A)); //clsid /* Write Hyperlink Object see [MS-OSHARED] spec*/ SwWW8Writer::WriteLong( *m_rWW8Export.pDataStrm, 0x00000002); @@ -1080,11 +1080,11 @@ bool WW8AttributeOutput::StartURL( const OUString &rUrl, const OUString &rTarget sURL = sURL.copy( sizeof(pSmb)-3 ).replaceAll( "/", "\\" ); } - m_rWW8Export.pDataStrm->Write( MAGIC_C, sizeof(MAGIC_C) ); + m_rWW8Export.pDataStrm->WriteBytes(MAGIC_C, sizeof(MAGIC_C)); SwWW8Writer::WriteLong( *m_rWW8Export.pDataStrm, sURL.getLength()+1 ); SwWW8Writer::WriteString8( *m_rWW8Export.pDataStrm, sURL, true, RTL_TEXTENCODING_MS_1252 ); - m_rWW8Export.pDataStrm->Write( MAGIC_D, sizeof( MAGIC_D ) ); + m_rWW8Export.pDataStrm->WriteBytes(MAGIC_D, sizeof(MAGIC_D)); SwWW8Writer::WriteLong( *m_rWW8Export.pDataStrm, 2*sURL.getLength() + 6 ); SwWW8Writer::WriteLong( *m_rWW8Export.pDataStrm, 2*sURL.getLength() ); @@ -1102,7 +1102,7 @@ bool WW8AttributeOutput::StartURL( const OUString &rUrl, const OUString &rTarget 0x8C,0x82,0x00,0xAA,0x00,0x4B,0xA9,0x0B }; - m_rWW8Export.pDataStrm->Write( MAGIC_B, sizeof(MAGIC_B) ); + m_rWW8Export.pDataStrm->WriteBytes(MAGIC_B, sizeof(MAGIC_B)); SwWW8Writer::WriteLong( *m_rWW8Export.pDataStrm, 2 * ( sURL.getLength() + 1 ) ); SwWW8Writer::WriteString16( *m_rWW8Export.pDataStrm, sURL, true ); } diff --git a/sw/source/filter/ww8/wrtw8num.cxx b/sw/source/filter/ww8/wrtw8num.cxx index b062c8a04436..6599d344e150 100644 --- a/sw/source/filter/ww8/wrtw8num.cxx +++ b/sw/source/filter/ww8/wrtw8num.cxx @@ -271,7 +271,7 @@ void WW8AttributeOutput::NumberingLevel( sal_uInt8 /*nLevel*/, // Write the rgbxchNums[9], positions of placeholders for paragraph // numbers in the text - m_rWW8Export.pTableStrm->Write( pNumLvlPos, WW8ListManager::nMaxLevel ); + m_rWW8Export.pTableStrm->WriteBytes(pNumLvlPos, WW8ListManager::nMaxLevel); // Type of the character between the bullet and the text m_rWW8Export.pTableStrm->WriteUChar( nFollow ); @@ -333,11 +333,11 @@ void WW8AttributeOutput::NumberingLevel( sal_uInt8 /*nLevel*/, pData += 5; Set_UInt16( pData, nListTabPos ); - m_rWW8Export.pTableStrm->Write( aPapSprms, sizeof( aPapSprms )); + m_rWW8Export.pTableStrm->WriteBytes(aPapSprms, sizeof(aPapSprms)); // write Chpx if( !aCharAtrs.empty() ) - m_rWW8Export.pTableStrm->Write( aCharAtrs.data(), aCharAtrs.size() ); + m_rWW8Export.pTableStrm->WriteBytes(aCharAtrs.data(), aCharAtrs.size()); // write the num string SwWW8Writer::WriteShort( *m_rWW8Export.pTableStrm, rNumberingString.getLength() ); diff --git a/sw/source/filter/ww8/wrtw8sty.cxx b/sw/source/filter/ww8/wrtw8sty.cxx index bc52d44c2ab6..e7121afd7aa0 100644 --- a/sw/source/filter/ww8/wrtw8sty.cxx +++ b/sw/source/filter/ww8/wrtw8sty.cxx @@ -393,7 +393,7 @@ void WW8AttributeOutput::EndStyle() p = &m_rWW8Export.pO->front() + nPOPosStdLen2; ShortToSVBT16( nLen, p ); // dito - m_rWW8Export.pTableStrm->Write( m_rWW8Export.pO->data(), m_rWW8Export.pO->size() ); // write it into the file + m_rWW8Export.pTableStrm->WriteBytes(m_rWW8Export.pO->data(), m_rWW8Export.pO->size()); m_rWW8Export.pO->clear(); } @@ -567,13 +567,11 @@ void WW8AttributeOutput::DefaultStyle( sal_uInt16 nStyle ) { if ( nStyle == 10 ) // Default Char-Style ( only WW ) { - sal_uInt16 n = 0; - m_rWW8Export.pTableStrm->Write( &n , 2 ); // empty Style + m_rWW8Export.pTableStrm->WriteUInt16(0); // empty Style } else { - sal_uInt16 n = 0; - m_rWW8Export.pTableStrm->Write( &n , 2 ); // empty Style + m_rWW8Export.pTableStrm->WriteUInt16(0); // empty Style } } @@ -661,7 +659,7 @@ void WW8AttributeOutput::StartStyles() 0x0F, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; - m_rWW8Export.pTableStrm->Write( &aStShi, sizeof( aStShi ) ); + m_rWW8Export.pTableStrm->WriteBytes(&aStShi, sizeof(aStShi)); } void WW8AttributeOutput::EndStyles( sal_uInt16 nNumberOfStyles ) @@ -780,7 +778,7 @@ wwFont::wwFont(const OUString &rFamilyName, FontPitch ePitch, FontFamily eFamily void wwFont::Write(SvStream *pTableStrm) const { - pTableStrm->Write(maWW8_FFN, sizeof(maWW8_FFN)); // fixed part + pTableStrm->WriteBytes(maWW8_FFN, sizeof(maWW8_FFN)); // fixed part // ab Ver8 sind folgende beiden Felder eingeschoben, // werden von uns ignoriert. //char panose[ 10 ]; // 0x6 PANOSE @@ -967,9 +965,7 @@ void WW8_WrPlc0::Write( SvStream& rStrm ) std::vector<sal_uLong>::const_iterator iter; for( iter = aPos.begin(); iter != aPos.end(); ++iter ) { - SVBT32 nP; - UInt32ToSVBT32( *iter, nP ); - rStrm.Write( nP, 4 ); + rStrm.WriteUInt32(*iter); } } @@ -1829,11 +1825,9 @@ void WW8_WrPlcSepx::WriteSepx( SvStream& rStrm ) const WW8_PdAttrDesc *const pA = rSectionAttribute.get(); if (pA->m_nLen && pA->m_pData != nullptr) { - SVBT16 nL; pA->m_nSepxFcPos = rStrm.Tell(); - ShortToSVBT16( pA->m_nLen, nL ); - rStrm.Write( nL, 2 ); - rStrm.Write( pA->m_pData.get(), pA->m_nLen ); + rStrm.WriteUInt16(pA->m_nLen); + rStrm.WriteBytes(pA->m_pData.get(), pA->m_nLen); } } } @@ -1849,9 +1843,7 @@ void WW8_WrPlcSepx::WritePlcSed( WW8Export& rWrt ) const for( i = 0; i <= aSects.size(); i++ ) { sal_uInt32 nP = aCps[i]; - SVBT32 nPos; - UInt32ToSVBT32( nP, nPos ); - rWrt.pTableStrm->Write( nPos, 4 ); + rWrt.pTableStrm->WriteUInt32(nP); } static WW8_SED aSed = {{4, 0},{0, 0, 0, 0},{0, 0},{0xff, 0xff, 0xff, 0xff}}; @@ -1860,7 +1852,7 @@ void WW8_WrPlcSepx::WritePlcSed( WW8Export& rWrt ) const { // Sepx-Pos UInt32ToSVBT32( rSectionAttribute->m_nSepxFcPos, aSed.fcSepx ); - rWrt.pTableStrm->Write( &aSed, sizeof( aSed ) ); + rWrt.pTableStrm->WriteBytes(&aSed, sizeof(aSed)); } rWrt.pFib->fcPlcfsed = nFcStart; rWrt.pFib->lcbPlcfsed = rWrt.pTableStrm->Tell() - nFcStart; diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx index 278cec8760e5..d1c073d2a140 100644 --- a/sw/source/filter/ww8/wrtww8.cxx +++ b/sw/source/filter/ww8/wrtww8.cxx @@ -857,7 +857,7 @@ void WW8_WrPlc1::Write( SvStream& rStrm ) for( i = 0; i < aPos.size(); ++i ) SwWW8Writer::WriteLong( rStrm, aPos[i] ); if( i ) - rStrm.Write( pData, (i-1) * nStructSiz ); + rStrm.WriteBytes(pData, (i-1) * nStructSiz); } // Class WW8_WrPlcField for fields @@ -953,10 +953,10 @@ void SwWW8Writer::FillCount( SvStream& rStrm, sal_uLong nCount ) while (nCount > 64) { - rStrm.Write( aNulls, 64 ); // in steps of 64-Byte + rStrm.WriteBytes(aNulls, 64); // in steps of 64-Byte nCount -= 64; } - rStrm.Write( aNulls, nCount ); // write the rest ( 0 .. 64 Bytes ) + rStrm.WriteBytes(aNulls, nCount); // write the rest (0 .. 64 Bytes) } sal_uLong SwWW8Writer::FillUntil( SvStream& rStrm, sal_uLong nEndPos ) @@ -1008,7 +1008,7 @@ void WW8_WrPlcPn::AppendFkpEntry(WW8_FC nEndFc,short nVarLen,const sal_uInt8* pS long nDataPos = rWrt.pDataStrm->Tell(); SwWW8Writer::WriteShort( *rWrt.pDataStrm, nVarLen ); - rWrt.pDataStrm->Write( pSprms, nVarLen ); + rWrt.pDataStrm->WriteBytes(pSprms, nVarLen); Set_UInt16( p, 0x6646 ); // set SprmCode Set_UInt32( p, nDataPos ); // set startpos (FC) in the datastream @@ -1279,7 +1279,7 @@ void WW8_WrFkp::Write( SvStream& rStrm, SwWW8WrGrf& rGrf ) UInt32ToSVBT32( rGrf.GetFPos(), nPos ); // FilePos the graphics memcpy( p, nPos, 4 ); // patch FilePos over the signature } - rStrm.Write( pFkp, 512 ); + rStrm.WriteBytes(pFkp, 512); } void WW8_WrFkp::MergeToNew( short& rVarLen, sal_uInt8 *& rpNewSprms ) @@ -1770,7 +1770,7 @@ void SwWW8Writer::WriteString16(SvStream& rStrm, const OUString& rStr, //vectors are guaranteed to have contiguous memory, so we can do //this while migrating away from WW8Bytes. Meyers Effective STL, item 16 if (!aBytes.empty()) - rStrm.Write(&aBytes[0], aBytes.size()); + rStrm.WriteBytes(&aBytes[0], aBytes.size()); } void SwWW8Writer::WriteString_xstz(SvStream& rStrm, const OUString& rStr, bool bAddZero) @@ -1780,7 +1780,7 @@ void SwWW8Writer::WriteString_xstz(SvStream& rStrm, const OUString& rStr, bool b SwWW8Writer::InsAsString16(aBytes, rStr); if (bAddZero) SwWW8Writer::InsUInt16(aBytes, 0); - rStrm.Write(&aBytes[0], aBytes.size()); + rStrm.WriteBytes(&aBytes[0], aBytes.size()); } void SwWW8Writer::WriteString8(SvStream& rStrm, const OUString& rStr, @@ -1793,7 +1793,7 @@ void SwWW8Writer::WriteString8(SvStream& rStrm, const OUString& rStr, //vectors are guaranteed to have contiguous memory, so we can do ////this while migrating away from WW8Bytes. Meyers Effective STL, item 16 if (!aBytes.empty()) - rStrm.Write(&aBytes[0], aBytes.size()); + rStrm.WriteBytes(&aBytes[0], aBytes.size()); } void WW8Export::WriteStringAsPara( const OUString& rText ) @@ -3058,10 +3058,10 @@ namespace for (sal_Size nI = 0, nBlock = 0; nI < nLen; nI += WW_BLOCKSIZE, ++nBlock) { sal_Size nBS = (nLen - nI > WW_BLOCKSIZE) ? WW_BLOCKSIZE : nLen - nI; - nBS = rIn.Read(in, nBS); + nBS = rIn.ReadBytes(in, nBS); rCtx.InitCipher(nBlock); rCtx.Encode(in, nBS, in, nBS); - rOut.Write(in, nBS); + rOut.WriteBytes(in, nBS); } } } @@ -3235,7 +3235,7 @@ void WW8Export::ExportDocument_Impl() pDataStrm = aTempData.GetStream( STREAM_READWRITE | StreamMode::SHARE_DENYWRITE ); sal_uInt8 aRC4EncryptionHeader[ 52 ] = {0}; - pTableStrm->Write( aRC4EncryptionHeader, 52 ); + pTableStrm->WriteBytes(aRC4EncryptionHeader, 52); } // Default: "Standard" @@ -3313,9 +3313,9 @@ void WW8Export::ExportDocument_Impl() sal_uInt8 pSaltDigest[16]; aCtx.GetEncryptKey( pDocId, pSaltData, pSaltDigest ); - pTableStrmTemp->Write( pDocId, 16 ); - pTableStrmTemp->Write( pSaltData, 16 ); - pTableStrmTemp->Write( pSaltDigest, 16 ); + pTableStrmTemp->WriteBytes(pDocId, 16); + pTableStrmTemp->WriteBytes(pSaltData, 16); + pTableStrmTemp->WriteBytes(pSaltDigest, 16); EncryptRC4(aCtx, GetWriter().Strm(), *pStrmTemp); @@ -3399,7 +3399,7 @@ void WW8Export::PrepareStorage() GetWriter().GetStorage().SetClass( aGName, SotClipboardFormatId::NONE, "Microsoft Word-Document"); tools::SvRef<SotStorageStream> xStor( GetWriter().GetStorage().OpenSotStream(sCompObj) ); - xStor->Write( pData, sizeof( pData ) ); + xStor->WriteBytes(pData, sizeof(pData)); SwDocShell* pDocShell = m_pDoc->GetDocShell (); OSL_ENSURE(pDocShell, "no SwDocShell"); @@ -3712,7 +3712,7 @@ void WW8Export::RestoreMacroCmds() sal_uInt8 *pBuffer = new sal_uInt8[pFib->lcbCmds]; bool bReadOk = checkRead(*pStream, pBuffer, pFib->lcbCmds); if (bReadOk) - pTableStrm->Write(pBuffer, pFib->lcbCmds); + pTableStrm->WriteBytes(pBuffer, pFib->lcbCmds); delete[] pBuffer; } @@ -3867,7 +3867,7 @@ void WW8Export::WriteFormData( const ::sw::mark::IFieldmark& rFieldmark ) int len = sizeof( aFieldData ); OSL_ENSURE( len == 0x44-sizeof(sal_uInt32), "SwWW8Writer::WriteFormData(..) - wrong aFieldData length" ); - pDataStrm->Write( aFieldData, len ); + pDataStrm->WriteBytes( aFieldData, len ); pDataStrm->WriteUInt32( aFieldHeader.version ).WriteUInt16( aFieldHeader.bits ).WriteUInt16( aFieldHeader.cch ).WriteUInt16( aFieldHeader.hps ); diff --git a/sw/source/filter/ww8/wrtww8gr.cxx b/sw/source/filter/ww8/wrtww8gr.cxx index 35122b2eeab1..e8b9aa0dce40 100644 --- a/sw/source/filter/ww8/wrtww8gr.cxx +++ b/sw/source/filter/ww8/wrtww8gr.cxx @@ -252,7 +252,7 @@ void WW8Export::OutputOLENode( const SwOLENode& rOLENode ) tools::SvRef<SotStorageStream> rObjInfoStream = xOleStg->OpenSotStream( aObjInfo ); if ( rObjInfoStream.Is() && !rObjInfoStream->GetError() ) { - rObjInfoStream->Write( pObjInfoData, sizeof( pObjInfoData ) ); + rObjInfoStream->WriteBytes(pObjInfoData, sizeof(pObjInfoData)); xOleStg->Commit(); } } @@ -650,7 +650,7 @@ void SwWW8WrGrf::WritePICFHeader(SvStream& rStrm, const ww8::Frame &rFly, Set_UInt16( pArr, nCropB ); // set dyaCropBottom } - rStrm.Write( aArr, nHdrLen ); + rStrm.WriteBytes(aArr, nHdrLen); } void SwWW8WrGrf::WriteGrfFromGrfNode(SvStream& rStrm, const SwGrfNode &rGrfNd, @@ -763,7 +763,7 @@ void SwWW8WrGrf::WritePICBulletFHeader(SvStream& rStrm, const Graphic &rGrf, Set_UInt16( pArr, nCropR ); // set dxaCropRight Set_UInt16( pArr, nCropB ); // set dyaCropBottom - rStrm.Write( aArr, nHdrLen ); + rStrm.WriteBytes(aArr, nHdrLen); } void SwWW8WrGrf::WriteGrfForBullet(SvStream& rStrm, const Graphic &rGrf, sal_uInt16 nWidth, sal_uInt16 nHeight) @@ -869,9 +869,7 @@ void SwWW8WrGrf::WriteGraphicNode(SvStream& rStrm, const GraphicDetails &rItem) sal_uInt32 nPos2 = rStrm.Tell(); // store the end rStrm.Seek( nPos ); - SVBT32 nLen; - UInt32ToSVBT32( nPos2 - nPos, nLen ); // calculate graphic length - rStrm.Write( nLen, 4 ); // patch it in the header + rStrm.WriteUInt32(nPos2 - nPos); // patch graphic length in the header rStrm.Seek( nPos2 ); // restore Pos } diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx index a987d145e4d1..d904b5661cb6 100644 --- a/sw/source/filter/ww8/ww8atr.cxx +++ b/sw/source/filter/ww8/ww8atr.cxx @@ -1583,7 +1583,7 @@ static void InsertSpecialChar( WW8Export& rWrt, sal_uInt8 c, const sal_uInt16 nEmptyHdrLen = 0x44; sal_uInt8 aEmptyHeader[ nEmptyHdrLen ] = { 0 }; aEmptyHeader[ 4 ] = 0x44; - rStrm.Write( aEmptyHeader, nEmptyHdrLen ); + rStrm.WriteBytes( aEmptyHeader, nEmptyHdrLen ); // writer fixed header const sal_uInt16 nFixHdrLen = 0x19; sal_uInt8 aFixHeader[ nFixHdrLen ] = @@ -1593,7 +1593,7 @@ static void InsertSpecialChar( WW8Export& rWrt, sal_uInt8 c, 0x0B, 0x02, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, }; - rStrm.Write( aFixHeader, nFixHdrLen ); + rStrm.WriteBytes( aFixHeader, nFixHdrLen ); // write reference string including length+1 sal_uInt32 nStrLen( pLinkStr->getLength() + 1 ); SwWW8Writer::WriteLong( rStrm, nStrLen ); @@ -1603,9 +1603,7 @@ static void InsertSpecialChar( WW8Export& rWrt, sal_uInt8 c, // write length of hyperlink data const sal_uInt32 nCurrPos = rStrm.Tell(); rStrm.Seek( nLinkPosInDataStrm ); - SVBT32 nLen; - UInt32ToSVBT32( nCurrPos - nLinkPosInDataStrm, nLen ); - rStrm.Write( nLen, 4 ); + rStrm.WriteUInt32(nCurrPos - nLinkPosInDataStrm); rStrm.Seek( nCurrPos ); // write attributes of hyperlink character 0x01 diff --git a/sw/source/filter/ww8/ww8graf2.cxx b/sw/source/filter/ww8/ww8graf2.cxx index e4a5f382c59b..04b5394408a5 100644 --- a/sw/source/filter/ww8/ww8graf2.cxx +++ b/sw/source/filter/ww8/ww8graf2.cxx @@ -444,10 +444,10 @@ void SwWW8ImplReader::PicRead(SvStream *pDataStream, WW8_PIC *pPic, { //Only the first 0x2e bytes are the same between version 6/7 and 8+ WW8_PIC_SHADOW aPicS; - pDataStream->Read( &aPicS, sizeof( aPicS ) ); + pDataStream->ReadBytes( &aPicS, sizeof( aPicS ) ); WW8PicShadowToReal( &aPicS, pPic ); for (WW8_BRC & i : pPic->rgbrc) - pDataStream->Read( &i, bVer67 ? 2 : 4); + pDataStream->ReadBytes(&i, bVer67 ? 2 : 4); pDataStream->ReadInt16( pPic->dxaOrigin ); pDataStream->ReadInt16( pPic->dyaOrigin ); if (!bVer67) diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx index 0719b4c79c28..c072c8346001 100644 --- a/sw/source/filter/ww8/ww8par.cxx +++ b/sw/source/filter/ww8/ww8par.cxx @@ -287,7 +287,7 @@ void SwWW8ImplReader::ReadEmbeddedData( SvMemoryStream& rStrm, SwDocShell* pDocS sal_uInt8 aGuid[16]; sal_uInt32 nFlags(0); - rStrm.Read(aGuid, 16); + rStrm.ReadBytes(aGuid, 16); rStrm.SeekRel( 4 ); rStrm.ReadUInt32( nFlags ); @@ -318,7 +318,7 @@ void SwWW8ImplReader::ReadEmbeddedData( SvMemoryStream& rStrm, SwDocShell* pDocS // file link or URL else if( ::get_flag( nFlags, WW8_HLINK_BODY ) ) { - rStrm.Read( aGuid, 16); + rStrm.ReadBytes(aGuid, 16); if( (memcmp(aGuid, aGuidFileMoniker, 16) == 0) ) { @@ -1157,9 +1157,9 @@ SdrObject* SwMSDffManager::ProcessObj(SvStream& rSt, ::std::vector< sal_uInt8 > aBuffer( nBufferSize ); sal_uInt8* pnData = &aBuffer.front(); sal_uInt8 nStreamSize; - if( pnData && rSt.Read( pnData, nBufferSize ) == nBufferSize ) + if (pnData && rSt.ReadBytes(pnData, nBufferSize) == nBufferSize) { - aMemStream.Write( pnData, nBufferSize ); + aMemStream.WriteBytes(pnData, nBufferSize); aMemStream.Seek( STREAM_SEEK_TO_END ); nStreamSize = aMemStream.Tell(); aMemStream.Seek( STREAM_SEEK_TO_BEGIN ); @@ -4689,8 +4689,8 @@ void SwWW8ImplReader::StoreMacroCmds() sal_uInt32 lcbCmds = std::min<sal_uInt32>(m_pWwFib->lcbCmds, m_pTableStream->remainingSize()); std::unique_ptr<sal_uInt8[]> xBuffer(new sal_uInt8[lcbCmds]); - m_pWwFib->lcbCmds = m_pTableStream->Read(xBuffer.get(), lcbCmds); - xOutStream->Write(xBuffer.get(), m_pWwFib->lcbCmds); + m_pWwFib->lcbCmds = m_pTableStream->ReadBytes(xBuffer.get(), lcbCmds); + xOutStream->WriteBytes(xBuffer.get(), m_pWwFib->lcbCmds); } catch (...) { @@ -5487,10 +5487,10 @@ namespace for (sal_Size nI = 0, nBlock = 0; nI < nLen; nI += WW_BLOCKSIZE, ++nBlock) { sal_Size nBS = (nLen - nI > WW_BLOCKSIZE) ? WW_BLOCKSIZE : nLen - nI; - nBS = rIn.Read(in, nBS); + nBS = rIn.ReadBytes(in, nBS); rCtx.InitCipher(nBlock); rCtx.Decode(in, nBS, in, nBS); - rOut.Write(in, nBS); + rOut.WriteBytes(in, nBS); } } @@ -5508,9 +5508,9 @@ namespace for (sal_Size nI = nSt; nI < nLen; nI += 0x4096) { sal_Size nBS = (nLen - nI > 0x4096 ) ? 0x4096 : nLen - nI; - nBS = rIn.Read(in, nBS); + nBS = rIn.ReadBytes(in, nBS); rCtx.Decode(in, nBS); - rOut.Write(in, nBS); + rOut.WriteBytes(in, nBS); } } @@ -5714,8 +5714,8 @@ sal_uLong SwWW8ImplReader::LoadThroughDecryption(WW8Glossary *pGloss) size_t nUnencryptedHdr = (8 == m_pWwFib->nVersion) ? 0x44 : 0x34; sal_uInt8 *pIn = new sal_uInt8[nUnencryptedHdr]; - nUnencryptedHdr = m_pStrm->Read(pIn, nUnencryptedHdr); - aDecryptMain.Write(pIn, nUnencryptedHdr); + nUnencryptedHdr = m_pStrm->ReadBytes(pIn, nUnencryptedHdr); + aDecryptMain.WriteBytes(pIn, nUnencryptedHdr); delete [] pIn; DecryptXOR(aCtx, *m_pStrm, aDecryptMain); @@ -5768,12 +5768,12 @@ sal_uLong SwWW8ImplReader::LoadThroughDecryption(WW8Glossary *pGloss) m_pStrm->Seek(0); sal_Size nUnencryptedHdr = 0x44; sal_uInt8 *pIn = new sal_uInt8[nUnencryptedHdr]; - nUnencryptedHdr = m_pStrm->Read(pIn, nUnencryptedHdr); + nUnencryptedHdr = m_pStrm->ReadBytes(pIn, nUnencryptedHdr); DecryptRC4(aCtx, *m_pStrm, aDecryptMain); aDecryptMain.Seek(0); - aDecryptMain.Write(pIn, nUnencryptedHdr); + aDecryptMain.WriteBytes(pIn, nUnencryptedHdr); delete [] pIn; pTempTable = MakeTemp(aDecryptTable); diff --git a/sw/source/filter/ww8/ww8par2.cxx b/sw/source/filter/ww8/ww8par2.cxx index 2259939b0e5f..77c9d319e446 100644 --- a/sw/source/filter/ww8/ww8par2.cxx +++ b/sw/source/filter/ww8/ww8par2.cxx @@ -3591,7 +3591,7 @@ void WW8RStyle::ImportSprms(sal_Size nPosFc, short nLen, bool bPap) if (checkSeek(*pStStrm, nPosFc)) { sal_uInt8 *pSprms = new sal_uInt8[nLen]; - nLen = pStStrm->Read(pSprms, nLen); + nLen = pStStrm->ReadBytes(pSprms, nLen); ImportSprms(pSprms, nLen, bPap); delete[] pSprms; } @@ -3602,7 +3602,7 @@ static inline short WW8SkipOdd(SvStream* pSt ) if ( pSt->Tell() & 0x1 ) { sal_uInt8 c; - return pSt->Read( &c, 1 ); + return pSt->ReadBytes( &c, 1 ); } return 0; } @@ -3612,7 +3612,7 @@ static inline short WW8SkipEven(SvStream* pSt ) if (!(pSt->Tell() & 0x1)) { sal_uInt8 c; - return pSt->Read( &c, 1 ); + return pSt->ReadBytes( &c, 1 ); } return 0; } diff --git a/sw/source/filter/ww8/ww8par3.cxx b/sw/source/filter/ww8/ww8par3.cxx index 4882660c1f68..7f2a884e0ee4 100644 --- a/sw/source/filter/ww8/ww8par3.cxx +++ b/sw/source/filter/ww8/ww8par3.cxx @@ -575,7 +575,7 @@ bool WW8ListManager::ReadLVL(SwNumFormat& rNumFormat, SfxItemSet*& rpItemSet, if( aLVL.nLenGrpprlPapx ) { sal_uInt8 aGrpprlPapx[ 255 ]; - if(aLVL.nLenGrpprlPapx != rSt.Read(&aGrpprlPapx,aLVL.nLenGrpprlPapx)) + if (aLVL.nLenGrpprlPapx != rSt.ReadBytes(&aGrpprlPapx, aLVL.nLenGrpprlPapx)) return false; // "sprmPDxaLeft" pap.dxaLeft;dxa;word; sal_uInt8* pSprm; @@ -675,7 +675,7 @@ bool WW8ListManager::ReadLVL(SwNumFormat& rNumFormat, SfxItemSet*& rpItemSet, { sal_uInt8 aGrpprlChpx[ 255 ]; memset(&aGrpprlChpx, 0, sizeof( aGrpprlChpx )); - if(aLVL.nLenGrpprlChpx != rSt.Read(&aGrpprlChpx, aLVL.nLenGrpprlChpx)) + if (aLVL.nLenGrpprlChpx != rSt.ReadBytes(&aGrpprlChpx, aLVL.nLenGrpprlChpx)) return false; //For i120928,parse the graphic info of bullets diff --git a/sw/source/filter/ww8/ww8par4.cxx b/sw/source/filter/ww8/ww8par4.cxx index 70932d4e2b10..7c02c895b8ee 100644 --- a/sw/source/filter/ww8/ww8par4.cxx +++ b/sw/source/filter/ww8/ww8par4.cxx @@ -131,7 +131,7 @@ static bool SwWw6ReadMetaStream(GDIMetaFile& rWMF, OLE_MFP* pMfp, STREAM_STD_READ ); SotStorageStream* pSt = xSrc2; pSt->SetEndian( SvStreamEndian::LITTLE ); - sal_uLong nRead = pSt->Read( pMfp, sizeof(*pMfp ) ); + size_t const nRead = pSt->ReadBytes(pMfp, sizeof(*pMfp)); // read mini-placable-header if (nRead != sizeof(*pMfp)) return false; @@ -185,7 +185,7 @@ static bool SwWw6ReadMacPICTStream(Graphic& rGraph, tools::SvRef<SotStorage>& rS SotStorageStream* pStp = xSrc4; pStp->SetEndian( SvStreamEndian::LITTLE ); sal_uInt8 aTestA[10]; // Does the 01Ole-stream even exist? - sal_uLong nReadTst = pStp->Read( aTestA, sizeof( aTestA ) ); + size_t const nReadTst = pStp->ReadBytes(aTestA, sizeof(aTestA)); if (nReadTst != sizeof(aTestA)) return false; diff --git a/sw/source/filter/ww8/ww8scan.cxx b/sw/source/filter/ww8/ww8scan.cxx index 6bf744e2669d..545605da7ea3 100644 --- a/sw/source/filter/ww8/ww8scan.cxx +++ b/sw/source/filter/ww8/ww8scan.cxx @@ -1674,7 +1674,7 @@ WW8ScannerBase::WW8ScannerBase( SvStream* pSt, SvStream* pTableSt, if (checkSeek(*pTableSt, pWwFib->fcAtrdExtra) && (pTableSt->remainingSize() >= pWwFib->lcbAtrdExtra)) { pExtendedAtrds = new sal_uInt8[pWwFib->lcbAtrdExtra]; - pWwFib->lcbAtrdExtra = pTableSt->Read(pExtendedAtrds, pWwFib->lcbAtrdExtra); + pWwFib->lcbAtrdExtra = pTableSt->ReadBytes(pExtendedAtrds, pWwFib->lcbAtrdExtra); } else pWwFib->lcbAtrdExtra = 0; @@ -1939,7 +1939,7 @@ WW8PLCFspecial::WW8PLCFspecial(SvStream* pSt, sal_uInt32 nFilePos, pPLCF_PosArray = new sal_Int32[ ( nPLCF + 3 ) / 4 ]; pPLCF_PosArray[0] = 0; - nPLCF = bValid ? pSt->Read(pPLCF_PosArray, nPLCF) : nValidMin; + nPLCF = bValid ? pSt->ReadBytes(pPLCF_PosArray, nPLCF) : nValidMin; nPLCF = std::max(nPLCF, nValidMin); @@ -2287,7 +2287,7 @@ WW8PLCFpcd::WW8PLCFpcd(SvStream* pSt, sal_uInt32 nFilePos, pPLCF_PosArray = new sal_Int32[ ( nPLCF + 3 ) / 4 ]; // Pointer to Pos-array pPLCF_PosArray[0] = 0; - nPLCF = bValid ? pSt->Read(pPLCF_PosArray, nPLCF) : nValidMin; + nPLCF = bValid ? pSt->ReadBytes(pPLCF_PosArray, nPLCF) : nValidMin; nPLCF = std::max(nPLCF, nValidMin); nIMax = ( nPLCF - 4 ) / ( 4 + nStruct ); @@ -2557,7 +2557,7 @@ WW8PLCFx_Fc_FKP::WW8Fkp::WW8Fkp(ww::WordVersion eVersion, SvStream* pSt, new sal_uInt8[aEntry.mnLen + nOrigLen]; aEntry.mbMustDelete = true; aEntry.mnLen = - pDataSt->Read(aEntry.mpData, aEntry.mnLen); + pDataSt->ReadBytes(aEntry.mpData, aEntry.mnLen); pDataSt->Seek( nCurr ); @@ -3456,7 +3456,7 @@ void WW8PLCFx_SEPX::GetSprms(WW8PLCFxDesc* p) nArrMax = nSprmSiz; // Get more memory pSprms = new sal_uInt8[nArrMax]; } - nSprmSiz = pStrm->Read(pSprms, nSprmSiz); // read Sprms + nSprmSiz = pStrm->ReadBytes(pSprms, nSprmSiz); // read Sprms p->nSprmsLen = nSprmSiz; p->pMemPos = pSprms; // return Position @@ -3871,7 +3871,7 @@ void WW8ReadSTTBF(bool bVer8, SvStream& rStrm, sal_uInt32 nStart, sal_Int32 nLen if (pExtraArray) { ww::bytes extraData(nExtraLen); - rStrm.Read(extraData.data(), nExtraLen); + rStrm.ReadBytes(extraData.data(), nExtraLen); pExtraArray->push_back(extraData); } else @@ -3927,7 +3927,7 @@ void WW8ReadSTTBF(bool bVer8, SvStream& rStrm, sal_uInt32 nStart, sal_Int32 nLen if (pExtraArray) { ww::bytes extraData(nExtraLen); - rStrm.Read(extraData.data(), nExtraLen); + rStrm.ReadBytes(extraData.data(), nExtraLen); pExtraArray->push_back(extraData); } else @@ -6006,7 +6006,7 @@ void WW8Fib::WriteHeader(SvStream& rStrm) // Marke: "rglw" Beginning of the array of longs Set_UInt32( pData, cbMac ); - rStrm.Write( pDataPtr, nUnencryptedHdr ); + rStrm.WriteBytes(pDataPtr, nUnencryptedHdr); delete[] pDataPtr; } @@ -6250,7 +6250,7 @@ void WW8Fib::Write(SvStream& rStrm) Set_UInt32( pData, 0); } - rStrm.Write( pDataPtr, fcMin - nUnencryptedHdr ); + rStrm.WriteBytes(pDataPtr, fcMin - nUnencryptedHdr); delete[] pDataPtr; } @@ -6839,7 +6839,7 @@ WW8Fonts::WW8Fonts( SvStream& rSt, WW8Fib& rFib ) rSt.SeekRel( 2 ); // read all font information - nFFn = rSt.Read(pA, nFFn); + nFFn = rSt.ReadBytes(pA, nFFn); sal_uInt8 * const pEnd = pA + nFFn; const sal_uInt16 nCalcMax = calcMaxFonts(pA, nFFn); @@ -7169,7 +7169,7 @@ WW8Dop::WW8Dop(SvStream& rSt, sal_Int16 nFib, sal_Int32 nPos, sal_uInt32 nSize) sal_uInt8* pData = pDataPtr; sal_uInt32 nRead = nMaxDopSize < nSize ? nMaxDopSize : nSize; - if (nSize < 2 || !checkSeek(rSt, nPos) || nRead != rSt.Read(pData, nRead)) + if (nSize < 2 || !checkSeek(rSt, nPos) || nRead != rSt.ReadBytes(pData, nRead)) nDopError = ERR_SWG_READ_ERROR; // report error else { @@ -7781,7 +7781,7 @@ void WW8Dop::Write(SvStream& rStrm, WW8Fib& rFib) const a16Bit = 0x0080; Set_UInt16(pData, a16Bit); } - rStrm.Write( aData, nLen ); + rStrm.WriteBytes(aData, nLen); } void WW8DopTypography::ReadFromMem(sal_uInt8 *&pData) @@ -8021,7 +8021,7 @@ bool checkSeek(SvStream &rSt, sal_uInt32 nOffset) bool checkRead(SvStream &rSt, void *pDest, sal_uInt32 nLength) { - return (rSt.Read(pDest, nLength) == static_cast<sal_Size>(nLength)); + return (rSt.ReadBytes(pDest, nLength) == static_cast<sal_Size>(nLength)); } #ifdef OSL_BIGENDIAN diff --git a/sw/source/ui/dialog/ascfldlg.cxx b/sw/source/ui/dialog/ascfldlg.cxx index beb36a6a5359..2e39a69b396c 100644 --- a/sw/source/ui/dialog/ascfldlg.cxx +++ b/sw/source/ui/dialog/ascfldlg.cxx @@ -95,7 +95,7 @@ SwAsciiFilterDlg::SwAsciiFilterDlg( vcl::Window* pParent, SwDocShell& rDocSh, { char aBuffer[ 4098 ]; const sal_uLong nOldPos = pStream->Tell(); - const sal_uLong nBytesRead = pStream->Read( aBuffer, 4096 ); + const size_t nBytesRead = pStream->ReadBytes(aBuffer, 4096); pStream->Seek( nOldPos ); if( nBytesRead <= 4096 ) diff --git a/sw/source/ui/uno/swdetect.cxx b/sw/source/ui/uno/swdetect.cxx index 9f6abf4248b8..765bd86a3f31 100644 --- a/sw/source/ui/uno/swdetect.cxx +++ b/sw/source/ui/uno/swdetect.cxx @@ -70,7 +70,7 @@ OUString SAL_CALL SwFilterDetect::detect( Sequence< PropertyValue >& lDescriptor pInStrm->Seek( STREAM_SEEK_TO_BEGIN ); const sal_uInt8 nBufSize = 3; sal_uInt8 nBuffer[ nBufSize ]; - if ( pInStrm->Read( nBuffer, nBufSize ) < nBufSize ) + if (pInStrm->ReadBytes(nBuffer, nBufSize) < nBufSize) return OUString(); bIsDetected = (nBuffer[0] == 0x9B && nBuffer[1] == 0xA5 && nBuffer[2] == 0x21) // WinWord 1 diff --git a/sw/source/uibase/dbui/mailmergehelper.cxx b/sw/source/uibase/dbui/mailmergehelper.cxx index e8d6c36e42be..3ef954f53d4e 100644 --- a/sw/source/uibase/dbui/mailmergehelper.cxx +++ b/sw/source/uibase/dbui/mailmergehelper.cxx @@ -715,7 +715,7 @@ uno::Any SwMailTransferable::getTransferData( const datatransfer::DataFlavor& /* aData.realloc(pStream->Tell()); pStream->Seek(0); sal_Int8 * pData = aData.getArray(); - pStream->Read( pData, aData.getLength() ); + pStream->ReadBytes( pData, aData.getLength() ); } aRet <<= aData; } diff --git a/sw/source/uibase/dochdl/swdtflvr.cxx b/sw/source/uibase/dochdl/swdtflvr.cxx index 8523785aed1d..c6c98aa34ddc 100644 --- a/sw/source/uibase/dochdl/swdtflvr.cxx +++ b/sw/source/uibase/dochdl/swdtflvr.cxx @@ -3725,7 +3725,7 @@ bool SwTrnsfrDdeLink::WriteData( SvStream& rStrm ) pMem[ nLen++ ] = 0; pMem[ nLen++ ] = 0; - rStrm.Write( pMem.get(), nLen ); + rStrm.WriteBytes( pMem.get(), nLen ); pMem.reset(); IDocumentMarkAccess* const pMarkAccess = pDocShell->GetDoc()->getIDocumentMarkAccess(); diff --git a/sw/source/uibase/uno/SwXDocumentSettings.cxx b/sw/source/uibase/uno/SwXDocumentSettings.cxx index d5168c179adc..db081c43bae7 100644 --- a/sw/source/uibase/uno/SwXDocumentSettings.cxx +++ b/sw/source/uibase/uno/SwXDocumentSettings.cxx @@ -954,7 +954,7 @@ void SwXDocumentSettings::_getSingleValue( const comphelper::PropertyInfo & rInf sal_uInt32 nSize = aStream.Tell(); aStream.Seek ( STREAM_SEEK_TO_BEGIN ); Sequence < sal_Int8 > aSequence( nSize ); - aStream.Read ( aSequence.getArray(), nSize ); + aStream.ReadBytes(aSequence.getArray(), nSize); rValue <<= aSequence; } else diff --git a/test/source/htmltesttools.cxx b/test/source/htmltesttools.cxx index f876dec101a2..f318edd21fe6 100644 --- a/test/source/htmltesttools.cxx +++ b/test/source/htmltesttools.cxx @@ -28,7 +28,7 @@ htmlDocPtr HtmlTestTools::parseHtmlStream(SvStream* pStream) { sal_Size nSize = pStream->remainingSize(); std::unique_ptr<sal_uInt8[]> pBuffer(new sal_uInt8[nSize + 1]); - pStream->Read(pBuffer.get(), nSize); + pStream->ReadBytes(pBuffer.get(), nSize); pBuffer[nSize] = 0; return htmlParseDoc(reinterpret_cast<xmlChar*>(pBuffer.get()), nullptr); } diff --git a/test/source/xmltesttools.cxx b/test/source/xmltesttools.cxx index 02ef2793686b..de5a3d9b0d38 100644 --- a/test/source/xmltesttools.cxx +++ b/test/source/xmltesttools.cxx @@ -44,7 +44,7 @@ xmlDocPtr XmlTestTools::parseXmlStream(SvStream* pStream) { sal_Size nSize = pStream->remainingSize(); std::unique_ptr<sal_uInt8[]> pBuffer(new sal_uInt8[nSize + 1]); - pStream->Read(pBuffer.get(), nSize); + pStream->ReadBytes(pBuffer.get(), nSize); pBuffer[nSize] = 0; return xmlParseDoc(reinterpret_cast<xmlChar*>(pBuffer.get())); } diff --git a/test/source/xmlwriter.cxx b/test/source/xmlwriter.cxx index d19284185153..f363378d57a1 100644 --- a/test/source/xmlwriter.cxx +++ b/test/source/xmlwriter.cxx @@ -27,7 +27,7 @@ namespace int lclWriteCallback(void* pContext, const char* sBuffer, int nLen) { SvStream* pStream = static_cast<SvStream*>(pContext); - return (int) pStream->Write(sBuffer, nLen); + return static_cast<int>(pStream->WriteBytes(sBuffer, nLen)); } int lclCloseCallback(void* pContext) diff --git a/tools/qa/cppunit/test_stream.cxx b/tools/qa/cppunit/test_stream.cxx index 71981ae70df4..c9c97bf0760d 100644 --- a/tools/qa/cppunit/test_stream.cxx +++ b/tools/qa/cppunit/test_stream.cxx @@ -123,7 +123,7 @@ namespace aMemStream.Seek(0); CPPUNIT_ASSERT(aMemStream.good()); - sal_Size nRet = aMemStream.Read(buffer, sizeof(buffer)); + sal_Size nRet = aMemStream.ReadBytes(buffer, sizeof(buffer)); CPPUNIT_ASSERT(nRet == 3); CPPUNIT_ASSERT(!aMemStream.good()); CPPUNIT_ASSERT(!aMemStream.bad()); diff --git a/tools/source/generic/poly.cxx b/tools/source/generic/poly.cxx index f8df46df2057..6d70f8af0760 100644 --- a/tools/source/generic/poly.cxx +++ b/tools/source/generic/poly.cxx @@ -1587,7 +1587,7 @@ SvStream& ReadPolygon( SvStream& rIStream, tools::Polygon& rPoly ) #else if ( rIStream.GetEndian() == SvStreamEndian::LITTLE ) #endif - rIStream.Read( rPoly.mpImplPolygon->mpPointAry, nPoints*sizeof(Point) ); + rIStream.ReadBytes(rPoly.mpImplPolygon->mpPointAry, nPoints*sizeof(Point)); else #endif { @@ -1622,7 +1622,7 @@ SvStream& WritePolygon( SvStream& rOStream, const tools::Polygon& rPoly ) #endif { if ( nPoints ) - rOStream.Write( rPoly.mpImplPolygon->mpPointAry, nPoints*sizeof(Point) ); + rOStream.WriteBytes(rPoly.mpImplPolygon->mpPointAry, nPoints*sizeof(Point)); } else #endif @@ -1648,7 +1648,7 @@ void Polygon::ImplRead( SvStream& rIStream ) if ( bHasPolyFlags ) { mpImplPolygon->mpFlagAry = new sal_uInt8[ mpImplPolygon->mnPoints ]; - rIStream.Read( mpImplPolygon->mpFlagAry, mpImplPolygon->mnPoints ); + rIStream.ReadBytes(mpImplPolygon->mpFlagAry, mpImplPolygon->mnPoints); } } @@ -1666,7 +1666,7 @@ void Polygon::ImplWrite( SvStream& rOStream ) const rOStream.WriteBool(bHasPolyFlags); if ( bHasPolyFlags ) - rOStream.Write( mpImplPolygon->mpFlagAry, mpImplPolygon->mnPoints ); + rOStream.WriteBytes( mpImplPolygon->mpFlagAry, mpImplPolygon->mnPoints ); } void Polygon::Write( SvStream& rOStream ) const diff --git a/tools/source/inet/inetstrm.cxx b/tools/source/inet/inetstrm.cxx index af0e8e494307..f1082a1f0486 100644 --- a/tools/source/inet/inetstrm.cxx +++ b/tools/source/inet/inetstrm.cxx @@ -81,7 +81,7 @@ int INetMIMEMessageStream::GetBodyLine(sal_Char* pData, sal_uIntPtr nSize) if (pMsgStrm == nullptr) pMsgStrm = new SvStream (pSourceMsg->GetDocumentLB()); - sal_uIntPtr nRead = pMsgStrm->Read(pWBuf, (pWEnd - pWBuf)); + sal_uIntPtr nRead = pMsgStrm->ReadBytes(pWBuf, (pWEnd - pWBuf)); pWBuf += nRead; } diff --git a/tools/source/rc/resmgr.cxx b/tools/source/rc/resmgr.cxx index fb3ed921d168..078ad5bfbcf4 100644 --- a/tools/source/rc/resmgr.cxx +++ b/tools/source/rc/resmgr.cxx @@ -489,13 +489,13 @@ bool InternalResMgr::Create() fRes, 0 ) ) != (RSHEADER_TYPE *)-1) */ pStm->SeekRel( - (int)sizeof( lContLen ) ); - pStm->Read( &lContLen, sizeof( lContLen ) ); - // is bigendian, swab to the right endian + pStm->ReadBytes( &lContLen, sizeof( lContLen ) ); + // file is bigendian but SvStreamEndian not set, swab to the right endian lContLen = ResMgr::GetLong( &lContLen ); pStm->SeekRel( -lContLen ); // allocate stored ImpContent data (12 bytes per unit) sal_uInt8* pContentBuf = static_cast<sal_uInt8*>(rtl_allocateMemory( lContLen )); - pStm->Read( pContentBuf, lContLen ); + pStm->ReadBytes( pContentBuf, lContLen ); // allocate ImpContent space (sizeof(ImpContent) per unit, not necessarily 12) pContent = static_cast<ImpContent *>(rtl_allocateMemory( sizeof(ImpContent)*lContLen/12 )); // Shorten to number of ImpContent @@ -590,11 +590,11 @@ void* InternalResMgr::LoadGlobalRes( RESOURCE_TYPE nRT, sal_uInt32 nId, --pLast; pStm->Seek( pLast->nOffset ); RSHEADER_TYPE aHdr; - pStm->Read( &aHdr, sizeof( aHdr ) ); + pStm->ReadBytes( &aHdr, sizeof( aHdr ) ); nSize = pLast->nOffset + aHdr.GetGlobOff() - nOffCorrection; pStringBlock = static_cast<sal_uInt8*>(rtl_allocateMemory( nSize )); pStm->Seek( pFirst->nOffset ); - pStm->Read( pStringBlock, nSize ); + pStm->ReadBytes( pStringBlock, nSize ); } *pResHandle = pStringBlock; return pStringBlock + pFind->nOffset - nOffCorrection; @@ -604,10 +604,10 @@ void* InternalResMgr::LoadGlobalRes( RESOURCE_TYPE nRT, sal_uInt32 nId, *pResHandle = nullptr; RSHEADER_TYPE aHeader; pStm->Seek( pFind->nOffset ); - pStm->Read( &aHeader, sizeof( RSHEADER_TYPE ) ); + pStm->ReadBytes( &aHeader, sizeof( RSHEADER_TYPE ) ); void * pRes = rtl_allocateMemory( aHeader.GetGlobOff() ); memcpy( pRes, &aHeader, sizeof( RSHEADER_TYPE ) ); - pStm->Read( static_cast<sal_uInt8*>(pRes) + sizeof( RSHEADER_TYPE ), + pStm->ReadBytes(static_cast<sal_uInt8*>(pRes) + sizeof(RSHEADER_TYPE), aHeader.GetGlobOff() - sizeof( RSHEADER_TYPE ) ); return pRes; } diff --git a/tools/source/ref/globname.cxx b/tools/source/ref/globname.cxx index edaf70548776..807af1774b9c 100644 --- a/tools/source/ref/globname.cxx +++ b/tools/source/ref/globname.cxx @@ -110,7 +110,7 @@ SvStream& WriteSvGlobalName( SvStream& rOStr, const SvGlobalName & rObj ) rOStr.WriteUInt32( rObj.pImp->szData.Data1 ); rOStr.WriteUInt16( rObj.pImp->szData.Data2 ); rOStr.WriteUInt16( rObj.pImp->szData.Data3 ); - rOStr.Write( &rObj.pImp->szData.Data4, 8 ); + rOStr.WriteBytes( &rObj.pImp->szData.Data4, 8 ); return rOStr; } @@ -121,7 +121,7 @@ SvStream& operator >> ( SvStream& rStr, SvGlobalName & rObj ) rStr.ReadUInt32( rObj.pImp->szData.Data1 ); rStr.ReadUInt16( rObj.pImp->szData.Data2 ); rStr.ReadUInt16( rObj.pImp->szData.Data3 ); - rStr.Read( &rObj.pImp->szData.Data4, 8 ); + rStr.ReadBytes( &rObj.pImp->szData.Data4, 8 ); return rStr; } diff --git a/tools/source/ref/pstm.cxx b/tools/source/ref/pstm.cxx index 3c15968c0699..74e6bc858108 100644 --- a/tools/source/ref/pstm.cxx +++ b/tools/source/ref/pstm.cxx @@ -93,7 +93,7 @@ void SvPersistStream::ResetError() sal_uIntPtr SvPersistStream::GetData( void* pData, sal_uIntPtr nSize ) { DBG_ASSERT( pStm, "stream not set" ); - sal_uIntPtr nRet = pStm->Read( pData, nSize ); + sal_Size const nRet = pStm->ReadBytes( pData, nSize ); SetError( pStm->GetError() ); return nRet; } @@ -101,7 +101,7 @@ sal_uIntPtr SvPersistStream::GetData( void* pData, sal_uIntPtr nSize ) sal_uIntPtr SvPersistStream::PutData( const void* pData, sal_uIntPtr nSize ) { DBG_ASSERT( pStm, "stream not set" ); - sal_uIntPtr nRet = pStm->Write( pData, nSize ); + sal_Size const nRet = pStm->WriteBytes( pData, nSize ); SetError( pStm->GetError() ); return nRet; } diff --git a/tools/source/stream/stream.cxx b/tools/source/stream/stream.cxx index b57cda22ffde..369ded58de01 100644 --- a/tools/source/stream/stream.cxx +++ b/tools/source/stream/stream.cxx @@ -142,13 +142,13 @@ static void SwapUnicode(sal_Unicode & r) { r = OSL_SWAPWORD(r); } } \ else \ { \ - Read( &value, sizeof(datatype) ); \ + ReadBytes( &value, sizeof(datatype) ); \ } \ #define WRITENUMBER_WITHOUT_SWAP(datatype,value) \ if (m_isIoWrite && sizeof(datatype) <= m_nBufFree) \ - { \ + { \ for (std::size_t i = 0; i < sizeof(datatype); i++) \ m_pBufPos[i] = reinterpret_cast<char const *>(&value)[i]; \ m_nBufFree -= sizeof(datatype); \ @@ -160,7 +160,7 @@ static void SwapUnicode(sal_Unicode & r) { r = OSL_SWAPWORD(r); } } \ else \ { \ - Write( &value, sizeof(datatype) ); \ + WriteBytes( &value, sizeof(datatype) ); \ } \ // class SvLockBytes @@ -184,7 +184,7 @@ ErrCode SvLockBytes::ReadAt(sal_uInt64 const nPos, void * pBuffer, sal_Size nCou } m_pStream->Seek(nPos); - sal_Size nTheRead = m_pStream->Read(pBuffer, nCount); + sal_Size nTheRead = m_pStream->ReadBytes(pBuffer, nCount); if (pRead) *pRead = nTheRead; return m_pStream->GetErrorCode(); @@ -201,7 +201,7 @@ ErrCode SvLockBytes::WriteAt(sal_uInt64 const nPos, const void * pBuffer, sal_Si } m_pStream->Seek(nPos); - sal_Size nTheWritten = m_pStream->Write(pBuffer, nCount); + sal_Size nTheWritten = m_pStream->WriteBytes(pBuffer, nCount); if (pWritten) *pWritten = nTheWritten; return m_pStream->GetErrorCode(); @@ -462,7 +462,7 @@ bool SvStream::ReadLine( OString& rStr, sal_Int32 nMaxBytesToRead ) while( !bEnd && !GetError() ) // Don't test for EOF as we // are reading block-wise! { - sal_uInt16 nLen = (sal_uInt16)Read( buf, sizeof(buf)-1 ); + sal_uInt16 nLen = static_cast<sal_uInt16>(ReadBytes(buf, sizeof(buf)-1)); if ( !nLen ) { if ( aBuf.isEmpty() ) @@ -511,7 +511,7 @@ bool SvStream::ReadLine( OString& rStr, sal_Int32 nMaxBytesToRead ) if ( bEnd && (c=='\r' || c=='\n') ) // Special treatment for DOS files { char cTemp; - sal_Size nLen = Read(&cTemp , sizeof(cTemp) ); + sal_Size nLen = ReadBytes(&cTemp, sizeof(cTemp)); if ( nLen ) { if( cTemp == c || (cTemp != '\n' && cTemp != '\r') ) Seek( nOldFilePos ); @@ -538,7 +538,7 @@ bool SvStream::ReadUniStringLine( OUString& rStr, sal_Int32 nMaxCodepointsToRead while( !bEnd && !GetError() ) // Don't test for EOF as we // are reading block-wise! { - sal_uInt16 nLen = (sal_uInt16)Read( buf, sizeof(buf)-sizeof(sal_Unicode) ); + sal_uInt16 nLen = static_cast<sal_uInt16>(ReadBytes( buf, sizeof(buf)-sizeof(sal_Unicode))); nLen /= sizeof(sal_Unicode); if ( !nLen ) { @@ -597,7 +597,7 @@ bool SvStream::ReadUniStringLine( OUString& rStr, sal_Int32 nMaxCodepointsToRead if ( bEnd && (c=='\r' || c=='\n') ) // special treatment for DOS files { sal_Unicode cTemp; - Read( &cTemp, sizeof(cTemp) ); + ReadBytes( &cTemp, sizeof(cTemp) ); if (m_isSwap) SwapUnicode( cTemp ); if( cTemp == c || (cTemp != '\n' && cTemp != '\r') ) @@ -629,7 +629,7 @@ OString read_zeroTerminated_uInt8s_ToOString(SvStream& rStream) while( !bEnd && !rStream.GetError() ) { - sal_Size nLen = rStream.Read(buf, sizeof(buf)-1); + sal_Size nLen = rStream.ReadBytes(buf, sizeof(buf)-1); if (!nLen) break; @@ -669,7 +669,7 @@ sal_Size write_uInt16s_FromOUString(SvStream& rStrm, const OUString& rStr, DBG_ASSERT( sizeof(sal_Unicode) == sizeof(sal_uInt16), "write_uInt16s_FromOUString: swapping sizeof(sal_Unicode) not implemented" ); sal_Size nWritten; if (!rStrm.IsEndianSwap()) - nWritten = rStrm.Write( rStr.getStr(), nUnits * sizeof(sal_Unicode) ); + nWritten = rStrm.WriteBytes(rStr.getStr(), nUnits * sizeof(sal_Unicode)); else { sal_Size nLen = nUnits; @@ -683,7 +683,7 @@ sal_Size write_uInt16s_FromOUString(SvStream& rStrm, const OUString& rStr, SwapUnicode( *p ); p++; } - nWritten = rStrm.Write( pTmp, nLen * sizeof(sal_Unicode) ); + nWritten = rStrm.WriteBytes( pTmp, nLen * sizeof(sal_Unicode) ); if ( pTmp != aBuf ) delete [] pTmp; } @@ -712,7 +712,7 @@ bool SvStream::WriteByteStringLine( const OUString& rStr, rtl_TextEncoding eDest bool SvStream::WriteLine(const OString& rStr) { - Write(rStr.getStr(), rStr.getLength()); + WriteBytes(rStr.getStr(), rStr.getLength()); endl(*this); return m_nError == SVSTREAM_OK; } @@ -724,7 +724,7 @@ bool SvStream::WriteUniOrByteChar( sal_Unicode ch, rtl_TextEncoding eDestCharSet else { OString aStr(&ch, 1, eDestCharSet); - Write(aStr.getStr(), aStr.getLength()); + WriteBytes(aStr.getStr(), aStr.getLength()); } return m_nError == SVSTREAM_OK; } @@ -902,7 +902,7 @@ SvStream& SvStream::ReadSChar( signed char& r ) m_nBufFree -= sizeof(signed char); } else - Read( &r, sizeof(signed char) ); + ReadBytes( &r, sizeof(signed char) ); return *this; } @@ -919,7 +919,7 @@ SvStream& SvStream::ReadChar( char& r ) m_nBufFree -= sizeof(char); } else - Read( &r, sizeof(char) ); + ReadBytes( &r, sizeof(char) ); return *this; } @@ -934,7 +934,7 @@ SvStream& SvStream::ReadUChar( unsigned char& r ) m_nBufFree -= sizeof(char); } else - Read( &r, sizeof(char) ); + ReadBytes( &r, sizeof(char) ); return *this; } @@ -966,7 +966,7 @@ SvStream& SvStream::ReadCharAsBool( bool& r ) else { unsigned char c; - if (Read(&c, 1) == 1) + if (ReadBytes(&c, 1) == 1) { SAL_WARN_IF(c > 1, "tools.stream", unsigned(c) << " not 0/1"); r = c != 0; @@ -1012,8 +1012,8 @@ SvStream& SvStream::ReadStream( SvStream& rStream ) sal_uInt32 nCount; do { - nCount = Read( pBuf, cBufLen ); - rStream.Write( pBuf, nCount ); + nCount = ReadBytes( pBuf, cBufLen ); + rStream.WriteBytes( pBuf, nCount ); } while( nCount == cBufLen ); delete[] pBuf; @@ -1082,7 +1082,7 @@ SvStream& SvStream::WriteSChar( signed char v ) m_isDirty = true; } else - Write( &v, sizeof(signed char) ); + WriteBytes( &v, sizeof(signed char) ); return *this; } @@ -1102,7 +1102,7 @@ SvStream& SvStream::WriteChar( char v ) m_isDirty = true; } else - Write( &v, sizeof(char) ); + WriteBytes( &v, sizeof(char) ); return *this; } @@ -1120,7 +1120,7 @@ SvStream& SvStream::WriteUChar( unsigned char v ) m_isDirty = true; } else - Write( &v, sizeof(char) ); + WriteBytes( &v, sizeof(char) ); return *this; } @@ -1164,7 +1164,7 @@ SvStream& SvStream::WriteDouble ( const double& r ) SvStream& SvStream::WriteCharPtr( const char* pBuf ) { - Write( pBuf, strlen( pBuf ) ); + WriteBytes( pBuf, strlen(pBuf) ); return *this; } @@ -1174,8 +1174,8 @@ SvStream& SvStream::WriteStream( SvStream& rStream ) char* pBuf = new char[ cBufLen ]; sal_uInt32 nCount; do { - nCount = rStream.Read( pBuf, cBufLen ); - Write( pBuf, nCount ); + nCount = rStream.ReadBytes( pBuf, cBufLen ); + WriteBytes( pBuf, nCount ); } while( nCount == cBufLen ); delete[] pBuf; @@ -1200,7 +1200,7 @@ SvStream& SvStream::WriteUniOrByteString( const OUString& rStr, rtl_TextEncoding return *this; } -sal_Size SvStream::Read( void* pData, sal_Size nCount ) +sal_Size SvStream::ReadBytes( void* pData, sal_Size nCount ) { sal_Size nSaveCount = nCount; if (!m_isConsistent) @@ -1287,7 +1287,7 @@ sal_Size SvStream::Read( void* pData, sal_Size nCount ) return nCount; } -sal_Size SvStream::Write( const void* pData, sal_Size nCount ) +sal_Size SvStream::WriteBytes( const void* pData, sal_Size nCount ) { if( !nCount ) return 0; @@ -1458,7 +1458,7 @@ SvStream& SvStream::WriteInt32AsString(sal_Int32 nInt32) { char buffer[12]; sal_Size nLen = sprintf(buffer, "%" SAL_PRIdINT32, nInt32); - Write(buffer, nLen); + WriteBytes(buffer, nLen); return *this; } @@ -1466,7 +1466,7 @@ SvStream& SvStream::WriteUInt32AsString(sal_uInt32 nUInt32) { char buffer[11]; sal_Size nLen = sprintf(buffer, "%" SAL_PRIuUINT32, nUInt32); - Write(buffer, nLen); + WriteBytes(buffer, nLen); return *this; } @@ -1990,7 +1990,7 @@ OString read_uInt8s_ToOString(SvStream& rStrm, sal_Size nLen) SAL_WARN_IF(!pStr, "tools", "allocation failed"); if (pStr) { - sal_Size nWasRead = rStrm.Read(pStr->buffer, nLen); + sal_Size nWasRead = rStrm.ReadBytes(pStr->buffer, nLen); if (nWasRead != nLen) { //on (typically unlikely) short read set length to what we could @@ -2019,7 +2019,7 @@ OUString read_uInt16s_ToOUString(SvStream& rStrm, sal_Size nLen) SAL_WARN_IF(!pStr, "tools", "allocation failed"); if (pStr) { - sal_Size nWasRead = rStrm.Read(pStr->buffer, nLen*2)/2; + sal_Size nWasRead = rStrm.ReadBytes(pStr->buffer, nLen*2)/2; if (nWasRead != nLen) { //on (typically unlikely) short read set length to what we could diff --git a/tools/source/zcodec/zcodec.cxx b/tools/source/zcodec/zcodec.cxx index fcf8c2126a6b..e841888a54b7 100644 --- a/tools/source/zcodec/zcodec.cxx +++ b/tools/source/zcodec/zcodec.cxx @@ -118,7 +118,8 @@ void ZCodec::Compress( SvStream& rIStm, SvStream& rOStm ) mpOStm = &rOStm; InitCompress(); mpInBuf = new sal_uInt8[ mnInBufSize ]; - while (( PZSTREAM->avail_in = rIStm.Read( PZSTREAM->next_in = mpInBuf, mnInBufSize )) != 0 ) + while ((PZSTREAM->avail_in = rIStm.ReadBytes( + PZSTREAM->next_in = mpInBuf, mnInBufSize )) != 0) { if ( PZSTREAM->avail_out == 0 ) ImplWriteBack(); @@ -146,7 +147,8 @@ long ZCodec::Decompress( SvStream& rIStm, SvStream& rOStm ) if ( PZSTREAM->avail_in == 0 && mnInToRead ) { nInToRead = ( mnInBufSize > mnInToRead ) ? mnInToRead : mnInBufSize; - PZSTREAM->avail_in = rIStm.Read( PZSTREAM->next_in = mpInBuf, nInToRead ); + PZSTREAM->next_in = mpInBuf; + PZSTREAM->avail_in = rIStm.ReadBytes(mpInBuf, nInToRead); mnInToRead -= nInToRead; if ( mbUpdateCrc ) @@ -211,8 +213,8 @@ long ZCodec::Read( SvStream& rIStm, sal_uInt8* pData, sal_uIntPtr nSize ) if ( PZSTREAM->avail_in == 0 && mnInToRead ) { nInToRead = (mnInBufSize > mnInToRead) ? mnInToRead : mnInBufSize; - PZSTREAM->avail_in = rIStm.Read ( - PZSTREAM->next_in = mpInBuf, nInToRead); + PZSTREAM->next_in = mpInBuf; + PZSTREAM->avail_in = rIStm.ReadBytes(mpInBuf, nInToRead); mnInToRead -= nInToRead; if ( mbUpdateCrc ) @@ -264,8 +266,8 @@ long ZCodec::ReadAsynchron( SvStream& rIStm, sal_uInt8* pData, sal_uIntPtr nSize break; } - PZSTREAM->avail_in = rIStm.Read ( - PZSTREAM->next_in = mpInBuf, nInToRead); + PZSTREAM->next_in = mpInBuf; + PZSTREAM->avail_in = rIStm.ReadBytes(mpInBuf, nInToRead); mnInToRead -= nInToRead; if ( mbUpdateCrc ) @@ -297,7 +299,8 @@ void ZCodec::ImplWriteBack() { if (meState == STATE_COMPRESS && mbUpdateCrc) UpdateCRC( mpOutBuf, nAvail ); - mpOStm->Write( PZSTREAM->next_out = mpOutBuf, nAvail ); + PZSTREAM->next_out = mpOutBuf; + mpOStm->WriteBytes( mpOutBuf, nAvail ); PZSTREAM->avail_out = mnOutBufSize; } } diff --git a/unotools/source/streaming/streamwrap.cxx b/unotools/source/streaming/streamwrap.cxx index 7356fad4c863..e64957005a03 100644 --- a/unotools/source/streaming/streamwrap.cxx +++ b/unotools/source/streaming/streamwrap.cxx @@ -58,7 +58,7 @@ sal_Int32 SAL_CALL OInputStreamWrapper::readBytes(css::uno::Sequence< sal_Int8 > if (aData.getLength() < nBytesToRead) aData.realloc(nBytesToRead); - sal_uInt32 nRead = m_pSvStream->Read(static_cast<void*>(aData.getArray()), nBytesToRead); + sal_uInt32 nRead = m_pSvStream->ReadBytes(static_cast<void*>(aData.getArray()), nBytesToRead); checkError(); // Wenn gelesene Zeichen < MaxLength, css::uno::Sequence anpassen @@ -195,7 +195,7 @@ OOutputStreamWrapper::~OOutputStreamWrapper() {} void SAL_CALL OOutputStreamWrapper::writeBytes(const css::uno::Sequence< sal_Int8 >& aData) throw( css::io::NotConnectedException, css::io::BufferSizeExceededException, css::uno::RuntimeException, std::exception ) { - sal_uInt32 nWritten = rStream.Write(aData.getConstArray(),aData.getLength()); + sal_uInt32 nWritten = rStream.WriteBytes(aData.getConstArray(), aData.getLength()); ErrCode err = rStream.GetError(); if ( (ERRCODE_NONE != err) || (nWritten != (sal_uInt32)aData.getLength()) @@ -293,7 +293,7 @@ css::uno::Reference< css::io::XOutputStream > SAL_CALL OStreamWrapper::getOutput void SAL_CALL OStreamWrapper::writeBytes(const css::uno::Sequence< sal_Int8 >& aData) throw(css::io::NotConnectedException, css::io::BufferSizeExceededException, css::uno::RuntimeException, std::exception) { - sal_uInt32 nWritten = m_pSvStream->Write(aData.getConstArray(),aData.getLength()); + sal_uInt32 nWritten = m_pSvStream->WriteBytes(aData.getConstArray(), aData.getLength()); ErrCode err = m_pSvStream->GetError(); if ( (ERRCODE_NONE != err) || (nWritten != (sal_uInt32)aData.getLength()) diff --git a/unotools/source/ucbhelper/xtempfile.cxx b/unotools/source/ucbhelper/xtempfile.cxx index 5193dd814819..9d1af5936ca6 100644 --- a/unotools/source/ucbhelper/xtempfile.cxx +++ b/unotools/source/ucbhelper/xtempfile.cxx @@ -165,7 +165,7 @@ throw (css::io::NotConnectedException, css::io::BufferSizeExceededException, css if (aData.getLength() < nBytesToRead) aData.realloc(nBytesToRead); - sal_uInt32 nRead = mpStream->Read(static_cast < void* > ( aData.getArray() ), nBytesToRead); + sal_uInt32 nRead = mpStream->ReadBytes(static_cast<void*>(aData.getArray()), nBytesToRead); checkError(); if (nRead < (sal_Size)aData.getLength()) @@ -262,7 +262,7 @@ throw ( css::io::NotConnectedException, css::io::BufferSizeExceededException, cs throw css::io::NotConnectedException ( OUString(), const_cast < css::uno::XWeak * > ( static_cast < const css::uno::XWeak * > (this ) ) ); checkConnected(); - sal_uInt32 nWritten = mpStream->Write(aData.getConstArray(),aData.getLength()); + sal_uInt32 nWritten = mpStream->WriteBytes(aData.getConstArray(), aData.getLength()); checkError(); if ( nWritten != (sal_uInt32)aData.getLength()) throw css::io::BufferSizeExceededException( OUString(),static_cast < css::uno::XWeak * > ( this ) ); diff --git a/vcl/source/bitmap/BitmapTools.cxx b/vcl/source/bitmap/BitmapTools.cxx index cb016c3306a3..98aef88379e4 100644 --- a/vcl/source/bitmap/BitmapTools.cxx +++ b/vcl/source/bitmap/BitmapTools.cxx @@ -36,7 +36,7 @@ void BitmapTools::loadFromSvg(SvStream& rStream, const OUString& sPath, BitmapEx sal_Size nSize = rStream.remainingSize(); std::vector<sal_Int8> aBuffer(nSize + 1); - rStream.Read(aBuffer.data(), nSize); + rStream.ReadBytes(aBuffer.data(), nSize); aBuffer[nSize] = 0; uno::Sequence<sal_Int8> aData(aBuffer.data(), nSize + 1); diff --git a/vcl/source/filter/GraphicNativeTransform.cxx b/vcl/source/filter/GraphicNativeTransform.cxx index aa24bfb50113..fc6143296072 100644 --- a/vcl/source/filter/GraphicNativeTransform.cxx +++ b/vcl/source/filter/GraphicNativeTransform.cxx @@ -152,7 +152,7 @@ bool GraphicNativeTransform::rotateJPEG(sal_uInt16 aRotation) GfxLink aLink = mrGraphic.GetLink(); SvMemoryStream aSourceStream; - aSourceStream.Write(aLink.GetData(), aLink.GetDataSize()); + aSourceStream.WriteBytes(aLink.GetData(), aLink.GetDataSize()); aSourceStream.Seek( STREAM_SEEK_TO_BEGIN ); Orientation aOrientation = TOP_LEFT; diff --git a/vcl/source/filter/graphicfilter.cxx b/vcl/source/filter/graphicfilter.cxx index a690faf222c7..2fab78563a68 100644 --- a/vcl/source/filter/graphicfilter.cxx +++ b/vcl/source/filter/graphicfilter.cxx @@ -90,7 +90,7 @@ protected: virtual void SAL_CALL writeBytes( const css::uno::Sequence< sal_Int8 >& rData ) throw (css::io::NotConnectedException, css::io::BufferSizeExceededException, css::io::IOException, css::uno::RuntimeException, std::exception) override - { mrStm.Write( rData.getConstArray(), rData.getLength() ); } + { mrStm.WriteBytes(rData.getConstArray(), rData.getLength()); } virtual void SAL_CALL flush() throw (css::io::NotConnectedException, css::io::BufferSizeExceededException, css::io::IOException, css::uno::RuntimeException, std::exception) override { mrStm.Flush(); } @@ -206,7 +206,7 @@ bool isPCT(SvStream& rStream, sal_uLong nStreamPos, sal_uLong nStreamLen) bdBoxOk = false; // read version op - rStream.Read( sBuf,3 ); + rStream.ReadBytes(sBuf, 3); // see http://developer.apple.com/legacy/mac/library/documentation/mac/pdf/Imaging_With_QuickDraw/Appendix_A.pdf // normal version 2 - page A23 and A24 if ( sBuf[ 0 ] == 0x00 && sBuf[ 1 ] == 0x11 && sBuf[ 2 ] == 0x02) @@ -273,13 +273,13 @@ static bool ImpPeekGraphicFormat( SvStream& rStream, OUString& rFormatExtension, else if (nStreamLen >= 256) { // load first 256 bytes into a buffer - sal_uLong nRead = rStream.Read(sFirstBytes, 256); + sal_uLong nRead = rStream.ReadBytes(sFirstBytes, 256); if (nRead < 256) nStreamLen = nRead; } else { - nStreamLen = rStream.Read(sFirstBytes, nStreamLen); + nStreamLen = rStream.ReadBytes(sFirstBytes, nStreamLen); } @@ -477,7 +477,7 @@ static bool ImpPeekGraphicFormat( SvStream& rStream, OUString& rFormatExtension, { char sBuf[8]; rStream.Seek( nStreamPos + 2048 ); - rStream.Read( sBuf, 7 ); + rStream.ReadBytes( sBuf, 7 ); if( strncmp( sBuf, "PCD_IPI", 7 ) == 0 ) { @@ -618,7 +618,7 @@ static bool ImpPeekGraphicFormat( SvStream& rStream, OUString& rFormatExtension, std::unique_ptr<sal_uInt8[]> pBuf(new sal_uInt8 [ nSize ]); rStream.Seek( nStreamPos ); - rStream.Read( pBuf.get(), nSize ); + rStream.ReadBytes( pBuf.get(), nSize ); sal_uInt8* pPtr = ImplSearchEntry( pBuf.get(), reinterpret_cast<sal_uInt8 const *>("#define"), nSize, 7 ); if( pPtr ) @@ -700,7 +700,7 @@ static bool ImpPeekGraphicFormat( SvStream& rStream, OUString& rFormatExtension, { nCheckSize = nStreamLen < 2048 ? nStreamLen : 2048; rStream.Seek(nStreamPos); - nCheckSize = rStream.Read(sExtendedOrDecompressedFirstBytes, nCheckSize); + nCheckSize = rStream.ReadBytes(sExtendedOrDecompressedFirstBytes, nCheckSize); } if(ImplSearchEntry(pCheckArray, reinterpret_cast<sal_uInt8 const *>("<svg"), nCheckSize, 4)) // '<svg' @@ -1461,7 +1461,7 @@ sal_uInt16 GraphicFilter::ImportGraphic( Graphic& rGraphic, const OUString& rPat SvMemoryStream aIStrm(const_cast<sal_uInt8*>(&rData[11]), nGraphicContentSize, StreamMode::READ); pGraphicContent = new sal_uInt8[nGraphicContentSize]; sal_uInt64 aCurrentPosition = aIStrm.Tell(); - aIStrm.Read(pGraphicContent, nGraphicContentSize); + aIStrm.ReadBytes(pGraphicContent, nGraphicContentSize); aIStrm.Seek(aCurrentPosition); ImportGIF(aIStrm, rGraphic); eLinkType = GfxLinkType::NativeGif; @@ -1513,7 +1513,7 @@ sal_uInt16 GraphicFilter::ImportGraphic( Graphic& rGraphic, const OUString& rPat { std::vector<sal_uInt8> aTwoBytes(2); rIStream.Seek(nStreamPosition); - rIStream.Read(&aTwoBytes[0], 2); + rIStream.ReadBytes(&aTwoBytes[0], 2); rIStream.Seek(nStreamPosition); if(aTwoBytes[0] == 0x1F && aTwoBytes[1] == 0x8B) @@ -1530,7 +1530,7 @@ sal_uInt16 GraphicFilter::ImportGraphic( Graphic& rGraphic, const OUString& rPat { SvgDataArray aNewData(nMemoryLength); aMemStream.Seek(STREAM_SEEK_TO_BEGIN); - aMemStream.Read(aNewData.begin(), nMemoryLength); + aMemStream.ReadBytes(aNewData.begin(), nMemoryLength); // Make a uncompressed copy for GfxLink nGraphicContentSize = nMemoryLength; @@ -1549,7 +1549,7 @@ sal_uInt16 GraphicFilter::ImportGraphic( Graphic& rGraphic, const OUString& rPat { SvgDataArray aNewData(nStreamLength); rIStream.Seek(nStreamPosition); - rIStream.Read(aNewData.begin(), nStreamLength); + rIStream.ReadBytes(aNewData.begin(), nStreamLength); if(!rIStream.GetError()) { @@ -1758,7 +1758,7 @@ sal_uInt16 GraphicFilter::ImportGraphic( Graphic& rGraphic, const OUString& rPat if( nStatus == GRFILTER_OK ) { rIStream.Seek(nStreamBegin); - rIStream.Read(pGraphicContent, nGraphicContentSize); + rIStream.ReadBytes(pGraphicContent, nGraphicContentSize); } } } @@ -2043,7 +2043,7 @@ sal_uInt16 GraphicFilter::ExportGraphic( const Graphic& rGraphic, const OUString if (aSvgDataPtr.get() && aSvgDataPtr->getSvgDataArrayLength()) { - rOStm.Write(aSvgDataPtr->getSvgDataArray().getConstArray(), aSvgDataPtr->getSvgDataArrayLength()); + rOStm.WriteBytes(aSvgDataPtr->getSvgDataArray().getConstArray(), aSvgDataPtr->getSvgDataArrayLength()); if( rOStm.GetError() ) { diff --git a/vcl/source/filter/graphicfilter2.cxx b/vcl/source/filter/graphicfilter2.cxx index a2eee2cce4fa..b31c0cb58fc0 100644 --- a/vcl/source/filter/graphicfilter2.cxx +++ b/vcl/source/filter/graphicfilter2.cxx @@ -910,7 +910,7 @@ bool GraphicDescriptor::ImpDetectEPS( SvStream& rStm, bool ) rStm.SetEndian( SvStreamEndian::BIG ); rStm.ReadUInt32( nFirstLong ); rStm.SeekRel( -4 ); - rStm.Read( &nFirstBytes, 20 ); + rStm.ReadBytes( &nFirstBytes, 20 ); if ( ( nFirstLong == 0xC5D0D3C6 ) || aPathExt.startsWith( "eps" ) || ( ImplSearchEntry( nFirstBytes, reinterpret_cast<sal_uInt8 const *>("%!PS-Adobe"), 10, 10 ) diff --git a/vcl/source/filter/igif/gifread.cxx b/vcl/source/filter/igif/gifread.cxx index f008b1bd9125..0609314924c7 100644 --- a/vcl/source/filter/igif/gifread.cxx +++ b/vcl/source/filter/igif/gifread.cxx @@ -227,13 +227,13 @@ bool GIFReader::ReadGlobalHeader() sal_uInt8 nAspect; bool bRet = false; - rIStm.Read( pBuf, 6 ); + rIStm.ReadBytes( pBuf, 6 ); if( NO_PENDING( rIStm ) ) { pBuf[ 6 ] = 0; if( !strcmp( pBuf, "GIF87a" ) || !strcmp( pBuf, "GIF89a" ) ) { - rIStm.Read( pBuf, 7 ); + rIStm.ReadBytes( pBuf, 7 ); if( NO_PENDING( rIStm ) ) { SvMemoryStream aMemStm; @@ -270,7 +270,7 @@ void GIFReader::ReadPaletteEntries( BitmapPalette* pPal, sal_uLong nCount ) if (nLen > nMaxPossible) nLen = nMaxPossible; std::unique_ptr<sal_uInt8[]> pBuf(new sal_uInt8[ nLen ]); - sal_Size nRead = rIStm.Read(pBuf.get(), nLen); + sal_Size nRead = rIStm.ReadBytes(pBuf.get(), nLen); nCount = nRead/3UL; if( NO_PENDING( rIStm ) ) { @@ -417,7 +417,7 @@ bool GIFReader::ReadExtension() std::unique_ptr<sal_uInt8[]> pBuffer(new sal_uInt8[nCount]); bRet = false; - sal_Size nRead = rIStm.Read(pBuffer.get(), nCount); + sal_Size nRead = rIStm.ReadBytes(pBuffer.get(), nCount); if (NO_PENDING(rIStm) && cSize < nRead) { cSize = pBuffer[cSize]; @@ -437,7 +437,7 @@ bool GIFReader::ReadLocalHeader() sal_uInt8 pBuf[ 9 ]; bool bRet = false; - sal_Size nRead = rIStm.Read(pBuf, 9); + sal_Size nRead = rIStm.ReadBytes(pBuf, 9); if (NO_PENDING(rIStm) && nRead == 9) { SvMemoryStream aMemStm; @@ -493,7 +493,7 @@ sal_uLong GIFReader::ReadNextBlock() nRet = 2UL; else { - rIStm.Read( pSrcBuf, cBlockSize ); + rIStm.ReadBytes( pSrcBuf, cBlockSize ); if( NO_PENDING( rIStm ) ) { diff --git a/vcl/source/filter/ixpm/xpmread.cxx b/vcl/source/filter/ixpm/xpmread.cxx index b757709be118..ef4ef3d1d953 100644 --- a/vcl/source/filter/ixpm/xpmread.cxx +++ b/vcl/source/filter/ixpm/xpmread.cxx @@ -638,7 +638,7 @@ bool XPMReader::ImplGetString() { if ( mnTempAvail == 0 ) { - mnTempAvail = mrIStm.Read( mpTempBuf, XPMTEMPBUFSIZE ); + mnTempAvail = mrIStm.ReadBytes( mpTempBuf, XPMTEMPBUFSIZE ); if ( mnTempAvail == 0 ) break; diff --git a/vcl/source/filter/jpeg/Exif.cxx b/vcl/source/filter/jpeg/Exif.cxx index d585329609eb..c695a3a92983 100644 --- a/vcl/source/filter/jpeg/Exif.cxx +++ b/vcl/source/filter/jpeg/Exif.cxx @@ -208,7 +208,7 @@ bool Exif::processExif(SvStream& rStream, sal_uInt16 aSectionLength, bool bSetVa std::unique_ptr<sal_uInt8[]> aExifData(new sal_uInt8[aLength]); sal_uInt32 aExifDataBeginPosition = rStream.Tell(); - rStream.Read(aExifData.get(), aLength); + rStream.ReadBytes(aExifData.get(), aLength); // Exif detected mbExifPresent = true; @@ -257,7 +257,7 @@ bool Exif::processExif(SvStream& rStream, sal_uInt16 aSectionLength, bool bSetVa if (bSetValue) { rStream.Seek(aExifDataBeginPosition); - rStream.Write(aExifData.get(), aLength); + rStream.WriteBytes(aExifData.get(), aLength); } return true; diff --git a/vcl/source/filter/jpeg/JpegReader.cxx b/vcl/source/filter/jpeg/JpegReader.cxx index 3f3487633c4f..8959e4e8bd99 100644 --- a/vcl/source/filter/jpeg/JpegReader.cxx +++ b/vcl/source/filter/jpeg/JpegReader.cxx @@ -72,7 +72,7 @@ long StreamRead( SvStream* pStream, void* pBuffer, long nBufferSize ) { long nInitialPosition = pStream->Tell(); - nRead = (long) pStream->Read( pBuffer, nBufferSize ); + nRead = static_cast<long>(pStream->ReadBytes(pBuffer, nBufferSize)); if( pStream->GetError() == ERRCODE_IO_PENDING ) { diff --git a/vcl/source/filter/jpeg/JpegWriter.cxx b/vcl/source/filter/jpeg/JpegWriter.cxx index 27fd6f23a96c..d25bf89406d6 100644 --- a/vcl/source/filter/jpeg/JpegWriter.cxx +++ b/vcl/source/filter/jpeg/JpegWriter.cxx @@ -53,7 +53,7 @@ extern "C" boolean empty_output_buffer (j_compress_ptr cinfo) { DestinationManagerStruct * destination = reinterpret_cast<DestinationManagerStruct *>(cinfo->dest); - if (destination->stream->Write(destination->buffer, BUFFER_SIZE) != (size_t) BUFFER_SIZE) + if (destination->stream->WriteBytes(destination->buffer, BUFFER_SIZE) != BUFFER_SIZE) { ERREXIT(cinfo, JERR_FILE_WRITE); } @@ -72,7 +72,7 @@ extern "C" void term_destination (j_compress_ptr cinfo) /* Write any data remaining in the buffer */ if (datacount > 0) { - if (destination->stream->Write(destination->buffer, datacount) != datacount) + if (destination->stream->WriteBytes(destination->buffer, datacount) != datacount) { ERREXIT(cinfo, JERR_FILE_WRITE); } diff --git a/vcl/source/filter/sgfbram.cxx b/vcl/source/filter/sgfbram.cxx index b7825d99c4e7..a2a51200a543 100644 --- a/vcl/source/filter/sgfbram.cxx +++ b/vcl/source/filter/sgfbram.cxx @@ -47,8 +47,8 @@ SvStream& ReadSgfHeader(SvStream& rIStream, SgfHeader& rHead) rIStream.ReadInt16(rHead.Yoffs); rIStream.ReadUInt16(rHead.Planes); rIStream.ReadUInt16(rHead.SwGrCol); - rIStream.Read(&rHead.Autor, 10); - rIStream.Read(&rHead.Programm, 10); + rIStream.ReadBytes(&rHead.Autor, 10); + rIStream.ReadBytes(&rHead.Programm, 10); rIStream.ReadUInt16(rHead.OfsLo); rIStream.ReadUInt16(rHead.OfsHi); assert(rIStream.GetError() || rIStream.Tell() == nOldPos + SgfHeaderSize); @@ -75,7 +75,7 @@ SvStream& ReadSgfEntry(SvStream& rIStream, SgfEntry& rEntr) rIStream.ReadUInt16(rEntr.iFrei); rIStream.ReadUInt16(rEntr.lFreiLo); rIStream.ReadUInt16(rEntr.lFreiHi); - rIStream.Read(&rEntr.cFrei, 10); + rIStream.ReadBytes(&rEntr.cFrei, 10); rIStream.ReadUInt16(rEntr.OfsLo); rIStream.ReadUInt16(rEntr.OfsHi); assert(rIStream.GetError() || rIStream.Tell() == nOldPos + SgfEntrySize); @@ -154,7 +154,7 @@ SvStream& WriteBmpInfoHeader(SvStream& rOStream, BmpInfoHeader& rInfo) SvStream& WriteRGBQuad(SvStream& rOStream, const RGBQuad& rQuad) { - rOStream.Write(&rQuad, sizeof(rQuad)); + rOStream.WriteBytes(&rQuad, sizeof(rQuad)); return rOStream; } @@ -176,10 +176,10 @@ sal_uInt8 PcxExpand::GetByte(SvStream& rInp) if (Count>0) { Count--; } else { - rInp.Read(&Data, 1); + rInp.ReadBytes(&Data, 1); if ((Data & 0xC0) == 0xC0) { Count=(Data & 0x3F) -1; - rInp.Read(&Data, 1); + rInp.ReadBytes(&Data, 1); } } return Data; @@ -233,14 +233,14 @@ bool SgfFilterBMap(SvStream& rInp, SvStream& rOut, SgfHeader& rHead, SgfEntry&) WriteRGBQuad( rOut, RGBQuad(0xFF,0xFF,0xFF) ); // white nOfs=rOut.Tell(); for (j=0;j<rHead.Ysize;j++) - rOut.Write(pBuf.get(), nWdtOut); // fill file with zeroes + rOut.WriteBytes(pBuf.get(), nWdtOut); // fill file with zeroes for (j=0;j<rHead.Ysize;j++) { for(i=0;i<nWdtInp;i++) { pBuf[i]=aPcx.GetByte(rInp); } for(i=nWdtInp;i<nWdtOut;i++) pBuf[i]=0; // up to 3 bytes rOut.Seek(nOfs+((sal_uLong)rHead.Ysize-j-1L)*(sal_uLong)nWdtOut); // write backwards - rOut.Write(pBuf.get(), nWdtOut); + rOut.WriteBytes(pBuf.get(), nWdtOut); } } else if (nColors==16) { sal_uInt8 pl2= 0; // planes' masks @@ -264,7 +264,7 @@ bool SgfFilterBMap(SvStream& rInp, SvStream& rOut, SgfHeader& rHead, SgfEntry&) nOfs=rOut.Tell(); for (j=0;j<rHead.Ysize;j++) - rOut.Write(pBuf.get(), nWdtOut); // fill file with zeroes + rOut.WriteBytes(pBuf.get(), nWdtOut); // fill file with zeroes for (j=0;j<rHead.Ysize;j++) { memset(pBuf.get(),0,nWdtOut); for(k=0;k<4;k++) { @@ -288,27 +288,27 @@ bool SgfFilterBMap(SvStream& rInp, SvStream& rOut, SgfHeader& rHead, SgfEntry&) } for(i=nWdtInp*4;i<nWdtOut;i++) pBuf[i]=0; // up to 3 bytes rOut.Seek(nOfs+((sal_uLong)rHead.Ysize-j-1L)*(sal_uLong)nWdtOut); // write backwards - rOut.Write(pBuf.get(), nWdtOut); + rOut.WriteBytes(pBuf.get(), nWdtOut); } } else if (nColors==256) { cRGB[3]=0; // fourth palette entry for BMP for (i=0;i<256;i++) { // copy palette - rInp.Read(cRGB, 3); + rInp.ReadBytes(cRGB, 3); pl1=cRGB[0]; // switch red and blue cRGB[0]=cRGB[2]; cRGB[2]=pl1; - rOut.Write(cRGB, 4); + rOut.WriteBytes(cRGB, 4); } nOfs=rOut.Tell(); for (j=0;j<rHead.Ysize;j++) - rOut.Write(pBuf.get(), nWdtOut); // fill file with zeroes + rOut.WriteBytes(pBuf.get(), nWdtOut); // fill file with zeroes for (j=0;j<rHead.Ysize;j++) { for(i=0;i<rHead.Xsize;i++) pBuf[i]=aPcx.GetByte(rInp); for(i=rHead.Xsize;i<nWdtOut;i++) pBuf[i]=0; // up to 3 bytes rOut.Seek(nOfs+((sal_uLong)rHead.Ysize-j-1L)*(sal_uLong)nWdtOut); // write backwards - rOut.Write(pBuf.get(), nWdtOut); + rOut.WriteBytes(pBuf.get(), nWdtOut); } } return true; diff --git a/vcl/source/filter/sgvmain.cxx b/vcl/source/filter/sgvmain.cxx index 1d85a9808209..c4f474f043b5 100644 --- a/vcl/source/filter/sgvmain.cxx +++ b/vcl/source/filter/sgvmain.cxx @@ -777,7 +777,7 @@ void DrawObjkList( SvStream& rInp, OutputDevice& rOut ) ReadTextType( rInp, aText ); if (!rInp.GetError()) { aText.Buffer=new UCHAR[aText.BufSize+1]; // add one for LookAhead at CK-separation - rInp.Read(aText.Buffer, aText.BufSize); + rInp.ReadBytes(aText.Buffer, aText.BufSize); if (!rInp.GetError()) aText.Draw(rOut); delete[] aText.Buffer; } diff --git a/vcl/source/filter/wmf/emfwr.cxx b/vcl/source/filter/wmf/emfwr.cxx index 98a1f957b2a7..8c352fa37f49 100644 --- a/vcl/source/filter/wmf/emfwr.cxx +++ b/vcl/source/filter/wmf/emfwr.cxx @@ -872,7 +872,7 @@ void EMFWriter::ImplWriteBmpRecord( const Bitmap& rBmp, const Point& rPt, sal_uInt32 nPalSize = nPalCount * 4; - m_rStm.Write( aMemStm.GetData(), nDIBSize ); + m_rStm.WriteBytes( aMemStm.GetData(), nDIBSize ); const sal_uLong nEndPos = m_rStm.Tell(); m_rStm.Seek( nOffPos ); @@ -1504,7 +1504,7 @@ void EMFWriter::ImplWrite( const GDIMetaFile& rMtf ) if (pCommentAction->GetComment() == "EMF_PLUS") { ImplBeginCommentRecord(WIN_EMR_COMMENT_EMFPLUS); - m_rStm.Write(pCommentAction->GetData(), + m_rStm.WriteBytes(pCommentAction->GetData(), pCommentAction->GetDataSize()); ImplEndCommentRecord(); } diff --git a/vcl/source/filter/wmf/enhwmf.cxx b/vcl/source/filter/wmf/enhwmf.cxx index f4e7d45b9a4a..d7b7fe293b6d 100644 --- a/vcl/source/filter/wmf/enhwmf.cxx +++ b/vcl/source/filter/wmf/enhwmf.cxx @@ -434,7 +434,7 @@ void EnhWMFReader::ReadEMFPlusComment(sal_uInt32 length, bool& bHaveDC) sal_Size pos = pWMF->Tell(); void *buffer = malloc( length ); - pOut->PassEMFPlus( buffer, pWMF->Read( buffer, length ) ); + pOut->PassEMFPlus( buffer, pWMF->ReadBytes(buffer, length) ); free( buffer ); pWMF->Seek( pos ); @@ -1275,7 +1275,7 @@ bool EnhWMFReader::ReadEnhWMF() // copy DIBInfoHeader from source (cbBmiSrc bytes) pWMF->Seek( nStart + offBmiSrc ); - pWMF->Read( pBuf + 14, cbBmiSrc ); + pWMF->ReadBytes(pBuf + 14, cbBmiSrc); if(bReadAlpha) { @@ -1287,7 +1287,7 @@ bool EnhWMFReader::ReadEnhWMF() // copy bitmap data from source (offBitsSrc bytes) pWMF->Seek( nStart + offBitsSrc ); - pWMF->Read( pBuf + 14 + nDeltaToDIB5HeaderSize + cbBmiSrc, cbBitsSrc ); + pWMF->ReadBytes(pBuf + 14 + nDeltaToDIB5HeaderSize + cbBmiSrc, cbBitsSrc); aTmp.Seek( 0 ); // prepare to read and fill BitmapEx @@ -1394,9 +1394,9 @@ bool EnhWMFReader::ReadEnhWMF() .WriteUInt16( 0 ) .WriteUInt32( cbBmiSrc + 14 ); pWMF->Seek( nStart + offBmiSrc ); - pWMF->Read( pBuf + 14, cbBmiSrc ); + pWMF->ReadBytes(pBuf + 14, cbBmiSrc); pWMF->Seek( nStart + offBitsSrc ); - pWMF->Read( pBuf + 14 + cbBmiSrc, cbBitsSrc ); + pWMF->ReadBytes(pBuf + 14 + cbBmiSrc, cbBitsSrc); aTmp.Seek( 0 ); ReadDIB(aBitmap, aTmp, true); @@ -1461,9 +1461,9 @@ bool EnhWMFReader::ReadEnhWMF() .WriteUInt16( 0 ) .WriteUInt32( cbBmiSrc + 14 ); pWMF->Seek( nStart + offBmiSrc ); - pWMF->Read( pBuf + 14, cbBmiSrc ); + pWMF->ReadBytes(pBuf + 14, cbBmiSrc); pWMF->Seek( nStart + offBitsSrc ); - pWMF->Read( pBuf + 14 + cbBmiSrc, cbBitsSrc ); + pWMF->ReadBytes(pBuf + 14 + cbBmiSrc, cbBitsSrc); aTmp.Seek( 0 ); ReadDIB(aBitmap, aTmp, true); @@ -1580,7 +1580,7 @@ bool EnhWMFReader::ReadEnhWMF() if ( nLen <= static_cast<sal_Int32>( nEndPos - pWMF->Tell() ) ) { std::unique_ptr<sal_Char[]> pBuf(new sal_Char[ nLen ]); - pWMF->Read( pBuf.get(), nLen ); + pWMF->ReadBytes(pBuf.get(), nLen); aText = OUString(pBuf.get(), nLen, pOut->GetCharSet()); pBuf.reset(); @@ -1605,7 +1605,7 @@ bool EnhWMFReader::ReadEnhWMF() if ( ( nLen * sizeof(sal_Unicode) ) <= ( nEndPos - pWMF->Tell() ) ) { std::unique_ptr<sal_Unicode[]> pBuf(new sal_Unicode[ nLen ]); - pWMF->Read( pBuf.get(), nLen << 1 ); + pWMF->ReadBytes(pBuf.get(), nLen << 1); #ifdef OSL_BIGENDIAN sal_Char nTmp, *pTmp = (sal_Char*)( pBuf.get() + nLen ); while ( pTmp-- != (sal_Char*)pBuf.get() ) @@ -1708,9 +1708,9 @@ bool EnhWMFReader::ReadEnhWMF() .WriteUInt16( 0 ) .WriteUInt32( cbBmi + 14 ); pWMF->Seek( nStart + offBmi ); - pWMF->Read( pBuf + 14, cbBmi ); + pWMF->ReadBytes(pBuf + 14, cbBmi); pWMF->Seek( nStart + offBits ); - pWMF->Read( pBuf + 14 + cbBmi, cbBits ); + pWMF->ReadBytes(pBuf + 14 + cbBmi, cbBits); aTmp.Seek( 0 ); ReadDIB(aBitmap, aTmp, true); } diff --git a/vcl/source/filter/wmf/winwmf.cxx b/vcl/source/filter/wmf/winwmf.cxx index 12fef7f872a8..5c3ccd825d9e 100644 --- a/vcl/source/filter/wmf/winwmf.cxx +++ b/vcl/source/filter/wmf/winwmf.cxx @@ -508,7 +508,7 @@ void WMFReader::ReadRecordParams( sal_uInt16 nFunc ) if ( nLength ) { std::unique_ptr<char[]> pChar(new char[ ( nLength + 1 ) &~ 1 ]); - pWMF->Read( pChar.get(), ( nLength + 1 ) &~ 1 ); + pWMF->ReadBytes(pChar.get(), (nLength + 1) &~ 1); OUString aText( pChar.get(), nLength, pOut->GetCharSet() ); pChar.reset(); Point aPosition( ReadYX() ); @@ -550,7 +550,7 @@ void WMFReader::ReadRecordParams( sal_uInt16 nFunc ) aRect = Rectangle( aPt1, aPt2 ); } std::unique_ptr<char[]> pChar(new char[ ( nOriginalTextLen + 1 ) &~ 1 ]); - pWMF->Read( pChar.get(), ( nOriginalTextLen + 1 ) &~ 1 ); + pWMF->ReadBytes(pChar.get(), (nOriginalTextLen + 1) &~ 1); OUString aText( pChar.get(), (sal_uInt16)nOriginalTextLen, pOut->GetCharSet() );// after this conversion the text may contain nNewTextLen = aText.getLength(); // less character (japanese version), so the pChar.reset(); // dxAry will not fit @@ -903,7 +903,7 @@ void WMFReader::ReadRecordParams( sal_uInt16 nFunc ) pWMF->ReadUChar( aLogFont.lfClipPrecision ); pWMF->ReadUChar( aLogFont.lfQuality ); pWMF->ReadUChar( aLogFont.lfPitchAndFamily ); - pWMF->Read( lfFaceName, LF_FACESIZE ); + pWMF->ReadBytes( lfFaceName, LF_FACESIZE ); aLogFont.lfWidth = aFontSize.Width(); aLogFont.lfHeight = aFontSize.Height(); aLogFont.lfEscapement = lfEscapement; @@ -1024,7 +1024,7 @@ void WMFReader::ReadRecordParams( sal_uInt16 nFunc ) if ( nEscLen > 0 ) { pData.reset(new sal_Int8[ nEscLen ]); - pWMF->Read( pData.get(), nEscLen ); + pWMF->ReadBytes(pData.get(), nEscLen); nCheckSum = rtl_crc32( nCheckSum, pData.get(), nEscLen ); } if ( nCheck == nCheckSum ) @@ -1041,7 +1041,7 @@ void WMFReader::ReadRecordParams( sal_uInt16 nFunc ) sal_uInt32 nStringLen, nDXCount; std::unique_ptr<long[]> pDXAry; SvMemoryStream aMemoryStream( nEscLen ); - aMemoryStream.Write( pData.get(), nEscLen ); + aMemoryStream.WriteBytes(pData.get(), nEscLen); aMemoryStream.Seek( STREAM_SEEK_TO_BEGIN ); sal_Int32 nTmpX(0), nTmpY(0); aMemoryStream.ReadInt32( nTmpX ) @@ -1112,9 +1112,9 @@ void WMFReader::ReadRecordParams( sal_uInt16 nFunc ) if( pEMFStream ) { std::unique_ptr<sal_Int8[]> pBuf(new sal_Int8[ nCurRecSize ]); - sal_uInt32 nCount = pWMF->Read( pBuf.get(), nCurRecSize ); + sal_uInt32 nCount = pWMF->ReadBytes(pBuf.get(), nCurRecSize); if( nCount == nCurRecSize ) - pEMFStream->Write( pBuf.get(), nCount ); + pEMFStream->WriteBytes(pBuf.get(), nCount); } } } diff --git a/vcl/source/filter/wmf/wmfwr.cxx b/vcl/source/filter/wmf/wmfwr.cxx index 9fa5bb3eb3db..8b96fdf848cf 100644 --- a/vcl/source/filter/wmf/wmfwr.cxx +++ b/vcl/source/filter/wmf/wmfwr.cxx @@ -435,7 +435,7 @@ void WMFWriter::WMFRecord_Escape( sal_uInt32 nEsc, sal_uInt32 nLen, const sal_In .WriteUInt32( 0xa2c2a ) // evil magic number .WriteUInt32( nCheckSum ) // crc32 checksum about nEsc & pData .WriteUInt32( nEsc ); // escape number - pWMF->Write( pData, nLen ); + pWMF->WriteBytes( pData, nLen ); if ( nLen & 1 ) pWMF->WriteUChar( 0 ); // pad byte } @@ -1922,7 +1922,7 @@ void WMFWriter::WriteEMFRecord( SvMemoryStream& rStream, sal_uInt32 nCurSize, sa .WriteUInt32( nRemainingSize ) // remaining size of data in following records, missing in MSDN documentation .WriteUInt32( nTotalSize ); // total size of EMF stream - pWMF->Write( static_cast< const sal_Char* >( rStream.GetData() ) + rStream.Tell(), nCurSize ); + pWMF->WriteBytes(static_cast<const sal_Char*>(rStream.GetData()) + rStream.Tell(), nCurSize); rStream.SeekRel( nCurSize ); UpdateRecordHeader(); } diff --git a/vcl/source/gdi/dibtools.cxx b/vcl/source/gdi/dibtools.cxx index 2b4992d90412..4e2dd868d1f0 100644 --- a/vcl/source/gdi/dibtools.cxx +++ b/vcl/source/gdi/dibtools.cxx @@ -310,7 +310,7 @@ bool ImplReadDIBPalette( SvStream& rIStm, BitmapWriteAccess& rAcc, bool bQuad ) BitmapColor aPalColor; std::unique_ptr<sal_uInt8[]> pEntries(new sal_uInt8[ nPalSize ]); - if (rIStm.Read( pEntries.get(), nPalSize ) != nPalSize) + if (rIStm.ReadBytes(pEntries.get(), nPalSize) != nPalSize) { return false; } @@ -504,7 +504,7 @@ bool ImplReadDIBBits(SvStream& rIStm, DIBV5Header& rHeader, BitmapWriteAccess& r return false; } sal_Size n = nAlignedWidth * rHeader.nHeight; - if (rIStm.Read(rAcc.GetBuffer(), n) != n) + if (rIStm.ReadBytes(rAcc.GetBuffer(), n) != n) { return false; } @@ -529,7 +529,7 @@ bool ImplReadDIBBits(SvStream& rIStm, DIBV5Header& rHeader, BitmapWriteAccess& r std::unique_ptr<sal_uInt8[]> pBuffer( new sal_uInt8[rHeader.nSizeImage]); - if (rIStm.Read(pBuffer.get(), rHeader.nSizeImage) + if (rIStm.ReadBytes(pBuffer.get(), rHeader.nSizeImage) != rHeader.nSizeImage) { return false; @@ -552,8 +552,8 @@ bool ImplReadDIBBits(SvStream& rIStm, DIBV5Header& rHeader, BitmapWriteAccess& r { for( ; nCount--; nY += nI ) { - sal_uInt8* pTmp; - if (rIStm.Read( pTmp = pBuf.get(), nAlignedWidth ) + sal_uInt8 * pTmp = pBuf.get(); + if (rIStm.ReadBytes(pTmp, nAlignedWidth) != nAlignedWidth) { return false; @@ -578,8 +578,8 @@ bool ImplReadDIBBits(SvStream& rIStm, DIBV5Header& rHeader, BitmapWriteAccess& r { for( ; nCount--; nY += nI ) { - sal_uInt8* pTmp; - if (rIStm.Read( pTmp = pBuf.get(), nAlignedWidth ) + sal_uInt8 * pTmp = pBuf.get(); + if (rIStm.ReadBytes(pTmp, nAlignedWidth) != nAlignedWidth) { return false; @@ -604,8 +604,8 @@ bool ImplReadDIBBits(SvStream& rIStm, DIBV5Header& rHeader, BitmapWriteAccess& r { for( ; nCount--; nY += nI ) { - sal_uInt8* pTmp; - if (rIStm.Read( pTmp = pBuf.get(), nAlignedWidth ) + sal_uInt8 * pTmp = pBuf.get(); + if (rIStm.ReadBytes(pTmp, nAlignedWidth) != nAlignedWidth) { return false; @@ -634,8 +634,8 @@ bool ImplReadDIBBits(SvStream& rIStm, DIBV5Header& rHeader, BitmapWriteAccess& r for( ; nCount--; nY += nI ) { - sal_uInt16* pTmp16; - if (rIStm.Read( ( pTmp16 = reinterpret_cast<sal_uInt16*>(pBuf.get()) ), nAlignedWidth ) + sal_uInt16 * pTmp16 = reinterpret_cast<sal_uInt16*>(pBuf.get()); + if (rIStm.ReadBytes(pTmp16, nAlignedWidth) != nAlignedWidth) { return false; @@ -656,8 +656,8 @@ bool ImplReadDIBBits(SvStream& rIStm, DIBV5Header& rHeader, BitmapWriteAccess& r for( ; nCount--; nY += nI ) { - sal_uInt8* pTmp; - if (rIStm.Read( pTmp = pBuf.get(), nAlignedWidth ) + sal_uInt8* pTmp = pBuf.get(); + if (rIStm.ReadBytes(pTmp, nAlignedWidth) != nAlignedWidth) { return false; @@ -696,7 +696,8 @@ bool ImplReadDIBBits(SvStream& rIStm, DIBV5Header& rHeader, BitmapWriteAccess& r for( ; nCount--; nY += nI ) { - if (rIStm.Read( ( pTmp32 = reinterpret_cast<sal_uInt32*>(pBuf.get()) ), nAlignedWidth ) + pTmp32 = reinterpret_cast<sal_uInt32*>(pBuf.get()); + if (rIStm.ReadBytes(pTmp32, nAlignedWidth) != nAlignedWidth) { return false; @@ -715,7 +716,8 @@ bool ImplReadDIBBits(SvStream& rIStm, DIBV5Header& rHeader, BitmapWriteAccess& r { for( ; nCount--; nY += nI ) { - if (rIStm.Read( ( pTmp32 = reinterpret_cast<sal_uInt32*>(pBuf.get()) ), nAlignedWidth ) + pTmp32 = reinterpret_cast<sal_uInt32*>(pBuf.get()); + if (rIStm.ReadBytes(pTmp32, nAlignedWidth) != nAlignedWidth) { return false; @@ -1015,7 +1017,7 @@ bool ImplWriteDIBPalette( SvStream& rOStm, BitmapReadAccess& rAcc ) *pTmpEntry++ = 0; } - rOStm.Write( pEntries.get(), nPalSize ); + rOStm.WriteBytes( pEntries.get(), nPalSize ); return( rOStm.GetError() == 0UL ); } @@ -1124,7 +1126,7 @@ bool ImplWriteRLE( SvStream& rOStm, BitmapReadAccess& rAcc, bool bRLE4 ) pBuf[ nBufCount++ ] = 0; pBuf[ nBufCount++ ] = 0; - rOStm.Write( pBuf.get(), nBufCount ); + rOStm.WriteBytes( pBuf.get(), nBufCount ); } rOStm.WriteUChar( 0 ); @@ -1141,22 +1143,22 @@ bool ImplWriteDIBBits(SvStream& rOStm, BitmapReadAccess& rAcc, BitmapReadAccess* SVBT32 aVal32; UInt32ToSVBT32( rMask.GetRedMask(), aVal32 ); - rOStm.Write( aVal32, 4UL ); + rOStm.WriteBytes( aVal32, 4UL ); UInt32ToSVBT32( rMask.GetGreenMask(), aVal32 ); - rOStm.Write( aVal32, 4UL ); + rOStm.WriteBytes( aVal32, 4UL ); UInt32ToSVBT32( rMask.GetBlueMask(), aVal32 ); - rOStm.Write( aVal32, 4UL ); + rOStm.WriteBytes( aVal32, 4UL ); rImageSize = rOStm.Tell(); if( rAcc.IsBottomUp() ) - rOStm.Write( rAcc.GetBuffer(), rAcc.Height() * rAcc.GetScanlineSize() ); + rOStm.WriteBytes(rAcc.GetBuffer(), rAcc.Height() * rAcc.GetScanlineSize()); else { for( long nY = rAcc.Height() - 1, nScanlineSize = rAcc.GetScanlineSize(); nY >= 0L; nY-- ) - rOStm.Write( rAcc.GetScanline( nY ), nScanlineSize ); + rOStm.WriteBytes( rAcc.GetScanline(nY), nScanlineSize ); } } else if(!pAccAlpha && ((RLE_4 == nCompression) || (RLE_8 == nCompression))) @@ -1203,7 +1205,7 @@ bool ImplWriteDIBBits(SvStream& rOStm, BitmapReadAccess& rAcc, BitmapReadAccess* if(bNative) { - rOStm.Write(rAcc.GetBuffer(), nAlignedWidth * rAcc.Height()); + rOStm.WriteBytes(rAcc.GetBuffer(), nAlignedWidth * rAcc.Height()); } else { @@ -1236,7 +1238,7 @@ bool ImplWriteDIBBits(SvStream& rOStm, BitmapReadAccess& rAcc, BitmapReadAccess* } *pTmp = cTmp; - rOStm.Write( pBuf.get(), nAlignedWidth ); + rOStm.WriteBytes( pBuf.get(), nAlignedWidth ); } } break; @@ -1264,7 +1266,7 @@ bool ImplWriteDIBBits(SvStream& rOStm, BitmapReadAccess& rAcc, BitmapReadAccess* cTmp |= rAcc.GetPixelIndex( nY, nX ) << ( --nShift << 2L ); } *pTmp = cTmp; - rOStm.Write( pBuf.get(), nAlignedWidth ); + rOStm.WriteBytes( pBuf.get(), nAlignedWidth ); } } break; @@ -1278,7 +1280,7 @@ bool ImplWriteDIBBits(SvStream& rOStm, BitmapReadAccess& rAcc, BitmapReadAccess* for( long nX = 0L; nX < nWidth; nX++ ) *pTmp++ = rAcc.GetPixelIndex( nY, nX ); - rOStm.Write( pBuf.get(), nAlignedWidth ); + rOStm.WriteBytes( pBuf.get(), nAlignedWidth ); } } break; @@ -1311,7 +1313,7 @@ bool ImplWriteDIBBits(SvStream& rOStm, BitmapReadAccess& rAcc, BitmapReadAccess* } } - rOStm.Write( pBuf.get(), nAlignedWidth ); + rOStm.WriteBytes( pBuf.get(), nAlignedWidth ); } } break; diff --git a/vcl/source/gdi/gdimtf.cxx b/vcl/source/gdi/gdimtf.cxx index afbce6be2e87..64811b3769e7 100644 --- a/vcl/source/gdi/gdimtf.cxx +++ b/vcl/source/gdi/gdimtf.cxx @@ -2758,7 +2758,7 @@ SvStream& ReadGDIMetaFile( SvStream& rIStm, GDIMetaFile& rGDIMetaFile ) aId[ 0 ] = 0; aId[ 6 ] = 0; - rIStm.Read( aId, 6 ); + rIStm.ReadBytes( aId, 6 ); if ( !strcmp( aId, "VCLMTF" ) ) { @@ -2861,7 +2861,7 @@ SvStream& GDIMetaFile::Write( SvStream& rOStm ) SvStreamEndian nOldFormat = rOStm.GetEndian(); rOStm.SetEndian( SvStreamEndian::LITTLE ); - rOStm.Write( "VCLMTF", 6 ); + rOStm.WriteBytes( "VCLMTF", 6 ); pCompat = new VersionCompat( rOStm, StreamMode::WRITE, 1 ); diff --git a/vcl/source/gdi/gfxlink.cxx b/vcl/source/gdi/gfxlink.cxx index fed0321f3ed8..c6db9866c3ef 100644 --- a/vcl/source/gdi/gfxlink.cxx +++ b/vcl/source/gdi/gfxlink.cxx @@ -234,7 +234,7 @@ bool GfxLink::ExportNative( SvStream& rOStream ) const if( IsSwappedOut() ) mpSwap->WriteTo( rOStream ); else if( GetData() ) - rOStream.Write( GetData(), GetDataSize() ); + rOStream.WriteBytes( GetData(), GetDataSize() ); } return ( rOStream.GetError() == ERRCODE_NONE ); @@ -258,7 +258,7 @@ SvStream& WriteGfxLink( SvStream& rOStream, const GfxLink& rGfxLink ) if( rGfxLink.IsSwappedOut() ) rGfxLink.mpSwap->WriteTo( rOStream ); else if( rGfxLink.GetData() ) - rOStream.Write( rGfxLink.GetData(), rGfxLink.GetDataSize() ); + rOStream.WriteBytes( rGfxLink.GetData(), rGfxLink.GetDataSize() ); } return rOStream; @@ -288,7 +288,7 @@ SvStream& ReadGfxLink( SvStream& rIStream, GfxLink& rGfxLink) pCompat.reset(); // destructor writes stuff into the header pBuf = new sal_uInt8[ nSize ]; - rIStream.Read( pBuf, nSize ); + rIStream.ReadBytes( pBuf, nSize ); rGfxLink = GfxLink( pBuf, nSize, (GfxLinkType) nType ); rGfxLink.SetUserId( nUserId ); @@ -316,7 +316,7 @@ ImpSwap::ImpSwap( sal_uInt8* pData, sal_uLong nDataSize ) : std::unique_ptr<SvStream> xOStm(::utl::UcbStreamHelper::CreateStream( maURL, STREAM_READWRITE | StreamMode::SHARE_DENYWRITE )); if( xOStm ) { - xOStm->Write( pData, mnDataSize ); + xOStm->WriteBytes( pData, mnDataSize ); bool bError = ( ERRCODE_NONE != xOStm->GetError() ); xOStm.reset(); @@ -346,7 +346,7 @@ sal_uInt8* ImpSwap::GetData() const if( xIStm ) { pData = new sal_uInt8[ mnDataSize ]; - xIStm->Read( pData, mnDataSize ); + xIStm->ReadBytes( pData, mnDataSize ); bool bError = ( ERRCODE_NONE != xIStm->GetError() ); sal_Size nActReadSize = xIStm->Tell(); if (nActReadSize != mnDataSize) @@ -376,7 +376,7 @@ void ImpSwap::WriteTo( SvStream& rOStm ) const if( pData ) { - rOStm.Write( pData, mnDataSize ); + rOStm.WriteBytes( pData, mnDataSize ); delete[] pData; } } diff --git a/vcl/source/gdi/impgraph.cxx b/vcl/source/gdi/impgraph.cxx index d2ce7646075f..371350bfdc1e 100644 --- a/vcl/source/gdi/impgraph.cxx +++ b/vcl/source/gdi/impgraph.cxx @@ -1553,7 +1553,7 @@ SvStream& ReadImpGraphic( SvStream& rIStm, ImpGraphic& rImpGraphic ) { SvgDataArray aNewData(nSvgDataArrayLength); - rIStm.Read(aNewData.getArray(), nSvgDataArrayLength); + rIStm.ReadBytes(aNewData.getArray(), nSvgDataArrayLength); OUString aPath = rIStm.ReadUniOrByteString(rIStm.GetStreamCharSet()); if (!rIStm.GetError()) @@ -1625,7 +1625,8 @@ SvStream& WriteImpGraphic( SvStream& rOStm, const ImpGraphic& rImpGraphic ) rOStm.WriteUInt32( nSvgMagic ); rOStm.WriteUInt32( rImpGraphic.getSvgData()->getSvgDataArrayLength() ); - rOStm.Write(rImpGraphic.getSvgData()->getSvgDataArray().getConstArray(), rImpGraphic.getSvgData()->getSvgDataArrayLength()); + rOStm.WriteBytes(rImpGraphic.getSvgData()->getSvgDataArray().getConstArray(), + rImpGraphic.getSvgData()->getSvgDataArrayLength()); rOStm.WriteUniOrByteString(rImpGraphic.getSvgData()->getPath(), rOStm.GetStreamCharSet()); } diff --git a/vcl/source/gdi/jobset.cxx b/vcl/source/gdi/jobset.cxx index b5627eecda64..00362bb9740e 100644 --- a/vcl/source/gdi/jobset.cxx +++ b/vcl/source/gdi/jobset.cxx @@ -235,7 +235,7 @@ SvStream& ReadJobSetup( SvStream& rIStream, JobSetup& rJobSetup ) } sal_Size nFirstPos = rIStream.Tell(); std::unique_ptr<char[]> pTempBuf(new char[nRead]); - rIStream.Read(pTempBuf.get(), nRead); + rIStream.ReadBytes(pTempBuf.get(), nRead); if (nRead >= sizeof(ImplOldJobSetupData)) { ImplOldJobSetupData* pData = reinterpret_cast<ImplOldJobSetupData*>(pTempBuf.get()); @@ -341,9 +341,9 @@ SvStream& WriteJobSetup( SvStream& rOStream, const JobSetup& rJobSetup ) int nPos = rOStream.Tell(); rOStream.WriteUInt16( nLen ); rOStream.WriteUInt16( nSystem ); - rOStream.Write( &aOldData, sizeof( aOldData ) ); - rOStream.Write( &aOldJobData, nOldJobDataSize ); - rOStream.Write( pJobData->mpDriverData, pJobData->mnDriverDataLen ); + rOStream.WriteBytes( &aOldData, sizeof( aOldData ) ); + rOStream.WriteBytes( &aOldJobData, nOldJobDataSize ); + rOStream.WriteBytes( pJobData->mpDriverData, pJobData->mnDriverDataLen ); std::unordered_map< OUString, OUString, OUStringHash >::const_iterator it; for( it = pJobData->maValueMap.begin(); it != pJobData->maValueMap.end(); ++it ) { diff --git a/vcl/source/gdi/metaact.cxx b/vcl/source/gdi/metaact.cxx index 869758780613..059b62e91788 100644 --- a/vcl/source/gdi/metaact.cxx +++ b/vcl/source/gdi/metaact.cxx @@ -3349,7 +3349,7 @@ void MetaCommentAction::Write( SvStream& rOStm, ImplMetaWriteData* pData ) rOStm.WriteInt32( mnValue ).WriteUInt32( mnDataSize ); if ( mnDataSize ) - rOStm.Write( mpData, mnDataSize ); + rOStm.WriteBytes( mpData, mnDataSize ); } void MetaCommentAction::Read( SvStream& rIStm, ImplMetaReadData* ) @@ -3365,7 +3365,7 @@ void MetaCommentAction::Read( SvStream& rIStm, ImplMetaReadData* ) if( mnDataSize ) { mpData = new sal_uInt8[ mnDataSize ]; - rIStm.Read( mpData, mnDataSize ); + rIStm.ReadBytes(mpData, mnDataSize); } else mpData = nullptr; diff --git a/vcl/source/gdi/pdfextoutdevdata.cxx b/vcl/source/gdi/pdfextoutdevdata.cxx index ca25461b3693..2647047f8502 100644 --- a/vcl/source/gdi/pdfextoutdevdata.cxx +++ b/vcl/source/gdi/pdfextoutdevdata.cxx @@ -469,7 +469,7 @@ bool PageSyncData::PlaySyncPageAct( PDFWriter& rWriter, sal_uInt32& rCurGDIMtfAc sal_uInt32 nBytes = aGfxLink.GetDataSize(); if( pData && nBytes ) { - aTmp.Write( pData, nBytes ); + aTmp.WriteBytes( pData, nBytes ); rWriter.DrawJPGBitmap( aTmp, aGraphic.GetBitmap().GetBitCount() > 8, aGraphic.GetSizePixel(), aOutputRect, aMask ); } diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx index 26df395f92d3..b2edf76c5729 100644 --- a/vcl/source/gdi/pdfwriter_impl.cxx +++ b/vcl/source/gdi/pdfwriter_impl.cxx @@ -2110,7 +2110,7 @@ bool PDFWriterImpl::compressStream( SvMemoryStream* pStream ) pStream->Seek( STREAM_SEEK_TO_BEGIN ); aStream.Seek( STREAM_SEEK_TO_BEGIN ); pStream->SetStreamSize( nEndPos ); - pStream->Write( aStream.GetData(), nEndPos ); + pStream->WriteBytes( aStream.GetData(), nEndPos ); return true; #else (void)pStream; @@ -2155,7 +2155,8 @@ bool PDFWriterImpl::writeBuffer( const void* pBuffer, sal_uInt64 nBytes ) if( !m_aOutputStreams.empty() ) { m_aOutputStreams.front().m_pStream->Seek( STREAM_SEEK_TO_END ); - m_aOutputStreams.front().m_pStream->Write( pBuffer, sal::static_int_cast<sal_Size>(nBytes) ); + m_aOutputStreams.front().m_pStream->WriteBytes( + pBuffer, sal::static_int_cast<sal_Size>(nBytes)); return true; } @@ -9997,7 +9998,8 @@ void PDFWriterImpl::drawTransparent( const tools::PolyPolygon& rPolyPoly, sal_uI aContent.append( " S\n" ); else aContent.append( " f*\n" ); - m_aTransparentObjects.back().m_pContentStream->Write( aContent.getStr(), aContent.getLength() ); + m_aTransparentObjects.back().m_pContentStream->WriteBytes( + aContent.getStr(), aContent.getLength() ); OStringBuffer aObjName( 16 ); aObjName.append( "Tr" ); @@ -11808,7 +11810,8 @@ void PDFWriterImpl::drawWallpaper( const Rectangle& rRect, const Wallpaper& rWal m_aTilings.back().m_nObject = createObject(); m_aTilings.back().m_aRectangle = Rectangle( Point( 0, 0 ), aConvertRect.GetSize() ); m_aTilings.back().m_pTilingStream = new SvMemoryStream(); - m_aTilings.back().m_pTilingStream->Write( aTilingStream.getStr(), aTilingStream.getLength() ); + m_aTilings.back().m_pTilingStream->WriteBytes( + aTilingStream.getStr(), aTilingStream.getLength() ); // phase the tiling so wallpaper begins on upper left if ((aConvertRect.GetWidth() == 0) || (aConvertRect.GetHeight() == 0)) throw o3tl::divide_by_zero(); diff --git a/vcl/source/gdi/pngread.cxx b/vcl/source/gdi/pngread.cxx index 377d41be6df6..57dc337ad296 100644 --- a/vcl/source/gdi/pngread.cxx +++ b/vcl/source/gdi/pngread.cxx @@ -297,7 +297,7 @@ bool PNGReaderImpl::ReadNextChunk() sal_Int32 nBytesRead = 0; do { sal_uInt8* pPtr = &rChunkData.aData[ nBytesRead ]; - nBytesRead += mrPNGStream.Read( pPtr, mnChunkLen - nBytesRead ); + nBytesRead += mrPNGStream.ReadBytes(pPtr, mnChunkLen - nBytesRead); } while ( ( nBytesRead < mnChunkLen ) && ( mrPNGStream.GetError() == ERRCODE_NONE ) ); nCRC32 = rtl_crc32( nCRC32, &rChunkData.aData[ 0 ], mnChunkLen ); diff --git a/vcl/source/gdi/pngwrite.cxx b/vcl/source/gdi/pngwrite.cxx index f4eb63912490..4f61e92b1041 100644 --- a/vcl/source/gdi/pngwrite.cxx +++ b/vcl/source/gdi/pngwrite.cxx @@ -279,7 +279,7 @@ bool PNGWriterImpl::Write(SvStream& rOStm) rOStm.WriteUInt32(nDataSize); rOStm.WriteUInt32(aBeg->nType); if (nDataSize) - rOStm.Write(&aBeg->aData[0], nDataSize); + rOStm.WriteBytes(&aBeg->aData[0], nDataSize); rOStm.WriteUInt32(nCRC); ++aBeg; } diff --git a/vcl/source/gdi/svgdata.cxx b/vcl/source/gdi/svgdata.cxx index 6c0fc705f1f5..2efe52f332ee 100644 --- a/vcl/source/gdi/svgdata.cxx +++ b/vcl/source/gdi/svgdata.cxx @@ -175,7 +175,7 @@ SvgData::SvgData(const OUString& rPath): if (nStmLen) { maSvgDataArray.realloc(nStmLen); - rIStm.Read(maSvgDataArray.begin(), nStmLen); + rIStm.ReadBytes(maSvgDataArray.begin(), nStmLen); if (rIStm.GetError()) { diff --git a/vcl/source/gdi/svmconverter.cxx b/vcl/source/gdi/svmconverter.cxx index f28daa662aad..ef8ad97ecdd3 100644 --- a/vcl/source/gdi/svmconverter.cxx +++ b/vcl/source/gdi/svmconverter.cxx @@ -242,7 +242,7 @@ void ImplWriteFont( SvStream& rOStm, const vcl::Font& rFont, rActualCharSet = GetStoreCharSet( rFont.GetCharSet() ); ImplWriteColor( rOStm, rFont.GetColor() ); ImplWriteColor( rOStm, rFont.GetFillColor() ); - rOStm.Write( aName, 32 ); + rOStm.WriteBytes( aName, 32 ); WritePair( rOStm, rFont.GetFontSize() ); rOStm.WriteInt16( 0 ); // no character orientation anymore rOStm.WriteInt16( rFont.GetOrientation() ); @@ -477,7 +477,7 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf ) sal_Int16 nVersion; // read header - rIStm.Read( aCode, sizeof( aCode ) ); // Identifier + rIStm.ReadBytes(aCode, sizeof(aCode)); // Identifier rIStm.ReadInt16( nSize ); // Size rIStm.ReadInt16( nVersion ); // Version sal_Int32 nTmp32(0); @@ -817,7 +817,7 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf ) ImplReadColor( rIStm, aActionColor ); aFont.SetColor( aActionColor ); ImplReadColor( rIStm, aActionColor ); aFont.SetFillColor( aActionColor ); - rIStm.Read( aName, 32 ); + rIStm.ReadBytes( aName, 32 ); aFont.SetFamilyName( OUString( aName, strlen(aName), rIStm.GetStreamCharSet() ) ); rIStm.ReadInt32( nWidth ).ReadInt32( nHeight ); rIStm.ReadInt16( nCharOrient ).ReadInt16( nLineOrient ); @@ -1330,7 +1330,7 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf ) if( nDataSize ) { pData = new sal_uInt8[ nDataSize ]; - rIStm.Read( pData, nDataSize ); + rIStm.ReadBytes( pData, nDataSize ); } else pData = nullptr; @@ -1736,7 +1736,7 @@ sal_uLong SVMConverter::ImplWriteActions( SvStream& rOStm, GDIMetaFile& rMtf, rOStm.WriteInt32( pAct->GetIndex() ); rOStm.WriteInt32( pAct->GetLen() ); rOStm.WriteInt32( nStrLen ); - rOStm.Write( aText.getStr(), nStrLen + 1 ); + rOStm.WriteBytes( aText.getStr(), nStrLen + 1 ); nCount++; } break; @@ -1776,7 +1776,7 @@ sal_uLong SVMConverter::ImplWriteActions( SvStream& rOStm, GDIMetaFile& rMtf, rOStm.WriteInt32( nLen ); rOStm.WriteInt32( nLen ); rOStm.WriteInt32( nAryLen ); - rOStm.Write( aText.getStr()+pAct->GetIndex(), nLen + 1 ); + rOStm.WriteBytes( aText.getStr()+pAct->GetIndex(), nLen + 1 ); for (sal_Int32 n = 0; n < nAryLen; ++n) rOStm.WriteInt32( pDXArray[ n ] ); @@ -1802,7 +1802,7 @@ sal_uLong SVMConverter::ImplWriteActions( SvStream& rOStm, GDIMetaFile& rMtf, rOStm.WriteInt32( pAct->GetLen() ); rOStm.WriteInt32( nStrLen ); rOStm.WriteInt32( pAct->GetWidth() ); - rOStm.Write( aText.getStr(), nStrLen + 1 ); + rOStm.WriteBytes( aText.getStr(), nStrLen + 1 ); nCount++; } break; @@ -2441,7 +2441,7 @@ sal_uLong SVMConverter::ImplWriteActions( SvStream& rOStm, GDIMetaFile& rMtf, rOStm.WriteInt32( pA->GetValue() ).WriteUInt32( nDataSize ); if( nDataSize ) - rOStm.Write( pA->GetData(), nDataSize ); + rOStm.WriteBytes( pA->GetData(), nDataSize ); rOStm.WriteInt32( 0 ); // number of actions that follow this comment diff --git a/vcl/source/image/ImplImageTree.cxx b/vcl/source/image/ImplImageTree.cxx index 49b6d97c1ffb..b512dd43047a 100644 --- a/vcl/source/image/ImplImageTree.cxx +++ b/vcl/source/image/ImplImageTree.cxx @@ -70,7 +70,7 @@ std::shared_ptr<SvStream> wrapStream(css::uno::Reference< css::io::XInputStream sal_Int32 const size = 2048; css::uno::Sequence< sal_Int8 > data(size); sal_Int32 n = stream->readBytes(data, size); - s->Write(data.getConstArray(), n); + s->WriteBytes(data.getConstArray(), n); if (n < size) break; } diff --git a/vcl/unx/generic/printer/jobdata.cxx b/vcl/unx/generic/printer/jobdata.cxx index aead34c96eb1..730487dbc294 100644 --- a/vcl/unx/generic/printer/jobdata.cxx +++ b/vcl/unx/generic/printer/jobdata.cxx @@ -176,7 +176,7 @@ bool JobData::getStreamBuffer( void*& pData, sal_uInt32& bytes ) sal_uLong nBytes; std::unique_ptr<char[]> pContextBuffer(m_aContext.getStreamableBuffer( nBytes )); if( nBytes ) - aStream.Write( pContextBuffer.get(), nBytes ); + aStream.WriteBytes( pContextBuffer.get(), nBytes ); pContextBuffer.reset(); // success @@ -276,7 +276,7 @@ bool JobData::constructFromStreamBuffer( void* pData, sal_uInt32 bytes, JobData& rJobData.m_aContext.setParser( rJobData.m_pParser ); const sal_uInt64 nBytes = bytes - aStream.Tell(); std::unique_ptr<char[]> pRemain(new char[bytes - aStream.Tell()]); - aStream.Read( pRemain.get(), nBytes ); + aStream.ReadBytes( pRemain.get(), nBytes ); rJobData.m_aContext.rebuildFromStreamBuffer( pRemain.get(), nBytes ); bContext = true; } diff --git a/vcl/workben/svpclient.cxx b/vcl/workben/svpclient.cxx index 65d16c11e0fe..bcb14219e6a3 100644 --- a/vcl/workben/svpclient.cxx +++ b/vcl/workben/svpclient.cxx @@ -266,7 +266,7 @@ IMPL_LINK_NOARG_TYPED( MyWin, SelectHdl, ListBox&, void) aCommand.append( OUStringToOString( aEntry.copy( nPos+2 ), RTL_TEXTENCODING_ASCII_US ) ); OString aAnswer( processCommand( aCommand.makeStringAndClear() ) ); SvMemoryStream aStream( aAnswer.getLength() ); - aStream.Write( aAnswer.getStr(), aAnswer.getLength() ); + aStream.WriteBytes( aAnswer.getStr(), aAnswer.getLength() ); aStream.Seek( STREAM_SEEK_TO_BEGIN ); Graphic aGraphicResult; |