Fixed doomclassic compiler warnings

This commit is contained in:
Felix Rueegg 2013-11-16 16:22:42 +01:00
parent bbd634b01e
commit 502b9fa180
29 changed files with 100 additions and 95 deletions

View file

@ -27,16 +27,17 @@ If you have questions concerning this license or the applicable additional terms
*/ */
#include "Precompiled.h" #include "Precompiled.h"
#include "globaldata.h"
// We are referring to sprite numbers.
#include "info.h"
#ifdef __GNUG__ #ifdef __GNUG__
#pragma implementation "d_items.h" #pragma implementation "d_items.h"
#endif #endif
#include "d_items.h" #include "d_items.h"
#include "globaldata.h"
// We are referring to sprite numbers.
#include "info.h"
// //
// PSPRITE ACTIONS for waepons. // PSPRITE ACTIONS for waepons.

View file

@ -414,7 +414,7 @@ void D_DoAdvanceDemo (void)
::g->pagetic = 8 * TICRATE; ::g->pagetic = 8 * TICRATE;
::g->gamestate = GS_DEMOSCREEN; ::g->gamestate = GS_DEMOSCREEN;
::g->pagename = "INTERPIC"; ::g->pagename = (char *)"INTERPIC";
if ( ::g->gamemode == commercial ) if ( ::g->gamemode == commercial )
S_StartMusic(mus_dm2ttl); S_StartMusic(mus_dm2ttl);
@ -428,7 +428,7 @@ void D_DoAdvanceDemo (void)
case 2: case 2:
::g->pagetic = 3 * TICRATE; ::g->pagetic = 3 * TICRATE;
::g->gamestate = GS_DEMOSCREEN; ::g->gamestate = GS_DEMOSCREEN;
::g->pagename = "INTERPIC"; ::g->pagename = (char *)"INTERPIC";
break; break;
case 3: case 3:
G_DeferedPlayDemo ("demo2"); G_DeferedPlayDemo ("demo2");
@ -436,7 +436,7 @@ void D_DoAdvanceDemo (void)
case 4: case 4:
::g->pagetic = 3 * TICRATE; ::g->pagetic = 3 * TICRATE;
::g->gamestate = GS_DEMOSCREEN; ::g->gamestate = GS_DEMOSCREEN;
::g->pagename = "INTERPIC"; ::g->pagename = (char *)"INTERPIC";
break; break;
case 5: case 5:
G_DeferedPlayDemo ("demo3"); G_DeferedPlayDemo ("demo3");
@ -445,7 +445,7 @@ void D_DoAdvanceDemo (void)
case 6: case 6:
::g->pagetic = 3 * TICRATE; ::g->pagetic = 3 * TICRATE;
::g->gamestate = GS_DEMOSCREEN; ::g->gamestate = GS_DEMOSCREEN;
::g->pagename = "INTERPIC"; ::g->pagename = (char *)"INTERPIC";
break; break;
case 7: case 7:
G_DeferedPlayDemo ("demo4"); G_DeferedPlayDemo ("demo4");

View file

@ -27,14 +27,15 @@ If you have questions concerning this license or the applicable additional terms
*/ */
#include "Precompiled.h" #include "Precompiled.h"
#include "globaldata.h"
#ifdef __GNUG__ #ifdef __GNUG__
#pragma implementation "doomdef.h" #pragma implementation "doomdef.h"
#endif #endif
#include "doomdef.h" #include "doomdef.h"
#include "globaldata.h"
// Location for any defines turned variables. // Location for any defines turned variables.
// None. // None.

View file

@ -41,7 +41,7 @@ extern void I_SetTime( int );
bool waitingForWipe; bool waitingForWipe;
static const int dargc = 7; static const int dargc = 7;
static char* dargv[4][7] = static const char* dargv[4][7] =
{ {
{ "doomlauncher", "-net", "0", "127.0.0.1", "127.0.0.1", "127.0.0.1", "127.0.0.1" }, { "doomlauncher", "-net", "0", "127.0.0.1", "127.0.0.1", "127.0.0.1", "127.0.0.1" },
{ "doomlauncher", "-net", "1", "127.0.0.1", "127.0.0.1", "127.0.0.1", "127.0.0.1" }, { "doomlauncher", "-net", "1", "127.0.0.1", "127.0.0.1", "127.0.0.1", "127.0.0.1" },
@ -106,7 +106,7 @@ void DoomInterface::Startup( int playerscount, bool multiplayer )
printf( "\n" ); printf( "\n" );
DoomLib::InitGame(mpArgc[i], mpArgVPtr[i] ); DoomLib::InitGame(mpArgc[i], mpArgVPtr[i] );
} else { } else {
DoomLib::InitGame(localdargc, dargv[i] ); DoomLib::InitGame(localdargc, (char **)dargv[i] );
} }
if( DoomLib::skipToLoad ) { if( DoomLib::skipToLoad ) {

View file

@ -498,7 +498,7 @@ int DoomLib::PlayerIndexToRemoteNode( int index ) {
return indexMap[::g->consoleplayer][index]; return indexMap[::g->consoleplayer][index];
} }
void I_Error (char *error, ...); void I_Error (const char *error, ...);
extern bool useTech5Packets; extern bool useTech5Packets;
void DoomLib::PollNetwork() { void DoomLib::PollNetwork() {

View file

@ -27,14 +27,13 @@ If you have questions concerning this license or the applicable additional terms
*/ */
#include "Precompiled.h" #include "Precompiled.h"
#include "globaldata.h"
#ifdef __GNUG__ #ifdef __GNUG__
#pragma implementation "dstrings.h" #pragma implementation "dstrings.h"
#endif #endif
#include "dstrings.h" #include "dstrings.h"
#include "globaldata.h"
const char* endmsg[NUM_QUITMESSAGES+1]= const char* endmsg[NUM_QUITMESSAGES+1]=

View file

@ -592,9 +592,9 @@ qboolean F_CastResponder (event_t* ev)
} }
void F_CastPrint (char* text) void F_CastPrint (const char* text)
{ {
char* ch; const char* ch;
int c; int c;
int cx; int cx;
int w; int w;

View file

@ -1844,9 +1844,9 @@ void G_BeginRecording (void)
// //
// G_PlayDemo // G_PlayDemo
// //
void G_DeferedPlayDemo (char* name) void G_DeferedPlayDemo (const char* name)
{ {
::g->defdemoname = name; ::g->defdemoname = (char *)name;
::g->gameaction = ga_playdemo; ::g->gameaction = ga_playdemo;
} }
@ -1946,14 +1946,14 @@ void G_DoPlayDemo (void)
// //
// G_TimeDemo // G_TimeDemo
// //
void G_TimeDemo (char* name) void G_TimeDemo (const char* name)
{ {
::g->nodrawers = M_CheckParm ("-nodraw"); ::g->nodrawers = M_CheckParm ("-nodraw");
::g->noblit = M_CheckParm ("-noblit"); ::g->noblit = M_CheckParm ("-noblit");
::g->timingdemo = true; ::g->timingdemo = true;
::g->singletics = true; ::g->singletics = true;
::g->defdemoname = name; ::g->defdemoname = (char *)name;
::g->gameaction = ga_playdemo; ::g->gameaction = ga_playdemo;
} }

View file

@ -46,7 +46,7 @@ void G_InitNew ( skill_t skill, int episode, int map );
// but a warp test can start elsewhere // but a warp test can start elsewhere
void G_DeferedInitNew (skill_t skill, int episode, int map); void G_DeferedInitNew (skill_t skill, int episode, int map);
void G_DeferedPlayDemo (char* demo); void G_DeferedPlayDemo (const char* demo);
// Can be called by the startup code or M_Responder, // Can be called by the startup code or M_Responder,
// calls P_SetupLevel or W_EnterWorld. // calls P_SetupLevel or W_EnterWorld.
@ -63,7 +63,7 @@ void G_RecordDemo (char* name);
void G_BeginRecording (void); void G_BeginRecording (void);
void G_PlayDemo (char* name); void G_PlayDemo (char* name);
void G_TimeDemo (char* name); void G_TimeDemo (const char* name);
qboolean G_CheckDemoStatus (void); qboolean G_CheckDemoStatus (void);
void G_ExitLevel (void); void G_ExitLevel (void);

View file

@ -84,11 +84,11 @@ void M_SetupNextMenu(menu_t *menudef);
void M_DrawThermo(int x,int y,int thermWidth,int thermDot); void M_DrawThermo(int x,int y,int thermWidth,int thermDot);
void M_DrawEmptyCell(menu_t *menu,int item); void M_DrawEmptyCell(menu_t *menu,int item);
void M_DrawSelCell(menu_t *menu,int item); void M_DrawSelCell(menu_t *menu,int item);
void M_WriteText(int x, int y, char *string); void M_WriteText(int x, int y, const char *string);
int M_StringWidth(char *string); int M_StringWidth(const char *string);
int M_StringHeight(char *string); int M_StringHeight(const char *string);
void M_StartControlPanel(void); void M_StartControlPanel(void);
void M_StartMessage(char *string,messageRoutine_t routine,qboolean input); void M_StartMessage(const char *string,messageRoutine_t routine,qboolean input);
void M_StopMessage(void); void M_StopMessage(void);
void M_ClearMenus (void); void M_ClearMenus (void);

View file

@ -97,16 +97,17 @@ void (*netsend) (void);
// //
int UDPsocket (void) int UDPsocket (void)
{ {
int s; //int s;
// allocate a socket // allocate a socket
//s = socket (AF_INET, SOCK_DGRAM, IPPROTO_UDP); //s = socket (AF_INET, SOCK_DGRAM, IPPROTO_UDP);
if ( !IsValidSocket( s ) ) { //if ( !IsValidSocket( s ) ) {
int err = GetLastSocketError(); // int err = GetLastSocketError();
I_Error( "can't create socket, error %d", err ); // I_Error( "can't create socket, error %d", err );
} //}
return s; //return s;
return 0;
} }
// //
@ -265,15 +266,15 @@ void I_ShutdownNetwork( void ) {
void I_NetCmd (void) void I_NetCmd (void)
{ {
if (::g->doomcom.command == CMD_SEND) //if (::g->doomcom.command == CMD_SEND)
{ //{
netsend (); // netsend ();
} //}
else if (::g->doomcom.command == CMD_GET) //else if (::g->doomcom.command == CMD_GET)
{ //{
netget (); // netget ();
} //}
else //else
I_Error ("Bad net cmd: %i\n",::g->doomcom.command); // I_Error ("Bad net cmd: %i\n",::g->doomcom.command);
} }

View file

@ -149,7 +149,7 @@ getsfx
// This function loads the sound data from the WAD lump, // This function loads the sound data from the WAD lump,
// for single sound. // for single sound.
// //
void* getsfx ( char* sfxname, int* len ) void* getsfx ( const char* sfxname, int* len )
{ {
unsigned char* sfx; unsigned char* sfx;
unsigned char* sfxmem; unsigned char* sfxmem;

View file

@ -158,7 +158,7 @@ getsfx
// This function loads the sound data from the WAD lump, // This function loads the sound data from the WAD lump,
// for single sound. // for single sound.
// //
void* getsfx ( char* sfxname, int* len ) void* getsfx ( const char* sfxname, int* len )
{ {
unsigned char* sfx; unsigned char* sfx;
unsigned char* sfxmem; unsigned char* sfxmem;

View file

@ -126,7 +126,7 @@ void I_EndRead(void)
// I_Error // I_Error
// //
extern bool debugOutput; extern bool debugOutput;
void I_Printf(char* msg, ...) void I_Printf(const char* msg, ...)
{ {
char pmsg[1024]; char pmsg[1024];
va_list argptr; va_list argptr;
@ -143,7 +143,7 @@ void I_Printf(char* msg, ...)
} }
void I_PrintfE(char* msg, ...) void I_PrintfE(const char* msg, ...)
{ {
char pmsg[1024]; char pmsg[1024];
va_list argptr; va_list argptr;
@ -160,7 +160,7 @@ void I_PrintfE(char* msg, ...)
} }
} }
void I_Error(char *error, ...) void I_Error(const char *error, ...)
{ {
const int ERROR_MSG_SIZE = 1024; const int ERROR_MSG_SIZE = 1024;
char error_msg[ERROR_MSG_SIZE]; char error_msg[ERROR_MSG_SIZE];

View file

@ -79,9 +79,9 @@ ticcmd_t* I_BaseTiccmd (void);
void I_Quit (void); void I_Quit (void);
void I_Error (char *error, ...); void I_Error (const char *error, ...);
void I_Printf(char *error, ...); void I_Printf(const char *error, ...);
void I_PrintfE(char *error, ...); void I_PrintfE(const char *error, ...);
#endif #endif

View file

@ -27,19 +27,21 @@ If you have questions concerning this license or the applicable additional terms
*/ */
#include "Precompiled.h" #include "Precompiled.h"
#include "globaldata.h"
// Data.
#include "sounds.h"
#include "m_fixed.h"
#ifdef __GNUG__ #ifdef __GNUG__
#pragma implementation "info.h" #pragma implementation "info.h"
#endif #endif
#include "info.h" #include "info.h"
#include "globaldata.h"
// Data.
#include "sounds.h"
#include "m_fixed.h"
#include "p_mobj.h" #include "p_mobj.h"
// RB: sprnames must be NULL-terminated // RB: sprnames must be NULL-terminated
const char * const sprnames[NUMSPRITES + 1] = { const char * const sprnames[NUMSPRITES + 1] = {
"TROO","SHTG","PUNG","PISG","PISF","SHTF","SHT2","CHGG","CHGF","MISG", "TROO","SHTG","PUNG","PISG","PISF","SHTF","SHT2","CHGG","CHGF","MISG",

View file

@ -42,7 +42,7 @@ If you have questions concerning this license or the applicable additional terms
// in the program's command line arguments. // in the program's command line arguments.
// Returns the argument number (1 to argc-1) // Returns the argument number (1 to argc-1)
// or 0 if not present // or 0 if not present
int M_CheckParm (char *check) int M_CheckParm (const char *check)
{ {
int i; int i;

View file

@ -37,7 +37,7 @@ extern char** myargv;
// Returns the position of the given parameter // Returns the position of the given parameter
// in the arg list (0 if not found). // in the arg list (0 if not found).
int M_CheckParm (char* check); int M_CheckParm (const char* check);
#endif #endif

View file

@ -27,19 +27,18 @@ If you have questions concerning this license or the applicable additional terms
*/ */
#include "Precompiled.h" #include "Precompiled.h"
#include "globaldata.h"
#include "stdlib.h"
#include "doomtype.h"
#include "i_system.h"
#ifdef __GNUG__ #ifdef __GNUG__
#pragma implementation "m_fixed.h" #pragma implementation "m_fixed.h"
#endif #endif
#include "m_fixed.h" #include "m_fixed.h"
#include "globaldata.h"
#include "stdlib.h"
#include "doomtype.h"
#include "i_system.h"
// Fixme. __USE_C_FIXED__ or something. // Fixme. __USE_C_FIXED__ or something.

View file

@ -183,11 +183,11 @@ void M_SetupNextMenu(menu_t *menudef);
void M_DrawThermo(int x,int y,int thermWidth,int thermDot); void M_DrawThermo(int x,int y,int thermWidth,int thermDot);
void M_DrawEmptyCell(menu_t *menu,int item); void M_DrawEmptyCell(menu_t *menu,int item);
void M_DrawSelCell(menu_t *menu,int item); void M_DrawSelCell(menu_t *menu,int item);
void M_WriteText(int x, int y, char *string); void M_WriteText(int x, int y, const char *string);
int M_StringWidth(char *string); int M_StringWidth(const char *string);
int M_StringHeight(char *string); int M_StringHeight(const char *string);
void M_StartControlPanel(void); void M_StartControlPanel(void);
void M_StartMessage(char *string,messageRoutine_t routine,qboolean input); void M_StartMessage(const char *string,messageRoutine_t routine,qboolean input);
void M_StopMessage(void); void M_StopMessage(void);
void M_ClearMenus (void); void M_ClearMenus (void);
@ -1051,13 +1051,13 @@ M_DrawSelCell
void void
M_StartMessage M_StartMessage
( char* string, ( const char* string,
messageRoutine_t routine, messageRoutine_t routine,
qboolean input ) qboolean input )
{ {
::g->messageLastMenuActive = ::g->menuactive; ::g->messageLastMenuActive = ::g->menuactive;
::g->messageToPrint = 1; ::g->messageToPrint = 1;
::g->messageString = string; ::g->messageString = (char *)string;
::g->messageRoutine = (messageRoutine_t)routine; ::g->messageRoutine = (messageRoutine_t)routine;
::g->messageNeedsInput = input; ::g->messageNeedsInput = input;
::g->menuactive = true; ::g->menuactive = true;
@ -1077,7 +1077,7 @@ void M_StopMessage(void)
// //
// Find string width from ::g->hu_font chars // Find string width from ::g->hu_font chars
// //
int M_StringWidth(char* string) int M_StringWidth(const char* string)
{ {
unsigned int i; unsigned int i;
int w = 0; int w = 0;
@ -1100,7 +1100,7 @@ int M_StringWidth(char* string)
// //
// Find string height from ::g->hu_font chars // Find string height from ::g->hu_font chars
// //
int M_StringHeight(char* string) int M_StringHeight(const char* string)
{ {
unsigned int i; unsigned int i;
int h; int h;
@ -1122,10 +1122,10 @@ void
M_WriteText M_WriteText
( int x, ( int x,
int y, int y,
char* string) const char* string)
{ {
int w; int w;
char* ch; const char* ch;
int c; int c;
int cx; int cx;
int cy; int cy;

View file

@ -38,7 +38,7 @@ typedef struct sfxinfo_struct sfxinfo_t;
struct sfxinfo_struct struct sfxinfo_struct
{ {
// up to 6-character name // up to 6-character name
char* name; const char* name;
// Sfx singularity (only one at a time) // Sfx singularity (only one at a time)
int singularity; int singularity;

View file

@ -53,7 +53,7 @@ typedef struct
// f_finale.structs begin // // f_finale.structs begin //
typedef struct typedef struct
{ {
char *name; const char *name;
mobjtype_t type; mobjtype_t type;
} castinfo_t; } castinfo_t;
// f_finale.structs end // // f_finale.structs end //
@ -212,7 +212,7 @@ typedef enum
// m_misc.structs begin // // m_misc.structs begin //
struct default_t struct default_t
{ {
char* name; const char* name;
union { union {
int * location; int * location;
const char * * charLocation; const char * * charLocation;
@ -232,13 +232,13 @@ struct default_t
untranslated( 0 ) { untranslated( 0 ) {
} }
default_t( char * name_, int * location_, int defaultvalue_ ) : default_t( const char * name_, int * location_, int defaultvalue_ ) :
name( name_ ), name( name_ ),
location( location_ ), location( location_ ),
defaultvalue( defaultvalue_ ) { defaultvalue( defaultvalue_ ) {
} }
default_t( char * name_, const char * * charLocation_, const char * charDefault_ ) : default_t( const char * name_, const char * * charLocation_, const char * charDefault_ ) :
name( name_ ), name( name_ ),
charLocation( charLocation_ ), charLocation( charLocation_ ),
charDefault( charDefault_ ) { charDefault( charDefault_ ) {

View file

@ -27,6 +27,12 @@ If you have questions concerning this license or the applicable additional terms
*/ */
#include "Precompiled.h" #include "Precompiled.h"
#ifdef __GNUG__
#pragma implementation "w_wad.h"
#endif
#include "w_wad.h"
#include "globaldata.h" #include "globaldata.h"
@ -44,12 +50,6 @@ If you have questions concerning this license or the applicable additional terms
#include "idlib/precompiled.h" #include "idlib/precompiled.h"
#ifdef __GNUG__
#pragma implementation "w_wad.h"
#endif
#include "w_wad.h"
// //
// GLOBALS // GLOBALS

View file

@ -23,7 +23,9 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#define __WIN32__ #define __WIN32__
#endif #endif
#ifndef LITTLE_ENDIAN
#define LITTLE_ENDIAN #define LITTLE_ENDIAN
#endif
#include <stdint.h> #include <stdint.h>

View file

@ -58,14 +58,14 @@ song if we're less than a second into this one. */
#define VERB_DEBUG_SILLY 4 #define VERB_DEBUG_SILLY 4
typedef struct { typedef struct {
char *id_name, id_character; const char *id_name, id_character;
int verbosity, trace_playing, opened; int verbosity, trace_playing, opened;
int (*open)(int using_stdin, int using_stdout); int (*open)(int using_stdin, int using_stdout);
void (*pass_playing_list)(int number_of_files, char *list_of_files[]); void (*pass_playing_list)(int number_of_files, char *list_of_files[]);
void (*close)(void); void (*close)(void);
int (*read)(int *valp); int (*read)(int *valp);
int (*cmsg)(int type, int verbosity_level, char *fmt, ...); int (*cmsg)(int type, int verbosity_level, const char *fmt, ...);
void (*refresh)(void); void (*refresh)(void);
void (*reset)(void); void (*reset)(void);

View file

@ -194,10 +194,10 @@ static Instrument *load_instrument(char *name, int percussion,
idFile * fp; idFile * fp;
uint8_t tmp[1024]; uint8_t tmp[1024];
int i,j,noluck=0; int i,j,noluck=0;
char *path; const char *path;
char filename[1024]; char filename[1024];
#ifdef PATCH_EXT_LIST #ifdef PATCH_EXT_LIST
static char *patch_ext[] = PATCH_EXT_LIST; static const char *patch_ext[] = PATCH_EXT_LIST;
#endif #endif
if (!name) return 0; if (!name) return 0;

View file

@ -113,7 +113,7 @@ static int32_t getvl(void)
/* Print a string from the file, followed by a newline. Any non-ASCII /* Print a string from the file, followed by a newline. Any non-ASCII
or unprintable characters will be converted to periods. */ or unprintable characters will be converted to periods. */
static int dumpstring( int32_t len, char *label) static int dumpstring( int32_t len, const char *label)
{ {
signed char *s=(signed char *)safe_malloc(len+1); signed char *s=(signed char *)safe_malloc(len+1);
if (len != (int32_t)read_local(s, 1, len)) if (len != (int32_t)read_local(s, 1, len))
@ -171,7 +171,7 @@ static MidiEventList *read_midi_event(void)
len=getvl(); len=getvl();
if (type>0 && type<16) if (type>0 && type<16)
{ {
static char *label[]={ static const char *label[]={
"Text event: ", "Text: ", "Copyright: ", "Track name: ", "Text event: ", "Text: ", "Copyright: ", "Track name: ",
"Instrument: ", "Lyric: ", "Marker: ", "Cue point: "}; "Instrument: ", "Lyric: ", "Marker: ", "Cue point: "};
dumpstring(len, label[(type>7) ? 0 : type]); dumpstring(len, label[(type>7) ? 0 : type]);

View file

@ -51,7 +51,7 @@ static void ctl_reset(void);
static int ctl_open(int using_stdin, int using_stdout); static int ctl_open(int using_stdin, int using_stdout);
static void ctl_close(void); static void ctl_close(void);
static int ctl_read(int *valp); static int ctl_read(int *valp);
static int cmsg(int type, int verbosity_level, char *fmt, ...); static int cmsg(int type, int verbosity_level, const char *fmt, ...);
#ifdef _DEBUG #ifdef _DEBUG
#define safeOutputDebug(x) printf( "%s", x ) #define safeOutputDebug(x) printf( "%s", x )
@ -92,7 +92,7 @@ static int ctl_read(int *valp)
} }
extern void SendDebugMsg(const char*); extern void SendDebugMsg(const char*);
extern bool debugOutput; extern bool debugOutput;
static int cmsg(int type, int verbosity_level, char *fmt, ...) static int cmsg(int type, int verbosity_level, const char *fmt, ...)
{ {
#ifdef _DEBUG #ifdef _DEBUG
va_list ap; va_list ap;

View file

@ -54,9 +54,9 @@ extern void Real_Tim_Free( void *pt );
typedef struct { typedef struct {
int rate, encoding; int rate, encoding;
char *id_name; const char *id_name;
FILE* fp; FILE* fp;
char *file_name; const char *file_name;
int (*open_output)(void); /* 0=success, 1=warning, -1=fatal error */ int (*open_output)(void); /* 0=success, 1=warning, -1=fatal error */
void (*close_output)(void); void (*close_output)(void);