diff options
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?) |