Fix memset in mg_iotest, add mg_random_str test

This commit is contained in:
Sergey Lyubka committed 2022-07-04 16:13:38 +01:00
1 parent e30ad43d36
commit 6c796b8552
4 files changed
+19 -6

No files matched your search

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