diff --git a/src/disk.c b/src/disk.c index 0070843a..4baa8f43 100644 --- a/src/disk.c +++ b/src/disk.c @@ -777,10 +777,6 @@ void disk6_init(void) { disk6.ddrw = 0; } -static volatile int get_errno() { - return errno; -} - const char *disk6_eject(int drive) { #if !TESTING @@ -805,7 +801,7 @@ const char *disk6_eject(int drive) { if (disk6.disk[drive].was_gzipped) { // backup uncompressed data ... - char *compressed_data = drive == 0 ? &disk_a_raw[0] : &disk_b_raw[0]; + uint8_t *compressed_data = drive == 0 ? &disk_a_raw[0] : &disk_b_raw[0]; // re-compress in place ... err = zlib_deflate_buffer(/*src:*/disk6.disk[drive].raw_image_data, disk6.disk[drive].whole_len, /*dst:*/compressed_data, &compressed_size); diff --git a/src/zlib-helpers.c b/src/zlib-helpers.c index 2bde05be..8bd4b1f6 100644 --- a/src/zlib-helpers.c +++ b/src/zlib-helpers.c @@ -31,7 +31,7 @@ static const char* const _gzerr(gzFile gzf) { } } -static int _gzread_data(gzFile gzsource, char *buf, const int expected_bytescount) { +static int _gzread_data(gzFile gzsource, uint8_t *buf, const int expected_bytescount) { int bytescount = 0; int maxtries = 10; @@ -58,7 +58,7 @@ static int _gzread_data(gzFile gzsource, char *buf, const int expected_bytescoun return bytescount; } -static int _read_data(int fd_own, char *buf, const int expected_bytescount) { +static int _read_data(int fd_own, uint8_t *buf, const int expected_bytescount) { int bytescount = 0; int maxtries = 10; @@ -87,7 +87,7 @@ static int _read_data(int fd_own, char *buf, const int expected_bytescount) { } -static int _write_data(int fd_own, char *buf, const int expected_bytescount) { +static int _write_data(int fd_own, uint8_t *buf, const int expected_bytescount) { int bytescount = 0; int maxtries = 10; @@ -121,7 +121,7 @@ static a2gzip_t _check_gzip_magick(int fd_own, const int expected_bytescount) { a2gzip_t ret = A2GZT_ERR; do { - char stkbuf[2]; + uint8_t stkbuf[2]; int bytescount = _read_data(fd_own, &stkbuf[0], sizeof(stkbuf)); if (bytescount != sizeof(stkbuf)) { ERRLOG("OOPS, could not read file magick for file descriptor"); @@ -158,7 +158,7 @@ static a2gzip_t _check_gzip_magick(int fd_own, const int expected_bytescount) { * * Return NULL on success, or error string (possibly from zlib) on failure. */ -const char *zlib_inflate_to_buffer(int fd, const int expected_bytescount, char *buf) { +const char *zlib_inflate_to_buffer(int fd, const int expected_bytescount, uint8_t *buf) { gzFile gzsource = NULL; int fd_own = -1; @@ -254,7 +254,7 @@ const char *zlib_inflate_to_buffer(int fd, const int expected_bytescount, char * const char *zlib_inflate_inplace(int fd, const int expected_bytescount, bool *is_gzipped) { gzFile gzsource = NULL; int fd_own = -1; - char *buf = NULL; + uint8_t *buf = NULL; *is_gzipped = false; @@ -374,7 +374,7 @@ const char *zlib_inflate_inplace(int fd, const int expected_bytescount, bool *is * * Return NULL on success, or error string (possibly from zlib) on failure. */ -const char *zlib_deflate_buffer(const char *src, const int src_bytescount, char *dst, OUTPARM off_t *dst_size) { +const char *zlib_deflate_buffer(const uint8_t *src, const int src_bytescount, uint8_t *dst, OUTPARM off_t *dst_size) { char *gzPath = NULL; gzFile gzdest = NULL; int fd_own = -1; diff --git a/src/zlib-helpers.h b/src/zlib-helpers.h index 7ef7df7e..d5932878 100644 --- a/src/zlib-helpers.h +++ b/src/zlib-helpers.h @@ -23,13 +23,13 @@ // Inflate/uncompress from file descriptor into previously allocated buffer of expected_bytes length. Underlying file // can either be gzipped or not. This is meant for readonly disk images. -const char *zlib_inflate_to_buffer(int fd, const int expected_bytescount, char *buf); +const char *zlib_inflate_to_buffer(int fd, const int expected_bytescount, uint8_t *buf); // Inflate/uncompress from file descriptor back into itself. Underlying file can either be gzipped or not. This is // meant for read/write disk images. const char *zlib_inflate_inplace(int fd, const int expected_bytescount, bool *is_gzipped); // Deflate/compress from buffer to buffer. This is meant for ejecting read/write disk images. -const char *zlib_deflate_buffer(const char *src, const int src_bytescount, char *dst, OUTPARM off_t *dst_size); +const char *zlib_deflate_buffer(const uint8_t *src, const int src_bytescount, uint8_t *dst, OUTPARM off_t *dst_size); #endif