summaryrefslogtreecommitdiffstats
path: root/src/cc4group.c
diff options
context:
space:
mode:
authorMarkus Mittendrein <git@maxmitti.tk>2019-04-28 18:23:30 +0200
committerMarkus Mittendrein <git@maxmitti.tk>2019-04-28 18:23:30 +0200
commit05abc872eafd9d6c5c4ae05b9262027aff070dac (patch)
treee6bf14db68f58bf0b217b0109dd5881dc1335711 /src/cc4group.c
parent00fdbbdfff60ca9ffaf84b02c2c2931a8c4bc20f (diff)
downloadcc4group-05abc872eafd9d6c5c4ae05b9262027aff070dac.tar.gz
cc4group-05abc872eafd9d6c5c4ae05b9262027aff070dac.zip
#define ZLIB_CONST instead of casting away const for gzStream.next_in
Diffstat (limited to 'src/cc4group.c')
-rw-r--r--src/cc4group.c9
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;