texinfo-commits
[Top][All Lists]
Advanced

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

branch master updated: * info/session.c (ask_for_search_string): explici


From: Patrice Dumas
Subject: branch master updated: * info/session.c (ask_for_search_string): explicitely convert the min_search_length variable to size_t before comparing with mbslen.
Date: Wed, 09 Oct 2024 11:31:52 -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 b942fb12d7 * info/session.c (ask_for_search_string): explicitely 
convert the min_search_length variable to size_t before comparing with mbslen.
b942fb12d7 is described below

commit b942fb12d725f9865cf43ffe989ce17bd1890138
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Wed Oct 9 17:31:41 2024 +0200

    * info/session.c (ask_for_search_string): explicitely convert the
    min_search_length variable to size_t before comparing with mbslen.
    
    * info/util.c (text_buffer_fill): use size_t to be consistent.
---
 ChangeLog      | 7 +++++++
 info/session.c | 5 ++++-
 info/util.c    | 2 +-
 3 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 88b0c0a58e..f57c1d15f3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2024-10-09  Patrice Dumas  <pertusus@free.fr>
+
+       * info/session.c (ask_for_search_string): explicitely convert the
+       min_search_length variable to size_t before comparing with mbslen.
+
+       * info/util.c (text_buffer_fill): use size_t to be consistent.
+
 2024-10-09  Patrice Dumas  <pertusus@free.fr>
 
        * info/session.c (move_to_goal_column): use size_t for long.  The
diff --git a/info/session.c b/info/session.c
index d783fe72f8..1b1c790a41 100644
--- a/info/session.c
+++ b/info/session.c
@@ -4254,6 +4254,9 @@ static int
 ask_for_search_string (int case_sensitive, int use_regex, int direction)
 {
   char *line, *prompt;
+  /* convert int to size_t for comparison with string length.  Bogus
+    values obtained with negative values should not be a concern. */
+  size_t min_length = min_search_length;
 
   if (search_string)
     xasprintf (&prompt, _("%s%s%s [%s]: "),
@@ -4280,7 +4283,7 @@ ask_for_search_string (int case_sensitive, int use_regex, 
int direction)
       return 1;
     }
 
-  if (mbslen (line) < min_search_length)
+  if (mbslen (line) < min_length)
     {
       info_error ("%s", _("Search string too short"));
       free (line);
diff --git a/info/util.c b/info/util.c
index 8e6d025cb2..64f80e8299 100644
--- a/info/util.c
+++ b/info/util.c
@@ -386,7 +386,7 @@ size_t
 text_buffer_fill (struct text_buffer *buf, int c, size_t len)
 {
   char *p;
-  int i;
+  size_t i;
   
   text_buffer_alloc (buf, len);
   



reply via email to

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