diff options
-rw-r--r-- | package/inc/ByteChucker.hxx | 12 | ||||
-rw-r--r-- | package/inc/ByteGrabber.hxx | 12 | ||||
-rw-r--r-- | package/source/zipapi/ByteChucker.cxx | 12 | ||||
-rw-r--r-- | package/source/zipapi/ByteGrabber.cxx | 12 | ||||
-rw-r--r-- | package/source/zipapi/MemoryByteGrabber.hxx | 12 | ||||
-rw-r--r-- | package/source/zipapi/ZipFile.cxx | 74 | ||||
-rw-r--r-- | package/source/zipapi/ZipOutputStream.cxx | 84 |
7 files changed, 109 insertions, 109 deletions
diff --git a/package/inc/ByteChucker.hxx b/package/inc/ByteChucker.hxx index 4fb0c1c6270f..7e3e60c0ce65 100644 --- a/package/inc/ByteChucker.hxx +++ b/package/inc/ByteChucker.hxx @@ -48,12 +48,12 @@ public: sal_Int64 GetPosition() throw(::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); - ByteChucker& operator << (sal_Int8 nInt8); - ByteChucker& operator << (sal_Int16 nInt16); - ByteChucker& operator << (sal_Int32 nInt32); - ByteChucker& operator << (sal_uInt8 nuInt8); - ByteChucker& operator << (sal_uInt16 nuInt16); - ByteChucker& operator << (sal_uInt32 nuInt32); + ByteChucker& WriteInt8(sal_Int8 nInt8); + ByteChucker& WriteInt16(sal_Int16 nInt16); + ByteChucker& WriteInt32(sal_Int32 nInt32); + ByteChucker& WriteUInt8(sal_uInt8 nuInt8); + ByteChucker& WriteUInt16(sal_uInt16 nuInt16); + ByteChucker& WriteUInt32(sal_uInt32 nuInt32); }; #endif diff --git a/package/inc/ByteGrabber.hxx b/package/inc/ByteGrabber.hxx index 85dd6da5020c..26df1b19a131 100644 --- a/package/inc/ByteGrabber.hxx +++ b/package/inc/ByteGrabber.hxx @@ -58,12 +58,12 @@ public: sal_Int64 SAL_CALL getLength( ) throw(::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); - ByteGrabber& operator >> (sal_Int8& rInt8); - ByteGrabber& operator >> (sal_Int16& rInt16); - ByteGrabber& operator >> (sal_Int32& rInt32); - ByteGrabber& operator >> (sal_uInt8& ruInt8); - ByteGrabber& operator >> (sal_uInt16& ruInt16); - ByteGrabber& operator >> (sal_uInt32& ruInt32); + ByteGrabber& ReadInt8(sal_Int8& rInt8); + ByteGrabber& ReadInt16(sal_Int16& rInt16); + ByteGrabber& ReadInt32(sal_Int32& rInt32); + ByteGrabber& ReadUInt8(sal_uInt8& ruInt8); + ByteGrabber& ReadUInt16(sal_uInt16& ruInt16); + ByteGrabber& ReadUInt32(sal_uInt32& ruInt32); }; #endif diff --git a/package/source/zipapi/ByteChucker.cxx b/package/source/zipapi/ByteChucker.cxx index af2f2ade8ed5..5bcf64272a5e 100644 --- a/package/source/zipapi/ByteChucker.cxx +++ b/package/source/zipapi/ByteChucker.cxx @@ -54,21 +54,21 @@ sal_Int64 ByteChucker::GetPosition( ) return xSeek->getPosition(); } -ByteChucker& ByteChucker::operator << (sal_Int8 nInt8) +ByteChucker& ByteChucker::WriteInt8(sal_Int8 nInt8) { p1Sequence[0] = nInt8 & 0xFF; WriteBytes( a1Sequence ); return *this; } -ByteChucker& ByteChucker::operator << (sal_Int16 nInt16) +ByteChucker& ByteChucker::WriteInt16(sal_Int16 nInt16) { p2Sequence[0] = static_cast< sal_Int8 >((nInt16 >> 0 ) & 0xFF); p2Sequence[1] = static_cast< sal_Int8 >((nInt16 >> 8 ) & 0xFF); WriteBytes( a2Sequence ); return *this; } -ByteChucker& ByteChucker::operator << (sal_Int32 nInt32) +ByteChucker& ByteChucker::WriteInt32(sal_Int32 nInt32) { p4Sequence[0] = static_cast< sal_Int8 >((nInt32 >> 0 ) & 0xFF); p4Sequence[1] = static_cast< sal_Int8 >((nInt32 >> 8 ) & 0xFF); @@ -78,20 +78,20 @@ ByteChucker& ByteChucker::operator << (sal_Int32 nInt32) return *this; } -ByteChucker& ByteChucker::operator << (sal_uInt8 nuInt8) +ByteChucker& ByteChucker::WriteUInt8(sal_uInt8 nuInt8) { p1Sequence[0] = nuInt8 & 0xFF; WriteBytes( a1Sequence ); return *this; } -ByteChucker& ByteChucker::operator << (sal_uInt16 nuInt16) +ByteChucker& ByteChucker::WriteUInt16(sal_uInt16 nuInt16) { p2Sequence[0] = static_cast< sal_Int8 >((nuInt16 >> 0 ) & 0xFF); p2Sequence[1] = static_cast< sal_Int8 >((nuInt16 >> 8 ) & 0xFF); WriteBytes( a2Sequence ); return *this; } -ByteChucker& ByteChucker::operator << (sal_uInt32 nuInt32) +ByteChucker& ByteChucker::WriteUInt32(sal_uInt32 nuInt32) { p4Sequence[0] = static_cast < sal_Int8 > ((nuInt32 >> 0 ) & 0xFF); p4Sequence[1] = static_cast < sal_Int8 > ((nuInt32 >> 8 ) & 0xFF); diff --git a/package/source/zipapi/ByteGrabber.cxx b/package/source/zipapi/ByteGrabber.cxx index 8b670ff80726..9b47a364fd55 100644 --- a/package/source/zipapi/ByteGrabber.cxx +++ b/package/source/zipapi/ByteGrabber.cxx @@ -100,7 +100,7 @@ sal_Int64 SAL_CALL ByteGrabber::getLength( ) throw io::IOException(THROW_WHERE ); } -ByteGrabber& ByteGrabber::operator >> (sal_Int8& rInt8) +ByteGrabber& ByteGrabber::ReadInt8(sal_Int8& rInt8) { ::osl::MutexGuard aGuard( m_aMutex ); if (xStream->readBytes(aSequence,1) != 1) @@ -110,7 +110,7 @@ ByteGrabber& ByteGrabber::operator >> (sal_Int8& rInt8) return *this; } -ByteGrabber& ByteGrabber::operator >> (sal_Int16& rInt16) +ByteGrabber& ByteGrabber::ReadInt16(sal_Int16& rInt16) { ::osl::MutexGuard aGuard( m_aMutex ); if (xStream->readBytes ( aSequence, 2) != 2) @@ -125,7 +125,7 @@ ByteGrabber& ByteGrabber::operator >> (sal_Int16& rInt16) return *this; } -ByteGrabber& ByteGrabber::operator >> (sal_Int32& rInt32) +ByteGrabber& ByteGrabber::ReadInt32(sal_Int32& rInt32) { ::osl::MutexGuard aGuard( m_aMutex ); @@ -143,7 +143,7 @@ ByteGrabber& ByteGrabber::operator >> (sal_Int32& rInt32) return *this; } -ByteGrabber& ByteGrabber::operator >> (sal_uInt8& rInt8) +ByteGrabber& ByteGrabber::ReadUInt8(sal_uInt8& rInt8) { ::osl::MutexGuard aGuard( m_aMutex ); @@ -153,7 +153,7 @@ ByteGrabber& ByteGrabber::operator >> (sal_uInt8& rInt8) rInt8 = static_cast < sal_uInt8 > (aSequence[0] & 0xFF ); return *this; } -ByteGrabber& ByteGrabber::operator >> (sal_uInt16& rInt16) +ByteGrabber& ByteGrabber::ReadUInt16(sal_uInt16& rInt16) { ::osl::MutexGuard aGuard( m_aMutex ); @@ -168,7 +168,7 @@ ByteGrabber& ByteGrabber::operator >> (sal_uInt16& rInt16) } return *this; } -ByteGrabber& ByteGrabber::operator >> (sal_uInt32& ruInt32) +ByteGrabber& ByteGrabber::ReadUInt32(sal_uInt32& ruInt32) { ::osl::MutexGuard aGuard( m_aMutex ); diff --git a/package/source/zipapi/MemoryByteGrabber.hxx b/package/source/zipapi/MemoryByteGrabber.hxx index 5dcc2fc18b6d..318b93c78594 100644 --- a/package/source/zipapi/MemoryByteGrabber.hxx +++ b/package/source/zipapi/MemoryByteGrabber.hxx @@ -99,7 +99,7 @@ public: { return mnEnd; } - MemoryByteGrabber& operator >> (sal_Int8& rInt8) + MemoryByteGrabber& ReadInt8(sal_Int8& rInt8) { if (mnCurrent + 1 > mnEnd ) rInt8 = 0; @@ -107,7 +107,7 @@ public: rInt8 = mpBuffer [mnCurrent++] & 0xFF; return *this; } - MemoryByteGrabber& operator >> (sal_Int16& rInt16) + MemoryByteGrabber& ReadInt16(sal_Int16& rInt16) { if (mnCurrent + 2 > mnEnd ) rInt16 = 0; @@ -118,7 +118,7 @@ public: } return *this; } - MemoryByteGrabber& operator >> (sal_Int32& rInt32) + MemoryByteGrabber& ReadInt32(sal_Int32& rInt32) { if (mnCurrent + 4 > mnEnd ) rInt32 = 0; @@ -132,7 +132,7 @@ public: return *this; } - MemoryByteGrabber& operator >> (sal_uInt8& rInt8) + MemoryByteGrabber& ReadUInt8(sal_uInt8& rInt8) { if (mnCurrent + 1 > mnEnd ) rInt8 = 0; @@ -140,7 +140,7 @@ public: rInt8 = mpBuffer [mnCurrent++] & 0xFF; return *this; } - MemoryByteGrabber& operator >> (sal_uInt16& rInt16) + MemoryByteGrabber& ReadUInt16(sal_uInt16& rInt16) { if (mnCurrent + 2 > mnEnd ) rInt16 = 0; @@ -151,7 +151,7 @@ public: } return *this; } - MemoryByteGrabber& operator >> (sal_uInt32& rInt32) + MemoryByteGrabber& ReadUInt32(sal_uInt32& rInt32) { if (mnCurrent + 4 > mnEnd ) rInt32 = 0; diff --git a/package/source/zipapi/ZipFile.cxx b/package/source/zipapi/ZipFile.cxx index f2dc709423f1..0fe8ff29a247 100644 --- a/package/source/zipapi/ZipFile.cxx +++ b/package/source/zipapi/ZipFile.cxx @@ -639,19 +639,19 @@ bool ZipFile::readLOC( ZipEntry &rEntry ) sal_Int64 nPos = -rEntry.nOffset; aGrabber.seek(nPos); - aGrabber >> nTestSig; + aGrabber.ReadInt32( nTestSig ); if (nTestSig != LOCSIG) throw ZipIOException("Invalid LOC header (bad signature)" ); - aGrabber >> nVersion; - aGrabber >> nFlag; - aGrabber >> nHow; - aGrabber >> nTime; - aGrabber >> nCRC; - aGrabber >> nCompressedSize; - aGrabber >> nSize; - aGrabber >> nPathLen; - aGrabber >> nExtraLen; + aGrabber.ReadInt16( nVersion ); + aGrabber.ReadInt16( nFlag ); + aGrabber.ReadInt16( nHow ); + aGrabber.ReadInt32( nTime ); + aGrabber.ReadInt32( nCRC ); + aGrabber.ReadInt32( nCompressedSize ); + aGrabber.ReadInt32( nSize ); + aGrabber.ReadInt16( nPathLen ); + aGrabber.ReadInt16( nExtraLen ); rEntry.nOffset = aGrabber.getPosition() + nPathLen + nExtraLen; // FIXME64: need to read 64bit LOC @@ -763,9 +763,9 @@ sal_Int32 ZipFile::readCEN() if (nEndPos == -1) return -1; aGrabber.seek(nEndPos + ENDTOT); - aGrabber >> nTotal; - aGrabber >> nCenLen; - aGrabber >> nCenOff; + aGrabber.ReadUInt16( nTotal ); + aGrabber.ReadInt32( nCenLen ); + aGrabber.ReadInt32( nCenOff ); if ( nTotal * CENHDR > nCenLen ) throw ZipException("invalid END header (bad entry count)" ); @@ -796,34 +796,34 @@ sal_Int32 ZipFile::readCEN() for (nCount = 0 ; nCount < nTotal; nCount++) { - aMemGrabber >> nTestSig; + aMemGrabber.ReadInt32( nTestSig ); if ( nTestSig != CENSIG ) throw ZipException("Invalid CEN header (bad signature)" ); aMemGrabber.skipBytes ( 2 ); - aMemGrabber >> aEntry.nVersion; + aMemGrabber.ReadInt16( aEntry.nVersion ); if ( ( aEntry.nVersion & 1 ) == 1 ) throw ZipException("Invalid CEN header (encrypted entry)" ); - aMemGrabber >> aEntry.nFlag; - aMemGrabber >> aEntry.nMethod; + aMemGrabber.ReadInt16( aEntry.nFlag ); + aMemGrabber.ReadInt16( aEntry.nMethod ); if ( aEntry.nMethod != STORED && aEntry.nMethod != DEFLATED) throw ZipException("Invalid CEN header (bad compression method)" ); - aMemGrabber >> aEntry.nTime; - aMemGrabber >> aEntry.nCrc; + aMemGrabber.ReadInt32( aEntry.nTime ); + aMemGrabber.ReadInt32( aEntry.nCrc ); sal_uInt32 nCompressedSize, nSize, nOffset; - aMemGrabber >> nCompressedSize; - aMemGrabber >> nSize; - aMemGrabber >> aEntry.nPathLen; - aMemGrabber >> aEntry.nExtraLen; - aMemGrabber >> nCommentLen; + aMemGrabber.ReadUInt32( nCompressedSize ); + aMemGrabber.ReadUInt32( nSize ); + aMemGrabber.ReadInt16( aEntry.nPathLen ); + aMemGrabber.ReadInt16( aEntry.nExtraLen ); + aMemGrabber.ReadInt16( nCommentLen ); aMemGrabber.skipBytes ( 8 ); - aMemGrabber >> nOffset; + aMemGrabber.ReadUInt32( nOffset ); // FIXME64: need to read the 64bit header instead if ( nSize == 0xffffffff || @@ -905,22 +905,22 @@ sal_Int32 ZipFile::recover() ZipEntry aEntry; MemoryByteGrabber aMemGrabber ( Sequence< sal_Int8 >( ((sal_Int8*)(&(pBuffer[nPos+4]))), 26 ) ); - aMemGrabber >> aEntry.nVersion; + aMemGrabber.ReadInt16( aEntry.nVersion ); if ( ( aEntry.nVersion & 1 ) != 1 ) { - aMemGrabber >> aEntry.nFlag; - aMemGrabber >> aEntry.nMethod; + aMemGrabber.ReadInt16( aEntry.nFlag ); + aMemGrabber.ReadInt16( aEntry.nMethod ); if ( aEntry.nMethod == STORED || aEntry.nMethod == DEFLATED ) { sal_uInt32 nCompressedSize, nSize; - aMemGrabber >> aEntry.nTime; - aMemGrabber >> aEntry.nCrc; - aMemGrabber >> nCompressedSize; - aMemGrabber >> nSize; - aMemGrabber >> aEntry.nPathLen; - aMemGrabber >> aEntry.nExtraLen; + aMemGrabber.ReadInt32( aEntry.nTime ); + aMemGrabber.ReadInt32( aEntry.nCrc ); + aMemGrabber.ReadUInt32( nCompressedSize ); + aMemGrabber.ReadUInt32( nSize ); + aMemGrabber.ReadInt16( aEntry.nPathLen ); + aMemGrabber.ReadInt16( aEntry.nExtraLen ); // FIXME64: need to read the 64bit header instead if ( nSize == 0xffffffff || @@ -978,9 +978,9 @@ sal_Int32 ZipFile::recover() sal_uInt32 nCompressedSize32, nSize32; sal_Int64 nCompressedSize, nSize; MemoryByteGrabber aMemGrabber ( Sequence< sal_Int8 >( ((sal_Int8*)(&(pBuffer[nPos+4]))), 12 ) ); - aMemGrabber >> nCRC32; - aMemGrabber >> nCompressedSize32; - aMemGrabber >> nSize32; + aMemGrabber.ReadInt32( nCRC32 ); + aMemGrabber.ReadUInt32( nCompressedSize32 ); + aMemGrabber.ReadUInt32( nSize32 ); // FIXME64: work to be done here ... nCompressedSize = nCompressedSize32; diff --git a/package/source/zipapi/ZipOutputStream.cxx b/package/source/zipapi/ZipOutputStream.cxx index 9c1252746f82..f16327e57b93 100644 --- a/package/source/zipapi/ZipOutputStream.cxx +++ b/package/source/zipapi/ZipOutputStream.cxx @@ -122,14 +122,14 @@ void ZipOutputStream::finish() void ZipOutputStream::writeEND(sal_uInt32 nOffset, sal_uInt32 nLength) throw(IOException, RuntimeException) { - m_aChucker << ENDSIG; - m_aChucker << static_cast < sal_Int16 > ( 0 ); - m_aChucker << static_cast < sal_Int16 > ( 0 ); - m_aChucker << static_cast < sal_Int16 > ( m_aZipList.size() ); - m_aChucker << static_cast < sal_Int16 > ( m_aZipList.size() ); - m_aChucker << nLength; - m_aChucker << nOffset; - m_aChucker << static_cast < sal_Int16 > ( 0 ); + m_aChucker.WriteInt32( ENDSIG ); + m_aChucker.WriteInt16( static_cast < sal_Int16 > ( 0 ) ); + m_aChucker.WriteInt16( static_cast < sal_Int16 > ( 0 ) ); + m_aChucker.WriteInt16( static_cast < sal_Int16 > ( m_aZipList.size() ) ); + m_aChucker.WriteInt16( static_cast < sal_Int16 > ( m_aZipList.size() ) ); + m_aChucker.WriteUInt32( nLength ); + m_aChucker.WriteUInt32( nOffset ); + m_aChucker.WriteInt16( static_cast < sal_Int16 > ( 0 ) ); } static sal_uInt32 getTruncated( sal_Int64 nNum, bool *pIsTruncated ) @@ -152,24 +152,24 @@ void ZipOutputStream::writeCEN( const ZipEntry &rEntry ) OString sUTF8Name = OUStringToOString( rEntry.sPath, RTL_TEXTENCODING_UTF8 ); sal_Int16 nNameLength = static_cast < sal_Int16 > ( sUTF8Name.getLength() ); - m_aChucker << CENSIG; - m_aChucker << rEntry.nVersion; - m_aChucker << rEntry.nVersion; - m_aChucker << rEntry.nFlag; - m_aChucker << rEntry.nMethod; + m_aChucker.WriteInt32( CENSIG ); + m_aChucker.WriteInt16( rEntry.nVersion ); + m_aChucker.WriteInt16( rEntry.nVersion ); + m_aChucker.WriteInt16( rEntry.nFlag ); + m_aChucker.WriteInt16( rEntry.nMethod ); bool bWrite64Header = false; - m_aChucker << static_cast < sal_uInt32> ( rEntry.nTime ); - m_aChucker << static_cast < sal_uInt32> ( rEntry.nCrc ); - m_aChucker << getTruncated( rEntry.nCompressedSize, &bWrite64Header ); - m_aChucker << getTruncated( rEntry.nSize, &bWrite64Header ); - m_aChucker << nNameLength; - m_aChucker << static_cast < sal_Int16> (0); - m_aChucker << static_cast < sal_Int16> (0); - m_aChucker << static_cast < sal_Int16> (0); - m_aChucker << static_cast < sal_Int16> (0); - m_aChucker << static_cast < sal_Int32> (0); - m_aChucker << getTruncated( rEntry.nOffset, &bWrite64Header ); + m_aChucker.WriteUInt32( static_cast < sal_uInt32> ( rEntry.nTime ) ); + m_aChucker.WriteUInt32( static_cast < sal_uInt32> ( rEntry.nCrc ) ); + m_aChucker.WriteUInt32( getTruncated( rEntry.nCompressedSize, &bWrite64Header ) ); + m_aChucker.WriteUInt32( getTruncated( rEntry.nSize, &bWrite64Header ) ); + m_aChucker.WriteInt16( nNameLength ); + m_aChucker.WriteInt16( static_cast < sal_Int16> (0) ); + m_aChucker.WriteInt16( static_cast < sal_Int16> (0) ); + m_aChucker.WriteInt16( static_cast < sal_Int16> (0) ); + m_aChucker.WriteInt16( static_cast < sal_Int16> (0) ); + m_aChucker.WriteInt32( static_cast < sal_Int32> (0) ); + m_aChucker.WriteUInt32( getTruncated( rEntry.nOffset, &bWrite64Header ) ); if( bWrite64Header ) { @@ -188,10 +188,10 @@ void ZipOutputStream::writeEXT( const ZipEntry &rEntry ) { bool bWrite64Header = false; - m_aChucker << EXTSIG; - m_aChucker << static_cast < sal_uInt32> ( rEntry.nCrc ); - m_aChucker << getTruncated( rEntry.nCompressedSize, &bWrite64Header ); - m_aChucker << getTruncated( rEntry.nSize, &bWrite64Header ); + m_aChucker.WriteInt32( EXTSIG ); + m_aChucker.WriteUInt32( static_cast < sal_uInt32> ( rEntry.nCrc ) ); + m_aChucker.WriteUInt32( getTruncated( rEntry.nCompressedSize, &bWrite64Header ) ); + m_aChucker.WriteUInt32( getTruncated( rEntry.nSize, &bWrite64Header ) ); if( bWrite64Header ) { @@ -216,33 +216,33 @@ void ZipOutputStream::writeLOC( ZipEntry *pEntry, bool bEncrypt ) OString sUTF8Name = OUStringToOString( rEntry.sPath, RTL_TEXTENCODING_UTF8 ); sal_Int16 nNameLength = static_cast < sal_Int16 > ( sUTF8Name.getLength() ); - m_aChucker << LOCSIG; - m_aChucker << rEntry.nVersion; + m_aChucker.WriteInt32( LOCSIG ); + m_aChucker.WriteInt16( rEntry.nVersion ); - m_aChucker << rEntry.nFlag; + m_aChucker.WriteInt16( rEntry.nFlag ); // If it's an encrypted entry, we pretend its stored plain text if (bEncrypt) - m_aChucker << static_cast < sal_Int16 > ( STORED ); + m_aChucker.WriteInt16( static_cast < sal_Int16 > ( STORED ) ); else - m_aChucker << rEntry.nMethod; + m_aChucker.WriteInt16( rEntry.nMethod ); bool bWrite64Header = false; - m_aChucker << static_cast < sal_uInt32 > (rEntry.nTime); + m_aChucker.WriteUInt32( static_cast < sal_uInt32 > (rEntry.nTime) ); if ((rEntry.nFlag & 8) == 8 ) { - m_aChucker << static_cast < sal_Int32 > (0); - m_aChucker << static_cast < sal_Int32 > (0); - m_aChucker << static_cast < sal_Int32 > (0); + m_aChucker.WriteInt32( static_cast < sal_Int32 > (0) ); + m_aChucker.WriteInt32( static_cast < sal_Int32 > (0) ); + m_aChucker.WriteInt32( static_cast < sal_Int32 > (0) ); } else { - m_aChucker << static_cast < sal_uInt32 > (rEntry.nCrc); - m_aChucker << getTruncated( rEntry.nCompressedSize, &bWrite64Header ); - m_aChucker << getTruncated( rEntry.nSize, &bWrite64Header ); + m_aChucker.WriteUInt32( static_cast < sal_uInt32 > (rEntry.nCrc) ); + m_aChucker.WriteUInt32( getTruncated( rEntry.nCompressedSize, &bWrite64Header ) ); + m_aChucker.WriteUInt32( getTruncated( rEntry.nSize, &bWrite64Header ) ); } - m_aChucker << nNameLength; - m_aChucker << static_cast < sal_Int16 > (0); + m_aChucker.WriteInt16( nNameLength ); + m_aChucker.WriteInt16( static_cast < sal_Int16 > (0) ); if( bWrite64Header ) { |