imlib vs. giflib update
Michael Hoffmann
benzene at arcor.de
Fri Jun 8 16:00:12 UTC 2012
Jim Pingle <jim <at> pingle.org> writes:
>
> The imlib port (/usr/ports/graphics/imlib) is still using source that
> references PrintGifError() which doesn't exist in the new giflib, so
> some programs are failing to link with a recent imlib.
>
> Patching these four references to that old function to use GifError()
> instead seems to make it happy for me, the same fix was done in some KDE
> source after the giflib migration.
>
> --- ./Imlib/load.c.orig 2012-06-04 13:35:37.000000000 -0400
> +++ ./Imlib/load.c 2012-06-04 13:36:00.000000000 -0400
> @@ -451,14 +451,14 @@
> {
> if (DGifGetRecordType(gif, &rec) == GIF_ERROR)
> {
> - PrintGifError();
> + GifError();
> rec = TERMINATE_RECORD_TYPE;
> }
> if ((rec == IMAGE_DESC_RECORD_TYPE) && (!done))
> {
> if (DGifGetImageDesc(gif) == GIF_ERROR)
> {
> - PrintGifError();
> + GifError();
> rec = TERMINATE_RECORD_TYPE;
> }
> *w = gif->Image.Width;
> --- ./gdk_imlib/io-gif.c.orig 2012-06-04 13:36:12.000000000 -0400
> +++ ./gdk_imlib/io-gif.c 2012-06-04 13:36:25.000000000 -0400
> @@ -43,14 +43,14 @@
> {
> if (DGifGetRecordType(gif, &rec) == GIF_ERROR)
> {
> - PrintGifError();
> + GifError();
> rec = TERMINATE_RECORD_TYPE;
> }
> if ((rec == IMAGE_DESC_RECORD_TYPE) && (!done))
> {
> if (DGifGetImageDesc(gif) == GIF_ERROR)
> {
> - PrintGifError();
> + GifError();
> rec = TERMINATE_RECORD_TYPE;
> }
> *w = gif->Image.Width;
>
Hello,
I am a newbie and encountered the same problem using the FreeBSD patched
versions of giflib-4.2.0_2 and imlib-1.9.15_14. Here comes my suggestion:
--- gdk_imlib/io-gif.c~ 2012-06-08 04:30:12.000000000 +0200
+++ gdk_imlib/io-gif.c 2012-06-08 04:39:51.000000000 +0200
@@ -10,6 +10,16 @@
#else
#include <gif_lib.h>
+static void
+PrintGifError(void) {
+ char *Err = GifErrorString();
+
+ if (Err != NULL)
+ fprintf(stderr, "\nGIF-LIB error: %s.\n", Err);
+ else
+ fprintf(stderr, "\nGIF-LIB undefined error %d.\n", GifError());
+}
+
unsigned char *
loader_gif(FILE *f, int *w, int *h, int *t)
{
--- Imlib/load.c~ 2012-06-08 04:30:12.000000000 +0200
+++ Imlib/load.c 2012-06-08 04:41:17.000000000 +0200
@@ -429,6 +429,17 @@
#endif /* HAVE_LIBTIFF */
#ifdef HAVE_LIBGIF
+
+static void
+PrintGifError(void) {
+ char *Err = GifErrorString();
+
+ if (Err != NULL)
+ fprintf(stderr, "\nGIF-LIB error: %s.\n", Err);
+ else
+ fprintf(stderr, "\nGIF-LIB undefined error %d.\n", GifError());
+}
+
unsigned char *
_LoadGIF(ImlibData * id, FILE *f, int *w, int *h, int *t)
{
After all I just copied the 'void PrintGifError(void)' function used by giflib
into imlib and made it static for not changing the external behaviour. After
this the old functionality should not have been altered at all.
I think this patch is more usable than the one posted above, because just
calling 'giflib-4.2.0/lib/gif_err.c:GifError(void)' should be avoided. Look at
its implementation:
> sed -n '31,37p' giflib-4.2.0/lib/gif_err.c
/*****************************************************************************
* Return the last GIF error (0 if none).
****************************************************************************/
int
GifError(void) {
return _GifError;
}
There mostly will be returned an int '0', and just calling GifError() without
printing this value will not have any effects.
Greeting,
Michael
More information about the freebsd-gnome
mailing list