diff options
author | Max Horn | 2009-02-21 19:27:06 +0000 |
---|---|---|
committer | Max Horn | 2009-02-21 19:27:06 +0000 |
commit | 1bbde7be4ebcd2d61ee1f10a7bd49c6546837c8a (patch) | |
tree | 68984d01c594e0200961ede91250fdbdf3f13316 /engines/sci/scicore/decompress11.cpp | |
parent | d451c7794d0980524ed470bc8b0dbcd14d7e8e2b (diff) | |
download | scummvm-rg350-1bbde7be4ebcd2d61ee1f10a7bd49c6546837c8a.tar.gz scummvm-rg350-1bbde7be4ebcd2d61ee1f10a7bd49c6546837c8a.tar.bz2 scummvm-rg350-1bbde7be4ebcd2d61ee1f10a7bd49c6546837c8a.zip |
SCI: Changed decompressors to take advantage of Common::ReadStream::readUint16LE; cleanup
svn-id: r38733
Diffstat (limited to 'engines/sci/scicore/decompress11.cpp')
-rw-r--r-- | engines/sci/scicore/decompress11.cpp | 27 |
1 files changed, 8 insertions, 19 deletions
diff --git a/engines/sci/scicore/decompress11.cpp b/engines/sci/scicore/decompress11.cpp index d2600b46e8..8f54fb6278 100644 --- a/engines/sci/scicore/decompress11.cpp +++ b/engines/sci/scicore/decompress11.cpp @@ -38,37 +38,26 @@ int decrypt4(guint8* dest, guint8* src, int length, int complength); int decompress11(resource_t *result, Common::ReadStream &stream, int sci_version) { guint16 compressedLength; - guint16 compressionMethod, result_size; + guint16 compressionMethod; guint8 *buffer; - guint8 tempid; DDEBUG("d1"); - if (stream.read(&tempid, 1) != 1) + result->id = stream.readByte(); + if (stream.err()) return SCI_ERROR_IO_ERROR; - result->id = tempid; - result->type = result->id & 0x7f; - if (stream.read(&(result->number), 2) != 2) - return SCI_ERROR_IO_ERROR; - -#ifdef SCUMM_BIG_ENDIAN - result->number = GUINT16_SWAP_LE_BE_CONSTANT(result->number); -#endif if ((result->type > sci_invalid_resource)) return SCI_ERROR_DECOMPRESSION_INSANE; - if ((stream.read(&compressedLength, 2) != 2) || (stream.read(&result_size, 2) != 2) || (stream.read(&compressionMethod, 2) != 2)) + result->number = stream.readUint16LE(); + compressedLength = stream.readUint16LE(); + result->size = stream.readUint16LE(); + compressionMethod = stream.readUint16LE(); + if (stream.err()) return SCI_ERROR_IO_ERROR; -#ifdef SCUMM_BIG_ENDIAN - compressedLength = GUINT16_SWAP_LE_BE_CONSTANT(compressedLength); - result_size = GUINT16_SWAP_LE_BE_CONSTANT(result_size); - compressionMethod = GUINT16_SWAP_LE_BE_CONSTANT(compressionMethod); -#endif - result->size = result_size; - //if ((result->size < 0) || (compressedLength < 0)) // return SCI_ERROR_DECOMPRESSION_INSANE; // This return will never happen in SCI0 or SCI1 (does it have any use?) |