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/decompress01.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/decompress01.cpp')
-rw-r--r-- | engines/sci/scicore/decompress01.cpp | 21 |
1 files changed, 7 insertions, 14 deletions
diff --git a/engines/sci/scicore/decompress01.cpp b/engines/sci/scicore/decompress01.cpp index 7b3a1d004c..b3fbf965d3 100644 --- a/engines/sci/scicore/decompress01.cpp +++ b/engines/sci/scicore/decompress01.cpp @@ -488,33 +488,26 @@ byte *view_reorder(byte *inbuffer, int dsize) { } int decompress01(resource_t *result, Common::ReadStream &stream, int sci_version) { - uint16 compressedLength, result_size; + uint16 compressedLength; uint16 compressionMethod; uint8 *buffer; - if (stream.read(&(result->id), 2) != 2) + result->id = stream.readUint16LE(); + if (stream.err()) return SCI_ERROR_IO_ERROR; -#ifdef SCUMM_BIG_ENDIAN - result->id = GUINT16_SWAP_LE_BE_CONSTANT(result->id); -#endif - result->number = result->id & 0x07ff; result->type = result->id >> 11; if ((result->number > sci_max_resource_nr[sci_version] || (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)) + 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?) |