summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBad Diode <bd@badd10de.dev>2021-05-20 10:10:45 +0200
committerBad Diode <bd@badd10de.dev>2021-05-20 10:10:45 +0200
commit717ea2fcdae2e3b895283adb5240a7e12794f43b (patch)
tree8306dca7d34b95fcf7335d039f7fffc22cf81047
parentc118943822514fee30084958a24a7d45a9016f46 (diff)
downloadgba-dev-tools-717ea2fcdae2e3b895283adb5240a7e12794f43b.tar.gz
gba-dev-tools-717ea2fcdae2e3b895283adb5240a7e12794f43b.zip
Fix formatting issues in corner case
-rw-r--r--bin2carr/src/main.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/bin2carr/src/main.c b/bin2carr/src/main.c
index f2d0569..1185b7f 100644
--- a/bin2carr/src/main.c
+++ b/bin2carr/src/main.c
@@ -1,6 +1,7 @@
1#include <getopt.h> 1#include <getopt.h>
2#include <stdio.h> 2#include <stdio.h>
3#include <stdlib.h> 3#include <stdlib.h>
4#include <string.h>
4 5
5#include "shorthand.h" 6#include "shorthand.h"
6 7
@@ -46,6 +47,10 @@ write_array(FILE *file_in, FILE *file_out, char *arr_name, ElemSize elem_size) {
46 arr_type = "s64"; 47 arr_type = "s64";
47 n_elem = 4; 48 n_elem = 4;
48 break; 49 break;
50 default:
51 arr_type = "u8";
52 n_elem = 8;
53 break;
49 } 54 }
50 fprintf(file_out, "%s %s[] = {\n", arr_type, arr_name); 55 fprintf(file_out, "%s %s[] = {\n", arr_type, arr_name);
51 size_t n_read = 0; 56 size_t n_read = 0;
@@ -93,6 +98,10 @@ write_array(FILE *file_in, FILE *file_out, char *arr_name, ElemSize elem_size) {
93 counter++; 98 counter++;
94 } 99 }
95 } while(n_read != 0); 100 } while(n_read != 0);
101 if (counter != 0) {
102 fseek(file_out, -1, SEEK_CUR);
103 fprintf(file_out, "\n");
104 }
96 fprintf(file_out, "};\n"); 105 fprintf(file_out, "};\n");
97} 106}
98 107