From 2c801bd43ac6dfb676def2b614e5c10ba2f1ad79 Mon Sep 17 00:00:00 2001 From: Pavel P Date: Wed, 7 Aug 2024 20:59:39 +0200 Subject: [PATCH] Cast result of zalloc to char * to avoid warnings + remove unnecessary cast when using `original_buf` --- deflate.c | 4 ++-- inflate.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/deflate.c b/deflate.c index 66b5506a..af0f27bd 100644 --- a/deflate.c +++ b/deflate.c @@ -239,7 +239,7 @@ Z_INTERNAL deflate_allocs* alloc_deflate(PREFIX3(stream) *strm, int windowBits, int total_size = PAD_64(curr_size + (WINDOW_PAD_SIZE - 1)); /* Allocate buffer, align to 64-byte cacheline, and zerofill the resulting buffer */ - char *original_buf = strm->zalloc(strm->opaque, 1, total_size); + char *original_buf = (char *)strm->zalloc(strm->opaque, 1, total_size); if (original_buf == NULL) return NULL; @@ -248,7 +248,7 @@ Z_INTERNAL deflate_allocs* alloc_deflate(PREFIX3(stream) *strm, int windowBits, /* Initialize alloc_bufs */ deflate_allocs *alloc_bufs = (struct deflate_allocs_s *)(buff + alloc_pos); - alloc_bufs->buf_start = (char *)original_buf; + alloc_bufs->buf_start = original_buf; alloc_bufs->zfree = strm->zfree; /* Assign buffers */ diff --git a/inflate.c b/inflate.c index 956f37db..cfcbf523 100644 --- a/inflate.c +++ b/inflate.c @@ -170,7 +170,7 @@ Z_INTERNAL inflate_allocs* alloc_inflate(PREFIX3(stream) *strm) { int total_size = PAD_64(curr_size + (WINDOW_PAD_SIZE - 1)); /* Allocate buffer, align to 64-byte cacheline, and zerofill the resulting buffer */ - char *original_buf = strm->zalloc(strm->opaque, 1, total_size); + char *original_buf = (char *)strm->zalloc(strm->opaque, 1, total_size); if (original_buf == NULL) return NULL; @@ -179,7 +179,7 @@ Z_INTERNAL inflate_allocs* alloc_inflate(PREFIX3(stream) *strm) { /* Initialize alloc_bufs */ inflate_allocs *alloc_bufs = (struct inflate_allocs_s *)(buff + alloc_pos); - alloc_bufs->buf_start = (char *)original_buf; + alloc_bufs->buf_start = original_buf; alloc_bufs->zfree = strm->zfree; alloc_bufs->window = (unsigned char *)HINT_ALIGNED_WINDOW((buff + window_pos)); -- 2.47.3