mirror of
git://git.sv.gnu.org/coreutils.git
synced 2026-04-21 03:12:48 +02:00
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.
This commit is contained in:
@@ -91,9 +91,6 @@ sub gen_tests($)
|
||||
['wrap-bad-3', '-w-1', {IN=>''}, {OUT=>""},
|
||||
{ERR_SUBST => 's/base..:/base..:/'},
|
||||
{ERR => "base..: invalid wrap size: '-1'\n"}, {EXIT => 1}],
|
||||
['wrap-bad-4', '-w-0', {IN=>''}, {OUT=>""},
|
||||
{ERR_SUBST => 's/base..:/base..:/'},
|
||||
{ERR => "base..: invalid wrap size: '-0'\n"}, {EXIT => 1}],
|
||||
|
||||
['buf-1', '--decode', {IN=>&$enc(1)}, {OUT=>'a' x 1}],
|
||||
['buf-2', '--decode', {IN=>&$enc(2)}, {OUT=>'a' x 2}],
|
||||
|
||||
Reference in New Issue
Block a user