]> git.ipfire.org Git - thirdparty/tar.git/commit
Prefer other types to int in buffer.c
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)
commita337cd35a0c461bd3c434dcf39aee29a99b35a39
tree74dcf6fa337b92c25182cb21e49e731491c615a3
parent5a7185ae314ca104c095d5a4e515189cde784e77
Prefer other types to int in buffer.c

This increases the volume number maximum from 2**31 - 1 to 2**63 - 1.
* src/buffer.c (record_index, inhibit_map, new_volume):
Prefer bool to int for booleans.
* src/buffer.c (volno, global_volno):
* src/system.c (sys_exec_info_script):
Prefer intmax_t to int.
* src/buffer.c (increase_volume_number): Omit by-hand check for
overflow that relied on undefined behavior.
(new_volume): Check for that overflow here instead, without
relying on undefined behavior.
(print_stats): Avoid undefined behavior if printf sums overflow,
and reliably treat printf error like overflow.
* src/common.h (add_printf): New inline function.
src/buffer.c
src/common.h
src/system.c