Merge from trunk
[bpt/emacs.git] / src / image.c
index e25cef5..b37ba39 100644 (file)
@@ -831,9 +831,7 @@ parse_image_spec (Lisp_Object spec, struct image_keyword *keywords,
 
        case IMAGE_FUNCTION_VALUE:
          value = indirect_function (value);
-         if (SUBRP (value)
-             || COMPILEDP (value)
-             || (CONSP (value) && EQ (XCAR (value), Qlambda)))
+         if (!NILP (Ffunctionp (value)))
            break;
          return 0;
 
@@ -1137,7 +1135,7 @@ static RGB_PIXEL_COLOR
 four_corners_best (XImagePtr_or_DC ximg, int *corners,
                   unsigned long width, unsigned long height)
 {
-  RGB_PIXEL_COLOR corner_pixels[4], best;
+  RGB_PIXEL_COLOR corner_pixels[4], best IF_LINT (= 0);
   int i, best_count;
 
   if (corners && corners[BOT_CORNER] >= 0)
@@ -1557,9 +1555,9 @@ clear_image_cache (struct frame *f, Lisp_Object filter)
 
          FOR_EACH_FRAME (tail, frame)
            {
-             struct frame *f = XFRAME (frame);
-             if (FRAME_IMAGE_CACHE (f) == c)
-               clear_current_matrices (f);
+             struct frame *fr = XFRAME (frame);
+             if (FRAME_IMAGE_CACHE (fr) == c)
+               clear_current_matrices (fr);
            }
 
          ++windows_or_buffers_changed;
@@ -2651,11 +2649,11 @@ xbm_read_bitmap_data (struct frame *f, unsigned char *contents, unsigned char *e
 
       if (LA1 == XBM_TK_NUMBER)
        {
-          char *p = strrchr (buffer, '_');
-         p = p ? p + 1 : buffer;
-          if (strcmp (p, "width") == 0)
+         char *q = strrchr (buffer, '_');
+         q = q ? q + 1 : buffer;
+         if (strcmp (q, "width") == 0)
            *width = value;
-          else if (strcmp (p, "height") == 0)
+         else if (strcmp (q, "height") == 0)
            *height = value;
        }
       expect (XBM_TK_NUMBER);
@@ -3425,11 +3423,12 @@ xpm_load (struct frame *f, struct image *img)
        {
          Lisp_Object name;
          Lisp_Object color;
+         char *empty_string = (char *) "";
 
          if (!CONSP (XCAR (tail)))
            {
-             xpm_syms[i].name = "";
-             xpm_syms[i].value = "";
+             xpm_syms[i].name = empty_string;
+             xpm_syms[i].value = empty_string;
              continue;
            }
          name = XCAR (XCAR (tail));
@@ -3440,14 +3439,14 @@ xpm_load (struct frame *f, struct image *img)
              strcpy (xpm_syms[i].name, SSDATA (name));
            }
          else
-           xpm_syms[i].name = "";
+           xpm_syms[i].name = empty_string;
          if (STRINGP (color))
            {
              xpm_syms[i].value = (char *) alloca (SCHARS (color) + 1);
              strcpy (xpm_syms[i].value, SSDATA (color));
            }
          else
-           xpm_syms[i].value = "";
+           xpm_syms[i].value = empty_string;
        }
     }
 
@@ -4484,7 +4483,6 @@ static void
 XPutPixel (XImagePtr ximg, int x, int y, COLORREF color)
 {
   int width = ximg->info.bmiHeader.biWidth;
-  int height = ximg->info.bmiHeader.biHeight;
   unsigned char * pixel;
 
   /* True color images.  */
@@ -4603,14 +4601,14 @@ x_detect_edges (struct frame *f, struct image *img, int *matrix, int color_adjus
 
       for (x = 1; x < img->width - 1; ++x, ++p)
        {
-         int r, g, b, y1, x1;
+         int r, g, b, yy, xx;
 
          r = g = b = i = 0;
-         for (y1 = y - 1; y1 < y + 2; ++y1)
-           for (x1 = x - 1; x1 < x + 2; ++x1, ++i)
+         for (yy = y - 1; yy < y + 2; ++yy)
+           for (xx = x - 1; xx < x + 2; ++xx, ++i)
              if (matrix[i])
                {
-                 XColor *t = COLOR (colors, x1, y1);
+                 XColor *t = COLOR (colors, xx, yy);
                  r += matrix[i] * t->red;
                  g += matrix[i] * t->green;
                  b += matrix[i] * t->blue;
@@ -4686,7 +4684,7 @@ x_edge_detection (struct frame *f, struct image *img, Lisp_Object matrix,
     color_adjust = make_number (0xffff / 2);
 
   if (i == 9 && NUMBERP (color_adjust))
-    x_detect_edges (f, img, trans, (int) XFLOATINT (color_adjust));
+    x_detect_edges (f, img, trans, XFLOATINT (color_adjust));
 }
 
 
@@ -5529,6 +5527,7 @@ init_png_functions (Lisp_Object libraries)
 /* Error and warning handlers installed when the PNG library
    is initialized.  */
 
+static void my_png_error (png_struct *, const char *) NO_RETURN;
 static void
 my_png_error (png_struct *png_ptr, const char *msg)
 {
@@ -6103,6 +6102,7 @@ struct my_jpeg_error_mgr
 };
 
 
+static void my_error_exit (j_common_ptr) NO_RETURN;
 static void
 my_error_exit (j_common_ptr cinfo)
 {
@@ -6363,10 +6363,10 @@ jpeg_load (struct frame *f, struct image *img)
       if (rc == 1)
        {
          /* Called from my_error_exit.  Display a JPEG error.  */
-         char buffer[JMSG_LENGTH_MAX];
-         cinfo.err->format_message ((j_common_ptr) &cinfo, buffer);
+         char buf[JMSG_LENGTH_MAX];
+         cinfo.err->format_message ((j_common_ptr) &cinfo, buf);
          image_error ("Error reading JPEG image `%s': %s", img->spec,
-                      build_string (buffer));
+                      build_string (buf));
        }
 
       /* Close the input file and destroy the JPEG object.  */
@@ -6751,7 +6751,7 @@ tiff_load (struct frame *f, struct image *img)
   TIFF *tiff;
   int width, height, x, y, count;
   uint32 *buf;
-  int rc, rc2;
+  int rc;
   XImagePtr ximg;
   tiff_memory_source memsrc;
   Lisp_Object image;
@@ -6839,8 +6839,8 @@ tiff_load (struct frame *f, struct image *img)
   rc = fn_TIFFReadRGBAImage (tiff, width, height, buf, 0);
 
   /* Count the number of images in the file.  */
-  for (count = 1, rc2 = 1; rc2; count++)
-    rc2 = fn_TIFFSetDirectory (tiff, count);
+  for (count = 1; fn_TIFFSetDirectory (tiff, count); count++)
+    continue;
 
   if (count > 1)
     img->data.lisp_val = Fcons (Qcount,
@@ -7102,7 +7102,7 @@ gif_load (struct frame *f, struct image *img)
   Lisp_Object file, specified_file;
   Lisp_Object specified_data;
   int rc, width, height, x, y, i;
-  boolean transparent_p;
+  boolean transparent_p = 0;
   XImagePtr ximg;
   ColorMapObject *gif_color_map;
   unsigned long pixel_colors[256];
@@ -7111,7 +7111,7 @@ gif_load (struct frame *f, struct image *img)
   int ino, image_height, image_width;
   gif_memory_source memsrc;
   unsigned char *raster;
-  unsigned int transparency_color_index;
+  unsigned int transparency_color_index IF_LINT (= 0);
 
   specified_file = image_spec_value (img->spec, QCfile, NULL);
   specified_data = image_spec_value (img->spec, QCdata, NULL);
@@ -7126,7 +7126,7 @@ gif_load (struct frame *f, struct image *img)
        }
 
       /* Open the GIF file.  */
-      gif = fn_DGifOpenFileName (SDATA (file));
+      gif = fn_DGifOpenFileName (SSDATA (file));
       if (gif == NULL)
        {
          image_error ("Cannot open `%s'", file, Qnil);
@@ -7299,9 +7299,9 @@ gif_load (struct frame *f, struct image *img)
 
          for (x = 0; x < image_width; x++)
            {
-             int i = raster[(y * image_width) + x];
+             int c = raster[(y * image_width) + x];
              XPutPixel (ximg, x + img->corners[LEFT_CORNER],
-                        row + img->corners[TOP_CORNER], pixel_colors[i]);
+                        row + img->corners[TOP_CORNER], pixel_colors[c]);
            }
 
          row += interlace_increment[pass];
@@ -7312,9 +7312,9 @@ gif_load (struct frame *f, struct image *img)
       for (y = 0; y < image_height; ++y)
        for (x = 0; x < image_width; ++x)
          {
-           int i = raster[y * image_width + x];
+           int c = raster[y * image_width + x];
            XPutPixel (ximg, x + img->corners[LEFT_CORNER],
-                      y + img->corners[TOP_CORNER], pixel_colors[i]);
+                      y + img->corners[TOP_CORNER], pixel_colors[c]);
          }
     }