emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] master c8431a0: Fix bug when hashing reversed buffer regio


From: Paul Eggert
Subject: [Emacs-diffs] master c8431a0: Fix bug when hashing reversed buffer regions
Date: Mon, 10 Dec 2018 16:41:28 -0500 (EST)

branch: master
commit c8431a06e4f2209f1c5ba30e2d6a70f284dc4678
Author: Paul Eggert <address@hidden>
Commit: Paul Eggert <address@hidden>

    Fix bug when hashing reversed buffer regions
    
    * src/fns.c (extract_data_from_object): When checking
    file-coding-system-alist, calculate the coding system
    correctly even if START and END are out of order.
    Use bool for booleans.
---
 src/fns.c | 19 +++++++++++--------
 1 file changed, 11 insertions(+), 8 deletions(-)

diff --git a/src/fns.c b/src/fns.c
index 9ef9601..79d0a96 100644
--- a/src/fns.c
+++ b/src/fns.c
@@ -4997,7 +4997,8 @@ extract_data_from_object (Lisp_Object spec,
        }
 
       if (STRING_MULTIBYTE (object))
-       object = code_convert_string (object, coding_system, Qnil, 1, 0, 1);
+       object = code_convert_string (object, coding_system,
+                                     Qnil, true, false, true);
 
       ptrdiff_t size = SCHARS (object), start_char, end_char;
       validate_subarray (object, start, end, size, &start_char, &end_char);
@@ -5052,7 +5053,7 @@ extract_data_from_object (Lisp_Object spec,
            coding_system = Vcoding_system_for_write;
          else
            {
-             bool force_raw_text = 0;
+             bool force_raw_text = false;
 
              coding_system = BVAR (XBUFFER (object), 
buffer_file_coding_system);
              if (NILP (coding_system)
@@ -5060,14 +5061,15 @@ extract_data_from_object (Lisp_Object spec,
                {
                  coding_system = Qnil;
                  if (NILP (BVAR (current_buffer, enable_multibyte_characters)))
-                   force_raw_text = 1;
+                   force_raw_text = true;
                }
 
              if (NILP (coding_system) && !NILP (Fbuffer_file_name (object)))
                {
                  /* Check file-coding-system-alist.  */
                  Lisp_Object val = CALLN (Ffind_operation_coding_system,
-                                          Qwrite_region, start, end,
+                                          Qwrite_region,
+                                          make_fixnum (b), make_fixnum (e),
                                           Fbuffer_file_name (object));
                  if (CONSP (val) && !NILP (XCDR (val)))
                    coding_system = XCDR (val);
@@ -5103,14 +5105,15 @@ extract_data_from_object (Lisp_Object spec,
            }
        }
 
-      object = make_buffer_string (b, e, 0);
+      object = make_buffer_string (b, e, false);
       set_buffer_internal (prev);
       /* Discard the unwind protect for recovering the current
         buffer.  */
       specpdl_ptr--;
 
       if (STRING_MULTIBYTE (object))
-       object = code_convert_string (object, coding_system, Qnil, 1, 0, 0);
+       object = code_convert_string (object, coding_system,
+                                     Qnil, true, false, false);
       *start_byte = 0;
       *end_byte = SBYTES (object);
     }
@@ -5395,7 +5398,7 @@ invoked by mouse clicks and mouse menu items.
 
 On some platforms, file selection dialogs are also enabled if this is
 non-nil.  */);
-  use_dialog_box = 1;
+  use_dialog_box = true;
 
   DEFVAR_BOOL ("use-file-dialog", use_file_dialog,
     doc: /* Non-nil means mouse commands use a file dialog to ask for files.
@@ -5403,7 +5406,7 @@ This applies to commands from menus and tool bar buttons 
even when
 they are initiated from the keyboard.  If `use-dialog-box' is nil,
 that disables the use of a file dialog, regardless of the value of
 this variable.  */);
-  use_file_dialog = 1;
+  use_file_dialog = true;
 
   defsubr (&Sidentity);
   defsubr (&Srandom);



reply via email to

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