1 diff -rub gd-2.0.33/entities.h gd-2.0.33jce3/entities.h
2 --- gd-2.0.33/entities.h 2004-10-27 10:22:46.000000000 -0400
3 +++ gd-2.0.33jce3/entities.h 2005-08-15 11:23:47.000000000 -0400
9 +static struct entities_s {
13 diff -rub gd-2.0.33/entities.tcl gd-2.0.33jce3/entities.tcl
14 --- gd-2.0.33/entities.tcl 2004-10-27 10:22:48.000000000 -0400
15 +++ gd-2.0.33jce3/entities.tcl 2005-08-15 10:19:33.000000000 -0400
17 puts $f "extern \"C\" {"
20 -puts $f "struct entities_s {"
21 +puts $f "static struct entities_s {"
22 puts $f " char *name;"
24 puts $f "} entities\[\] = {"
25 diff -rub gd-2.0.33/gd.c gd-2.0.33jce3/gd.c
26 --- gd-2.0.33/gd.c 2004-11-01 13:28:56.000000000 -0500
27 +++ gd-2.0.33jce3/gd.c 2005-08-15 11:23:47.000000000 -0400
31 im = (gdImage *) gdMalloc (sizeof (gdImage));
34 memset (im, 0, sizeof (gdImage));
35 /* Row-major ever since gd 1.3 */
36 im->pixels = (unsigned char **) gdMalloc (sizeof (unsigned char *) * sy);
43 im->polyAllocated = 0;
47 /* Row-major ever since gd 1.3 */
48 im->pixels[i] = (unsigned char *) gdCalloc (sx, sizeof (unsigned char));
51 + for (--i ; i >= 0; i--)
53 + gdFree(im->pixels[i]);
61 diff -rub gd-2.0.33/gd_gif_in.c gd-2.0.33jce3/gd_gif_in.c
62 --- gd-2.0.33/gd_gif_in.c 2004-11-01 13:28:56.000000000 -0500
63 +++ gd-2.0.33jce3/gd_gif_in.c 2005-08-15 11:23:47.000000000 -0400
72 diff -rub gd-2.0.33/gd_gif_out.c gd-2.0.33jce3/gd_gif_out.c
73 --- gd-2.0.33/gd_gif_out.c 2004-11-02 08:41:00.000000000 -0500
74 +++ gd-2.0.33jce3/gd_gif_out.c 2005-08-15 11:23:47.000000000 -0400
83 diff -rub gd-2.0.33/gd_topal.c gd-2.0.33jce3/gd_topal.c
84 --- gd-2.0.33/gd_topal.c 2004-10-28 14:12:08.000000000 -0400
85 +++ gd-2.0.33jce3/gd_topal.c 2005-08-15 11:23:47.000000000 -0400
87 #define ORIGINAL_LIB_JPEG_REVERSE_ODD_ROWS
96 #include "gdhelpers.h"
97 diff -rub gd-2.0.33/gdfontg.c gd-2.0.33jce3/gdfontg.c
98 --- gd-2.0.33/gdfontg.c 2004-10-27 10:22:04.000000000 -0400
99 +++ gd-2.0.33jce3/gdfontg.c 2005-08-15 11:23:47.000000000 -0400
101 "Libor Skarvada, libor@informatics.muni.cz"
104 +#ifdef HAVE_CONFIG_H
110 diff -rub gd-2.0.33/gdfontl.c gd-2.0.33jce3/gdfontl.c
111 --- gd-2.0.33/gdfontl.c 2004-10-27 10:22:04.000000000 -0400
112 +++ gd-2.0.33jce3/gdfontl.c 2005-08-15 11:23:47.000000000 -0400
114 "Libor Skarvada, libor@informatics.muni.cz"
117 +#ifdef HAVE_CONFIG_H
123 diff -rub gd-2.0.33/gdfontmb.c gd-2.0.33jce3/gdfontmb.c
124 --- gd-2.0.33/gdfontmb.c 2004-10-27 10:22:04.000000000 -0400
125 +++ gd-2.0.33jce3/gdfontmb.c 2005-08-15 11:23:47.000000000 -0400
127 No copyright info was found in the original bdf.
130 +#ifdef HAVE_CONFIG_H
134 #include "gdfontmb.h"
136 diff -rub gd-2.0.33/gdfonts.c gd-2.0.33jce3/gdfonts.c
137 --- gd-2.0.33/gdfonts.c 2004-10-27 10:22:04.000000000 -0400
138 +++ gd-2.0.33jce3/gdfonts.c 2005-08-15 11:23:47.000000000 -0400
140 No copyright info was found in the original bdf.
143 +#ifdef HAVE_CONFIG_H
149 diff -rub gd-2.0.33/gdfontt.c gd-2.0.33jce3/gdfontt.c
150 --- gd-2.0.33/gdfontt.c 2004-10-27 10:22:04.000000000 -0400
151 +++ gd-2.0.33jce3/gdfontt.c 2005-08-15 11:23:47.000000000 -0400
153 "Libor Skarvada, libor@informatics.muni.cz"
156 +#ifdef HAVE_CONFIG_H
162 diff -rub gd-2.0.33/gdft.c gd-2.0.33jce3/gdft.c
163 --- gd-2.0.33/gdft.c 2004-11-02 16:00:48.000000000 -0500
164 +++ gd-2.0.33jce3/gdft.c 2005-08-15 11:23:47.000000000 -0400
167 FT_Vector penf, oldpenf, delta, total_min = {0,0}, total_max = {0,0}, glyph_min, glyph_max;
169 - FT_CharMap charmap;
170 + FT_CharMap charmap = NULL;
180 render_mode |= FT_LOAD_MONOCHROME;
183 /* find requested charmap */
185 @@ -1208,12 +1210,14 @@
186 so we don't have to recheck for the terminating number */
189 - strex->xshow = malloc(xshow_alloc);
190 + strex->xshow = gdMalloc(xshow_alloc);
193 else if (xshow_pos + 20 > xshow_alloc) {
195 strex->xshow = realloc(strex->xshow, xshow_alloc);
196 + if (! strex->xshow)
197 + return "Problem allocating memory with realloc";
199 xshow_pos += sprintf(strex->xshow + xshow_pos, "%g ",
200 (double)(penf.x - oldpenf.x) * hdpi / (64 * METRIC_RES));
201 @@ -1322,10 +1326,8 @@
204 { /* only if need brect */
207 - dpix = 64 * METRIC_RES / hdpi;
208 - dpiy = 64 * METRIC_RES / vdpi;
209 + double scalex = (double)hdpi / (64 * METRIC_RES);
210 + double scaley = (double)vdpi / (64 * METRIC_RES);
212 /* increase by 1 pixel to allow for rounding */
213 total_min.x -= METRIC_RES;
214 @@ -1334,14 +1336,14 @@
215 total_max.y += METRIC_RES;
217 /* rotate bounding rectangle, scale and round to int pixels, and translate */
218 - brect[0] = x + (total_min.x * cos_a + total_max.y * sin_a)/dpix;
219 - brect[1] = y - (total_min.x * sin_a - total_max.y * cos_a)/dpiy;
220 - brect[2] = x + (total_max.x * cos_a + total_max.y * sin_a)/dpix;
221 - brect[3] = y - (total_max.x * sin_a - total_max.y * cos_a)/dpiy;
222 - brect[4] = x + (total_max.x * cos_a + total_min.y * sin_a)/dpix;
223 - brect[5] = y - (total_max.x * sin_a - total_min.y * cos_a)/dpiy;
224 - brect[6] = x + (total_min.x * cos_a + total_min.y * sin_a)/dpix;
225 - brect[7] = y - (total_min.x * sin_a - total_min.y * cos_a)/dpiy;
226 + brect[0] = x + (total_min.x * cos_a + total_max.y * sin_a)*scalex;
227 + brect[1] = y - (total_min.x * sin_a - total_max.y * cos_a)*scaley;
228 + brect[2] = x + (total_max.x * cos_a + total_max.y * sin_a)*scalex;
229 + brect[3] = y - (total_max.x * sin_a - total_max.y * cos_a)*scaley;
230 + brect[4] = x + (total_max.x * cos_a + total_min.y * sin_a)*scalex;
231 + brect[5] = y - (total_max.x * sin_a - total_min.y * cos_a)*scaley;
232 + brect[6] = x + (total_min.x * cos_a + total_min.y * sin_a)*scalex;
233 + brect[7] = y - (total_min.x * sin_a - total_min.y * cos_a)*scaley;
236 FT_Done_Size (platform_independent);
237 @@ -1510,6 +1512,66 @@
239 #endif /* HAVE_LIBFONTCONFIG */
242 +#define FONTSFX "\\FONTS"
243 +#define GDP "GDFONTPATH="
244 +#define F_OK 0 /* Needed in Windows */
247 + * See if environment variable envv is defined and
248 + * if the path $envv/FONTS exists. If so, return the path,
249 + * else return NULL.
252 +chkWinFontPath (char* envv)
256 + root = getenv(envv);
257 + if (!root) return NULL;
258 + path = (char*)gdMalloc(strlen(root)+strlen(FONTSFX)+1);
259 + strcpy (path, root);
260 + strcat (path, FONTSFX);
261 + if (access (path, F_OK) == 0) { /* success */
271 + * Find Windows system font directory. Use environment variables to
272 + * find system directory with a FONTS subdirectory.
273 + * If successful, set GDFONTPATH to this value, for caching, and return it.
274 + * Else, return NULL
279 + char* path = chkWinFontPath("SystemRoot");
281 + path = chkWinFontPath ("WinDir");
286 + setenv("GDFONTPATH", path, 1);
289 + char* ebuf = (char*)gdMalloc(strlen(GDP)+strlen(path)+1);
301 /* Look up font using font names as file names. */
302 static char * font_path(char **fontpath, char *name_list)
304 @@ -1524,6 +1586,10 @@
307 fontsearchpath = getenv ("GDFONTPATH");
309 + if (!fontsearchpath)
310 + fontsearchpath = getWinFontPath ();
313 fontsearchpath = DEFAULT_FONTPATH;
314 fontlist = strdup (name_list);
315 diff -rub gd-2.0.33/gdfx.c gd-2.0.33jce3/gdfx.c
316 --- gd-2.0.33/gdfx.c 2004-10-27 10:22:07.000000000 -0400
317 +++ gd-2.0.33jce3/gdfx.c 2005-08-15 11:23:47.000000000 -0400
319 +#ifdef HAVE_CONFIG_H
326 diff -rub gd-2.0.33/gdhelpers.h gd-2.0.33jce3/gdhelpers.h
327 --- gd-2.0.33/gdhelpers.h 2004-10-28 13:09:12.000000000 -0400
328 +++ gd-2.0.33jce3/gdhelpers.h 2005-08-15 11:23:47.000000000 -0400
331 /* 2.0.16: portable mutex support for thread safety. */
334 -/* 2.0.18: must include windows.h to get CRITICAL_SECTION. */
335 -#include <windows.h>
336 -#define gdMutexDeclare(x) CRITICAL_SECTION x
337 -#define gdMutexSetup(x) InitializeCriticalSection(&x)
338 -#define gdMutexShutdown(x) DeleteCriticalSection(&x)
339 -#define gdMutexLock(x) EnterCriticalSection(&x)
340 -#define gdMutexUnlock(x) LeaveCriticalSection(&x)
343 -#include <pthread.h>
344 -#define gdMutexDeclare(x) pthread_mutex_t x
345 -#define gdMutexSetup(x) pthread_mutex_init(&x, 0)
346 -#define gdMutexShutdown(x) pthread_mutex_destroy(&x)
347 -#define gdMutexLock(x) pthread_mutex_lock(&x)
348 -#define gdMutexUnlock(x) pthread_mutex_unlock(&x)
349 +#ifdef DISABLE_THREADS
350 +# define gdMutexDeclare(x)
351 +# define gdMutexSetup(x)
352 +# define gdMutexShutdown(x)
353 +# define gdMutexLock(x)
354 +# define gdMutexUnlock(x)
356 -#define gdMutexDeclare(x)
357 -#define gdMutexSetup(x)
358 -#define gdMutexShutdown(x)
359 -#define gdMutexLock(x)
360 -#define gdMutexUnlock(x)
361 -#endif /* HAVE_PTHREAD */
364 +/* 2.0.18: must include windows.h to get CRITICAL_SECTION. */
365 +# include <windows.h>
366 +# define gdMutexDeclare(x) CRITICAL_SECTION x
367 +# define gdMutexSetup(x) InitializeCriticalSection(&x)
368 +# define gdMutexShutdown(x) DeleteCriticalSection(&x)
369 +# define gdMutexLock(x) EnterCriticalSection(&x)
370 +# define gdMutexUnlock(x) LeaveCriticalSection(&x)
372 +# ifdef HAVE_PTHREAD
373 +# include <pthread.h>
374 +# define gdMutexDeclare(x) pthread_mutex_t x
375 +# define gdMutexSetup(x) pthread_mutex_init(&x, 0)
376 +# define gdMutexShutdown(x) pthread_mutex_destroy(&x)
377 +# define gdMutexLock(x) pthread_mutex_lock(&x)
378 +# define gdMutexUnlock(x) pthread_mutex_unlock(&x)
380 +# define gdMutexDeclare(x)
381 +# define gdMutexSetup(x)
382 +# define gdMutexShutdown(x)
383 +# define gdMutexLock(x)
384 +# define gdMutexUnlock(x)
385 +# endif /* HAVE_PTHREAD */
387 +#endif /* DISABLE_THREADS */
389 #endif /* GDHELPERS_H */