Upstream patch.
diff --git a/debian/patches/incompatible-pointer-types.patch b/debian/patches/incompatible-pointer-types.patch
new file mode 100644
index 0000000..4e9a2bf
--- /dev/null
+++ b/debian/patches/incompatible-pointer-types.patch
@@ -0,0 +1,167 @@
+From 2b9d8f5bac5d2352f8021548b4852014ed683b2c Mon Sep 17 00:00:00 2001
+From: Alan Coopersmith <alan.coopersm...@oracle.com>
+Date: Tue, 5 Dec 2023 15:41:28 -0800
+Subject: [PATCH] Fix -Wincompatible-pointer-types warning from gcc (issue #1)
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+xlsfonts.c: In function ‘get_list’:
+xlsfonts.c:204:23: warning: assignment to ‘char **’ from incompatible
+ pointer type ‘const char **’ [-Wincompatible-pointer-types]
+  204 |                 fonts = &pattern;
+      |                       ^
+
+v2: Split the open vs. list code to allow preserving the constness
+of the argument to get_list, at the cost of less code sharing between
+the two paths
+
+Closes: #1
+Signed-off-by: Alan Coopersmith <alan.coopersm...@oracle.com>
+
+--- a/xlsfonts/xlsfonts.c
++++ b/xlsfonts/xlsfonts.c
+@@ -58,7 +58,7 @@ static int  font_cnt                  = 0;
+ static int  min_max;
+ 
+ typedef struct {
+-    char *name;
++    const char *name;
+     XFontStruct *info;
+ } FontList;
+ 
+@@ -73,7 +73,7 @@ static int  IgnoreError(Display *disp, XErrorEvent *event);
+ static void PrintProperty(XFontProp *prop);
+ static void ComputeFontType(XFontStruct *fs);
+ static void print_character_metrics(register XFontStruct *info);
+-static void do_query_font(Display *dpy, char *name);
++static void do_query_font(Display *dpy, const char *name);
+ 
+ void
+ usage(const char *errmsg)
+@@ -191,57 +191,70 @@ main(int argc, char **argv)
+ static void
+ get_list(const char *pattern)
+ {
+-    int available = nnames + 1, i;
+-    char **fonts;
+     XFontStruct *info;
+ 
+-    /* Get list of fonts matching pattern */
+-    for (;;) {
+-        if (open_instead_of_list) {
+-            info = XLoadQueryFont(dpy, pattern);
++    if (open_instead_of_list) {
++        info = XLoadQueryFont(dpy, pattern);
+ 
+-            if (info) {
+-                fonts = &pattern;
+-                available = 1;
+-                XUnloadFont(dpy, info->fid);
+-            }
+-            else {
+-                fonts = NULL;
+-            }
+-            break;
++        if (info == NULL) {
++            fprintf(stderr, "%s: pattern \"%s\" unmatched\n",
++                    program_name, pattern);
++            return;
+         }
+ 
+-        if (long_list == L_MEDIUM)
+-            fonts = XListFontsWithInfo(dpy, pattern, nnames, &available, &info);
+-        else
+-            fonts = XListFonts(dpy, pattern, nnames, &available);
+-        if (fonts == NULL || available < nnames)
+-            break;
+-        if (long_list == L_MEDIUM)
+-            XFreeFontInfo(fonts, info, available);
+-        else
+-            XFreeFontNames(fonts);
+-        nnames = available * 2;
+-    }
+-
+-    if (fonts == NULL) {
+-        fprintf(stderr, "%s: pattern \"%s\" unmatched\n",
+-                program_name, pattern);
+-        return;
+-    }
+-
+-    font_list = realloc(font_list, (font_cnt + available) * sizeof(FontList));
+-    if (font_list == NULL)
+-        Fatal_Error("Out of memory!");
+-    for (i = 0; i < available; i++) {
+-        font_list[font_cnt].name = fonts[i];
+-        if (long_list == L_MEDIUM)
+-            font_list[font_cnt].info = info + i;
+-        else
++        font_list = realloc(font_list, (font_cnt + 1) * sizeof(FontList));
++        if (font_list == NULL)
++            Fatal_Error("Out of memory!");
++        font_list[font_cnt].name = pattern;
++        if (long_list == L_MEDIUM) {
++            font_list[font_cnt].info = info;
++            XUnloadFont(dpy, info->fid);
++        }
++        else {
+             font_list[font_cnt].info = NULL;
+-
++            XFreeFont(dpy, info);
++        }
+         font_cnt++;
+     }
++    else {
++        /* Get list of fonts matching pattern */
++        int available = nnames + 1;
++        char **fonts;
++
++        for (;;) {
++            if (long_list == L_MEDIUM)
++                fonts = XListFontsWithInfo(dpy, pattern, nnames, &available,
++                                           &info);
++            else
++                fonts = XListFonts(dpy, pattern, nnames, &available);
++            if (fonts == NULL) {
++                fprintf(stderr, "%s: pattern \"%s\" unmatched\n",
++                        program_name, pattern);
++                return;
++            }
++            if (available < nnames)
++                break;
++            if (long_list == L_MEDIUM)
++                XFreeFontInfo(fonts, info, available);
++            else
++                XFreeFontNames(fonts);
++            nnames = available * 2;
++        }
++
++        font_list = realloc(font_list,
++                            (font_cnt + available) * sizeof(FontList));
++        if (font_list == NULL)
++            Fatal_Error("Out of memory!");
++        for (int i = 0; i < available; i++) {
++            font_list[font_cnt].name = fonts[i];
++            if (long_list == L_MEDIUM)
++                font_list[font_cnt].info = info + i;
++            else
++                font_list[font_cnt].info = NULL;
++
++            font_cnt++;
++        }
++    }
+ }
+ 
+ static int
+@@ -625,7 +638,7 @@ print_character_metrics(register XFontStruct *info)
+ }
+ 
+ static void
+-do_query_font(Display *display, char *name)
++do_query_font(Display *display, const char *name)
+ {
+     register int i;
+     register XFontStruct *info = XLoadQueryFont(display, name);
+-- 
+GitLab
+
diff --git a/debian/patches/series b/debian/patches/series
index e0a607f..a94ce8d 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1 +1,2 @@
 editres-format-strings.diff
+incompatible-pointer-types.patch

Reply via email to