Update databases/mariadb105-server to version 10.5.17
[dports.git] / x11-toolkits / redkite / dragonfly / patch-tools_rkpng2c.c
1
2 WARNINGS
3      The basename() function returns a pointer to internal static storage
4      space that will be overwritten by subsequent calls.
5
6 $ rkpng2c about.png about_png.c rk_about_png
7 image size: 0x0
8 $ cat about_png.c
9 /**
10  * Generated with png2c
11  * File name: about.png
12  * Image size name: 0x0
13  */
14
15 const unsigned char about.png[] = {
16 };
17
18
19 --- tools/rkpng2c.c.orig        2020-10-25 12:39:57 UTC
20 +++ tools/rkpng2c.c
21 @@ -29,6 +29,10 @@
22  #define RK_VERSION_STR "1.0.0"
23  
24  #include <stdio.h>
25 +#ifdef __DragonFly__
26 +#include <stdlib.h>
27 +#include <string.h>
28 +#endif
29  #include <libgen.h>
30  #include <cairo/cairo.h>
31  
32 @@ -57,13 +61,23 @@ int main(int argc , char **argv)
33          }
34  
35          const unsigned char *buff = cairo_image_surface_get_data(image);
36 +#ifdef __DragonFly__
37 +        char *b1 = strdup(basename(argv[1]));
38 +        char *b3 = strdup(basename(argv[3]));
39 +#endif
40          fprintf(fptr, "/**\n"
41                        " * Generated with rkpng2c version %s, part of Redkite GUI toolkit.\n"
42                        " * File name: %s\n"
43                        " * Image size: %dx%d\n"
44                        " */\n"
45                        "\n"
46 +#ifdef __DragonFly__
47 +               "const unsigned char %s[] = {\n", RK_VERSION_STR, b1, w, h, b3);
48 +               free(b1);
49 +               free(b3);
50 +#else
51                  "const unsigned char %s[] = {\n", RK_VERSION_STR, basename(argv[1]), w, h, basename(argv[3]));
52 +#endif
53          for (int i = 0; i < w * h * 4; i++) {
54                  if ((i + 1) == 12 || (i + 1) % 12 == 0)
55                          fprintf(fptr, "0x%02x,\n", buff[i]);