Kaydet (Commit) 4cbba986 authored tarafından Noel Grandin's avatar Noel Grandin

remove operator>> and operator<< methods

in favour of ReadXXX/WriteXXX methods

Change-Id: I849fd10c689fb9834ae9974e430dc337adc68755
üst a3181adc
...@@ -78,18 +78,30 @@ public: ...@@ -78,18 +78,30 @@ public:
All data types supported by the ByteOrderConverter class can be used. All data types supported by the ByteOrderConverter class can be used.
*/ */
template< typename Type > template< typename Type >
SAL_WARN_UNUSED_RESULT
Type readValue(); Type readValue();
SAL_WARN_UNUSED_RESULT
sal_Int8 readInt8() { return readValue<sal_Int8>(); } sal_Int8 readInt8() { return readValue<sal_Int8>(); }
SAL_WARN_UNUSED_RESULT
sal_uInt8 readuInt8() { return readValue<sal_uInt8>(); } sal_uInt8 readuInt8() { return readValue<sal_uInt8>(); }
SAL_WARN_UNUSED_RESULT
sal_Int16 readInt16() { return readValue<sal_Int16>(); } sal_Int16 readInt16() { return readValue<sal_Int16>(); }
SAL_WARN_UNUSED_RESULT
sal_uInt16 readuInt16() { return readValue<sal_uInt16>(); } sal_uInt16 readuInt16() { return readValue<sal_uInt16>(); }
SAL_WARN_UNUSED_RESULT
sal_Int32 readInt32() { return readValue<sal_Int32>(); } sal_Int32 readInt32() { return readValue<sal_Int32>(); }
SAL_WARN_UNUSED_RESULT
sal_uInt32 readuInt32() { return readValue<sal_uInt32>(); } sal_uInt32 readuInt32() { return readValue<sal_uInt32>(); }
SAL_WARN_UNUSED_RESULT
sal_Int64 readInt64() { return readValue<sal_Int64>(); } sal_Int64 readInt64() { return readValue<sal_Int64>(); }
SAL_WARN_UNUSED_RESULT
sal_uInt64 readuInt64() { return readValue<sal_uInt64>(); } sal_uInt64 readuInt64() { return readValue<sal_uInt64>(); }
SAL_WARN_UNUSED_RESULT
float readFloat() { return readValue<float>(); } float readFloat() { return readValue<float>(); }
SAL_WARN_UNUSED_RESULT
double readDouble() { return readValue<double>(); } double readDouble() { return readValue<double>(); }
SAL_WARN_UNUSED_RESULT
unsigned char readuChar() { return readValue<unsigned char>(); } unsigned char readuChar() { return readValue<unsigned char>(); }
/** Reads a (preallocated!) C array of values from the stream. /** Reads a (preallocated!) C array of values from the stream.
...@@ -204,7 +216,7 @@ public: ...@@ -204,7 +216,7 @@ public:
/** Copies nBytes bytes from the current position to the passed output stream. /** 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: protected:
/** This dummy default c'tor will never call the c'tor of the virtual base /** This dummy default c'tor will never call the c'tor of the virtual base
...@@ -300,10 +312,6 @@ public: ...@@ -300,10 +312,6 @@ public:
non-seekable streams too. */ non-seekable streams too. */
virtual void skip( sal_Int32 nBytes, size_t nAtomSize = 1 ) SAL_OVERRIDE; 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: private:
StreamDataSequence maBuffer; ///< Data buffer used in readMemory() function. StreamDataSequence maBuffer; ///< Data buffer used in readMemory() function.
::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >
......
...@@ -155,10 +155,6 @@ public: ...@@ -155,10 +155,6 @@ public:
/** Write nBytes bytes from the (preallocated!) buffer pMem. */ /** Write nBytes bytes from the (preallocated!) buffer pMem. */
virtual void writeMemory( const void* pMem, sal_Int32 nBytes, size_t nAtomSize = 1 ) SAL_OVERRIDE; 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. */ /** Returns the XOutputStream interface of the wrapped output stream. */
::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream > ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream >
getXOutputStream() const { return mxOutStrm; } getXOutputStream() const { return mxOutStrm; }
......
...@@ -146,8 +146,7 @@ bool AgileEngine::decrypt( ...@@ -146,8 +146,7 @@ bool AgileEngine::decrypt(
BinaryXInputStream& aInputStream, BinaryXInputStream& aInputStream,
BinaryXOutputStream& aOutputStream) BinaryXOutputStream& aOutputStream)
{ {
sal_uInt32 totalSize; sal_uInt32 totalSize = aInputStream.readuInt32(); // Document unencrypted size - 4 bytes
aInputStream >> totalSize; // Document unencrypted size - 4 bytes
aInputStream.skip( 4 ); // Reserved 4 Bytes aInputStream.skip( 4 ); // Reserved 4 Bytes
vector<sal_uInt8> keyDataSalt = mInfo.keyDataSalt; vector<sal_uInt8> keyDataSalt = mInfo.keyDataSalt;
......
...@@ -327,8 +327,7 @@ bool DocumentDecryption::readEncryptionInfo() ...@@ -327,8 +327,7 @@ bool DocumentDecryption::readEncryptionInfo()
BinaryXInputStream aBinaryInputStream( xEncryptionInfo, true ); BinaryXInputStream aBinaryInputStream( xEncryptionInfo, true );
sal_uInt32 aVersion; sal_uInt32 aVersion = aBinaryInputStream.readuInt32();
aBinaryInputStream >> aVersion;
switch (aVersion) switch (aVersion)
{ {
......
...@@ -182,9 +182,8 @@ bool Standard2007Engine::decrypt( ...@@ -182,9 +182,8 @@ bool Standard2007Engine::decrypt(
BinaryXInputStream& aInputStream, BinaryXInputStream& aInputStream,
BinaryXOutputStream& aOutputStream) BinaryXOutputStream& aOutputStream)
{ {
sal_uInt32 totalSize; aInputStream.skip(4); // Document unencrypted size - 4 bytes
aInputStream >> totalSize; // Document unencrypted size - 4 bytes aInputStream.skip(4); // Reserved 4 Bytes
aInputStream.skip( 4 ); // Reserved 4 Bytes
vector<sal_uInt8> iv; vector<sal_uInt8> iv;
Decrypt aDecryptor(mKey, iv, Crypto::AES_128_ECB); Decrypt aDecryptor(mKey, iv, Crypto::AES_128_ECB);
...@@ -227,9 +226,9 @@ bool Standard2007Engine::writeEncryptionInfo(const OUString& password, BinaryXOu ...@@ -227,9 +226,9 @@ bool Standard2007Engine::writeEncryptionInfo(const OUString& password, BinaryXOu
sal_uInt32 encryptionHeaderSize = static_cast<sal_uInt32>(sizeof(EncryptionStandardHeader)); sal_uInt32 encryptionHeaderSize = static_cast<sal_uInt32>(sizeof(EncryptionStandardHeader));
rStream << mInfo.header.flags; rStream.WriteUInt32( mInfo.header.flags );
sal_uInt32 headerSize = encryptionHeaderSize + cspNameSize; sal_uInt32 headerSize = encryptionHeaderSize + cspNameSize;
rStream << headerSize; rStream.WriteUInt32( headerSize );
rStream.writeMemory(&mInfo.header, encryptionHeaderSize); rStream.writeMemory(&mInfo.header, encryptionHeaderSize);
rStream.writeUnicodeArray(lclCspName); rStream.writeUnicodeArray(lclCspName);
......
...@@ -426,7 +426,7 @@ void OleFormCtrlExportHelper::exportName( const Reference< XOutputStream >& rxOu ...@@ -426,7 +426,7 @@ void OleFormCtrlExportHelper::exportName( const Reference< XOutputStream >& rxOu
{ {
oox::BinaryXOutputStream aOut( rxOut, false ); oox::BinaryXOutputStream aOut( rxOut, false );
aOut.writeUnicodeArray( maName ); aOut.writeUnicodeArray( maName );
aOut << sal_Int32(0); aOut.WriteInt32(0);
} }
void OleFormCtrlExportHelper::exportCompObj( const Reference< XOutputStream >& rxOut ) void OleFormCtrlExportHelper::exportCompObj( const Reference< XOutputStream >& rxOut )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment