- Fixed all the warnings from GCC 4.2, including a handful that were

present in
  older GCCs.



SVN r430 (trunk)
This commit is contained in:
Randy Heit 2006-12-29 03:38:37 +00:00
parent ff65f75a8c
commit 851bf89442
33 changed files with 106 additions and 87 deletions

View file

@ -1,4 +1,6 @@
December 28, 2006
December 28, 2006
- Fixed all the warnings from GCC 4.2, including a handful that were present in
older GCCs.
- Fixed: The VC++ project was not set up to redefine RM using del in
wadsrc/Makefile, nor did it use the makefile for cleaning.
- Added ST_NetMessage() for mixing miscellaneous messages with the network

View file

@ -1135,7 +1135,7 @@ bool AM_clipMline (mline_t *ml, fline_t *fl)
register int outcode2 = 0;
register int outside;
fpoint_t tmp;
fpoint_t tmp = { 0, 0 };
int dx;
int dy;

View file

@ -403,7 +403,7 @@ CCMD (exec)
CCMD (logfile)
{
char *timestr = myasctime ();
const char *timestr = myasctime ();
if (Logfile)
{

View file

@ -698,8 +698,9 @@ void AddToConsole (int printlevel, const char *text)
worklen = size;
}
if (work == NULL)
{
work = TEXTCOLOR_RED "*** OUT OF MEMORY ***";
{
static char oom[] = TEXTCOLOR_RED "*** OUT OF MEMORY ***";
work = oom;
worklen = 0;
}
else

View file

@ -326,7 +326,7 @@ void FormatGUID (char *text, const GUID &guid)
}
// [RH] Returns the current local time as ASCII, even if it's too early
char *myasctime ()
const char *myasctime ()
{
time_t clock;
struct tm *lt;

View file

@ -49,7 +49,7 @@ bool CheckWildcards (const char *pattern, const char *text);
void FormatGUID (char *text, const GUID &guid);
char *myasctime ();
const char *myasctime ();
void strbin (char *str);

View file

@ -339,7 +339,7 @@ static BitName *BitNames;
static int NumBitNames;
struct Key {
char *name;
const char *name;
ptrdiff_t offset;
};
@ -359,7 +359,7 @@ static int PatchCodePtrs (int);
static int DoInclude (int);
static const struct {
char *name;
const char *name;
int (*func)(int);
} Modes[] = {
// These appear in .deh and .bex files

View file

@ -159,8 +159,8 @@ CVAR (Int, wipetype, 1, CVAR_ARCHIVE);
bool DrawFSHUD; // [RH] Draw fullscreen HUD?
wadlist_t *wadfiles; // [RH] remove limit on # of loaded wads
bool devparm; // started game with -devparm
char *D_DrawIcon; // [RH] Patch name of icon to draw on next refresh
int NoWipe; // [RH] Allow wipe? (Needs to be set each time)
const char *D_DrawIcon; // [RH] Patch name of icon to draw on next refresh
int NoWipe; // [RH] Allow wipe? (Needs to be set each time)
bool singletics = false; // debug flag to cancel adaptiveness
char startmap[8];
bool autostart;
@ -2273,11 +2273,12 @@ void D_DoomMain (void)
// turbo option // [RH] (now a cvar)
{
UCVarValue value;
UCVarValue value;
static char one_hundred[] = "100";
value.String = Args.CheckValue ("-turbo");
if (value.String == NULL)
value.String = "100";
value.String = one_hundred;
else
Printf ("turbo scale: %s%%\n", value.String);

View file

@ -52,7 +52,7 @@ void D_StartTitle (void);
// [RH] Set this to something to draw an icon during the next screen refresh.
extern char *D_DrawIcon;
extern const char *D_DrawIcon;
enum EIWADType

View file

@ -69,7 +69,7 @@ static bool FinaleHasPic;
static FString FinaleText;
static size_t FinaleTextLen;
static char *FinaleFlat;
static const char *FinaleFlat;
void F_StartCast (void);
void F_CastTicker (void);

View file

@ -418,7 +418,7 @@ CCMD (useflechette)
for (j = 0; j < 3; ++j)
{
AInventory *item;
if (item = who->FindInventory (bagnames[(i+j)%3]))
if ( (item = who->FindInventory (bagnames[(i+j)%3])) )
{
SendItemUse = item;
break;
@ -843,9 +843,10 @@ void G_Ticker ()
}
if (ToggleFullscreen)
{
{
static char toggle_fullscreen[] = "toggle fullscreen";
ToggleFullscreen = false;
AddCommandString ("toggle fullscreen");
AddCommandString (toggle_fullscreen);
}
// do things to change the game state
@ -1805,7 +1806,7 @@ void G_DoAutoSave ()
{
// Keep up to four autosaves at a time
UCVarValue num;
char *readableTime;
const char *readableTime;
int count = autosavecount != 0 ? autosavecount : 1;
num.Int = (autosavenum + 1) % count;
@ -1841,7 +1842,7 @@ static void PutSaveWads (FILE *file)
static void PutSaveComment (FILE *file)
{
char comment[256];
char *readableTime;
const char *readableTime;
WORD len;
int levelTime;

View file

@ -137,8 +137,26 @@ TArray<level_info_t> wadlevelinfos;
// MAPINFO is parsed slightly differently when the map name is just a number.
static bool HexenHack;
static level_info_t TheDefaultLevelInfo = { "", 0, "", "", "", "SKY1", 0, 0, 0, 0, NULL, "Unnamed", "COLORMAP", +8, -8 };
static char unnamed[] = "Unnamed";
static level_info_t TheDefaultLevelInfo =
{
"", // mapname
0, // levelnum
"", // pname,
"", // nextmap
"", // secretmap
"SKY1", // skypic1
0, // cluster
0, // partime
0, // sucktime
0, // flags
NULL, // music
unnamed, // level_name
"COLORMAP", // fadetable
+8, // WallVertLight
-8 // WallHorizLight
};
static cluster_info_t TheDefaultClusterInfo = { 0 };
@ -1316,7 +1334,7 @@ bool CheckWarpTransMap (char mapname[9], bool substitute)
//
static char d_mapname[256];
void G_DeferedInitNew (char *mapname)
void G_DeferedInitNew (const char *mapname)
{
strncpy (d_mapname, mapname, 8);
CheckWarpTransMap (d_mapname, true);
@ -1414,7 +1432,7 @@ void G_DoNewGame (void)
gameaction = ga_nothing;
}
void G_InitNew (char *mapname, bool bTitleLevel)
void G_InitNew (const char *mapname, bool bTitleLevel)
{
EGameSpeed oldSpeed;
bool wantFast;

View file

@ -291,12 +291,12 @@ extern bool savegamerestore;
// mapname will be changed if it is a valid warptrans
bool CheckWarpTransMap (char mapname[9], bool substitute);
void G_InitNew (char *mapname, bool bTitleLevel);
void G_InitNew (const char *mapname, bool bTitleLevel);
// Can be called by the startup code or M_Responder.
// A normal game starts at map 1,
// but a warp test can start elsewhere
void G_DeferedInitNew (char *mapname);
void G_DeferedInitNew (const char *mapname);
void G_ExitLevel (int position, bool keepFacing);
void G_SecretExitLevel (int position);

View file

@ -44,7 +44,7 @@ const char *GameNames[9] =
NULL, "Doom", "Heretic", NULL, "Hexen", NULL, NULL, NULL, "Strife"
};
static char *quitsounds[8] =
static const char *quitsounds[8] =
{
"player/male/death1",
"demon/pain",
@ -56,7 +56,7 @@ static char *quitsounds[8] =
"demon/melee"
};
static char *quitsounds2[8] =
static const char *quitsounds2[8] =
{
"vile/active",
"misc/p_pkup",

View file

@ -104,7 +104,7 @@ typedef struct
char numPages;
} indexed;
} info;
char **quitSounds;
const char **quitSounds;
int maxSwitch;
char borderFlat[9];
gameborder_t *border;

View file

@ -469,7 +469,7 @@ void GiveSpawner (player_t *player, const PClass *type, int amount)
}
}
void cht_Give (player_t *player, char *name, int amount)
void cht_Give (player_t *player, const char *name, int amount)
{
bool giveall;
int i;

View file

@ -31,7 +31,7 @@
class player_s;
struct PClass;
void cht_DoCheat (player_s *player, int cheat);
void cht_Give (player_s *player, char *item, int amount=1);
void cht_Give (player_s *player, const char *item, int amount=1);
void cht_Suicide (player_s *player);
const char *cht_Morph (player_s *player, const PClass *morphclass, bool quickundo);

View file

@ -222,7 +222,7 @@ static oldmenu_t *TopLevelMenu; // The main menu everything hangs off of
static DCanvas *FireScreen;
static BYTE FireRemap[256];
static char *genders[3] = { "male", "female", "other" };
static const char *genders[3] = { "male", "female", "other" };
static FPlayerClass *PlayerClass;
static int PlayerSkin;
static FState *PlayerState;

View file

@ -116,7 +116,7 @@ struct GUIDName;
typedef struct menuitem_s {
itemtype type;
char *label;
const char *label;
union {
FBaseCVar *cvar;
FIntCVar *intcvar;
@ -156,7 +156,7 @@ typedef struct menuitem_s {
} menuitem_t;
typedef struct menu_s {
char *texttitle;
const char *texttitle;
int lastOn;
int numitems;
int indent;
@ -171,7 +171,7 @@ typedef struct menu_s {
typedef struct value_s {
float value;
char *name;
const char *name;
} value_t;
typedef struct

View file

@ -133,7 +133,7 @@ value_t OnOff[2] = {
menu_t *CurrentMenu;
int CurrentItem;
static char *OldMessage;
static const char *OldMessage;
static itemtype OldType;
int flagsvar;
@ -149,7 +149,7 @@ enum
* Confirm Menu - Used by safemore
*
*=======================================*/
static void ActivateConfirm (char *text, void (*func)());
static void ActivateConfirm (const char *text, void (*func)());
static void ConfirmIsAGo ();
static menuitem_t ConfirmItems[] = {
@ -678,7 +678,7 @@ menu_t MapColorsMenu =
* Color Picker Sub-menu
*
*=======================================*/
static void StartColorPickerMenu (char *colorname, FColorCVar *cvar);
static void StartColorPickerMenu (const char *colorname, FColorCVar *cvar);
static void ColorPickerReset ();
static int CurrColorIndex;
static int SelColorIndex;
@ -1173,24 +1173,7 @@ static menu_t AdvSoundMenu =
AdvSoundItems,
};
void M_FreeValues (value_t **values, int num)
{
int i;
if (*values)
{
for (i = 0; i < num; i++)
{
if ((*values)[i].name)
free ((*values)[i].name);
}
free (*values);
*values = NULL;
}
}
static void ActivateConfirm (char *text, void (*func)())
static void ActivateConfirm (const char *text, void (*func)())
{
ConfirmItems[0].label = text;
ConfirmItems[0].e.mfunc = func;
@ -1688,7 +1671,7 @@ void M_OptDrawer ()
case bitflag:
{
value_t *value;
char *str;
const char *str;
if (item->b.min)
value = NoYes;
@ -2551,7 +2534,7 @@ static void ActivateColorChoice ()
ColorPickerItems[0].a.colorcvar->SetGenericRep (val, CVAR_Int);
}
static void StartColorPickerMenu (char *colorname, FColorCVar *cvar)
static void StartColorPickerMenu (const char *colorname, FColorCVar *cvar)
{
ColorPickerMenu.PreDraw = ColorPickerDrawer;
ColorPickerMenu.EscapeHandler = ActivateColorChoice;
@ -2778,8 +2761,9 @@ CCMD (menu_mididevice)
#endif
static void MakeSoundChanges (void)
{
AddCommandString ("snd_reset");
{
static char snd_reset[] = "snd_reset";
AddCommandString (snd_reset);
}
static void VideoOptions (void)
@ -2932,7 +2916,7 @@ static void SetModesMenu (int w, int h, int bits)
if (testingmode <= 1)
{
if (ModesItems[VM_ENTERLINE].label != VMEnterText)
free (ModesItems[VM_ENTERLINE].label);
free (const_cast<char *>(ModesItems[VM_ENTERLINE].label));
ModesItems[VM_ENTERLINE].label = VMEnterText;
ModesItems[VM_TESTLINE].label = VMTestText;
}

View file

@ -351,7 +351,8 @@ DWORD FNodeBuilder::PushGLSeg (TArray<seg_t> &segs, const FPrivSeg *seg, vertex_
newseg.sidedef = NULL;
}
newseg.PartnerSeg = (seg_t *)(seg->partner == DWORD_MAX ? 0 : (size_t)seg->partner + 1);
newseg.bPolySeg = false;
newseg.bPolySeg = false;
newseg.Subsector = NULL;
return (DWORD)segs.Push (newseg);
}
@ -366,6 +367,7 @@ void FNodeBuilder::PushConnectingGLSeg (int subsector, TArray<seg_t> &segs, vert
newseg.linedef = NULL;
newseg.sidedef = NULL;
newseg.PartnerSeg = NULL;
newseg.bPolySeg = false;
newseg.bPolySeg = false;
newseg.Subsector = NULL;
segs.Push (newseg);
}

View file

@ -231,7 +231,11 @@ DWORD FNodeBuilder::AddMiniseg (int v1, int v2, DWORD partner, DWORD seg1, DWORD
newseg.linedef = -1;
newseg.loopnum = 0;
newseg.next = DWORD_MAX;
newseg.planefront = true;
newseg.planefront = true;
newseg.hashnext = NULL;
newseg.storedseg = NULL;
newseg.frontsector = NULL;
newseg.backsector = NULL;
if (splitseg != DWORD_MAX)
{

View file

@ -148,7 +148,11 @@ int FNodeBuilder::CreateSeg (int linenum, int sidenum)
seg.next = DWORD_MAX;
seg.loopnum = 0;
seg.partner = DWORD_MAX;
seg.partner = DWORD_MAX;
seg.hashnext = NULL;
seg.planefront = DWORD_MAX;
seg.planenum = DWORD_MAX;
seg.storedseg = DWORD_MAX;
if (sidenum == 0)
{ // front

View file

@ -188,7 +188,7 @@ static void P_SetSideNum (DWORD *sidenum_p, WORD sidenum);
struct checkstruct
{
char *lumpname;
const char lumpname[9];
bool required;
};
@ -196,7 +196,7 @@ static int GetMapIndex(const char *mapname, int lastindex, const char *lumpname,
{
static const checkstruct check[] =
{
{NULL, true},
{"", true},
{"THINGS", true},
{"LINEDEFS", true},
{"SIDEDEFS", true},

View file

@ -24,7 +24,7 @@ static int WriteBEHAVIOR (FILE *file);
CCMD (dumpmap)
{
char *mapname;
const char *mapname;
FILE *file;
if (argv.argc() < 2)

View file

@ -934,7 +934,7 @@ static InterpolationViewer *FindPastViewer (AActor *actor)
}
// Not found, so make a new one
InterpolationViewer iview;
InterpolationViewer iview = { 0 };
iview.ViewActor = actor;
iview.otic = -1;
return &PastViewers[PastViewers.Push (iview)];

View file

@ -1045,7 +1045,7 @@ void R_DrawSkyBoxes ()
if (visplanes[MAXVISPLANES] == NULL)
return;
VisplaneAndAlpha vaAdder;
VisplaneAndAlpha vaAdder = { 0 };
int savedextralight = extralight;
fixed_t savedx = viewx;
fixed_t savedy = viewy;
@ -1175,7 +1175,7 @@ void R_DrawSkyBoxes ()
// sake of nested skyboxes.
while (interestingStack.Pop (FirstInterestingDrawseg))
{
ptrdiff_t pd;
ptrdiff_t pd = 0;
drawsegStack.Pop (pd);
firstdrawseg = drawsegs + pd;

View file

@ -327,7 +327,7 @@ int PolyClipper::DoMost (float x0, float y0, float x1, float y1, pmostcallbackty
double dx, d, n, t;
float spx[4], spy[4], cy[2], cv[2];
int j, k, z, scnt, dir, spt[4];
vsptype *vsp, *nvsp, *vcnt, *ni;
vsptype *vsp, *nvsp, *vcnt = NULL, *ni;
int did = 1;
if (x0 < x1)
@ -670,7 +670,7 @@ void printnum(int x, int y, int num)
void drawpolymosttest()
{
float cx0, cy0, fx0, fy0;
float cx0 = 0, cy0 = 0, fx0 = 0, fy0 = 0;
int ccol, fcol;
PolyClipper::vsptype *vsp, *ovsp = &TestPoly.UsedList, *nvsp;
@ -1035,7 +1035,7 @@ void RP_AddLine (seg_t *line)
fixed_t tx1, tx2, ty1, ty2;
fixed_t fcz0, ffz0, fcz1, ffz1, bcz0, bfz0, bcz1, bfz1;
double x0, x1, xp0, yp0, xp1, yp1, oxp0, oyp0, nx0, ny0, nx1, ny1, ryp0, ryp1;
double cy0, fy0, cy1, fy1, ocy0, ofy0, ocy1, ofy1;
double cy0, fy0, cy1, fy1, ocy0 = 0, ofy0 = 0, ocy1 = 0, ofy1 = 0;
double t0, t1;
double x, y;

View file

@ -62,7 +62,6 @@ int sc_Line;
bool sc_End;
bool sc_Crossed;
bool sc_FileScripts = false;
char *sc_ScriptsDir = "";
// PRIVATE DATA DEFINITIONS ------------------------------------------------

View file

@ -156,6 +156,5 @@ extern int sc_Line;
extern bool sc_End;
extern bool sc_Crossed;
extern bool sc_FileScripts;
extern char *sc_ScriptsDir;
#endif //__SC_MAN_H__

View file

@ -122,9 +122,9 @@ public:
item = Array[--Count];
Array[Count].~T();
return true;
}
return false;
}
}
return false;
}
void Delete (unsigned int index)
{
if (index < Count)

View file

@ -400,7 +400,7 @@ static void DoJump(AActor * self, FState * CallingState, int offset)
jumpto = cls->ActorInfo->FindState(numnames, &JumpParameters[offset+2]);
if (jumpto == NULL)
{
char * dot="";
const char *dot="";
Printf("Jump target '");
if (classname != NAME_None) Printf("%s::", classname.GetChars());
for (int i=0;i<numnames;i++)

View file

@ -1715,7 +1715,9 @@ FWadLump FWadCollection::OpenLumpNum (int lump)
}
else if (l->flags & LUMPF_EXTERNAL)
{
FILE * f;
static char zero = '\0';
FILE *f;
if (wad != NULL) // The WadRecord in this case is just a means to store a path
{
FString name;
@ -1731,7 +1733,7 @@ FWadLump FWadCollection::OpenLumpNum (int lump)
// the complete contents into a memory buffer first
if (f != NULL)
{
char * buffer = new char[l->size+1]; // the last byte is used as a reference counter
char *buffer = new char[l->size+1]; // the last byte is used as a reference counter
buffer[l->size] = 0;
fread(buffer, 1, l->size, f);
fclose(f);
@ -1739,7 +1741,7 @@ FWadLump FWadCollection::OpenLumpNum (int lump)
}
// The file got deleted or worse. At least return something.
Printf("%s: Unable to open file\n", l->fullname);
return FWadLump("", 1, false);
return FWadLump(&zero, 1, false);
}
else if (wad->MemoryData != NULL)
{
@ -1796,8 +1798,10 @@ FWadLump *FWadCollection::ReopenLumpNum (int lump)
return new FWadLump(buffer, l->size, true); //... but restore the file pointer afterward!
}
else if (l->flags & LUMPF_EXTERNAL)
{
FILE * f;
{
static char zero = '\0';
FILE *f;
if (wad != NULL) // The WadRecord in this case is just a means to store a path
{
FString name;
@ -1813,7 +1817,7 @@ FWadLump *FWadCollection::ReopenLumpNum (int lump)
// the complete contents into a memory buffer first
if (f != NULL)
{
char * buffer = new char[l->size+1]; // the last byte is used as a reference counter
char *buffer = new char[l->size+1]; // the last byte is used as a reference counter
buffer[l->size] = 0;
fread(buffer, 1, l->size, f);
fclose(f);
@ -1821,7 +1825,7 @@ FWadLump *FWadCollection::ReopenLumpNum (int lump)
}
// The file got deleted or worse. At least return something.
Printf("%s: Unable to open file\n", l->fullname);
return new FWadLump("", 1, false);
return new FWadLump(&zero, 1, false);
}
else if (wad->MemoryData!=NULL)
{