diff --git a/HISTORY b/HISTORY index ab0c92a..0e85d9b 100644 --- a/HISTORY +++ b/HISTORY @@ -1,3 +1,8 @@ +***version 3.1.1 stable*** +-sq_gettypetag doesn't set last error(it's treated as SQBool function but keeps a SQRESULT for backward compatibility) +-fixed _set method in userdata deelegates +-fixed some warnings + ***version 3.1 stable*** -added slice range for tolower and toupper -added startswith() and endswith() in string lib diff --git a/sqstdlib/sqstdblob.cpp b/sqstdlib/sqstdblob.cpp index 1db973b..67e5f3c 100644 --- a/sqstdlib/sqstdblob.cpp +++ b/sqstdlib/sqstdblob.cpp @@ -7,7 +7,7 @@ #include "sqstdstream.h" #include "sqstdblobimpl.h" -#define SQSTD_BLOB_TYPE_TAG (SQSTD_STREAM_TYPE_TAG | 0x00000002) +#define SQSTD_BLOB_TYPE_TAG ((SQUnsignedInteger)(SQSTD_STREAM_TYPE_TAG | 0x00000002)) //Blob diff --git a/sqstdlib/sqstdio.cpp b/sqstdlib/sqstdio.cpp index bbd54b4..52cd515 100644 --- a/sqstdlib/sqstdio.cpp +++ b/sqstdlib/sqstdio.cpp @@ -5,7 +5,7 @@ #include #include "sqstdstream.h" -#define SQSTD_FILE_TYPE_TAG (SQSTD_STREAM_TYPE_TAG | 0x00000001) +#define SQSTD_FILE_TYPE_TAG ((SQUnsignedInteger)(SQSTD_STREAM_TYPE_TAG | 0x00000001)) //basic API SQFILE sqstd_fopen(const SQChar *filename ,const SQChar *mode) { diff --git a/sqstdlib/sqstdrex.cpp b/sqstdlib/sqstdrex.cpp index 228d539..d0583a6 100644 --- a/sqstdlib/sqstdrex.cpp +++ b/sqstdlib/sqstdrex.cpp @@ -578,9 +578,9 @@ SQRex *sqstd_rex_compile(const SQChar *pattern,const SQChar **error) scprintf(_SC("\n")); for(i = 0;i < nsize; i++) { if(exp->_nodes[i].type>MAX_CHAR) - scprintf(_SC("[%02d] %10s "),i,g_nnames[exp->_nodes[i].type-MAX_CHAR]); + scprintf(_SC("[%02d] %10s "), (SQInt32)i,g_nnames[exp->_nodes[i].type-MAX_CHAR]); else - scprintf(_SC("[%02d] %10c "),i,exp->_nodes[i].type); + scprintf(_SC("[%02d] %10c "), (SQInt32)i,exp->_nodes[i].type); scprintf(_SC("left %02d right %02d next %02d\n"), (SQInt32)exp->_nodes[i].left, (SQInt32)exp->_nodes[i].right, (SQInt32)exp->_nodes[i].next); } scprintf(_SC("\n")); diff --git a/sqstdlib/sqstdstream.cpp b/sqstdlib/sqstdstream.cpp index 406f561..b5c47cf 100644 --- a/sqstdlib/sqstdstream.cpp +++ b/sqstdlib/sqstdstream.cpp @@ -11,7 +11,7 @@ #define SETUP_STREAM(v) \ SQStream *self = NULL; \ - if(SQ_FAILED(sq_getinstanceup(v,1,(SQUserPointer*)&self,(SQUserPointer)SQSTD_STREAM_TYPE_TAG))) \ + if(SQ_FAILED(sq_getinstanceup(v,1,(SQUserPointer*)&self,(SQUserPointer)((SQUnsignedInteger)SQSTD_STREAM_TYPE_TAG)))) \ return sq_throwerror(v,_SC("invalid type tag")); \ if(!self || !self->IsValid()) \ return sq_throwerror(v,_SC("the stream is invalid")); @@ -259,7 +259,7 @@ void init_streamclass(HSQUIRRELVM v) if(SQ_FAILED(sq_get(v,-2))) { sq_pushstring(v,_SC("std_stream"),-1); sq_newclass(v,SQFalse); - sq_settypetag(v,-1,(SQUserPointer)SQSTD_STREAM_TYPE_TAG); + sq_settypetag(v,-1,(SQUserPointer)((SQUnsignedInteger)SQSTD_STREAM_TYPE_TAG)); SQInteger i = 0; while(_stream_methods[i].name != 0) { const SQRegFunction &f = _stream_methods[i]; diff --git a/squirrel/sqapi.cpp b/squirrel/sqapi.cpp index 3651d0a..21039fc 100644 --- a/squirrel/sqapi.cpp +++ b/squirrel/sqapi.cpp @@ -776,8 +776,8 @@ SQRESULT sq_getobjtypetag(const HSQOBJECT *o,SQUserPointer * typetag) SQRESULT sq_gettypetag(HSQUIRRELVM v,SQInteger idx,SQUserPointer *typetag) { SQObjectPtr &o = stack_get(v,idx); - if(SQ_FAILED(sq_getobjtypetag(&o,typetag))) - return sq_throwerror(v,_SC("invalid object type")); + if (SQ_FAILED(sq_getobjtypetag(&o, typetag))) + return SQ_ERROR;// this is not an error it should be a bool but would break backward compatibility return SQ_OK; } diff --git a/squirrel/sqdebug.cpp b/squirrel/sqdebug.cpp index 7785f21..7214a2c 100644 --- a/squirrel/sqdebug.cpp +++ b/squirrel/sqdebug.cpp @@ -107,7 +107,7 @@ void SQVM::Raise_ParamTypeError(SQInteger nparam,SQInteger typemask,SQInteger ty SQInteger found = 0; for(SQInteger i=0; i<16; i++) { - SQInteger mask = 0x00000001 << i; + SQInteger mask = ((SQInteger)1) << i; if(typemask & (mask)) { if(found>0) StringCat(exptypes,SQString::Create(_ss(this), _SC("|"), -1), exptypes); found ++; diff --git a/squirrel/sqfuncstate.cpp b/squirrel/sqfuncstate.cpp index ce3c7f5..022702c 100644 --- a/squirrel/sqfuncstate.cpp +++ b/squirrel/sqfuncstate.cpp @@ -117,8 +117,8 @@ void SQFuncState::Dump(SQFunctionProto *func) { SQUnsignedInteger n=0,i; SQInteger si; - scprintf(_SC("SQInstruction sizeof %d\n"),sizeof(SQInstruction)); - scprintf(_SC("SQObject sizeof %d\n"),sizeof(SQObject)); + scprintf(_SC("SQInstruction sizeof %d\n"),(SQInt32)sizeof(SQInstruction)); + scprintf(_SC("SQObject sizeof %d\n"), (SQInt32)sizeof(SQObject)); scprintf(_SC("--------------------------------------------------------------------\n")); scprintf(_SC("*****FUNCTION [%s]\n"),type(func->_name)==OT_STRING?_stringval(func->_name):_SC("unknown")); scprintf(_SC("-----LITERALS\n")); @@ -131,7 +131,7 @@ void SQFuncState::Dump(SQFunctionProto *func) templiterals[_integer(val)]=key; } for(i=0;i>\n")); n=0; for(i=0;i<_parameters.size();i++){ - scprintf(_SC("[%d] "),n); + scprintf(_SC("[%d] "), (SQInt32)n); DumpLiteral(_parameters[i]); scprintf(_SC("\n")); n++; @@ -149,13 +149,13 @@ void SQFuncState::Dump(SQFunctionProto *func) scprintf(_SC("-----LOCALS\n")); for(si=0;si_nlocalvarinfos;si++){ SQLocalVarInfo lvi=func->_localvarinfos[si]; - scprintf(_SC("[%d] %s \t%d %d\n"),lvi._pos,_stringval(lvi._name),lvi._start_op,lvi._end_op); + scprintf(_SC("[%d] %s \t%d %d\n"), (SQInt32)lvi._pos,_stringval(lvi._name), (SQInt32)lvi._start_op, (SQInt32)lvi._end_op); n++; } scprintf(_SC("-----LINE INFO\n")); for(i=0;i<_lineinfos.size();i++){ SQLineInfo li=_lineinfos[i]; - scprintf(_SC("op [%d] line [%d] \n"),li._op,li._line); + scprintf(_SC("op [%d] line [%d] \n"), (SQInt32)li._op, (SQInt32)li._line); n++; } scprintf(_SC("-----dump\n")); @@ -165,7 +165,7 @@ void SQFuncState::Dump(SQFunctionProto *func) if(inst.op==_OP_LOAD || inst.op==_OP_DLOAD || inst.op==_OP_PREPCALLK || inst.op==_OP_GETK ){ SQInteger lidx = inst._arg1; - scprintf(_SC("[%03d] %15s %d "),n,g_InstrDesc[inst.op].name,inst._arg0); + scprintf(_SC("[%03d] %15s %d "), (SQInt32)n,g_InstrDesc[inst.op].name,inst._arg0); if(lidx >= 0xFFFFFFFF) scprintf(_SC("null")); else { @@ -196,18 +196,18 @@ void SQFuncState::Dump(SQFunctionProto *func) } } else if(inst.op==_OP_LOADFLOAT) { - scprintf(_SC("[%03d] %15s %d %f %d %d\n"),n,g_InstrDesc[inst.op].name,inst._arg0,*((SQFloat*)&inst._arg1),inst._arg2,inst._arg3); + scprintf(_SC("[%03d] %15s %d %f %d %d\n"), (SQInt32)n,g_InstrDesc[inst.op].name,inst._arg0,*((SQFloat*)&inst._arg1),inst._arg2,inst._arg3); } /* else if(inst.op==_OP_ARITH){ scprintf(_SC("[%03d] %15s %d %d %d %c\n"),n,g_InstrDesc[inst.op].name,inst._arg0,inst._arg1,inst._arg2,inst._arg3); }*/ else { - scprintf(_SC("[%03d] %15s %d %d %d %d\n"),n,g_InstrDesc[inst.op].name,inst._arg0,inst._arg1,inst._arg2,inst._arg3); + scprintf(_SC("[%03d] %15s %d %d %d %d\n"), (SQInt32)n,g_InstrDesc[inst.op].name,inst._arg0,inst._arg1,inst._arg2,inst._arg3); } n++; } scprintf(_SC("-----\n")); - scprintf(_SC("stack size[%d]\n"),func->_stacksize); + scprintf(_SC("stack size[%d]\n"), (SQInt32)func->_stacksize); scprintf(_SC("--------------------------------------------------------------------\n\n")); } #endif diff --git a/squirrel/sqvm.cpp b/squirrel/sqvm.cpp index 757f438..5a8a6e8 100644 --- a/squirrel/sqvm.cpp +++ b/squirrel/sqvm.cpp @@ -1330,6 +1330,7 @@ bool SQVM::Set(const SQObjectPtr &self,const SQObjectPtr &key,const SQObjectPtr return false; } return true; + case OT_USERDATA: break; // must fall back default: Raise_Error(_SC("trying to set '%s'"),GetTypeName(self)); return false; @@ -1717,10 +1718,10 @@ void SQVM::dumpstack(SQInteger stackbase,bool dumpall) for(SQInteger i=0;i"));else scprintf(_SC(" ")); - scprintf(_SC("[%d]:"),n); + scprintf(_SC("[" _PRINT_INT_FMT "]:"),n); switch(type(obj)){ case OT_FLOAT: scprintf(_SC("FLOAT %.3f"),_float(obj));break; - case OT_INTEGER: scprintf(_SC("INTEGER %d"),_integer(obj));break; + case OT_INTEGER: scprintf(_SC("INTEGER " _PRINT_INT_FMT),_integer(obj));break; case OT_BOOL: scprintf(_SC("BOOL %s"),_integer(obj)?"true":"false");break; case OT_STRING: scprintf(_SC("STRING %s"),_stringval(obj));break; case OT_NULL: scprintf(_SC("NULL")); break;