fix printing arrays

This commit is contained in:
Freya Murphy 2023-12-14 20:20:39 -05:00
parent eaa1d434a0
commit 4198e0a819
No known key found for this signature in database
GPG key ID: 988032A5638EE799

View file

@ -35,9 +35,11 @@ static void tag_print_data(const tag_t *tag, int depth) {
break; break;
case TAG_BYTE_ARRAY: case TAG_BYTE_ARRAY:
printf("["); printf("[");
for (int32_t i = 0; i < tag->data.b_arr.size; i++) for (int32_t i = 0; i < tag->data.b_arr.size; i++) {
printf("%hhd,", tag->data.b_arr.data[i]); if (i != 0) printf(",");
printf("\b]"); printf("%hhd", tag->data.b_arr.data[i]);
}
printf("]");
break; break;
case TAG_STRING: case TAG_STRING:
if (tag->data.string.size > 1) if (tag->data.string.size > 1)
@ -65,15 +67,19 @@ static void tag_print_data(const tag_t *tag, int depth) {
break; break;
case TAG_INT_ARRAY: case TAG_INT_ARRAY:
printi(depth, "["); printi(depth, "[");
for (int32_t i = 0; i < tag->data.i_arr.size; i++) for (int32_t i = 0; i < tag->data.i_arr.size; i++) {
printf("%d,", tag->data.i_arr.data[i]); if (i != 0) printf(",");
printf("\b]"); printf("%d", tag->data.i_arr.data[i]);
}
printf("]");
break; break;
case TAG_LONG_ARRAY: case TAG_LONG_ARRAY:
printf("["); printf("[");
for (int32_t i = 0; i < tag->data.l_arr.size; i++) for (int32_t i = 0; i < tag->data.l_arr.size; i++) {
printf("%ld,", tag->data.l_arr.data[i]); if (i != 0) printf(",");
printf("\b]"); printf("%ld", tag->data.l_arr.data[i]);
}
printf("]");
break; break;
case TAG_END: case TAG_END:
break; break;