cvs: php4 /ext/gd/libgd gd.c gd_gd.c gd_gd2.c gd_jpeg.c gd_png.c gd_topal.c gd_wbmp.c gdft.c gdhelpers.c wbmp.c
| From: | Marcus B�rger | Date: | Sun, 11 Aug 2002 13:50:27 +0000 |
| Subject: | cvs: php4 /ext/gd/libgd gd.c gd_gd.c gd_gd2.c gd_jpeg.c gd_png.c gd_topal.c gd_wbmp.c gdft.c gdhelpers.c wbmp.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-13260@lists.php.net to get a copy of this message | ||
helly Sun Aug 11 09:50:27 2002 EDT
Modified files:
/php4/ext/gd/libgd gd.c gd_gd.c gd_gd2.c gd_jpeg.c gd_png.c
gd_topal.c gd_wbmp.c gdft.c gdhelpers.c wbmp.c
Log:
try to fix those warnings.....
#this code must come from hell: will we change code to our coding-scheme?
Index: php4/ext/gd/libgd/gd.c diff -u php4/ext/gd/libgd/gd.c:1.6 php4/ext/gd/libgd/gd.c:1.7 --- php4/ext/gd/libgd/gd.c:1.6 Thu Jun 6 08:58:25 2002 +++ php4/ext/gd/libgd/gd.c Sun Aug 11 09:50:27 2002 @@ -206,7 +206,7 @@ #define RETURN_HWB(h, w, b) {HWB->H = h; HWB->W = w; HWB->B = b; return HWB;} #define RETURN_RGB(r, g, b) {RGB->R = r; RGB->G = g; RGB->B = b; return RGB;} #define HWB_UNDEFINED -1 -#define SETUP_RGB(s, r, g, b) {s.R = r/255.0; s.G = g/255.0; s.B = b/255.0;} +#define SETUP_RGB(s, r, g, b) {s.R = r/255.0f; s.G = g/255.0f; s.B = b/255.0f;} #define MIN(a,b) ((a)<(b)?(a):(b)) #define MIN3(a,b,c) ((a)<(b)?(MIN(a,c)):(MIN(b,c))) @@ -290,6 +290,7 @@ } +#if 0 /* * This is not actually used, but is here for completeness, in case someone wants to * use the HWB stuff for anything else... @@ -332,8 +333,8 @@ } return RGB; - } +#endif /* 0 */ int gdImageColorClosestHWB (gdImagePtr im, int r, int g, int b) @@ -657,6 +658,22 @@ } } +static int +gdImageGetTrueColorPixel (gdImagePtr im, int x, int y) +{ + int p = gdImageGetPixel (im, x, y); + if (!im->trueColor) + { + return gdTrueColorAlpha (im->red[p], im->green[p], im->blue[p], + (im->transparent == p) ? gdAlphaTransparent : + gdAlphaOpaque); + } + else + { + return p; + } +} + static void gdImageBrushApply (gdImagePtr im, int x, int y) { @@ -793,22 +810,6 @@ } } -int -gdImageGetTrueColorPixel (gdImagePtr im, int x, int y) -{ - int p = gdImageGetPixel (im, x, y); - if (!im->trueColor) - { - return gdTrueColorAlpha (im->red[p], im->green[p], im->blue[p], - (im->transparent == p) ? gdAlphaTransparent : - gdAlphaOpaque); - } - else - { - return p; - } -} - /* Bresenham as presented in Foley & Van Dam */ void gdImageLine (gdImagePtr im, int x1, int y1, int x2, int y2, int color) @@ -968,7 +969,7 @@ int dashStep = 0; int on = 1; int wid; - int w, wstart, vert; + int vert; int thick = im->thick; dx = abs (x2 - x1); @@ -1905,7 +1906,6 @@ } if (dst->trueColor) { - int d; mapTo = gdImageGetTrueColorPixel (src, x, y); /* Added 7/24/95: support transparent copies */ if (gdImageGetTransparent (src) == mapTo) @@ -1985,7 +1985,6 @@ int srcW, int srcH) { int x, y; - float sx, sy; if (!dst->trueColor) { gdImageCopyResized ( @@ -1997,11 +1996,11 @@ { for (x = dstX; (x < dstX + dstW); x++) { - int pd = gdImageGetPixel (dst, x, y); + /*int pd = gdImageGetPixel (dst, x, y);*/ float sy1, sy2, sx1, sx2; float sx, sy; float spixels = 0; - float red = 0.0, green = 0.0, blue = 0.0, alpha = 0.0; + float red = 0.0f, green = 0.0f, blue = 0.0f, alpha = 0.0f; sy1 = ((float) y - (float) dstY) * (float) srcH / (float) dstH; sy2 = ((float) (y + 1) - (float) dstY) * (float) srcH / @@ -2012,7 +2011,7 @@ float yportion; if (floor (sy) == floor (sy1)) { - yportion = 1.0 - (sy - floor (sy)); + yportion = 1.0f - (sy - floor (sy)); if (yportion > sy2 - sy1) { yportion = sy2 - sy1; Index: php4/ext/gd/libgd/gd_gd.c diff -u php4/ext/gd/libgd/gd_gd.c:1.1 php4/ext/gd/libgd/gd_gd.c:1.2 --- php4/ext/gd/libgd/gd_gd.c:1.1 Fri Apr 12 22:03:08 2002 +++ php4/ext/gd/libgd/gd_gd.c Sun Aug 11 09:50:27 2002 @@ -195,7 +195,6 @@ _gdPutColors (gdImagePtr im, gdIOCtx * out) { int i; - int trans; gdPutC (im->trueColor, out); if (!im->trueColor) Index: php4/ext/gd/libgd/gd_gd2.c diff -u php4/ext/gd/libgd/gd_gd2.c:1.1 php4/ext/gd/libgd/gd_gd2.c:1.2 --- php4/ext/gd/libgd/gd_gd2.c:1.1 Fri Apr 12 22:03:08 2002 +++ php4/ext/gd/libgd/gd_gd2.c Sun Aug 11 09:50:27 2002 @@ -262,7 +262,7 @@ int i; int ncx, ncy, nc, cs, cx, cy; int x, y, ylo, yhi, xlo, xhi; - int ch, vers, fmt; + int vers, fmt; t_chunk_info *chunkIdx = NULL; /* So we can gdFree it with impunity. */ unsigned char *chunkBuf = NULL; /* So we can gdFree it with impunity. */ int chunkNum = 0; @@ -635,10 +635,10 @@ { if (im->trueColor) { - ch = chunkBuf[chunkPos++] << 24 + - chunkBuf[chunkPos++] << 16 + - chunkBuf[chunkPos++] << 8 + - chunkBuf[chunkPos++]; + ch = (chunkBuf[chunkPos++] << 24) + + (chunkBuf[chunkPos++] << 16) + + (chunkBuf[chunkPos++] << 8) + + (chunkBuf[chunkPos++]); } else { @@ -762,7 +762,7 @@ /* The zlib notes say output buffer size should be (input size) * 1.01 * 12 */ /* - we'll use 1.02 to be paranoid. */ /* */ - compMax = cs * bytesPerPixel * cs * 1.02 + 12; + compMax = (int)(cs * bytesPerPixel * cs * 1.02f + 12); /* */ /* Allocate the buffers. */ Index: php4/ext/gd/libgd/gd_jpeg.c diff -u php4/ext/gd/libgd/gd_jpeg.c:1.1 php4/ext/gd/libgd/gd_jpeg.c:1.2 --- php4/ext/gd/libgd/gd_jpeg.c:1.1 Fri Apr 12 22:03:08 2002 +++ php4/ext/gd/libgd/gd_jpeg.c Sun Aug 11 09:50:27 2002 @@ -249,7 +249,7 @@ } } jpeg_finish_compress (&cinfo); -error: +/*error:*/ jpeg_destroy_compress (&cinfo); gdFree (row); } @@ -282,8 +282,9 @@ volatile JSAMPROW row = 0; volatile gdImagePtr im = 0; JSAMPROW rowptr[1]; - int i, j, retval; + JDIMENSION i, j; JDIMENSION nrows; + int retval; #ifdef JPEG_DEBUG printf ("gd-jpeg: gd JPEG version %s\n", GD_JPEG_VERSION); @@ -496,7 +497,7 @@ gdIOCtx *infile; /* source stream */ unsigned char *buffer; /* start of buffer */ safeboolean start_of_file; /* have we gotten any data yet? */ - + } my_source_mgr; @@ -554,46 +555,46 @@ * Data beyond this point must be rescanned after resumption, so move it to * the front of the buffer rather than discarding it. */ - -#define END_JPEG_SEQUENCE "\r\n[*]--:END JPEG:--[*]\r\n" + +#define END_JPEG_SEQUENCE "\r\n[*]--:END JPEG:--[*]\r\n" safeboolean fill_input_buffer (j_decompress_ptr cinfo) { my_src_ptr src = (my_src_ptr) cinfo->src; size_t nbytes = 0; - + /* size_t got; */ /* char *s; */ memset (src->buffer, 0, INPUT_BUF_SIZE); - + while (nbytes < INPUT_BUF_SIZE) { - - int got = gdGetBuf (src->buffer + nbytes, + + int got = gdGetBuf (src->buffer + nbytes, INPUT_BUF_SIZE - nbytes, src->infile); - + if ((got == EOF) || (got == 0)) { - - /* EOF or error. If we got any data, don't worry about it. - If we didn't, then this is unexpected. */ + + /* EOF or error. If we got any data, don't worry about it. + If we didn't, then this is unexpected. */ if (!nbytes) { - + nbytes = -1; - + } - + break; - + } - + nbytes += got; - + } - + if (nbytes <= 0) { if (src->start_of_file) /* Treat empty input file as fatal error */ @@ -670,11 +671,11 @@ void term_source (j_decompress_ptr cinfo) { - + #if 0 /* never used */ my_src_ptr src = (my_src_ptr) cinfo->src; - + #endif } @@ -707,7 +708,7 @@ src->buffer = (unsigned char *) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT, INPUT_BUF_SIZE * sizeof (unsigned char)); - + } src = (my_src_ptr) cinfo->src; Index: php4/ext/gd/libgd/gd_png.c diff -u php4/ext/gd/libgd/gd_png.c:1.2 php4/ext/gd/libgd/gd_png.c:1.3 --- php4/ext/gd/libgd/gd_png.c:1.2 Sun Apr 21 09:48:22 2002 +++ php4/ext/gd/libgd/gd_png.c Sun Aug 11 09:50:27 2002 @@ -126,6 +126,7 @@ png_bytepp row_pointers = NULL; gdImagePtr im = NULL; int i, j, *open; + png_uint_32 ui, uj; volatile int transparent = -1; volatile int palette_allocated = FALSE; @@ -318,9 +319,9 @@ } /* set the individual row_pointers to point at the correct offsets */ - for (j = 0; j < height; ++j) + for (uj = 0; uj < height; ++uj) { - row_pointers[j] = image_data + j * rowbytes; + row_pointers[uj] = image_data + uj * rowbytes; } png_read_image (png_ptr, row_pointers); /* read whole image... */ @@ -351,44 +352,44 @@ switch (color_type) { case PNG_COLOR_TYPE_RGB: - for (j = 0; j < height; j++) + for (uj = 0; uj < height; uj++) { int boffset = 0; - for (i = 0; i < width; i++) + for (ui = 0; ui < width; ui++) { - register png_byte r = row_pointers[j][boffset++]; - register png_byte g = row_pointers[j][boffset++]; - register png_byte b = row_pointers[j][boffset++]; - im->tpixels[j][i] = gdTrueColor (r, g, b); + register png_byte r = row_pointers[uj][boffset++]; + register png_byte g = row_pointers[uj][boffset++]; + register png_byte b = row_pointers[uj][boffset++]; + im->tpixels[uj][ui] = gdTrueColor (r, g, b); } } break; case PNG_COLOR_TYPE_RGB_ALPHA: - for (j = 0; j < height; j++) + for (uj = 0; uj < height; uj++) { int boffset = 0; - for (i = 0; i < width; i++) + for (ui = 0; ui < width; ui++) { - register png_byte r = row_pointers[j][boffset++]; - register png_byte g = row_pointers[j][boffset++]; - register png_byte b = row_pointers[j][boffset++]; + register png_byte r = row_pointers[uj][boffset++]; + register png_byte g = row_pointers[uj][boffset++]; + register png_byte b = row_pointers[uj][boffset++]; /* gd has only 7 bits of alpha channel resolution, and 127 is transparent, 0 opaque. A moment of convenience, a lifetime of compatibility. */ register png_byte a = gdAlphaMax - - (row_pointers[j][boffset++] >> 1); - im->tpixels[j][i] = gdTrueColorAlpha (r, g, b, a); + (row_pointers[uj][boffset++] >> 1); + im->tpixels[uj][ui] = gdTrueColorAlpha (r, g, b, a); } } break; default: /* Palette image, or something coerced to be one */ - for (j = 0; j < height; ++j) + for (uj = 0; uj < height; ++uj) { - for (i = 0; i < width; ++i) + for (ui = 0; ui < width; ++ui) { - register png_byte idx = row_pointers[j][i]; - im->pixels[j][i] = idx; + register png_byte idx = row_pointers[uj][ui]; + im->pixels[uj][ui] = idx; open[idx] = 0; } } @@ -579,7 +580,6 @@ int i; int j; int k; - int highTrans = -1; for (i = 0; (i < im->colorsTotal); i++) { if ((!im->open[i]) && Index: php4/ext/gd/libgd/gd_topal.c diff -u php4/ext/gd/libgd/gd_topal.c:1.1 php4/ext/gd/libgd/gd_topal.c:1.2 --- php4/ext/gd/libgd/gd_topal.c:1.1 Fri Apr 12 22:03:08 2002 +++ php4/ext/gd/libgd/gd_topal.c Sun Aug 11 09:50:27 2002 @@ -28,6 +28,7 @@ #include "gd.h" #include "gdhelpers.h" +#include <string.h> /* * This module implements the well-known Heckbert paradigm for color Index: php4/ext/gd/libgd/gd_wbmp.c diff -u php4/ext/gd/libgd/gd_wbmp.c:1.1 php4/ext/gd/libgd/gd_wbmp.c:1.2 --- php4/ext/gd/libgd/gd_wbmp.c:1.1 Fri Apr 12 22:03:08 2002 +++ php4/ext/gd/libgd/gd_wbmp.c Sun Aug 11 09:50:27 2002 @@ -70,7 +70,7 @@ void gd_putout (int i, void *out) { - gdPutC (i, (gdIOCtx *) out); + gdPutC ((unsigned char)i, (gdIOCtx *) out); } Index: php4/ext/gd/libgd/gdft.c diff -u php4/ext/gd/libgd/gdft.c:1.5 php4/ext/gd/libgd/gdft.c:1.6 --- php4/ext/gd/libgd/gdft.c:1.5 Thu Aug 8 17:26:49 2002 +++ php4/ext/gd/libgd/gdft.c Sun Aug 11 09:50:27 2002 @@ -14,6 +14,7 @@ #ifndef MSWIN32 #include <unistd.h> +extern int access(const char *pathname, int mode); #else #define R_OK 2 #endif @@ -25,7 +26,7 @@ gdImageStringTTF (gdImage * im, int *brect, int fg, char *fontlist, double ptsize, double angle, int x, int y, char *string) { - gdImageStringFT (im, brect, fg, fontlist, ptsize, + return gdImageStringFT (im, brect, fg, fontlist, ptsize, angle, x, y, string); } @@ -331,7 +332,7 @@ int n; int font_found = 0; unsigned short platform, encoding; - char *fontsearchpath, *fontpath, *fontlist; + char *fontsearchpath, *fontlist; char *fullname = NULL; char *name, *path, *dir; char *strtok_ptr; @@ -537,7 +538,6 @@ gdft_draw_bitmap (gdImage * im, int fg, FT_Bitmap bitmap, int pen_x, int pen_y) { unsigned char *pixel; - int *tpixel; int x, y, row, col, pc; tweencolor_t *tc_elem; @@ -631,6 +631,14 @@ return gdImageStringFTEx(im, brect, fg, fontlist, ptsize, angle, x, y, string, NULL); } +static int +gdroundupdown (FT_F26Dot6 v1, int updown) +{ + return (!updown) + ? (v1 < 0 ? ((v1 - 63) >> 6) : v1 >> 6) + : (v1 > 0 ? ((v1 + 63) >> 6) : v1 >> 6); +} + char * gdImageStringFTEx (gdImage * im, int *brect, int fg, char *fontlist, double ptsize, double angle, int x, int y, char *string, @@ -739,8 +747,8 @@ if (ch == '\r') { penf.x = 0; - x1 = (penf.x * cos_a - penf.y * sin_a + 32) / 64; - y1 = (penf.x * sin_a + penf.y * cos_a + 32) / 64; + x1 = (int)(penf.x * cos_a - penf.y * sin_a + 32) / 64; + y1 = (int)(penf.x * sin_a + penf.y * cos_a + 32) / 64; pen.x = pen.y = 0; previous = 0; /* clear kerning flag */ next++; @@ -749,10 +757,10 @@ /* newlines */ if (ch == '\n') { - penf.y -= face->size->metrics.height * linespace; + penf.y -= (long)(face->size->metrics.height * linespace); penf.y = (penf.y - 32) & -64; /* round to next pixel row */ - x1 = (penf.x * cos_a - penf.y * sin_a + 32) / 64; - y1 = (penf.x * sin_a + penf.y * cos_a + 32) / 64; + x1 = (int)(penf.x * cos_a - penf.y * sin_a + 32) / 64; + y1 = (int)(penf.x * sin_a + penf.y * cos_a + 32) / 64; pen.x = pen.y = 0; previous = 0; /* clear kerning flag */ next++; @@ -918,14 +926,6 @@ if (tmpstr) gdFree (tmpstr); return (char *) NULL; -} - -int -gdroundupdown (FT_F26Dot6 v1, int updown) -{ - return (!updown) - ? (v1 < 0 ? ((v1 - 63) >> 6) : v1 >> 6) - : (v1 > 0 ? ((v1 + 63) >> 6) : v1 >> 6); } #endif /* HAVE_LIBFREETYPE */ Index: php4/ext/gd/libgd/gdhelpers.c diff -u php4/ext/gd/libgd/gdhelpers.c:1.1 php4/ext/gd/libgd/gdhelpers.c:1.2 --- php4/ext/gd/libgd/gdhelpers.c:1.1 Fri Apr 12 22:03:09 2002 +++ php4/ext/gd/libgd/gdhelpers.c Sun Aug 11 09:50:27 2002 @@ -1,6 +1,7 @@ #include "gd.h" #include "gdhelpers.h" #include <stdlib.h> +#include <string.h> /* TBB: gd_strtok_r is not portable; provide an implementation */ Index: php4/ext/gd/libgd/wbmp.c diff -u php4/ext/gd/libgd/wbmp.c:1.1 php4/ext/gd/libgd/wbmp.c:1.2 --- php4/ext/gd/libgd/wbmp.c:1.1 Fri Apr 12 22:03:09 2002 +++ php4/ext/gd/libgd/wbmp.c Sun Aug 11 09:50:27 2002 @@ -44,7 +44,7 @@ i = getin (in); if (i < 0) return (-1); - mbi = mbi << 7 | i & 0x7f; + mbi = (mbi << 7) | (i & 0x7f); } while (i & 0x80);
Index: php4/ext/gd/libgd/gd.c diff -u php4/ext/gd/libgd/gd.c:1.6 php4/ext/gd/libgd/gd.c:1.7 --- php4/ext/gd/libgd/gd.c:1.6 Thu Jun 6 08:58:25 2002 +++ php4/ext/gd/libgd/gd.c Sun Aug 11 09:50:27 2002 @@ -206,7 +206,7 @@ #define RETURN_HWB(h, w, b) {HWB->H = h; HWB->W = w; HWB->B = b; return HWB;} #define RETURN_RGB(r, g, b) {RGB->R = r; RGB->G = g; RGB->B = b; return RGB;} #define HWB_UNDEFINED -1 -#define SETUP_RGB(s, r, g, b) {s.R = r/255.0; s.G = g/255.0; s.B = b/255.0;} +#define SETUP_RGB(s, r, g, b) {s.R = r/255.0f; s.G = g/255.0f; s.B = b/255.0f;} #define MIN(a,b) ((a)<(b)?(a):(b)) #define MIN3(a,b,c) ((a)<(b)?(MIN(a,c)):(MIN(b,c))) @@ -290,6 +290,7 @@ } +#if 0 /* * This is not actually used, but is here for completeness, in case someone wants to * use the HWB stuff for anything else... @@ -332,8 +333,8 @@ } return RGB; - } +#endif /* 0 */ int gdImageColorClosestHWB (gdImagePtr im, int r, int g, int b) @@ -657,6 +658,22 @@ } } +static int +gdImageGetTrueColorPixel (gdImagePtr im, int x, int y) +{ + int p = gdImageGetPixel (im, x, y); + if (!im->trueColor) + { + return gdTrueColorAlpha (im->red[p], im->green[p], im->blue[p], + (im->transparent == p) ? gdAlphaTransparent : + gdAlphaOpaque); + } + else + { + return p; + } +} + static void gdImageBrushApply (gdImagePtr im, int x, int y) { @@ -793,22 +810,6 @@ } } -int -gdImageGetTrueColorPixel (gdImagePtr im, int x, int y) -{ - int p = gdImageGetPixel (im, x, y); - if (!im->trueColor) - { - return gdTrueColorAlpha (im->red[p], im->green[p], im->blue[p], - (im->transparent == p) ? gdAlphaTransparent : - gdAlphaOpaque); - } - else - { - return p; - } -} - /* Bresenham as presented in Foley & Van Dam */ void gdImageLine (gdImagePtr im, int x1, int y1, int x2, int y2, int color) @@ -968,7 +969,7 @@ int dashStep = 0; int on = 1; int wid; - int w, wstart, vert; + int vert; int thick = im->thick; dx = abs (x2 - x1); @@ -1905,7 +1906,6 @@ } if (dst->trueColor) { - int d; mapTo = gdImageGetTrueColorPixel (src, x, y); /* Added 7/24/95: support transparent copies */ if (gdImageGetTransparent (src) == mapTo) @@ -1985,7 +1985,6 @@ int srcW, int srcH) { int x, y; - float sx, sy; if (!dst->trueColor) { gdImageCopyResized ( @@ -1997,11 +1996,11 @@ { for (x = dstX; (x < dstX + dstW); x++) { - int pd = gdImageGetPixel (dst, x, y); + /*int pd = gdImageGetPixel (dst, x, y);*/ float sy1, sy2, sx1, sx2; float sx, sy; float spixels = 0; - float red = 0.0, green = 0.0, blue = 0.0, alpha = 0.0; + float red = 0.0f, green = 0.0f, blue = 0.0f, alpha = 0.0f; sy1 = ((float) y - (float) dstY) * (float) srcH / (float) dstH; sy2 = ((float) (y + 1) - (float) dstY) * (float) srcH / @@ -2012,7 +2011,7 @@ float yportion; if (floor (sy) == floor (sy1)) { - yportion = 1.0 - (sy - floor (sy)); + yportion = 1.0f - (sy - floor (sy)); if (yportion > sy2 - sy1) { yportion = sy2 - sy1; Index: php4/ext/gd/libgd/gd_gd.c diff -u php4/ext/gd/libgd/gd_gd.c:1.1 php4/ext/gd/libgd/gd_gd.c:1.2 --- php4/ext/gd/libgd/gd_gd.c:1.1 Fri Apr 12 22:03:08 2002 +++ php4/ext/gd/libgd/gd_gd.c Sun Aug 11 09:50:27 2002 @@ -195,7 +195,6 @@ _gdPutColors (gdImagePtr im, gdIOCtx * out) { int i; - int trans; gdPutC (im->trueColor, out); if (!im->trueColor) Index: php4/ext/gd/libgd/gd_gd2.c diff -u php4/ext/gd/libgd/gd_gd2.c:1.1 php4/ext/gd/libgd/gd_gd2.c:1.2 --- php4/ext/gd/libgd/gd_gd2.c:1.1 Fri Apr 12 22:03:08 2002 +++ php4/ext/gd/libgd/gd_gd2.c Sun Aug 11 09:50:27 2002 @@ -262,7 +262,7 @@ int i; int ncx, ncy, nc, cs, cx, cy; int x, y, ylo, yhi, xlo, xhi; - int ch, vers, fmt; + int vers, fmt; t_chunk_info *chunkIdx = NULL; /* So we can gdFree it with impunity. */ unsigned char *chunkBuf = NULL; /* So we can gdFree it with impunity. */ int chunkNum = 0; @@ -635,10 +635,10 @@ { if (im->trueColor) { - ch = chunkBuf[chunkPos++] << 24 + - chunkBuf[chunkPos++] << 16 + - chunkBuf[chunkPos++] << 8 + - chunkBuf[chunkPos++]; + ch = (chunkBuf[chunkPos++] << 24) + + (chunkBuf[chunkPos++] << 16) + + (chunkBuf[chunkPos++] << 8) + + (chunkBuf[chunkPos++]); } else { @@ -762,7 +762,7 @@ /* The zlib notes say output buffer size should be (input size) * 1.01 * 12 */ /* - we'll use 1.02 to be paranoid. */ /* */ - compMax = cs * bytesPerPixel * cs * 1.02 + 12; + compMax = (int)(cs * bytesPerPixel * cs * 1.02f + 12); /* */ /* Allocate the buffers. */ Index: php4/ext/gd/libgd/gd_jpeg.c diff -u php4/ext/gd/libgd/gd_jpeg.c:1.1 php4/ext/gd/libgd/gd_jpeg.c:1.2 --- php4/ext/gd/libgd/gd_jpeg.c:1.1 Fri Apr 12 22:03:08 2002 +++ php4/ext/gd/libgd/gd_jpeg.c Sun Aug 11 09:50:27 2002 @@ -249,7 +249,7 @@ } } jpeg_finish_compress (&cinfo); -error: +/*error:*/ jpeg_destroy_compress (&cinfo); gdFree (row); } @@ -282,8 +282,9 @@ volatile JSAMPROW row = 0; volatile gdImagePtr im = 0; JSAMPROW rowptr[1]; - int i, j, retval; + JDIMENSION i, j; JDIMENSION nrows; + int retval; #ifdef JPEG_DEBUG printf ("gd-jpeg: gd JPEG version %s\n", GD_JPEG_VERSION); @@ -496,7 +497,7 @@ gdIOCtx *infile; /* source stream */ unsigned char *buffer; /* start of buffer */ safeboolean start_of_file; /* have we gotten any data yet? */ - + } my_source_mgr; @@ -554,46 +555,46 @@ * Data beyond this point must be rescanned after resumption, so move it to * the front of the buffer rather than discarding it. */ - -#define END_JPEG_SEQUENCE "\r\n[*]--:END JPEG:--[*]\r\n" + +#define END_JPEG_SEQUENCE "\r\n[*]--:END JPEG:--[*]\r\n" safeboolean fill_input_buffer (j_decompress_ptr cinfo) { my_src_ptr src = (my_src_ptr) cinfo->src; size_t nbytes = 0; - + /* size_t got; */ /* char *s; */ memset (src->buffer, 0, INPUT_BUF_SIZE); - + while (nbytes < INPUT_BUF_SIZE) { - - int got = gdGetBuf (src->buffer + nbytes, + + int got = gdGetBuf (src->buffer + nbytes, INPUT_BUF_SIZE - nbytes, src->infile); - + if ((got == EOF) || (got == 0)) { - - /* EOF or error. If we got any data, don't worry about it. - If we didn't, then this is unexpected. */ + + /* EOF or error. If we got any data, don't worry about it. + If we didn't, then this is unexpected. */ if (!nbytes) { - + nbytes = -1; - + } - + break; - + } - + nbytes += got; - + } - + if (nbytes <= 0) { if (src->start_of_file) /* Treat empty input file as fatal error */ @@ -670,11 +671,11 @@ void term_source (j_decompress_ptr cinfo) { - + #if 0 /* never used */ my_src_ptr src = (my_src_ptr) cinfo->src; - + #endif } @@ -707,7 +708,7 @@ src->buffer = (unsigned char *) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT, INPUT_BUF_SIZE * sizeof (unsigned char)); - + } src = (my_src_ptr) cinfo->src; Index: php4/ext/gd/libgd/gd_png.c diff -u php4/ext/gd/libgd/gd_png.c:1.2 php4/ext/gd/libgd/gd_png.c:1.3 --- php4/ext/gd/libgd/gd_png.c:1.2 Sun Apr 21 09:48:22 2002 +++ php4/ext/gd/libgd/gd_png.c Sun Aug 11 09:50:27 2002 @@ -126,6 +126,7 @@ png_bytepp row_pointers = NULL; gdImagePtr im = NULL; int i, j, *open; + png_uint_32 ui, uj; volatile int transparent = -1; volatile int palette_allocated = FALSE; @@ -318,9 +319,9 @@ } /* set the individual row_pointers to point at the correct offsets */ - for (j = 0; j < height; ++j) + for (uj = 0; uj < height; ++uj) { - row_pointers[j] = image_data + j * rowbytes; + row_pointers[uj] = image_data + uj * rowbytes; } png_read_image (png_ptr, row_pointers); /* read whole image... */ @@ -351,44 +352,44 @@ switch (color_type) { case PNG_COLOR_TYPE_RGB: - for (j = 0; j < height; j++) + for (uj = 0; uj < height; uj++) { int boffset = 0; - for (i = 0; i < width; i++) + for (ui = 0; ui < width; ui++) { - register png_byte r = row_pointers[j][boffset++]; - register png_byte g = row_pointers[j][boffset++]; - register png_byte b = row_pointers[j][boffset++]; - im->tpixels[j][i] = gdTrueColor (r, g, b); + register png_byte r = row_pointers[uj][boffset++]; + register png_byte g = row_pointers[uj][boffset++]; + register png_byte b = row_pointers[uj][boffset++]; + im->tpixels[uj][ui] = gdTrueColor (r, g, b); } } break; case PNG_COLOR_TYPE_RGB_ALPHA: - for (j = 0; j < height; j++) + for (uj = 0; uj < height; uj++) { int boffset = 0; - for (i = 0; i < width; i++) + for (ui = 0; ui < width; ui++) { - register png_byte r = row_pointers[j][boffset++]; - register png_byte g = row_pointers[j][boffset++]; - register png_byte b = row_pointers[j][boffset++]; + register png_byte r = row_pointers[uj][boffset++]; + register png_byte g = row_pointers[uj][boffset++]; + register png_byte b = row_pointers[uj][boffset++]; /* gd has only 7 bits of alpha channel resolution, and 127 is transparent, 0 opaque. A moment of convenience, a lifetime of compatibility. */ register png_byte a = gdAlphaMax - - (row_pointers[j][boffset++] >> 1); - im->tpixels[j][i] = gdTrueColorAlpha (r, g, b, a); + (row_pointers[uj][boffset++] >> 1); + im->tpixels[uj][ui] = gdTrueColorAlpha (r, g, b, a); } } break; default: /* Palette image, or something coerced to be one */ - for (j = 0; j < height; ++j) + for (uj = 0; uj < height; ++uj) { - for (i = 0; i < width; ++i) + for (ui = 0; ui < width; ++ui) { - register png_byte idx = row_pointers[j][i]; - im->pixels[j][i] = idx; + register png_byte idx = row_pointers[uj][ui]; + im->pixels[uj][ui] = idx; open[idx] = 0; } } @@ -579,7 +580,6 @@ int i; int j; int k; - int highTrans = -1; for (i = 0; (i < im->colorsTotal); i++) { if ((!im->open[i]) && Index: php4/ext/gd/libgd/gd_topal.c diff -u php4/ext/gd/libgd/gd_topal.c:1.1 php4/ext/gd/libgd/gd_topal.c:1.2 --- php4/ext/gd/libgd/gd_topal.c:1.1 Fri Apr 12 22:03:08 2002 +++ php4/ext/gd/libgd/gd_topal.c Sun Aug 11 09:50:27 2002 @@ -28,6 +28,7 @@ #include "gd.h" #include "gdhelpers.h" +#include <string.h> /* * This module implements the well-known Heckbert paradigm for color Index: php4/ext/gd/libgd/gd_wbmp.c diff -u php4/ext/gd/libgd/gd_wbmp.c:1.1 php4/ext/gd/libgd/gd_wbmp.c:1.2 --- php4/ext/gd/libgd/gd_wbmp.c:1.1 Fri Apr 12 22:03:08 2002 +++ php4/ext/gd/libgd/gd_wbmp.c Sun Aug 11 09:50:27 2002 @@ -70,7 +70,7 @@ void gd_putout (int i, void *out) { - gdPutC (i, (gdIOCtx *) out); + gdPutC ((unsigned char)i, (gdIOCtx *) out); } Index: php4/ext/gd/libgd/gdft.c diff -u php4/ext/gd/libgd/gdft.c:1.5 php4/ext/gd/libgd/gdft.c:1.6 --- php4/ext/gd/libgd/gdft.c:1.5 Thu Aug 8 17:26:49 2002 +++ php4/ext/gd/libgd/gdft.c Sun Aug 11 09:50:27 2002 @@ -14,6 +14,7 @@ #ifndef MSWIN32 #include <unistd.h> +extern int access(const char *pathname, int mode); #else #define R_OK 2 #endif @@ -25,7 +26,7 @@ gdImageStringTTF (gdImage * im, int *brect, int fg, char *fontlist, double ptsize, double angle, int x, int y, char *string) { - gdImageStringFT (im, brect, fg, fontlist, ptsize, + return gdImageStringFT (im, brect, fg, fontlist, ptsize, angle, x, y, string); } @@ -331,7 +332,7 @@ int n; int font_found = 0; unsigned short platform, encoding; - char *fontsearchpath, *fontpath, *fontlist; + char *fontsearchpath, *fontlist; char *fullname = NULL; char *name, *path, *dir; char *strtok_ptr; @@ -537,7 +538,6 @@ gdft_draw_bitmap (gdImage * im, int fg, FT_Bitmap bitmap, int pen_x, int pen_y) { unsigned char *pixel; - int *tpixel; int x, y, row, col, pc; tweencolor_t *tc_elem; @@ -631,6 +631,14 @@ return gdImageStringFTEx(im, brect, fg, fontlist, ptsize, angle, x, y, string, NULL); } +static int +gdroundupdown (FT_F26Dot6 v1, int updown) +{ + return (!updown) + ? (v1 < 0 ? ((v1 - 63) >> 6) : v1 >> 6) + : (v1 > 0 ? ((v1 + 63) >> 6) : v1 >> 6); +} + char * gdImageStringFTEx (gdImage * im, int *brect, int fg, char *fontlist, double ptsize, double angle, int x, int y, char *string, @@ -739,8 +747,8 @@ if (ch == '\r') { penf.x = 0; - x1 = (penf.x * cos_a - penf.y * sin_a + 32) / 64; - y1 = (penf.x * sin_a + penf.y * cos_a + 32) / 64; + x1 = (int)(penf.x * cos_a - penf.y * sin_a + 32) / 64; + y1 = (int)(penf.x * sin_a + penf.y * cos_a + 32) / 64; pen.x = pen.y = 0; previous = 0; /* clear kerning flag */ next++; @@ -749,10 +757,10 @@ /* newlines */ if (ch == '\n') { - penf.y -= face->size->metrics.height * linespace; + penf.y -= (long)(face->size->metrics.height * linespace); penf.y = (penf.y - 32) & -64; /* round to next pixel row */ - x1 = (penf.x * cos_a - penf.y * sin_a + 32) / 64; - y1 = (penf.x * sin_a + penf.y * cos_a + 32) / 64; + x1 = (int)(penf.x * cos_a - penf.y * sin_a + 32) / 64; + y1 = (int)(penf.x * sin_a + penf.y * cos_a + 32) / 64; pen.x = pen.y = 0; previous = 0; /* clear kerning flag */ next++; @@ -918,14 +926,6 @@ if (tmpstr) gdFree (tmpstr); return (char *) NULL; -} - -int -gdroundupdown (FT_F26Dot6 v1, int updown) -{ - return (!updown) - ? (v1 < 0 ? ((v1 - 63) >> 6) : v1 >> 6) - : (v1 > 0 ? ((v1 + 63) >> 6) : v1 >> 6); } #endif /* HAVE_LIBFREETYPE */ Index: php4/ext/gd/libgd/gdhelpers.c diff -u php4/ext/gd/libgd/gdhelpers.c:1.1 php4/ext/gd/libgd/gdhelpers.c:1.2 --- php4/ext/gd/libgd/gdhelpers.c:1.1 Fri Apr 12 22:03:09 2002 +++ php4/ext/gd/libgd/gdhelpers.c Sun Aug 11 09:50:27 2002 @@ -1,6 +1,7 @@ #include "gd.h" #include "gdhelpers.h" #include <stdlib.h> +#include <string.h> /* TBB: gd_strtok_r is not portable; provide an implementation */ Index: php4/ext/gd/libgd/wbmp.c diff -u php4/ext/gd/libgd/wbmp.c:1.1 php4/ext/gd/libgd/wbmp.c:1.2 --- php4/ext/gd/libgd/wbmp.c:1.1 Fri Apr 12 22:03:09 2002 +++ php4/ext/gd/libgd/wbmp.c Sun Aug 11 09:50:27 2002 @@ -44,7 +44,7 @@ i = getin (in); if (i < 0) return (-1); - mbi = mbi << 7 | i & 0x7f; + mbi = (mbi << 7) | (i & 0x7f); } while (i & 0x80);