From 003fb2a7c8da6311037d1c73363dd104e789bb14 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Fri, 13 Mar 2015 23:22:39 +0100 Subject: [PATCH] (RPNG) Reorganize png_process_reverse_filter_regular_loop --- .../formats/png/rpng_decode_common.h | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/libretro-common/formats/png/rpng_decode_common.h b/libretro-common/formats/png/rpng_decode_common.h index 23e6e0522d..1430d0311e 100644 --- a/libretro-common/formats/png/rpng_decode_common.h +++ b/libretro-common/formats/png/rpng_decode_common.h @@ -431,13 +431,21 @@ static int png_reverse_filter_regular_loop(uint32_t **data_, const struct png_ih uint32_t *data = *data_; int ret; - do{ + do + { ret = png_reverse_filter_iterate(data, ihdr, pngp); - if (ret != PNG_PROCESS_NEXT) - break; - data += ihdr->width; - }while(1); + switch (ret) + { + case PNG_PROCESS_ERROR: + case PNG_PROCESS_ERROR_END: + case PNG_PROCESS_END: + break; + case PNG_PROCESS_NEXT: + data += ihdr->width; + } + + }while(ret == PNG_PROCESS_NEXT); pngp->inflate_buf -= pngp->restore_buf_size;