shithub: choc

Download patch

ref: 3aeb98b92575dccb70df15c393c95a72891ce205
parent: b500013f80419217013ada4211662e9bea2702e4
author: Simon Howard <fraggle@gmail.com>
date: Thu Aug 4 14:42:15 EDT 2005

Silence compiler warnings

Subversion-branch: /trunk/chocolate-doom
Subversion-revision: 37

--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1,7 +1,7 @@
 
 bindir = $(prefix)/bin
 
-CFLAGS = @CFLAGS@ @SDL_CFLAGS@ -DNORMALUNIX 
+CFLAGS = @CFLAGS@ @SDL_CFLAGS@ -DNORMALUNIX -Wall
 LDFLAGS = @LDFLAGS@ @SDL_LIBS@ 
 
 chocolate_doom_SOURCES=\
--- a/src/am_map.c
+++ b/src/am_map.c
@@ -1,7 +1,7 @@
 // Emacs style mode select   -*- C++ -*- 
 //-----------------------------------------------------------------------------
 //
-// $Id: am_map.c 19 2005-07-23 19:17:11Z fraggle $
+// $Id: am_map.c 37 2005-08-04 18:42:15Z fraggle $
 //
 // Copyright(C) 1993-1996 Id Software, Inc.
 // Copyright(C) 2005 Simon Howard
@@ -23,6 +23,9 @@
 //
 //
 // $Log$
+// Revision 1.4  2005/08/04 18:42:15  fraggle
+// Silence compiler warnings
+//
 // Revision 1.3  2005/07/23 19:17:11  fraggle
 // Use ANSI-standard limit constants.  Remove LINUX define.
 //
@@ -37,7 +40,7 @@
 //
 //-----------------------------------------------------------------------------
 
-static const char rcsid[] = "$Id: am_map.c 19 2005-07-23 19:17:11Z fraggle $";
+static const char rcsid[] = "$Id: am_map.c 37 2005-08-04 18:42:15Z fraggle $";
 
 #include <stdio.h>
 
@@ -799,7 +802,7 @@
 //
 void AM_updateLightLev(void)
 {
-    static nexttic = 0;
+    static int nexttic = 0;
     //static int litelevels[] = { 0, 3, 5, 6, 6, 7, 7, 7 };
     static int litelevels[] = { 0, 4, 7, 10, 12, 14, 15, 15 };
     static int litelevelscnt = 0;
@@ -872,9 +875,9 @@
 	TOP	=8
     };
     
-    register	outcode1 = 0;
-    register	outcode2 = 0;
-    register	outside;
+    register int	outcode1 = 0;
+    register int	outcode2 = 0;
+    register int	outside;
     
     fpoint_t	tmp;
     int		dx;
@@ -1005,7 +1008,7 @@
     register int ay;
     register int d;
     
-    static fuck = 0;
+    static int fuck = 0;
 
     // For debugging only
     if (      fl->a.x < 0 || fl->a.x >= f_w
--- a/src/d_main.c
+++ b/src/d_main.c
@@ -1,7 +1,7 @@
 // Emacs style mode select   -*- C++ -*- 
 //-----------------------------------------------------------------------------
 //
-// $Id: d_main.c 8 2005-07-23 16:44:57Z fraggle $
+// $Id: d_main.c 37 2005-08-04 18:42:15Z fraggle $
 //
 // Copyright(C) 1993-1996 Id Software, Inc.
 // Copyright(C) 2005 Simon Howard
@@ -22,6 +22,9 @@
 // 02111-1307, USA.
 //
 // $Log$
+// Revision 1.3  2005/08/04 18:42:15  fraggle
+// Silence compiler warnings
+//
 // Revision 1.2  2005/07/23 16:44:55  fraggle
 // Update copyright to GNU GPL
 //
@@ -38,7 +41,7 @@
 //-----------------------------------------------------------------------------
 
 
-static const char rcsid[] = "$Id: d_main.c 8 2005-07-23 16:44:57Z fraggle $";
+static const char rcsid[] = "$Id: d_main.c 37 2005-08-04 18:42:15Z fraggle $";
 
 #define	BGCOLOR		7
 #define	FGCOLOR		8
@@ -163,7 +166,7 @@
 void D_PostEvent (event_t* ev)
 {
     events[eventhead] = *ev;
-    eventhead = (++eventhead)&(MAXEVENTS-1);
+    eventhead = (eventhead + 1) & (MAXEVENTS-1);
 }
 
 
--- a/src/i_net.c
+++ b/src/i_net.c
@@ -1,7 +1,7 @@
 // Emacs style mode select   -*- C++ -*- 
 //-----------------------------------------------------------------------------
 //
-// $Id: i_net.c 18 2005-07-23 18:56:07Z fraggle $
+// $Id: i_net.c 37 2005-08-04 18:42:15Z fraggle $
 //
 // Copyright(C) 1993-1996 Id Software, Inc.
 // Copyright(C) 2005 Simon Howard
@@ -22,6 +22,9 @@
 // 02111-1307, USA.
 //
 // $Log$
+// Revision 1.4  2005/08/04 18:42:15  fraggle
+// Silence compiler warnings
+//
 // Revision 1.3  2005/07/23 18:56:07  fraggle
 // Remove unneccessary pragmas
 //
@@ -37,7 +40,7 @@
 //-----------------------------------------------------------------------------
 
 static const char
-rcsid[] = "$Id: i_net.c 18 2005-07-23 18:56:07Z fraggle $";
+rcsid[] = "$Id: i_net.c 37 2005-08-04 18:42:15Z fraggle $";
 
 #include <stdlib.h>
 #include <string.h>
@@ -63,20 +66,6 @@
 
 
 
-
-// For some odd reason...
-#define ntohl(x) \
-        ((unsigned long int)((((unsigned long int)(x) & 0x000000ffU) << 24) | \
-                             (((unsigned long int)(x) & 0x0000ff00U) <<  8) | \
-                             (((unsigned long int)(x) & 0x00ff0000U) >>  8) | \
-                             (((unsigned long int)(x) & 0xff000000U) >> 24)))
-
-#define ntohs(x) \
-        ((unsigned short int)((((unsigned short int)(x) & 0x00ff) << 8) | \
-                              (((unsigned short int)(x) & 0xff00) >> 8))) \
-	  
-#define htonl(x) ntohl(x)
-#define htons(x) ntohs(x)
 
 void	NetSend (void);
 boolean NetListen (void);
--- a/src/i_system.c
+++ b/src/i_system.c
@@ -1,7 +1,7 @@
 // Emacs style mode select   -*- C++ -*- 
 //-----------------------------------------------------------------------------
 //
-// $Id: i_system.c 34 2005-08-04 01:14:37Z fraggle $
+// $Id: i_system.c 37 2005-08-04 18:42:15Z fraggle $
 //
 // Copyright(C) 1993-1996 Id Software, Inc.
 // Copyright(C) 2005 Simon Howard
@@ -22,6 +22,9 @@
 // 02111-1307, USA.
 //
 // $Log$
+// Revision 1.7  2005/08/04 18:42:15  fraggle
+// Silence compiler warnings
+//
 // Revision 1.6  2005/08/04 01:14:37  fraggle
 // Begin/EndRead now in i_video.c
 //
@@ -46,7 +49,7 @@
 //-----------------------------------------------------------------------------
 
 static const char
-rcsid[] = "$Id: i_system.c 34 2005-08-04 01:14:37Z fraggle $";
+rcsid[] = "$Id: i_system.c 37 2005-08-04 18:42:15Z fraggle $";
 
 
 #include <stdlib.h>
@@ -100,7 +103,7 @@
     *size = mb_used*1024*1024;
     zonemem = malloc (*size);
     printf("zone memory: %x, %x allocated for zone\n", 
-	   (long) zonemem, *size);
+	   (int) zonemem, *size);
     return zonemem;
 }
 
--- a/src/i_video.c
+++ b/src/i_video.c
@@ -1,7 +1,7 @@
 // Emacs style mode select   -*- C++ -*- 
 //-----------------------------------------------------------------------------
 //
-// $Id: i_video.c 33 2005-08-04 01:13:46Z fraggle $
+// $Id: i_video.c 37 2005-08-04 18:42:15Z fraggle $
 //
 // Copyright(C) 1993-1996 Id Software, Inc.
 // Copyright(C) 2005 Simon Howard
@@ -22,6 +22,9 @@
 // 02111-1307, USA.
 //
 // $Log$
+// Revision 1.11  2005/08/04 18:42:15  fraggle
+// Silence compiler warnings
+//
 // Revision 1.10  2005/08/04 01:13:46  fraggle
 // Loading disk
 //
@@ -62,11 +65,12 @@
 //-----------------------------------------------------------------------------
 
 static const char
-rcsid[] = "$Id: i_video.c 33 2005-08-04 01:13:46Z fraggle $";
+rcsid[] = "$Id: i_video.c 37 2005-08-04 18:42:15Z fraggle $";
 
 #include <ctype.h>
 #include <SDL.h>
 
+#include "w_wad.h"
 #include "z_zone.h"
 #include "doomstat.h"
 #include "i_system.h"
@@ -181,8 +185,6 @@
 
 int xlatekey(SDL_keysym *sym)
 {
-    int rc;
-
     switch(sym->sym)
     {
       case SDLK_LEFT:	return KEY_LEFTARROW;
@@ -289,8 +291,6 @@
     return result;
 }
 
-static int	lastmousex = 0;
-static int	lastmousey = 0;
 boolean		mousemoved = false;
 
 void I_GetEvent(void)
--- a/src/m_misc.c
+++ b/src/m_misc.c
@@ -1,7 +1,7 @@
 // Emacs style mode select   -*- C++ -*- 
 //-----------------------------------------------------------------------------
 //
-// $Id: m_misc.c 26 2005-07-24 02:14:04Z fraggle $
+// $Id: m_misc.c 37 2005-08-04 18:42:15Z fraggle $
 //
 // Copyright(C) 1993-1996 Id Software, Inc.
 // Copyright(C) 2005 Simon Howard
@@ -23,6 +23,9 @@
 //
 //
 // $Log$
+// Revision 1.5  2005/08/04 18:42:15  fraggle
+// Silence compiler warnings
+//
 // Revision 1.4  2005/07/24 02:14:04  fraggle
 // Move to SDL for graphics.
 // Translate key scancodes to correct internal format when reading
@@ -47,7 +50,7 @@
 //-----------------------------------------------------------------------------
 
 static const char
-rcsid[] = "$Id: m_misc.c 26 2005-07-24 02:14:04Z fraggle $";
+rcsid[] = "$Id: m_misc.c 37 2005-08-04 18:42:15Z fraggle $";
 
 #include <sys/stat.h>
 #include <sys/types.h>
@@ -240,8 +243,8 @@
 
 typedef struct
 {
-    char*	name;
-    int*	location;
+    char *	name;
+    void *	location;
     int		defaultvalue;
     int		scantranslate; // translate this value to a scancode
     int         untranslated;
@@ -287,16 +290,16 @@
 
     {"usegamma",&usegamma, 0},
 
-    {"chatmacro0", (int *) &chat_macros[0], (int) HUSTR_CHATMACRO0 },
-    {"chatmacro1", (int *) &chat_macros[1], (int) HUSTR_CHATMACRO1 },
-    {"chatmacro2", (int *) &chat_macros[2], (int) HUSTR_CHATMACRO2 },
-    {"chatmacro3", (int *) &chat_macros[3], (int) HUSTR_CHATMACRO3 },
-    {"chatmacro4", (int *) &chat_macros[4], (int) HUSTR_CHATMACRO4 },
-    {"chatmacro5", (int *) &chat_macros[5], (int) HUSTR_CHATMACRO5 },
-    {"chatmacro6", (int *) &chat_macros[6], (int) HUSTR_CHATMACRO6 },
-    {"chatmacro7", (int *) &chat_macros[7], (int) HUSTR_CHATMACRO7 },
-    {"chatmacro8", (int *) &chat_macros[8], (int) HUSTR_CHATMACRO8 },
-    {"chatmacro9", (int *) &chat_macros[9], (int) HUSTR_CHATMACRO9 }
+    {"chatmacro0", &chat_macros[0], (int) HUSTR_CHATMACRO0 },
+    {"chatmacro1", &chat_macros[1], (int) HUSTR_CHATMACRO1 },
+    {"chatmacro2", &chat_macros[2], (int) HUSTR_CHATMACRO2 },
+    {"chatmacro3", &chat_macros[3], (int) HUSTR_CHATMACRO3 },
+    {"chatmacro4", &chat_macros[4], (int) HUSTR_CHATMACRO4 },
+    {"chatmacro5", &chat_macros[5], (int) HUSTR_CHATMACRO5 },
+    {"chatmacro6", &chat_macros[6], (int) HUSTR_CHATMACRO6 },
+    {"chatmacro7", &chat_macros[7], (int) HUSTR_CHATMACRO7 },
+    {"chatmacro8", &chat_macros[8], (int) HUSTR_CHATMACRO8 },
+    {"chatmacro9", &chat_macros[9], (int) HUSTR_CHATMACRO9 }
 
 };
 
@@ -344,7 +347,7 @@
 	if (defaults[i].defaultvalue > -0xfff
 	    && defaults[i].defaultvalue < 0xfff)
 	{
-	    v = *defaults[i].location;
+	    v = *((int *)defaults[i].location);
 
             // translate keys back to scancodes
 
@@ -397,7 +400,7 @@
     FILE*	f;
     char	def[80];
     char	strparm[100];
-    char*	newstring;
+    char*	newstring = "";
     int		parm;
     boolean	isstring;
     
@@ -405,7 +408,7 @@
     numdefaults = sizeof(defaults)/sizeof(defaults[0]);
     for (i=0 ; i<numdefaults ; i++)
     {
-	*defaults[i].location = defaults[i].defaultvalue;
+	*((int *) defaults[i].location) = defaults[i].defaultvalue;
         defaults[i].untranslated = 0;
     }
     // check for a custom default file
@@ -453,10 +456,9 @@
                         }
                         
 			if (!isstring)
-			    *defaults[i].location = parm;
+			    *((int *) defaults[i].location) = parm;
 			else
-			    *defaults[i].location =
-				(int) newstring;
+			    *((char **) defaults[i].location) = newstring;
 			break;
 		    }
 	    }
--- a/src/p_floor.c
+++ b/src/p_floor.c
@@ -1,7 +1,7 @@
 // Emacs style mode select   -*- C++ -*- 
 //-----------------------------------------------------------------------------
 //
-// $Id: p_floor.c 19 2005-07-23 19:17:11Z fraggle $
+// $Id: p_floor.c 37 2005-08-04 18:42:15Z fraggle $
 //
 // Copyright(C) 1993-1996 Id Software, Inc.
 // Copyright(C) 2005 Simon Howard
@@ -22,6 +22,9 @@
 // 02111-1307, USA.
 //
 // $Log$
+// Revision 1.4  2005/08/04 18:42:15  fraggle
+// Silence compiler warnings
+//
 // Revision 1.3  2005/07/23 19:17:11  fraggle
 // Use ANSI-standard limit constants.  Remove LINUX define.
 //
@@ -38,7 +41,7 @@
 //-----------------------------------------------------------------------------
 
 static const char
-rcsid[] = "$Id: p_floor.c 19 2005-07-23 19:17:11Z fraggle $";
+rcsid[] = "$Id: p_floor.c 37 2005-08-04 18:42:15Z fraggle $";
 
 
 #include "z_zone.h"
@@ -483,8 +486,8 @@
 
     floormove_t*	floor;
     
-    fixed_t		stairsize;
-    fixed_t		speed;
+    fixed_t		stairsize = 0;
+    fixed_t		speed = 0;
 
     secnum = -1;
     rtn = 0;
--- a/src/p_maputl.c
+++ b/src/p_maputl.c
@@ -1,7 +1,7 @@
 // Emacs style mode select   -*- C++ -*- 
 //-----------------------------------------------------------------------------
 //
-// $Id: p_maputl.c 19 2005-07-23 19:17:11Z fraggle $
+// $Id: p_maputl.c 37 2005-08-04 18:42:15Z fraggle $
 //
 // Copyright(C) 1993-1996 Id Software, Inc.
 // Copyright(C) 2005 Simon Howard
@@ -22,6 +22,9 @@
 // 02111-1307, USA.
 //
 // $Log$
+// Revision 1.4  2005/08/04 18:42:15  fraggle
+// Silence compiler warnings
+//
 // Revision 1.3  2005/07/23 19:17:11  fraggle
 // Use ANSI-standard limit constants.  Remove LINUX define.
 //
@@ -41,7 +44,7 @@
 //-----------------------------------------------------------------------------
 
 static const char
-rcsid[] = "$Id: p_maputl.c 19 2005-07-23 19:17:11Z fraggle $";
+rcsid[] = "$Id: p_maputl.c 37 2005-08-04 18:42:15Z fraggle $";
 
 
 #include <stdlib.h>
@@ -127,8 +130,8 @@
 ( fixed_t*	tmbox,
   line_t*	ld )
 {
-    int		p1;
-    int		p2;
+    int		p1 = 0;
+    int		p2 = 0;
 	
     switch (ld->slopetype)
     {
--- a/src/r_segs.c
+++ b/src/r_segs.c
@@ -1,7 +1,7 @@
 // Emacs style mode select   -*- C++ -*- 
 //-----------------------------------------------------------------------------
 //
-// $Id: r_segs.c 19 2005-07-23 19:17:11Z fraggle $
+// $Id: r_segs.c 37 2005-08-04 18:42:15Z fraggle $
 //
 // Copyright(C) 1993-1996 Id Software, Inc.
 // Copyright(C) 2005 Simon Howard
@@ -22,6 +22,9 @@
 // 02111-1307, USA.
 //
 // $Log$
+// Revision 1.4  2005/08/04 18:42:15  fraggle
+// Silence compiler warnings
+//
 // Revision 1.3  2005/07/23 19:17:11  fraggle
 // Use ANSI-standard limit constants.  Remove LINUX define.
 //
@@ -39,7 +42,7 @@
 
 
 static const char
-rcsid[] = "$Id: r_segs.c 19 2005-07-23 19:17:11Z fraggle $";
+rcsid[] = "$Id: r_segs.c 37 2005-08-04 18:42:15Z fraggle $";
 
 
 
@@ -230,8 +233,6 @@
     int			top;
     int			bottom;
 
-    //texturecolumn = 0;				// shut up compiler warning
-	
     for ( ; rw_x < rw_stopx ; rw_x++)
     {
 	// mark floor / ceiling areas
@@ -291,6 +292,12 @@
 	    dc_x = rw_x;
 	    dc_iscale = 0xffffffffu / (unsigned)rw_scale;
 	}
+        else
+        {
+            // purely to shut up the compiler
+
+            texturecolumn = 0;
+        }
 	
 	// draw the wall tiers
 	if (midtexture)
--- a/src/r_things.c
+++ b/src/r_things.c
@@ -1,7 +1,7 @@
 // Emacs style mode select   -*- C++ -*- 
 //-----------------------------------------------------------------------------
 //
-// $Id: r_things.c 19 2005-07-23 19:17:11Z fraggle $
+// $Id: r_things.c 37 2005-08-04 18:42:15Z fraggle $
 //
 // Copyright(C) 1993-1996 Id Software, Inc.
 // Copyright(C) 2005 Simon Howard
@@ -22,6 +22,9 @@
 // 02111-1307, USA.
 //
 // $Log$
+// Revision 1.4  2005/08/04 18:42:15  fraggle
+// Silence compiler warnings
+//
 // Revision 1.3  2005/07/23 19:17:11  fraggle
 // Use ANSI-standard limit constants.  Remove LINUX define.
 //
@@ -39,7 +42,7 @@
 
 
 static const char
-rcsid[] = "$Id: r_things.c 19 2005-07-23 19:17:11Z fraggle $";
+rcsid[] = "$Id: r_things.c 37 2005-08-04 18:42:15Z fraggle $";
 
 
 #include <stdio.h>
@@ -828,11 +831,12 @@
     unsorted.prev = vissprite_p-1;
     
     // pull the vissprites out by scale
-    //best = 0;		// shut up the compiler warning
+
     vsprsortedhead.next = vsprsortedhead.prev = &vsprsortedhead;
     for (i=0 ; i<count ; i++)
     {
 	bestscale = INT_MAX;
+        best = unsorted.next;
 	for (ds=unsorted.next ; ds!= &unsorted ; ds=ds->next)
 	{
 	    if (ds->scale < bestscale)
--- a/src/s_sound.c
+++ b/src/s_sound.c
@@ -1,7 +1,7 @@
 // Emacs style mode select   -*- C++ -*- 
 //-----------------------------------------------------------------------------
 //
-// $Id: s_sound.c 8 2005-07-23 16:44:57Z fraggle $
+// $Id: s_sound.c 37 2005-08-04 18:42:15Z fraggle $
 //
 // Copyright(C) 1993-1996 Id Software, Inc.
 // Copyright(C) 2005 Simon Howard
@@ -22,6 +22,9 @@
 // 02111-1307, USA.
 //
 // $Log$
+// Revision 1.3  2005/08/04 18:42:15  fraggle
+// Silence compiler warnings
+//
 // Revision 1.2  2005/07/23 16:44:57  fraggle
 // Update copyright to GNU GPL
 //
@@ -35,7 +38,7 @@
 
 
 static const char
-rcsid[] = "$Id: s_sound.c 8 2005-07-23 16:44:57Z fraggle $";
+rcsid[] = "$Id: s_sound.c 37 2005-08-04 18:42:15Z fraggle $";
 
 
 
@@ -664,7 +667,7 @@
 ( int			musicnum,
   int			looping )
 {
-    musicinfo_t*	music;
+    musicinfo_t*	music = NULL;
     char		namebuf[9];
 
     if ( (musicnum <= mus_None)
--- a/src/w_wad.c
+++ b/src/w_wad.c
@@ -1,7 +1,7 @@
 // Emacs style mode select   -*- C++ -*- 
 //-----------------------------------------------------------------------------
 //
-// $Id: w_wad.c 33 2005-08-04 01:13:46Z fraggle $
+// $Id: w_wad.c 37 2005-08-04 18:42:15Z fraggle $
 //
 // Copyright(C) 1993-1996 Id Software, Inc.
 // Copyright(C) 2005 Simon Howard
@@ -22,6 +22,9 @@
 // 02111-1307, USA.
 //
 // $Log$
+// Revision 1.5  2005/08/04 18:42:15  fraggle
+// Silence compiler warnings
+//
 // Revision 1.4  2005/08/04 01:13:46  fraggle
 // Loading disk
 //
@@ -42,15 +45,18 @@
 
 
 static const char
-rcsid[] = "$Id: w_wad.c 33 2005-08-04 01:13:46Z fraggle $";
+rcsid[] = "$Id: w_wad.c 37 2005-08-04 18:42:15Z fraggle $";
 
 
+#include <ctype.h>
 #include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
 
 #include "doomtype.h"
 #include "m_swap.h"
 #include "i_system.h"
+#include "i_video.h"
 #include "z_zone.h"
 
 #include "w_wad.h"