]> git.ipfire.org Git - thirdparty/tar.git/commitdiff
Prefer intmax_t for occurrence counts
authorPaul Eggert <eggert@cs.ucla.edu>
Fri, 1 Nov 2024 16:40:36 +0000 (09:40 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Sat, 2 Nov 2024 06:47:23 +0000 (23:47 -0700)
* src/common.h (struct name):
* src/tar.c (occurrence_option, parse_opt):
Use intmax_t, not uintmax_t, for occurrence counts.

src/common.h
src/tar.c

index 4394f50bdd8d7c04313b9d448cf12d724766c9f3..15755b7b078e99fd2364650940c73474fc8ec48f 100644 (file)
@@ -172,7 +172,7 @@ extern const char *info_script_option;
 extern bool interactive_option;
 
 /* If nonzero, extract only Nth occurrence of each named file */
-extern uintmax_t occurrence_option;
+extern intmax_t occurrence_option;
 
 enum old_files
 {
@@ -361,7 +361,7 @@ struct name
 
     idx_t change_dir;          /* Number of the directory to change to.
                                   Set with the -C option. */
-    uintmax_t found_count;     /* number of times a matching file has
+    intmax_t found_count;      /* number of times a matching file has
                                   been found */
 
     /* The following members are used for incremental dumps only,
index 3eb02f435cf994598d43e9ee1b6073a06b31013a..af02d5189376b63fdb16cfa149bceca1bef10ea2 100644 (file)
--- a/src/tar.c
+++ b/src/tar.c
@@ -56,7 +56,7 @@ bool ignore_zeros_option;
 bool incremental_option;
 const char *info_script_option;
 bool interactive_option;
-uintmax_t occurrence_option;
+intmax_t occurrence_option;
 enum old_files old_files_option;
 bool keep_directory_symlink_option;
 const char *listed_incremental_option;
@@ -2007,7 +2007,7 @@ parse_opt (int key, char *arg, struct argp_state *state)
       else
        {
          char *end;
-         occurrence_option = stoint (arg, &end, NULL, 0, UINTMAX_MAX);
+         occurrence_option = stoint (arg, &end, NULL, 0, INTMAX_MAX);
          if (*end)
            paxfatal (0, "%s: %s", quotearg_colon (arg), _("Invalid number"));
        }