]> granicus.if.org Git - php/commitdiff
try to fix those warnings.....
authorMarcus Boerger <helly@php.net>
Sun, 11 Aug 2002 13:50:27 +0000 (13:50 +0000)
committerMarcus Boerger <helly@php.net>
Sun, 11 Aug 2002 13:50:27 +0000 (13:50 +0000)
#this code must come from hell: will we change code to our coding-scheme?

ext/gd/libgd/gd.c
ext/gd/libgd/gd_gd.c
ext/gd/libgd/gd_gd2.c
ext/gd/libgd/gd_jpeg.c
ext/gd/libgd/gd_png.c
ext/gd/libgd/gd_topal.c
ext/gd/libgd/gd_wbmp.c
ext/gd/libgd/gdft.c
ext/gd/libgd/gdhelpers.c
ext/gd/libgd/wbmp.c

index 4293c521c1ad015284558194a630e1cc26d81e43..196dd90bd67557ca5dbe56c6777f3ac1259d9722 100644 (file)
@@ -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;
index 45b64923128d6d4c805c559db2e147dfb975e4ec..72213a848ed0fb7cb881c128912f6d734ea78ac7 100644 (file)
@@ -195,7 +195,6 @@ void
 _gdPutColors (gdImagePtr im, gdIOCtx * out)
 {
   int i;
-  int trans;
 
   gdPutC (im->trueColor, out);
   if (!im->trueColor)
index 5697cf31386fd9c768cc0a174f7c7304e50812e5..98e619b19a710c44b1484a94c9813ed77b601d41 100644 (file)
@@ -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.  */
index 8d3614c3432d4de964c245afc29517875cd90b60..54da0779d235abd028873111365435b86a6e2200 100644 (file)
@@ -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);
index 4cdbea44e6b6ccfd3e00c8a21685726cd27de2ba..19f74cdef2b2883404e7db9113372ad6a4f6717b 100644 (file)
@@ -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]) &&
index d2be7508f220b578cc712e995ad20fc42e780d84..a43683937f64273c9d3af9ff19e93c56ccf83a8f 100644 (file)
@@ -28,6 +28,7 @@
 
 #include "gd.h"
 #include "gdhelpers.h"
+#include <string.h>
 
 /*
  * This module implements the well-known Heckbert paradigm for color
index 04a7108278d32e2067cfae8f1005ddfbce9a6eeb..c7948f98653df77999a5f98a0a2806e78e381227 100644 (file)
@@ -70,7 +70,7 @@
 void
 gd_putout (int i, void *out)
 {
-  gdPutC (i, (gdIOCtx *) out);
+  gdPutC ((unsigned char)i, (gdIOCtx *) out);
 }
 
 
index b8fd69fc134399666130266e45e43976b1e5ae18..474405d240559e4681c34efa02d6081ab1a6aa2e 100644 (file)
@@ -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 @@ 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 */
index 7909ca0ee21ed87dafc00dc26ab4ce12534b7db0..03f880a06b22f21d316cab8dc8f837d8c8fcd5d5 100644 (file)
@@ -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 828beeb50c24eca89306c380b13204feba1a4985..039d80f00c762b23a6de8b02f40b3a3d640f1187 100644 (file)
@@ -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);