Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
8 changes: 8 additions & 0 deletions sqstdlib/sqstdio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,20 @@ SQInteger sqstd_fseek(SQFILE file, SQInteger offset, SQInteger origin)
case SQ_SEEK_SET: realorigin = SEEK_SET; break;
default: return -1; //failed
}
#ifndef _WIN64
return fseek((FILE *)file,(long)offset,(int)realorigin);
#else
return _fseeki64((FILE*)file, (long)offset, (int)realorigin);
#endif // !_WIN64
}

SQInteger sqstd_ftell(SQFILE file)
{
#ifndef _WIN64
return ftell((FILE *)file);
#else
return _ftelli64((FILE*)file);
#endif // !_WIN64
}

SQInteger sqstd_fflush(SQFILE file)
Expand Down
2 changes: 1 addition & 1 deletion squirrel/sqclass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ bool SQClass::NewSlot(SQSharedState *ss,const SQObjectPtr &key,const SQObjectPtr
_methods.push_back(m);
}
else {
_methods[_member_idx(temp)].val = theval;
_methods[_member_idx(temp)].val = std::move(theval);
}
}
return true;
Expand Down
2 changes: 1 addition & 1 deletion squirrel/sqcompiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1008,8 +1008,8 @@ class SQCompiler
if(separator == ',') { //only works for tables
_fs->AddInstruction(_OP_LOAD, _fs->PushTarget(), _fs->GetConstant(Expect(TK_STRING_LITERAL)));
Expect(_SC(':')); Expression();
break;
}
break;
default :
_fs->AddInstruction(_OP_LOAD, _fs->PushTarget(), _fs->GetConstant(Expect(TK_IDENTIFIER)));
Expect(_SC('=')); Expression();
Expand Down
16 changes: 4 additions & 12 deletions squirrel/sqfuncproto.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,11 @@ enum SQOuterType {
struct SQOuterVar
{

SQOuterVar(){}
SQOuterVar(const SQObjectPtr &name,const SQObjectPtr &src,SQOuterType t)
{
_name = name;
_src=src;
_type=t;
}
SQOuterVar() = default;
SQOuterVar(const SQObjectPtr &name, const SQObjectPtr &src, SQOuterType t)
: _type(t), _name(name), _src(src) {}
SQOuterVar(const SQOuterVar &ov)
{
_type=ov._type;
_src=ov._src;
_name=ov._name;
}
: _type(ov._type), _name(ov._name), _src(ov._src) {}
SQOuterType _type;
SQObjectPtr _name;
SQObjectPtr _src;
Expand Down
2 changes: 1 addition & 1 deletion squirrel/sqlexer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#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() = default;
SQLexer::~SQLexer()
{
_keywords->Release();
Expand Down
4 changes: 2 additions & 2 deletions squirrel/sqobject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -493,8 +493,8 @@ bool SQFunctionProto::Load(SQVM *v,SQUserPointer up,SQREADFUNC read,SQObjectPtr
SQFunctionProto *f = SQFunctionProto::Create(_opt_ss(v),ninstructions,nliterals,nparameters,
nfunctions,noutervalues,nlineinfos,nlocalvarinfos,ndefaultparams);
SQObjectPtr proto = f; //gets a ref in case of failure
f->_sourcename = sourcename;
f->_name = name;
f->_sourcename = std::move(sourcename);
f->_name = std::move(name);

_CHECK_IO(CheckTag(v,read,up,SQ_CLOSURESTREAM_PART));

Expand Down
2 changes: 1 addition & 1 deletion squirrel/sqopcodes.h
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ struct SQInstructionDesc {

struct SQInstruction
{
SQInstruction(){};
SQInstruction() = default;
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;
Expand Down
20 changes: 12 additions & 8 deletions squirrel/sqvm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,7 @@ bool SQVM::ToString(const SQObjectPtr &o,SQObjectPtr &res)
}
}
}
break;
default:
scsprintf(_sp(sq_rsl((sizeof(void*)*2)+NUMBER_MAX_CHAR)),sq_rsl((sizeof(void*)*2)+NUMBER_MAX_CHAR),_SC("(%s : 0x%p)"),GetTypeName(o),(void*)_rawval(o));
}
Expand Down Expand Up @@ -574,6 +575,7 @@ bool SQVM::FOREACH_OP(SQObjectPtr &o1,SQObjectPtr &o2,SQObjectPtr
_generator(o1)->Resume(this, o3);
_FINISH(0);
}
break;
default:
Raise_Error(_SC("cannot iterate %s"), GetTypeName(o1));
}
Expand Down Expand Up @@ -651,7 +653,7 @@ bool SQVM::CLASS_OP(SQObjectPtr &target,SQInteger baseclass,SQInteger attributes
}
Pop(nparams);
}
_class(target)->_attributes = attrs;
_class(target)->_attributes = std::move(attrs);
return true;
}

Expand Down Expand Up @@ -1070,12 +1072,14 @@ bool SQVM::Execute(SQObjectPtr &closure, SQInteger nargs, SQInteger stackbase,SQ
_GUARD(NewSlotA(STK(arg1),STK(arg2),STK(arg3),(arg0&NEW_SLOT_ATTRIBUTES_FLAG) ? STK(arg2-1) : SQObjectPtr(),(arg0&NEW_SLOT_STATIC_FLAG)?true:false,false));
continue;
case _OP_GETBASE:{
SQClosure *clo = _closure(ci->_closure);
if(clo->_base) {
TARGET = clo->_base;
}
else {
TARGET.Null();
if (ci) {
SQClosure* clo = _closure(ci->_closure);
if (clo->_base) {
TARGET = clo->_base;
}
else {
TARGET.Null();
}
}
continue;
}
Expand Down Expand Up @@ -1409,7 +1413,7 @@ SQInteger SQVM::FallBackSet(const SQObjectPtr &self,const SQObjectPtr &key,const
if(_table(self)->_delegate) {
if(Set(_table(self)->_delegate,key,val,DONT_FALL_BACK)) return FALLBACK_OK;
}
//keps on going
// keeps on going
case OT_INSTANCE:
case OT_USERDATA:{
SQObjectPtr closure;
Expand Down
2 changes: 1 addition & 1 deletion squirrel/sqvm.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
void sq_base_register(HSQUIRRELVM v);

struct SQExceptionTrap{
SQExceptionTrap() {}
SQExceptionTrap() = default;
SQExceptionTrap(SQInteger ss, SQInteger stackbase,SQInstruction *ip, SQInteger ex_target){ _stacksize = ss; _stackbase = stackbase; _ip = ip; _extarget = ex_target;}
SQExceptionTrap(const SQExceptionTrap &et) { (*this) = et; }
SQInteger _stackbase;
Expand Down