From b5ee94956f9708c7469a0c292dcae07f85b50d97 Mon Sep 17 00:00:00 2001 From: naddy Date: Sun, 29 Jan 2023 00:07:55 +0000 Subject: [PATCH] x11/xpostit: explicitly cast integer to pointer to fix build with clang 15 The callback takes a pointer to be able to pass arbitrary data, but instead of allocating an int and passing a pointer to it, the code jams the int directly into the pointer for an int -> pointer -> int roundtrip. Problem reported by and discussed with jca@. Fix implicit function declarations. --- x11/xpostit/Makefile | 2 +- x11/xpostit/patches/patch-menu_c | 12 ++++++++ x11/xpostit/patches/patch-note_c | 46 +++++++++++++++++++++++++++++ x11/xpostit/patches/patch-util_c | 31 +++++++++++++++++++ x11/xpostit/patches/patch-xpostit_h | 25 ++++++++++++++++ 5 files changed, 115 insertions(+), 1 deletion(-) create mode 100644 x11/xpostit/patches/patch-menu_c create mode 100644 x11/xpostit/patches/patch-note_c create mode 100644 x11/xpostit/patches/patch-util_c create mode 100644 x11/xpostit/patches/patch-xpostit_h diff --git a/x11/xpostit/Makefile b/x11/xpostit/Makefile index 600732e3b80..09dd0d3ba61 100644 --- a/x11/xpostit/Makefile +++ b/x11/xpostit/Makefile @@ -2,7 +2,7 @@ COMMENT= PostIt (R) messages onto your X11 screen DISTNAME= xpostit3.3.1 PKGNAME= xpostit-3.3.1 -REVISION= 2 +REVISION= 3 CATEGORIES= x11 MASTER_SITES= ${MASTER_SITE_R5CONTRIB} diff --git a/x11/xpostit/patches/patch-menu_c b/x11/xpostit/patches/patch-menu_c new file mode 100644 index 00000000000..47bbaccb3d4 --- /dev/null +++ b/x11/xpostit/patches/patch-menu_c @@ -0,0 +1,12 @@ +Index: menu.c +--- menu.c.orig ++++ menu.c +@@ -120,7 +120,7 @@ CreateMenuWidget() + smeBSBObjectClass, menuwidget, + NULL, 0); + +- XtAddCallback(entry, XtNcallback, HandleMenuSelection, i); ++ XtAddCallback(entry, XtNcallback, HandleMenuSelection, (XtPointer)i); + } + + XawSimpleMenuAddGlobalActions(appcontext); diff --git a/x11/xpostit/patches/patch-note_c b/x11/xpostit/patches/patch-note_c new file mode 100644 index 00000000000..bb8b72f3ae2 --- /dev/null +++ b/x11/xpostit/patches/patch-note_c @@ -0,0 +1,46 @@ +Index: note.c +--- note.c.orig ++++ note.c +@@ -97,6 +97,7 @@ static char *RCSid = "$Header: /home/harbor/davy/stuff + #include + #include + #include ++#include + #include + #include + #include +@@ -105,7 +106,10 @@ static char *RCSid = "$Header: /home/harbor/davy/stuff + #else + #include + #endif ++#include + #include ++#include ++#include + + #include "xpostit.h" + #include "vroot.h" +@@ -135,6 +139,7 @@ static void CancelDestroy(); + static void ConfirmDestroy(); + static void MakeNoteWidget(); + static void NoteProtocolsHandler(); ++static void GetNotePosition(); + + static XtEventHandler StructureNotifyHandler(); + +@@ -238,7 +243,6 @@ LoadSavedNotes() + { + DIR *dp; + FILE *fp; +- char *realloc(); + register PostItNote *pn; + #if defined(USG) || defined(SYSV) || defined(SVR4) + register struct dirent *d; +@@ -1169,6 +1173,7 @@ NoteIndex() + * + * Thanks to Stewart Levin for the original code. + */ ++static void + GetNotePosition(w, x, y) + int *x, *y; + Widget w; diff --git a/x11/xpostit/patches/patch-util_c b/x11/xpostit/patches/patch-util_c new file mode 100644 index 00000000000..bb022a34940 --- /dev/null +++ b/x11/xpostit/patches/patch-util_c @@ -0,0 +1,31 @@ +Index: util.c +--- util.c.orig ++++ util.c +@@ -44,8 +44,10 @@ static char *RCSid = "$Header: /home/harbor/davy/stuff + #include + #include + #include +-#include + #include ++#include ++#include ++#include + + #include "xpostit.h" + +@@ -72,7 +74,6 @@ ByeBye() + void + SetNoteDir() + { +- char *getenv(); + char *home, *s; + struct passwd *pwd; + char fname[MAXPATHLEN]; +@@ -129,7 +130,6 @@ char * + SafeAlloc(nbytes) + register int nbytes; + { +- char *malloc(); + register char *s; + + if ((s = malloc(nbytes)) == NULL) { diff --git a/x11/xpostit/patches/patch-xpostit_h b/x11/xpostit/patches/patch-xpostit_h new file mode 100644 index 00000000000..27c6ca1c3fa --- /dev/null +++ b/x11/xpostit/patches/patch-xpostit_h @@ -0,0 +1,25 @@ +Index: xpostit.h +--- xpostit.h.orig ++++ xpostit.h +@@ -162,8 +162,10 @@ extern Widget plaidwidget; + * Function declarations. + */ + char *SafeAlloc(); ++char *GetNoteTitle(); + + void ByeBye(); ++void SetNoteDir(); + void ConfirmIt(); + void MakeNewNote(); + void ClearConfirm(); +@@ -173,8 +175,10 @@ void ShowAllNotes(); + void RaiseAllNotes(); + void LowerAllNotes(); + void CreateNewNote(); ++void LoadSavedNotes(); + void CreateMenuWidget(); + void CreatePlaidWidget(); ++void ClearTitle(); + + #if defined(USG) || defined(SYSV) || defined(SVR4) + #define rindex strrchr