diff options
Diffstat (limited to 'src/nsimage.m')
-rw-r--r-- | src/nsimage.m | 30 |
1 files changed, 17 insertions, 13 deletions
diff --git a/src/nsimage.m b/src/nsimage.m index c9811a8cb33..a5bea91e633 100644 --- a/src/nsimage.m +++ b/src/nsimage.m @@ -27,7 +27,7 @@ GNUstep port and post-20 update by Adrian Robert (arobert@cogsci.ucsd.edu) /* This should be the first include, as it may set up #defines affecting interpretation of even the system includes. */ -#include "config.h" +#include <config.h> #include <setjmp.h> #include "lisp.h" @@ -83,19 +83,21 @@ int ns_load_image (struct frame *f, struct image *img, Lisp_Object spec_file, Lisp_Object spec_data) { - NSTRACE (ns_load_image); - - EmacsImage *eImg; + EmacsImage *eImg = nil; NSSize size; - if (NILP (spec_data)) + NSTRACE (ns_load_image); + + 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]; } @@ -315,9 +317,9 @@ static EmacsImage *ImageList = nil; [self addRepresentation: bmRep]; - bzero (planes[0], w*h); - bzero (planes[1], w*h); - bzero (planes[2], w*h); + memset (planes[0], 0, w*h); + memset (planes[1], 0, w*h); + memset (planes[2], 0, w*h); [self setXBMColor: [NSColor blackColor]]; return self; } @@ -334,7 +336,7 @@ static EmacsImage *ImageList = nil; NSColor *rgbColor; if (bmRep == nil || color == nil) - return; + return self; if ([color colorSpaceName] != NSCalibratedRGBColorSpace) rgbColor = [color colorUsingColorSpaceName: NSCalibratedRGBColorSpace]; @@ -359,6 +361,8 @@ static EmacsImage *ImageList = nil; planes[2][i] = bb; } } + + return self; } @@ -379,7 +383,7 @@ static EmacsImage *ImageList = nil; [bmRep getBitmapDataPlanes: pixmapData]; for (i =0; i<4; i++) - bzero (pixmapData[i], width*height); + memset (pixmapData[i], 0, width*height); [self addRepresentation: bmRep]; return self; } |