- 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 - Fixed: The VC++ project was not set up to redefine RM using del in
wadsrc/Makefile, nor did it use the makefile for cleaning. wadsrc/Makefile, nor did it use the makefile for cleaning.
- Added ST_NetMessage() for mixing miscellaneous messages with the network - 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 outcode2 = 0;
register int outside; register int outside;
fpoint_t tmp; fpoint_t tmp = { 0, 0 };
int dx; int dx;
int dy; int dy;

View file

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

View file

@ -698,8 +698,9 @@ void AddToConsole (int printlevel, const char *text)
worklen = size; worklen = size;
} }
if (work == NULL) if (work == NULL)
{ {
work = TEXTCOLOR_RED "*** OUT OF MEMORY ***"; static char oom[] = TEXTCOLOR_RED "*** OUT OF MEMORY ***";
work = oom;
worklen = 0; worklen = 0;
} }
else 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 // [RH] Returns the current local time as ASCII, even if it's too early
char *myasctime () const char *myasctime ()
{ {
time_t clock; time_t clock;
struct tm *lt; struct tm *lt;

View file

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

View file

@ -339,7 +339,7 @@ static BitName *BitNames;
static int NumBitNames; static int NumBitNames;
struct Key { struct Key {
char *name; const char *name;
ptrdiff_t offset; ptrdiff_t offset;
}; };
@ -359,7 +359,7 @@ static int PatchCodePtrs (int);
static int DoInclude (int); static int DoInclude (int);
static const struct { static const struct {
char *name; const char *name;
int (*func)(int); int (*func)(int);
} Modes[] = { } Modes[] = {
// These appear in .deh and .bex files // 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? bool DrawFSHUD; // [RH] Draw fullscreen HUD?
wadlist_t *wadfiles; // [RH] remove limit on # of loaded wads wadlist_t *wadfiles; // [RH] remove limit on # of loaded wads
bool devparm; // started game with -devparm bool devparm; // started game with -devparm
char *D_DrawIcon; // [RH] Patch name of icon to draw on next refresh 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) int NoWipe; // [RH] Allow wipe? (Needs to be set each time)
bool singletics = false; // debug flag to cancel adaptiveness bool singletics = false; // debug flag to cancel adaptiveness
char startmap[8]; char startmap[8];
bool autostart; bool autostart;
@ -2273,11 +2273,12 @@ void D_DoomMain (void)
// turbo option // [RH] (now a cvar) // turbo option // [RH] (now a cvar)
{ {
UCVarValue value; UCVarValue value;
static char one_hundred[] = "100";
value.String = Args.CheckValue ("-turbo"); value.String = Args.CheckValue ("-turbo");
if (value.String == NULL) if (value.String == NULL)
value.String = "100"; value.String = one_hundred;
else else
Printf ("turbo scale: %s%%\n", value.String); 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. // [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 enum EIWADType

View file

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

View file

@ -418,7 +418,7 @@ CCMD (useflechette)
for (j = 0; j < 3; ++j) for (j = 0; j < 3; ++j)
{ {
AInventory *item; AInventory *item;
if (item = who->FindInventory (bagnames[(i+j)%3])) if ( (item = who->FindInventory (bagnames[(i+j)%3])) )
{ {
SendItemUse = item; SendItemUse = item;
break; break;
@ -843,9 +843,10 @@ void G_Ticker ()
} }
if (ToggleFullscreen) if (ToggleFullscreen)
{ {
static char toggle_fullscreen[] = "toggle fullscreen";
ToggleFullscreen = false; ToggleFullscreen = false;
AddCommandString ("toggle fullscreen"); AddCommandString (toggle_fullscreen);
} }
// do things to change the game state // do things to change the game state
@ -1805,7 +1806,7 @@ void G_DoAutoSave ()
{ {
// Keep up to four autosaves at a time // Keep up to four autosaves at a time
UCVarValue num; UCVarValue num;
char *readableTime; const char *readableTime;
int count = autosavecount != 0 ? autosavecount : 1; int count = autosavecount != 0 ? autosavecount : 1;
num.Int = (autosavenum + 1) % count; num.Int = (autosavenum + 1) % count;
@ -1841,7 +1842,7 @@ static void PutSaveWads (FILE *file)
static void PutSaveComment (FILE *file) static void PutSaveComment (FILE *file)
{ {
char comment[256]; char comment[256];
char *readableTime; const char *readableTime;
WORD len; WORD len;
int levelTime; 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. // MAPINFO is parsed slightly differently when the map name is just a number.
static bool HexenHack; 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 }; static cluster_info_t TheDefaultClusterInfo = { 0 };
@ -1316,7 +1334,7 @@ bool CheckWarpTransMap (char mapname[9], bool substitute)
// //
static char d_mapname[256]; static char d_mapname[256];
void G_DeferedInitNew (char *mapname) void G_DeferedInitNew (const char *mapname)
{ {
strncpy (d_mapname, mapname, 8); strncpy (d_mapname, mapname, 8);
CheckWarpTransMap (d_mapname, true); CheckWarpTransMap (d_mapname, true);
@ -1414,7 +1432,7 @@ void G_DoNewGame (void)
gameaction = ga_nothing; gameaction = ga_nothing;
} }
void G_InitNew (char *mapname, bool bTitleLevel) void G_InitNew (const char *mapname, bool bTitleLevel)
{ {
EGameSpeed oldSpeed; EGameSpeed oldSpeed;
bool wantFast; bool wantFast;

View file

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

View file

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

View file

@ -104,7 +104,7 @@ typedef struct
char numPages; char numPages;
} indexed; } indexed;
} info; } info;
char **quitSounds; const char **quitSounds;
int maxSwitch; int maxSwitch;
char borderFlat[9]; char borderFlat[9];
gameborder_t *border; 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; bool giveall;
int i; int i;

View file

@ -31,7 +31,7 @@
class player_s; class player_s;
struct PClass; struct PClass;
void cht_DoCheat (player_s *player, int cheat); 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); void cht_Suicide (player_s *player);
const char *cht_Morph (player_s *player, const PClass *morphclass, bool quickundo); 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 DCanvas *FireScreen;
static BYTE FireRemap[256]; static BYTE FireRemap[256];
static char *genders[3] = { "male", "female", "other" }; static const char *genders[3] = { "male", "female", "other" };
static FPlayerClass *PlayerClass; static FPlayerClass *PlayerClass;
static int PlayerSkin; static int PlayerSkin;
static FState *PlayerState; static FState *PlayerState;

View file

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

View file

@ -133,7 +133,7 @@ value_t OnOff[2] = {
menu_t *CurrentMenu; menu_t *CurrentMenu;
int CurrentItem; int CurrentItem;
static char *OldMessage; static const char *OldMessage;
static itemtype OldType; static itemtype OldType;
int flagsvar; int flagsvar;
@ -149,7 +149,7 @@ enum
* Confirm Menu - Used by safemore * Confirm Menu - Used by safemore
* *
*=======================================*/ *=======================================*/
static void ActivateConfirm (char *text, void (*func)()); static void ActivateConfirm (const char *text, void (*func)());
static void ConfirmIsAGo (); static void ConfirmIsAGo ();
static menuitem_t ConfirmItems[] = { static menuitem_t ConfirmItems[] = {
@ -678,7 +678,7 @@ menu_t MapColorsMenu =
* Color Picker Sub-menu * Color Picker Sub-menu
* *
*=======================================*/ *=======================================*/
static void StartColorPickerMenu (char *colorname, FColorCVar *cvar); static void StartColorPickerMenu (const char *colorname, FColorCVar *cvar);
static void ColorPickerReset (); static void ColorPickerReset ();
static int CurrColorIndex; static int CurrColorIndex;
static int SelColorIndex; static int SelColorIndex;
@ -1173,24 +1173,7 @@ static menu_t AdvSoundMenu =
AdvSoundItems, AdvSoundItems,
}; };
void M_FreeValues (value_t **values, int num) static void ActivateConfirm (const char *text, void (*func)())
{
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)())
{ {
ConfirmItems[0].label = text; ConfirmItems[0].label = text;
ConfirmItems[0].e.mfunc = func; ConfirmItems[0].e.mfunc = func;
@ -1688,7 +1671,7 @@ void M_OptDrawer ()
case bitflag: case bitflag:
{ {
value_t *value; value_t *value;
char *str; const char *str;
if (item->b.min) if (item->b.min)
value = NoYes; value = NoYes;
@ -2551,7 +2534,7 @@ static void ActivateColorChoice ()
ColorPickerItems[0].a.colorcvar->SetGenericRep (val, CVAR_Int); 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.PreDraw = ColorPickerDrawer;
ColorPickerMenu.EscapeHandler = ActivateColorChoice; ColorPickerMenu.EscapeHandler = ActivateColorChoice;
@ -2778,8 +2761,9 @@ CCMD (menu_mididevice)
#endif #endif
static void MakeSoundChanges (void) static void MakeSoundChanges (void)
{ {
AddCommandString ("snd_reset"); static char snd_reset[] = "snd_reset";
AddCommandString (snd_reset);
} }
static void VideoOptions (void) static void VideoOptions (void)
@ -2932,7 +2916,7 @@ static void SetModesMenu (int w, int h, int bits)
if (testingmode <= 1) if (testingmode <= 1)
{ {
if (ModesItems[VM_ENTERLINE].label != VMEnterText) 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_ENTERLINE].label = VMEnterText;
ModesItems[VM_TESTLINE].label = VMTestText; 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.sidedef = NULL;
} }
newseg.PartnerSeg = (seg_t *)(seg->partner == DWORD_MAX ? 0 : (size_t)seg->partner + 1); 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); return (DWORD)segs.Push (newseg);
} }
@ -366,6 +367,7 @@ void FNodeBuilder::PushConnectingGLSeg (int subsector, TArray<seg_t> &segs, vert
newseg.linedef = NULL; newseg.linedef = NULL;
newseg.sidedef = NULL; newseg.sidedef = NULL;
newseg.PartnerSeg = NULL; newseg.PartnerSeg = NULL;
newseg.bPolySeg = false; newseg.bPolySeg = false;
newseg.Subsector = NULL;
segs.Push (newseg); 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.linedef = -1;
newseg.loopnum = 0; newseg.loopnum = 0;
newseg.next = DWORD_MAX; 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) if (splitseg != DWORD_MAX)
{ {

View file

@ -148,7 +148,11 @@ int FNodeBuilder::CreateSeg (int linenum, int sidenum)
seg.next = DWORD_MAX; seg.next = DWORD_MAX;
seg.loopnum = 0; 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) if (sidenum == 0)
{ // front { // front

View file

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

View file

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

View file

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

View file

@ -1045,7 +1045,7 @@ void R_DrawSkyBoxes ()
if (visplanes[MAXVISPLANES] == NULL) if (visplanes[MAXVISPLANES] == NULL)
return; return;
VisplaneAndAlpha vaAdder; VisplaneAndAlpha vaAdder = { 0 };
int savedextralight = extralight; int savedextralight = extralight;
fixed_t savedx = viewx; fixed_t savedx = viewx;
fixed_t savedy = viewy; fixed_t savedy = viewy;
@ -1175,7 +1175,7 @@ void R_DrawSkyBoxes ()
// sake of nested skyboxes. // sake of nested skyboxes.
while (interestingStack.Pop (FirstInterestingDrawseg)) while (interestingStack.Pop (FirstInterestingDrawseg))
{ {
ptrdiff_t pd; ptrdiff_t pd = 0;
drawsegStack.Pop (pd); drawsegStack.Pop (pd);
firstdrawseg = drawsegs + 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; double dx, d, n, t;
float spx[4], spy[4], cy[2], cv[2]; float spx[4], spy[4], cy[2], cv[2];
int j, k, z, scnt, dir, spt[4]; int j, k, z, scnt, dir, spt[4];
vsptype *vsp, *nvsp, *vcnt, *ni; vsptype *vsp, *nvsp, *vcnt = NULL, *ni;
int did = 1; int did = 1;
if (x0 < x1) if (x0 < x1)
@ -670,7 +670,7 @@ void printnum(int x, int y, int num)
void drawpolymosttest() void drawpolymosttest()
{ {
float cx0, cy0, fx0, fy0; float cx0 = 0, cy0 = 0, fx0 = 0, fy0 = 0;
int ccol, fcol; int ccol, fcol;
PolyClipper::vsptype *vsp, *ovsp = &TestPoly.UsedList, *nvsp; 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 tx1, tx2, ty1, ty2;
fixed_t fcz0, ffz0, fcz1, ffz1, bcz0, bfz0, bcz1, bfz1; 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 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 t0, t1;
double x, y; double x, y;

View file

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

View file

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

View file

@ -122,9 +122,9 @@ public:
item = Array[--Count]; item = Array[--Count];
Array[Count].~T(); Array[Count].~T();
return true; return true;
} }
return false; return false;
} }
void Delete (unsigned int index) void Delete (unsigned int index)
{ {
if (index < Count) 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]); jumpto = cls->ActorInfo->FindState(numnames, &JumpParameters[offset+2]);
if (jumpto == NULL) if (jumpto == NULL)
{ {
char * dot=""; const char *dot="";
Printf("Jump target '"); Printf("Jump target '");
if (classname != NAME_None) Printf("%s::", classname.GetChars()); if (classname != NAME_None) Printf("%s::", classname.GetChars());
for (int i=0;i<numnames;i++) for (int i=0;i<numnames;i++)

View file

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