Squash more warns

This commit is contained in:
Sergey Lyubka 2022-07-04 11:43:52 +01:00
parent 4c9fdaf8b0
commit 735b7bece6
2 changed files with 2 additions and 2 deletions

View File

@ -5412,7 +5412,7 @@ char *mg_random_str(char *buf, size_t len) {
mg_random(buf, len);
for (i = 0; i < len; i++) {
uint8_t c = ((uint8_t *) buf)[i] % 62;
buf[i] = i == len - 1 ? '\0' // 0-terminate last byte
buf[i] = i == len - 1 ? (char) '\0' // 0-terminate last byte
: c < 26 ? (char) ('a' + c) // lowercase
: c < 52 ? (char) ('A' + c - 26) // uppercase
: (char) ('0' + c - 52); // numeric

View File

@ -26,7 +26,7 @@ char *mg_random_str(char *buf, size_t len) {
mg_random(buf, len);
for (i = 0; i < len; i++) {
uint8_t c = ((uint8_t *) buf)[i] % 62;
buf[i] = i == len - 1 ? '\0' // 0-terminate last byte
buf[i] = i == len - 1 ? (char) '\0' // 0-terminate last byte
: c < 26 ? (char) ('a' + c) // lowercase
: c < 52 ? (char) ('A' + c - 26) // uppercase
: (char) ('0' + c - 52); // numeric