merge from trunk

This commit is contained in:
Joakim Verona 2013-08-13 20:27:11 +02:00
commit 527a4d099e
2 changed files with 18 additions and 5 deletions

View file

@ -1,3 +1,8 @@
2013-08-13 Lars Magne Ingebrigtsen <larsi@gnus.org>
* image.c (imagemagick_filename_hint): Check for errors in the
alist structure.
2013-08-13 Eli Zaretskii <eliz@gnu.org>
* window.c (Fwindow_margins): Return nil when there's no marginal

View file

@ -7853,19 +7853,27 @@ imagemagick_filename_hint (Lisp_Object spec)
{
Lisp_Object content_type = image_spec_value (spec, QCcontent_type, NULL);
Lisp_Object symbol = intern ("image-content-type-suffixes");
Lisp_Object suffix;
Lisp_Object val;
char *name, *prefix = "/tmp/foo.";
if (NILP (Fboundp (symbol)))
return NULL;
suffix = Fcar (Fcdr (Fassq (content_type, Fsymbol_value (symbol))));
if (! STRINGP (suffix))
val = Fassq (content_type, Fsymbol_value (symbol));
if (! CONSP (val))
return NULL;
name = xmalloc (strlen (prefix) + SBYTES (suffix) + 1);
val = Fcdr (val);
if (! CONSP (val))
return NULL;
val = Fcar (val);
if (! STRINGP (val))
return NULL;
name = xmalloc (strlen (prefix) + SBYTES (val) + 1);
strcpy(name, prefix);
strcat(name, SDATA (suffix));
strcat(name, SDATA (val));
return name;
}