From b911fbc980b63c9635ee7ca5efb497b0c4b5cb03 Mon Sep 17 00:00:00 2001 From: Yannis Guyon Date: Tue, 9 Oct 2018 17:10:31 +0200 Subject: [PATCH] libwebp: Remove duplicate GIFDisplayError in anim_util GIFDisplayError() is already defined exactly the same way in gifdec. Remove it from anim_util.c and add dependency. Change-Id: Iec01b41c44d0b61b3a279b8cd754d9917d64f804 --- examples/Makefile.am | 4 ++-- examples/anim_util.c | 21 +-------------------- makefile.unix | 4 ++-- 3 files changed, 5 insertions(+), 24 deletions(-) diff --git a/examples/Makefile.am b/examples/Makefile.am index 512d37e5..8d52589f 100644 --- a/examples/Makefile.am +++ b/examples/Makefile.am @@ -28,7 +28,7 @@ noinst_LTLIBRARIES = libexample_util.la libexample_util_la_SOURCES = example_util.c example_util.h libexample_util_la_LIBADD = ../src/libwebp.la -anim_diff_SOURCES = anim_diff.c anim_util.c anim_util.h +anim_diff_SOURCES = anim_diff.c anim_util.c anim_util.h gifdec.c gifdec.h anim_diff_CPPFLAGS = $(AM_CPPFLAGS) $(GIF_INCLUDES) anim_diff_LDADD = anim_diff_LDADD += ../src/demux/libwebpdemux.la @@ -36,7 +36,7 @@ anim_diff_LDADD += libexample_util.la anim_diff_LDADD += ../imageio/libimageio_util.la anim_diff_LDADD += $(GIF_LIBS) -lm -anim_dump_SOURCES = anim_dump.c anim_util.c anim_util.h +anim_dump_SOURCES = anim_dump.c anim_util.c anim_util.h gifdec.c gifdec.h anim_dump_CPPFLAGS = $(AM_CPPFLAGS) $(PNG_INCLUDES) anim_dump_CPPFLAGS += $(GIF_INCLUDES) anim_dump_LDADD = diff --git a/examples/anim_util.c b/examples/anim_util.c index ee3e3326..d1ecb58b 100644 --- a/examples/anim_util.c +++ b/examples/anim_util.c @@ -23,6 +23,7 @@ #include "webp/decode.h" #include "webp/demux.h" #include "../imageio/imageio_util.h" +#include "./gifdec.h" #if defined(_MSC_VER) && _MSC_VER < 1900 #define snprintf _snprintf @@ -370,26 +371,6 @@ static int DGifSavedExtensionToGCB(GifFileType* GifFile, int ImageIndex, #define DGifCloseFile(a, b) DGifCloseFile(a) #endif -static void GIFDisplayError(const GifFileType* const gif, int gif_error) { - // libgif 4.2.0 has retired PrintGifError() and added GifErrorString(). -#if LOCAL_GIF_PREREQ(4, 2) -#if LOCAL_GIF_PREREQ(5, 0) - const char* error_str = - GifErrorString((gif == NULL) ? gif_error : gif->Error); -#else - const char* error_str = GifErrorString(); - (void)gif; -#endif - if (error_str == NULL) error_str = "Unknown error"; - fprintf(stderr, "GIFLib Error %d: %s\n", gif_error, error_str); -#else - (void)gif; - fprintf(stderr, "GIFLib Error %d: ", gif_error); - PrintGifError(); - fprintf(stderr, "\n"); -#endif -} - static int IsKeyFrameGIF(const GifImageDesc* prev_desc, int prev_dispose, const DecodedFrame* const prev_frame, int canvas_width, int canvas_height) { diff --git a/makefile.unix b/makefile.unix index cc0035df..26a4b9c4 100644 --- a/makefile.unix +++ b/makefile.unix @@ -392,7 +392,7 @@ src/demux/libwebpdemux.a: $(LIBWEBPDEMUX_OBJS) $(AR) $(ARFLAGS) $@ $^ examples/anim_diff: examples/anim_diff.o $(ANIM_UTIL_OBJS) $(GIFDEC_OBJS) -examples/anim_dump: examples/anim_dump.o $(ANIM_UTIL_OBJS) +examples/anim_dump: examples/anim_dump.o $(ANIM_UTIL_OBJS) $(GIFDEC_OBJS) examples/cwebp: examples/cwebp.o examples/dwebp: examples/dwebp.o examples/gif2webp: examples/gif2webp.o $(GIFDEC_OBJS) @@ -406,7 +406,7 @@ examples/anim_diff: src/demux/libwebpdemux.a examples/libexample_util.a examples/anim_diff: imageio/libimageio_util.a src/libwebp.a examples/anim_diff: EXTRA_LIBS += $(GIF_LIBS) examples/anim_diff: EXTRA_FLAGS += -DWEBP_HAVE_GIF -examples/anim_dump: examples/libanim_util.a +examples/anim_dump: examples/libanim_util.a examples/libgifdec.a examples/anim_dump: src/demux/libwebpdemux.a examples/anim_dump: examples/libexample_util.a examples/anim_dump: imageio/libimageio_util.a