Hello community,

here is the log from the commit of package xplanet for openSUSE:Factory checked 
in at 2013-03-14 15:06:27
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/xplanet (Old)
 and      /work/SRC/openSUSE:Factory/.xplanet.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "xplanet", Maintainer is "[email protected]"

Changes:
--------
--- /work/SRC/openSUSE:Factory/xplanet/xplanet.changes  2013-02-15 
18:55:17.000000000 +0100
+++ /work/SRC/openSUSE:Factory/.xplanet.new/xplanet.changes     2013-03-14 
15:08:54.000000000 +0100
@@ -1,0 +2,5 @@
+Tue Mar 12 16:36:52 UTC 2013 - [email protected]
+
+- fix build with giflib-5, xplanet-giflib5.patch
+
+-------------------------------------------------------------------

New:
----
  xplanet-giflib5.patch

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ xplanet.spec ++++++
--- /var/tmp/diff_new_pack.ObJSYp/_old  2013-03-14 15:08:57.000000000 +0100
+++ /var/tmp/diff_new_pack.ObJSYp/_new  2013-03-14 15:08:57.000000000 +0100
@@ -2,6 +2,7 @@
 # spec file for package xplanet
 #
 # Copyright (c) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany.
+# Copyright (c) 2013 B1 Systems GmbH, Vohburg, Germany.
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -26,6 +27,8 @@
 Source0:        
http://downloads.sourceforge.net/%{name}/%{name}-%{version}.tar.gz
 # build also with libpng16, patch sent to [email protected]
 Patch0:         xplanet-libpng16.patch
+# new giflib-5 api
+Patch1:         xplanet-giflib5.patch
 BuildRequires:  freetype2-devel
 BuildRequires:  gcc-c++
 BuildRequires:  giflib-devel
@@ -49,6 +52,7 @@
 %prep
 %setup -q
 %patch0 -p1
+%patch1 -p1
 
 %build
 # configure does not check if netpbm headers are installed in 
/usr/include/netpbm

++++++ xplanet-giflib5.patch ++++++
diff --git a/src/libimage/gif.c b/src/libimage/gif.c
index 835bb20..6cfb040 100644
--- a/src/libimage/gif.c
+++ b/src/libimage/gif.c
@@ -23,6 +23,29 @@
 
 #include <gif_lib.h>
 
+#if GIFLIB_MAJOR >= 5
+/* old giflib did define TRUE/FALSE */
+#ifndef TRUE
+#define TRUE        1
+#endif /* TRUE */
+#ifndef FALSE
+#define FALSE       0
+#endif /* FALSE */
+
+static void
+gif_error(int err)
+{
+    const char * Err = GifErrorString(err);
+    if (Err != NULL)
+        fprintf(stderr, "\nGIF-LIB error: %s.\n", Err);
+    else
+        fprintf(stderr, "\nGIF-LIB undefined error %d.\n", err);
+}
+
+#define QuantizeBuffer GifQuantizeBuffer
+#define MakeMapObject  GifMakeMapObject
+#endif
+
 /*
   A lot of this is based on the gif2rgb and rgb2gif codes in the libungif 
   distribution. 
@@ -42,11 +65,20 @@ read_gif(const char *filename, int *width, int *height, 
unsigned char **rgb)
     int color_index;
     unsigned char *ptr = NULL;
 
+#if GIFLIB_MAJOR >= 5
+    int err;
+    infile = DGifOpenFileName(filename, &err);
+#else
     infile = DGifOpenFileName(filename);
+#endif
 
     if (infile == NULL)
     {
+#if GIFLIB_MAJOR < 5
         PrintGifError();
+#else
+        gif_error(err);
+#endif
         return(0);
     }
 
@@ -54,7 +86,11 @@ read_gif(const char *filename, int *width, int *height, 
unsigned char **rgb)
     {
         if (DGifGetRecordType(infile, &record_type) == GIF_ERROR) 
         {
+#if GIFLIB_MAJOR < 5
             PrintGifError();
+#else
+            gif_error(infile->Error);
+#endif
             return(0);
         }
 
@@ -63,7 +99,11 @@ read_gif(const char *filename, int *width, int *height, 
unsigned char **rgb)
         case IMAGE_DESC_RECORD_TYPE:
             if (DGifGetImageDesc(infile) == GIF_ERROR)
             {
+#if GIFLIB_MAJOR < 5
                 PrintGifError();
+#else
+                gif_error(infile->Error);
+#endif
                 return(0);
             }
 
@@ -107,14 +147,22 @@ read_gif(const char *filename, int *width, int *height, 
unsigned char **rgb)
             GifByteType *ext;
             if (DGifGetExtension(infile, &ext_code, &ext) == GIF_ERROR) 
             {
+#if GIFLIB_MAJOR < 5
                 PrintGifError();
+#else
+                gif_error(infile->Error);
+#endif
                 return(0);
             }
             while (ext != NULL) 
             {
                 if (DGifGetExtensionNext(infile, &ext) == GIF_ERROR) 
                 {
+#if GIFLIB_MAJOR < 5
                     PrintGifError();
+#else
+                    gif_error(infile->Error);
+#endif
                     return(0);
                 }
             }
@@ -166,6 +214,9 @@ write_gif(const char *filename, int width, int height, char 
*rgb)
     GifByteType *red, *green, *blue, *buffer, *ptr;
     GifFileType *outfile;
     ColorMapObject *colormap;
+#if GIFLIB_MAJOR >= 5
+    int err;
+#endif
 
     red = malloc(width * height * sizeof(GifByteType));
     green = malloc(width * height * sizeof(GifByteType));
@@ -190,7 +241,11 @@ write_gif(const char *filename, int width, int height, 
char *rgb)
     if (QuantizeBuffer(width, height, &colormap_size, red, green, blue,   
                        buffer, colormap->Colors) == GIF_ERROR)
     {
+#if GIFLIB_MAJOR < 5
         PrintGifError();
+#else
+        /* gif utilities don't print anything about the error reason also */
+#endif
         return(0);
     }
 
@@ -198,24 +253,40 @@ write_gif(const char *filename, int width, int height, 
char *rgb)
     free(green);
     free(blue);
 
+#if GIFLIB_MAJOR < 5
     outfile = EGifOpenFileName((char *) filename, FALSE);
+#else
+    outfile = EGifOpenFileName((char *) filename, FALSE, &err);
+#endif
     if (outfile == NULL)
     {
+#if GIFLIB_MAJOR < 5
         PrintGifError();
+#else
+        gif_error(err);
+#endif
         return(0);
     }
 
     if (EGifPutScreenDesc(outfile, width, height, colormap_size, 0, colormap)
         == GIF_ERROR)
     {
+#if GIFLIB_MAJOR < 5
         PrintGifError();
+#else
+        gif_error(outfile->Error);
+#endif
         return(0);
     }
 
     if (EGifPutImageDesc(outfile, 0, 0, width, height, FALSE, NULL)
         == GIF_ERROR)
     {
+#if GIFLIB_MAJOR < 5
         PrintGifError();
+#else
+        gif_error(outfile->Error);
+#endif
         return(0);
     }
 
@@ -224,7 +295,11 @@ write_gif(const char *filename, int width, int height, 
char *rgb)
     {
         if (EGifPutLine(outfile, ptr, width) == GIF_ERROR)
         {
+#if GIFLIB_MAJOR < 5
             PrintGifError();
+#else
+            gif_error(outfile->Error);
+#endif
             return(0);
         }
         ptr += width;
@@ -233,7 +308,11 @@ write_gif(const char *filename, int width, int height, 
char *rgb)
     EGifSpew(outfile);
 
     if (EGifCloseFile(outfile) == GIF_ERROR) 
+#if GIFLIB_MAJOR < 5
         PrintGifError();
+#else
+        gif_error(outfile->Error);
+#endif
 
     free(buffer);
 
-- 
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to