diff options
author | Max Horn | 2009-03-25 23:47:16 +0000 |
---|---|---|
committer | Max Horn | 2009-03-25 23:47:16 +0000 |
commit | c592bf3300339a755b692906e7364bb6c9ed76f4 (patch) | |
tree | 639588294ea2a2d00cb7b73cd4b3c2fcdaa6f69c /engines/sci/scicore/decompressor.h | |
parent | b4b0e35841e19dc3f472762c09d7e5598c3cbfe5 (diff) | |
download | scummvm-rg350-c592bf3300339a755b692906e7364bb6c9ed76f4.tar.gz scummvm-rg350-c592bf3300339a755b692906e7364bb6c9ed76f4.tar.bz2 scummvm-rg350-c592bf3300339a755b692906e7364bb6c9ed76f4.zip |
SCI: Cleaned up the decompressor comments and code a little bit
svn-id: r39698
Diffstat (limited to 'engines/sci/scicore/decompressor.h')
-rw-r--r-- | engines/sci/scicore/decompressor.h | 75 |
1 files changed, 45 insertions, 30 deletions
diff --git a/engines/sci/scicore/decompressor.h b/engines/sci/scicore/decompressor.h index eefd9387b9..bdbfd3c823 100644 --- a/engines/sci/scicore/decompressor.h +++ b/engines/sci/scicore/decompressor.h @@ -48,53 +48,68 @@ class Decompressor { public: Decompressor() {} virtual ~Decompressor() {} + + virtual int unpack(Common::ReadStream *src, byte *dest, uint32 nPacked, uint32 nUnpacked); protected: - //! Initialize decompressor - /** @param src - source stream to read from - @param dest - destination stream to write to - @param nPacked - size of packed data - @param nUnpacket - size of unpacked data - @return (int) 0 on success, non-zero on error - */ + /** + * Initialize decompressor. + * @param src source stream to read from + * @param dest destination stream to write to + * @param nPacked size of packed data + * @param nUnpacket size of unpacked data + * @return 0 on success, non-zero on error + */ virtual void init(Common::ReadStream *src, byte *dest, uint32 nPacked, uint32 nUnpacked); - //! get one bit from _src stream - /** @return (bool) bit; - */ - bool getBitMSB(); - bool getBitLSB(); - //! get a number of bits from _src stream - /** @param n - number of bits to get - @return (uint32) n-bits number - */ + + /** + * Get a number of bits from _src stream, starting with the most + * significant unread bit of the current four byte block. + * @param n number of bits to get + * @return n-bits number + */ uint32 getBitsMSB(int n); + + /** + * Get a number of bits from _src stream, starting with the least + * significant unread bit of the current four byte block. + * @param n number of bits to get + * @return n-bits number + */ uint32 getBitsLSB(int n); - //! get one byte from _src stream - /** @return (byte) byte - */ + + /** + * Get one byte from _src stream. + * @return byte + */ byte getByteMSB(); byte getByteLSB(); void fetchBitsMSB(); void fetchBitsLSB(); - //! put byte to _dest stream - /** @param b - byte to put - */ + /** + * Write one byte into _dest stream + * @param b byte to put + */ + virtual void putByte(byte b); - // Returns true if all expected data has been unpacked to _dest - // and there is no more data in _src + + /** + * Returns true if all expected data has been unpacked to _dest + * and there is no more data in _src. + */ bool isFinished() { return (_dwWrote == _szUnpacked) && (_dwRead >= _szPacked); } - uint32 _dwBits; // bits buffer - byte _nBits; // # of bits in buffer - uint32 _szPacked; - uint32 _szUnpacked; - uint32 _dwRead; // # of bytes read from _src - uint32 _dwWrote; + uint32 _dwBits; //!< bits buffer + byte _nBits; //!< number of unread bits in _dwBits + uint32 _szPacked; //!< size of the compressed data + uint32 _szUnpacked; //!< size of the decompressed data + uint32 _dwRead; //!< number of bytes read from _src + uint32 _dwWrote; //!< number of bytes written to _dest Common::ReadStream *_src; byte *_dest; }; |