[PATCH xawtv3 1/2] Fix gcc-14 compilation failures caused by incompatible pointer types

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



`XawListChange` declares the type of its second parameter as `_Xconst
char **`.  However, xawtv passes `str_list`, which is declared as
`String *`, or `&empty` which is declared as `char *`.  With gcc 14, these
result in incompatible-pointer errors:

 x11/propwatch.c: In function 'RebuildList':
 x11/propwatch.c:319:43: error: passing argument 2 of 'XawListChange' from incompatible pointer type [-Wincompatible-pointer-types]
   319 |     XawListChange(bl,str_count ? str_list : &empty,
       |                      ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~
       |                                           |
       |                                           char **
 In file included from x11/propwatch.c:28:
 /usr/include/X11/Xaw/List.h:170:27: note: expected 'const char **' but argument is of type 'char **'
   170 |  _Xconst char           **list,
       |                           ^
 x11/propwatch.c: In function 'ProcessPropertyChange':
 x11/propwatch.c:498:34: error: passing argument 2 of 'XawListChange' from incompatible pointer type [-Wincompatible-pointer-types]
   498 |                 XawListChange(bl,str_list,str_count,1000,1);
       |                                  ^~~~~~~~
       |                                  |
       |                                  char **
 /usr/include/X11/Xaw/List.h:170:27: note: expected 'const char **' but argument is of type 'char **'
   170 |  _Xconst char           **list,
       |                           ^

Both variables are only used as arguments to `XawListChange`, so change
their types to match its expectations.

Link: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1075650
Signed-off-by: Jeremy Sowden <jeremy@xxxxxxxxxx>
---
 x11/propwatch.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/x11/propwatch.c b/x11/propwatch.c
index 465c4ea1546e..f7aac657a4c8 100644
--- a/x11/propwatch.c
+++ b/x11/propwatch.c
@@ -58,8 +58,8 @@ static char *watch_default[] = {
     "WM_COMMAND",
 };
 
-static String   *str_list;
-static int      str_count;
+static const char **str_list;
+static int          str_count;
 
 static void AddWatch(Display *dpy, Window win, int i);
 static void DeleteWatch(Window win);
@@ -306,13 +306,13 @@ cmp(const void *a, const void *b)
 static void
 RebuildList(void)
 {
-    static char *empty = "empty";
+    static const char *empty = "empty";
     int i;
     struct WATCHLIST *this;
 
     if (str_list)
 	free(str_list);
-    str_list = malloc(str_count*sizeof(String));
+    str_list = malloc(str_count*sizeof(*str_list));
     for (i=0, this=watchlist; this!=NULL; i++, this=this->next)
 	str_list[i] = this->text;
     qsort(str_list,str_count,sizeof(char*),cmp);
-- 
2.43.0





[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux