at 18.09-beta 3.3 kB view raw
1diff -Naur libgdiplus-2.10.9-orig/src/gifcodec.c libgdiplus-2.10.9/src/gifcodec.c 2--- src/gifcodec.c 3+++ src/gifcodec.c 4@@ -39,8 +39,10 @@ 5 6 #include "gifcodec.h" 7 8+#if GIFLIB_MAJOR < 5 9 /* giflib declares this incorrectly as EgifOpen */ 10 extern GifFileType *EGifOpen(void *userData, OutputFunc writeFunc); 11+#endif 12 13 /* Data structure used for callback */ 14 typedef struct 15@@ -105,7 +107,7 @@ 16 */ 17 18 static int 19-AddExtensionBlockMono(SavedImage *New, int Len, BYTE ExtData[]) 20+AddExtensionBlockMono(SavedImage *New, int Len, int func, BYTE ExtData[]) 21 { 22 ExtensionBlock *ep; 23 24@@ -129,7 +131,7 @@ 25 26 if (ExtData) { 27 memcpy(ep->Bytes, ExtData, Len); 28- ep->Function = New->Function; 29+ ep->Function = func; 30 } 31 32 return (GIF_OK); 33@@ -232,20 +234,20 @@ 34 } 35 36 case EXTENSION_RECORD_TYPE: { 37- if (DGifGetExtension(GifFile, &temp_save.Function, &ExtData) == GIF_ERROR) { 38+ int func; 39+ if (DGifGetExtension(GifFile, &func, &ExtData) == GIF_ERROR) { 40 return (GIF_ERROR); 41 } 42 43 while (ExtData != NULL) { 44 /* Create an extension block with our data */ 45- if (AddExtensionBlockMono(&temp_save, ExtData[0], &ExtData[1]) == GIF_ERROR) { 46+ if (AddExtensionBlockMono(&temp_save, func, ExtData[0], &ExtData[1]) == GIF_ERROR) { 47 return (GIF_ERROR); 48 } 49 50 if (DGifGetExtensionNext(GifFile, &ExtData) == GIF_ERROR) { 51 return (GIF_ERROR); 52 } 53- temp_save.Function = 0; 54 } 55 break; 56 } 57@@ -303,12 +305,19 @@ 58 result = NULL; 59 loop_counter = FALSE; 60 61+#if GIFLIB_MAJOR < 5 62 if (from_file) { 63 gif = DGifOpen(stream, &gdip_gif_fileinputfunc); 64 } else { 65 gif = DGifOpen (stream, &gdip_gif_inputfunc); 66 } 67- 68+#else 69+ if (from_file) 70+ gif = DGifOpen(stream, &gdip_gif_fileinputfunc, NULL); 71+ else 72+ gif = DGifOpen(stream, &gdip_gif_inputfunc, NULL); 73+#endif 74+ 75 if (gif == NULL) { 76 goto error; 77 } 78@@ -581,7 +590,7 @@ 79 } 80 81 FreeExtensionMono(&global_extensions); 82- DGifCloseFile (gif); 83+ DGifCloseFile (gif, NULL); 84 85 *image = result; 86 return Ok; 87@@ -597,7 +606,7 @@ 88 89 if (gif != NULL) { 90 FreeExtensionMono (&global_extensions); 91- DGifCloseFile (gif); 92+ DGifCloseFile (gif, NULL); 93 } 94 95 *image = NULL; 96@@ -660,11 +669,22 @@ 97 return InvalidParameter; 98 } 99 100+#if GIFLIB_MAJOR < 5 101 if (from_file) { 102 fp = EGifOpenFileName (stream, 0); 103 } else { 104 fp = EGifOpen (stream, gdip_gif_outputfunc); 105 } 106+#else 107+ if (from_file) 108+ fp = EGifOpenFileName (stream, 0, NULL); 109+ else 110+ fp = EGifOpen (stream, gdip_gif_outputfunc, NULL); 111+#define MakeMapObject GifMakeMapObject 112+#define FreeMapObject GifFreeMapObject 113+#define QuantizeBuffer GifQuantizeBuffer 114+#define BitSize GifBitSize 115+#endif 116 117 if (!fp) { 118 return FileNotFound; 119@@ -848,8 +868,15 @@ 120 Buffer[0] = 1; 121 Buffer[1] = ptr[0]; 122 Buffer[2] = ptr[1]; 123+#if GIFLIB_MAJOR < 5 124 EGifPutExtensionFirst(fp, APPLICATION_EXT_FUNC_CODE, 11, "NETSCAPE2.0"); 125 EGifPutExtensionLast(fp, APPLICATION_EXT_FUNC_CODE, 3, Buffer); 126+#else 127+ EGifPutExtensionLeader(fp, APPLICATION_EXT_FUNC_CODE); 128+ EGifPutExtensionBlock(fp, 11, "NETSCAPE2.0"); 129+ EGifPutExtensionBlock(fp, 3, Buffer); 130+ EGifPutExtensionTrailer(fp); 131+#endif 132 } 133 } 134 135@@ -923,7 +950,7 @@ 136 } 137 } 138 139- EGifCloseFile (fp); 140+ EGifCloseFile (fp, NULL); 141 142 return Ok; 143