36 sal_uInt8 cByte1, cByte2, cByte3, cByte4, cByte5, cByte6;
40 if ( cByte1 ==
'S' && cByte2 ==
'V' && cByte3 ==
'R' && cByte4 ==
'L' && cByte5 ==
'E' && ( cByte6 ==
'1' || cByte6 ==
'2' ) )
42 rVersion = ( ( cByte6 ==
'1' ) ? 1 : 2 );
58 sal_uInt32
nPos, nCompSize;
60 const sal_uInt32 nSize = rStmToWrite.
TellEnd();
61 rStmToWrite.
Seek( 0 );
87 sal_uInt32 nCompressedSize, nUnCompressedSize;
95 std::unique_ptr<sal_uInt8[]> pCompressedBuffer(
new sal_uInt8[ nCompressedSize ]);
97 sal_uInt8* pInBuf = pCompressedBuffer.get();
98 std::unique_ptr<sal_uInt8[]> pOutBuf(
new sal_uInt8[ nUnCompressedSize ]);
100 sal_uInt8* pLast = pOutBuf.get() + nUnCompressedSize - 1;
101 sal_uIntPtr
nIndex = 0, nCountByte, nRunByte;
102 bool bEndDecoding =
false;
106 nCountByte = *pInBuf++;
110 nRunByte = *pInBuf++;
115 memcpy( &pTmpBuf[
nIndex ], pInBuf, nRunByte );
123 else if ( nRunByte == 1 )
130 memset( &pTmpBuf[
nIndex ], cVal, nCountByte );
134 while ( !bEndDecoding && ( pTmpBuf <= pLast ) );
136 rStmToRead.
WriteBytes(pOutBuf.get(), nUnCompressedSize);
void Read(SvStream &rStmToRead)
GalleryCodec(SvStream &rIOStm)
void Write(SvStream &rStmToWrite)
static bool IsCoded(SvStream &rStm, sal_uInt32 &rVersion)
virtual sal_uInt64 TellEnd()
std::size_t WriteBytes(const void *pData, std::size_t nSize)
SvStream & WriteUInt32(sal_uInt32 nUInt32)
SvStream & ReadUInt32(sal_uInt32 &rUInt32)
sal_uInt64 Seek(sal_uInt64 nPos)
SvStream & WriteChar(char nChar)
std::size_t ReadBytes(void *pData, std::size_t nSize)
sal_uInt64 SeekRel(sal_Int64 nPos)
SvStream & ReadUChar(unsigned char &rChar)
tools::Long Decompress(SvStream &rIStm, SvStream &rOStm)
tools::Long EndCompression()
void BeginCompression(int nCompressLevel=ZCODEC_DEFAULT_COMPRESSION, bool gzLib=false)
void Compress(SvStream &rIStm, SvStream &rOStm)
#define STREAM_SEEK_TO_END