diff --git a/include/sqconfig.h b/include/sqconfig.h index f8360f9..58bc979 100644 --- a/include/sqconfig.h +++ b/include/sqconfig.h @@ -60,10 +60,10 @@ typedef wchar_t SQChar; #define scstrcmp wcscmp -#ifdef _MSC_VER +#ifdef _WIN32 #define scsprintf _snwprintf #else -#define scsprintf snwprintf +#define scsprintf swprintf #endif #define scstrlen wcslen #define scstrtod wcstod diff --git a/sq/sq.c b/sq/sq.c index 0a96771..675ac78 100644 --- a/sq/sq.c +++ b/sq/sq.c @@ -46,20 +46,22 @@ SQInteger quit(HSQUIRRELVM v) return 0; } -void printfunc(HSQUIRRELVM v,const SQChar *s,...) +void printfunc(HSQUIRRELVM v, const SQChar *s,...) { va_list vl; va_start(vl, s); scvprintf(stdout, s, vl); va_end(vl); + (void)v; /* UNUSED */ } -void errorfunc(HSQUIRRELVM v,const SQChar *s,...) +void errorfunc(HSQUIRRELVM v, const SQChar *s,...) { va_list vl; va_start(vl, s); scvprintf(stderr, s, vl); va_end(vl); + (void)v; /* UNUSED */ } void PrintVersionInfos() @@ -87,10 +89,10 @@ int getargs(HSQUIRRELVM v,int argc, char* argv[],SQInteger *retval) { int i; int compiles_only = 0; +#ifdef SQUNICODE static SQChar temp[500]; - const SQChar *ret=NULL; +#endif char * output = NULL; - int lineinfo=0; *retval = 0; if(argc>1) { @@ -307,7 +309,6 @@ int main(int argc, char* argv[]) { HSQUIRRELVM v; SQInteger retval = 0; - const SQChar *filename=NULL; #if defined(_MSC_VER) && defined(_DEBUG) _CrtSetAllocHook(MemAllocHook); #endif diff --git a/sqstdlib/sqstdblob.cpp b/sqstdlib/sqstdblob.cpp index e4c6690..492a25e 100644 --- a/sqstdlib/sqstdblob.cpp +++ b/sqstdlib/sqstdblob.cpp @@ -114,7 +114,7 @@ static SQInteger _blob__typeof(HSQUIRRELVM v) return 1; } -static SQInteger _blob_releasehook(SQUserPointer p, SQInteger size) +static SQInteger _blob_releasehook(SQUserPointer p, SQInteger /*size*/) { SQBlob *self = (SQBlob*)p; self->~SQBlob(); @@ -172,7 +172,7 @@ static const SQRegFunction _blob_methods[] = { _DECL_BLOB_FUNC(_typeof,1,_SC("x")), _DECL_BLOB_FUNC(_nexti,2,_SC("x")), _DECL_BLOB_FUNC(_cloned,2,_SC("xx")), - {0,0,0,0} + {NULL,(SQFUNCTION)0,0,NULL} }; @@ -230,7 +230,7 @@ static const SQRegFunction bloblib_funcs[]={ _DECL_GLOBALBLOB_FUNC(swap2,2,_SC(".n")), _DECL_GLOBALBLOB_FUNC(swap4,2,_SC(".n")), _DECL_GLOBALBLOB_FUNC(swapfloat,2,_SC(".n")), - {0,0} + {NULL,(SQFUNCTION)0,0,NULL} }; SQRESULT sqstd_getblob(HSQUIRRELVM v,SQInteger idx,SQUserPointer *ptr) diff --git a/sqstdlib/sqstdio.cpp b/sqstdlib/sqstdio.cpp index c648724..866b464 100644 --- a/sqstdlib/sqstdio.cpp +++ b/sqstdlib/sqstdio.cpp @@ -115,7 +115,7 @@ static SQInteger _file__typeof(HSQUIRRELVM v) return 1; } -static SQInteger _file_releasehook(SQUserPointer p, SQInteger size) +static SQInteger _file_releasehook(SQUserPointer p, SQInteger /*size*/) { SQFile *self = (SQFile*)p; self->~SQFile(); @@ -168,7 +168,7 @@ static const SQRegFunction _file_methods[] = { _DECL_FILE_FUNC(constructor,3,_SC("x")), _DECL_FILE_FUNC(_typeof,1,_SC("x")), _DECL_FILE_FUNC(close,1,_SC("x")), - {0,0,0,0}, + {NULL,(SQFUNCTION)0,0,NULL} }; @@ -463,7 +463,7 @@ static const SQRegFunction iolib_funcs[]={ _DECL_GLOBALIO_FUNC(loadfile,-2,_SC(".sb")), _DECL_GLOBALIO_FUNC(dofile,-2,_SC(".sb")), _DECL_GLOBALIO_FUNC(writeclosuretofile,3,_SC(".sc")), - {0,0} + {NULL,(SQFUNCTION)0,0,NULL} }; SQRESULT sqstd_register_iolib(HSQUIRRELVM v) diff --git a/sqstdlib/sqstdmath.cpp b/sqstdlib/sqstdmath.cpp index 63f55f5..c41ffd5 100644 --- a/sqstdlib/sqstdmath.cpp +++ b/sqstdlib/sqstdmath.cpp @@ -78,7 +78,7 @@ static const SQRegFunction mathlib_funcs[] = { _DECL_FUNC(rand,1,NULL), _DECL_FUNC(fabs,2,_SC(".n")), _DECL_FUNC(abs,2,_SC(".n")), - {0,0}, + {NULL,(SQFUNCTION)0,0,NULL} }; #undef _DECL_FUNC diff --git a/sqstdlib/sqstdrex.cpp b/sqstdlib/sqstdrex.cpp index 22c1317..3ead1db 100644 --- a/sqstdlib/sqstdrex.cpp +++ b/sqstdlib/sqstdrex.cpp @@ -550,7 +550,7 @@ static const SQChar *sqstd_rex_matchnode(SQRex* exp,SQRexNode *node,const SQChar /* public api */ SQRex *sqstd_rex_compile(const SQChar *pattern,const SQChar **error) { - SQRex *exp = (SQRex *)sq_malloc(sizeof(SQRex)); + SQRex * volatile exp = (SQRex *)sq_malloc(sizeof(SQRex)); // "volatile" is needed for setjmp() exp->_eol = exp->_bol = NULL; exp->_p = pattern; exp->_nallocated = (SQInteger)scstrlen(pattern) * sizeof(SQChar); diff --git a/sqstdlib/sqstdstream.cpp b/sqstdlib/sqstdstream.cpp index a7081fa..406f561 100644 --- a/sqstdlib/sqstdstream.cpp +++ b/sqstdlib/sqstdstream.cpp @@ -249,7 +249,7 @@ static const SQRegFunction _stream_methods[] = { _DECL_STREAM_FUNC(eos,1,_SC("x")), _DECL_STREAM_FUNC(flush,1,_SC("x")), _DECL_STREAM_FUNC(_cloned,0,NULL), - {0,0} + {NULL,(SQFUNCTION)0,0,NULL} }; void init_streamclass(HSQUIRRELVM v) diff --git a/sqstdlib/sqstdstring.cpp b/sqstdlib/sqstdstring.cpp index 1ce1149..fa7ecd3 100644 --- a/sqstdlib/sqstdstring.cpp +++ b/sqstdlib/sqstdstring.cpp @@ -94,9 +94,9 @@ SQRESULT sqstd_format(HSQUIRRELVM v,SQInteger nformatstringidx,SQInteger *outlen if(n < 0) return -1; SQInteger addlen = 0; SQInteger valtype = 0; - const SQChar *ts; - SQInteger ti; - SQFloat tf; + const SQChar *ts = NULL; + SQInteger ti = 0; + SQFloat tf = 0; switch(format[n]) { case 's': if(SQ_FAILED(sq_getstring(v,nparam,&ts))) @@ -350,7 +350,7 @@ static SQInteger _string_endswith(HSQUIRRELVM v) SQRex *self = NULL; \ sq_getinstanceup(v,1,(SQUserPointer *)&self,0); -static SQInteger _rexobj_releasehook(SQUserPointer p, SQInteger size) +static SQInteger _rexobj_releasehook(SQUserPointer p, SQInteger /*size*/) { SQRex *self = ((SQRex *)p); sqstd_rex_free(self); @@ -452,7 +452,7 @@ static const SQRegFunction rexobj_funcs[]={ _DECL_REX_FUNC(capture,-2,_SC("xsn")), _DECL_REX_FUNC(subexpcount,1,_SC("x")), _DECL_REX_FUNC(_typeof,1,_SC("x")), - {0,0} + {NULL,(SQFUNCTION)0,0,NULL} }; #undef _DECL_REX_FUNC @@ -466,7 +466,7 @@ static const SQRegFunction stringlib_funcs[]={ _DECL_FUNC(escape,2,_SC(".s")), _DECL_FUNC(startswith,3,_SC(".ss")), _DECL_FUNC(endswith,3,_SC(".ss")), - {0,0} + {NULL,(SQFUNCTION)0,0,NULL} }; #undef _DECL_FUNC diff --git a/sqstdlib/sqstdsystem.cpp b/sqstdlib/sqstdsystem.cpp index 959d631..b008a44 100644 --- a/sqstdlib/sqstdsystem.cpp +++ b/sqstdlib/sqstdsystem.cpp @@ -126,7 +126,7 @@ static const SQRegFunction systemlib_funcs[]={ _DECL_FUNC(date,-1,_SC(".nn")), _DECL_FUNC(remove,2,_SC(".s")), _DECL_FUNC(rename,3,_SC(".ss")), - {0,0} + {NULL,(SQFUNCTION)0,0,NULL} }; #undef _DECL_FUNC diff --git a/squirrel/sqapi.cpp b/squirrel/sqapi.cpp index 38505bd..d32d35f 100644 --- a/squirrel/sqapi.cpp +++ b/squirrel/sqapi.cpp @@ -180,7 +180,7 @@ SQBool sq_release(HSQUIRRELVM v,HSQOBJECT *po) #endif } -SQUnsignedInteger sq_getvmrefcount(HSQUIRRELVM v, const HSQOBJECT *po) +SQUnsignedInteger sq_getvmrefcount(HSQUIRRELVM /*v*/, const HSQOBJECT *po) { if (!ISREFCOUNTED(type(*po))) return 0; return po->_unVal.pRefCounted->_uiRef; diff --git a/squirrel/sqbaselib.cpp b/squirrel/sqbaselib.cpp index 41efa53..b6cc207 100644 --- a/squirrel/sqbaselib.cpp +++ b/squirrel/sqbaselib.cpp @@ -40,7 +40,7 @@ static bool str2num(const SQChar *s,SQObjectPtr &res,SQInteger base) return true; } -static SQInteger base_dummy(HSQUIRRELVM v) +static SQInteger base_dummy(HSQUIRRELVM /*v*/) { return 0; } @@ -296,7 +296,7 @@ static const SQRegFunction base_funcs[]={ {_SC("collectgarbage"),base_collectgarbage,0, NULL}, {_SC("resurrectunreachable"),base_resurectureachable,0, NULL}, #endif - {0,0} + {NULL,(SQFUNCTION)0,0,NULL} }; void sq_base_register(HSQUIRRELVM v) @@ -475,7 +475,7 @@ const SQRegFunction SQSharedState::_table_default_delegate_funcz[]={ {_SC("clear"),obj_clear,1, _SC(".")}, {_SC("setdelegate"),table_setdelegate,2, _SC(".t|o")}, {_SC("getdelegate"),table_getdelegate,1, _SC(".")}, - {0,0} + {NULL,(SQFUNCTION)0,0,NULL} }; //ARRAY DEFAULT DELEGATE/////////////////////////////////////// @@ -721,7 +721,7 @@ static bool _hsort_sift_down(HSQUIRRELVM v,SQArray *arr, SQInteger root, SQInteg return true; } -static bool _hsort(HSQUIRRELVM v,SQObjectPtr &arr, SQInteger l, SQInteger r,SQInteger func) +static bool _hsort(HSQUIRRELVM v,SQObjectPtr &arr, SQInteger /*l*/, SQInteger /*r*/, SQInteger func) { SQArray *a = _array(arr); SQInteger i; @@ -794,7 +794,7 @@ const SQRegFunction SQSharedState::_array_default_delegate_funcz[]={ {_SC("reduce"),array_reduce,2, _SC("ac")}, {_SC("filter"),array_filter,2, _SC("ac")}, {_SC("find"),array_find,2, _SC("a.")}, - {0,0} + {NULL,(SQFUNCTION)0,0,NULL} }; //STRING DEFAULT DELEGATE////////////////////////// @@ -863,7 +863,7 @@ const SQRegFunction SQSharedState::_string_default_delegate_funcz[]={ {_SC("tolower"),string_tolower,-1, _SC("s n n")}, {_SC("toupper"),string_toupper,-1, _SC("s n n")}, {_SC("weakref"),obj_delegate_weakref,1, NULL }, - {0,0} + {NULL,(SQFUNCTION)0,0,NULL} }; //INTEGER DEFAULT DELEGATE////////////////////////// @@ -873,7 +873,7 @@ const SQRegFunction SQSharedState::_number_default_delegate_funcz[]={ {_SC("tostring"),default_delegate_tostring,1, _SC(".")}, {_SC("tochar"),number_delegate_tochar,1, _SC("n|b")}, {_SC("weakref"),obj_delegate_weakref,1, NULL }, - {0,0} + {NULL,(SQFUNCTION)0,0,NULL} }; //CLOSURE DEFAULT DELEGATE////////////////////////// @@ -983,7 +983,7 @@ const SQRegFunction SQSharedState::_closure_default_delegate_funcz[]={ {_SC("getinfos"),closure_getinfos,1, _SC("c")}, {_SC("getroot"),closure_getroot,1, _SC("c")}, {_SC("setroot"),closure_setroot,2, _SC("ct")}, - {0,0} + {NULL,(SQFUNCTION)0,0,NULL} }; //GENERATOR DEFAULT DELEGATE @@ -1002,7 +1002,7 @@ const SQRegFunction SQSharedState::_generator_default_delegate_funcz[]={ {_SC("getstatus"),generator_getstatus,1, _SC("g")}, {_SC("weakref"),obj_delegate_weakref,1, NULL }, {_SC("tostring"),default_delegate_tostring,1, _SC(".")}, - {0,0} + {NULL,(SQFUNCTION)0,0,NULL} }; //THREAD DEFAULT DELEGATE @@ -1162,7 +1162,7 @@ const SQRegFunction SQSharedState::_thread_default_delegate_funcz[] = { {_SC("weakref"),obj_delegate_weakref,1, NULL }, {_SC("getstackinfos"),thread_getstackinfos,2, _SC("vn")}, {_SC("tostring"),default_delegate_tostring,1, _SC(".")}, - {0,0}, + {NULL,(SQFUNCTION)0,0,NULL} }; static SQInteger class_getattributes(HSQUIRRELVM v) @@ -1229,7 +1229,7 @@ const SQRegFunction SQSharedState::_class_default_delegate_funcz[] = { {_SC("getbase"),class_getbase,1, _SC("y")}, {_SC("newmember"),class_newmember,-3, _SC("y")}, {_SC("rawnewmember"),class_rawnewmember,-3, _SC("y")}, - {0,0} + {NULL,(SQFUNCTION)0,0,NULL} }; @@ -1247,7 +1247,7 @@ const SQRegFunction SQSharedState::_instance_default_delegate_funcz[] = { {_SC("rawin"),container_rawexists,2, _SC("x")}, {_SC("weakref"),obj_delegate_weakref,1, NULL }, {_SC("tostring"),default_delegate_tostring,1, _SC(".")}, - {0,0} + {NULL,(SQFUNCTION)0,0,NULL} }; static SQInteger weakref_ref(HSQUIRRELVM v) @@ -1261,6 +1261,6 @@ const SQRegFunction SQSharedState::_weakref_default_delegate_funcz[] = { {_SC("ref"),weakref_ref,1, _SC("r")}, {_SC("weakref"),obj_delegate_weakref,1, NULL }, {_SC("tostring"),default_delegate_tostring,1, _SC(".")}, - {0,0} + {NULL,(SQFUNCTION)0,0,NULL} }; diff --git a/squirrel/sqclass.cpp b/squirrel/sqclass.cpp index 6d588db..4fb4f62 100644 --- a/squirrel/sqclass.cpp +++ b/squirrel/sqclass.cpp @@ -189,7 +189,7 @@ SQInstance::~SQInstance() if(_class){ Finalize(); } //if _class is null it was already finalized by the GC } -bool SQInstance::GetMetaMethod(SQVM *v,SQMetaMethod mm,SQObjectPtr &res) +bool SQInstance::GetMetaMethod(SQVM * /*v*/, SQMetaMethod mm, SQObjectPtr &res) { if(type(_class->_metamethods[mm]) != OT_NULL) { res = _class->_metamethods[mm]; diff --git a/squirrel/sqcompiler.cpp b/squirrel/sqcompiler.cpp index 68b99ae..d36662b 100644 --- a/squirrel/sqcompiler.cpp +++ b/squirrel/sqcompiler.cpp @@ -983,6 +983,7 @@ public: SQInteger key = _fs->PopTarget(); SQInteger attrs = hasattrs ? _fs->PopTarget():-1; assert((hasattrs && (attrs == key-1)) || !hasattrs); + (void)attrs; // UNUSED unsigned char flags = (hasattrs?NEW_SLOT_ATTRIBUTES_FLAG:0)|(isstatic?NEW_SLOT_STATIC_FLAG:0); SQInteger table = _fs->TopTarget(); //<