emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] emacs-24 r116866: More backward-compatible fix to char-equ


From: Paul Eggert
Subject: [Emacs-diffs] emacs-24 r116866: More backward-compatible fix to char-equal core dump.
Date: Wed, 26 Mar 2014 17:55:36 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 116866
revision-id: address@hidden
parent: address@hidden
fixes bug: http://debbugs.gnu.org/17011
committer: Paul Eggert <address@hidden>
branch nick: emacs-24
timestamp: Wed 2014-03-26 10:55:31 -0700
message:
  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.
modified:
  src/ChangeLog                  changelog-20091113204419-o5vbwnq5f7feedwu-1438
  src/editfns.c                  editfns.c-20091113204419-o5vbwnq5f7feedwu-255
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2014-03-26 05:35:38 +0000
+++ b/src/ChangeLog     2014-03-26 17:55:31 +0000
@@ -1,4 +1,8 @@
-2014-03-26  Paul Eggert  <address@hidden>
+2014-03-26  Paul Eggert  <address@hidden>
+
+       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

=== modified file 'src/editfns.c'
--- a/src/editfns.c     2014-03-26 05:35:38 +0000
+++ b/src/editfns.c     2014-03-26 17:55:31 +0000
@@ -4377,13 +4377,23 @@
   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);
 }
 


reply via email to

[Prev in Thread] Current Thread [Next in Thread]