comparison src/unicode.c @ 3452:551c008d3777

[xemacs-hg @ 2006-06-14 06:10:08 by aidan] Fix snprintf problems with the Win32 build.
author aidan
date Wed, 14 Jun 2006 06:10:10 +0000
parents d1754e7f0cea
children 98af8a976fc3
comparison
equal deleted inserted replaced
3451:2a674bf63a86 3452:551c008d3777
1110 if (unicode_precedence_dynarr == charsets) 1110 if (unicode_precedence_dynarr == charsets)
1111 { 1111 {
1112 if (NILP (Vcurrent_jit_charset) || 1112 if (NILP (Vcurrent_jit_charset) ||
1113 (-1 == (i = get_free_codepoint(Vcurrent_jit_charset)))) 1113 (-1 == (i = get_free_codepoint(Vcurrent_jit_charset))))
1114 { 1114 {
1115 Ascbyte setname[32]; 1115 Ibyte setname[32];
1116 Lisp_Object charset_descr = build_string 1116 Lisp_Object charset_descr = build_string
1117 ("Mule charset for otherwise unknown Unicode code points."); 1117 ("Mule charset for otherwise unknown Unicode code points.");
1118 Lisp_Object charset_regr = build_string("iso10646-1"); 1118 Lisp_Object charset_regr = build_string("iso10646-1");
1119 1119
1120 struct gcpro gcpro1, gcpro2; 1120 struct gcpro gcpro1, gcpro2;
1123 { 1123 {
1124 /* This final byte shit is, umm, not that cool. */ 1124 /* This final byte shit is, umm, not that cool. */
1125 last_jit_charset_final = 0x30; 1125 last_jit_charset_final = 0x30;
1126 } 1126 }
1127 1127
1128 snprintf(setname, sizeof(setname), 1128 /* Assertion added partly because our Win32 layer doesn't
1129 "jit-ucs-charset-%d", number_of_jit_charsets++); 1129 support snprintf; with this, we're sure it won't overflow
1130 the buffer. */
1131 assert(100 > number_of_jit_charsets);
1132
1133 qxesprintf(setname, "jit-ucs-charset-%d", number_of_jit_charsets++);
1130 1134
1131 /* Aside: GCPROing here would be overkill according to the FSF's 1135 /* Aside: GCPROing here would be overkill according to the FSF's
1132 philosophy. make-charset cannot currently GC, but is intended 1136 philosophy. make-charset cannot currently GC, but is intended
1133 to be called from Lisp, with its arguments protected by the 1137 to be called from Lisp, with its arguments protected by the
1134 Lisp reader. We GCPRO in case it GCs in the future and no-one 1138 Lisp reader. We GCPRO in case it GCs in the future and no-one
1135 checks all the C callers. */ 1139 checks all the C callers. */
1136 1140
1137 GCPRO2 (charset_descr, charset_regr); 1141 GCPRO2 (charset_descr, charset_regr);
1138 Vcurrent_jit_charset = Fmake_charset 1142 Vcurrent_jit_charset = Fmake_charset
1139 (intern(setname), charset_descr, 1143 (intern((const CIbyte *)setname), charset_descr,
1140 /* Set encode-as-utf-8 to t, to have this character set written 1144 /* Set encode-as-utf-8 to t, to have this character set written
1141 using UTF-8 escapes in escape-quoted and ctext. This 1145 using UTF-8 escapes in escape-quoted and ctext. This
1142 sidesteps the fact that our internal character -> Unicode 1146 sidesteps the fact that our internal character -> Unicode
1143 mapping is not stable from one invocation to the next. */ 1147 mapping is not stable from one invocation to the next. */
1144 nconc2 (list2(Qencode_as_utf_8, Qt), 1148 nconc2 (list2(Qencode_as_utf_8, Qt),