Initialize some variables, several TODOs

seems to kinda work though
This commit is contained in:
Daniel Gibson 2020-01-23 21:19:34 +01:00
parent 21cfdc877a
commit 7cef835ca7
2 changed files with 12 additions and 10 deletions

View file

@ -81,6 +81,7 @@ ccBst::ccBst()
}
ccBst::~ccBst()
{
// FIXME: DG: shouldn't all nodes be deleted recursively?
delete Tree;
}
@ -89,11 +90,12 @@ void ccBst::InitOnce()
language = cc_languageSelector.GetInteger();
}
// FIXME: DG: apparently initLanguages() is never called? what's this good for?
void ccBst::initLanguages()
{
char* buf; //For initing languages, scope is only inside the constructor. Added Jason 04/02/05
idStr currentLanguage = "";
bool comment;
bool comment = false; // DG: make sure to init this..
numLanguages = 0;
languagesLoaded = false;
@ -174,7 +176,7 @@ void ccBst::initLanguages()
//resets the Root of the BST
void ccBst::Reset()
{
Tree = NULL;
Tree = NULL; // TODO: DG: remove elements?
output[0].Data.Reset();
output[1].Data.Reset();
output[2].Data.Reset();
@ -219,18 +221,17 @@ void ccBst::Init(idStr mapName, bool MFS)
idFile *f = idLib::fileSystem->OpenFileRead(mapName);
if ( f )
{
{
length = f->Length();
buf = (char *) Mem_Alloc( length + 1 );
buf[length] = '\0';//allocate enough memory to read the whole file
f->Read( buf, length );//read the file
bool quote = false;
bool inside = false;
bool first; //used to keep track of first and second digits in timecode
int code; //used to keep track between minutes, seconds and milliseconds
int tm; //used to add up the time
// DG: made sure the next 3 variables are initialized (compiler was complaining)
bool first = false; //used to keep track of first and second digits in timecode
int code = 0; //used to keep track between minutes, seconds and milliseconds
int tm = 0; //used to add up the time
int lenscroll = 0;
int y = 0;
idStr temp = "";

View file

@ -230,6 +230,7 @@ struct ccParamaters {
void Resize(int newsize)
{//only works if size is less than newsize
//could be easily changed with a conditional
// FIXME: DG: who deletes those arrays?
idStr *temp = new idStr[newsize];
int *tempint = new int[newsize];
int *tempbool = new int[newsize];
@ -251,7 +252,7 @@ struct ccParamaters {
if(caption[size - 1] == "")
{
c = true;
delete caption[size - 1];
// delete caption[size - 1]; DG: trying to delete an element of an array doesn't really make sense (and crashes)
size--;
}
current = 0;
@ -285,4 +286,4 @@ struct ccParamaters {
#endif
#endif