summaryrefslogtreecommitdiff
path: root/extra/fbida/ida-PrintGifError.patch
blob: e023218dd888b839766b4ee1404c983cf54c2612 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
diff -Naur fbida-2.09-orig/rd/read-gif.c fbida-2.09/rd/read-gif.c
--- fbida-2.09-orig/rd/read-gif.c	2013-07-29 16:43:26.949362012 -0400
+++ fbida-2.09/rd/read-gif.c	2013-07-29 16:43:43.669166969 -0400
@@ -13,6 +13,14 @@
     int w,h;
 };
 
+static void
+localPrintGifError(void)
+{
+    int ErrorCode=0;
+    GifErrorString(ErrorCode);
+    fprintf(stderr, "\nGIF-LIB error: %i.\n", ErrorCode);
+}
+
 static GifRecordType
 gif_fileread(struct gif_state *h)
 {
@@ -25,7 +33,7 @@
 	if (GIF_ERROR == DGifGetRecordType(h->gif,&RecordType)) {
 	    if (debug)
 		fprintf(stderr,"gif: DGifGetRecordType failed\n");
-	    PrintGifError();
+	    localPrintGifError();
 	    return -1;
 	}
 	switch (RecordType) {
@@ -42,7 +50,7 @@
 		if (rc == GIF_ERROR) {
 		    if (debug)
 			fprintf(stderr,"gif: DGifGetExtension failed\n");
-		    PrintGifError();
+		    localPrintGifError();
 		    return -1;
 		}
 		if (debug) {
@@ -93,12 +101,13 @@
     struct gif_state *h;
     GifRecordType RecordType;
     int i, image = 0;
-    
+    int Error;
+
     h = malloc(sizeof(*h));
     memset(h,0,sizeof(*h));
 
     h->infile = fp;
-    h->gif = DGifOpenFileHandle(fileno(fp));
+    h->gif = DGifOpenFileHandle(fileno(fp), &Error);
     h->row = malloc(h->gif->SWidth * sizeof(GifPixelType));
 
     while (0 == image) {
@@ -108,7 +117,7 @@
 	    if (GIF_ERROR == DGifGetImageDesc(h->gif)) {
 		if (debug)
 		    fprintf(stderr,"gif: DGifGetImageDesc failed\n");
-		PrintGifError();
+		localPrintGifError();
 	    }
 	    if (NULL == h->gif->SColorMap &&
 		NULL == h->gif->Image.ColorMap) {
@@ -165,7 +165,7 @@
  oops:
     if (debug)
 	fprintf(stderr,"gif: fatal error, aborting\n");
-    DGifCloseFile(h->gif);
+    DGifCloseFile(h->gif, &Error);
     fclose(h->infile);
     free(h->row);
     free(h);
@@ -202,10 +202,11 @@
 gif_done(void *data)
 {
     struct gif_state *h = data;
+    int Error;
 
     if (debug)
 	fprintf(stderr,"gif: done, cleaning up\n");
-    DGifCloseFile(h->gif);
+    DGifCloseFile(h->gif, &Error);
     fclose(h->infile);
     if (h->il)
 	free(h->il);