From a1f3c5c296a6273e80453616f6ed2b0a0f73c519 Mon Sep 17 00:00:00 2001 From: Trent Huber Date: Sat, 15 Nov 2025 19:11:39 -0500 Subject: [PATCH] Update raylib to fix bug, clean up initializer lists --- external/cbs | 2 +- external/raylib | 2 +- src/build.c | 13 +++++++------ src/xpm.c | 10 +++------- 4 files changed, 12 insertions(+), 15 deletions(-) diff --git a/external/cbs b/external/cbs index e998819..011c66e 160000 --- a/external/cbs +++ b/external/cbs @@ -1 +1 @@ -Subproject commit e998819b1d1e191d035600967abd84e9f2eb9cf8 +Subproject commit 011c66e9c2332506752b701fdfa37739dde67f6a diff --git a/external/raylib b/external/raylib index 7103703..470a326 160000 --- a/external/raylib +++ b/external/raylib @@ -1 +1 @@ -Subproject commit 71037033137e692f1a39003e06f570fa2744dce3 +Subproject commit 470a3265882968b624f475f3c9f349be962adc43 diff --git a/src/build.c b/src/build.c index 6698c31..c74ebd0 100644 --- a/src/build.c +++ b/src/build.c @@ -25,8 +25,8 @@ #ifdef FONT static void buildcolors(void) { - int quit, txtfd, codefd; - char *txt, *code, *p; + int quit, txtfd, codefd, d; + char *txt, *code, *p, *decl; struct stat txtstat; size_t l, i; void *map; @@ -52,10 +52,11 @@ static void buildcolors(void) { goto munmap; } + decl = "struct color colors[] = {"; + d = (int)strlen(decl); if (dprintf(codefd, "#include \n\n" "#include \"colors.h\"\n\n" - "struct color colors[] = {\n" - "\t{\"None\", 0x00ffffff},\n") == -1) { + "%s{\"None\", 0x00ffffff},\n", decl) == -1) { warn("Unable to write to `%s'", code); goto closecode; } @@ -63,8 +64,8 @@ static void buildcolors(void) { r = strtol(p, &p, 10); g = strtol(p, &p, 10); b = strtol(p, &p, 10); - if (dprintf(codefd, "\t{\"%s\", 0x%02x%02x%02x},\n", - strsep(&p, "\n") + 2, r, g, b) == -1) { + if (dprintf(codefd, "%*s{\"%s\", 0x%02x%02x%02x},\n", + d, "", strsep(&p, "\n") + 2, r, g, b) == -1) { warn("Unable to write to `%s'", code); goto closecode; } diff --git a/src/xpm.c b/src/xpm.c index 408bc5a..7a2ead1 100644 --- a/src/xpm.c +++ b/src/xpm.c @@ -193,13 +193,9 @@ static void parse(char **data, long *sizep) { for (m = 0; m < NUMMODES; ++m) pixels[m * width * height + i * width + j] = colors[m * ncolors + k]; if (j != width || l != 0) warnx("Actual image width too narrow"); - else image = (Image){ - .data = pixels, - .width = width, - .height = height, - .mipmaps = 1, - .format = PIXELFORMAT_UNCOMPRESSED_R8G8B8A8, - }; + else image = (Image){.data = pixels, .width = width, .height = height, + .mipmaps = 1, + .format = PIXELFORMAT_UNCOMPRESSED_R8G8B8A8}; free: free(chars); -- 2.51.0