Skip to content

Commit 6359e27

Browse files
committed
ignore extension case
1 parent a096b7b commit 6359e27

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

main.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ bool dds2tex(const char* dds_path)
155155
}
156156
}
157157

158-
char tex_path[input_path_length];
158+
char tex_path[input_path_length + 1];
159159
memcpy(tex_path, dds_path, input_path_length);
160160
memcpy(tex_path + input_path_length - 4, ".tex", 5);
161161
FILE* tex_file = fopen(tex_path, "wb");
@@ -253,7 +253,7 @@ bool tex2dds(const char* tex_path)
253253
}
254254
memcpy(ddspf.dwFourCC, dds_format, 4);
255255

256-
char dds_path[input_path_length];
256+
char dds_path[input_path_length + 1];
257257
memcpy(dds_path, tex_path, input_path_length);
258258
memcpy(dds_path + input_path_length - 4, ".dds", 5);
259259
FILE* dds_file = fopen(dds_path, "wb");
@@ -329,9 +329,9 @@ int main(int argc, char* argv[])
329329
for (int i = 1; i < argc; i++) {
330330
input_path_length = strlen(argv[i]);
331331
if (input_path_length > 4) {
332-
if (strcmp(argv[i] + input_path_length - 4, ".dds") == 0) {
332+
if (strcasecmp(argv[i] + input_path_length - 4, ".dds") == 0) {
333333
success = dds2tex(argv[i]) && success;
334-
} else if (strcmp(argv[i] + input_path_length - 4, ".tex") == 0) {
334+
} else if (strcasecmp(argv[i] + input_path_length - 4, ".tex") == 0) {
335335
success = tex2dds(argv[i]) && success;
336336
} else {
337337
fprintf(stderr, "Error: \"%s\" is neither a .dds or .tex file!\n", argv[i]);

0 commit comments

Comments
 (0)