Skip to content
Open
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion include/squirrel.h
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@ SQUIRREL_API void sq_setnativedebughook(HSQUIRRELVM v,SQDEBUGHOOK hook);
#if defined(__GNUC__) || defined(__clang__)
# define SQ_UNUSED_ARG(x) x __attribute__((__unused__))
#else
# define SQ_UNUSED_ARG(x) x
# define SQ_UNUSED_ARG(x)
#endif

#ifdef __cplusplus
Expand Down
1 change: 0 additions & 1 deletion squirrel/sqapi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ HSQUIRRELVM sq_open(SQInteger initialstacksize)
sq_vm_destroy_alloc_context(&allocctx);
return NULL;
}
return v;
}

HSQUIRRELVM sq_newthread(HSQUIRRELVM friendvm, SQInteger initialstacksize)
Expand Down
6 changes: 3 additions & 3 deletions squirrel/sqbaselib.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1519,7 +1519,7 @@ static SQInteger string_substitute(HSQUIRRELVM v)
SQObjectPtr &val = stack_get(v, index);
SQObjectPtr valStr;
if (v->ToString(val, valStr)) {
int delta = _string(valStr)->_len - (j + 1 - i);
int delta = (int)_string(valStr)->_len - (j + 1 - i);
s = replace_substring_internal(allocctx, s, buf_len, len, i, j + 1 - i,
_stringval(valStr), _string(valStr)->_len);
i = j + delta;
Expand All @@ -1540,7 +1540,7 @@ static SQInteger string_substitute(HSQUIRRELVM v)
SQObjectPtr valStr;
if (table->GetStr(s + i + 1, j - i - 1, val)) {
if (v->ToString(val, valStr)) {
int delta = _string(valStr)->_len - (j + 1 - i);
int delta = (int)_string(valStr)->_len - (j + 1 - i);
s = replace_substring_internal(allocctx, s, buf_len, len, i, j + 1 - i,
_stringval(valStr), _string(valStr)->_len);
i = j + delta;
Expand Down Expand Up @@ -1755,7 +1755,7 @@ static SQInteger string_split(HSQUIRRELVM v)
const SQChar *sthis=_stringval(str); \
SQChar *snew=(_ss(v)->GetScratchPad(sq_rsl(len))); \
memcpy(snew,sthis,sq_rsl(len));\
for(SQInteger i=sidx;i<eidx;i++) snew[i] = func(sthis[i]); \
for(SQInteger i=sidx;i<eidx;i++) snew[i] = (SQChar)func(sthis[i]); \
v->Push(SQString::Create(_ss(v),snew,len)); \
return 1; \
}
Expand Down
3 changes: 2 additions & 1 deletion squirrel/sqcompiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -977,13 +977,14 @@ class SQCompiler
break;
}

SQObject id;
SQObject id = {};

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Satisfy the compiler

SQObject constant;

switch(_token) {
case TK_IDENTIFIER: id = _fs->CreateString(_lex._svalue); break;
case TK_THIS: id = _fs->CreateString(_SC("this"),4); break;
case TK_CONSTRUCTOR: id = _fs->CreateString(_SC("constructor"),11); break;
default: Error("Unhandled token type %d", _token); break;

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Safety

}

if (_stringval(id) == _stringval(_fs->_name)) {
Expand Down
2 changes: 1 addition & 1 deletion squirrel/sqlexer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -732,7 +732,7 @@ SQInteger SQLexer::ReadNumber()
}
}
else {
APPEND_CHAR((int)firstchar);
APPEND_CHAR((SQChar)firstchar);
while (CUR_CHAR == _SC('.') || scisdigit(CUR_CHAR) || isexponent(CUR_CHAR)) {
if(CUR_CHAR == _SC('.') || isexponent(CUR_CHAR)) type = TFLOAT;
if(isexponent(CUR_CHAR)) {
Expand Down
6 changes: 3 additions & 3 deletions squirrel/sqobject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -516,11 +516,11 @@ bool SQFunctionProto::Load(SQVM *v,SQUserPointer up,SQREADFUNC read,SQObjectPtr

for(i = 0; i < noutervalues; i++){
SQUnsignedInteger type;
SQObjectPtr name;
SQObjectPtr inner_name;
_CHECK_IO(SafeRead(v,read,up, &type, sizeof(SQUnsignedInteger)));
_CHECK_IO(ReadObject(v, up, read, o));
_CHECK_IO(ReadObject(v, up, read, name));
f->_outervalues[i] = SQOuterVar(name,o, (SQOuterType)type);
_CHECK_IO(ReadObject(v, up, read, inner_name));
f->_outervalues[i] = SQOuterVar(inner_name,o, (SQOuterType)type);
}
_CHECK_IO(CheckTag(v,read,up,SQ_CLOSURESTREAM_PART));

Expand Down
4 changes: 2 additions & 2 deletions squirrel/sqtable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ void SQTable::AllocNodes(SQInteger nSize)
new (&n) _HashNode;
n.next=NULL;
}
_numofnodes_minus_one=nSize-1;
_numofnodes_minus_one=(uint32_t)(nSize-1);
_nodes=nodes;
_firstfree=&_nodes[_numofnodes_minus_one];
}
Expand Down Expand Up @@ -202,7 +202,7 @@ bool SQTable::NewSlot(const SQObjectPtr &key,const SQObjectPtr &val VT_DECL_ARG

SQInteger SQTable::Next(bool getweakrefs,const SQObjectPtr &refpos, SQObjectPtr &outkey, SQObjectPtr &outval)
{
uint32_t idx = TranslateIndex(refpos);
uint32_t idx = (uint32_t)TranslateIndex(refpos);
while (idx <= _numofnodes_minus_one) {
if(sq_type(_nodes[idx].key) != OT_NULL) {
//first found
Expand Down
24 changes: 12 additions & 12 deletions squirrel/sqvm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -853,11 +853,11 @@ bool SQVM::Execute(SQObjectPtr &closure, SQInteger nargs, SQInteger stackbase,SQ
case OT_TABLE:
case OT_USERDATA:
case OT_INSTANCE:{
SQObjectPtr closure;
if(_delegable(clo)->_delegate && _delegable(clo)->GetMetaMethod(this,MT_CALL,closure)) {
SQObjectPtr inner_closure;
if(_delegable(clo)->_delegate && _delegable(clo)->GetMetaMethod(this,MT_CALL, inner_closure)) {
Push(clo);
for (SQInteger i = 0; i < arg3; i++) Push(STK(arg2 + i));
if(!CallMetaMethod(closure, MT_CALL, arg3+1, clo)) SQ_THROW();
if(!CallMetaMethod(inner_closure, MT_CALL, arg3+1, clo)) SQ_THROW();
if(tgt0 != -1) {
STK(tgt0) = clo;
}
Expand Down Expand Up @@ -1211,11 +1211,11 @@ bool SQVM::Execute(SQObjectPtr &closure, SQInteger nargs, SQInteger stackbase,SQ

while( ci ) {
if(ci->_etraps > 0) {
SQExceptionTrap &et = _etraps.top();
ci->_ip = et._ip;
_top = et._stacksize;
_stackbase = et._stackbase;
_stack._vals[_stackbase + et._extarget] = currerror;
SQExceptionTrap &inner_et = _etraps.top();
ci->_ip = inner_et._ip;
_top = inner_et._stacksize;
_stackbase = inner_et._stackbase;
_stack._vals[_stackbase + inner_et._extarget] = currerror;
_etraps.pop_back(); traps--; ci->_etraps--;
while(last_top >= _top) _stack._vals[last_top--].Null();
goto exception_restore;
Expand Down Expand Up @@ -1291,10 +1291,10 @@ void SQVM::CallDebugHook(SQInteger type,SQInteger forcedline)
_debughook_native(this,type,src,line,fname);
}
else {
SQObjectPtr temp_reg;
SQObjectPtr local_temp_reg;
SQInteger nparams=5;
Push(_roottable); Push(type); Push(func->_sourcename); Push(forcedline?forcedline:func->GetLine(ci->_ip)); Push(func->_name);
Call(_debughook_closure,nparams,_top-nparams,temp_reg,SQFalse);
Call(_debughook_closure,nparams,_top-nparams, local_temp_reg,SQFalse);
Pop(nparams);
}
_debughook = true;
Expand Down Expand Up @@ -1650,7 +1650,7 @@ SQInteger SQVM::FallBackSet(const SQObjectPtr &self,const SQObjectPtr &key,const

bool SQVM::Clone(const SQObjectPtr &self,SQObjectPtr &target)
{
SQObjectPtr temp_reg;
SQObjectPtr local_temp_reg;
SQObjectPtr newobj;
switch(sq_type(self)){
case OT_TABLE:
Expand All @@ -1663,7 +1663,7 @@ bool SQVM::Clone(const SQObjectPtr &self,SQObjectPtr &target)
if(_delegable(newobj)->_delegate && _delegable(newobj)->GetMetaMethod(this,MT_CLONED,closure)) {
Push(newobj);
Push(self);
if(!CallMetaMethod(closure,MT_CLONED,2,temp_reg))
if(!CallMetaMethod(closure,MT_CLONED,2, local_temp_reg))
return false;
}
}
Expand Down