From: Rudolf Polzer Date: Fri, 5 Feb 2010 11:34:56 +0000 (+0100) Subject: try making it work with newer libpng X-Git-Tag: xonotic-v0.5.0~294 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=c1b0348878e340d36a875ce11917e7296b6ca4bb;p=xonotic%2Fnetradiant.git try making it work with newer libpng --- diff --git a/plugins/imagepng/plugin.cpp b/plugins/imagepng/plugin.cpp index 426c4f06..3b761447 100644 --- a/plugins/imagepng/plugin.cpp +++ b/plugins/imagepng/plugin.cpp @@ -41,7 +41,7 @@ void user_warning_fn(png_structp png_ptr, png_const_charp warning_msg) void user_error_fn(png_structp png_ptr, png_const_charp error_msg) { globalErrorStream() << "libpng error: " << error_msg << "\n"; - longjmp(png_ptr->jmpbuf, 0); + longjmp(png_jmpbuf(png_ptr), 0); } void user_read_data(png_structp png_ptr, png_bytep data, png_uint_32 length) @@ -89,7 +89,7 @@ Image* LoadPNGBuff (unsigned char* fbuffer) // configure the read function png_set_read_fn(png_ptr, (voidp)&p_fbuffer, (png_rw_ptr)&user_read_data); - if (setjmp(png_ptr->jmpbuf)) { + if (setjmp(png_jmpbuf(png_ptr))) { png_destroy_read_struct(&png_ptr, &info_ptr, &end_info); return 0; @@ -108,7 +108,7 @@ Image* LoadPNGBuff (unsigned char* fbuffer) png_set_palette_to_rgb(png_ptr); if (color_type == PNG_COLOR_TYPE_GRAY && bit_depth < 8) - png_set_gray_1_2_4_to_8(png_ptr); + png_set_expand_gray_1_2_4_to_8(png_ptr); if (png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS)) png_set_tRNS_to_alpha(png_ptr); @@ -153,7 +153,7 @@ Image* LoadPNGBuff (unsigned char* fbuffer) png_read_end(png_ptr, info_ptr); /* free up the memory structure */ - png_destroy_read_struct(&png_ptr, &info_ptr, png_infopp_NULL); + png_destroy_read_struct(&png_ptr, &info_ptr, NULL); free(row_pointers);