]> Trent Huber's Code - xpmview.git/commitdiff
Update raylib to fix bug, clean up initializer lists
authorTrent Huber <trentmhuber@gmail.com>
Sun, 16 Nov 2025 00:11:39 +0000 (19:11 -0500)
committerTrent Huber <trentmhuber@gmail.com>
Sun, 16 Nov 2025 00:11:39 +0000 (19:11 -0500)
external/cbs
external/raylib
src/build.c
src/xpm.c

index e998819b1d1e191d035600967abd84e9f2eb9cf8..011c66e9c2332506752b701fdfa37739dde67f6a 160000 (submodule)
@@ -1 +1 @@
-Subproject commit e998819b1d1e191d035600967abd84e9f2eb9cf8
+Subproject commit 011c66e9c2332506752b701fdfa37739dde67f6a
index 71037033137e692f1a39003e06f570fa2744dce3..470a3265882968b624f475f3c9f349be962adc43 160000 (submodule)
@@ -1 +1 @@
-Subproject commit 71037033137e692f1a39003e06f570fa2744dce3
+Subproject commit 470a3265882968b624f475f3c9f349be962adc43
index 6698c315d941009ee6bb033c537255c9c7beaedc..c74ebd0bb2090ae493469f49b29c4ef70c727ec4 100644 (file)
@@ -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 <stddef.h>\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;
        }
index 408bc5a7d299dfb9d14bf3472c4ed5e7c0a398eb..7a2ead1a5d3042cf7c4fd69301b9115a6e8a6337 100644 (file)
--- 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);