diff options
author | Noel Grandin <noel@peralex.com> | 2014-12-12 10:45:32 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2014-12-12 10:46:23 +0200 |
commit | aa2f02a4dc8a05f49e679a26f2beebb9d66b2325 (patch) | |
tree | bed0e3b1b000fceaf09552bc703d19a236de7bbc /oox | |
parent | df46ec0580b625efe8bd747bed54bc4d4d71f073 (diff) |
remove operator>> and operator<< methods
in favour of ReadXXX/WriteXXX methods
Change-Id: I69eebee3a8ce5b40301db7940a1d85915c0bf6f4
Diffstat (limited to 'oox')
-rw-r--r-- | oox/source/crypto/DocumentDecryption.cxx | 25 | ||||
-rw-r--r-- | oox/source/crypto/DocumentEncryption.cxx | 4 | ||||
-rw-r--r-- | oox/source/crypto/Standard2007Engine.cxx | 4 | ||||
-rw-r--r-- | oox/source/dump/dffdumper.cxx | 6 | ||||
-rw-r--r-- | oox/source/dump/dumperbase.cxx | 17 | ||||
-rw-r--r-- | oox/source/dump/oledumper.cxx | 12 | ||||
-rw-r--r-- | oox/source/helper/binaryinputstream.cxx | 8 | ||||
-rw-r--r-- | oox/source/ole/axbinaryreader.cxx | 4 | ||||
-rw-r--r-- | oox/source/ole/axcontrol.cxx | 37 | ||||
-rw-r--r-- | oox/source/ole/olehelper.cxx | 16 | ||||
-rw-r--r-- | oox/source/ole/vbacontrol.cxx | 3 | ||||
-rw-r--r-- | oox/source/ole/vbahelper.cxx | 3 | ||||
-rw-r--r-- | oox/source/ole/vbainputstream.cxx | 2 |
13 files changed, 81 insertions, 60 deletions
diff --git a/oox/source/crypto/DocumentDecryption.cxx b/oox/source/crypto/DocumentDecryption.cxx index 50a886875c11..fc93e0b46a31 100644 --- a/oox/source/crypto/DocumentDecryption.cxx +++ b/oox/source/crypto/DocumentDecryption.cxx @@ -264,33 +264,32 @@ bool DocumentDecryption::readStandard2007EncryptionInfo(BinaryInputStream& rStre mEngine.reset(engine); StandardEncryptionInfo& info = engine->getInfo(); - rStream >> info.header.flags; + info.header.flags = rStream.readuInt32(); if( getFlag( info.header.flags, ENCRYPTINFO_EXTERNAL ) ) return false; - sal_uInt32 nHeaderSize; - rStream >> nHeaderSize; + sal_uInt32 nHeaderSize = rStream.readuInt32(); sal_uInt32 actualHeaderSize = sizeof(info.header); if( (nHeaderSize < actualHeaderSize) ) return false; - rStream >> info.header.flags; - rStream >> info.header.sizeExtra; - rStream >> info.header.algId; - rStream >> info.header.algIdHash; - rStream >> info.header.keyBits; - rStream >> info.header.providedType; - rStream >> info.header.reserved1; - rStream >> info.header.reserved2; + info.header.flags = rStream.readuInt32(); + info.header.sizeExtra = rStream.readuInt32(); + info.header.algId = rStream.readuInt32(); + info.header.algIdHash = rStream.readuInt32(); + info.header.keyBits = rStream.readuInt32(); + info.header.providedType = rStream.readuInt32(); + info.header.reserved1 = rStream.readuInt32(); + info.header.reserved2 = rStream.readuInt32(); rStream.skip( nHeaderSize - actualHeaderSize ); - rStream >> info.verifier.saltSize; + info.verifier.saltSize = rStream.readuInt32(); rStream.readArray(info.verifier.salt, SAL_N_ELEMENTS(info.verifier.salt)); rStream.readArray(info.verifier.encryptedVerifier, SAL_N_ELEMENTS(info.verifier.encryptedVerifier)); - rStream >> info.verifier.encryptedVerifierHashSize; + info.verifier.encryptedVerifierHashSize = rStream.readuInt32(); rStream.readArray(info.verifier.encryptedVerifierHash, SAL_N_ELEMENTS(info.verifier.encryptedVerifierHash)); if( info.verifier.saltSize != 16 ) diff --git a/oox/source/crypto/DocumentEncryption.cxx b/oox/source/crypto/DocumentEncryption.cxx index 8928101a9bc2..cd6527aa95a2 100644 --- a/oox/source/crypto/DocumentEncryption.cxx +++ b/oox/source/crypto/DocumentEncryption.cxx @@ -59,8 +59,8 @@ bool DocumentEncryption::encrypt() BinaryXInputStream aDocumentInputStream( xInputStream, false ); aDocumentInputStream.seekToStart(); - aEncryptedPackageStream.writeValue<sal_uInt32>( aLength ); // size - aEncryptedPackageStream.writeValue<sal_uInt32>( 0 ); // reserved + aEncryptedPackageStream.WriteUInt32( aLength ); // size + aEncryptedPackageStream.WriteUInt32( 0U ); // reserved mEngine.encrypt(aDocumentInputStream, aEncryptedPackageStream); diff --git a/oox/source/crypto/Standard2007Engine.cxx b/oox/source/crypto/Standard2007Engine.cxx index c59e840c7b3d..311fea7f930e 100644 --- a/oox/source/crypto/Standard2007Engine.cxx +++ b/oox/source/crypto/Standard2007Engine.cxx @@ -221,7 +221,7 @@ bool Standard2007Engine::writeEncryptionInfo(const OUString& password, BinaryXOu if (!generateVerifier()) return false; - rStream.writeValue(VERSION_INFO_2007_FORMAT); + rStream.WriteUInt32(VERSION_INFO_2007_FORMAT); sal_uInt32 cspNameSize = (lclCspName.getLength() * 2) + 2; @@ -233,7 +233,7 @@ bool Standard2007Engine::writeEncryptionInfo(const OUString& password, BinaryXOu rStream.writeMemory(&mInfo.header, encryptionHeaderSize); rStream.writeUnicodeArray(lclCspName); - rStream.writeValue<sal_uInt16>(0); + rStream.WriteUInt16(0); sal_uInt32 encryptionVerifierSize = static_cast<sal_uInt32>(sizeof(EncryptionVerifierAES)); rStream.writeMemory(&mInfo.verifier, encryptionVerifierSize); diff --git a/oox/source/dump/dffdumper.cxx b/oox/source/dump/dffdumper.cxx index 318a129541ea..e2f76a1e25ae 100644 --- a/oox/source/dump/dffdumper.cxx +++ b/oox/source/dump/dffdumper.cxx @@ -47,9 +47,9 @@ const sal_uInt16 DFF_OPT_FLAGSMASK = 0x003F; bool DffStreamObject::implReadRecordHeader( BinaryInputStream& rBaseStrm, sal_Int64& ornRecId, sal_Int64& ornRecSize ) { - sal_uInt16 nRecId; - rBaseStrm >> mnInstVer >> nRecId >> mnRealSize; - ornRecId = nRecId; + mnInstVer = rBaseStrm.readuInt16(); + ornRecId = rBaseStrm.readuInt16(); + mnRealSize = rBaseStrm.readInt32(); ornRecSize = isContainer() ? 0 : mnRealSize; return !rBaseStrm.isEof(); } diff --git a/oox/source/dump/dumperbase.cxx b/oox/source/dump/dumperbase.cxx index 2dac7bc006b4..556b685ab5c4 100644 --- a/oox/source/dump/dumperbase.cxx +++ b/oox/source/dump/dumperbase.cxx @@ -2157,8 +2157,7 @@ void InputObjectBase::dumpArray( const String& rName, sal_Int32 nBytes, sal_Unic sal_Unicode InputObjectBase::dumpUnicode( const String& rName ) { - sal_uInt16 nChar; - *mxStrm >> nChar; + sal_uInt16 nChar = mxStrm->readuInt16(); sal_Unicode cChar = static_cast< sal_Unicode >( nChar ); writeCharItem( rName( "char" ), cChar ); return cChar; @@ -2185,7 +2184,9 @@ OUString InputObjectBase::dumpUnicodeArray( const String& rName, sal_Int32 nLen, { OUStringBuffer aBuffer; for( sal_Int32 nIndex = 0; !mxStrm->isEof() && (nIndex < nLen); ++nIndex ) + { aBuffer.append( static_cast< sal_Unicode >( mxStrm->readuInt16() ) ); + } OUString aString = aBuffer.makeStringAndClear(); if( bHideTrailingNul ) aString = StringHelper::trimTrailingNul( aString ); @@ -2249,23 +2250,23 @@ OUString InputObjectBase::dumpGuid( const String& rName ) sal_uInt16 nData16; sal_uInt8 nData8; - *mxStrm >> nData32; + nData32 = mxStrm->readuInt32(); StringHelper::appendHex( aBuffer, nData32, false ); aBuffer.append( '-' ); - *mxStrm >> nData16; + nData16 = mxStrm->readuInt16(); StringHelper::appendHex( aBuffer, nData16, false ); aBuffer.append( '-' ); - *mxStrm >> nData16; + nData16 = mxStrm->readuInt16(); StringHelper::appendHex( aBuffer, nData16, false ); aBuffer.append( '-' ); - *mxStrm >> nData8; + nData8 = mxStrm->readuChar(); StringHelper::appendHex( aBuffer, nData8, false ); - *mxStrm >> nData8; + nData8 = mxStrm->readuChar( ); StringHelper::appendHex( aBuffer, nData8, false ); aBuffer.append( '-' ); for( int nIndex = 0; nIndex < 6; ++nIndex ) { - *mxStrm >> nData8; + nData8 = mxStrm->readuChar( ); StringHelper::appendHex( aBuffer, nData8, false ); } StringHelper::enclose( aBuffer, '{', '}' ); diff --git a/oox/source/dump/oledumper.cxx b/oox/source/dump/oledumper.cxx index a16ea7121d54..feb51ff08ebf 100644 --- a/oox/source/dump/oledumper.cxx +++ b/oox/source/dump/oledumper.cxx @@ -546,8 +546,8 @@ bool ComCtlObjectBase::dumpComCtlHeader( sal_uInt32 nExpId, sal_uInt16 nExpMajor // no idea if all this is correct... sal_uInt32 nId = dumpHex< sal_uInt32 >( "header-id", "COMCTL-HEADER-IDS" ); ItemGuard aItem( mxOut, "version" ); - sal_uInt16 nMinor, nMajor; - *mxStrm >> nMinor >> nMajor; + sal_uInt16 nMinor = mxStrm->readuInt16(); + sal_uInt16 nMajor = mxStrm->readuInt16(); mxOut->writeDec( nMajor ); mxOut->writeChar( '.' ); mxOut->writeDec( nMinor ); @@ -1042,8 +1042,8 @@ void AxPropertyObjectBase::constructAxPropObj( const String& rPropNameList, bool void AxPropertyObjectBase::dumpVersion() { ItemGuard aItem( mxOut, "version" ); - sal_uInt8 nMinor, nMajor; - *mxStrm >> nMinor >> nMajor; + sal_uInt8 nMinor = mxStrm->readuChar(); + sal_uInt8 nMajor = mxStrm->readuChar(); mxOut->writeDec( nMajor ); mxOut->writeChar( '.' ); mxOut->writeDec( nMinor ); @@ -1885,8 +1885,8 @@ bool VbaDirStreamObject::implIsValid() const bool VbaDirStreamObject::implReadRecordHeader( BinaryInputStream& rBaseStrm, sal_Int64& ornRecId, sal_Int64& ornRecSize ) { - ornRecId = rBaseStrm.readuInt16(); - ornRecSize = rBaseStrm.readInt32(); + ornRecId = rBaseStrm.readuInt16(); + ornRecSize = rBaseStrm.readInt32(); // for no obvious reason, PROJECTVERSION record contains size field of 4, but is 6 bytes long if( ornRecId == 9 ) diff --git a/oox/source/helper/binaryinputstream.cxx b/oox/source/helper/binaryinputstream.cxx index b514beb70fba..7597981c29ec 100644 --- a/oox/source/helper/binaryinputstream.cxx +++ b/oox/source/helper/binaryinputstream.cxx @@ -42,8 +42,12 @@ const sal_Int32 INPUTSTREAM_BUFFERSIZE = 0x8000; OUString BinaryInputStream::readNulUnicodeArray() { OUStringBuffer aBuffer; - for( sal_uInt16 nChar = readuInt16(); !mbEof && (nChar > 0); readValue( nChar ) ) - aBuffer.append( static_cast< sal_Unicode >( nChar ) ); + for (;;) + { + sal_uInt16 nChar = readuInt16(); + if ( mbEof || (nChar < 0) ) break; + aBuffer.append( static_cast< sal_Unicode >( nChar ) ); + } return aBuffer.makeStringAndClear(); } diff --git a/oox/source/ole/axbinaryreader.cxx b/oox/source/ole/axbinaryreader.cxx index cee80c4fa08a..b06910786669 100644 --- a/oox/source/ole/axbinaryreader.cxx +++ b/oox/source/ole/axbinaryreader.cxx @@ -175,11 +175,11 @@ AxBinaryPropertyReader::AxBinaryPropertyReader( BinaryInputStream& rInStrm, bool { // version and size of property block maInStrm.skip( 2 ); - sal_uInt16 nBlockSize = maInStrm.readValue< sal_uInt16 >(); + sal_uInt16 nBlockSize = maInStrm.readuInt16(); mnPropsEnd = maInStrm.tell() + nBlockSize; // flagfield containing existing properties if( b64BitPropFlags ) - maInStrm >> mnPropFlags; + mnPropFlags = maInStrm.readInt64(); else mnPropFlags = maInStrm.readuInt32(); mnNextProp = 1; diff --git a/oox/source/ole/axcontrol.cxx b/oox/source/ole/axcontrol.cxx index 4dca8af8d198..8efc05bf952c 100644 --- a/oox/source/ole/axcontrol.cxx +++ b/oox/source/ole/axcontrol.cxx @@ -663,7 +663,9 @@ bool ComCtlModelBase::importBinaryModel( BinaryInputStream& rInStrm ) if( importSizePart( rInStrm ) && readPartHeader( rInStrm, getDataPartId(), mnVersion ) ) { // if flags part exists, the first int32 of the data part contains its size - sal_uInt32 nCommonPartSize = mbCommonPart ? rInStrm.readuInt32() : 0; + sal_uInt32 nCommonPartSize = 0; + if (mbCommonPart) + nCommonPartSize = rInStrm.readuInt32(); // implementations must read the exact amount of data, stream must point to its end afterwards importControlData( rInStrm ); // read following parts @@ -706,9 +708,9 @@ sal_uInt32 ComCtlModelBase::getDataPartId() const bool ComCtlModelBase::readPartHeader( BinaryInputStream& rInStrm, sal_uInt32 nExpPartId, sal_uInt16 nExpMajor, sal_uInt16 nExpMinor ) { // no idea if all this is correct... - sal_uInt32 nPartId; - sal_uInt16 nMajor, nMinor; - rInStrm >> nPartId >> nMinor >> nMajor; + sal_uInt32 nPartId = rInStrm.readuInt32(); + sal_uInt16 nMinor = rInStrm.readuInt16(); + sal_uInt16 nMajor = rInStrm.readuInt16(); bool bPartId = nPartId == nExpPartId; OSL_ENSURE( bPartId, "ComCtlObjectBase::readPartHeader - unexpected part identifier" ); bool bVersion = ((nExpMajor == SAL_MAX_UINT16) || (nExpMajor == nMajor)) && ((nExpMinor == SAL_MAX_UINT16) || (nExpMinor == nMinor)); @@ -720,7 +722,8 @@ bool ComCtlModelBase::importSizePart( BinaryInputStream& rInStrm ) { if( readPartHeader( rInStrm, COMCTL_ID_SIZE, 0, 8 ) ) { - rInStrm >> maSize.first >> maSize.second; + maSize.first = rInStrm.readInt32(); + maSize.second = rInStrm.readInt32(); return !rInStrm.isEof(); } return false; @@ -732,7 +735,7 @@ bool ComCtlModelBase::importCommonPart( BinaryInputStream& rInStrm, sal_uInt32 n if( (nPartSize >= 16) && readPartHeader( rInStrm, COMCTL_ID_COMMONDATA, 5, 0 ) ) { rInStrm.skip( 4 ); - rInStrm >> mnFlags; + mnFlags = rInStrm.readuInt32(); // implementations may read less than the exact amount of data importCommonExtraData( rInStrm ); rInStrm.seek( nEndPos ); @@ -747,8 +750,7 @@ bool ComCtlModelBase::importComplexPart( BinaryInputStream& rInStrm ) { if( readPartHeader( rInStrm, COMCTL_ID_COMPLEXDATA, 5, 1 ) ) { - sal_uInt32 nContFlags; - rInStrm >> nContFlags; + sal_uInt32 nContFlags = rInStrm.readuInt32(); bool bReadOk = (!getFlag( nContFlags, COMCTL_COMPLEX_FONT ) || OleHelper::importStdFont( maFontData, rInStrm, true )) && (!getFlag( nContFlags, COMCTL_COMPLEX_MOUSEICON ) || OleHelper::importStdPic( maMouseIcon, rInStrm, true )); @@ -783,7 +785,12 @@ void ComCtlScrollBarModel::convertProperties( PropertyMap& rPropMap, const Contr void ComCtlScrollBarModel::importControlData( BinaryInputStream& rInStrm ) { - rInStrm >> mnScrollBarFlags >> mnLargeChange >> mnSmallChange >> mnMin >> mnMax >> mnPosition; + mnScrollBarFlags = rInStrm.readuInt32(); + mnLargeChange = rInStrm.readInt32(); + mnSmallChange = rInStrm.readInt32(); + mnMin = rInStrm.readInt32(); + mnMax = rInStrm.readInt32(); + mnPosition = rInStrm.readInt32(); } ComCtlProgressBarModel::ComCtlProgressBarModel( sal_uInt16 nVersion ) : @@ -813,9 +820,13 @@ void ComCtlProgressBarModel::convertProperties( PropertyMap& rPropMap, const Con void ComCtlProgressBarModel::importControlData( BinaryInputStream& rInStrm ) { - rInStrm >> mfMin >> mfMax; + mfMin = rInStrm.readFloat(); + mfMax = rInStrm.readFloat(); if( mnVersion == COMCTL_VERSION_60 ) - rInStrm >> mnVertical >> mnSmooth; + { + mnVertical = rInStrm.readuInt16(); + mnSmooth = rInStrm.readuInt16(); + } } AxControlModelBase::AxControlModelBase() @@ -2478,9 +2489,7 @@ bool AxMultiPageModel::importPageAndMultiPageProperties( BinaryInputStream& rInS // IDs for ( sal_uInt32 count = 0; count < nPageCount; ++count ) { - sal_Int32 nID = 0; - rInStrm >> nID; - mnIDs.push_back( nID ); + mnIDs.push_back( rInStrm.readInt32() ); } return true; } diff --git a/oox/source/ole/olehelper.cxx b/oox/source/ole/olehelper.cxx index 92aacef2d05d..e6c854c370cf 100644 --- a/oox/source/ole/olehelper.cxx +++ b/oox/source/ole/olehelper.cxx @@ -260,9 +260,9 @@ sal_uInt32 OleHelper::encodeOleColor( sal_Int32 nRgbColor ) void OleHelper::exportGuid( BinaryOutputStream& rOStr, const SvGlobalName& rId ) { - rOStr << rId.GetCLSID().Data1; - rOStr << rId.GetCLSID().Data2; - rOStr << rId.GetCLSID().Data3; + rOStr.WriteUInt32( rId.GetCLSID().Data1 ); + rOStr.WriteUInt16( rId.GetCLSID().Data2 ); + rOStr.WriteUInt16( rId.GetCLSID().Data3 ); rOStr.writeArray( rId.GetCLSID().Data4, 8 ); } @@ -296,7 +296,12 @@ bool OleHelper::importStdFont( StdFontInfo& orFontInfo, BinaryInputStream& rInSt } sal_uInt8 nVersion, nNameLen; - rInStrm >> nVersion >> orFontInfo.mnCharSet >> orFontInfo.mnFlags >> orFontInfo.mnWeight >> orFontInfo.mnHeight >> nNameLen; + nVersion = rInStrm.readuChar(); + orFontInfo.mnCharSet = rInStrm.readuInt16(); + orFontInfo.mnFlags = rInStrm.readuChar(); + orFontInfo.mnWeight = rInStrm.readuInt16(); + orFontInfo.mnHeight = rInStrm.readuInt32(); + nNameLen = rInStrm.readuChar(); // according to spec the name is ASCII orFontInfo.maName = rInStrm.readCharArrayUC( nNameLen, RTL_TEXTENCODING_ASCII_US ); OSL_ENSURE( nVersion <= 1, "OleHelper::importStdFont - wrong version" ); @@ -315,7 +320,8 @@ bool OleHelper::importStdPic( StreamDataSequence& orGraphicData, BinaryInputStre sal_uInt32 nStdPicId; sal_Int32 nBytes; - rInStrm >> nStdPicId >> nBytes; + nStdPicId = rInStrm.readuInt32(); + nBytes = rInStrm.readInt32(); OSL_ENSURE( nStdPicId == OLE_STDPIC_ID, "OleHelper::importStdPic - unexpected header version" ); return !rInStrm.isEof() && (nStdPicId == OLE_STDPIC_ID) && (nBytes > 0) && (rInStrm.readData( orGraphicData, nBytes ) == nBytes); } diff --git a/oox/source/ole/vbacontrol.cxx b/oox/source/ole/vbacontrol.cxx index 30d7e00eb9f0..ddfb303035d0 100644 --- a/oox/source/ole/vbacontrol.cxx +++ b/oox/source/ole/vbacontrol.cxx @@ -527,7 +527,8 @@ bool VbaFormControl::importEmbeddedSiteModels( BinaryInputStream& rInStrm ) { sal_uInt64 nAnchorPos = rInStrm.tell(); sal_uInt32 nSiteCount, nSiteDataSize; - rInStrm >> nSiteCount >> nSiteDataSize; + nSiteCount = rInStrm.readuInt32(); + nSiteDataSize = rInStrm.readuInt32(); sal_Int64 nSiteEndPos = rInStrm.tell() + nSiteDataSize; // skip the site info structure diff --git a/oox/source/ole/vbahelper.cxx b/oox/source/ole/vbahelper.cxx index d47726f88873..c523688e0583 100644 --- a/oox/source/ole/vbahelper.cxx +++ b/oox/source/ole/vbahelper.cxx @@ -31,7 +31,8 @@ bool VbaHelper::readDirRecord( sal_uInt16& rnRecId, StreamDataSequence& rRecData { // read the record header sal_Int32 nRecSize; - rInStrm >> rnRecId >> nRecSize; + rnRecId = rInStrm.readuInt16(); + nRecSize = rInStrm.readInt32(); // for no obvious reason, PROJECTVERSION record contains size field of 4, but is 6 bytes long if( rnRecId == VBA_ID_PROJECTVERSION ) { diff --git a/oox/source/ole/vbainputstream.cxx b/oox/source/ole/vbainputstream.cxx index 15a926e28c6f..bd19460340ed 100644 --- a/oox/source/ole/vbainputstream.cxx +++ b/oox/source/ole/vbainputstream.cxx @@ -185,7 +185,7 @@ bool VbaInputStream::updateChunk() else { maChunk.resize( maChunk.size() + 1 ); - *mpInStrm >> maChunk.back(); + maChunk.back() = mpInStrm->readuChar(); ++nChunkPos; } } |