uninitialized variables-console

This commit is contained in:
AzaezelX 2020-05-11 14:40:31 -05:00
parent e9415a0994
commit 2c1508c169
23 changed files with 66 additions and 11 deletions

View file

@ -142,6 +142,7 @@ StmtNode::StmtNode()
{
mNext = NULL;
dbgFileName = CodeBlock::smCurrentParser->getCurrentFile();
dbgLineNumber = 0;
}
void StmtNode::setPackage(StringTableEntry)

View file

@ -56,6 +56,9 @@ CodeBlock::CodeBlock()
name = NULL;
fullPath = NULL;
modPath = NULL;
codeSize = 0;
lineBreakPairCount = 0;
nextFile = NULL;
}
CodeBlock::~CodeBlock()

View file

@ -224,6 +224,9 @@ CodeInterpreter::CodeInterpreter(CodeBlock *cb) :
mSaveCodeBlock(nullptr),
mCurrentInstruction(0)
{
dMemset(&mExec, 0, sizeof(mExec));
dMemset(&mObjectCreationStack, 0, sizeof(mObjectCreationStack));
dMemset(&mNSDocBlockClass, 0, sizeof(mNSDocBlockClass));
}
CodeInterpreter::~CodeInterpreter()

View file

@ -317,7 +317,7 @@ protected:
U32 addr; ///< Address to patch
U32 value; ///< Value to place at addr
PatchEntry() { ; }
PatchEntry(): addr(0), value(0) { ; }
PatchEntry(U32 a, U32 v) : addr(a), value(v) { ; }
} PatchEntry;

View file

@ -475,7 +475,7 @@ Dictionary::Entry::Entry(StringTableEntry in_name)
nextEntry = NULL;
mUsage = NULL;
mIsConstant = false;
mNext = NULL;
// NOTE: This is data inside a nameless
// union, so we don't need to init the rest.
value.init();
@ -856,6 +856,7 @@ ExprEvalState::ExprEvalState()
stack.reserve(64);
mShouldReset = false;
mResetLocked = false;
copyVariable = NULL;
}
ExprEvalState::~ExprEvalState()
@ -927,6 +928,15 @@ Namespace::Entry::Entry()
mUsage = NULL;
mHeader = NULL;
mNamespace = NULL;
cb.mStringCallbackFunc = NULL;
mFunctionLineNumber = 0;
mFunctionName = StringTable->EmptyString();
mFunctionOffset = 0;
mMinArgs = 0;
mMaxArgs = 0;
mNext = NULL;
mPackage = StringTable->EmptyString();
mToolOnly = false;
}
void Namespace::Entry::clear()
@ -959,6 +969,7 @@ Namespace::Namespace()
mHashSequence = 0;
mRefCountToParent = 0;
mClassRep = 0;
lastUsage = NULL;
}
Namespace::~Namespace()

View file

@ -306,6 +306,7 @@ public:
nextEntry = NULL;
mUsage = NULL;
mIsConstant = false;
mNext = NULL;
value.init();
}

View file

@ -220,7 +220,21 @@ public:
: Parent( sizeof( void* ), conIdPtr, typeName )
{
VECTOR_SET_ASSOCIATION( mFieldList );
mCategory = StringTable->EmptyString();
mClassGroupMask = 0;
std::fill_n(mClassId, NetClassGroupsCount, -1);
mClassName = StringTable->EmptyString();
mClassSizeof = 0;
mClassType = 0;
mDescription = StringTable->EmptyString();
#ifdef TORQUE_NET_STATS
dMemset(mDirtyMaskFrequency, 0, sizeof(mDirtyMaskFrequency));
dMemset(mDirtyMaskTotal, 0, sizeof(mDirtyMaskTotal));
#endif
mDynamicGroupExpand = false;
mNamespace = NULL;
mNetEventDir = 0;
nextClass = NULL;
parentClass = NULL;
mIsRenderEnabled = true;
mIsSelectionEnabled = true;
@ -496,6 +510,7 @@ public:
validator( NULL ),
setDataFn( NULL ),
getDataFn( NULL ),
writeDataFn(NULL),
networkMask(0)
{
doNotSubstitute = keepClearSubsOnly = false;

View file

@ -1190,7 +1190,7 @@ public:
ConsoleValueRef _exec();
ConsoleValueRef _execLater(SimConsoleThreadExecEvent *evt);
_BaseEngineConsoleCallbackHelper() {;}
_BaseEngineConsoleCallbackHelper(): mThis(NULL), mInitialArgc(0), mArgc(0), mCallbackName(StringTable->EmptyString()){;}
};

View file

@ -123,6 +123,7 @@ class EngineExport : public StaticEngineObject
: mExportName( "" ),
mExportKind( EngineExportKindScope ),
mExportScope( NULL ),
mDocString(""),
mNextExport( NULL ) {}
};
@ -165,7 +166,7 @@ class EngineExportScope : public EngineExport
private:
/// Constructor for the global scope.
EngineExportScope() {}
EngineExportScope():mExports(NULL){}
};

View file

@ -53,7 +53,7 @@ void*& _USERDATA( EngineObject* object )
//-----------------------------------------------------------------------------
EngineObject::EngineObject()
: mEngineObjectUserData( NULL )
: mEngineObjectPool(NULL), mEngineObjectUserData( NULL )
{
#ifdef TORQUE_DEBUG
// Add to instance list.

View file

@ -58,6 +58,7 @@ EngineTypeInfo::EngineTypeInfo( const char* typeName, EngineExportScope* scope,
mEnumTable( NULL ),
mFieldTable( NULL ),
mPropertyTable( NULL ),
mArgumentTypeTable(NULL),
mSuperType( NULL ),
mNext( smFirst )
{

View file

@ -55,6 +55,7 @@ ConsoleDocClass( SimDataBlock,
SimDataBlock::SimDataBlock()
{
modifiedKey = 0;
setModDynamicFields(true);
setModStaticFields(true);
}

View file

@ -31,6 +31,8 @@ SimNameDictionary::SimNameDictionary()
{
#ifndef USE_NEW_SIMDICTIONARY
hashTable = NULL;
hashTableSize = DefaultTableSize;
hashEntryCount = 0;
#endif
mutex = Mutex::createMutex();
}

View file

@ -62,7 +62,7 @@ public:
/// of addition to the list.
SimObject *destObject; ///< Object on which this event will be applied.
SimEvent() { destObject = NULL; }
SimEvent() { nextEvent = NULL; startTime = 0; time = 0; sequenceCount = 0; destObject = NULL; }
virtual ~SimEvent() {} ///< Destructor
///
/// A dummy virtual destructor is required

View file

@ -47,7 +47,7 @@ class SimFieldDictionary
public:
struct Entry
{
Entry() : type(NULL) {};
Entry() : slotName(StringTable->EmptyString()), value(NULL), next(NULL), type(NULL) {};
StringTableEntry slotName;
char *value;
@ -112,4 +112,4 @@ public:
};
#endif // _SIMFIELDDICTIONARY_H_
#endif // _SIMFIELDDICTIONARY_H_

View file

@ -1380,6 +1380,7 @@ SimObject::SimObject(const SimObject& other, bool temp_clone)
nextIdObject = other.nextIdObject;
mGroup = other.mGroup;
mFlags = other.mFlags;
mProgenitorFile = other.mProgenitorFile;
mCopySource = other.mCopySource;
mFieldDictionary = other.mFieldDictionary;
//mIdString = other.mIdString; // special treatment (see below)

View file

@ -30,7 +30,12 @@ StringStack::StringStack()
mBuffer = NULL;
mArgBufferSize = 0;
mArgBuffer = NULL;
for (U32 i = 0; i < MaxArgs; i++)
mArgV[i] = "";
dMemset(mFrameOffsets, 0, sizeof(mFrameOffsets));
dMemset(mStartOffsets, 0, sizeof(mStartOffsets));
mNumFrames = 0;
mArgc = 0;
mStart = 0;
mLen = 0;
mStartStackSize = 0;
@ -232,6 +237,7 @@ mStackPos(0)
mStack[i].init();
mStack[i].type = ConsoleValue::TypeInternalString;
}
dMemset(mStackFrames, 0, sizeof(mStackFrames));
}
ConsoleValueStack::~ConsoleValueStack()

View file

@ -88,6 +88,9 @@ TelnetConsole::TelnetConsole()
mAcceptPort = -1;
mClientList = NULL;
mRemoteEchoEnabled = false;
dStrncpy(mTelnetPassword, "", PasswordMaxLength);
dStrncpy(mListenPassword, "", PasswordMaxLength);
}
TelnetConsole::~TelnetConsole()

View file

@ -78,6 +78,7 @@ class TelnetConsole
S32 state; ///< State of the client.
/// @see TelnetConsole::State
TelnetClient *nextClient;
TelnetClient() { dStrncpy(curLine, "", Con::MaxLineLength); curPos = 0; state = 0; nextClient = NULL; }
};
TelnetClient *mClientList;
TelnetConsole();

View file

@ -163,6 +163,9 @@ TelnetDebugger::TelnetDebugger()
mProgramPaused = false;
mWaitForClient = false;
dStrncpy(mDebuggerPassword, "", PasswordMaxLength);
dStrncpy(mLineBuffer, "", sizeof(mLineBuffer));
// Add the version number in a global so that
// scripts can detect the presence of the
// "enhanced" debugger features.

View file

@ -27,7 +27,8 @@ class TypeValidator
{
public:
S32 fieldIndex;
TypeValidator() : fieldIndex(0) {}
~TypeValidator() {}
/// Prints a console error message for the validator.
///
/// The message is prefaced with with:

View file

@ -203,7 +203,7 @@ public:
class StockColorItem
{
private:
StockColorItem() {}
StockColorItem():mColorName("") {}
public:
StockColorItem( const char* pName, const U8 red, const U8 green, const U8 blue, const U8 alpha = 255 )

View file

@ -295,6 +295,7 @@ public:
AssertFatal( count > 0, "Allocating a FrameTemp with less than one instance" ); \
mWaterMark = FrameAllocator::getWaterMark(); \
mMemory = reinterpret_cast<type *>( FrameAllocator::alloc( sizeof( type ) * count ) ); \
mNumObjectsInMemory = 0; \
} \
template<>\
inline FrameTemp<type>::~FrameTemp() \