[mw-devel] MW3 r1292 - in trunk/src: . server webclient

welshbyte at sucs.org welshbyte at sucs.org
Sun Nov 18 03:17:58 GMT 2012


Author: welshbyte
Date: 2012-11-18 03:17:57 +0000 (Sun, 18 Nov 2012)
New Revision: 1292

Modified:
   trunk/src/Makefile
   trunk/src/edit.c
   trunk/src/files.c
   trunk/src/files.h
   trunk/src/main.c
   trunk/src/server/Makefile
   trunk/src/strings.c
   trunk/src/webclient/Makefile
   trunk/src/webclient/comms.c
   trunk/src/webclient/mwpoll.c
   trunk/src/webclient/mwstring.h
Log:
Add more warning options: -Wcast-align -Wbad-function-cast -Wmissing-format-attribute -Wformat=2 -Wformat-security -Wformat-nonliteral -Wno-long-long
Also remove create_pipe (which was left empty) and get_pipe_name (which is now unused).


Modified: trunk/src/Makefile
===================================================================
--- trunk/src/Makefile	2012-11-18 02:37:23 UTC (rev 1291)
+++ trunk/src/Makefile	2012-11-18 03:17:57 UTC (rev 1292)
@@ -11,7 +11,7 @@
 CFLAGS+=-I/usr/include/mozjs
 
 # cflags for standard 'cc' compiler
-CFLAGS+= -Wall -Wshadow -Wmissing-prototypes -Wstrict-prototypes -Wpointer-arith -Wwrite-strings -Wno-strict-aliasing -pedantic -fpie -std=gnu99 -D_GNU_SOURCE
+CFLAGS+= -Wall -Wshadow -Wmissing-prototypes -Wstrict-prototypes -Wpointer-arith -Wwrite-strings -Wcast-align -Wbad-function-cast -Wmissing-format-attribute -Wformat=2 -Wformat-security -Wformat-nonliteral -Wno-long-long -Wno-strict-aliasing -pedantic -fpie -std=gnu99 -D_GNU_SOURCE
 LDFLAGS+= -pie
 LDLIBS+= -lreadline -ltermcap -lcrypt -l$(JSLIB) -lsqlite3 -lcurl -lpthread -lgnutls-openssl -ljansson
 

Modified: trunk/src/edit.c
===================================================================
--- trunk/src/edit.c	2012-11-18 02:37:23 UTC (rev 1291)
+++ trunk/src/edit.c	2012-11-18 03:17:57 UTC (rev 1292)
@@ -137,7 +137,7 @@
 		strncat(text, sub, MAXTEXTLENGTH - strlen(text) - 1);
 	}
 	if (add[0]==0 && sub[0]==0) return;
-	broadcast(3, text);
+	broadcast(3, "%s", text);
 }
 
 void edit_user(const char *args, const char *name)
@@ -661,7 +661,7 @@
 			if(!f_active(fold.g_status))
 				printf(_("WARNING: folder may get written over by the next folder created.\n"));
 		}
-		mwlog(fullpath);
+		mwlog("%s", fullpath);
 	}else
 	if (stringcmp(args,"groups",2))
 	{

Modified: trunk/src/files.c
===================================================================
--- trunk/src/files.c	2012-11-18 02:37:23 UTC (rev 1291)
+++ trunk/src/files.c	2012-11-18 03:17:57 UTC (rev 1292)
@@ -22,17 +22,6 @@
 
 #define MAXPIPELENGTH 2048
 
-static char *get_pipe_name(int pid)
-{
-	static char fullpath[MAXPIPELENGTH];
-	snprintf(fullpath,MAXPIPELENGTH-1,MSGDIR"/bbs.%d",pid);
-	return(fullpath);
-}
-
-void create_pipe(void)
-{
-}
-
 void open_incoming_fifo(const char *host)
 {
 	if (host == NULL)

Modified: trunk/src/files.h
===================================================================
--- trunk/src/files.h	2012-11-18 02:37:23 UTC (rev 1291)
+++ trunk/src/files.h	2012-11-18 03:17:57 UTC (rev 1292)
@@ -10,7 +10,6 @@
 #define USERFILE    STATEDIR"/users.bb"
 #define WHOFILE     MSGDIR"/who.bb"
 
-void create_pipe(void);
 void open_incoming_fifo(const char *host);
 void close_fifo(void);
 void Lock_File(int f);

Modified: trunk/src/main.c
===================================================================
--- trunk/src/main.c	2012-11-18 02:37:23 UTC (rev 1291)
+++ trunk/src/main.c	2012-11-18 03:17:57 UTC (rev 1292)
@@ -602,7 +602,6 @@
 	alarm_init();
 
 	close_fifo();
-	create_pipe();
 
 	/* display all new messages for given user */
 	if (msguser_num>-1 && god_mode())

Modified: trunk/src/server/Makefile
===================================================================
--- trunk/src/server/Makefile	2012-11-18 02:37:23 UTC (rev 1291)
+++ trunk/src/server/Makefile	2012-11-18 03:17:57 UTC (rev 1292)
@@ -8,7 +8,7 @@
 HOMEPATH := $(libdir)/mw
 
 # cflags for standard 'cc' compiler
-CFLAGS= -Wall -Wshadow -Wmissing-prototypes -Wstrict-prototypes -Wpointer-arith -Wwrite-strings -Wno-strict-aliasing -pedantic --std=gnu99 -D_GNU_SOURCE -I.. -I/usr/include/postgresql
+CFLAGS= -Wall -Wshadow -Wmissing-prototypes -Wstrict-prototypes -Wpointer-arith -Wwrite-strings -Wcast-align -Wbad-function-cast -Wmissing-format-attribute -Wformat=2 -Wformat-security -Wformat-nonliteral -Wno-long-long -Wno-strict-aliasing -pedantic --std=gnu99 -D_GNU_SOURCE -I.. -I/usr/include/postgresql
 #LDFLAGS+= -pie
 
 # info strings, do not edit.

Modified: trunk/src/strings.c
===================================================================
--- trunk/src/strings.c	2012-11-18 02:37:23 UTC (rev 1291)
+++ trunk/src/strings.c	2012-11-18 03:17:57 UTC (rev 1292)
@@ -259,9 +259,10 @@
 
 int get_rand(int min, int max)
 {
+	int r = rand();
 	float	fValue;
 
-	fValue = (float)rand() * (float)(max - min + 1);
+	fValue = (float)r * (float)(max - min + 1);
 	fValue /= (float)RAND_MAX;
 	fValue += (float)min;
 

Modified: trunk/src/webclient/Makefile
===================================================================
--- trunk/src/webclient/Makefile	2012-11-18 02:37:23 UTC (rev 1291)
+++ trunk/src/webclient/Makefile	2012-11-18 03:17:57 UTC (rev 1292)
@@ -8,7 +8,7 @@
 HOMEPATH := $(libdir)/mw
 
 # cflags for standard 'cc' compiler
-CFLAGS= -Wall -Wshadow -Wmissing-prototypes -Wstrict-prototypes -Wpointer-arith -Wwrite-strings -pedantic --std=gnu99 -D_GNU_SOURCE -I.. -I/usr/include/postgresql
+CFLAGS= -Wall -Wshadow -Wmissing-prototypes -Wstrict-prototypes -Wpointer-arith -Wwrite-strings -Wcast-align -Wbad-function-cast -Wmissing-format-attribute -Wformat=2 -Wformat-security -Wformat-nonliteral -Wno-long-long -pedantic --std=gnu99 -D_GNU_SOURCE -I.. -I/usr/include/postgresql
 #LDFLAGS+= -pie
 
 # info strings, do not edit.

Modified: trunk/src/webclient/comms.c
===================================================================
--- trunk/src/webclient/comms.c	2012-11-18 02:37:23 UTC (rev 1291)
+++ trunk/src/webclient/comms.c	2012-11-18 03:17:57 UTC (rev 1292)
@@ -421,7 +421,7 @@
 		tmp = remove_first_word(buff);
 		tmpm = remove_first_word(tmp);
 		tmpu = strtok(tmp," ");
-		snprintf(msg,sizeof msg,tmpm);
+		snprintf(msg,sizeof msg, "%s", tmpm);
 		snprintf(duser,17,"%s",tmpu);
 		if (buff[strlen(buff)-1]=='?') {
 	                snprintf(line, sizeof line, "%s asks: %s", user->name, msg);

Modified: trunk/src/webclient/mwpoll.c
===================================================================
--- trunk/src/webclient/mwpoll.c	2012-11-18 02:37:23 UTC (rev 1291)
+++ trunk/src/webclient/mwpoll.c	2012-11-18 03:17:57 UTC (rev 1292)
@@ -220,7 +220,6 @@
 	}
 
 	/* load us up */
-	create_pipe();
 	open_incoming_fifo(hostname);
 	open_command_socket();
 	

Modified: trunk/src/webclient/mwstring.h
===================================================================
--- trunk/src/webclient/mwstring.h	2012-11-18 02:37:23 UTC (rev 1291)
+++ trunk/src/webclient/mwstring.h	2012-11-18 03:17:57 UTC (rev 1292)
@@ -6,7 +6,7 @@
 
 /* mwstring.c */
 mwstring *mws_new(int size);
-void mws_add(mwstring *s, const char *fmt, ...);
+void mws_add(mwstring *s, const char *fmt, ...) __attribute__((format(printf,2,3)));
 const char *mws_cstr(mwstring *s);
 int mws_len(mwstring *s);
 void mws_free(mwstring *s);




More information about the mw-devel mailing list