X-Git-Url: http://git.hungrycats.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=hacks%2Fglx%2Fxpm-ximage.c;h=024f95bc1277d5f8ca1410834fe9e150a8bd76b4;hb=aa75c7476aeaa84cf3abc192b376a8b03c325213;hp=ac17b987c25177757b0cb4bd8641681b359cb83c;hpb=49f5b54f312fe4ac2e9bc47581a72451bd0e8439;p=xscreensaver diff --git a/hacks/glx/xpm-ximage.c b/hacks/glx/xpm-ximage.c index ac17b987..024f95bc 100644 --- a/hacks/glx/xpm-ximage.c +++ b/hacks/glx/xpm-ximage.c @@ -1,5 +1,5 @@ /* xpm-ximage.c --- converts XPM data to an XImage for use with OpenGL. - * xscreensaver, Copyright (c) 1998-2006 Jamie Zawinski + * xscreensaver, Copyright (c) 1998-2013 Jamie Zawinski * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that @@ -19,7 +19,7 @@ #include #include -#ifdef HAVE_COCOA +#ifdef HAVE_JWXYZ # include "jwxyz.h" #else # include @@ -78,7 +78,9 @@ xpm_to_ximage_1 (Display *dpy, Visual *visual, Colormap cmap, if (!initted) { #ifdef HAVE_GTK2 +#if !GLIB_CHECK_VERSION(2, 36 ,0) g_type_init (); +#endif #endif gdk_pixbuf_xlib_init (dpy, DefaultScreen (dpy)); xlib_rgb_init (dpy, DefaultScreenOfDisplay (dpy)); @@ -157,7 +159,9 @@ xpm_to_ximage_1 (Display *dpy, Visual *visual, Colormap cmap, } row += stride; } - gdk_pixbuf_unref (pb); /* #### does doing this free colors? */ + + /* #### are colors getting freed here? */ + g_object_unref (pb); return image; } @@ -224,7 +228,7 @@ xpm_to_ximage_1 (Display *dpy, Visual *visual, Colormap cmap, if (filename) { xpm_data = 0; - if (! XpmReadFileToData ((char *) filename, &xpm_data)) + if (XpmSuccess != XpmReadFileToData ((char *) filename, &xpm_data)) { fprintf (stderr, "%s: unable to read XPM file %s\n", progname, filename); @@ -332,7 +336,8 @@ xpm_to_ximage_1 (Display *dpy, Visual *visual, Colormap cmap, /* Given a bitmask, returns the position and width of the field. */ static void -decode_mask (unsigned int mask, unsigned int *pos_ret, unsigned int *size_ret) +decode_mask (unsigned long mask, unsigned long *pos_ret, + unsigned long *size_ret) { int i; for (i = 0; i < 32; i++) @@ -366,9 +371,9 @@ xpm_to_ximage_1 (Display *dpy, Visual *visual, Colormap cmap, int npixels = 0; int bpl; - unsigned int rpos=0, gpos=0, bpos=0, apos=0; - unsigned int rmsk=0, gmsk=0, bmsk=0, amsk=0; - unsigned int rsiz=0, gsiz=0, bsiz=0, asiz=0; + unsigned long rpos=0, gpos=0, bpos=0, apos=0; + unsigned long rmsk=0, gmsk=0, bmsk=0, amsk=0; + unsigned long rsiz=0, gsiz=0, bsiz=0, asiz=0; if (filename) { @@ -412,7 +417,7 @@ xpm_to_ximage_1 (Display *dpy, Visual *visual, Colormap cmap, for (x = 0; x < ximage->width; x++) { - unsigned long pixel = iline[x]; + unsigned int pixel = iline[x]; unsigned char r = (pixel & rmsk) >> rpos; unsigned char g = (pixel & gmsk) >> gpos; unsigned char b = (pixel & bmsk) >> bpos;