Subject: pkg/35288: Build of graphics/png fails on Irix with MIPSPro
To: None <pkg-manager@netbsd.org, gnats-admin@netbsd.org,>
From: None <fanch@kekpar.net>
List: pkgsrc-bugs
Date: 12/20/2006 09:05:00
>Number:         35288
>Category:       pkg
>Synopsis:       Build of graphics/png fails on Irix with MIPSPro
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Dec 20 09:05:00 +0000 2006
>Originator:     Francois Brunel
>Release:        pkgsrc-2006Q3
>Organization:
>Environment:
IP30
Irix 6.5.30
MIPSPro 7.4.1m
ABI=32
>Description:
Trying to build graphics/png fails with compiler errors because locals
are declared after code.


>How-To-Repeat:

>Fix:
-----------------
patches/patch-af
-----------------

--- pngmem.c.orig	2006-11-15 13:51:26.000000000 +0100
+++ pngmem.c
@@ -541,8 +541,9 @@ png_voidp PNGAPI
 png_malloc_warn(png_structp png_ptr, png_uint_32 size)
 {
    png_voidp ptr;
+   png_uint_32 save_flags;
    if(png_ptr == NULL) return (NULL);
-   png_uint_32 save_flags=png_ptr->flags;
+   save_flags=png_ptr->flags;
 
    png_ptr->flags|=PNG_FLAG_MALLOC_NULL_MEM_OK;
    ptr = (png_voidp)png_malloc((png_structp)png_ptr, size);


-----------------
patches/patch-ad
-----------------

--- pngwio.c.orig	2006-11-15 13:51:26.000000000 +0100
+++ pngwio.c
@@ -131,9 +131,11 @@ png_flush(png_structp png_ptr)
 void PNGAPI
 png_default_flush(png_structp png_ptr)
 {
-   if(png_ptr == NULL) return;
 #if !defined(_WIN32_WCE)
    png_FILE_p io_ptr;
+#endif
+   if(png_ptr == NULL) return;
+#if !defined(_WIN32_WCE)
    io_ptr = (png_FILE_p)CVT_PTR((png_ptr->io_ptr));
    if (io_ptr != NULL)
       fflush(io_ptr);


-----------------
patches/patch-ac
-----------------

--- png.c.orig	2006-11-15 13:51:25.000000000 +0100
+++ png.c
@@ -267,8 +267,8 @@ png_create_info_struct(png_structp png_p
 void PNGAPI
 png_destroy_info_struct(png_structp png_ptr, png_infopp info_ptr_ptr)
 {
-   if(png_ptr == NULL) return;
    png_infop info_ptr = NULL;
+   if(png_ptr == NULL) return;
 
    png_debug(1, "in png_destroy_info_struct\n");
    if (info_ptr_ptr != NULL)