src/lib/pngwrite.c 1.3
1.3 2009/11/01 01:11:13 markd
png portability changes for ubuntu and gcc 4.3.3
Index: src/lib/pngwrite.c
===================================================================
RCS file: /projects/compbio/cvsroot/kent/src/lib/pngwrite.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -b -B -U 4 -r1.2 -r1.3
--- src/lib/pngwrite.c 20 Aug 2009 21:34:44 -0000 1.2
+++ src/lib/pngwrite.c 1 Nov 2009 01:11:13 -0000 1.3
@@ -4,27 +4,24 @@
* has been under development and testing for 14 years -- http://libpng.org/) */
#ifdef USE_PNG
+#include "png.h" // MUST come before common.h, due to setjmp checking in pngconf.h
#include "common.h"
#include "memgfx.h"
-#ifdef _SETJMP_H
-//.!$ simulate syntax error like the distro /usr/include/pngconf.h does when setjmp.h has already been included. currently common.h includes it.
-#endif//def _SETJMP_H
-#include "png.h"
static char const rcsid[] = "$Id$";
static void pngAbort(png_structp png, png_const_charp errorMessage)
/* type png_error wrapper around errAbort */
{
-errAbort((char *)errorMessage);
+errAbort("%s", (char *)errorMessage);
}
static void pngWarn(png_structp png, png_const_charp warningMessage)
/* type png_error wrapper around warn */
{
-warn((char *)warningMessage);
+warn("%s", (char *)warningMessage);
}
boolean mgSaveToPng(FILE *png_file, struct memGfx *mg, boolean useTransparency)
/* Save PNG to an already open file.
@@ -33,10 +30,9 @@
* are made transparent. */
/* Reference: http://libpng.org/pub/png/libpng-1.2.5-manual.html */
{
if (!png_file || !mg)
- errAbort("mgSaveToPng: called with a NULL: png_file=[%lld], mg=[%lld]",
- (long long int)png_file, (long long int)mg);
+ errAbort("mgSaveToPng: called with a NULL");
png_structp png = png_create_write_struct(PNG_LIBPNG_VER_STRING,
NULL, // don't need pointer to data for err/warn handlers
pngAbort, pngWarn);
if (!png)