summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2014-03-26 10:55:31 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2014-03-26 10:55:31 -0700
commit3fd3e736934750c8b0e73b8327f0b75d3b09bf78 (patch)
tree61c9c1c31a18ad85201f8b3182a6dd33427fd1d6
parent196716cf35f81bea108c3b75362e92c86ed1c016 (diff)
downloademacs-3fd3e736934750c8b0e73b8327f0b75d3b09bf78.tar.gz
More backward-compatible fix to char-equal core dump.
* editfns.c (Fchar_equal): In unibyte buffers, assume values in range 128-255 are raw bytes. Suggested by Eli Zaretskii. Fixes: debbugs:17011
-rw-r--r--src/ChangeLog6
-rw-r--r--src/editfns.c20
2 files changed, 20 insertions, 6 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index bf27ece6af7..025ea45b23b 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,4 +1,8 @@
-2014-03-26 Paul Eggert <eggert@cs.ucla.edu>
+2014-03-26 Paul Eggert <eggert@penguin.cs.ucla.edu>
+
+ More backward-compatible fix to char-equal core dump (Bug#17011).
+ * editfns.c (Fchar_equal): In unibyte buffers, assume values in
+ range 128-255 are raw bytes. Suggested by Eli Zaretskii.
Fix core dump in char-equal (Bug#17011).
* editfns.c (Fchar_equal): Do not use MAKE_CHAR_MULTIBYTE in
diff --git a/src/editfns.c b/src/editfns.c
index 1986ee53d23..9c1fcb0b790 100644
--- a/src/editfns.c
+++ b/src/editfns.c
@@ -4377,13 +4377,23 @@ Case is ignored if `case-fold-search' is non-nil in the current buffer. */)
if (NILP (BVAR (current_buffer, case_fold_search)))
return Qnil;
- /* FIXME: When enable-multibyte-characters is nil, it's still possible
- to manipulate multibyte chars, which means there is a bug for chars
- in the range 128-255 as we can't tell whether they are eight-bit
- bytes or Latin-1 chars. For now, assume the latter. See Bug#17011.
- Also see casefiddle.c's casify_object, which has a similar problem. */
i1 = XFASTINT (c1);
i2 = XFASTINT (c2);
+
+ /* FIXME: It is possible to compare multibyte characters even when
+ the current buffer is unibyte. Unfortunately this is ambiguous
+ for characters between 128 and 255, as they could be either
+ eight-bit raw bytes or Latin-1 characters. Assume the former for
+ now. See Bug#17011, and also see casefiddle.c's casify_object,
+ which has a similar problem. */
+ if (NILP (BVAR (current_buffer, enable_multibyte_characters)))
+ {
+ if (SINGLE_BYTE_CHAR_P (i1))
+ i1 = UNIBYTE_TO_CHAR (i1);
+ if (SINGLE_BYTE_CHAR_P (i2))
+ i2 = UNIBYTE_TO_CHAR (i2);
+ }
+
return (downcase (i1) == downcase (i2) ? Qt : Qnil);
}