Skip to content

Commit

Permalink
Apply coverity patches once instead of at every build
Browse files Browse the repository at this point in the history
  • Loading branch information
tobbi committed Mar 31, 2015
1 parent b0c94d8 commit 441d0a2
Show file tree
Hide file tree
Showing 7 changed files with 40 additions and 10 deletions.
2 changes: 1 addition & 1 deletion external/squirrel/CMakeLists.txt
Expand Up @@ -20,7 +20,7 @@
## Apply patch that fixes some Coverity errors

## Apply coverity patch to Squirrel?
SET(APPLY_COVERITY_PATCH TRUE)
SET(APPLY_COVERITY_PATCH FALSE)
SET(WORKING_DIR WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})

IF(APPLY_COVERITY_PATCH)
Expand Down
3 changes: 2 additions & 1 deletion external/squirrel/sqstdlib/sqstdstring.cpp
Expand Up @@ -116,8 +116,9 @@ SQRESULT sqstd_format(HSQUIRRELVM v,SQInteger nformatstringidx,SQInteger *outlen
fmt[fpos++] = _SC('\0');
}
#endif
break;
case 'c':
if(SQ_FAILED(sq_getinteger(v,nparam,&ti)))
if(SQ_FAILED(sq_getinteger(v,nparam,&ti)))
return sq_throwerror(v,_SC("integer expected for the specified format"));
addlen = (ADDITIONAL_FORMAT_SPACE)+((w+1)*sizeof(SQChar));
valtype = 'i';
Expand Down
4 changes: 2 additions & 2 deletions external/squirrel/squirrel/sqclosure.h
Expand Up @@ -10,7 +10,7 @@ struct SQClass;
struct SQClosure : public CHAINABLE_OBJ
{
private:
SQClosure(SQSharedState *ss,SQFunctionProto *func){_function = func; __ObjAddRef(_function); _base = NULL; INIT_CHAIN();ADD_TO_CHAIN(&_ss(this)->_gc_chain,this); _env = NULL;}
SQClosure(SQSharedState *ss,SQFunctionProto *func): _outervalues(NULL), _defaultparams(NULL) {_function = func; __ObjAddRef(_function); _base = NULL; INIT_CHAIN();ADD_TO_CHAIN(&_ss(this)->_gc_chain,this); _env = NULL;}
public:
static SQClosure *Create(SQSharedState *ss,SQFunctionProto *func){
SQInteger size = _CALC_CLOSURE_SIZE(func);
Expand Down Expand Up @@ -139,7 +139,7 @@ struct SQGenerator : public CHAINABLE_OBJ
struct SQNativeClosure : public CHAINABLE_OBJ
{
private:
SQNativeClosure(SQSharedState *ss,SQFUNCTION func){_function=func;INIT_CHAIN();ADD_TO_CHAIN(&_ss(this)->_gc_chain,this); _env = NULL;}
SQNativeClosure(SQSharedState *ss,SQFUNCTION func): _nparamscheck(0), _outervalues(NULL), _noutervalues(0){_function=func;INIT_CHAIN();ADD_TO_CHAIN(&_ss(this)->_gc_chain,this); _env = NULL;}
public:
static SQNativeClosure *Create(SQSharedState *ss,SQFUNCTION func,SQInteger nouters)
{
Expand Down
4 changes: 2 additions & 2 deletions external/squirrel/squirrel/sqfuncproto.h
Expand Up @@ -11,8 +11,8 @@ enum SQOuterType {

struct SQOuterVar
{
SQOuterVar(){}

SQOuterVar() : _type(otLOCAL) {}
SQOuterVar(const SQObjectPtr &name,const SQObjectPtr &src,SQOuterType t)
{
_name = name;
Expand Down
1 change: 1 addition & 0 deletions external/squirrel/squirrel/sqfuncstate.cpp
Expand Up @@ -460,6 +460,7 @@ void SQFuncState::AddInstruction(SQInstruction &i)
pi._arg1 = i._arg1;
return;
}
break;
case _OP_SET:
case _OP_NEWSLOT:
if(i._arg0 == i._arg3) {
Expand Down
26 changes: 23 additions & 3 deletions external/squirrel/squirrel/sqlexer.cpp
Expand Up @@ -18,7 +18,24 @@
#define TERMINATE_BUFFER() {_longstr.push_back(_SC('\0'));}
#define ADD_KEYWORD(key,id) _keywords->NewSlot( SQString::Create(ss, _SC(#key)) ,SQInteger(id))

SQLexer::SQLexer(){}
SQLexer::SQLexer() :
_curtoken(0),
_keywords(NULL),
_reached_eof(false),
_prevtoken(0),
_currentline(0),
_lasttokenline(0),
_currentcolumn(0),
_svalue(NULL),
_nvalue(0),
_fvalue(0.0),
_readf(NULL),
_up(NULL),
_currdata('\0'),
_sharedstate(NULL),
_errfunc(NULL),
_errtarget(NULL)
{}
SQLexer::~SQLexer()
{
_keywords->Release();
Expand Down Expand Up @@ -148,11 +165,11 @@ SQInteger SQLexer::Lex()
case _SC('='):
NEXT();
RETURN_TOKEN(TK_DIVEQ);
continue;
break;
case _SC('>'):
NEXT();
RETURN_TOKEN(TK_ATTR_CLOSE);
continue;
break;
default:
RETURN_TOKEN('/');
}
Expand Down Expand Up @@ -192,6 +209,7 @@ SQInteger SQLexer::Lex()
NEXT();
if (CUR_CHAR != _SC('=')){ RETURN_TOKEN('!')}
else { NEXT(); RETURN_TOKEN(TK_NE); }
break;
case _SC('@'): {
SQInteger stype;
NEXT();
Expand All @@ -203,6 +221,7 @@ SQInteger SQLexer::Lex()
}
Error(_SC("error parsing the string"));
}
break;
case _SC('"'):
case _SC('\''): {
SQInteger stype;
Expand All @@ -211,6 +230,7 @@ SQInteger SQLexer::Lex()
}
Error(_SC("error parsing the string"));
}
break;
case _SC('{'): case _SC('}'): case _SC('('): case _SC(')'): case _SC('['): case _SC(']'):
case _SC(';'): case _SC(','): case _SC('?'): case _SC('^'): case _SC('~'):
{SQInteger ret = CUR_CHAR;
Expand Down
10 changes: 9 additions & 1 deletion external/squirrel/squirrel/sqvm.cpp
Expand Up @@ -119,6 +119,11 @@ SQVM::SQVM(SQSharedState *ss)
_debughook_native = NULL;
_debughook_closure.Null();
_openouters = NULL;
_top = 0;
_stackbase = 0;
_callsstack = NULL;
_callsstacksize = 0;
_alloccallsstacksize = 0;
ci = NULL;
INIT_CHAIN();ADD_TO_CHAIN(&_ss(this)->_gc_chain,this);
}
Expand Down Expand Up @@ -306,6 +311,7 @@ bool SQVM::ToString(const SQObjectPtr &o,SQObjectPtr &res)
}
}
}
break;
default:
scsprintf(_sp(rsl(sizeof(void*)+20)),_SC("(%s : 0x%p)"),GetTypeName(o),(void*)_rawval(o));
}
Expand Down Expand Up @@ -561,7 +567,8 @@ bool SQVM::FOREACH_OP(SQObjectPtr &o1,SQObjectPtr &o2,SQObjectPtr
_generator(o1)->Resume(this, o3);
_FINISH(0);
}
default:
break;
default:
Raise_Error(_SC("cannot iterate %s"), GetTypeName(o1));
}
return false; //cannot be hit(just to avoid warnings)
Expand Down Expand Up @@ -724,6 +731,7 @@ bool SQVM::Execute(SQObjectPtr &closure, SQInteger nargs, SQInteger stackbase,SQ
continue;
}
}
break;
case _OP_CALL: {
SQObjectPtr clo = STK(arg1);
switch (type(clo)) {
Expand Down

0 comments on commit 441d0a2

Please sign in to comment.