Esme Povirk : windowscodecs: Do not call png_read_end.

Alexandre Julliard julliard at winehq.org
Mon Oct 19 15:54:05 CDT 2020


Module: wine
Branch: master
Commit: cd778e0b7f54cbbb9b7faae0dd6d25f826f54d6b
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=cd778e0b7f54cbbb9b7faae0dd6d25f826f54d6b

Author: Esme Povirk <esme at codeweavers.com>
Date:   Fri Oct  9 14:56:22 2020 -0500

windowscodecs: Do not call png_read_end.

This isn't necessary because we do not use libpng to read metadata
or verify checksums. If this happens to be the last thing we do,
it will fail the pngformat tests which do not expect us to return
with the stream seeked to the end of the file.

Signed-off-by: Esme Povirk <esme at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/windowscodecs/libpng.c | 14 ++------------
 1 file changed, 2 insertions(+), 12 deletions(-)

diff --git a/dlls/windowscodecs/libpng.c b/dlls/windowscodecs/libpng.c
index f7042c86a64..201f5c700d3 100644
--- a/dlls/windowscodecs/libpng.c
+++ b/dlls/windowscodecs/libpng.c
@@ -61,7 +61,6 @@ MAKE_FUNCPTR(png_get_io_ptr);
 MAKE_FUNCPTR(png_get_pHYs);
 MAKE_FUNCPTR(png_get_PLTE);
 MAKE_FUNCPTR(png_get_tRNS);
-MAKE_FUNCPTR(png_read_end);
 MAKE_FUNCPTR(png_read_image);
 MAKE_FUNCPTR(png_read_info);
 MAKE_FUNCPTR(png_set_bgr);
@@ -111,7 +110,6 @@ static void *load_libpng(void)
         LOAD_FUNCPTR(png_get_pHYs);
         LOAD_FUNCPTR(png_get_PLTE);
         LOAD_FUNCPTR(png_get_tRNS);
-        LOAD_FUNCPTR(png_read_end);
         LOAD_FUNCPTR(png_read_image);
         LOAD_FUNCPTR(png_read_info);
         LOAD_FUNCPTR(png_set_bgr);
@@ -183,7 +181,6 @@ HRESULT CDECL png_decoder_initialize(struct decoder *iface, IStream *stream, str
     struct png_decoder *This = impl_from_decoder(iface);
     png_structp png_ptr;
     png_infop info_ptr;
-    png_infop end_info;
     jmp_buf jmpbuf;
     HRESULT hr = E_FAIL;
     int color_type, bit_depth;
@@ -216,13 +213,6 @@ HRESULT CDECL png_decoder_initialize(struct decoder *iface, IStream *stream, str
         return E_FAIL;
     }
 
-    end_info = ppng_create_info_struct(png_ptr);
-    if (!end_info)
-    {
-        ppng_destroy_read_struct(&png_ptr, &info_ptr, NULL);
-        return E_FAIL;
-    }
-
     /* set up setjmp/longjmp error handling */
     if (setjmp(jmpbuf))
     {
@@ -443,7 +433,7 @@ HRESULT CDECL png_decoder_initialize(struct decoder *iface, IStream *stream, str
     free(row_pointers);
     row_pointers = NULL;
 
-    ppng_read_end(png_ptr, end_info);
+    /* png_read_end intentionally not called to not seek to the end of the file */
 
     st->flags = WICBitmapDecoderCapabilityCanDecodeAllImages |
                 WICBitmapDecoderCapabilityCanDecodeSomeImages |
@@ -455,7 +445,7 @@ HRESULT CDECL png_decoder_initialize(struct decoder *iface, IStream *stream, str
     hr = S_OK;
 
 end:
-    ppng_destroy_read_struct(&png_ptr, &info_ptr, &end_info);
+    ppng_destroy_read_struct(&png_ptr, &info_ptr, NULL);
     free(row_pointers);
     if (FAILED(hr))
     {




More information about the wine-cvs mailing list