diff options
| -rw-r--r-- | src/cc4group.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/cc4group.c b/src/cc4group.c index 9f41b64..6dc7544 100644 --- a/src/cc4group.c +++ b/src/cc4group.c @@ -24,6 +24,7 @@ #include <stdio.h> +#define ZLIB_CONST #include <zlib.h> #define SET_ERROR(errorCauser, errorCode, errorFormatter, data) do { this->error.code = errorCode; this->error.formatter.formatter = errorFormatter; this->error.causer = errorCauser; this->error.method = __func__; } while(0) @@ -529,7 +530,7 @@ static bool cc4group_inflateFillOutput(z_stream* const strm, CC4Group_ReadCallba } strm->avail_in = readSize; - strm->next_in = (uint8_t*)*lastData; // I don't know why this must be non-const; anyway a read-only mapped input doesn't segfault. so it seems to be used read-only + strm->next_in = *lastData; } ret = inflate(strm, *eof ? Z_FINISH : Z_NO_FLUSH); @@ -713,7 +714,7 @@ static bool cc4group_uncompressGroup(CC4Group* const this, CC4Group_ReadCallback goto ret; } - static uint8_t magic[] = {0x1f, 0x8b}; + static const uint8_t magic[] = {0x1f, 0x8b}; if((magic1 != C4GroupMagic1 && magic1 != magic[0]) || (magic2 != C4GroupMagic2 && magic2 != magic[1])) { @@ -757,7 +758,7 @@ static bool cc4group_uncompressGroup(CC4Group* const this, CC4Group_ReadCallback if(totalReadSize > 2) { - this->readState.gzStrm.next_in = (uint8_t*)readDataAfterMagic; + this->readState.gzStrm.next_in = readDataAfterMagic; this->readState.gzStrm.avail_in = totalReadSize - 2; } @@ -1973,7 +1974,7 @@ static bool cc4group_deflateToCallback(WriteCallback* const callback, const void assert(callback); assert(data || size == 0); - callback->gzStream.next_in = (void*)data; + callback->gzStream.next_in = data; callback->gzStream.avail_in = size; int ret = Z_BUF_ERROR; |
