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.
This commit is contained in:
naddy 2023-01-29 00:07:55 +00:00
parent 4f1d2838ba
commit b5ee94956f
5 changed files with 115 additions and 1 deletions

View File

@ -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}

View File

@ -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);

View File

@ -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 <X11/Intrinsic.h>
#include <X11/Xaw/AsciiText.h>
#include <X11/Xaw/Command.h>
+#include <X11/Xaw/Dialog.h>
#include <X11/Xaw/Form.h>
#include <X11/Shell.h>
#include <sys/param.h>
@@ -105,7 +106,10 @@ static char *RCSid = "$Header: /home/harbor/davy/stuff
#else
#include <sys/dir.h>
#endif
+#include <sys/stat.h>
#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
#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;

View File

@ -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 <X11/StringDefs.h>
#include <X11/Intrinsic.h>
#include <sys/param.h>
-#include <stdio.h>
#include <pwd.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
#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) {

View File

@ -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