wok-next diff xplanet/stuff/patches/giflib5.diff @ rev 20241

xplanet: use patches
author Aleksej Bobylev <al.bobylev@gmail.com>
date Mon Nov 06 22:53:21 2017 +0200 (2017-11-06)
parents
children
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/xplanet/stuff/patches/giflib5.diff	Mon Nov 06 22:53:21 2017 +0200
     1.3 @@ -0,0 +1,162 @@
     1.4 +Index: b/src/libimage/gif.c
     1.5 +===================================================================
     1.6 +--- a/src/libimage/gif.c
     1.7 ++++ b/src/libimage/gif.c
     1.8 +@@ -38,32 +38,34 @@ read_gif(const char *filename, int *widt
     1.9 +     GifRecordType record_type;
    1.10 +     GifRowType *buffer = NULL;
    1.11 + 
    1.12 +-    int i, j;
    1.13 ++    int i, j, err;
    1.14 +     int color_index;
    1.15 +     unsigned char *ptr = NULL;
    1.16 + 
    1.17 +-    infile = DGifOpenFileName(filename);
    1.18 ++    infile = DGifOpenFileName(filename, &err);
    1.19 + 
    1.20 +     if (infile == NULL)
    1.21 +     {
    1.22 +-        PrintGifError();
    1.23 ++        fprintf(stderr, "\nGIF-LIB error: %s.\n", GifErrorString(err));
    1.24 +         return(0);
    1.25 +     }
    1.26 + 
    1.27 +     do
    1.28 +     {
    1.29 +-        if (DGifGetRecordType(infile, &record_type) == GIF_ERROR) 
    1.30 ++        err = DGifGetRecordType(infile, &record_type);
    1.31 ++        if (err != GIF_OK) 
    1.32 +         {
    1.33 +-            PrintGifError();
    1.34 ++            fprintf(stderr, "\nGIF-LIB error: %s.\n", GifErrorString(err));
    1.35 +             return(0);
    1.36 +         }
    1.37 + 
    1.38 +         switch (record_type)
    1.39 +         {
    1.40 +         case IMAGE_DESC_RECORD_TYPE:
    1.41 +-            if (DGifGetImageDesc(infile) == GIF_ERROR)
    1.42 ++            err = DGifGetImageDesc(infile);
    1.43 ++            if (err != GIF_OK)
    1.44 +             {
    1.45 +-                PrintGifError();
    1.46 ++                fprintf(stderr, "\nGIF-LIB error: %s.\n", GifErrorString(err));
    1.47 +                 return(0);
    1.48 +             }
    1.49 + 
    1.50 +@@ -105,16 +107,18 @@ read_gif(const char *filename, int *widt
    1.51 +             /* Skip extension blocks */
    1.52 +             int ext_code;
    1.53 +             GifByteType *ext;
    1.54 +-            if (DGifGetExtension(infile, &ext_code, &ext) == GIF_ERROR) 
    1.55 ++            err = DGifGetExtension(infile, &ext_code, &ext);
    1.56 ++            if (err != GIF_OK) 
    1.57 +             {
    1.58 +-                PrintGifError();
    1.59 ++                fprintf(stderr, "\nGIF-LIB error: %s.\n", GifErrorString(err));
    1.60 +                 return(0);
    1.61 +             }
    1.62 +             while (ext != NULL) 
    1.63 +             {
    1.64 +-                if (DGifGetExtensionNext(infile, &ext) == GIF_ERROR) 
    1.65 ++                err = DGifGetExtensionNext(infile, &ext);
    1.66 ++                if (err != GIF_OK) 
    1.67 +                 {
    1.68 +-                    PrintGifError();
    1.69 ++                    fprintf(stderr, "\nGIF-LIB error: %s.\n", GifErrorString(err));
    1.70 +                     return(0);
    1.71 +                 }
    1.72 +             }
    1.73 +@@ -154,14 +158,14 @@ read_gif(const char *filename, int *widt
    1.74 +     
    1.75 +     free(buffer);
    1.76 + 
    1.77 +-    DGifCloseFile(infile);
    1.78 ++    DGifCloseFile(infile, NULL);
    1.79 +     return(1);
    1.80 + }
    1.81 + 
    1.82 + int 
    1.83 + write_gif(const char *filename, int width, int height, char *rgb)
    1.84 + {
    1.85 +-    int i;
    1.86 ++    int i, err;
    1.87 +     int colormap_size = 256;
    1.88 +     GifByteType *red, *green, *blue, *buffer, *ptr;
    1.89 +     GifFileType *outfile;
    1.90 +@@ -178,7 +182,7 @@ write_gif(const char *filename, int widt
    1.91 +         return(0);
    1.92 +     }
    1.93 + 
    1.94 +-    colormap = MakeMapObject(colormap_size, NULL);
    1.95 ++    colormap = GifMakeMapObject(colormap_size, NULL);
    1.96 + 
    1.97 +     for (i = 0; i < width * height; i++)
    1.98 +     {
    1.99 +@@ -187,10 +191,11 @@ write_gif(const char *filename, int widt
   1.100 +         blue[i]  = (GifByteType) rgb[3*i+2];
   1.101 +     }
   1.102 +   
   1.103 +-    if (QuantizeBuffer(width, height, &colormap_size, red, green, blue,   
   1.104 +-                       buffer, colormap->Colors) == GIF_ERROR)
   1.105 ++    err = GifQuantizeBuffer(width, height, &colormap_size, red, green, blue,   
   1.106 ++                            buffer, colormap->Colors);
   1.107 ++    if (err != GIF_OK)
   1.108 +     {
   1.109 +-        PrintGifError();
   1.110 ++        fprintf(stderr, "\nGIF-LIB error: %s.\n", GifErrorString(err));
   1.111 +         return(0);
   1.112 +     }
   1.113 + 
   1.114 +@@ -198,24 +203,24 @@ write_gif(const char *filename, int widt
   1.115 +     free(green);
   1.116 +     free(blue);
   1.117 + 
   1.118 +-    outfile = EGifOpenFileName((char *) filename, FALSE);
   1.119 ++    outfile = EGifOpenFileName((char *) filename, 0, &err);
   1.120 +     if (outfile == NULL)
   1.121 +     {
   1.122 +-        PrintGifError();
   1.123 ++        fprintf(stderr, "\nGIF-LIB error: %s.\n", GifErrorString(err));
   1.124 +         return(0);
   1.125 +     }
   1.126 + 
   1.127 +-    if (EGifPutScreenDesc(outfile, width, height, colormap_size, 0, colormap)
   1.128 +-        == GIF_ERROR)
   1.129 ++    err = EGifPutScreenDesc(outfile, width, height, colormap_size, 0, colormap);
   1.130 ++    if (err != GIF_OK)
   1.131 +     {
   1.132 +-        PrintGifError();
   1.133 ++        fprintf(stderr, "\nGIF-LIB error: %s.\n", GifErrorString(err));
   1.134 +         return(0);
   1.135 +     }
   1.136 + 
   1.137 +-    if (EGifPutImageDesc(outfile, 0, 0, width, height, FALSE, NULL)
   1.138 ++    if (EGifPutImageDesc(outfile, 0, 0, width, height, 0, NULL)
   1.139 +         == GIF_ERROR)
   1.140 +     {
   1.141 +-        PrintGifError();
   1.142 ++        fprintf(stderr, "\nGIF-LIB error: %s.\n", GifErrorString(err));
   1.143 +         return(0);
   1.144 +     }
   1.145 + 
   1.146 +@@ -224,7 +229,7 @@ write_gif(const char *filename, int widt
   1.147 +     {
   1.148 +         if (EGifPutLine(outfile, ptr, width) == GIF_ERROR)
   1.149 +         {
   1.150 +-            PrintGifError();
   1.151 ++            fprintf(stderr, "\nGIF-LIB error: %s.\n", GifErrorString(err));
   1.152 +             return(0);
   1.153 +         }
   1.154 +         ptr += width;
   1.155 +@@ -232,8 +237,8 @@ write_gif(const char *filename, int widt
   1.156 + 
   1.157 +     EGifSpew(outfile);
   1.158 + 
   1.159 +-    if (EGifCloseFile(outfile) == GIF_ERROR) 
   1.160 +-        PrintGifError();
   1.161 ++    if (EGifCloseFile(outfile, NULL) == GIF_ERROR) 
   1.162 ++        fprintf(stderr, "\nGIF-LIB error: %s.\n", GifErrorString(err));
   1.163 + 
   1.164 +     free(buffer);
   1.165 +