mirror of
https://github.com/libretro/RetroArch.git
synced 2024-11-29 03:00:24 +00:00
Cleanups
This commit is contained in:
parent
cc2d6ea99d
commit
7c047ea3b3
@ -351,7 +351,7 @@ static int png_reverse_filter_init(const struct png_ihdr *ihdr,
|
||||
png_pass_geom(&pngp->ihdr, pngp->pass.width,
|
||||
pngp->pass.height, NULL, NULL, &pngp->pass.size);
|
||||
|
||||
if (pngp->pass.size > zlib_stream_get_total_out(&pngp->stream))
|
||||
if (pngp->pass.size > zlib_stream_get_total_out(pngp->stream))
|
||||
{
|
||||
free(pngp->data);
|
||||
return -1;
|
||||
@ -367,7 +367,7 @@ static int png_reverse_filter_init(const struct png_ihdr *ihdr,
|
||||
|
||||
png_pass_geom(ihdr, ihdr->width, ihdr->height, &pngp->bpp, &pngp->pitch, &pass_size);
|
||||
|
||||
if (zlib_stream_get_total_out(&pngp->stream) < pass_size)
|
||||
if (zlib_stream_get_total_out(pngp->stream) < pass_size)
|
||||
return -1;
|
||||
|
||||
pngp->restore_buf_size = 0;
|
||||
@ -524,7 +524,7 @@ static int png_reverse_filter_adam7_iterate(uint32_t **data_,
|
||||
pngp->inflate_buf += pngp->pass.size;
|
||||
pngp->adam7_restore_buf_size += pngp->pass.size;
|
||||
|
||||
zlib_stream_decrement_total_out(&pngp->stream, pngp->pass.size);
|
||||
zlib_stream_decrement_total_out(pngp->stream, pngp->pass.size);
|
||||
|
||||
png_reverse_filter_adam7_deinterlace_pass(data,
|
||||
ihdr, pngp->data, pngp->pass.width, pngp->pass.height, &passes[pngp->pass.pos]);
|
||||
@ -583,13 +583,13 @@ int rpng_load_image_argb_process_inflate_init(struct rpng_t *rpng,
|
||||
uint32_t **data, unsigned *width, unsigned *height)
|
||||
{
|
||||
int zstatus;
|
||||
bool to_continue = (zlib_stream_get_avail_in(&rpng->process.stream) > 0
|
||||
&& zlib_stream_get_avail_out(&rpng->process.stream) > 0);
|
||||
bool to_continue = (zlib_stream_get_avail_in(rpng->process.stream) > 0
|
||||
&& zlib_stream_get_avail_out(rpng->process.stream) > 0);
|
||||
|
||||
if (!to_continue)
|
||||
goto end;
|
||||
|
||||
zstatus = zlib_inflate_data_to_file_iterate(&rpng->process.stream);
|
||||
zstatus = zlib_inflate_data_to_file_iterate(rpng->process.stream);
|
||||
|
||||
switch (zstatus)
|
||||
{
|
||||
@ -604,7 +604,7 @@ int rpng_load_image_argb_process_inflate_init(struct rpng_t *rpng,
|
||||
return 0;
|
||||
|
||||
end:
|
||||
zlib_stream_free(&rpng->process.stream);
|
||||
zlib_stream_free(rpng->process.stream);
|
||||
|
||||
*width = rpng->ihdr.width;
|
||||
*height = rpng->ihdr.height;
|
||||
@ -631,7 +631,7 @@ end:
|
||||
return 1;
|
||||
|
||||
error:
|
||||
zlib_stream_free(&rpng->process.stream);
|
||||
zlib_stream_free(rpng->process.stream);
|
||||
|
||||
false_end:
|
||||
rpng->process.inflate_initialized = false;
|
||||
@ -649,7 +649,12 @@ 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 (!zlib_inflate_init(&rpng->process.stream))
|
||||
rpng->process.stream = zlib_stream_new();
|
||||
|
||||
if (!rpng->process.stream)
|
||||
return false;
|
||||
|
||||
if (!zlib_inflate_init(rpng->process.stream))
|
||||
return false;
|
||||
|
||||
rpng->process.inflate_buf = (uint8_t*)malloc(rpng->process.inflate_buf_size);
|
||||
@ -657,7 +662,7 @@ bool rpng_load_image_argb_process_init(struct rpng_t *rpng,
|
||||
return false;
|
||||
|
||||
zlib_set_stream(
|
||||
&rpng->process.stream,
|
||||
rpng->process.stream,
|
||||
rpng->idat_buf.size,
|
||||
rpng->process.inflate_buf_size,
|
||||
rpng->idat_buf.data,
|
||||
|
@ -21,12 +21,10 @@
|
||||
*/
|
||||
|
||||
#include <formats/rpng.h>
|
||||
|
||||
#include <zlib.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <zlib.h>
|
||||
|
||||
#include "rpng_common.h"
|
||||
|
||||
|
@ -27,7 +27,6 @@
|
||||
#include <stddef.h>
|
||||
|
||||
#include <boolean.h>
|
||||
#include <zlib.h>
|
||||
#include <file/file_extract.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
@ -84,7 +83,7 @@ struct rpng_process_t
|
||||
size_t size;
|
||||
unsigned pos;
|
||||
} pass;
|
||||
z_stream stream;
|
||||
void *stream;
|
||||
zlib_file_handle_t handle;
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user