From 98e8c41c7c9ad05c6e500b286e298a69a0c360cf Mon Sep 17 00:00:00 2001 From: ellson Date: Thu, 26 Jul 2007 18:21:54 +0000 Subject: [PATCH] upgrade mylibgd tree to gd-2.0.35 use system gd-2.0.34 or later on fc7 or later distros --- lib/gd/gd_topal.c | 11 ++++++----- lib/gd/gdcache.c | 14 +++++++++++++- lib/gd/gdcmpgif.c | 2 ++ lib/gd/gdfontg.c | 3 --- lib/gd/gdfontl.c | 3 --- lib/gd/gdfontmb.c | 3 --- lib/gd/gdfonts.c | 3 --- lib/gd/gdfontt.c | 3 --- 8 files changed, 21 insertions(+), 21 deletions(-) diff --git a/lib/gd/gd_topal.c b/lib/gd/gd_topal.c index 16c0e33b3..375889602 100644 --- a/lib/gd/gd_topal.c +++ b/lib/gd/gd_topal.c @@ -49,10 +49,6 @@ #define ORIGINAL_LIB_JPEG_REVERSE_ODD_ROWS */ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - #include #include "gd.h" #include "gdhelpers.h" @@ -776,6 +772,7 @@ LOCAL (void) nim->green[icolor] = 255; nim->blue[icolor] = 255; } + nim->open[icolor] = 0; #endif } @@ -803,6 +800,9 @@ select_colors (gdImagePtr oim, gdImagePtr nim, my_cquantize_ptr cquantize, int d return; } boxlist = (boxptr) gdMalloc (desired_colors * sizeof (box)); + if (!boxlist) { + return; + } #endif /* Initialize one box containing whole space */ numboxes = 1; @@ -1935,11 +1935,12 @@ static void gdImageTrueColorToPaletteBody (gdImagePtr oim, int dither, int color init_error_limit (oim, nim, cquantize); arraysize = (size_t) ((nim->sx + 2) * (3 * sizeof (FSERROR))); /* Allocate Floyd-Steinberg workspace. */ - cquantize->fserrors = gdCalloc (arraysize, 1); + cquantize->fserrors = gdRealloc(cquantize->fserrors, arraysize); if (!cquantize->fserrors) { goto outOfMemory; } + memset(cquantize->fserrors, 0, arraysize); cquantize->on_odd_row = FALSE; /* Do the work! */ diff --git a/lib/gd/gdcache.c b/lib/gd/gdcache.c index b5b891341..f02f8c343 100644 --- a/lib/gd/gdcache.c +++ b/lib/gd/gdcache.c @@ -9,7 +9,7 @@ #ifdef HAVE_LIBTTF #define NEED_CACHE 1 #else -#ifdef HAVE_LIBFREETYPE +#ifdef HAVE_FREETYPE2 #define NEED_CACHE 1 #endif #endif @@ -71,6 +71,10 @@ gdCacheCreate (int size, gdCache_head_t *head; head = (gdCache_head_t *) gdMalloc (sizeof (gdCache_head_t)); + if (!head) { + return NULL; + } + head->mru = NULL; head->size = size; head->gdCacheTest = gdCacheTest; @@ -130,6 +134,11 @@ gdCacheGet (gdCache_head_t * head, void *keydata) if (i < head->size) { /* cache still growing - add new elem */ elem = (gdCache_element_t *) gdMalloc (sizeof (gdCache_element_t)); + if (!elem) + { + (*(head->gdCacheRelease)) (userdata); + return NULL; + } } else { /* cache full - replace least-recently-used */ @@ -195,6 +204,9 @@ main (char *argv[], int argc) int elem, key; cacheTable = gdCacheCreate (3, cacheTest, cacheFetch, cacheRelease); + if (!cacheTable) { + exit(1); + } key = 20; elem = *(int *) gdCacheGet (cacheTable, &key); diff --git a/lib/gd/gdcmpgif.c b/lib/gd/gdcmpgif.c index b82eb22d9..dd2de69bf 100644 --- a/lib/gd/gdcmpgif.c +++ b/lib/gd/gdcmpgif.c @@ -4,7 +4,9 @@ #include #include +#ifndef WIN32 #include /* For unlink function */ +#endif #include "gd.h" diff --git a/lib/gd/gdfontg.c b/lib/gd/gdfontg.c index 229215e76..f345c5f8c 100644 --- a/lib/gd/gdfontg.c +++ b/lib/gd/gdfontg.c @@ -10,9 +10,6 @@ "Libor Skarvada, libor@informatics.muni.cz" */ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif #include "gdfontg.h" diff --git a/lib/gd/gdfontl.c b/lib/gd/gdfontl.c index 54adffa88..5de3ae8a6 100644 --- a/lib/gd/gdfontl.c +++ b/lib/gd/gdfontl.c @@ -11,9 +11,6 @@ "Libor Skarvada, libor@informatics.muni.cz" */ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif #include "gdfontl.h" diff --git a/lib/gd/gdfontmb.c b/lib/gd/gdfontmb.c index b0ed6a363..33a1fd449 100644 --- a/lib/gd/gdfontmb.c +++ b/lib/gd/gdfontmb.c @@ -9,9 +9,6 @@ No copyright info was found in the original bdf. */ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif #include "gdfontmb.h" diff --git a/lib/gd/gdfonts.c b/lib/gd/gdfonts.c index e5d3f7ea9..5e1a0896c 100644 --- a/lib/gd/gdfonts.c +++ b/lib/gd/gdfonts.c @@ -7,9 +7,6 @@ No copyright info was found in the original bdf. */ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif #include "gdfonts.h" diff --git a/lib/gd/gdfontt.c b/lib/gd/gdfontt.c index d7abcf627..11bd3a35a 100644 --- a/lib/gd/gdfontt.c +++ b/lib/gd/gdfontt.c @@ -10,9 +10,6 @@ "Libor Skarvada, libor@informatics.muni.cz" */ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif #include "gdfontt.h" -- 2.40.0