#include "wx/defs.h"
#endif
-#if wxUSE_LIBPNG
+#if wxUSE_IMAGE && wxUSE_LIBPNG
#include "wx/imagpng.h"
#include "wx/bitmap.h"
#if wxUSE_LIBPNG
#if defined(__VISAGECPP__)
-#define LINKAGEMODE _Optlink
+#define PNGLINKAGEMODE _Optlink
+#elif defined(__WATCOMC__)
+#define PNGLINKAGEMODE _cdecl
#else
-#define LINKAGEMODE
+#define PNGLINKAGEMODE
#endif
-static void LINKAGEMODE _PNG_stream_reader( png_structp png_ptr, png_bytep data, png_size_t length )
+static 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 )
+static 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);
}
// 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
{
}
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))
{
}
+// temporarily disable the warning C4611 (interaction between '_setjmp' and
+// C++ object destruction is non-portable) - I don't see any dtors here
+#ifdef __VISUALC__
+ #pragma warning(disable:4611)
+#endif /* VC++ */
+
bool wxPNGHandler::LoadFile( wxImage *image, wxInputStream& stream, bool verbose, int WXUNUSED(index) )
{
// VZ: as this function uses setjmp() the only fool proof error handling
return FALSE;
}
-
bool wxPNGHandler::SaveFile( wxImage *image, wxOutputStream& stream, bool verbose )
{
{
return TRUE;
}
+#ifdef __VISUALC__
+ #pragma warning(default:4611)
+#endif /* VC++ */
+
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');
}