From 7574650a39ce88088ff88acac1f734168161882b Mon Sep 17 00:00:00 2001 From: Andreas Schwab Date: Sat, 4 Sep 2010 21:39:34 +0200 Subject: Check all lisp types in image loader * nsimage.m (ns_load_image): Check argument types. * image.c: Remove all uses of gcpro. (xpm_load): Check all lisp types. (pbm_load): Likewise. (png_load): Likewise. (jpeg_load): Likewise. (tiff_load): Likewise. (gif_load): Likewise. (imagemagick_load_image): Likewise. (imagemagick_load): Likewise. (svg_load): Likewise. (gs_load): Likewise. --- src/nsimage.m | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'src/nsimage.m') diff --git a/src/nsimage.m b/src/nsimage.m index 13761ba5f71..a42950d1f52 100644 --- a/src/nsimage.m +++ b/src/nsimage.m @@ -83,19 +83,21 @@ int ns_load_image (struct frame *f, struct image *img, Lisp_Object spec_file, Lisp_Object spec_data) { - EmacsImage *eImg; + EmacsImage *eImg = nil; NSSize size; NSTRACE (ns_load_image); - if (NILP (spec_data)) + if (STRINGP (spec_file)) { eImg = [EmacsImage allocInitFromFile: spec_file]; } - else + else if (STRINGP (spec_data)) { - NSData *data = [NSData dataWithBytes: SDATA (spec_data) - length: SBYTES (spec_data)]; + NSData *data; + + data = [NSData dataWithBytes: SDATA (spec_data) + length: SBYTES (spec_data)]; eImg = [[EmacsImage alloc] initWithData: data]; [eImg setPixmapData]; } -- cgit v1.2.1