[Scummvm-git-logs] scummvm master -> 047ee3249747d4d9528cf151394e420fe286a838

dwatteau noreply at scummvm.org
Thu Aug 6 08:29:56 UTC 2026


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://api.github.com/repos/scummvm/scummvm .

Summary:
047ee32497 IMAGE: GIF: Fix DGifCloseFile() build error with giflib 5.0.x


Commit: 047ee3249747d4d9528cf151394e420fe286a838
    https://github.com/scummvm/scummvm/commit/047ee3249747d4d9528cf151394e420fe286a838
Author: Donovan Watteau (contrib at dwatteau.fr)
Date: 2026-08-06T10:24:00+02:00

Commit Message:
IMAGE: GIF: Fix DGifCloseFile() build error with giflib 5.0.x

The second argument to DGifCloseFile() was added in giflib 5.1.0.

Changed paths:
    image/gif.cpp


diff --git a/image/gif.cpp b/image/gif.cpp
index f5b63224474..a161165e2be 100644
--- a/image/gif.cpp
+++ b/image/gif.cpp
@@ -30,6 +30,12 @@
 
 #include <gif_lib.h>
 
+#if GIFLIB_MAJOR > 5 || (GIFLIB_MAJOR == 5 && GIFLIB_MINOR >= 1)
+#  define DGIF_CLOSE_FILE_COMPAT(f) DGifCloseFile((f), nullptr)
+#else
+#  define DGIF_CLOSE_FILE_COMPAT(f) DGifCloseFile((f))
+#endif
+
 namespace Image {
 
 GIFDecoder::GIFDecoder() : _outputSurface(nullptr), _palette(0) {
@@ -57,13 +63,13 @@ bool GIFDecoder::loadStream(Common::SeekableReadStream &stream) {
 	const int errcode = DGifSlurp(gif);
 	if (errcode != GIF_OK) {
 		warning("GIF failed to load");
-		DGifCloseFile(gif, 0);
+		DGIF_CLOSE_FILE_COMPAT(gif);
 		return false;
 	}
 
 	if (gif->ImageCount <= 0) {
 		warning("GIF doesn't contain valid image data");
-		DGifCloseFile(gif, 0);
+		DGIF_CLOSE_FILE_COMPAT(gif);
 		return false;
 	}
 
@@ -124,7 +130,7 @@ bool GIFDecoder::loadStream(Common::SeekableReadStream &stream) {
 		memcpy(pixelPtr, in, width * height);
 	}
 
-	DGifCloseFile(gif, 0);
+	DGIF_CLOSE_FILE_COMPAT(gif);
 	return true;
 }
 




More information about the Scummvm-git-logs mailing list