From: Marcus Boerger Date: Sun, 11 Aug 2002 13:50:27 +0000 (+0000) Subject: try to fix those warnings..... X-Git-Tag: php-4.3.0dev_zend2_alpha3~143 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=1723861618ea13d19def6508bec867c40c1adf1e;p=php try to fix those warnings..... #this code must come from hell: will we change code to our coding-scheme? --- diff --git a/ext/gd/libgd/gd.c b/ext/gd/libgd/gd.c index 4293c521c1..196dd90bd6 100644 --- a/ext/gd/libgd/gd.c +++ b/ext/gd/libgd/gd.c @@ -206,7 +206,7 @@ gdImageColorClosestAlpha (gdImagePtr im, int r, int g, int b, int a) #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 @@ HWB_Diff (int r1, int g1, int b1, int r2, int g2, int b2) } +#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 @@ HWB_to_RGB (HWBType HWB, RGBType * RGB) } return RGB; - } +#endif /* 0 */ int gdImageColorClosestHWB (gdImagePtr im, int r, int g, int b) @@ -657,6 +658,22 @@ gdImageSetPixel (gdImagePtr im, int x, int y, int color) } } +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 @@ gdImageGetPixel (gdImagePtr im, int x, int y) } } -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 @@ gdImageDashedLine (gdImagePtr im, int x1, int y1, int x2, int y2, int color) 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 @@ gdImageCopyResized (gdImagePtr dst, gdImagePtr src, int dstX, int dstY, int srcX } 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 @@ gdImageCopyResampled (gdImagePtr dst, int srcW, int srcH) { int x, y; - float sx, sy; if (!dst->trueColor) { gdImageCopyResized ( @@ -1997,11 +1996,11 @@ gdImageCopyResampled (gdImagePtr dst, { 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 @@ gdImageCopyResampled (gdImagePtr dst, 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; diff --git a/ext/gd/libgd/gd_gd.c b/ext/gd/libgd/gd_gd.c index 45b6492312..72213a848e 100644 --- a/ext/gd/libgd/gd_gd.c +++ b/ext/gd/libgd/gd_gd.c @@ -195,7 +195,6 @@ void _gdPutColors (gdImagePtr im, gdIOCtx * out) { int i; - int trans; gdPutC (im->trueColor, out); if (!im->trueColor) diff --git a/ext/gd/libgd/gd_gd2.c b/ext/gd/libgd/gd_gd2.c index 5697cf3138..98e619b19a 100644 --- a/ext/gd/libgd/gd_gd2.c +++ b/ext/gd/libgd/gd_gd2.c @@ -262,7 +262,7 @@ gdImageCreateFromGd2Ctx (gdIOCtxPtr in) 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 @@ gdImageCreateFromGd2PartCtx (gdIOCtx * in, int srcx, int srcy, int w, int h) { 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 @@ _gdImageGd2 (gdImagePtr im, gdIOCtx * out, int cs, int fmt) /* 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. */ diff --git a/ext/gd/libgd/gd_jpeg.c b/ext/gd/libgd/gd_jpeg.c index 8d3614c343..54da0779d2 100644 --- a/ext/gd/libgd/gd_jpeg.c +++ b/ext/gd/libgd/gd_jpeg.c @@ -249,7 +249,7 @@ gdImageJpegCtx (gdImagePtr im, gdIOCtx * outfile, int quality) } } jpeg_finish_compress (&cinfo); -error: +/*error:*/ jpeg_destroy_compress (&cinfo); gdFree (row); } @@ -282,8 +282,9 @@ gdImageCreateFromJpegCtx (gdIOCtx * infile) 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); diff --git a/ext/gd/libgd/gd_png.c b/ext/gd/libgd/gd_png.c index 4cdbea44e6..19f74cdef2 100644 --- a/ext/gd/libgd/gd_png.c +++ b/ext/gd/libgd/gd_png.c @@ -126,6 +126,7 @@ gdImageCreateFromPngCtx (gdIOCtx * infile) 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 @@ gdImageCreateFromPngCtx (gdIOCtx * infile) } /* 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 @@ gdImageCreateFromPngCtx (gdIOCtx * infile) 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 @@ gdImagePngCtx (gdImagePtr im, gdIOCtx * outfile) int i; int j; int k; - int highTrans = -1; for (i = 0; (i < im->colorsTotal); i++) { if ((!im->open[i]) && diff --git a/ext/gd/libgd/gd_topal.c b/ext/gd/libgd/gd_topal.c index d2be7508f2..a43683937f 100644 --- a/ext/gd/libgd/gd_topal.c +++ b/ext/gd/libgd/gd_topal.c @@ -28,6 +28,7 @@ #include "gd.h" #include "gdhelpers.h" +#include /* * This module implements the well-known Heckbert paradigm for color diff --git a/ext/gd/libgd/gd_wbmp.c b/ext/gd/libgd/gd_wbmp.c index 04a7108278..c7948f9865 100644 --- a/ext/gd/libgd/gd_wbmp.c +++ b/ext/gd/libgd/gd_wbmp.c @@ -70,7 +70,7 @@ void gd_putout (int i, void *out) { - gdPutC (i, (gdIOCtx *) out); + gdPutC ((unsigned char)i, (gdIOCtx *) out); } diff --git a/ext/gd/libgd/gdft.c b/ext/gd/libgd/gdft.c index b8fd69fc13..474405d240 100644 --- a/ext/gd/libgd/gdft.c +++ b/ext/gd/libgd/gdft.c @@ -14,6 +14,7 @@ #ifndef MSWIN32 #include +extern int access(const char *pathname, int mode); #else #define R_OK 2 #endif @@ -25,7 +26,7 @@ char * 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 @@ fontFetch (char **error, void *key) 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 @@ static char * 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 @@ gdImageStringFT (gdImage * im, int *brect, int fg, char *fontlist, 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 @@ gdImageStringFTEx (gdImage * im, int *brect, int fg, char *fontlist, 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 @@ gdImageStringFTEx (gdImage * im, int *brect, int fg, char *fontlist, /* 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++; @@ -920,12 +928,4 @@ gdImageStringFTEx (gdImage * im, int *brect, int fg, char *fontlist, 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 */ diff --git a/ext/gd/libgd/gdhelpers.c b/ext/gd/libgd/gdhelpers.c index 7909ca0ee2..03f880a06b 100644 --- a/ext/gd/libgd/gdhelpers.c +++ b/ext/gd/libgd/gdhelpers.c @@ -1,6 +1,7 @@ #include "gd.h" #include "gdhelpers.h" #include +#include /* TBB: gd_strtok_r is not portable; provide an implementation */ diff --git a/ext/gd/libgd/wbmp.c b/ext/gd/libgd/wbmp.c index 828beeb50c..039d80f00c 100644 --- a/ext/gd/libgd/wbmp.c +++ b/ext/gd/libgd/wbmp.c @@ -44,7 +44,7 @@ getmbi (int (*getin) (void *in), void *in) i = getin (in); if (i < 0) return (-1); - mbi = mbi << 7 | i & 0x7f; + mbi = (mbi << 7) | (i & 0x7f); } while (i & 0x80);