Avoid strtoul

This is part of the general trend to prefer signed integer types,
to allow better runtime checking with -fsanitize=undefined etc.
* gnulib.modules: Remove strtoul.  Add xstrtoimax.
* src/checkpoint.c (checkpoint, format_checkpoint_string):
* src/system.c (sys_exec_checkpoint_script):
* src/tar.c (checkpoint_option):
Use intmax_t, not unsigned, for checkpoint numbers.
All uses changed.
* src/checkpoint.c (checkpoint_compile_action): Don’t assume
time_t == unsigned long.  Treat overflows as TYPE_MAXIMUM (time_t),
essentially infinity.
* src/tar.c (tar_sparse_major, tar_sparse_minor):
* src/tar.h (struct tar_stat_info):
Use intmax_t, not unsigned, for sparse major and minor.
All uses changed.
* src/tar.c (parse_opt):
Don’t mishandle multiple specifications of sparse major and minor.
* src/transform.c (struct transform):
Use idx_t, not unsigned, for match_number.  All uses changed.
(parse_transform_expr): Don’t mishandle large match numbers
by wrapping them around.
This commit is contained in:
Paul Eggert
2024-08-14 23:25:45 -07:00
parent a80f364662
commit 4642cd04ed
8 changed files with 59 additions and 39 deletions
+1 -1
View File
@@ -108,7 +108,6 @@ strerror
strnlen
strtoimax
strtol
strtoul
strtoumax
symlinkat
sys_stat
@@ -123,6 +122,7 @@ xalignalloc
xalloc
xalloc-die
xgetcwd
xstrtoimax
xstrtoumax
xvasprintf
year2038-recommended