Switch type of base parameter to better handle corner cases
This commit is contained in:
parent
17a13cc101
commit
cba8f303a9
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
static bool baseconv_internal(
|
static bool baseconv_internal(
|
||||||
char outbuf[], size_t bufsize,
|
char outbuf[], size_t bufsize,
|
||||||
const char *digits, unsigned base,
|
const char *digits, size_t base,
|
||||||
uintmax_t num
|
uintmax_t num
|
||||||
) {
|
) {
|
||||||
// Supported bases are 2 to number of digits inclusive
|
// Supported bases are 2 to number of digits inclusive
|
||||||
|
@ -48,7 +48,7 @@ static bool baseconv_internal(
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool baseconv(char outbuf[], size_t bufsize, unsigned base, uintmax_t num) {
|
bool baseconv(char outbuf[], size_t bufsize, size_t base, uintmax_t num) {
|
||||||
const char *digits = "0123456789abcdefghijklmnopqrstuvwxyz";
|
const char *digits = "0123456789abcdefghijklmnopqrstuvwxyz";
|
||||||
return baseconv_internal(outbuf, bufsize, digits, base, num);
|
return baseconv_internal(outbuf, bufsize, digits, base, num);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,2 +1,2 @@
|
||||||
bool baseconv(char outbuf[], size_t bufsize, unsigned base, uintmax_t num);
|
bool baseconv(char outbuf[], size_t bufsize, size_t base, uintmax_t num);
|
||||||
bool baseconv_digits(char outbuf[], size_t bufsize, const char *digits, uintmax_t num);
|
bool baseconv_digits(char outbuf[], size_t bufsize, const char *digits, uintmax_t num);
|
||||||
|
|
Loading…
Reference in New Issue