aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKenichi Handa1998-12-15 04:35:38 +0000
committerKenichi Handa1998-12-15 04:35:38 +0000
commit67bfe42d769453352e17c53b7db2e095bf7d5523 (patch)
tree34cefe410dea505e710caef905e0a119a4af9c5b /src
parent040272ceb2552a84171db18185f53fccbb9fb12d (diff)
downloademacs-67bfe42d769453352e17c53b7db2e095bf7d5523.tar.gz
emacs-67bfe42d769453352e17c53b7db2e095bf7d5523.zip
(string_char_to_byte): Handle invalid multibyte sequence
correctly. (string_byte_to_char): Likesize.
Diffstat (limited to 'src')
-rw-r--r--src/fns.c4
1 files changed, 2 insertions, 2 deletions
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)
845 while (best_above_byte > 0 845 while (best_above_byte > 0
846 && !CHAR_HEAD_P (XSTRING (string)->data[best_above_byte])) 846 && !CHAR_HEAD_P (XSTRING (string)->data[best_above_byte]))
847 best_above_byte--; 847 best_above_byte--;
848 if (XSTRING (string)->data[best_above_byte] < 0x80) 848 if (!BASE_LEADING_CODE_P (XSTRING (string)->data[best_above_byte]))
849 best_above_byte = best_above_byte_saved; 849 best_above_byte = best_above_byte_saved;
850 best_above--; 850 best_above--;
851 } 851 }
@@ -911,7 +911,7 @@ string_byte_to_char (string, byte_index)
911 while (best_above_byte > 0 911 while (best_above_byte > 0
912 && !CHAR_HEAD_P (XSTRING (string)->data[best_above_byte])) 912 && !CHAR_HEAD_P (XSTRING (string)->data[best_above_byte]))
913 best_above_byte--; 913 best_above_byte--;
914 if (XSTRING (string)->data[best_above_byte] < 0x80) 914 if (!BASE_LEADING_CODE_P (XSTRING (string)->data[best_above_byte]))
915 best_above_byte = best_above_byte_saved; 915 best_above_byte = best_above_byte_saved;
916 best_above--; 916 best_above--;
917 } 917 }