From: tomo Date: Mon, 15 Mar 2004 13:17:02 +0000 (+0000) Subject: (char_encode_as_entity_reference): Allow prefix within 8 characters; X-Git-Tag: r21-4-14-chise-0_21-25-si-same^2~75 X-Git-Url: http://git.chise.org/gitweb/?a=commitdiff_plain;h=08e93b9be3f5bc29996825e7192baefe9602339e;p=chise%2Fxemacs-chise.git- (char_encode_as_entity_reference): Allow prefix within 8 characters; fix infinite loop. --- diff --git a/src/text-coding.c b/src/text-coding.c index d8322a0..3c19e20 100644 --- a/src/text-coding.c +++ b/src/text-coding.c @@ -3375,7 +3375,7 @@ char_encode_as_entity_reference (Emchar ch, char* buf) Lisp_Object ccs; Lisp_Object char_type; int format_columns, idx; - char format[18]; + char format[20]; while (!NILP (rest)) { @@ -3400,14 +3400,14 @@ char_encode_as_entity_reference (Emchar ch, char* buf) cell = Fcdr (cell); ret = Fcar (cell); - if (STRINGP (ret) && ((idx = XSTRING_LENGTH (ret)) <= 6)) + if (STRINGP (ret) && ( (idx = XSTRING_LENGTH (ret)) <= 8 )) { format[0] = '&'; strncpy (&format[1], XSTRING_DATA (ret), idx); idx++; } else - continue; + goto try_next; cell = Fcdr (cell); ret = Fcar (cell); @@ -3431,7 +3431,7 @@ char_encode_as_entity_reference (Emchar ch, char* buf) else if (EQ (ret, QX)) format [idx++] = 'X'; else - continue; + goto try_next; format [idx++] = ';'; format [idx++] = 0; @@ -3439,6 +3439,7 @@ char_encode_as_entity_reference (Emchar ch, char* buf) return; } } + try_next: rest = Fcdr (rest); } sprintf (buf, "&MCS-%08X;", ch);