summaryrefslogtreecommitdiffstats
path: root/hacks/ximage-loader.c
diff options
context:
space:
mode:
Diffstat (limited to 'hacks/ximage-loader.c')
-rw-r--r--hacks/ximage-loader.c36
1 files changed, 19 insertions, 17 deletions
diff --git a/hacks/ximage-loader.c b/hacks/ximage-loader.c
index cb86ab3..04f0315 100644
--- a/hacks/ximage-loader.c
+++ b/hacks/ximage-loader.c
@@ -1,5 +1,5 @@
/* ximage-loader.c --- converts image files or data to XImages or Pixmap.
- * xscreensaver, Copyright (c) 1998-2018 Jamie Zawinski <jwz@jwz.org>
+ * xscreensaver, Copyright (c) 1998-2020 Jamie Zawinski <jwz@jwz.org>
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
@@ -10,23 +10,13 @@
* implied warranty.
*/
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
+#include "screenhackI.h"
+#include "ximage-loader.h"
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
-#ifdef HAVE_JWXYZ
-# include "jwxyz.h"
-#else
-# include <X11/Xlib.h>
-# include <X11/Xutil.h>
-#endif
-
-#include "ximage-loader.h"
-
#if defined(HAVE_GDK_PIXBUF) || defined(HAVE_COCOA) || defined(HAVE_ANDROID)
# undef HAVE_LIBPNG
#endif
@@ -36,12 +26,25 @@
#endif
#ifdef HAVE_GDK_PIXBUF
+
+# if (__GNUC__ >= 4) /* Ignore useless warnings generated by GTK headers */
+# pragma GCC diagnostic push
+# pragma GCC diagnostic ignored "-Wlong-long"
+# pragma GCC diagnostic ignored "-Wvariadic-macros"
+# pragma GCC diagnostic ignored "-Wpedantic"
+# endif
+
# include <gdk-pixbuf/gdk-pixbuf.h>
# ifdef HAVE_GTK2
# include <gdk-pixbuf-xlib/gdk-pixbuf-xlib.h>
# else /* !HAVE_GTK2 */
# include <gdk-pixbuf/gdk-pixbuf-xlib.h>
# endif /* !HAVE_GTK2 */
+
+# if (__GNUC__ >= 4)
+# pragma GCC diagnostic pop
+# endif
+
#endif /* HAVE_GDK_PIXBUF */
#ifdef HAVE_LIBPNG
@@ -55,8 +58,6 @@ extern void Log(const char *format, ...);
# define fprintf(S, ...) Log(__VA_ARGS__)
#endif
-extern char *progname;
-
static Bool
bigendian (void)
{
@@ -303,6 +304,8 @@ make_ximage (Display *dpy, Visual *visual,
png_uint_32 width, height, channels;
int bit_depth, color_type, interlace_type;
FILE *fp = 0;
+ /* Must be at top or it goes out of scope in the setjmp! */
+ png_read_closure closure;
png_ptr = png_create_read_struct (PNG_LIBPNG_VER_STRING, 0, 0, 0);
if (!png_ptr) return 0;
@@ -339,7 +342,6 @@ make_ximage (Display *dpy, Visual *visual,
}
else
{
- png_read_closure closure;
closure.buf = image_data;
closure.siz = data_size;
closure.ptr = 0;
@@ -529,7 +531,7 @@ make_pixmap (Display *dpy, Window window,
unsigned long srsiz=0, sgsiz=0, sbsiz=0;
# ifdef HAVE_JWXYZ
- // BlackPixel has alpha: 0xFF000000.
+ /* BlackPixel has alpha: 0xFF000000. */
unsigned long black = BlackPixelOfScreen (DefaultScreenOfDisplay (dpy));
#else
unsigned long black = 0;