aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/scicore/decompress0.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'engines/sci/scicore/decompress0.cpp')
-rw-r--r--engines/sci/scicore/decompress0.cpp15
1 files changed, 8 insertions, 7 deletions
diff --git a/engines/sci/scicore/decompress0.cpp b/engines/sci/scicore/decompress0.cpp
index 0c829ad3d8..0eb3774b31 100644
--- a/engines/sci/scicore/decompress0.cpp
+++ b/engines/sci/scicore/decompress0.cpp
@@ -27,6 +27,7 @@
** This is for SCI version 0 style compression.
*/
+#include "common/util.h"
#include "sci/include/sci_memory.h"
#include "sci/include/sciresource.h"
@@ -99,7 +100,7 @@ decrypt1(guint8 *dest, guint8 *src, int length, int complength)
if (token > 0xff) {
if (token >= tokenctr) {
#ifdef _SCI_DECOMPRESS_DEBUG
- fprintf(stderr, "decrypt1: Bad token %x!\n", token);
+ error("decrypt1: Bad token %x", token);
#endif
/* Well this is really bad */
/* May be it should throw something like SCI_ERROR_DECOMPRESSION_INSANE */
@@ -109,7 +110,7 @@ decrypt1(guint8 *dest, guint8 *src, int length, int complength)
#ifdef _SCI_DECOMPRESS_DEBUG
/* For me this seems a normal situation, It's necessary to handle it*/
- printf("decrypt1: Trying to write beyond the end of array(len=%d, destctr=%d, tok_len=%d)!\n",
+ printf("decrypt1: Trying to write beyond the end of array(len=%d, destctr=%d, tok_len=%d)",
length, destctr, tokenlastlength);
#endif
@@ -127,7 +128,7 @@ decrypt1(guint8 *dest, guint8 *src, int length, int complength)
tokenlastlength = 1;
if (destctr >= length) {
#ifdef _SCI_DECOMPRESS_DEBUG
- printf("decrypt1: Try to write single byte beyond end of array!\n");
+ printf("decrypt1: Try to write single byte beyond end of array");
#endif
} else
dest[destctr++] = (byte)token;
@@ -301,12 +302,12 @@ int decompress0(resource_t *result, Common::ReadStream &stream, int sci_version)
#ifdef _SCI_DECOMPRESS_DEBUG
- fprintf(stderr, "Resource %s.%03hi encrypted with method %hi at %.2f%%"
+ error("Resource %s.%03hi encrypted with method %hi at %.2f%%"
" ratio\n",
sci_resource_types[result->type], result->number, compressionMethod,
(result->size == 0) ? -1.0 :
(100.0 * compressedLength / result->size));
- fprintf(stderr, " compressedLength = 0x%hx, actualLength=0x%hx\n",
+ error(" compressedLength = 0x%hx, actualLength=0x%hx\n",
compressedLength, result->size);
#endif
@@ -347,8 +348,8 @@ int decompress0(resource_t *result, Common::ReadStream &stream, int sci_version)
break;
default:
- fprintf(stderr, "Resource %s.%03hi: Compression method %hi not "
- "supported!\n", sci_resource_types[result->type], result->number,
+ error("Resource %s.%03hi: Compression method %hi not "
+ "supported", sci_resource_types[result->type], result->number,
compressionMethod);
free(result->data);
result->data = 0; /* So that we know that it didn't work */