Create more wrappers around zlib in file_extract.c
This commit is contained in:
parent
32304af540
commit
758d01b5da
|
@ -295,7 +295,7 @@ void *zlib_stream_new(void)
|
|||
return (z_stream*)calloc(1, sizeof(z_stream));
|
||||
}
|
||||
|
||||
bool zlib_inflate_init(void *data)
|
||||
bool zlib_inflate_init2(void *data)
|
||||
{
|
||||
z_stream *stream = (z_stream*)data;
|
||||
|
||||
|
@ -306,6 +306,17 @@ bool zlib_inflate_init(void *data)
|
|||
return true;
|
||||
}
|
||||
|
||||
bool zlib_inflate_init(void *data)
|
||||
{
|
||||
z_stream *stream = (z_stream*)data;
|
||||
|
||||
if (!stream)
|
||||
return false;
|
||||
if (inflateInit(stream) != Z_OK)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
void zlib_stream_free(void *data)
|
||||
{
|
||||
z_stream *ret = (z_stream*)data;
|
||||
|
@ -325,7 +336,7 @@ bool zlib_inflate_data_to_file_init(
|
|||
if (!(handle->stream = (z_stream*)zlib_stream_new()))
|
||||
goto error;
|
||||
|
||||
if (!(zlib_inflate_init(handle->stream)))
|
||||
if (!(zlib_inflate_init2(handle->stream)))
|
||||
goto error;
|
||||
|
||||
handle->data = (uint8_t*)malloc(size);
|
||||
|
|
|
@ -648,7 +648,7 @@ bool rpng_load_image_argb_process_init(struct rpng_t *rpng,
|
|||
if (rpng->ihdr.interlace == 1) /* To be sure. */
|
||||
rpng->process.inflate_buf_size *= 2;
|
||||
|
||||
if (inflateInit(&rpng->process.stream) != Z_OK)
|
||||
if (!zlib_inflate_init(&rpng->process.stream))
|
||||
return false;
|
||||
|
||||
rpng->process.inflate_buf = (uint8_t*)malloc(rpng->process.inflate_buf_size);
|
||||
|
|
|
@ -119,5 +119,7 @@ void zlib_stream_free(void *data);
|
|||
|
||||
bool zlib_inflate_init(void *data);
|
||||
|
||||
bool zlib_inflate_init2(void *data);
|
||||
|
||||
#endif
|
||||
|
||||
|
|
Loading…
Reference in New Issue