]> git.ipfire.org Git - thirdparty/coreutils.git/commit
basenc: prefer signed to unsigned integers
authorPaul Eggert <eggert@cs.ucla.edu>
Fri, 27 Aug 2021 22:29:46 +0000 (15:29 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Sat, 28 Aug 2021 00:12:27 +0000 (17:12 -0700)
commit97d8dcc5ca433471eac0609c0e8d51d40082876f
tree2171fc25abecfe4f3cd37d270631c971640fa8dd
parent88562dc9c756f9d85c4e7f7769dff1e86d7a7a95
basenc: prefer signed to unsigned integers

This patch modifies basenc to prefer signed integers to
unsigned, as signed are less error-prone.
This patch also updates Gnulib to to latest, which updates Gnulib’s
base32 and base64 modules to prefer signed to unsigned integers.
* src/basenc.c: Include idx.h.
(struct base2_decode_context): Use unsigned char, not unsigned
for an octet that must fit in an unsigned char.
(base_encode, struct base_decode_context)
(base64_decode_ctx_wrapper, prepare_inbuf, base64url_encode)
(base64url_decode_ctx_wrapper, base32_decode_ctx_wrapper)
(base32hex_encode, base32hex_decode_ctx_wrapper, base16_encode)
(base16_decode_ctx, z85_encode, Z85_HI_CTX_TO_32BIT_VAL)
(z85_decoding, z85_decode_ctx, base2msbf_encode)
(base2lsbf_encode, base2lsbf_decode_ctx, base2msbf_decode_ctx)
(wrap_write, do_encode, do_decode, main):
Prefer signed integers to unsigned.
(main): Treat extremely large wrap columns as if they were
infinite; that’s good enough.  Since we’re now using xstrtoimax,
this allows ‘-w -0’ (same as ‘-w 0’).
* tests/misc/base64.pl (gen_tests): -w-0 is no longer an error.
gnulib
src/basenc.c
tests/misc/base64.pl