diff --git a/baseconv.c b/baseconv.c index 4d66799..f566522 100644 --- a/baseconv.c +++ b/baseconv.c @@ -7,7 +7,7 @@ static bool baseconv_internal( char outbuf[], size_t bufsize, - const char *digits, unsigned base, + const char *digits, size_t base, uintmax_t num ) { // Supported bases are 2 to number of digits inclusive @@ -48,7 +48,7 @@ static bool baseconv_internal( 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"; return baseconv_internal(outbuf, bufsize, digits, base, num); } diff --git a/baseconv.h b/baseconv.h index 4c4bafa..c7a8cf1 100644 --- a/baseconv.h +++ b/baseconv.h @@ -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); diff --git a/main.c b/main.c index 826fbc1..6030ec5 100644 --- a/main.c +++ b/main.c @@ -15,9 +15,9 @@ int main(void) { return 1; } - unsigned base; + size_t base; printf("Base? "); - if (scanf("%u", &base) != 1) { + if (scanf("%zu", &base) != 1) { fprintf(stderr, "Invalid input\n"); return 1; }