aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/image.c23
-rw-r--r--src/nsfns.m3
-rw-r--r--src/nsimage.m9
3 files changed, 16 insertions, 19 deletions
diff --git a/src/image.c b/src/image.c
index b34dc3e9161..07de4d31aa8 100644
--- a/src/image.c
+++ b/src/image.c
@@ -3153,19 +3153,16 @@ image_find_image_fd (Lisp_Object file, int *pfd)
3153 /* Try to find FILE in data-directory/images, then x-bitmap-file-path. */ 3153 /* Try to find FILE in data-directory/images, then x-bitmap-file-path. */
3154 fd = openp (search_path, file, Qnil, &file_found, 3154 fd = openp (search_path, file, Qnil, &file_found,
3155 pfd ? Qt : make_fixnum (R_OK), false, false); 3155 pfd ? Qt : make_fixnum (R_OK), false, false);
3156 if (fd >= 0 || fd == -2) 3156 if (fd == -2)
3157 { 3157 {
3158 file_found = ENCODE_FILE (file_found); 3158 /* The file exists locally, but has a file name handler.
3159 if (fd == -2) 3159 (This happens, e.g., under Auto Image File Mode.)
3160 { 3160 'openp' didn't open the file, so we should, because the
3161 /* The file exists locally, but has a file name handler. 3161 caller expects that. */
3162 (This happens, e.g., under Auto Image File Mode.) 3162 Lisp_Object encoded_name = ENCODE_FILE (file_found);
3163 'openp' didn't open the file, so we should, because the 3163 fd = emacs_open (SSDATA (encoded_name), O_RDONLY, 0);
3164 caller expects that. */
3165 fd = emacs_open (SSDATA (file_found), O_RDONLY, 0);
3166 }
3167 } 3164 }
3168 else /* fd < 0, but not -2 */ 3165 else if (fd < 0)
3169 return Qnil; 3166 return Qnil;
3170 if (pfd) 3167 if (pfd)
3171 *pfd = fd; 3168 *pfd = fd;
@@ -3173,8 +3170,8 @@ image_find_image_fd (Lisp_Object file, int *pfd)
3173} 3170}
3174 3171
3175/* Find image file FILE. Look in data-directory/images, then 3172/* Find image file FILE. Look in data-directory/images, then
3176 x-bitmap-file-path. Value is the encoded full name of the file 3173 x-bitmap-file-path. Value is the full name of the file found, or
3177 found, or nil if not found. */ 3174 nil if not found. */
3178 3175
3179Lisp_Object 3176Lisp_Object
3180image_find_image_file (Lisp_Object file) 3177image_find_image_file (Lisp_Object file)
diff --git a/src/nsfns.m b/src/nsfns.m
index d14f7b51eaf..98801d8526f 100644
--- a/src/nsfns.m
+++ b/src/nsfns.m
@@ -3024,7 +3024,8 @@ all_nonzero_ascii (unsigned char *str, ptrdiff_t n)
3024} 3024}
3025 3025
3026@implementation NSString (EmacsString) 3026@implementation NSString (EmacsString)
3027/* Make an NSString from a Lisp string. */ 3027/* Make an NSString from a Lisp string. STRING must not be in an
3028 encoded form (e.g. UTF-8). */
3028+ (NSString *)stringWithLispString:(Lisp_Object)string 3029+ (NSString *)stringWithLispString:(Lisp_Object)string
3029{ 3030{
3030 /* Shortcut for the common case. */ 3031 /* Shortcut for the common case. */
diff --git a/src/nsimage.m b/src/nsimage.m
index fa81a41a519..3c16cd371e6 100644
--- a/src/nsimage.m
+++ b/src/nsimage.m
@@ -254,15 +254,15 @@ ns_image_size_in_bytes (void *img)
254 NSImageRep *imgRep; 254 NSImageRep *imgRep;
255 Lisp_Object found; 255 Lisp_Object found;
256 EmacsImage *image; 256 EmacsImage *image;
257 NSString *filename;
257 258
258 /* Search bitmap-file-path for the file, if appropriate. */ 259 /* Search bitmap-file-path for the file, if appropriate. */
259 found = image_find_image_file (file); 260 found = image_find_image_file (file);
260 if (!STRINGP (found)) 261 if (!STRINGP (found))
261 return nil; 262 return nil;
262 found = ENCODE_FILE (found); 263 filename = [NSString stringWithLispString:found];
263 264
264 image = [[EmacsImage alloc] initByReferencingFile: 265 image = [[EmacsImage alloc] initByReferencingFile:filename];
265 [NSString stringWithLispString: found]];
266 266
267 image->bmRep = nil; 267 image->bmRep = nil;
268#ifdef NS_IMPL_COCOA 268#ifdef NS_IMPL_COCOA
@@ -277,8 +277,7 @@ ns_image_size_in_bytes (void *img)
277 } 277 }
278 278
279 [image setSize: NSMakeSize([imgRep pixelsWide], [imgRep pixelsHigh])]; 279 [image setSize: NSMakeSize([imgRep pixelsWide], [imgRep pixelsHigh])];
280 280 [image setName:filename];
281 [image setName: [NSString stringWithLispString: file]];
282 281
283 return image; 282 return image;
284} 283}