mayingzhen / nvidia-texture-tools

Automatically exported from code.google.com/p/nvidia-texture-tools
Other
0 stars 0 forks source link

NVTT does not compile with Libpng >= 1.5 (tested with libpng1.6) - fix provided #193

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. instead using the shipped version of libpng shipped with the NVTT package, 
use CMake to link a newever libpng version (tested with 1.6).
2. create VS 2012 solution
3. try to compile

What is the expected output? What do you see instead?
The compiler throws an error  in ImageIO.cpp::static void 
user_read_data(png_structp png_ptr, png_bytep data, png_size_t length)

in that function, please replace "Stream * s = (Stream *)png_ptr->io_ptr;" with 
"Stream * s = (Stream *)png_get_io_ptr(png_ptr)" since it is the new api in 
libpng15 and above.

-> Then It compiles as expected.

What version of the product are you using? On what operating system?
Win8, MSVC 2012.3

Please provide any additional information below.

the full function should be:

static void user_read_data(png_structp png_ptr, png_bytep data, png_size_t 
length)
{
    nvDebugCheck(png_ptr != NULL);

#if (PNG_LIBPNG_VER_SONUM < 15)
    Stream * s = (Stream *)png_ptr->io_ptr;
#else
    Stream * s = (Stream *)png_get_io_ptr(png_ptr);
#endif
    s->serialize(data, (int)length);

    if (s->isError()) {
        png_error(png_ptr, "Read Error");
    }
}

regards,
Torben Dannhauer

Original issue reported on code.google.com by tor...@dannhauer.info on 17 Jul 2013 at 9:57

Attachments:

GoogleCodeExporter commented 8 years ago
Confirmed that this is needed to compile in OS X Mavericks with Libpng 1.6.

Original comment by luis.mo...@gmail.com on 22 Aug 2014 at 8:47