From: Marcus Boerger Date: Sun, 11 Aug 2002 19:13:07 +0000 (+0000) Subject: try even more to fix those warnings..... X-Git-Tag: php-4.3.0dev_zend2_alpha3~137 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b9c0c918cc9b4b73fd42422814d202e2aa31c546;p=php try even more to fix those warnings..... #repeat: this code must come from hell --- diff --git a/ext/gd/libgd/gd.c b/ext/gd/libgd/gd.c index 196dd90bd6..ac5a19a66d 100644 --- a/ext/gd/libgd/gd.c +++ b/ext/gd/libgd/gd.c @@ -277,7 +277,7 @@ HWB_Diff (int r1, int g1, int b1, int r2, int g2, int b2) } else { - diff = abs (HWB1.H - HWB2.H); + diff = fabsf (HWB1.H - HWB2.H); if (diff > 3) { diff = 6 - diff; /* Remember, it's a colour circle */ @@ -823,7 +823,7 @@ gdImageLine (gdImagePtr im, int x1, int y1, int x2, int y2, int color) if (dy <= dx) { /* More-or-less horizontal. use wid for vertical stroke */ - wid = thick * cos (atan2 (dy, dx)); + wid = (int)(thick * cos (atan2 (dy, dx))); if (wid == 0) wid = 1; @@ -892,7 +892,7 @@ gdImageLine (gdImagePtr im, int x1, int y1, int x2, int y2, int color) else { /* More-or-less vertical. use wid for horizontal stroke */ - wid = thick * sin (atan2 (dy, dx)); + wid = (int)(thick * sin (atan2 (dy, dx))); if (wid == 0) wid = 1; @@ -977,7 +977,7 @@ gdImageDashedLine (gdImagePtr im, int x1, int y1, int x2, int y2, int color) if (dy <= dx) { /* More-or-less horizontal. use wid for vertical stroke */ - wid = thick * sin (atan2 (dy, dx)); + wid = (int)(thick * sin (atan2 (dy, dx))); vert = 1; d = 2 * dy - dx; @@ -1036,7 +1036,7 @@ gdImageDashedLine (gdImagePtr im, int x1, int y1, int x2, int y2, int color) else { /* More-or-less vertical. use wid for horizontal stroke */ - wid = thick * sin (atan2 (dy, dx)); + wid = (int)(thick * sin (atan2 (dy, dx))); vert = 0; d = 2 * dx - dy; @@ -1766,12 +1766,12 @@ gdImageCopyMerge (gdImagePtr dst, gdImagePtr src, int dstX, int dstY, int srcX, { dc = gdImageGetPixel (dst, tox, toy); - ncR = gdImageRed (src, c) * (pct / 100.0) - + gdImageRed (dst, dc) * ((100 - pct) / 100.0); - ncG = gdImageGreen (src, c) * (pct / 100.0) - + gdImageGreen (dst, dc) * ((100 - pct) / 100.0); - ncB = gdImageBlue (src, c) * (pct / 100.0) - + gdImageBlue (dst, dc) * ((100 - pct) / 100.0); + ncR = (int)( gdImageRed (src, c) * (pct / 100.0f) + + gdImageRed (dst, dc) * ((100 - pct) / 100.0f)); + ncG = (int)( gdImageGreen (src, c) * (pct / 100.0f) + + gdImageGreen (dst, dc) * ((100 - pct) / 100.0f)); + ncB = (int)( gdImageBlue (src, c) * (pct / 100.0f) + + gdImageBlue (dst, dc) * ((100 - pct) / 100.0f)); /* Find a reasonable color */ nc = gdImageColorResolve (dst, ncR, ncG, ncB); @@ -1816,19 +1816,19 @@ gdImageCopyMergeGray (gdImagePtr dst, gdImagePtr src, int dstX, int dstY, int sr else { dc = gdImageGetPixel (dst, tox, toy); - g = 0.29900 * dst->red[dc] - + 0.58700 * dst->green[dc] - + 0.11400 * dst->blue[dc]; - - ncR = gdImageRed (src, c) * (pct / 100.0) - + gdImageRed (dst, dc) * g * - ((100 - pct) / 100.0); - ncG = gdImageGreen (src, c) * (pct / 100.0) - + gdImageGreen (dst, dc) * g * - ((100 - pct) / 100.0); - ncB = gdImageBlue (src, c) * (pct / 100.0) - + gdImageBlue (dst, dc) * g * - ((100 - pct) / 100.0); + g = 0.29900f * dst->red[dc] + + 0.58700f * dst->green[dc] + + 0.11400f * dst->blue[dc]; + + ncR = (int)( gdImageRed (src, c) * (pct / 100.0f) + + gdImageRed (dst, dc) * g * ((100 - pct) / 100.0f)); + + ncG = (int)( gdImageGreen (src, c) * (pct / 100.0f) + + gdImageGreen (dst, dc) * g * ((100 - pct) / 100.0f)); + + ncB = (int)( gdImageBlue (src, c) * (pct / 100.0f) + + gdImageBlue (dst, dc) * g * ((100 - pct) / 100.0f)); + /* First look for an exact match */ nc = gdImageColorExact (dst, ncR, ncG, ncB); @@ -2009,18 +2009,18 @@ gdImageCopyResampled (gdImagePtr dst, do { float yportion; - if (floor (sy) == floor (sy1)) + if (floorf(sy) == floorf(sy1)) { - yportion = 1.0f - (sy - floor (sy)); + yportion = 1.0f - (sy - floorf(sy)); if (yportion > sy2 - sy1) { yportion = sy2 - sy1; } - sy = floor (sy); + sy = floorf(sy); } - else if (sy == floor (sy2)) + else if (sy == floorf(sy2)) { - yportion = sy2 - floor (sy2); + yportion = sy2 - floorf(sy2); } else { @@ -2036,18 +2036,18 @@ gdImageCopyResampled (gdImagePtr dst, float xportion; float pcontribution; int p; - if (floor (sx) == floor (sx1)) + if (floorf(sx) == floorf(sx1)) { - xportion = 1.0 - (sx - floor (sx)); + xportion = 1.0 - (sx - floorf(sx)); if (xportion > sx2 - sx1) { xportion = sx2 - sx1; } - sx = floor (sx); + sx = floorf(sx); } - else if (sx == floor (sx2)) + else if (sx == floorf(sx2)) { - xportion = sx2 - floor (sx2); + xportion = sx2 - floorf(sx2); } else { diff --git a/ext/gd/libgd/gd2copypal.c b/ext/gd/libgd/gd2copypal.c index 1b0a81def6..ae9b559f17 100644 --- a/ext/gd/libgd/gd2copypal.c +++ b/ext/gd/libgd/gd2copypal.c @@ -1,6 +1,7 @@ #include #include "gd.h" +#include /* A short program which converts a .png file into a .gd file, for your convenience in creating images on the fly from a diff --git a/ext/gd/libgd/gd_jpeg.c b/ext/gd/libgd/gd_jpeg.c index 54da0779d2..96b895ec38 100644 --- a/ext/gd/libgd/gd_jpeg.c +++ b/ext/gd/libgd/gd_jpeg.c @@ -813,7 +813,7 @@ term_destination (j_compress_ptr cinfo) /* Write any data remaining in the buffer */ if (datacount > 0) { - if (gdPutBuf (dest->buffer, datacount, dest->outfile) != datacount) + if ((size_t)gdPutBuf (dest->buffer, datacount, dest->outfile) != datacount) ERREXIT (cinfo, JERR_FILE_WRITE); } } diff --git a/ext/gd/libgd/gdft.c b/ext/gd/libgd/gdft.c index 474405d240..cc2044b171 100644 --- a/ext/gd/libgd/gdft.c +++ b/ext/gd/libgd/gdft.c @@ -14,10 +14,12 @@ #ifndef MSWIN32 #include -extern int access(const char *pathname, int mode); #else #define R_OK 2 #endif +#ifdef WIN32 +extern int access(const char *pathname, int mode); +#endif /* number of antialised colors for indexed bitmaps */ #define NUMCOLORS 8