Revert "Split up deinit code from png_reverse_filter"

This reverts commit 3fc262ecac3f257c1a90cf189a8afd328faf7da3.
This commit is contained in:
twinaphex 2015-02-25 21:54:08 +01:00
parent 3fc262ecac
commit c6f34ff91e
3 changed files with 14 additions and 24 deletions

View File

@ -124,6 +124,7 @@ static bool png_reverse_filter(uint32_t *data, const struct png_ihdr *ihdr,
struct rpng_process_t *pngp)
{
unsigned i;
bool ret = true;
for (; pngp->h < ihdr->height;
pngp->h++, pngp->inflate_buf += pngp->pitch, data += ihdr->width)
@ -172,7 +173,7 @@ static bool png_reverse_filter(uint32_t *data, const struct png_ihdr *ihdr,
break;
default:
return false;
GOTO_END_ERROR();
}
if (ihdr->color_type == 0)
@ -191,7 +192,9 @@ static bool png_reverse_filter(uint32_t *data, const struct png_ihdr *ihdr,
memcpy(pngp->prev_scanline, pngp->decoded_scanline, pngp->pitch);
}
return true;
end:
png_reverse_filter_deinit(pngp);
return ret;
}
static bool png_reverse_filter_adam7(uint32_t *data,
@ -210,7 +213,6 @@ static bool png_reverse_filter_adam7(uint32_t *data,
for (; pngp->pass < ARRAY_SIZE(passes); pngp->pass++)
{
bool ret = true;
unsigned pass_width, pass_height;
struct png_ihdr tmp_ihdr;
uint32_t *tmp_data = NULL;
@ -243,12 +245,8 @@ static bool png_reverse_filter_adam7(uint32_t *data,
return false;
}
ret = png_reverse_filter(tmp_data,
&tmp_ihdr, pngp);
png_reverse_filter_deinit(pngp);
if (ret)
if (!png_reverse_filter(tmp_data,
&tmp_ihdr, pngp))
{
free(tmp_data);
return false;

View File

@ -353,13 +353,8 @@ bool rpng_load_image_argb(const char *path, uint32_t **data,
&rpng.ihdr, &pngp))
GOTO_END_ERROR();
}
else
ret = png_reverse_filter(*data,
&rpng.ihdr, &pngp);
png_reverse_filter_deinit(&pngp);
if (!ret)
else if (!png_reverse_filter(*data,
&rpng.ihdr, &pngp))
GOTO_END_ERROR();
end:

View File

@ -257,7 +257,6 @@ bool rpng_nbio_load_image_argb_iterate(uint8_t *buf, struct rpng_t *rpng)
bool rpng_nbio_load_image_argb_process(struct rpng_t *rpng,
uint32_t **data, unsigned *width, unsigned *height)
{
bool ret = true;
struct rpng_process_t pngp = {0};
z_stream stream = {0};
@ -314,13 +313,11 @@ bool rpng_nbio_load_image_argb_process(struct rpng_t *rpng,
return false;
}
else
ret = png_reverse_filter(*data,
&rpng->ihdr, &pngp);
png_reverse_filter_deinit(&pngp);
if (!ret)
return false;
{
if (!png_reverse_filter(*data,
&rpng->ihdr, &pngp))
return false;
}
return true;
}