mirror of
https://github.com/zeldaret/oot
synced 2026-05-22 22:44:26 -04:00
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
This commit is contained in:
@@ -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';
|
||||
|
||||
Reference in New Issue
Block a user