fix printing arrays

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