1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-12-27 05:10:36 +00:00

- make fvwm compile w/o Warnings apart from one usage of mkstemp

by adding needed #includes, adding return statements to
 non-void functions and declaring functions returning a int
 instead of void if they do return an return code.
- start using one central safemalloc.
- do not mangle pointers which makes FvwmWinList work on
  amd64/7-STABLE again.
PR:		132571
Submitted by:	Bjoern A. Zeeb
This commit is contained in:
Dirk Meyer 2009-03-14 20:10:23 +00:00
parent 713ba5fa75
commit ee1fdf1921
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=230087
39 changed files with 581 additions and 1 deletions

View File

@ -7,7 +7,7 @@
PORTNAME= fvwm
PORTVERSION= 1.24r
PORTREVISION= 3
PORTREVISION= 4
CATEGORIES= x11-wm
MASTER_SITES= ftp://ftp.fvwm.org/pub/fvwm/version-1/ \
ftp://ftp.ics.es.osaka-u.ac.jp/pub/CFAN/sources/1.x/

View File

@ -0,0 +1,10 @@
--- ./modules/FvwmWinList/ButtonArray.c.orig 1994-05-09 17:08:28.000000000 +0000
+++ ./modules/FvwmWinList/ButtonArray.c 2009-03-11 09:42:51.000000000 +0000
@@ -14,6 +14,7 @@
#include <stdlib.h>
#include <stdio.h>
+#include <string.h>
#include <X11/Xlib.h>
#include "ButtonArray.h"
#include "Mallocs.h"

View File

@ -0,0 +1,11 @@
--- ./modules/FvwmAudio/FvwmAudio.c.orig 1994-09-14 14:28:53.000000000 +0000
+++ ./modules/FvwmAudio/FvwmAudio.c 2009-03-11 09:42:51.000000000 +0000
@@ -477,7 +477,7 @@
if (sound_table[sound])
{
- memset(buf,NULL,BUFSIZE);
+ memset(buf, 0, sizeof(buf));
/*
* Don't use audio_play_dir if it's NULL or if the sound file

View File

@ -0,0 +1,19 @@
--- ./modules/FvwmAuto/FvwmAuto.c.orig 1994-12-02 19:04:02.000000000 +0000
+++ ./modules/FvwmAuto/FvwmAuto.c 2009-03-11 09:42:51.000000000 +0000
@@ -57,7 +57,7 @@
* main - start of module
*
***********************************************************************/
-void main(int argc, char **argv)
+int main(int argc, char **argv)
{
FILE *file;
char mask_mesg[80];
@@ -82,6 +82,7 @@
sprintf(mask_mesg,"SET_MASK %lu\n",(unsigned long)(M_FOCUS_CHANGE));
SendInfo(fd,mask_mesg,0);
Loop(fd);
+ return (0);
}

View File

@ -0,0 +1,11 @@
--- ./modules/FvwmBacker/Mallocs.c.orig 1994-09-14 20:06:16.000000000 +0000
+++ ./modules/FvwmBacker/Mallocs.c 2009-03-11 09:42:51.000000000 +0000
@@ -33,6 +33,8 @@
#include "../../fvwm/alpha_header.h"
#endif /* NEEDS_ALPHA_HEADER */
+#include "Mallocs.h"
+
extern char *Module;
/******************************************************************************

View File

@ -0,0 +1,13 @@
--- ./modules/FvwmBacker/Mallocs.h.orig 1994-09-14 19:59:18.000000000 +0000
+++ ./modules/FvwmBacker/Mallocs.h 2009-03-11 09:42:48.000000000 +0000
@@ -18,8 +18,9 @@
* own risk. Permission to use this program for any purpose is given,
* as long as the copyright is kept intact. */
+#include "../../libs/fvwmlib.h"
+
/* Function Prototypes */
-char *safemalloc(int length);
char *saferealloc(char *ptr, int length);
void sleep_a_little(int n);
void UpdateString(char **string,char *value);

View File

@ -0,0 +1,19 @@
--- ./modules/FvwmBacker/FvwmBacker.c.orig 1994-09-28 13:37:39.000000000 +0000
+++ ./modules/FvwmBacker/FvwmBacker.c 2009-03-11 09:42:51.000000000 +0000
@@ -84,7 +84,7 @@
/* #define LOGFILE "/tmp/FvwmBacker.log"*/
-void main(int argc, char **argv)
+int main(int argc, char **argv)
{
char *temp, *s;
char* displayName = NULL;
@@ -139,6 +139,7 @@
/* Recieve all messages from Fvwm */
EndLessLoop();
+ return (0);
}
/******************************************************************************

View File

@ -0,0 +1,51 @@
--- ./modules/FvwmClean/FvwmClean.c.orig 1994-09-16 15:53:49.000000000 +0000
+++ ./modules/FvwmClean/FvwmClean.c 2009-03-11 09:42:51.000000000 +0000
@@ -52,7 +52,7 @@
* main - start of module
*
***********************************************************************/
-void main(int argc, char **argv)
+int main(int argc, char **argv)
{
char *temp, *s;
FILE *file;
@@ -134,6 +134,7 @@
SendInfo(fd,"Send_WindowList",0);
Loop(fd);
+ return (0);
}
@@ -228,31 +229,6 @@
}
-
-
-/***********************************************************************
- *
- * Procedure:
- * safemalloc - mallocs specified space or exits if there's a
- * problem
- *
- ***********************************************************************/
-char *safemalloc(int length)
-{
- char *ptr;
-
- if(length <=0)
- length = 1;
-
- ptr = malloc(length);
- if(ptr == (char *)0)
- {
- fprintf(stderr,"%s:malloc failed",MyName);
- exit(1);
- }
- return ptr;
-}
-
/***********************************************************************
*
* Procedure:

View File

@ -0,0 +1,10 @@
--- ./modules/FvwmClean/FvwmClean.h.orig 1994-09-13 18:24:26.000000000 +0000
+++ ./modules/FvwmClean/FvwmClean.h 2009-03-11 09:42:48.000000000 +0000
@@ -18,7 +18,6 @@
*************************************************************************/
void Loop(int *fd);
void SendInfo(int *fd,char *message,unsigned long window);
-char *safemalloc(int length);
struct list *find_window(unsigned long id);
void remove_window(unsigned long id);
void add_window(unsigned long new_win);

View File

@ -0,0 +1,19 @@
--- ./modules/FvwmDebug/FvwmDebug.c.orig 1994-09-30 12:48:59.000000000 +0000
+++ ./modules/FvwmDebug/FvwmDebug.c 2009-03-11 09:42:51.000000000 +0000
@@ -36,7 +36,7 @@
* main - start of module
*
***********************************************************************/
-void main(int argc, char **argv)
+int main(int argc, char **argv)
{
char *temp, *s;
@@ -75,6 +75,7 @@
SendInfo(fd,"Send_WindowList",0);
Loop(fd);
+ return (0);
}
/***********************************************************************

View File

@ -0,0 +1,10 @@
--- ./modules/FvwmDebug/FvwmDebug.h.orig 1994-09-13 18:24:41.000000000 +0000
+++ ./modules/FvwmDebug/FvwmDebug.h 2009-03-11 09:42:48.000000000 +0000
@@ -6,7 +6,6 @@
*************************************************************************/
void Loop(int *fd);
void SendInfo(int *fd,char *message,unsigned long window);
-char *safemalloc(int length);
void DeadPipe(int nonsense);
void process_message(unsigned long type,unsigned long *body);

View File

@ -0,0 +1,19 @@
--- ./modules/FvwmIconBox/FvwmIconBox.c.orig 1994-09-16 15:54:49.000000000 +0000
+++ ./modules/FvwmIconBox/FvwmIconBox.c 2009-03-11 09:42:51.000000000 +0000
@@ -155,7 +155,7 @@
Based on main() from GoodStuff:
Copyright 1993, Robert Nation.
************************************************************************/
-void main(int argc, char **argv)
+int main(int argc, char **argv)
{
char *display_name = NULL;
char *temp, *s;
@@ -223,6 +223,7 @@
SendFvwmPipe(fd,"Send_WindowList",0);
Loop();
+ return (0);
}
/************************************************************************

View File

@ -0,0 +1,10 @@
--- ./modules/FvwmIconBox/FvwmIconBox.h.orig 1994-09-13 20:38:23.000000000 +0000
+++ ./modules/FvwmIconBox/FvwmIconBox.h 2009-03-11 09:42:48.000000000 +0000
@@ -15,7 +15,6 @@
extern void match_string(char *tline);
extern void Loop(void);
extern void ParseOptions(char *);
-extern char *safemalloc(int length);
extern void change_window_name(char *str);
extern int My_XNextEvent(Display *dpy, XEvent *event);
extern void CopyString(char **dest, char *source);

View File

@ -0,0 +1,19 @@
--- ./modules/FvwmIdent/FvwmIdent.c.orig 1994-09-16 15:07:11.000000000 +0000
+++ ./modules/FvwmIdent/FvwmIdent.c 2009-03-11 09:42:51.000000000 +0000
@@ -80,7 +80,7 @@
* main - start of module
*
***********************************************************************/
-void main(int argc, char **argv)
+int main(int argc, char **argv)
{
char *temp, *s;
FILE *file;
@@ -173,6 +173,7 @@
SendInfo(fd,"Send_WindowList",0);
Loop(fd);
+ return (0);
}
/**************************************************************************

View File

@ -0,0 +1,10 @@
--- ./modules/FvwmIdent/FvwmIdent.h.orig 1994-09-13 18:25:16.000000000 +0000
+++ ./modules/FvwmIdent/FvwmIdent.h 2009-03-11 09:42:48.000000000 +0000
@@ -42,7 +42,6 @@
*************************************************************************/
void Loop(int *fd);
void SendInfo(int *fd,char *message,unsigned long window);
-char *safemalloc(int length);
void DeadPipe(int nonsense);
void process_message(unsigned long type,unsigned long *body);
void GetTargetWindow(Window *app_win);

View File

@ -0,0 +1,19 @@
--- ./modules/FvwmPager/FvwmPager.c.orig 1994-10-07 12:49:26.000000000 +0000
+++ ./modules/FvwmPager/FvwmPager.c 2009-03-11 09:42:51.000000000 +0000
@@ -82,7 +82,7 @@
* main - start of module
*
***********************************************************************/
-void main(int argc, char **argv)
+int main(int argc, char **argv)
{
char *temp, *s, *cptr;
char *display_name = NULL;
@@ -186,6 +186,7 @@
SendInfo(fd,"Send_WindowList",0);
Loop(fd);
+ return (0);
}
/***********************************************************************

View File

@ -0,0 +1,16 @@
--- ./modules/FvwmPager/FvwmPager.h.orig 1994-10-07 12:49:27.000000000 +0000
+++ ./modules/FvwmPager/FvwmPager.h 2009-03-11 09:42:48.000000000 +0000
@@ -1,3 +1,5 @@
+#include "../../libs/fvwmlib.h"
+
typedef struct ScreenInfo
{
unsigned long screen;
@@ -83,7 +85,6 @@
*************************************************************************/
void Loop(int *fd);
void SendInfo(int *fd,char *message,unsigned long window);
-char *safemalloc(int length);
void DeadPipe(int nonsense);
void process_message(unsigned long type,unsigned long *body);
void ParseOptions(char *filename);

View File

@ -0,0 +1,19 @@
--- ./modules/FvwmSave/FvwmSave.c.orig 1994-09-16 15:07:40.000000000 +0000
+++ ./modules/FvwmSave/FvwmSave.c 2009-03-11 09:42:51.000000000 +0000
@@ -51,7 +51,7 @@
* main - start of module
*
***********************************************************************/
-void main(int argc, char **argv)
+int main(int argc, char **argv)
{
char *temp, *s;
char *display_name = NULL;
@@ -99,6 +99,7 @@
SendInfo(fd,"Send_WindowList",0);
Loop(fd);
+ return (0);
}

View File

@ -0,0 +1,10 @@
--- ./modules/FvwmSave/FvwmSave.h.orig 1994-09-13 18:25:36.000000000 +0000
+++ ./modules/FvwmSave/FvwmSave.h 2009-03-11 09:42:48.000000000 +0000
@@ -26,7 +26,6 @@
*************************************************************************/
void Loop(int *fd);
void SendInfo(int *fd,char *message,unsigned long window);
-char *safemalloc(int length);
struct list *find_window(unsigned long id);
void add_window(unsigned long new_win, unsigned long *body);
void DeadPipe(int nonsense);

View File

@ -0,0 +1,19 @@
--- ./modules/FvwmSaveDesk/FvwmSaveDesk.c.orig 1994-09-16 15:07:59.000000000 +0000
+++ ./modules/FvwmSaveDesk/FvwmSaveDesk.c 2009-03-11 09:42:51.000000000 +0000
@@ -64,7 +64,7 @@
* main - start of module
*
***********************************************************************/
-void main(int argc, char **argv)
+int main(int argc, char **argv)
{
char *temp, *s;
char *display_name = NULL;
@@ -112,6 +112,7 @@
SendInfo(fd,"Send_WindowList",0);
Loop(fd);
+ return (0);
}

View File

@ -0,0 +1,10 @@
--- ./modules/FvwmSaveDesk/FvwmSaveDesk.h.orig 1994-09-13 18:25:45.000000000 +0000
+++ ./modules/FvwmSaveDesk/FvwmSaveDesk.h 2009-03-11 09:42:48.000000000 +0000
@@ -27,7 +27,6 @@
*************************************************************************/
void Loop(int *fd);
void SendInfo(int *fd,char *message,unsigned long window);
-char *safemalloc(int length);
struct list *find_window(unsigned long id);
void add_window(unsigned long new_win, unsigned long *body);
void DeadPipe(int nonsense);

View File

@ -0,0 +1,26 @@
--- ./modules/FvwmScroll/FvwmScroll.c.orig 1994-09-16 15:08:10.000000000 +0000
+++ ./modules/FvwmScroll/FvwmScroll.c 2009-03-11 09:42:51.000000000 +0000
@@ -65,7 +65,7 @@
* main - start of module
*
***********************************************************************/
-void main(int argc, char **argv)
+int main(int argc, char **argv)
{
char *temp, *s;
FILE *file;
@@ -159,12 +159,13 @@
GetTargetWindow(&app_win);
if(app_win == 0)
- return;
+ return (0);
fd_width = GetFdWidth();
GrabWindow(app_win);
Loop(app_win);
+ return (0);
}

View File

@ -0,0 +1,8 @@
--- ./modules/FvwmScroll/FvwmScroll.h.orig 1994-09-14 14:11:35.000000000 +0000
+++ ./modules/FvwmScroll/FvwmScroll.h 2009-03-11 09:42:48.000000000 +0000
@@ -1,5 +1,4 @@
#include "../../libs/fvwmlib.h"
-char *safemalloc(int length);
void DeadPipe(int nonsense);
void GetTargetWindow(Window *app_win);
void sleep_a_little(int n);

View File

@ -0,0 +1,11 @@
--- ./modules/FvwmWinList/Mallocs.c.orig 1994-09-14 20:07:21.000000000 +0000
+++ ./modules/FvwmWinList/Mallocs.c 2009-03-11 09:42:43.000000000 +0000
@@ -33,6 +33,8 @@
#include "../../fvwm/alpha_header.h"
#endif /* NEEDS_ALPHA_HEADER */
+#include "Mallocs.h"
+
extern char *Module;
/******************************************************************************

View File

@ -0,0 +1,13 @@
--- ./modules/FvwmWinList/Mallocs.h.orig 1994-09-14 14:11:34.000000000 +0000
+++ ./modules/FvwmWinList/Mallocs.h 2009-03-11 09:42:48.000000000 +0000
@@ -18,8 +18,9 @@
* own risk. Permission to use this program for any purpose is given,
* as long as the copyright is kept intact. */
+#include "../../libs/fvwmlib.h"
+
/* Function Prototypes */
-char *safemalloc(int length);
char *saferealloc(char *ptr, int length);
void sleep_a_little(int n);
void CopyString(char **dest, char *source);

View File

@ -0,0 +1,19 @@
--- ./modules/FvwmWinList/FvwmWinList.c.orig 1994-09-19 12:40:13.000000000 +0000
+++ ./modules/FvwmWinList/FvwmWinList.c 2009-03-11 09:42:51.000000000 +0000
@@ -101,7 +101,7 @@
Based on main() from FvwmIdent:
Copyright 1994, Robert Nation and Nobutaka Suzuki.
******************************************************************************/
-void main(int argc, char **argv)
+int main(int argc, char **argv)
{
char *temp, *s;
@@ -153,6 +153,7 @@
/* Recieve all messages from Fvwm */
EndLessLoop();
+ return (0);
}
/******************************************************************************

View File

@ -0,0 +1,28 @@
--- ./modules/GoodStuff/GoodStuff.c.orig 1994-12-05 17:39:04.000000000 +0000
+++ ./modules/GoodStuff/GoodStuff.c 2009-03-11 09:42:52.000000000 +0000
@@ -89,7 +89,7 @@
*
***********************************************************************
*/
-void main(int argc, char **argv)
+int main(int argc, char **argv)
{
char *display_name = NULL;
int i,j;
@@ -209,7 +209,7 @@
SendText(fd,"Send_WindowList",0);
Loop();
-
+ return (0);
}
/***********************************************************************
@@ -396,7 +396,6 @@
}
}
}
- return;
}
/************************************************************************

View File

@ -0,0 +1,10 @@
--- ./modules/GoodStuff/GoodStuff.h.orig 1994-09-14 19:58:12.000000000 +0000
+++ ./modules/GoodStuff/GoodStuff.h 2009-03-11 09:42:48.000000000 +0000
@@ -13,7 +13,6 @@
extern void match_string(char *tline);
extern void Loop(void);
extern void ParseOptions(char *);
-extern char *safemalloc(int length);
extern void change_window_name(char *str);
extern int My_XNextEvent(Display *dpy, XEvent *event);
extern FVWM_INLINE void RelieveWindow(Window win,int x,int y,int w,int h,GC rGC,GC sGC);

View File

@ -0,0 +1,9 @@
--- ./libs/SendInfo.c.orig 1994-09-13 18:53:14.000000000 +0000
+++ ./libs/SendInfo.c 2009-03-11 09:42:49.000000000 +0000
@@ -1,5 +1,6 @@
#include <stdio.h>
#include <ctype.h>
+#include <string.h>
/***********************************************************************
*

View File

@ -0,0 +1,10 @@
--- ./libs/SendText.c.orig 1994-09-13 18:53:12.000000000 +0000
+++ ./libs/SendText.c 2009-03-11 09:42:49.000000000 +0000
@@ -1,5 +1,7 @@
#include <stdio.h>
#include <ctype.h>
+#include <string.h>
+
/************************************************************************
*
* Sends arbitrary text to fvwm

View File

@ -0,0 +1,11 @@
--- ./fvwm/events.c.orig 1994-11-15 14:02:39.000000000 +0000
+++ ./fvwm/events.c 2009-03-11 09:42:52.000000000 +0000
@@ -985,7 +985,7 @@
(MouseEntry->Modifier == (modifier& (~LockMask)))))
{
/* got a match, now process it */
- if (MouseEntry->func != (int)NULL)
+ if (MouseEntry->func != 0)
{
Action = MouseEntry->item ? MouseEntry->item->action : NULL;
ExecuteFunction(MouseEntry->func, Action, Event.xany.window,

View File

@ -0,0 +1,28 @@
--- ./fvwm/fvwm.c.orig 1994-11-15 14:02:52.000000000 +0000
+++ ./fvwm/fvwm.c 2009-03-11 09:42:51.000000000 +0000
@@ -132,7 +132,7 @@
*
***********************************************************************
*/
-void main(int argc, char **argv)
+int main(int argc, char **argv)
{
unsigned long valuemask; /* mask for create windows */
XSetWindowAttributes attributes; /* attributes for create windows */
@@ -463,7 +463,7 @@
}
HandleEvents();
- return;
+ return (0);
}
/***********************************************************************
@@ -988,6 +988,7 @@
#endif
fprintf(stderr,USAGE,VERSION);
+ exit (0);
}

View File

@ -0,0 +1,11 @@
--- ./libs/fvwmlib.h.orig 1994-09-16 14:47:13.000000000 +0000
+++ ./libs/fvwmlib.h 2009-03-11 09:42:44.000000000 +0000
@@ -4,7 +4,7 @@
int mygethostname(char *client, int namelen);
void SendText(int *fd,char *message,unsigned long window);
void SendInfo(int *fd,char *message,unsigned long window);
-char *safemalloc(int);
+void *safemalloc(unsigned int);
char *findIconFile(char *icon, char *pathlist, int type);
int ReadFvwmPacket(int fd, unsigned long *header, unsigned long **body);
void CopyString(char **dest, char *source);

View File

@ -0,0 +1,10 @@
--- ./libs/hostname.c.orig 1994-09-22 12:37:18.000000000 +0000
+++ ./libs/hostname.c 2009-03-11 09:42:49.000000000 +0000
@@ -4,6 +4,7 @@
/* define mygethostname() by using uname() */
#include <sys/utsname.h>
+#include <string.h>
int mygethostname(char *client, int length)
{

View File

@ -0,0 +1,11 @@
--- ./fvwm/icons.c.orig 1994-11-15 14:03:29.000000000 +0000
+++ ./fvwm/icons.c 2009-03-11 09:42:52.000000000 +0000
@@ -340,7 +340,7 @@
if(Tmp_win->flags & SUPPRESSICON)
return;
- if (Tmp_win->icon_w == (int)NULL)
+ if (Tmp_win->icon_w == 0)
return;
Tmp_win->icon_t_width = XTextWidth(IconFont->font,Tmp_win->icon_name,

View File

@ -0,0 +1,10 @@
--- ./libs/mystrcasecmp.c.orig 1994-09-14 15:55:20.000000000 +0000
+++ ./libs/mystrcasecmp.c 2009-03-11 09:42:49.000000000 +0000
@@ -1,6 +1,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
+#include <string.h>
int mystrcasecmp(char *s1,char *s2)
{

View File

@ -0,0 +1,10 @@
--- ./modules/FvwmBacker/root_bits.c.orig 1994-09-16 12:36:23.000000000 +0000
+++ ./modules/FvwmBacker/root_bits.c 2009-03-11 09:42:51.000000000 +0000
@@ -38,6 +38,7 @@
#include <X11/Xutil.h>
#include <X11/Xatom.h>
#include <stdio.h>
+#include <stdlib.h>
#include "X11/bitmaps/gray"
char *index();

View File

@ -0,0 +1,21 @@
--- ./libs/safemalloc.c.orig 1994-09-13 19:38:01.000000000 +0000
+++ ./libs/safemalloc.c 2009-03-11 09:42:44.000000000 +0000
@@ -8,15 +8,15 @@
* problem
*
***********************************************************************/
-char *safemalloc(int length)
+void *safemalloc(unsigned int length)
{
- char *ptr;
+ void *ptr;
if(length <= 0)
length = 1;
ptr = malloc(length);
- if(ptr == (char *)0)
+ if(ptr == NULL)
{
fprintf(stderr,"malloc of %d bytes failed. Exiting\n",length);
exit(1);

View File

@ -0,0 +1,10 @@
--- ./xpmroot/xpmroot.c.orig 1994-11-15 14:06:38.000000000 +0000
+++ ./xpmroot/xpmroot.c 2009-03-11 09:42:51.000000000 +0000
@@ -11,6 +11,7 @@
#include <stdio.h>
#include <signal.h>
#include <string.h>
+#include <stdlib.h>
#include <X11/Xos.h>
#include <X11/Xatom.h>
#include <X11/xpm.h>