diff --git a/tools/assets/build_from_png/build_from_png.c b/tools/assets/build_from_png/build_from_png.c index 0af45ce06d..5a0829e049 100644 --- a/tools/assets/build_from_png/build_from_png.c +++ b/tools/assets/build_from_png/build_from_png.c @@ -17,6 +17,7 @@ #include "../n64texconv/src/libn64texconv/n64texconv.h" #define NUM_FORMATS 9 +#define MAX_N_SUFFIXES 5 static const struct fmt_info { const char* name; int fmt; @@ -57,8 +58,7 @@ static bool strendswith(const char* s, const char* suffix) { static bool parse_png_p(char* png_p_buf, const struct fmt_info** fmtp, enum sub_format* subfmt, int* elem_sizep, size_t* len_png_p_prefix, char** tlut_namep, int* tlut_elem_sizep, bool print_err) { // The last 5 (or less) suffixes, without the '.' - const int max_n_suffixes = 5; - char* png_p_suffixes[max_n_suffixes]; + char* png_p_suffixes[MAX_N_SUFFIXES]; int n_suffixes_found = 0; size_t i = strlen(png_p_buf); while (i != 0) { @@ -66,7 +66,7 @@ static bool parse_png_p(char* png_p_buf, const struct fmt_info** fmtp, enum sub_ if (png_p_buf[i] == '.') { png_p_suffixes[n_suffixes_found] = &png_p_buf[i + 1]; n_suffixes_found++; - if (n_suffixes_found >= max_n_suffixes) { + if (n_suffixes_found >= MAX_N_SUFFIXES) { break; } png_p_buf[i] = '\0';