2014-10-11 08:39:02 +00:00
|
|
|
diff -Naur libgdiplus-2.10.9-orig/src/gifcodec.c libgdiplus-2.10.9/src/gifcodec.c
|
2013-12-07 12:32:57 +00:00
|
|
|
--- src/gifcodec.c
|
|
|
|
+++ src/gifcodec.c
|
2014-10-11 08:39:02 +00:00
|
|
|
@@ -39,8 +39,10 @@
|
2013-12-07 12:32:57 +00:00
|
|
|
|
|
|
|
#include "gifcodec.h"
|
|
|
|
|
|
|
|
+#if GIFLIB_MAJOR < 5
|
|
|
|
/* giflib declares this incorrectly as EgifOpen */
|
|
|
|
extern GifFileType *EGifOpen(void *userData, OutputFunc writeFunc);
|
|
|
|
+#endif
|
|
|
|
|
|
|
|
/* Data structure used for callback */
|
|
|
|
typedef struct
|
2014-10-11 08:39:02 +00:00
|
|
|
@@ -105,7 +107,7 @@
|
2013-12-07 12:32:57 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
static int
|
|
|
|
-AddExtensionBlockMono(SavedImage *New, int Len, BYTE ExtData[])
|
|
|
|
+AddExtensionBlockMono(SavedImage *New, int Len, int func, BYTE ExtData[])
|
|
|
|
{
|
|
|
|
ExtensionBlock *ep;
|
|
|
|
|
2014-10-11 08:39:02 +00:00
|
|
|
@@ -129,7 +131,7 @@
|
2013-12-07 12:32:57 +00:00
|
|
|
|
|
|
|
if (ExtData) {
|
|
|
|
memcpy(ep->Bytes, ExtData, Len);
|
|
|
|
- ep->Function = New->Function;
|
|
|
|
+ ep->Function = func;
|
|
|
|
}
|
|
|
|
|
|
|
|
return (GIF_OK);
|
2014-10-11 08:39:02 +00:00
|
|
|
@@ -232,20 +234,20 @@
|
2013-12-07 12:32:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
case EXTENSION_RECORD_TYPE: {
|
|
|
|
- if (DGifGetExtension(GifFile, &temp_save.Function, &ExtData) == GIF_ERROR) {
|
|
|
|
+ int func;
|
|
|
|
+ if (DGifGetExtension(GifFile, &func, &ExtData) == GIF_ERROR) {
|
|
|
|
return (GIF_ERROR);
|
|
|
|
}
|
|
|
|
|
|
|
|
while (ExtData != NULL) {
|
|
|
|
/* Create an extension block with our data */
|
|
|
|
- if (AddExtensionBlockMono(&temp_save, ExtData[0], &ExtData[1]) == GIF_ERROR) {
|
|
|
|
+ if (AddExtensionBlockMono(&temp_save, func, ExtData[0], &ExtData[1]) == GIF_ERROR) {
|
|
|
|
return (GIF_ERROR);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (DGifGetExtensionNext(GifFile, &ExtData) == GIF_ERROR) {
|
|
|
|
return (GIF_ERROR);
|
|
|
|
}
|
|
|
|
- temp_save.Function = 0;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
2014-10-11 08:39:02 +00:00
|
|
|
@@ -303,12 +305,19 @@
|
2013-12-07 12:32:57 +00:00
|
|
|
result = NULL;
|
|
|
|
loop_counter = FALSE;
|
|
|
|
|
|
|
|
+#if GIFLIB_MAJOR < 5
|
|
|
|
if (from_file) {
|
|
|
|
gif = DGifOpen(stream, &gdip_gif_fileinputfunc);
|
|
|
|
} else {
|
|
|
|
gif = DGifOpen (stream, &gdip_gif_inputfunc);
|
|
|
|
}
|
|
|
|
-
|
|
|
|
+#else
|
|
|
|
+ if (from_file)
|
|
|
|
+ gif = DGifOpen(stream, &gdip_gif_fileinputfunc, NULL);
|
|
|
|
+ else
|
|
|
|
+ gif = DGifOpen(stream, &gdip_gif_inputfunc, NULL);
|
|
|
|
+#endif
|
|
|
|
+
|
|
|
|
if (gif == NULL) {
|
|
|
|
goto error;
|
|
|
|
}
|
2014-10-11 08:39:02 +00:00
|
|
|
@@ -581,7 +590,7 @@
|
|
|
|
}
|
|
|
|
|
|
|
|
FreeExtensionMono(&global_extensions);
|
|
|
|
- DGifCloseFile (gif);
|
|
|
|
+ DGifCloseFile (gif, NULL);
|
|
|
|
|
|
|
|
*image = result;
|
|
|
|
return Ok;
|
|
|
|
@@ -597,7 +606,7 @@
|
|
|
|
|
|
|
|
if (gif != NULL) {
|
|
|
|
FreeExtensionMono (&global_extensions);
|
|
|
|
- DGifCloseFile (gif);
|
|
|
|
+ DGifCloseFile (gif, NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
*image = NULL;
|
|
|
|
@@ -660,11 +669,22 @@
|
2013-12-07 12:32:57 +00:00
|
|
|
return InvalidParameter;
|
|
|
|
}
|
|
|
|
|
|
|
|
+#if GIFLIB_MAJOR < 5
|
|
|
|
if (from_file) {
|
|
|
|
fp = EGifOpenFileName (stream, 0);
|
|
|
|
} else {
|
|
|
|
fp = EGifOpen (stream, gdip_gif_outputfunc);
|
|
|
|
}
|
|
|
|
+#else
|
|
|
|
+ if (from_file)
|
|
|
|
+ fp = EGifOpenFileName (stream, 0, NULL);
|
|
|
|
+ else
|
|
|
|
+ fp = EGifOpen (stream, gdip_gif_outputfunc, NULL);
|
|
|
|
+#define MakeMapObject GifMakeMapObject
|
|
|
|
+#define FreeMapObject GifFreeMapObject
|
|
|
|
+#define QuantizeBuffer GifQuantizeBuffer
|
|
|
|
+#define BitSize GifBitSize
|
|
|
|
+#endif
|
|
|
|
|
|
|
|
if (!fp) {
|
|
|
|
return FileNotFound;
|
2014-10-11 08:39:02 +00:00
|
|
|
@@ -848,8 +868,15 @@
|
2013-12-07 12:32:57 +00:00
|
|
|
Buffer[0] = 1;
|
|
|
|
Buffer[1] = ptr[0];
|
|
|
|
Buffer[2] = ptr[1];
|
|
|
|
+#if GIFLIB_MAJOR < 5
|
|
|
|
EGifPutExtensionFirst(fp, APPLICATION_EXT_FUNC_CODE, 11, "NETSCAPE2.0");
|
|
|
|
EGifPutExtensionLast(fp, APPLICATION_EXT_FUNC_CODE, 3, Buffer);
|
|
|
|
+#else
|
|
|
|
+ EGifPutExtensionLeader(fp, APPLICATION_EXT_FUNC_CODE);
|
|
|
|
+ EGifPutExtensionBlock(fp, 11, "NETSCAPE2.0");
|
|
|
|
+ EGifPutExtensionBlock(fp, 3, Buffer);
|
|
|
|
+ EGifPutExtensionTrailer(fp);
|
|
|
|
+#endif
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-10-11 08:39:02 +00:00
|
|
|
@@ -923,7 +950,7 @@
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
- EGifCloseFile (fp);
|
|
|
|
+ EGifCloseFile (fp, NULL);
|
|
|
|
|
|
|
|
return Ok;
|
|
|
|
|