forked from M-Labs/nac3
1
0
Fork 0

standalone: Use uint32_t for cslice length

Matching the expected type of string and list slices.
This commit is contained in:
David Mak 2024-07-22 00:18:19 +08:00
parent f139db9af9
commit fd025c1137
1 changed files with 3 additions and 3 deletions

View File

@ -64,14 +64,14 @@ void output_asciiart(int32_t x) {
struct cslice { struct cslice {
void *data; void *data;
usize len; uint32_t len;
}; };
void output_int32_list(struct cslice *slice) { void output_int32_list(struct cslice *slice) {
const int32_t *data = (int32_t *) slice->data; const int32_t *data = (int32_t *) slice->data;
putchar('['); putchar('[');
for (usize i = 0; i < slice->len; ++i) { for (uint32_t i = 0; i < slice->len; ++i) {
if (i == slice->len - 1) { if (i == slice->len - 1) {
printf("%d", data[i]); printf("%d", data[i]);
} else { } else {
@ -85,7 +85,7 @@ void output_int32_list(struct cslice *slice) {
void output_str(struct cslice *slice) { void output_str(struct cslice *slice) {
const char *data = (const char *) slice->data; const char *data = (const char *) slice->data;
for (usize i = 0; i < slice->len; ++i) { for (uint32_t i = 0; i < slice->len; ++i) {
putchar(data[i]); putchar(data[i]);
} }
} }