From owner-svn-ports-head@freebsd.org Fri Jan 29 18:54:43 2021 Return-Path: Delivered-To: svn-ports-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0F82F4F60D2; Fri, 29 Jan 2021 18:54:43 +0000 (UTC) (envelope-from nc@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DS62p753Zz3n17; Fri, 29 Jan 2021 18:54:42 +0000 (UTC) (envelope-from nc@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E4ABD27857; Fri, 29 Jan 2021 18:54:42 +0000 (UTC) (envelope-from nc@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 10TIsgIT044144; Fri, 29 Jan 2021 18:54:42 GMT (envelope-from nc@FreeBSD.org) Received: (from nc@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 10TIsgCv044141; Fri, 29 Jan 2021 18:54:42 GMT (envelope-from nc@FreeBSD.org) Message-Id: <202101291854.10TIsgCv044141@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: nc set sender to nc@FreeBSD.org using -f From: Neel Chauhan Date: Fri, 29 Jan 2021 18:54:42 +0000 (UTC) To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r563228 - in head/astro/xplanet: . files X-SVN-Group: ports-head X-SVN-Commit-Author: nc X-SVN-Commit-Paths: in head/astro/xplanet: . files X-SVN-Commit-Revision: 563228 X-SVN-Commit-Repository: ports MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-ports-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the ports tree for head List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 Jan 2021 18:54:43 -0000 Author: nc Date: Fri Jan 29 18:54:42 2021 New Revision: 563228 URL: https://svnweb.freebsd.org/changeset/ports/563228 Log: astro/xplanet: Update to 1.3.1 Reviewed by: 0mp (mentor) Approved by: 0mp (mentor) Differential Revision: https://reviews.freebsd.org/D28373 Modified: head/astro/xplanet/Makefile head/astro/xplanet/distinfo head/astro/xplanet/files/patch-src_libimage_gif.c Modified: head/astro/xplanet/Makefile ============================================================================== --- head/astro/xplanet/Makefile Fri Jan 29 18:53:36 2021 (r563227) +++ head/astro/xplanet/Makefile Fri Jan 29 18:54:42 2021 (r563228) @@ -2,8 +2,7 @@ # $FreeBSD$ PORTNAME= xplanet -PORTVERSION= 1.3.0 -PORTREVISION= 12 +PORTVERSION= 1.3.1 CATEGORIES= astro geography MASTER_SITES= SF @@ -11,8 +10,8 @@ MAINTAINER= ports@FreeBSD.org COMMENT= Draw pictures of the earth textured by an image GNU_CONFIGURE= yes -USES= iconv localbase xorg -USE_XORG= xt xscrnsaver +USES= iconv:wchar_t localbase xorg +USE_XORG= x11 xext xt xscrnsaver CONFIGURE_ARGS= --with-map-extension=jpg CPPFLAGS+= -I${LOCALBASE}/include/netpbm LIBS+= -lm Modified: head/astro/xplanet/distinfo ============================================================================== --- head/astro/xplanet/distinfo Fri Jan 29 18:53:36 2021 (r563227) +++ head/astro/xplanet/distinfo Fri Jan 29 18:54:42 2021 (r563228) @@ -1,2 +1,3 @@ -SHA256 (xplanet-1.3.0.tar.gz) = 44fb742bb93e5661ea8b11ccabcc12896693e051f3dd5083c9227224c416b442 -SIZE (xplanet-1.3.0.tar.gz) = 1227385 +TIMESTAMP = 1611765595 +SHA256 (xplanet-1.3.1.tar.gz) = 4380d570a8bf27b81fb629c97a636c1673407f4ac4989ce931720078a90aece7 +SIZE (xplanet-1.3.1.tar.gz) = 1236035 Modified: head/astro/xplanet/files/patch-src_libimage_gif.c ============================================================================== --- head/astro/xplanet/files/patch-src_libimage_gif.c Fri Jan 29 18:53:36 2021 (r563227) +++ head/astro/xplanet/files/patch-src_libimage_gif.c Fri Jan 29 18:54:42 2021 (r563228) @@ -1,487 +1,29 @@ ---- src/libimage/gif.c.orig 2006-03-25 22:50:51 UTC -+++ src/libimage/gif.c -@@ -28,6 +28,314 @@ - distribution. - */ - -+#define ABS(x) ((x) > 0 ? (x) : (-(x))) -+#define COLOR_ARRAY_SIZE 32768 -+#define BITS_PER_PRIM_COLOR 5 -+#define MAX_PRIM_COLOR 0x1f -+ -+static int SortRGBAxis; -+ -+typedef struct QuantizedColorType { -+ GifByteType RGB[3]; -+ GifByteType NewColorIndex; -+ long Count; -+ struct QuantizedColorType *Pnext; -+} QuantizedColorType; -+ -+typedef struct NewColorMapType { -+ GifByteType RGBMin[3], RGBWidth[3]; -+ unsigned int NumEntries; /* # of QuantizedColorType in linked list below */ -+ unsigned long Count; /* Total number of pixels in all the entries */ -+ QuantizedColorType *QuantizedColors; -+} NewColorMapType; -+ -+ -+/**************************************************************************** -+ * Routine called by qsort to compare two entries. -+ ****************************************************************************/ -+static int -+SortCmpRtn(const void *Entry1, -+ const void *Entry2) { -+ -+ return (*((QuantizedColorType **) Entry1))->RGB[SortRGBAxis] - -+ (*((QuantizedColorType **) Entry2))->RGB[SortRGBAxis]; -+} -+ -+/****************************************************************************** -+ * Routine to subdivide the RGB space recursively using median cut in each -+ * axes alternatingly until ColorMapSize different cubes exists. -+ * The biggest cube in one dimension is subdivide unless it has only one entry. -+ * Returns GIF_ERROR if failed, otherwise GIF_OK. -+ ******************************************************************************/ -+static int -+SubdivColorMap(NewColorMapType * NewColorSubdiv, -+ unsigned int ColorMapSize, -+ unsigned int *NewColorMapSize) { -+ -+ int MaxSize; -+ unsigned int i, j, Index = 0, NumEntries, MinColor, MaxColor; -+ long Sum, Count; -+ QuantizedColorType *QuantizedColor, **SortArray; -+ -+ while (ColorMapSize > *NewColorMapSize) { -+ /* Find candidate for subdivision: */ -+ MaxSize = -1; -+ for (i = 0; i < *NewColorMapSize; i++) { -+ for (j = 0; j < 3; j++) { -+ if ((((int)NewColorSubdiv[i].RGBWidth[j]) > MaxSize) && -+ (NewColorSubdiv[i].NumEntries > 1)) { -+ MaxSize = NewColorSubdiv[i].RGBWidth[j]; -+ Index = i; -+ SortRGBAxis = j; -+ } -+ } -+ } -+ -+ if (MaxSize == -1) -+ return GIF_OK; -+ -+ /* Split the entry Index into two along the axis SortRGBAxis: */ -+ -+ /* Sort all elements in that entry along the given axis and split at -+ * the median. */ -+ SortArray = (QuantizedColorType **)malloc( -+ sizeof(QuantizedColorType *) * -+ NewColorSubdiv[Index].NumEntries); -+ if (SortArray == NULL) -+ return GIF_ERROR; -+ for (j = 0, QuantizedColor = NewColorSubdiv[Index].QuantizedColors; -+ j < NewColorSubdiv[Index].NumEntries && QuantizedColor != NULL; -+ j++, QuantizedColor = QuantizedColor->Pnext) -+ SortArray[j] = QuantizedColor; -+ -+ qsort(SortArray, NewColorSubdiv[Index].NumEntries, -+ sizeof(QuantizedColorType *), SortCmpRtn); -+ -+ /* Relink the sorted list into one: */ -+ for (j = 0; j < NewColorSubdiv[Index].NumEntries - 1; j++) -+ SortArray[j]->Pnext = SortArray[j + 1]; -+ SortArray[NewColorSubdiv[Index].NumEntries - 1]->Pnext = NULL; -+ NewColorSubdiv[Index].QuantizedColors = QuantizedColor = SortArray[0]; -+ free((char *)SortArray); -+ -+ /* Now simply add the Counts until we have half of the Count: */ -+ Sum = NewColorSubdiv[Index].Count / 2 - QuantizedColor->Count; -+ NumEntries = 1; -+ Count = QuantizedColor->Count; -+ while (QuantizedColor->Pnext != NULL && -+ (Sum -= QuantizedColor->Pnext->Count) >= 0 && -+ QuantizedColor->Pnext->Pnext != NULL) { -+ QuantizedColor = QuantizedColor->Pnext; -+ NumEntries++; -+ Count += QuantizedColor->Count; -+ } -+ /* Save the values of the last color of the first half, and first -+ * of the second half so we can update the Bounding Boxes later. -+ * Also as the colors are quantized and the BBoxes are full 0..255, -+ * they need to be rescaled. -+ */ -+ MaxColor = QuantizedColor->RGB[SortRGBAxis]; /* Max. of first half */ -+ /* coverity[var_deref_op] */ -+ MinColor = QuantizedColor->Pnext->RGB[SortRGBAxis]; /* of second */ -+ MaxColor <<= (8 - BITS_PER_PRIM_COLOR); -+ MinColor <<= (8 - BITS_PER_PRIM_COLOR); -+ -+ /* Partition right here: */ -+ NewColorSubdiv[*NewColorMapSize].QuantizedColors = -+ QuantizedColor->Pnext; -+ QuantizedColor->Pnext = NULL; -+ NewColorSubdiv[*NewColorMapSize].Count = Count; -+ NewColorSubdiv[Index].Count -= Count; -+ NewColorSubdiv[*NewColorMapSize].NumEntries = -+ NewColorSubdiv[Index].NumEntries - NumEntries; -+ NewColorSubdiv[Index].NumEntries = NumEntries; -+ for (j = 0; j < 3; j++) { -+ NewColorSubdiv[*NewColorMapSize].RGBMin[j] = -+ NewColorSubdiv[Index].RGBMin[j]; -+ NewColorSubdiv[*NewColorMapSize].RGBWidth[j] = -+ NewColorSubdiv[Index].RGBWidth[j]; -+ } -+ NewColorSubdiv[*NewColorMapSize].RGBWidth[SortRGBAxis] = -+ NewColorSubdiv[*NewColorMapSize].RGBMin[SortRGBAxis] + -+ NewColorSubdiv[*NewColorMapSize].RGBWidth[SortRGBAxis] - MinColor; -+ NewColorSubdiv[*NewColorMapSize].RGBMin[SortRGBAxis] = MinColor; -+ -+ NewColorSubdiv[Index].RGBWidth[SortRGBAxis] = -+ MaxColor - NewColorSubdiv[Index].RGBMin[SortRGBAxis]; -+ -+ (*NewColorMapSize)++; -+ } -+ -+ return GIF_OK; -+} -+ -+/****************************************************************************** -+ * Quantize high resolution image into lower one. Input image consists of a -+ * 2D array for each of the RGB colors with size Width by Height. There is no -+ * Color map for the input. Output is a quantized image with 2D array of -+ * indexes into the output color map. -+ * Note input image can be 24 bits at the most (8 for red/green/blue) and -+ * the output has 256 colors at the most (256 entries in the color map.). -+ * ColorMapSize specifies size of color map up to 256 and will be updated to -+ * real size before returning. -+ * Also non of the parameter are allocated by this routine. -+ * This function returns GIF_OK if succesfull, GIF_ERROR otherwise. -+ ******************************************************************************/ -+static int -+QuantizeBuffer(unsigned int Width, -+ unsigned int Height, -+ int *ColorMapSize, -+ GifByteType * RedInput, -+ GifByteType * GreenInput, -+ GifByteType * BlueInput, -+ GifByteType * OutputBuffer, -+ GifColorType * OutputColorMap) { -+ -+ unsigned int Index, NumOfEntries; -+ int i, j, MaxRGBError[3]; -+ unsigned int NewColorMapSize; -+ long Red, Green, Blue; -+ NewColorMapType NewColorSubdiv[256]; -+ QuantizedColorType *ColorArrayEntries, *QuantizedColor; -+ -+ ColorArrayEntries = (QuantizedColorType *)malloc( -+ sizeof(QuantizedColorType) * COLOR_ARRAY_SIZE); -+ if (ColorArrayEntries == NULL) { -+ return GIF_ERROR; -+ } -+ -+ for (i = 0; i < COLOR_ARRAY_SIZE; i++) { -+ ColorArrayEntries[i].RGB[0] = i >> (2 * BITS_PER_PRIM_COLOR); -+ ColorArrayEntries[i].RGB[1] = (i >> BITS_PER_PRIM_COLOR) & -+ MAX_PRIM_COLOR; -+ ColorArrayEntries[i].RGB[2] = i & MAX_PRIM_COLOR; -+ ColorArrayEntries[i].Count = 0; -+ } -+ -+ /* Sample the colors and their distribution: */ -+ for (i = 0; i < (int)(Width * Height); i++) { -+ Index = ((RedInput[i] >> (8 - BITS_PER_PRIM_COLOR)) << -+ (2 * BITS_PER_PRIM_COLOR)) + -+ ((GreenInput[i] >> (8 - BITS_PER_PRIM_COLOR)) << -+ BITS_PER_PRIM_COLOR) + -+ (BlueInput[i] >> (8 - BITS_PER_PRIM_COLOR)); -+ ColorArrayEntries[Index].Count++; -+ } -+ -+ /* Put all the colors in the first entry of the color map, and call the -+ * recursive subdivision process. */ -+ for (i = 0; i < 256; i++) { -+ NewColorSubdiv[i].QuantizedColors = NULL; -+ NewColorSubdiv[i].Count = NewColorSubdiv[i].NumEntries = 0; -+ for (j = 0; j < 3; j++) { -+ NewColorSubdiv[i].RGBMin[j] = 0; -+ NewColorSubdiv[i].RGBWidth[j] = 255; -+ } -+ } -+ -+ /* Find the non empty entries in the color table and chain them: */ -+ for (i = 0; i < COLOR_ARRAY_SIZE; i++) -+ if (ColorArrayEntries[i].Count > 0) -+ break; -+ QuantizedColor = NewColorSubdiv[0].QuantizedColors = &ColorArrayEntries[i]; -+ NumOfEntries = 1; -+ while (++i < COLOR_ARRAY_SIZE) -+ if (ColorArrayEntries[i].Count > 0) { -+ QuantizedColor->Pnext = &ColorArrayEntries[i]; -+ QuantizedColor = &ColorArrayEntries[i]; -+ NumOfEntries++; -+ } -+ QuantizedColor->Pnext = NULL; -+ -+ NewColorSubdiv[0].NumEntries = NumOfEntries; /* Different sampled colors */ -+ NewColorSubdiv[0].Count = ((long)Width) * Height; /* Pixels */ -+ NewColorMapSize = 1; -+ if (SubdivColorMap(NewColorSubdiv, *ColorMapSize, &NewColorMapSize) != -+ GIF_OK) { -+ free((char *)ColorArrayEntries); -+ return GIF_ERROR; -+ } -+ if (NewColorMapSize < *ColorMapSize) { -+ /* And clear rest of color map: */ -+ for (i = NewColorMapSize; i < *ColorMapSize; i++) -+ OutputColorMap[i].Red = OutputColorMap[i].Green = -+ OutputColorMap[i].Blue = 0; -+ } -+ -+ /* Average the colors in each entry to be the color to be used in the -+ * output color map, and plug it into the output color map itself. */ -+ for (i = 0; i < NewColorMapSize; i++) { -+ if ((j = NewColorSubdiv[i].NumEntries) > 0) { -+ QuantizedColor = NewColorSubdiv[i].QuantizedColors; -+ Red = Green = Blue = 0; -+ while (QuantizedColor) { -+ QuantizedColor->NewColorIndex = i; -+ Red += QuantizedColor->RGB[0]; -+ Green += QuantizedColor->RGB[1]; -+ Blue += QuantizedColor->RGB[2]; -+ QuantizedColor = QuantizedColor->Pnext; -+ } -+ OutputColorMap[i].Red = (Red << (8 - BITS_PER_PRIM_COLOR)) / j; -+ OutputColorMap[i].Green = (Green << (8 - BITS_PER_PRIM_COLOR)) / j; -+ OutputColorMap[i].Blue = (Blue << (8 - BITS_PER_PRIM_COLOR)) / j; -+ } else -+ fprintf(stderr, -+ "\n%s: Null entry in quantized color map - that's weird.\n", -+ "libgdiplus"); -+ } -+ -+ /* Finally scan the input buffer again and put the mapped index in the -+ * output buffer. */ -+ MaxRGBError[0] = MaxRGBError[1] = MaxRGBError[2] = 0; -+ for (i = 0; i < (int)(Width * Height); i++) { -+ Index = ((RedInput[i] >> (8 - BITS_PER_PRIM_COLOR)) << -+ (2 * BITS_PER_PRIM_COLOR)) + -+ ((GreenInput[i] >> (8 - BITS_PER_PRIM_COLOR)) << -+ BITS_PER_PRIM_COLOR) + -+ (BlueInput[i] >> (8 - BITS_PER_PRIM_COLOR)); -+ Index = ColorArrayEntries[Index].NewColorIndex; -+ OutputBuffer[i] = Index; -+ if (MaxRGBError[0] < ABS(OutputColorMap[Index].Red - RedInput[i])) -+ MaxRGBError[0] = ABS(OutputColorMap[Index].Red - RedInput[i]); -+ if (MaxRGBError[1] < ABS(OutputColorMap[Index].Green - GreenInput[i])) -+ MaxRGBError[1] = ABS(OutputColorMap[Index].Green - GreenInput[i]); -+ if (MaxRGBError[2] < ABS(OutputColorMap[Index].Blue - BlueInput[i])) -+ MaxRGBError[2] = ABS(OutputColorMap[Index].Blue - BlueInput[i]); -+ } -+ -+#ifdef DEBUG -+ fprintf(stderr, -+ "Quantization L(0) errors: Red = %d, Green = %d, Blue = %d.\n", -+ MaxRGBError[0], MaxRGBError[1], MaxRGBError[2]); -+#endif /* DEBUG */ -+ -+ free((char *)ColorArrayEntries); -+ -+ *ColorMapSize = NewColorMapSize; -+ -+ return GIF_OK; -+} -+ -+static void -+#if GIFLIB_MAJOR >= 5 -+localPrintGifError(int ErrorCode) -+#else -+localPrintGifError(void) -+#endif -+{ -+#if GIFLIB_MAJOR >= 5 -+ char *Err = GifErrorString(ErrorCode); -+#else -+ char *Err = GifErrorString(); -+ int ErrorCode = GifError(); -+#endif -+ -+ if (Err != NULL) -+ fprintf(stderr, "\nGIF-LIB error: %s.\n", Err); -+ else -+ fprintf(stderr, "\nGIF-LIB undefined error %d.\n", ErrorCode); -+} -+ - int - read_gif(const char *filename, int *width, int *height, unsigned char **rgb) - { -@@ -42,11 +350,15 @@ read_gif(const char *filename, int *widt - int color_index; - unsigned char *ptr = NULL; - -+#if GIFLIB_MAJOR >= 5 -+ infile = DGifOpenFileName(filename, NULL); -+#else - infile = DGifOpenFileName(filename); -+#endif - - if (infile == NULL) - { -- PrintGifError(); -+ fprintf(stderr, "Can't open GIF file %s\n", filename); - return(0); +--- src/libimage/gif.c.orig 2021-01-27 08:42:58.763140000 -0800 ++++ src/libimage/gif.c 2021-01-27 08:45:43.718031000 -0800 +@@ -179,7 +179,7 @@ + } } - -@@ -54,7 +366,11 @@ read_gif(const char *filename, int *widt - { - if (DGifGetRecordType(infile, &record_type) == GIF_ERROR) - { -- PrintGifError(); -+#if GIFLIB_MAJOR >= 5 -+ localPrintGifError(infile->Error); -+#else -+ localPrintGifError(); -+#endif - return(0); - } - -@@ -63,7 +379,11 @@ read_gif(const char *filename, int *widt - case IMAGE_DESC_RECORD_TYPE: - if (DGifGetImageDesc(infile) == GIF_ERROR) - { -- PrintGifError(); -+#if GIFLIB_MAJOR >= 5 -+ localPrintGifError(infile->Error); -+#else -+ localPrintGifError(); -+#endif - return(0); - } - -@@ -107,14 +427,22 @@ read_gif(const char *filename, int *widt - GifByteType *ext; - if (DGifGetExtension(infile, &ext_code, &ext) == GIF_ERROR) - { -- PrintGifError(); -+#if GIFLIB_MAJOR >= 5 -+ localPrintGifError(infile->Error); -+#else -+ localPrintGifError(); -+#endif - return(0); - } - while (ext != NULL) - { - if (DGifGetExtensionNext(infile, &ext) == GIF_ERROR) - { -- PrintGifError(); -+#if GIFLIB_MAJOR >= 5 -+ localPrintGifError(infile->Error); -+#else -+ localPrintGifError(); -+#endif - return(0); - } - } -@@ -154,7 +482,11 @@ read_gif(const char *filename, int *widt - free(buffer); +- if (DGifCloseFile(GifFile) == GIF_ERROR) { ++ if (DGifCloseFile(GifFile, NULL) == GIF_ERROR) { + return(0); + } -+#if GIFLIB_MAJOR == 5 && GIFLIB_MINOR >= 1 || GIFLIB_MAJOR > 5 -+ DGifCloseFile(infile, NULL); -+#else - DGifCloseFile(infile); -+#endif - return(1); +@@ -493,7 +493,7 @@ + static void QuitGifError(GifFileType *GifFile) + { + fprintf(stderr, "Error writing GIF file\n"); +- if (GifFile != NULL) EGifCloseFile(GifFile); ++ if (GifFile != NULL) EGifCloseFile(GifFile, NULL); } -@@ -178,7 +510,11 @@ write_gif(const char *filename, int widt - return(0); + int +@@ -589,7 +589,7 @@ + Ptr += width; } -+#if GIFLIB_MAJOR >= 5 -+ colormap = GifMakeMapObject(colormap_size, NULL); -+#else - colormap = MakeMapObject(colormap_size, NULL); -+#endif +- if (EGifCloseFile(GifFile) == GIF_ERROR) ++ if (EGifCloseFile(GifFile, NULL) == GIF_ERROR) - for (i = 0; i < width * height; i++) { -@@ -190,7 +526,7 @@ write_gif(const char *filename, int widt - if (QuantizeBuffer(width, height, &colormap_size, red, green, blue, - buffer, colormap->Colors) == GIF_ERROR) - { -- PrintGifError(); -+ fprintf(stderr, "Can't quantize buffer\n"); - return(0); - } - -@@ -198,24 +534,36 @@ write_gif(const char *filename, int widt - free(green); - free(blue); - -- outfile = EGifOpenFileName((char *) filename, FALSE); -+#if GIFLIB_MAJOR >= 5 -+ outfile = EGifOpenFileName((char *) filename, false, NULL); -+#else -+ outfile = EGifOpenFileName((char *) filename, false); -+#endif - if (outfile == NULL) - { -- PrintGifError(); -+ fprintf(stderr, "Can't open GIF file %s\n", filename); - return(0); - } - - if (EGifPutScreenDesc(outfile, width, height, colormap_size, 0, colormap) - == GIF_ERROR) - { -- PrintGifError(); -+#if GIFLIB_MAJOR >= 5 -+ localPrintGifError(outfile->Error); -+#else -+ localPrintGifError(); -+#endif - return(0); - } - -- if (EGifPutImageDesc(outfile, 0, 0, width, height, FALSE, NULL) -+ if (EGifPutImageDesc(outfile, 0, 0, width, height, false, NULL) - == GIF_ERROR) - { -- PrintGifError(); -+#if GIFLIB_MAJOR >= 5 -+ localPrintGifError(outfile->Error); -+#else -+ localPrintGifError(); -+#endif - return(0); - } - -@@ -224,7 +572,11 @@ write_gif(const char *filename, int widt - { - if (EGifPutLine(outfile, ptr, width) == GIF_ERROR) - { -- PrintGifError(); -+#if GIFLIB_MAJOR >= 5 -+ localPrintGifError(outfile->Error); -+#else -+ localPrintGifError(); -+#endif - return(0); - } - ptr += width; -@@ -232,8 +584,12 @@ write_gif(const char *filename, int widt - - EGifSpew(outfile); - -+#if GIFLIB_MAJOR == 5 && GIFLIB_MINOR >= 1 || GIFLIB_MAJOR > 5 -+ if (EGifCloseFile(outfile, NULL) == GIF_ERROR) -+#else - if (EGifCloseFile(outfile) == GIF_ERROR) -- PrintGifError(); -+#endif -+ fprintf(stderr, "Can't close GIF file %s\n", filename); - - free(buffer); - + QuitGifError(GifFile);