Upstream support for giflib >= 5.1.
DGifCloseFile now takes two arugments. The second argument appears to be an
optional out-param with more information on failures.
( c.f. http://giflib.sourceforge.net/gif_lib.html )
PS 1 is the original patch we received from google3. I've updated it a bit to
be pedantically legal C++98.
BUG=skia:
Review URL: https://codereview.chromium.org/860853003
diff --git a/src/images/SkImageDecoder_libgif.cpp b/src/images/SkImageDecoder_libgif.cpp
index 0701eb6..fa12301 100644
--- a/src/images/SkImageDecoder_libgif.cpp
+++ b/src/images/SkImageDecoder_libgif.cpp
@@ -229,6 +229,15 @@
}
}
+int close_gif(GifFileType*); // This function is a template argument, so can't be static.
+int close_gif(GifFileType* gif) {
+#if GIFLIB_MAJOR < 5 || (GIFLIB_MAJOR == 5 && GIFLIB_MINOR == 0)
+ return DGifCloseFile(gif);
+#else
+ return DGifCloseFile(gif, NULL);
+#endif
+}
+
SkImageDecoder::Result SkGIFImageDecoder::onDecode(SkStream* sk_stream, SkBitmap* bm, Mode mode) {
#if GIFLIB_MAJOR < 5
GifFileType* gif = DGifOpen(sk_stream, DecodeCallBackProc);
@@ -239,7 +248,7 @@
return error_return(*bm, "DGifOpen");
}
- SkAutoTCallIProc<GifFileType, DGifCloseFile> acp(gif);
+ SkAutoTCallIProc<GifFileType, close_gif> acp(gif);
SavedImage temp_save;
temp_save.ExtensionBlocks=NULL;