diff options
author | Noel Grandin <noel@peralex.com> | 2014-12-12 14:32:11 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2014-12-19 08:50:29 +0200 |
commit | 4cbba98601ae16cda1739e1e81d697592bb31213 (patch) | |
tree | e9dab946f962455656c76479ee63c6b41d139dc1 | |
parent | a3181adc11bc707680424551369a24b3c65de921 (diff) |
remove operator>> and operator<< methods
in favour of ReadXXX/WriteXXX methods
Change-Id: I849fd10c689fb9834ae9974e430dc337adc68755
-rw-r--r-- | include/oox/helper/binaryinputstream.hxx | 18 | ||||
-rw-r--r-- | include/oox/helper/binaryoutputstream.hxx | 4 | ||||
-rw-r--r-- | oox/source/crypto/AgileEngine.cxx | 3 | ||||
-rw-r--r-- | oox/source/crypto/DocumentDecryption.cxx | 3 | ||||
-rw-r--r-- | oox/source/crypto/Standard2007Engine.cxx | 9 | ||||
-rw-r--r-- | oox/source/ole/olehelper.cxx | 2 |
6 files changed, 20 insertions, 19 deletions
diff --git a/include/oox/helper/binaryinputstream.hxx b/include/oox/helper/binaryinputstream.hxx index 49186054954e..569f48d77642 100644 --- a/include/oox/helper/binaryinputstream.hxx +++ b/include/oox/helper/binaryinputstream.hxx @@ -78,18 +78,30 @@ public: All data types supported by the ByteOrderConverter class can be used. */ template< typename Type > + SAL_WARN_UNUSED_RESULT Type readValue(); + SAL_WARN_UNUSED_RESULT sal_Int8 readInt8() { return readValue<sal_Int8>(); } + SAL_WARN_UNUSED_RESULT sal_uInt8 readuInt8() { return readValue<sal_uInt8>(); } + SAL_WARN_UNUSED_RESULT sal_Int16 readInt16() { return readValue<sal_Int16>(); } + SAL_WARN_UNUSED_RESULT sal_uInt16 readuInt16() { return readValue<sal_uInt16>(); } + SAL_WARN_UNUSED_RESULT sal_Int32 readInt32() { return readValue<sal_Int32>(); } + SAL_WARN_UNUSED_RESULT sal_uInt32 readuInt32() { return readValue<sal_uInt32>(); } + SAL_WARN_UNUSED_RESULT sal_Int64 readInt64() { return readValue<sal_Int64>(); } + SAL_WARN_UNUSED_RESULT sal_uInt64 readuInt64() { return readValue<sal_uInt64>(); } + SAL_WARN_UNUSED_RESULT float readFloat() { return readValue<float>(); } + SAL_WARN_UNUSED_RESULT double readDouble() { return readValue<double>(); } + SAL_WARN_UNUSED_RESULT unsigned char readuChar() { return readValue<unsigned char>(); } /** Reads a (preallocated!) C array of values from the stream. @@ -204,7 +216,7 @@ public: /** Copies nBytes bytes from the current position to the passed output stream. */ - void copyToStream( BinaryOutputStream& rOutStrm, sal_Int64 nBytes = SAL_MAX_INT64, sal_Int32 nAtomSize = 1 ); + void copyToStream( BinaryOutputStream& rOutStrm, sal_Int64 nBytes = SAL_MAX_INT64, sal_Int32 nAtomSize = 1 ); protected: /** This dummy default c'tor will never call the c'tor of the virtual base @@ -300,10 +312,6 @@ public: non-seekable streams too. */ virtual void skip( sal_Int32 nBytes, size_t nAtomSize = 1 ) SAL_OVERRIDE; - /** Stream operator for all data types supported by the readValue() function. */ - template< typename Type > - BinaryXInputStream& operator>>( Type& ornValue ) { ornValue = readValue<Type>(); return *this; } - private: StreamDataSequence maBuffer; ///< Data buffer used in readMemory() function. ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > diff --git a/include/oox/helper/binaryoutputstream.hxx b/include/oox/helper/binaryoutputstream.hxx index 0674481ccdc4..e1c21ff79a13 100644 --- a/include/oox/helper/binaryoutputstream.hxx +++ b/include/oox/helper/binaryoutputstream.hxx @@ -155,10 +155,6 @@ public: /** Write nBytes bytes from the (preallocated!) buffer pMem. */ virtual void writeMemory( const void* pMem, sal_Int32 nBytes, size_t nAtomSize = 1 ) SAL_OVERRIDE; - /** Stream operator for all data types supported by the writeValue() function. */ - template< typename Type > - BinaryXOutputStream& operator<<( Type nValue ) { writeValue( nValue ); return *this; } - /** Returns the XOutputStream interface of the wrapped output stream. */ ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream > getXOutputStream() const { return mxOutStrm; } diff --git a/oox/source/crypto/AgileEngine.cxx b/oox/source/crypto/AgileEngine.cxx index 3ae847a9994a..d207cf533a7f 100644 --- a/oox/source/crypto/AgileEngine.cxx +++ b/oox/source/crypto/AgileEngine.cxx @@ -146,8 +146,7 @@ bool AgileEngine::decrypt( BinaryXInputStream& aInputStream, BinaryXOutputStream& aOutputStream) { - sal_uInt32 totalSize; - aInputStream >> totalSize; // Document unencrypted size - 4 bytes + sal_uInt32 totalSize = aInputStream.readuInt32(); // Document unencrypted size - 4 bytes aInputStream.skip( 4 ); // Reserved 4 Bytes vector<sal_uInt8> keyDataSalt = mInfo.keyDataSalt; diff --git a/oox/source/crypto/DocumentDecryption.cxx b/oox/source/crypto/DocumentDecryption.cxx index fc93e0b46a31..5d5e6466d813 100644 --- a/oox/source/crypto/DocumentDecryption.cxx +++ b/oox/source/crypto/DocumentDecryption.cxx @@ -327,8 +327,7 @@ bool DocumentDecryption::readEncryptionInfo() BinaryXInputStream aBinaryInputStream( xEncryptionInfo, true ); - sal_uInt32 aVersion; - aBinaryInputStream >> aVersion; + sal_uInt32 aVersion = aBinaryInputStream.readuInt32(); switch (aVersion) { diff --git a/oox/source/crypto/Standard2007Engine.cxx b/oox/source/crypto/Standard2007Engine.cxx index 311fea7f930e..bcaba3052aeb 100644 --- a/oox/source/crypto/Standard2007Engine.cxx +++ b/oox/source/crypto/Standard2007Engine.cxx @@ -182,9 +182,8 @@ bool Standard2007Engine::decrypt( BinaryXInputStream& aInputStream, BinaryXOutputStream& aOutputStream) { - sal_uInt32 totalSize; - aInputStream >> totalSize; // Document unencrypted size - 4 bytes - aInputStream.skip( 4 ); // Reserved 4 Bytes + aInputStream.skip(4); // Document unencrypted size - 4 bytes + aInputStream.skip(4); // Reserved 4 Bytes vector<sal_uInt8> iv; Decrypt aDecryptor(mKey, iv, Crypto::AES_128_ECB); @@ -227,9 +226,9 @@ bool Standard2007Engine::writeEncryptionInfo(const OUString& password, BinaryXOu sal_uInt32 encryptionHeaderSize = static_cast<sal_uInt32>(sizeof(EncryptionStandardHeader)); - rStream << mInfo.header.flags; + rStream.WriteUInt32( mInfo.header.flags ); sal_uInt32 headerSize = encryptionHeaderSize + cspNameSize; - rStream << headerSize; + rStream.WriteUInt32( headerSize ); rStream.writeMemory(&mInfo.header, encryptionHeaderSize); rStream.writeUnicodeArray(lclCspName); diff --git a/oox/source/ole/olehelper.cxx b/oox/source/ole/olehelper.cxx index a87f290cc94e..66d8554a21e3 100644 --- a/oox/source/ole/olehelper.cxx +++ b/oox/source/ole/olehelper.cxx @@ -426,7 +426,7 @@ void OleFormCtrlExportHelper::exportName( const Reference< XOutputStream >& rxOu { oox::BinaryXOutputStream aOut( rxOut, false ); aOut.writeUnicodeArray( maName ); - aOut << sal_Int32(0); + aOut.WriteInt32(0); } void OleFormCtrlExportHelper::exportCompObj( const Reference< XOutputStream >& rxOut ) |