From: Kenichi Handa Date: Tue, 15 Dec 1998 04:35:38 +0000 (+0000) Subject: (string_char_to_byte): Handle invalid multibyte sequence X-Git-Tag: emacs-20.4~1072 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=67bfe42d769453352e17c53b7db2e095bf7d5523;p=emacs.git (string_char_to_byte): Handle invalid multibyte sequence correctly. (string_byte_to_char): Likesize. --- diff --git a/src/fns.c b/src/fns.c index 6e7723ccaa0..e406ce3ecfd 100644 --- a/src/fns.c +++ b/src/fns.c @@ -845,7 +845,7 @@ string_char_to_byte (string, char_index) while (best_above_byte > 0 && !CHAR_HEAD_P (XSTRING (string)->data[best_above_byte])) best_above_byte--; - if (XSTRING (string)->data[best_above_byte] < 0x80) + if (!BASE_LEADING_CODE_P (XSTRING (string)->data[best_above_byte])) best_above_byte = best_above_byte_saved; best_above--; } @@ -911,7 +911,7 @@ string_byte_to_char (string, byte_index) while (best_above_byte > 0 && !CHAR_HEAD_P (XSTRING (string)->data[best_above_byte])) best_above_byte--; - if (XSTRING (string)->data[best_above_byte] < 0x80) + if (!BASE_LEADING_CODE_P (XSTRING (string)->data[best_above_byte])) best_above_byte = best_above_byte_saved; best_above--; }