]> git.eshelyaron.com Git - emacs.git/commitdiff
(string_char_to_byte): Handle invalid multibyte sequence
authorKenichi Handa <handa@m17n.org>
Tue, 15 Dec 1998 04:35:38 +0000 (04:35 +0000)
committerKenichi Handa <handa@m17n.org>
Tue, 15 Dec 1998 04:35:38 +0000 (04:35 +0000)
correctly.
(string_byte_to_char): Likesize.

src/fns.c

index 6e7723ccaa08db81339c9d859d5304c7dabfe364..e406ce3ecfdb678dfa2ef5c5da4988fc4293185a 100644 (file)
--- 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--;
        }