summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTanner Johnson <tannerwj@users.noreply.github.com>2026-03-14 15:39:32 -0600
committerGitHub <noreply@github.com>2026-03-14 21:39:32 +0000
commit1ccf13ff635475e6f3aaf2cba00056a8cb644c05 (patch)
treec93f4b386e876ba21334579c3c1bc46d7e5fa566
parent34a40816fa69b0c6fe47829896bb7a90b16d568d (diff)
tools/assets: fix build_from_png with Apple clang (#2724)
* tools/assets: fix build_from_png with Apple clang * tools/assets: use macro for build_from_png suffix limit
-rw-r--r--tools/assets/build_from_png/build_from_png.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/tools/assets/build_from_png/build_from_png.c b/tools/assets/build_from_png/build_from_png.c
index 0af45ce06..5a0829e04 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';