]> granicus.if.org Git - php/commitdiff
try even more to fix those warnings.....
authorMarcus Boerger <helly@php.net>
Sun, 11 Aug 2002 19:13:07 +0000 (19:13 +0000)
committerMarcus Boerger <helly@php.net>
Sun, 11 Aug 2002 19:13:07 +0000 (19:13 +0000)
#repeat: this code must come from hell

ext/gd/libgd/gd.c
ext/gd/libgd/gd2copypal.c
ext/gd/libgd/gd_jpeg.c
ext/gd/libgd/gdft.c

index 196dd90bd67557ca5dbe56c6777f3ac1259d9722..ac5a19a66d06726c47f94158fa89a65818b39dfd 100644 (file)
@@ -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
                    {
index 1b0a81def6211c58e8ddf07aeea74dc49b233c18..ae9b559f17b2e84b7625f431f29f221a1d8df549 100644 (file)
@@ -1,6 +1,7 @@
 
 #include <stdio.h>
 #include "gd.h"
+#include <stdlib.h>
 
 /* A short program which converts a .png file into a .gd file, for
    your convenience in creating images on the fly from a
index 54da0779d235abd028873111365435b86a6e2200..96b895ec38df8589eb9bb440f7b91d110a61ed1b 100644 (file)
@@ -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);
     }
 }
index 474405d240559e4681c34efa02d6081ab1a6aa2e..cc2044b171a816a8bba4c0a9f8e5b229824934d9 100644 (file)
 
 #ifndef MSWIN32
 #include <unistd.h>
-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