X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/3ca6a5f04692678cd2d9f3ea0843fc3f5a0b254f..78500b7db1287068a04469e1ce92b4fe99e4e4f0:/src/common/imagpng.cpp?ds=sidebyside diff --git a/src/common/imagpng.cpp b/src/common/imagpng.cpp index 8272a0d383..b41838fa22 100644 --- a/src/common/imagpng.cpp +++ b/src/common/imagpng.cpp @@ -22,7 +22,7 @@ #include "wx/defs.h" #endif -#if wxUSE_LIBPNG +#if wxUSE_IMAGE && wxUSE_LIBPNG #include "wx/imagpng.h" #include "wx/bitmap.h" @@ -56,18 +56,19 @@ IMPLEMENT_DYNAMIC_CLASS(wxPNGHandler,wxImageHandler) #if wxUSE_LIBPNG -#if defined(__VISAGECPP__) -#define LINKAGEMODE _Optlink -#else -#define LINKAGEMODE +#ifndef PNGLINKAGEMODE + #define PNGLINKAGEMODE LINKAGEMODE #endif -static void LINKAGEMODE _PNG_stream_reader( png_structp png_ptr, png_bytep data, png_size_t length ) +extern "C" +{ + +void PNGLINKAGEMODE _PNG_stream_reader( png_structp png_ptr, png_bytep data, png_size_t length ) { ((wxInputStream*) png_get_io_ptr( png_ptr )) -> Read(data, length); } -static void LINKAGEMODE _PNG_stream_writer( png_structp png_ptr, png_bytep data, png_size_t length ) +void PNGLINKAGEMODE _PNG_stream_writer( png_structp png_ptr, png_bytep data, png_size_t length ) { ((wxOutputStream*) png_get_io_ptr( png_ptr )) -> Write(data, length); } @@ -75,7 +76,7 @@ static void LINKAGEMODE _PNG_stream_writer( png_structp png_ptr, png_bytep data, // from pngerror.c // so that the libpng doesn't send anything on stderr void -LINKAGEMODE png_silent_error(png_structp png_ptr, png_const_charp WXUNUSED(message)) +PNGLINKAGEMODE png_silent_error(png_structp png_ptr, png_const_charp WXUNUSED(message)) { #ifdef USE_FAR_KEYWORD { @@ -89,10 +90,12 @@ LINKAGEMODE png_silent_error(png_structp png_ptr, png_const_charp WXUNUSED(messa } void -LINKAGEMODE png_silent_warning(png_structp WXUNUSED(png_ptr), png_const_charp WXUNUSED(message)) +PNGLINKAGEMODE png_silent_warning(png_structp WXUNUSED(png_ptr), png_const_charp WXUNUSED(message)) { } +} // extern "C" + // temporarily disable the warning C4611 (interaction between '_setjmp' and // C++ object destruction is non-portable) - I don't see any dtors here #ifdef __VISUALC__ @@ -359,7 +362,7 @@ bool wxPNGHandler::DoCanRead( wxInputStream& stream ) { unsigned char hdr[4]; - stream.Read(&hdr, 4); + stream.Read(hdr, 4); stream.SeekI(-4, wxFromCurrent); return (hdr[0] == 0x89 && hdr[1] == 'P' && hdr[2] == 'N' && hdr[3] == 'G'); }