patch 9.1.0041: xxd -i may generate incorrect C statements

Commit: 
https://github.com/vim/vim/commit/7062be13129985fe297b9a8e59c57b8f0db61b8f
Author: Kuratius <[email protected]>
Date:   Wed Jan 17 18:37:32 2024 +0100

    patch 9.1.0041: xxd -i may generate incorrect C statements
    
    Problem:  xxd -i may generate incorrect C statements
              (Kuratius)
    Solution: xxd: Make size type returned by -i option compatible
              with C standard by using type size_t instead of
              unsigned int (Kuratius)
    
    Also change affected tests to now correctly expect size_t's
    
    fixes: #13876
    closes: #13880
    
    Signed-off-by: Kuratius <[email protected]>
    Signed-off-by: Christian Brabandt <[email protected]>

diff --git a/src/testdir/test_xxd.vim b/src/testdir/test_xxd.vim
index 7a2771e03..a3f006b6f 100644
--- a/src/testdir/test_xxd.vim
+++ b/src/testdir/test_xxd.vim
@@ -103,7 +103,7 @@ func Test_xxd()
     unsigned char XXDfile[] = {
       0x54, 0x45, 0x53, 0x54, 0x61, 0x62, 0x63, 0x64, 0x30, 0x39, 0x0a
     };
-    unsigned int XXDfile_len = 11;
+    size_t XXDfile_len = 11;
   [CODE]
 
   call assert_equal(expected, getline(1,'$'), s:Mess(s:test))
@@ -119,7 +119,7 @@ func Test_xxd()
       unsigned char XXDFILE[] = {
         0x54, 0x45, 0x53, 0x54, 0x61, 0x62, 0x63, 0x64, 0x30, 0x39, 0x0a
       };
-      unsigned int XXDFILE_LEN = 11;
+      size_t XXDFILE_LEN = 11;
     [CODE]
     call assert_equal(expected, getline(1,'$'), s:Mess(s:test))
   endfor
@@ -233,7 +233,7 @@ func Test_xxd()
       unsigned char varName[] = {
         0x54, 0x45, 0x53, 0x54, 0x61, 0x62, 0x63, 0x64, 0x30, 0x39, 0x0a
       };
-      unsigned int varName_len = 11;
+      size_t varName_len = 11;
     [CODE]
 
     call assert_equal(expected, getline(1,'$'), s:Mess(s:test))
@@ -247,7 +247,7 @@ func Test_xxd()
     unsigned char StdIn[] = {
       0x54, 0x45, 0x53, 0x54, 0x61, 0x62, 0x63, 0x64, 0x30, 0x39, 0x0a
     };
-    unsigned int StdIn_len = 11;
+    size_t StdIn_len = 11;
   [CODE]
   call assert_equal(expected, getline(1,'$'), s:Mess(s:test))
 
@@ -263,7 +263,7 @@ func Test_xxd()
       unsigned char VARNAME[] = {
         0x54, 0x45, 0x53, 0x54, 0x61, 0x62, 0x63, 0x64, 0x30, 0x39, 0x0a
       };
-      unsigned int VARNAME_LEN = 11;
+      size_t VARNAME_LEN = 11;
     [CODE]
     call assert_equal(expected, getline(1,'$'), s:Mess(s:test))
   endfor
diff --git a/src/version.c b/src/version.c
index 924c6f175..04832e111 100644
--- a/src/version.c
+++ b/src/version.c
@@ -704,6 +704,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    41,
 /**/
     40,
 /**/
diff --git a/src/xxd/xxd.c b/src/xxd/xxd.c
index 20023e0ee..75de98281 100644
--- a/src/xxd/xxd.c
+++ b/src/xxd/xxd.c
@@ -59,6 +59,7 @@
  * 31.08.2023  -R never/auto/always prints colored output
  * 06.10.2023  enable -r -b to reverse bit dumps
  * 12.01.2024  disable auto-conversion for z/OS (MVS)
+ * 17.01.2024  use size_t instead of usigned int for code-generation (-i), 
#13876
  *
  * (c) 1990-1998 by Juergen Weigert ([email protected])
  *
@@ -139,7 +140,7 @@ extern void perror __P((char *));
 # endif
 #endif
 
-char version[] = "xxd 2024-01-12 by Juergen Weigert et al.";
+char version[] = "xxd 2024-01-17 by Juergen Weigert et al.";
 #ifdef WIN32
 char osver[] = " (Win32)";
 #else
@@ -977,7 +978,7 @@ main(int argc, char *argv[])
       if (varname != NULL)
        {
          fputs_or_die("};
", fpo);
-         FPRINTF_OR_DIE((fpo, "unsigned int %s", isdigit((unsigned 
char)varname[0]) ? "__" : ""));
+         FPRINTF_OR_DIE((fpo, "size_t %s", isdigit((unsigned char)varname[0]) 
? "__" : ""));
          for (e = 0; (c = varname[e]) != 0; e++)
            putc_or_die(isalnum((unsigned char)c) ? CONDITIONAL_CAPITALIZE(c) : 
'_', fpo);
          FPRINTF_OR_DIE((fpo, "_%s = %d;
", capitalize ? "LEN" : "len", p));

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/E1rQDiY-00HLoc-Ir%40256bit.org.

Raspunde prin e-mail lui