emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] Changes to emacs/src/image.c


From: YAMAMOTO Mitsuharu
Subject: [Emacs-diffs] Changes to emacs/src/image.c
Date: Tue, 25 Oct 2005 04:12:45 -0400

Index: emacs/src/image.c
diff -c emacs/src/image.c:1.38 emacs/src/image.c:1.39
*** emacs/src/image.c:1.38      Wed Oct 19 21:52:13 2005
--- emacs/src/image.c   Tue Oct 25 08:12:44 2005
***************
*** 2291,2296 ****
--- 2291,2297 ----
    GraphicsImportComponent gi;
    Rect rect;
    int width, height;
+   ImageDescriptionHandle desc_handle;
    short draw_all_pixels;
    Lisp_Object specified_bg;
    XColor color;
***************
*** 2326,2339 ****
          goto error;
        }
      }
!   err = GraphicsImportGetNaturalBounds (gi, &rect);
!   if (err != noErr)
      {
        image_error ("Error reading `%s'", img->spec, Qnil);
        goto error;
      }
!   width = img->width = rect.right - rect.left;
!   height = img->height = rect.bottom - rect.top;
    err = GraphicsImportDoesDrawAllPixels (gi, &draw_all_pixels);
  #if 0
    /* Don't check the error code here.  It may have an undocumented
--- 2327,2348 ----
          goto error;
        }
      }
!   err = GraphicsImportGetImageDescription (gi, &desc_handle);
!   if (err != noErr || desc_handle == NULL)
      {
        image_error ("Error reading `%s'", img->spec, Qnil);
        goto error;
      }
!   width = img->width = (*desc_handle)->width;
!   height = img->height = (*desc_handle)->height;
!   DisposeHandle ((Handle)desc_handle);
! 
!   if (!check_image_size (f, width, height))
!     {
!       image_error ("Invalid image size", Qnil, Qnil);
!       goto error;
!     }
! 
    err = GraphicsImportDoesDrawAllPixels (gi, &draw_all_pixels);
  #if 0
    /* Don't check the error code here.  It may have an undocumented
***************
*** 2535,2540 ****
--- 2544,2558 ----
        image_error ("Error reading image `%s'", img->spec, Qnil);
        return 0;
      }
+   width = img->width = CGImageGetWidth (image);
+   height = img->height = CGImageGetHeight (image);
+ 
+   if (!check_image_size (f, width, height))
+     {
+       UNGCPRO;
+       image_error ("Invalid image size", Qnil, Qnil);
+       return 0;
+     }
  
    if (png_p)
      {
***************
*** 2548,2555 ****
          color.blue = BLUE16_FROM_ULONG (color.pixel);
        }
      }
!   width = img->width = CGImageGetWidth (image);
!   height = img->height = CGImageGetHeight (image);
    if (!x_create_x_image_and_pixmap (f, width, height, 0, &ximg, &img->pixmap))
      {
        CGImageRelease (image);
--- 2566,2572 ----
          color.blue = BLUE16_FROM_ULONG (color.pixel);
        }
      }
! 
    if (!x_create_x_image_and_pixmap (f, width, height, 0, &ximg, &img->pixmap))
      {
        CGImageRelease (image);
***************
*** 4190,4195 ****
--- 4207,4219 ----
        || width <= 0 || height <= 0
        || num_colors <= 0 || chars_per_pixel <= 0)
      goto failure;
+ 
+   if (!check_image_size (f, width, height))
+     {
+       image_error ("Invalid image size", Qnil, Qnil);
+       goto failure;
+     }
+ 
    expect (',');
  
    XSETFRAME (frame, f);




reply via email to

[Prev in Thread] Current Thread [Next in Thread]