From b7fe19b6c82f888edc28db827bc9b1e8f5228a49 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sun, 15 Sep 2019 02:04:10 +0200 Subject: [PATCH] (libretro-common) RPNG - Cleanup --- libretro-common/formats/png/rpng_encode.c | 21 +++++---------------- 1 file changed, 5 insertions(+), 16 deletions(-) diff --git a/libretro-common/formats/png/rpng_encode.c b/libretro-common/formats/png/rpng_encode.c index 42df8116aa..ffe4b0df47 100644 --- a/libretro-common/formats/png/rpng_encode.c +++ b/libretro-common/formats/png/rpng_encode.c @@ -86,11 +86,8 @@ static bool png_write_ihdr(RFILE *file, const struct png_ihdr *ihdr) if (filestream_write(file, ihdr_raw, sizeof(ihdr_raw)) != sizeof(ihdr_raw)) return false; - if (!png_write_crc(file, ihdr_raw + sizeof(uint32_t), - sizeof(ihdr_raw) - sizeof(uint32_t))) - return false; - - return true; + return png_write_crc(file, ihdr_raw + sizeof(uint32_t), + sizeof(ihdr_raw) - sizeof(uint32_t)); } static bool png_write_idat(RFILE *file, const uint8_t *data, size_t size) @@ -98,10 +95,7 @@ static bool png_write_idat(RFILE *file, const uint8_t *data, size_t size) if (filestream_write(file, data, size) != (ssize_t)size) return false; - if (!png_write_crc(file, data + sizeof(uint32_t), size - sizeof(uint32_t))) - return false; - - return true; + return png_write_crc(file, data + sizeof(uint32_t), size - sizeof(uint32_t)); } static bool png_write_iend(RFILE *file) @@ -114,11 +108,8 @@ static bool png_write_iend(RFILE *file) if (filestream_write(file, data, sizeof(data)) != sizeof(data)) return false; - if (!png_write_crc(file, data + sizeof(uint32_t), - sizeof(data) - sizeof(uint32_t))) - return false; - - return true; + return png_write_crc(file, data + sizeof(uint32_t), + sizeof(data) - sizeof(uint32_t)); } static void copy_argb_line(uint8_t *dst, const uint32_t *src, unsigned width) @@ -344,9 +335,7 @@ static bool rpng_save_image(const char *path, (unsigned)(encode_buf_size * 2)); if (!stream_backend->trans(stream, true, &total_in, &total_out, NULL)) - { GOTO_END_ERROR(); - } memcpy(deflate_buf + 4, "IDAT", 4); dword_write_be(deflate_buf + 0, ((uint32_t)total_out));