]> de.git.xonotic.org Git - xonotic/netradiant.git/blobdiff - tools/quake3/q3map2/image.c
fix deprecation with libpng 1.4
[xonotic/netradiant.git] / tools / quake3 / q3map2 / image.c
index 929b15d96cf5ec6c5e256955c16d0b40f0d9fdda..4f0a87db04698c0e077efd08f15d2132b5eb3fdf 100644 (file)
@@ -127,7 +127,7 @@ static void LoadPNGBuffer( byte *buffer, int size, byte **pixels, int *width, in
        png_struct      *png;
        png_info        *info, *end;
        pngBuffer_t     pb;
-       int                     bitDepth, colorType, channels;
+       int                     bitDepth, colorType;
        png_uint_32     w, h, i;
        byte            **rowPointers;
        
@@ -177,10 +177,9 @@ static void LoadPNGBuffer( byte *buffer, int size, byte **pixels, int *width, in
        pb.size = size;
        pb.offset = 0;
        png_set_read_fn( png, &pb, PNGReadData );
-       png->io_ptr = &pb; /* hack! */
        
        /* set error longjmp */
-       if( setjmp( png->jmpbuf ) )
+       if( setjmp( png_jmpbuf(png) ) )
        {
                Sys_Printf( "WARNING: An error occurred reading PNG image\n" );
                png_destroy_read_struct( &png, &info, &end );
@@ -196,9 +195,6 @@ static void LoadPNGBuffer( byte *buffer, int size, byte **pixels, int *width, in
        png_get_IHDR( png, info,
                &w, &h, &bitDepth, &colorType, NULL, NULL, NULL );
        
-       /* read number of channels */
-       channels = png_get_channels( png, info );
-       
        /* the following will probably bork on certain types of png images, but hey... */
 
        /* force indexed/gray/trans chunk to rgb */