diff options
| author | Paul Eggert | 2015-08-18 16:17:30 -0700 |
|---|---|---|
| committer | Paul Eggert | 2015-08-18 16:24:56 -0700 |
| commit | 636736861688abe73cc5dd4181fdb66de3fd8cfd (patch) | |
| tree | 94e6780e22be312f57d32ef1b8768b4708c8cc45 /src/gtkutil.c | |
| parent | 345284f5e9eebb07536d12c08c72f1bab02ea55e (diff) | |
| download | emacs-636736861688abe73cc5dd4181fdb66de3fd8cfd.tar.gz emacs-636736861688abe73cc5dd4181fdb66de3fd8cfd.zip | |
Fix file name encodings in diagnostics
Also, close some minor races when opening image files, by opening
them once instead of multiple times.
* src/gtkutil.c (xg_get_image_for_pixmap):
* src/image.c (xpm_load, tiff_load, gif_load, imagemagick_load)
(svg_load):
* src/nsimage.m (allocInitFromFile:):
* src/xfns.c (xg_set_icon):
Encode file name, since x_find_image_file no longer does that.
* src/image.c (x_find_image_fd): New function.
(x_find_image_file): Use it. Do not encode resulting file name,
since callers sometimes need it decoded.
(slurp_file): File arg is now a fd, not a file name.
All callers changed. This saves us having to open the file twice.
(xbm_load, xpm_load, pbm_load, png_load_body, jpeg_load_body)
(svg_load):
Use x_find_image_fd and fdopen to save a file-open.
Report file name that failed.
* src/lread.c (openp): If PREDICATE is t, open the file in binary mode.
Diffstat (limited to 'src/gtkutil.c')
| -rw-r--r-- | src/gtkutil.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/gtkutil.c b/src/gtkutil.c index a4b4331c039..d684cd90888 100644 --- a/src/gtkutil.c +++ b/src/gtkutil.c | |||
| @@ -382,10 +382,11 @@ xg_get_image_for_pixmap (struct frame *f, | |||
| 382 | if (STRINGP (specified_file) | 382 | if (STRINGP (specified_file) |
| 383 | && STRINGP (file = x_find_image_file (specified_file))) | 383 | && STRINGP (file = x_find_image_file (specified_file))) |
| 384 | { | 384 | { |
| 385 | char *encoded_file = SSDATA (ENCODE_FILE (file)); | ||
| 385 | if (! old_widget) | 386 | if (! old_widget) |
| 386 | old_widget = GTK_IMAGE (gtk_image_new_from_file (SSDATA (file))); | 387 | old_widget = GTK_IMAGE (gtk_image_new_from_file (encoded_file)); |
| 387 | else | 388 | else |
| 388 | gtk_image_set_from_file (old_widget, SSDATA (file)); | 389 | gtk_image_set_from_file (old_widget, encoded_file); |
| 389 | 390 | ||
| 390 | return GTK_WIDGET (old_widget); | 391 | return GTK_WIDGET (old_widget); |
| 391 | } | 392 | } |