TWP: Fix not all members of a class are initialized in squirrel. PVS-Studio V730

This commit is contained in:
scemino 2024-03-19 20:33:02 +01:00
parent 2e823bc6f6
commit df0d1cb8d4
5 changed files with 14 additions and 4 deletions

View File

@ -12,7 +12,7 @@ enum SQOuterType {
struct SQOuterVar
{
SQOuterVar(){}
SQOuterVar() : _type(otLOCAL) {}
SQOuterVar(const SQObjectPtr &name,const SQObjectPtr &src,SQOuterType t)
{
_name = name;

View File

@ -108,7 +108,7 @@ struct SQInstructionDesc {
struct SQInstruction
{
SQInstruction(){};
SQInstruction() : _arg1(0), op(0), _arg0(0), _arg2(0), _arg3(0){}
SQInstruction(SQOpcode _op,SQInteger a0=0,SQInteger a1=0,SQInteger a2=0,SQInteger a3=0)
{ op = (unsigned char)_op;
_arg0 = (unsigned char)a0;_arg1 = (SQInt32)a1;

View File

@ -14,6 +14,13 @@
SQSharedState::SQSharedState()
{
_metamethods = NULL;
_systemstrings = NULL;
_types = NULL;
_stringtable = NULL;
_gc_chain = NULL;
_scratchpad = NULL;
_scratchpadsize = 0;
_compilererrorhandler = NULL;
_printfunc = NULL;
_errorfunc = NULL;

View File

@ -13,7 +13,10 @@ inline SQHash _hashstr (const SQChar *s, size_t l)
struct SQString : public SQRefCounted
{
SQString(){}
SQString() : _sharedstate(nullptr), _next(nullptr), _len(0), _hash(0)
{
_val[0] = 0;
}
~SQString(){}
public:
static SQString *Create(SQSharedState *ss, const SQChar *, SQInteger len = -1 );

View File

@ -18,7 +18,7 @@
void sq_base_register(HSQUIRRELVM v);
struct SQExceptionTrap{
SQExceptionTrap() {}
SQExceptionTrap() : _stackbase(0), _stacksize(0), _ip(nullptr), _extarget(0) {}
SQExceptionTrap(SQInteger ss, SQInteger stackbase,SQInstruction *ip, SQInteger ex_target){ _stacksize = ss; _stackbase = stackbase; _ip = ip; _extarget = ex_target;}
SQInteger _stackbase;
SQInteger _stacksize;