diff src/mule-charset.c @ 3676:3ef0aaf3dc34

[xemacs-hg @ 2006-11-12 13:40:04 by aidan] Prevent a crash if the ASCII charset registries match nothing.
author aidan
date Sun, 12 Nov 2006 13:40:09 +0000
parents 1d313cd71cd7
children 3131094eed8c
line wrap: on
line diff
--- a/src/mule-charset.c	Sat Nov 11 22:51:05 2006 +0000
+++ b/src/mule-charset.c	Sun Nov 12 13:40:09 2006 +0000
@@ -883,6 +883,14 @@
   return Qnil;
 }
 
+void
+set_charset_registries(Lisp_Object charset, Lisp_Object registries)
+{
+  XCHARSET_REGISTRIES (charset) = registries;
+  invalidate_charset_font_caches (charset);
+  face_property_was_changed (Vdefault_face, Qfont, Qglobal);
+}
+
 DEFUN ("set-charset-registries", Fset_charset_registries, 2, 2, 0, /*
 Set the `registries' property of CHARSET to REGISTRIES.
 
@@ -913,11 +921,19 @@
 	  invalid_argument("Not an X11 REGISTRY-ENCODING combination", 
 			   XVECTOR_DATA(registries)[i]);
 	}
+
+      if (qxestrchr(XSTRING_DATA(XVECTOR_DATA(registries)[i]), '*') ||
+	  qxestrchr(XSTRING_DATA(XVECTOR_DATA(registries)[i]), '?'))
+	{
+	  invalid_argument
+	    ("XLFD wildcards not allowed in charset-registries", 
+	     XVECTOR_DATA(registries)[i]);
+
+	}
     }
 
-  XCHARSET_REGISTRIES (charset) = registries;
-  invalidate_charset_font_caches (charset);
-  face_property_was_changed (Vdefault_face, Qfont, Qglobal);
+  set_charset_registries(charset, registries);
+
   return Qnil;
 }