Fix compilation errors when using giflib 5

Some distristributions like Arch Linux are already
shipping giflib 5.0, which has some API changes
master
Jon Nordby 2014-07-04 17:27:27 +02:00
rodzic 1d75fccd12
commit 5d6570ae35
4 zmienionych plików z 60 dodań i 2 usunięć

Wyświetl plik

@ -48,7 +48,11 @@ int main(int argc, char **argv) {
//
printf("read %s\n",argv[1]);
color_resolution = -1;
GIFfile = DGifOpenFileName(argv[1]);
#if GIFLIB_MAJOR >= 5
GIFfile = DGifOpenFileName(argv[1], NULL);
#else
GIFfile = DGifOpenFileName(argv[1]);
#endif
if (GIFfile == NULL) {
printf("gif_info: oops -- can not open %s\n",argv[1]);
exit(-1);
@ -115,6 +119,10 @@ int main(int argc, char **argv) {
//
// exit
//
#if GIFLIB_MAJOR >= 5
DGifCloseFile(GIFfile, NULL);
#else
DGifCloseFile(GIFfile);
#endif
exit(0);
}

Wyświetl plik

@ -84,7 +84,11 @@ int main(int argc, char **argv) {
imin = 256;
imax = 0;
color_resolution = -1;
#if GIFLIB_MAJOR >= 5
GIFfile = DGifOpenFileName(argv[1], NULL);
#else
GIFfile = DGifOpenFileName(argv[1]);
#endif
if (GIFfile == NULL) {
printf("gif_png: oops -- can not open %s\n",argv[1]);
exit(-1);
@ -193,8 +197,17 @@ int main(int argc, char **argv) {
//
// read the file
//
#if GIFLIB_MAJOR >= 5
DGifCloseFile(GIFfile, NULL);
#else
DGifCloseFile(GIFfile);
#endif
#if GIFLIB_MAJOR >= 5
GIFfile = DGifOpenFileName(argv[1], NULL);
#else
GIFfile = DGifOpenFileName(argv[1]);
#endif
if (GIFfile == NULL) {
printf("gif_png: oops -- can not open %s\n",argv[1]);
exit(-1);
@ -341,6 +354,10 @@ int main(int argc, char **argv) {
//
// exit
//
#if GIFLIB_MAJOR >= 5
DGifCloseFile(GIFfile, NULL);
#else
DGifCloseFile(GIFfile);
#endif
exit(0);
}

Wyświetl plik

@ -465,7 +465,11 @@ int main(int argc, char **argv) {
//
printf("read %s\n",argv[1]);
color_resolution = -1;
#if GIFLIB_MAJOR >= 5
GIFfile = DGifOpenFileName(argv[1], NULL);
#else
GIFfile = DGifOpenFileName(argv[1]);
#endif
if (GIFfile == NULL) {
printf("gif_stl: oops -- can not open %s\n",argv[1]);
exit(-1);
@ -557,8 +561,16 @@ int main(int argc, char **argv) {
//
// read the file
//
#if GIFLIB_MAJOR >= 5
DGifCloseFile(GIFfile, NULL);
#else
DGifCloseFile(GIFfile);
#endif
#if GIFLIB_MAJOR >= 5
GIFfile = DGifOpenFileName(argv[1], NULL);
#else
GIFfile = DGifOpenFileName(argv[1]);
#endif
if (GIFfile == NULL) {
printf("gif_stl: oops -- can not open %s\n",argv[1]);
exit(-1);
@ -712,6 +724,10 @@ int main(int argc, char **argv) {
//
// exit
//
#if GIFLIB_MAJOR >= 5
DGifCloseFile(GIFfile, NULL);
#else
DGifCloseFile(GIFfile);
#endif
exit(0);
}

Wyświetl plik

@ -178,7 +178,11 @@ int main(int argc, char **argv) {
//
// set up color map
//
#if GIFLIB_MAJOR >= 5
GIFcmap = GifMakeMapObject(256, NULL);
#else
GIFcmap = MakeMapObject(256, NULL);
#endif
for (i = 0; i < 256; i++) {
GIFcmap->Colors[i].Red = i;
GIFcmap->Colors[i].Green = i;
@ -188,11 +192,20 @@ int main(int argc, char **argv) {
// open GIF file
//
printf("write %s\n",argv[2]);
GIFfile = EGifOpenFileName(argv[2], 0);
EGifPutScreenDesc(GIFfile,dx,dy,8,0,GIFcmap);
unsigned char loop_count[] = {1,0,0};
#if GIFLIB_MAJOR >= 5
GIFfile = EGifOpenFileName(argv[2], 0, NULL);
EGifPutExtension(GIFfile, APPLICATION_EXT_FUNC_CODE, 11, "NETSCAPE2.0");
EGifPutExtension(GIFfile, APPLICATION_EXT_FUNC_CODE, 3, loop_count);
#else
GIFfile = EGifOpenFileName(argv[2], 0);
EGifPutExtensionFirst(GIFfile, APPLICATION_EXT_FUNC_CODE, 11, "NETSCAPE2.0");
EGifPutExtensionLast(GIFfile, APPLICATION_EXT_FUNC_CODE, 3, loop_count);
#endif
unsigned char delay_count[5] = {
0, // no transparency
0, // delay time
@ -260,6 +273,10 @@ int main(int argc, char **argv) {
// exit
//
fclose(input_file);
#if GIFLIB_MAJOR >= 5
EGifCloseFile(GIFfile, NULL);
#else
EGifCloseFile(GIFfile);
#endif
exit(0);
}