texinfo-commits
[Top][All Lists]
Advanced

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

branch master updated: * info/nodes.c (DEFAULT_INFO_LOCAL_VAR_RANGE) (ge


From: Patrice Dumas
Subject: branch master updated: * info/nodes.c (DEFAULT_INFO_LOCAL_VAR_RANGE) (get_file_character_encoding, adjust_nodestart): avoid setting search binding end or start to negative numbers, even temporarily.
Date: Mon, 07 Oct 2024 17:20:16 -0400

This is an automated email from the git hooks/post-receive script.

pertusus pushed a commit to branch master
in repository texinfo.

The following commit(s) were added to refs/heads/master by this push:
     new 8437052e32 * info/nodes.c (DEFAULT_INFO_LOCAL_VAR_RANGE) 
(get_file_character_encoding, adjust_nodestart): avoid setting search binding 
end or start to negative numbers, even temporarily.
8437052e32 is described below

commit 8437052e32e332b048d2abea334d1668f0f182eb
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Mon Oct 7 23:20:06 2024 +0200

    * info/nodes.c (DEFAULT_INFO_LOCAL_VAR_RANGE)
    (get_file_character_encoding, adjust_nodestart): avoid setting
    search binding end or start to negative numbers, even temporarily.
---
 ChangeLog    |  6 ++++++
 info/nodes.c | 18 ++++++++++++------
 2 files changed, 18 insertions(+), 6 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index e852ed8f86..019f3357e8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2024-10-07  Patrice Dumas  <pertusus@free.fr>
+
+       * info/nodes.c (DEFAULT_INFO_LOCAL_VAR_RANGE)
+       (get_file_character_encoding, adjust_nodestart): avoid setting
+       search binding end or start to negative numbers, even temporarily.
+
 2024-10-07  Patrice Dumas  <pertusus@free.fr>
 
        * info/search.c (looking_at): modify comment, as the string is
diff --git a/info/nodes.c b/info/nodes.c
index 6c96227336..f5dfafb153 100644
--- a/info/nodes.c
+++ b/info/nodes.c
@@ -754,6 +754,8 @@ info_load_file (char *fullpath, int is_subfile)
   return file_buffer;
 }
 
+#define DEFAULT_INFO_LOCAL_VAR_RANGE 1000
+
 /* Look for local variables section in FB and set encoding */
 static void
 get_file_character_encoding (FILE_BUFFER *fb)
@@ -768,9 +770,10 @@ get_file_character_encoding (FILE_BUFFER *fb)
   /* See if there is a local variables section in this info file. */
   binding.buffer = fb->contents;
   binding.start = fb->filesize;
-  binding.end = binding.start - 1000;
-  if (binding.end < 0)
+  if (binding.start < DEFAULT_INFO_LOCAL_VAR_RANGE)
     binding.end = 0;
+  else
+    binding.end = binding.start - DEFAULT_INFO_LOCAL_VAR_RANGE;
   binding.flags = S_FoldCase;
 
   /* Null means the encoding is unknown. */
@@ -1125,13 +1128,16 @@ adjust_nodestart (FILE_BUFFER *fb, TAG *node)
          that accumulates throughout the file. */
       fudge += s.start >> 5;
 
-      s.start -= fudge;
       s.end += fudge;
 
-      if (s.start < 0)
+      if (s.start < fudge)
         s.start = 0;
-      else if (s.start > fb->filesize)
-        s.start = fb->filesize;
+      else
+        {
+          s.start -= fudge;
+          if (s.start > fb->filesize)
+            s.start = fb->filesize;
+        }
       if (s.end > fb->filesize)
         s.end = fb->filesize;
 



reply via email to

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