Projects
Essentials
lightspark
Sign Up
Log In
Username
Password
We truncated the diff of some files because they were too big. If you want to see the full diff for every file,
click here
.
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
Expand all
Collapse all
Changes of Revision 108
View file
lightspark.spec
Changed
@@ -20,7 +20,7 @@ %bcond_without librtmp Name: lightspark -Version: 0.7.2.99+git20160529.1025 +Version: 0.7.2.99+git20160604.1811 Release: 0 Summary: Modern, free, open-source flash player implementation License: LGPL-3.0+
View file
lightspark.tar.xz/src/asobject.cpp
Changed
@@ -249,9 +249,7 @@ if (r->is<ObjectConstructor>()) return this == r->getClass(); - LOG(LOG_CALLS,_("Equal comparison between type ")<<getObjectType()<< _(" and type ") << r->getObjectType()); - if(classdef) - LOG(LOG_CALLS,_("Type ") << classdef->class_name); + LOG_CALL(_("Equal comparison between type ")<<getObjectType()<< _(" and type ") << r->getObjectType()); return false; } @@ -526,6 +524,8 @@ { assert(this->is<Class_base>()); obj=this->as<Class_base>()->borrowedVariables.findObjVar(nameId,ns,DECLARED_TRAIT, DECLARED_TRAIT); + if (!this->is<Class_inherit>()) + o->setConstant(); } else obj=Variables.findObjVar(nameId,ns,DECLARED_TRAIT, DECLARED_TRAIT); @@ -676,7 +676,7 @@ if(obj->setter) { //Call the setter - LOG(LOG_CALLS,_("Calling the setter")); + LOG_CALL(_("Calling the setter")); //Overriding function is automatically done by using cur_level IFunction* setter=obj->setter; //One argument can be passed without creating an array @@ -684,7 +684,7 @@ target->incRef(); _R<ASObject> ret= _MR( setter->call(target,&o,1) ); assert_and_throw(ret->is<Undefined>()); - LOG(LOG_CALLS,_("End of setter")); + LOG_CALL(_("End of setter")); } else { @@ -885,7 +885,7 @@ if (type == Type::anyType) { // type could not be found, so it's stored as an uninitialized variable - LOG(LOG_CALLS,"add uninitialized var:"<<mname<<" "<<*typemname); + LOG_CALL("add uninitialized var:"<<mname<<" "<<*typemname); uninitializedVar v; mainObj->incRef(); v.mainObj = mainObj; @@ -909,7 +909,7 @@ //if (!((Class_base*)type)->super) { // super type could not be found, so the class is stored as an uninitialized variable - LOG(LOG_CALLS,"add uninitialized class var:"<<mname); + LOG_CALL("add uninitialized class var:"<<mname); uninitializedVar v; mainObj->incRef(); v.mainObj = mainObj; @@ -942,7 +942,7 @@ //By default we assume it's a passthrough cast if(argslen==1) { - LOG(LOG_CALLS,_("Passthrough of ") << args[0]); + LOG_CALL(_("Passthrough of ") << args[0]); args[0]->incRef(); return args[0]; } @@ -1184,16 +1184,16 @@ ASObject* target=this; if(target->classdef) { - LOG(LOG_CALLS,_("Calling the getter on type ") << target->classdef->class_name<< " for "<<name); + LOG_CALL(_("Calling the getter on type ") << target->classdef->class_name<< " for "<<name); } else { - LOG(LOG_CALLS,_("Calling the getter")<< " for "<<name); + LOG_CALL(_("Calling the getter")<< " for "<<name); } IFunction* getter=obj->getter; target->incRef(); ASObject* ret=getter->call(target,NULL,0); - LOG(LOG_CALLS,_("End of getter")); + LOG_CALL(_("End of getter")); // No incRef because ret is a new instance return _MNR(ret); } @@ -1203,7 +1203,7 @@ assert_and_throw(obj->var); if(obj->var->getObjectType()==T_FUNCTION && obj->var->as<IFunction>()->isMethod()) { - LOG(LOG_CALLS,"Attaching this " << this << " to function " << name); + LOG_CALL("Attaching this " << this << " to function " << name); //the obj reference is acquired by the smart reference this->incRef(); IFunction* f=obj->var->as<IFunction>()->bind(_MR(this),-1); @@ -1337,10 +1337,9 @@ } } -ASObject::ASObject(Class_base* c):Variables((c)?c->memoryAccount:NULL),classdef(NULL),proxyMultiName(NULL),sys(c?c->sys:NULL), - type(T_OBJECT),traitsInitialized(false),constructIndicator(false),constructorCallComplete(false),reusableListNumber(0),implEnable(true) +ASObject::ASObject(Class_base* c,SWFOBJECT_TYPE t):Variables((c)?c->memoryAccount:NULL),classdef(c),proxyMultiName(NULL),sys(c?c->sys:NULL), + type(t),traitsInitialized(false),constructIndicator(false),constructorCallComplete(false),reusableListNumber(0),implEnable(true) { - setClass(c); #ifndef NDEBUG //Stuff only used in debugging initialized=false; @@ -1350,43 +1349,20 @@ ASObject::ASObject(const ASObject& o):Variables((o.classdef)?o.classdef->memoryAccount:NULL),classdef(NULL),proxyMultiName(NULL),sys(o.classdef? o.classdef->sys : NULL), type(o.type),traitsInitialized(false),constructIndicator(false),constructorCallComplete(false),reusableListNumber(0),implEnable(true) { - if(o.classdef) - setClass(o.classdef); - #ifndef NDEBUG //Stuff only used in debugging initialized=false; #endif - - assert_and_throw(o.Variables.size()==0); + assert(o.Variables.size()==0); } void ASObject::setClass(Class_base* c) { if (classdef == c) return; - if(classdef) - { - classdef->abandonObject(this); - classdef->decRef(); - } classdef=c; - if(classdef) - { - classdef->acquireObject(this); - classdef->incRef(); + if(c) this->sys = c->sys; - } -} - -void ASObject::destroy() -{ - if(classdef) - { - classdef->abandonObject(this); - classdef->decRef(); - classdef=NULL; - } } bool ASObject::destruct() @@ -1479,11 +1455,11 @@ if(obj->getter) { //Call the getter - LOG(LOG_CALLS,_("Calling the getter")); + LOG_CALL(_("Calling the getter")); IFunction* getter=obj->getter; incRef(); _R<ASObject> ret(getter->call(this,NULL,0)); - LOG(LOG_CALLS,_("End of getter")); + LOG_CALL(_("End of getter")); return ret; } else
View file
lightspark.tar.xz/src/asobject.h
Changed
@@ -406,9 +406,10 @@ */ bool destruct(); // called when object is really destroyed - virtual void destroy(); + virtual void destroy(){} public: - ASObject(Class_base* c); + ASObject(Class_base* c,SWFOBJECT_TYPE t = T_OBJECT); + #ifndef NDEBUG //Stuff only used in debugging bool initialized:1;
View file
lightspark.tar.xz/src/backends/decoder.cpp
Changed
@@ -869,7 +869,7 @@ if(ret<0) return; - LOG(LOG_CALLS,_("FFMpeg found ") << formatCtx->nb_streams << _(" streams")); + LOG_CALL(_("FFMpeg found ") << formatCtx->nb_streams << _(" streams")); for(uint32_t i=0;i<formatCtx->nb_streams;i++) { if(formatCtx->streams[i]->codec->codec_type==AVMEDIA_TYPE_VIDEO && videoFound==false)
View file
lightspark.tar.xz/src/backends/graphics.cpp
Changed
@@ -118,7 +118,7 @@ if(w>allocWidth || h>allocHeight) //Destination texture should be reallocated { glBindTexture(GL_TEXTURE_2D,texId); - LOG(LOG_CALLS,_("Reallocating texture to size ") << w << 'x' << h); + LOG_CALL(_("Reallocating texture to size ") << w << 'x' << h); setAllocSize(w,h); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, allocWidth, allocHeight, 0, GL_BGRA, GL_UNSIGNED_BYTE, 0); if(GLRenderContext::handleGLErrors())
View file
lightspark.tar.xz/src/logger.h
Changed
@@ -28,6 +28,21 @@ enum LOG_LEVEL { LOG_ERROR=0, LOG_INFO=1, LOG_NOT_IMPLEMENTED=2,LOG_CALLS=3,LOG_TRACE=4}; +// LOG_CALL will only generate output in DEBUG builds +// this is done because the LOG(LOG_CALLS...) macro creates measurable perfomance loss +// when used inside the ABCVm::executeFunction loop even on lower log levels +#ifndef NDEBUG +#define LOG_CALL(esp) \ +do { \ + if(LOG_CALLS<=Log::getLevel()) \ + { \ + Log l(level); \ + l() << esp << std::endl; \ + } \ +} while(0) +#else +#define LOG_CALL(esp) +#endif #define LOG(level,esp) \ do { \ if(level<=Log::getLevel()) \
View file
lightspark.tar.xz/src/scripting/abc.cpp
Changed
@@ -1009,10 +1009,10 @@ #endif /* - * nextNamespaceBase is set to 1 since 0 is the empty namespace + * nextNamespaceBase is set to 2 since 0 is the empty namespace and 1 is the AS3 namespace */ ABCVm::ABCVm(SystemState* s, MemoryAccount* m):m_sys(s),status(CREATED),shuttingdown(false), - events_queue(reporter_allocator<eventType>(m)),nextNamespaceBase(1),currentCallContext(NULL), + events_queue(reporter_allocator<eventType>(m)),nextNamespaceBase(2),currentCallContext(NULL), vmDataMemory(m),cur_recursion(0) { limits.max_recursion = 256;
View file
lightspark.tar.xz/src/scripting/abc_fast_interpreter.cpp
Changed
@@ -78,7 +78,7 @@ case 0x01: { //bkpt - LOG(LOG_CALLS, _("bkpt") ); + LOG_CALL( _("bkpt") ); break; } case 0x02: @@ -124,7 +124,7 @@ { //kill uint32_t t=data->uints[0]; - LOG(LOG_CALLS, "kill " << t); + LOG_CALL( "kill " << t); instructionPointer+=4; assert_and_throw(context->locals[t]); context->locals[t]->decRef(); @@ -363,7 +363,7 @@ { //lookupswitch uint32_t defaultdest=data->uints[0]; - LOG(LOG_CALLS,_("Switch default dest ") << defaultdest); + LOG_CALL(_("Switch default dest ") << defaultdest); uint32_t count=data->uints[1]; ASObject* index_obj=context->runtime_stack_pop(); @@ -553,70 +553,70 @@ case 0x35: { //li8 - LOG(LOG_CALLS, "li8"); + LOG_CALL( "li8"); loadIntN<uint8_t>(context); break; } case 0x36: { //li16 - LOG(LOG_CALLS, "li16"); + LOG_CALL( "li16"); loadIntN<uint16_t>(context); break; } case 0x37: { //li32 - LOG(LOG_CALLS, "li32"); + LOG_CALL( "li32"); loadIntN<uint32_t>(context); break; } case 0x38: { //lf32 - LOG(LOG_CALLS, "lf32"); + LOG_CALL( "lf32"); loadFloat(context); break; } case 0x39: { //lf32 - LOG(LOG_CALLS, "lf64"); + LOG_CALL( "lf64"); loadDouble(context); break; } case 0x3a: { //si8 - LOG(LOG_CALLS, "si8"); + LOG_CALL( "si8"); storeIntN<uint8_t>(context); break; } case 0x3b: { //si16 - LOG(LOG_CALLS, "si16"); + LOG_CALL( "si16"); storeIntN<uint16_t>(context); break; } case 0x3c: { //si32 - LOG(LOG_CALLS, "si32"); + LOG_CALL( "si32"); storeIntN<uint32_t>(context); break; } case 0x3d: { //sf32 - LOG(LOG_CALLS, "sf32"); + LOG_CALL( "sf32"); storeFloat(context); break; } case 0x3e: { //sf32 - LOG(LOG_CALLS, "sf64"); + LOG_CALL( "sf64"); storeDouble(context); break; } @@ -696,7 +696,7 @@ case 0x47: { //returnvoid - LOG(LOG_CALLS,_("returnVoid")); + LOG_CALL(_("returnVoid")); PROF_ACCOUNT_TIME(mi->profTime[instructionPointer],profilingCheckpoint(startTime)); return NULL; } @@ -704,7 +704,7 @@ { //returnvalue ASObject* ret=context->runtime_stack_pop(); - LOG(LOG_CALLS,_("returnValue ") << ret); + LOG_CALL(_("returnValue ") << ret); PROF_ACCOUNT_TIME(mi->profTime[instructionPointer],profilingCheckpoint(startTime)); return ret; } @@ -757,7 +757,7 @@ case 0x50: { //sxi1 - LOG(LOG_CALLS, "sxi1"); + LOG_CALL( "sxi1"); ASObject* arg1=context->runtime_stack_pop(); int32_t ret=arg1->toUInt() & 0x1; arg1->decRef(); @@ -767,7 +767,7 @@ case 0x51: { //sxi8 - LOG(LOG_CALLS, "sxi8"); + LOG_CALL( "sxi8"); ASObject* arg1=context->runtime_stack_pop(); int32_t ret=(int8_t)arg1->toUInt(); arg1->decRef(); @@ -777,7 +777,7 @@ case 0x52: { //sxi16 - LOG(LOG_CALLS, "sxi16"); + LOG_CALL( "sxi16"); ASObject* arg1=context->runtime_stack_pop(); int32_t ret=(int16_t)arg1->toUInt(); arg1->decRef(); @@ -893,12 +893,12 @@ instructionPointer+=4; if (!context->locals[i]) { - LOG(LOG_CALLS, _("getLocal ") << i << " not set, pushing Undefined"); + LOG_CALL( _("getLocal ") << i << " not set, pushing Undefined"); context->runtime_stack_push(function->getSystemState()->getUndefinedRef()); break; } context->locals[i]->incRef(); - LOG(LOG_CALLS, _("getLocal ") << i << _(": ") << context->locals[i]->toDebugString() ); + LOG_CALL( _("getLocal ") << i << _(": ") << context->locals[i]->toDebugString() ); context->runtime_stack_push(context->locals[i]); break; } @@ -907,7 +907,7 @@ //setlocal uint32_t i=data->uints[0]; instructionPointer+=4; - LOG(LOG_CALLS, _("setLocal ") << i ); + LOG_CALL( _("setLocal ") << i ); ASObject* obj=context->runtime_stack_pop(); assert_and_throw(obj); if ((int)i != context->argarrayposition || obj->is<Array>()) @@ -1126,7 +1126,7 @@ rewriteableCode[instructionPointer-1]=0xfc; rewritableData->types[0]=type; - LOG(LOG_CALLS,"coerceOnce " << *name); + LOG_CALL("coerceOnce " << *name); ASObject* o=context->runtime_stack_pop(); o=type->coerce(o); @@ -1274,7 +1274,7 @@ { int64_t num1=v1->toInt64(); int64_t num2=v2->toInt64(); - LOG(LOG_CALLS,_("subtractI ") << num1 << '-' << num2); + LOG_CALL(_("subtractI ") << num1 << '-' << num2); v1->decRef(); v2->decRef(); ret = abstract_di(function->getSystemState(), num1-num2); @@ -1297,7 +1297,7 @@ { int64_t num1=v1->toInt64(); int64_t num2=v2->toInt64(); - LOG(LOG_CALLS,_("multiplyI ") << num1 << '*' << num2);
View file
lightspark.tar.xz/src/scripting/abc_interpreter.cpp
Changed
@@ -74,7 +74,7 @@ case 0x01: { //bkpt - LOG(LOG_CALLS, _("bkpt") ); + LOG_CALL( _("bkpt") ); break; } case 0x02: @@ -120,7 +120,7 @@ { //kill uint32_t t = code.readu30(); - LOG(LOG_CALLS, "kill " << t); + LOG_CALL( "kill " << t); assert_and_throw(context->locals[t]); context->locals[t]->decRef(); context->locals[t]=function->getSystemState()->getUndefinedRef(); @@ -425,13 +425,13 @@ int here=int(code.tellg())-1; //Base for the jumps is the instruction itself for the switch int32_t t = code.reads24(); int defaultdest=here+t; - LOG(LOG_CALLS,_("Switch default dest ") << defaultdest); + LOG_CALL(_("Switch default dest ") << defaultdest); uint32_t count = code.readu30(); int32_t* offsets=g_newa(int32_t, count+1); for(unsigned int i=0;i<count+1;i++) { offsets[i] = code.reads24(); - LOG(LOG_CALLS,_("Switch dest ") << i << ' ' << offsets[i]); + LOG_CALL(_("Switch dest ") << i << ' ' << offsets[i]); } ASObject* index_obj=context->runtime_stack_pop(); @@ -679,70 +679,70 @@ case 0x35: { //li8 - LOG(LOG_CALLS, "li8"); + LOG_CALL( "li8"); loadIntN<uint8_t>(context); break; } case 0x36: { //li16 - LOG(LOG_CALLS, "li16"); + LOG_CALL( "li16"); loadIntN<uint16_t>(context); break; } case 0x37: { //li32 - LOG(LOG_CALLS, "li32"); + LOG_CALL( "li32"); loadIntN<uint32_t>(context); break; } case 0x38: { //lf32 - LOG(LOG_CALLS, "lf32"); + LOG_CALL( "lf32"); loadFloat(context); break; } case 0x39: { //lf32 - LOG(LOG_CALLS, "lf64"); + LOG_CALL( "lf64"); loadDouble(context); break; } case 0x3a: { //si8 - LOG(LOG_CALLS, "si8"); + LOG_CALL( "si8"); storeIntN<uint8_t>(context); break; } case 0x3b: { //si16 - LOG(LOG_CALLS, "si16"); + LOG_CALL( "si16"); storeIntN<uint16_t>(context); break; } case 0x3c: { //si32 - LOG(LOG_CALLS, "si32"); + LOG_CALL( "si32"); storeIntN<uint32_t>(context); break; } case 0x3d: { //sf32 - LOG(LOG_CALLS, "sf32"); + LOG_CALL( "sf32"); storeFloat(context); break; } case 0x3e: { //sf32 - LOG(LOG_CALLS, "sf64"); + LOG_CALL( "sf64"); storeDouble(context); break; } @@ -819,7 +819,7 @@ case 0x47: { //returnvoid - LOG(LOG_CALLS,_("returnVoid")); + LOG_CALL(_("returnVoid")); PROF_ACCOUNT_TIME(mi->profTime[instructionPointer],profilingCheckpoint(startTime)); return NULL; } @@ -827,7 +827,7 @@ { //returnvalue ASObject* ret=context->runtime_stack_pop(); - LOG(LOG_CALLS,_("returnValue ") << ret); + LOG_CALL(_("returnValue ") << ret); PROF_ACCOUNT_TIME(mi->profTime[instructionPointer],profilingCheckpoint(startTime)); return ret; } @@ -877,7 +877,7 @@ case 0x50: { //sxi1 - LOG(LOG_CALLS, "sxi1"); + LOG_CALL( "sxi1"); ASObject* arg1=context->runtime_stack_pop(); int32_t ret=arg1->toUInt() >>31; arg1->decRef(); @@ -887,7 +887,7 @@ case 0x51: { //sxi8 - LOG(LOG_CALLS, "sxi8"); + LOG_CALL( "sxi8"); ASObject* arg1=context->runtime_stack_pop(); int32_t ret=(int8_t)arg1->toUInt(); arg1->decRef(); @@ -897,7 +897,7 @@ case 0x52: { //sxi16 - LOG(LOG_CALLS, "sxi16"); + LOG_CALL( "sxi16"); ASObject* arg1=context->runtime_stack_pop(); int32_t ret=(int16_t)arg1->toUInt(); arg1->decRef(); @@ -1007,12 +1007,12 @@ uint32_t i = code.readu30(); if (!context->locals[i]) { - LOG(LOG_CALLS, _("getLocal ") << i << " not set, pushing Undefined"); + LOG_CALL( _("getLocal ") << i << " not set, pushing Undefined"); context->runtime_stack_push(function->getSystemState()->getUndefinedRef()); break; } context->locals[i]->incRef(); - LOG(LOG_CALLS, _("getLocal ") << i << _(": ") << context->locals[i]->toDebugString() ); + LOG_CALL( _("getLocal ") << i << _(": ") << context->locals[i]->toDebugString() ); context->runtime_stack_push(context->locals[i]); break; } @@ -1020,7 +1020,7 @@ { //setlocal uint32_t i = code.readu30(); - LOG(LOG_CALLS, _("setLocal ") << i ); + LOG_CALL( _("setLocal ") << i ); ASObject* obj=context->runtime_stack_pop(); assert_and_throw(obj); if ((int)i != context->argarrayposition || obj->is<Array>()) @@ -1363,7 +1363,7 @@ { int64_t num1=v1->toInt64(); int64_t num2=v2->toInt64(); - LOG(LOG_CALLS,_("subtractI ") << num1 << '-' << num2); + LOG_CALL(_("subtractI ") << num1 << '-' << num2); v1->decRef(); v2->decRef(); ret = abstract_di(function->getSystemState(), num1-num2); @@ -1386,7 +1386,7 @@ { int64_t num1=v1->toInt64(); int64_t num2=v2->toInt64(); - LOG(LOG_CALLS,_("multiplyI ") << num1 << '*' << num2); + LOG_CALL(_("multiplyI ") << num1 << '*' << num2); v1->decRef();
View file
lightspark.tar.xz/src/scripting/abc_opcodes.cpp
Changed
@@ -38,7 +38,7 @@ int32_t i2=val2->toInt(); val1->decRef(); val2->decRef(); - LOG(LOG_CALLS,_("bitAnd_oo ") << hex << i1 << '&' << i2 << dec); + LOG_CALL(_("bitAnd_oo ") << hex << i1 << '&' << i2 << dec); return i1&i2; } @@ -47,13 +47,13 @@ int32_t i1=val1->toInt(); int32_t i2=val2; val1->decRef(); - LOG(LOG_CALLS,_("bitAnd_oi ") << hex << i1 << '&' << i2 << dec); + LOG_CALL(_("bitAnd_oi ") << hex << i1 << '&' << i2 << dec); return i1&i2; } void ABCVm::setProperty(ASObject* value,ASObject* obj,multiname* name) { - LOG(LOG_CALLS,_("setProperty ") << *name << ' ' << obj<<" "<<obj->toDebugString()<<" " <<value); + LOG_CALL(_("setProperty ") << *name << ' ' << obj<<" "<<obj->toDebugString()<<" " <<value); if(obj->is<Null>()) { @@ -72,7 +72,7 @@ void ABCVm::setProperty_i(int32_t value,ASObject* obj,multiname* name) { - LOG(LOG_CALLS,_("setProperty_i ") << *name << ' ' <<obj); + LOG_CALL(_("setProperty_i ") << *name << ' ' <<obj); if(obj->is<Null>()) { LOG(LOG_ERROR,"calling setProperty_i on null:" << *name << ' ' << obj->toDebugString()<<" " << value); @@ -89,7 +89,7 @@ number_t ABCVm::convert_d(ASObject* o) { - LOG(LOG_CALLS, _("convert_d") ); + LOG_CALL( _("convert_d") ); number_t ret=o->toNumber(); o->decRef(); return ret; @@ -97,7 +97,7 @@ bool ABCVm::convert_b(ASObject* o) { - LOG(LOG_CALLS, _("convert_b") ); + LOG_CALL( _("convert_b") ); bool ret=Boolean_concrete(o); o->decRef(); return ret; @@ -105,7 +105,7 @@ uint32_t ABCVm::convert_u(ASObject* o) { - LOG(LOG_CALLS, _("convert_u") ); + LOG_CALL( _("convert_u") ); uint32_t ret=o->toUInt(); o->decRef(); return ret; @@ -113,7 +113,7 @@ int32_t ABCVm::convert_i(ASObject* o) { - LOG(LOG_CALLS, _("convert_i") ); + LOG_CALL( _("convert_i") ); int32_t ret=o->toInt(); o->decRef(); return ret; @@ -121,7 +121,7 @@ int64_t ABCVm::convert_di(ASObject* o) { - LOG(LOG_CALLS, _("convert_di") ); + LOG_CALL( _("convert_di") ); int64_t ret=o->toInt64(); o->decRef(); return ret; @@ -129,7 +129,7 @@ ASObject* ABCVm::convert_s(ASObject* o) { - LOG(LOG_CALLS, _("convert_s") ); + LOG_CALL( _("convert_s") ); ASObject* ret=o; if(o->getObjectType()!=T_STRING) { @@ -141,34 +141,34 @@ void ABCVm::label() { - LOG(LOG_CALLS, _("label") ); + LOG_CALL( _("label") ); } void ABCVm::lookupswitch() { - LOG(LOG_CALLS, _("lookupswitch") ); + LOG_CALL( _("lookupswitch") ); } ASObject* ABCVm::pushUndefined() { - LOG(LOG_CALLS, _("pushUndefined") ); + LOG_CALL( _("pushUndefined") ); return getSys()->getUndefinedRef(); } ASObject* ABCVm::pushNull() { - LOG(LOG_CALLS, _("pushNull") ); + LOG_CALL( _("pushNull") ); return getSys()->getNullRef(); } void ABCVm::coerce_a() { - LOG(LOG_CALLS, _("coerce_a") ); + LOG_CALL( _("coerce_a") ); } ASObject* ABCVm::checkfilter(ASObject* o) { - LOG(LOG_CALLS, _("checkfilter") ); + LOG_CALL( _("checkfilter") ); if (!o->is<XML>() && !o->is<XMLList>()) throwError<TypeError>(kFilterError, o->getClassName()); return o; @@ -182,7 +182,7 @@ void ABCVm::coerce(call_context* th, int n) { multiname* mn = th->context->getMultiname(n,NULL); - LOG(LOG_CALLS,"coerce " << *mn); + LOG_CALL("coerce " << *mn); const Type* type = Type::getTypeFromMultiname(mn, th->context); @@ -193,48 +193,48 @@ void ABCVm::pop() { - LOG(LOG_CALLS, _("pop: DONE") ); + LOG_CALL( _("pop: DONE") ); } void ABCVm::getLocal_int(int n, int v) { - LOG(LOG_CALLS,_("getLocal[") << n << _("] (int)= ") << dec << v); + LOG_CALL(_("getLocal[") << n << _("] (int)= ") << dec << v); } void ABCVm::getLocal(ASObject* o, int n) { - LOG(LOG_CALLS,_("getLocal[") << n << _("] (") << o << _(") ") << o->toDebugString()); + LOG_CALL(_("getLocal[") << n << _("] (") << o << _(") ") << o->toDebugString()); } void ABCVm::getLocal_short(int n) { - LOG(LOG_CALLS,_("getLocal[") << n << _("]")); + LOG_CALL(_("getLocal[") << n << _("]")); } void ABCVm::setLocal(int n) { - LOG(LOG_CALLS,_("setLocal[") << n << _("]")); + LOG_CALL(_("setLocal[") << n << _("]")); } void ABCVm::setLocal_int(int n, int v) { - LOG(LOG_CALLS,_("setLocal[") << n << _("] (int)= ") << dec << v); + LOG_CALL(_("setLocal[") << n << _("] (int)= ") << dec << v); } void ABCVm::setLocal_obj(int n, ASObject* v) { - LOG(LOG_CALLS,_("setLocal[") << n << _("] = ") << v->toDebugString()); + LOG_CALL(_("setLocal[") << n << _("] = ") << v->toDebugString()); } int32_t ABCVm::pushShort(intptr_t n) { - LOG(LOG_CALLS, _("pushShort ") << n ); + LOG_CALL( _("pushShort ") << n ); return n; } void ABCVm::setSlot(ASObject* value, ASObject* obj, int n) { - LOG(LOG_CALLS,"setSlot " << n << " "<< obj<<" " <<obj->toDebugString() << " "<< value->toDebugString()<<" "<<value); + LOG_CALL("setSlot " << n << " "<< obj<<" " <<obj->toDebugString() << " "<< value->toDebugString()<<" "<<value); obj->setSlot(n,value); obj->decRef(); } @@ -242,7 +242,7 @@ ASObject* ABCVm::getSlot(ASObject* obj, int n) { ASObject* ret=obj->getSlot(n);
View file
lightspark.tar.xz/src/scripting/class.h
Changed
@@ -233,15 +233,32 @@ template<> inline ASObject* Class<Number>::coerce(ASObject* o) const { - number_t n = o->toNumber(); - ASObject* res = abstract_d(o->getSystemState(),n); - o->decRef(); - return res; + switch (o->getObjectType()) + { + case T_NUMBER: + return o; + case T_INTEGER: + case T_UINTEGER: + { + ASObject* res = abstract_di(o->getSystemState(),o->toInt64()); + o->decRef(); + return res; + } + default: + { + number_t n = o->toNumber(); + ASObject* res = abstract_d(o->getSystemState(),n); + o->decRef(); + return res; + } + } } template<> inline ASObject* Class<UInteger>::coerce(ASObject* o) const { + if (o->is<UInteger>()) + return o; uint32_t n = o->toUInt(); ASObject* res = abstract_ui(o->getSystemState(),n); o->decRef(); @@ -251,6 +268,8 @@ template<> inline ASObject* Class<Integer>::coerce(ASObject* o) const { + if (o->is<Integer>()) + return o; int32_t n = o->toInt(); ASObject* res = abstract_i(o->getSystemState(),n); o->decRef(); @@ -260,6 +279,8 @@ template<> inline ASObject* Class<Boolean>::coerce(ASObject* o) const { + if (o->is<Boolean>()) + return o; bool n = Boolean_concrete(o); ASObject* res = abstract_b(o->getSystemState(),n); o->decRef();
View file
lightspark.tar.xz/src/scripting/flash/utils/Proxy.cpp
Changed
@@ -87,7 +87,7 @@ args[1]=o; //We now suppress special handling implEnable=false; - LOG(LOG_CALLS,_("Proxy::setProperty")); + LOG_CALL(_("Proxy::setProperty")); incRef(); _R<ASObject> ret=_MR( f->call(this,args,2) ); assert_and_throw(ret->is<Undefined>()); @@ -99,7 +99,7 @@ //It seems that various kind of implementation works only with the empty namespace assert_and_throw(name.ns.size()>0); _NR<ASObject> o; - LOG(LOG_CALLS,"Proxy::getVar "<< name << " " << this->toDebugString()<<" "<<ASObject::hasPropertyByMultiname(name, true, true)); + LOG_CALL("Proxy::getVar "<< name << " " << this->toDebugString()<<" "<<ASObject::hasPropertyByMultiname(name, true, true)); if(ASObject::hasPropertyByMultiname(name, true, true) || !implEnable || (opt & ASObject::SKIP_IMPL)!=0) o = ASObject::getVariableByMultiname(name,opt); if (!o.isNull() || !implEnable || (opt & ASObject::SKIP_IMPL)!=0) @@ -124,7 +124,7 @@ ASObject* arg = namearg; //We now suppress special handling implEnable=false; - LOG(LOG_CALLS,"Proxy::getProperty "<< name.normalizedNameUnresolved(getSystemState()) << " " << this->toDebugString()); + LOG_CALL("Proxy::getProperty "<< name.normalizedNameUnresolved(getSystemState()) << " " << this->toDebugString()); incRef(); _NR<ASObject> ret=_MNR(f->call(this,&arg,1)); implEnable=true; @@ -162,7 +162,7 @@ ASObject* arg = namearg; //We now suppress special handling implEnable=false; - LOG(LOG_CALLS,_("Proxy::hasProperty")); + LOG_CALL(_("Proxy::hasProperty")); incRef(); _NR<ASObject> ret=_MNR(f->call(this,&arg,1)); implEnable=true; @@ -198,7 +198,7 @@ ASObject* arg = namearg; //We now suppress special handling implEnable=false; - LOG(LOG_CALLS,_("Proxy::deleteProperty")); + LOG_CALL(_("Proxy::deleteProperty")); incRef(); _NR<ASObject> ret=_MNR(f->call(this,&arg,1)); implEnable=true; @@ -209,7 +209,7 @@ uint32_t Proxy::nextNameIndex(uint32_t cur_index) { assert_and_throw(implEnable); - LOG(LOG_CALLS,"Proxy::nextNameIndex"); + LOG_CALL("Proxy::nextNameIndex"); //Check if there is a custom enumerator, skipping implementation to avoid recursive calls multiname nextNameIndexName(NULL); nextNameIndexName.name_type=multiname::NAME_STRING; @@ -229,7 +229,7 @@ _R<ASObject> Proxy::nextName(uint32_t index) { assert_and_throw(implEnable); - LOG(LOG_CALLS, _("Proxy::nextName")); + LOG_CALL( _("Proxy::nextName")); //Check if there is a custom enumerator, skipping implementation to avoid recursive calls multiname nextNameName(NULL); nextNameName.name_type=multiname::NAME_STRING; @@ -246,7 +246,7 @@ _R<ASObject> Proxy::nextValue(uint32_t index) { assert_and_throw(implEnable); - LOG(LOG_CALLS, _("Proxy::nextValue")); + LOG_CALL( _("Proxy::nextValue")); //Check if there is a custom enumerator, skipping implementation to avoid recursive calls multiname nextValueName(NULL); nextValueName.name_type=multiname::NAME_STRING;
View file
lightspark.tar.xz/src/scripting/toplevel/ASString.cpp
Changed
@@ -29,38 +29,32 @@ using namespace std; using namespace lightspark; -ASString::ASString(Class_base* c):ASObject(c),hasId(true),datafilled(true),stringId(BUILTIN_STRINGS::EMPTY) +ASString::ASString(Class_base* c):ASObject(c,T_STRING),hasId(true),datafilled(true),stringId(BUILTIN_STRINGS::EMPTY) { - type=T_STRING; } -ASString::ASString(Class_base* c,const string& s) : ASObject(c),data(s),hasId(false),datafilled(true),stringId(BUILTIN_STRINGS::EMPTY) +ASString::ASString(Class_base* c,const string& s) : ASObject(c,T_STRING),data(s),hasId(false),datafilled(true),stringId(BUILTIN_STRINGS::EMPTY) { - type=T_STRING; } -ASString::ASString(Class_base* c,const tiny_string& s) : ASObject(c),data(s),hasId(false),datafilled(true),stringId(BUILTIN_STRINGS::EMPTY) +ASString::ASString(Class_base* c,const tiny_string& s) : ASObject(c,T_STRING),data(s),hasId(false),datafilled(true),stringId(BUILTIN_STRINGS::EMPTY) { - type=T_STRING; } -ASString::ASString(Class_base* c,const Glib::ustring& s) : ASObject(c),data(s),hasId(false),datafilled(true),stringId(BUILTIN_STRINGS::EMPTY) +ASString::ASString(Class_base* c,const Glib::ustring& s) : ASObject(c,T_STRING),data(s),hasId(false),datafilled(true),stringId(BUILTIN_STRINGS::EMPTY) { - type=T_STRING; } -ASString::ASString(Class_base* c,const char* s) : ASObject(c),data(s, /*copy:*/true),hasId(false),datafilled(true),stringId(BUILTIN_STRINGS::EMPTY) +ASString::ASString(Class_base* c,const char* s) : ASObject(c,T_STRING),data(s, /*copy:*/true),hasId(false),datafilled(true),stringId(BUILTIN_STRINGS::EMPTY) { - type=T_STRING; } -ASString::ASString(Class_base* c,const char* s, uint32_t len) : ASObject(c) +ASString::ASString(Class_base* c,const char* s, uint32_t len) : ASObject(c,T_STRING) { data = std::string(s,len); hasId = false; stringId = BUILTIN_STRINGS::EMPTY; datafilled=true; - type=T_STRING; } ASFUNCTIONBODY(ASString,_constructor) @@ -80,7 +74,14 @@ { // fast path if obj is ASString if (obj->is<ASString>()) - return abstract_i(obj->getSystemState(),obj->as<ASString>()->getData().numChars()); + { + ASString* th = obj->as<ASString>(); + if (th->strlength.isNull()) + th->strlength = _MNR(abstract_i(obj->getSystemState(),th->getData().numChars())); + th->strlength->incRef(); + return th->strlength.getPtr(); +// return abstract_i(obj->getSystemState(),th->getData().numChars()); + } return abstract_i(obj->getSystemState(),obj->toString().numChars()); }
View file
lightspark.tar.xz/src/scripting/toplevel/ASString.h
Changed
@@ -40,6 +40,7 @@ private: number_t parseStringInfinite(const char *s, char **end) const; tiny_string data; + _NR<ASObject> strlength; public: ASString(Class_base* c); ASString(Class_base* c, const std::string& s); @@ -47,8 +48,8 @@ ASString(Class_base* c, const Glib::ustring& s); ASString(Class_base* c, const char* s); ASString(Class_base* c, const char* s, uint32_t len); - bool hasId; - bool datafilled; + bool hasId:1; + bool datafilled:1; uint32_t stringId; inline tiny_string& getData() { @@ -106,6 +107,7 @@ inline bool destruct() { data.clear(); + strlength.reset(); hasId = true; datafilled=true; stringId = BUILTIN_STRINGS::EMPTY;
View file
lightspark.tar.xz/src/scripting/toplevel/Array.cpp
Changed
@@ -28,11 +28,9 @@ using namespace std; using namespace lightspark; -Array::Array(Class_base* c):ASObject(c), +Array::Array(Class_base* c):ASObject(c,T_ARRAY),currentsize(0), data(std::less<arrayType::key_type>(), reporter_allocator<arrayType::value_type>(c->memoryAccount)) { - currentsize=0; - type=T_ARRAY; } void Array::sinit(Class_base* c)
View file
lightspark.tar.xz/src/scripting/toplevel/Boolean.h
Changed
@@ -35,7 +35,7 @@ class Boolean: public ASObject { public: - Boolean(Class_base* c, bool v=false):ASObject(c),val(v) {type=T_BOOLEAN;} + Boolean(Class_base* c, bool v=false):ASObject(c,T_BOOLEAN),val(v) {} static void sinit(Class_base*); static void buildTraits(ASObject* o){}; bool val;
View file
lightspark.tar.xz/src/scripting/toplevel/Integer.h
Changed
@@ -33,7 +33,7 @@ friend class ABCContext; friend ASObject* abstract_i(int32_t i); public: - Integer(Class_base* c,int32_t v=0):ASObject(c),val(v){type=T_INTEGER;} + Integer(Class_base* c,int32_t v=0):ASObject(c,T_INTEGER),val(v){} int32_t val; static void buildTraits(ASObject* o){}; static void sinit(Class_base* c);
View file
lightspark.tar.xz/src/scripting/toplevel/Number.h
Changed
@@ -38,13 +38,13 @@ static tiny_string purgeExponentLeadingZeros(const tiny_string& exponentialForm); static int32_t countSignificantDigits(double v); public: - Number(Class_base* c, double v=Number::NaN):ASObject(c),dval(v),isfloat(true){type=T_NUMBER;} + Number(Class_base* c, double v=Number::NaN):ASObject(c,T_NUMBER),dval(v),isfloat(true){} static const number_t NaN; union { number_t dval; int64_t ival; }; - bool isfloat; + bool isfloat:1; inline number_t toNumber() { return isfloat ? dval : ival; } inline bool destruct() { dval=Number::NaN; isfloat = true; return ASObject::destruct(); } ASFUNCTION(_constructor);
View file
lightspark.tar.xz/src/scripting/toplevel/UInteger.h
Changed
@@ -30,7 +30,7 @@ friend ASObject* abstract_ui(uint32_t i); public: uint32_t val; - UInteger(Class_base* c,uint32_t v=0):ASObject(c),val(v){type=T_UINTEGER;} + UInteger(Class_base* c,uint32_t v=0):ASObject(c,T_UINTEGER),val(v){} static void sinit(Class_base* c); tiny_string toString();
View file
lightspark.tar.xz/src/scripting/toplevel/toplevel.cpp
Changed
@@ -52,25 +52,23 @@ Any* const Type::anyType = new Any(); Void* const Type::voidType = new Void(); -Null::Null():ASObject((Class_base*)(NULL)) +Null::Null():ASObject((Class_base*)(NULL),T_NULL) { traitsInitialized = true; constructIndicator = true; constructorCallComplete = true; - type=T_NULL; } -Undefined::Undefined():ASObject((Class_base*)(NULL)) +Undefined::Undefined():ASObject((Class_base*)(NULL),T_UNDEFINED) { traitsInitialized = true; constructIndicator = true; constructorCallComplete = true; - type=T_UNDEFINED; } ASFUNCTIONBODY(Undefined,call) { - LOG(LOG_CALLS,_("Undefined function")); + LOG_CALL(_("Undefined function")); return NULL; } @@ -133,9 +131,8 @@ throwError<TypeError>(kConvertUndefinedToObjectError); } -IFunction::IFunction(Class_base* c):ASObject(c),length(0),inClass(NULL),functionname(0) +IFunction::IFunction(Class_base* c):ASObject(c,T_FUNCTION),length(0),inClass(NULL),functionname(0) { - type=T_FUNCTION; } void IFunction::sinit(Class_base* c) @@ -403,7 +400,7 @@ if(isBound()) { /* closure_this can never been overriden */ - LOG(LOG_CALLS,_("Calling with closure ") << this); + LOG_CALL(_("Calling with closure ") << this); if(obj) obj->decRef(); obj=closure_this.getPtr(); @@ -558,7 +555,7 @@ ASObject* ret; if(isBound()) { /* closure_this can never been overriden */ - LOG(LOG_CALLS,_("Calling with closure ") << this); + LOG_CALL(_("Calling with closure ") << this); if(obj) obj->decRef(); obj=closure_this.getPtr(); @@ -776,12 +773,11 @@ return typeObject ? typeObject->as<Type>() : NULL; } -Class_base::Class_base(const QName& name, MemoryAccount* m):ASObject(Class_object::getClass(getSys())),protected_ns(getSys(),"",NAMESPACE),constructor(NULL), +Class_base::Class_base(const QName& name, MemoryAccount* m):ASObject(Class_object::getClass(getSys()),T_CLASS),protected_ns(getSys(),"",NAMESPACE),constructor(NULL), freelistsize(0),freelistsize2(0),borrowedVariables(m), context(NULL),class_name(name),memoryAccount(m),length(1),class_index(-1),isFinal(false),isSealed(false),isInterface(false),isReusable(false),isProxy(false),use_protected(false) { setConstant(); - type=T_CLASS; } Class_base::Class_base(const Class_object*):ASObject((MemoryAccount*)NULL),protected_ns(getSys(),BUILTIN_STRINGS::EMPTY,NAMESPACE),constructor(NULL), @@ -1153,7 +1149,7 @@ if(constructor) { - LOG(LOG_CALLS,_("Calling interface init for ") << class_name); + LOG_CALL(_("Calling interface init for ") << class_name); ASObject* ret=constructor->call(c,NULL,0); assert_and_throw(ret==NULL); } @@ -1490,9 +1486,8 @@ return NOT_BINDED; } -ASQName::ASQName(Class_base* c):ASObject(c) +ASQName::ASQName(Class_base* c):ASObject(c,T_QNAME),uri_is_null(false),uri(0),local_name(0) { - type=T_QNAME; uri_is_null=false; } void ASQName::setByXML(XML* node) { @@ -1754,17 +1749,13 @@ } } -Namespace::Namespace(Class_base* c):ASObject(c),nskind(NAMESPACE) +Namespace::Namespace(Class_base* c):ASObject(c,T_NAMESPACE),nskind(NAMESPACE),prefix_is_undefined(false) { - type=T_NAMESPACE; - prefix_is_undefined=false; } Namespace::Namespace(Class_base* c, const tiny_string& _uri, const tiny_string& _prefix) - : ASObject(c),nskind(NAMESPACE),uri(_uri),prefix(_prefix) + : ASObject(c,T_NAMESPACE),nskind(NAMESPACE),prefix_is_undefined(false),uri(_uri),prefix(_prefix) { - type=T_NAMESPACE; - prefix_is_undefined=false; } void Namespace::sinit(Class_base* c) @@ -2167,7 +2158,7 @@ */ if(ret.isNull() || !context || context->hasRunScriptInit[scriptId]) return ret; - LOG(LOG_CALLS,"Access to " << name << ", running script init"); + LOG_CALL("Access to " << name << ", running script init"); context->runScriptInit(scriptId, this); return ASObject::getVariableByMultiname(name, opt); }
View file
lightspark.tar.xz/src/swf.cpp
Changed
@@ -175,7 +175,7 @@ } //See BUILTIN_STRINGS enum -static const char* builtinStrings[] = {"", "any", "void", "prototype", "Function", "__AS3__.vec","Class","*" }; +static const char* builtinStrings[] = {"", "any", "void", "prototype", "Function", "__AS3__.vec","Class","*", "http://adobe.com/AS3/2006/builtin" }; extern uint32_t asClassCount; @@ -202,6 +202,10 @@ uint32_t baseId; getUniqueNamespaceId(emptyNs, 0, nsId, baseId); assert(nsId==0 && baseId==0); + //Forge the AS3 namespace and make sure it gets id 1 + nsNameAndKindImpl as3Ns(BUILTIN_STRINGS::STRING_AS3NS, NAMESPACE); + getUniqueNamespaceId(as3Ns, 1, nsId, baseId); + assert(nsId==1 && baseId==1); cookiesFileName = NULL; @@ -1861,8 +1865,7 @@ void SystemState::getUniqueNamespaceId(const nsNameAndKindImpl& s, uint32_t& nsId, uint32_t& baseId) { - int32_t hintedId=ATOMIC_DECREMENT(lastUsedNamespaceId); - getUniqueNamespaceId(s, hintedId, nsId, baseId); + getUniqueNamespaceId(s, 0xffffffff, nsId, baseId); } void SystemState::getUniqueNamespaceId(const nsNameAndKindImpl& s, uint32_t hintedId, uint32_t& nsId, uint32_t& baseId) @@ -1871,6 +1874,9 @@ auto it=uniqueNamespaceMap.left.find(s); if(it==uniqueNamespaceMap.left.end()) { + if (hintedId == 0xffffffff) + hintedId=ATOMIC_DECREMENT(lastUsedNamespaceId); + auto ret=uniqueNamespaceMap.left.insert(make_pair(s,hintedId)); assert(ret.second); it=ret.first;
View file
lightspark.tar.xz/src/swftypes.cpp
Changed
@@ -1510,21 +1510,18 @@ { nsNameAndKindImpl tmp(sys->getUniqueStringId(_name), _kind); sys->getUniqueNamespaceId(tmp, nsRealId, nsId); - nameIsEmpty=_name.empty(); } nsNameAndKind::nsNameAndKind(SystemState* sys,const char* _name, NS_KIND _kind) { nsNameAndKindImpl tmp(sys->getUniqueStringId(_name), _kind); sys->getUniqueNamespaceId(tmp, nsRealId, nsId); - nameIsEmpty=(_name[0]=='\0'); } nsNameAndKind::nsNameAndKind(SystemState* sys,uint32_t _nameId, NS_KIND _kind) { nsNameAndKindImpl tmp(_nameId, _kind); sys->getUniqueNamespaceId(tmp, nsRealId, nsId); - nameIsEmpty=_nameId == BUILTIN_STRINGS::EMPTY; } nsNameAndKind::nsNameAndKind(SystemState* sys, uint32_t _nameId, uint32_t _baseId, NS_KIND _kind) { @@ -1534,7 +1531,6 @@ uint32_t tmpId; sys->getUniqueNamespaceId(tmp, nsRealId, tmpId); assert(tmpId==_baseId); - nameIsEmpty=_nameId == BUILTIN_STRINGS::EMPTY; } nsNameAndKind::nsNameAndKind(ABCContext* c, uint32_t nsContextIndex) @@ -1547,7 +1543,6 @@ //Special handling for private namespaces, they are always compared by id if(ns.kind==PRIVATE_NAMESPACE) nsId=c->namespaceBaseId+nsContextIndex; - nameIsEmpty=nsNameId==BUILTIN_STRINGS::EMPTY; } const nsNameAndKindImpl& nsNameAndKind::getImpl(SystemState* sys) const
View file
lightspark.tar.xz/src/swftypes.h
Changed
@@ -40,7 +40,7 @@ namespace lightspark { -enum BUILTIN_STRINGS { EMPTY=0, ANY, VOID, PROTOTYPE, STRING_FUNCTION,STRING_AS3VECTOR,STRING_CLASS,STRING_WILDCARD,LAST_BUILTIN_STRING }; +enum BUILTIN_STRINGS { EMPTY=0, ANY, VOID, PROTOTYPE, STRING_FUNCTION,STRING_AS3VECTOR,STRING_CLASS,STRING_WILDCARD,STRING_AS3NS,LAST_BUILTIN_STRING }; enum BUILTIN_NAMESPACES { EMPTY_NS=0 }; @@ -316,8 +316,7 @@ { uint32_t nsId; uint32_t nsRealId; - bool nameIsEmpty; - nsNameAndKind():nsId(0),nsRealId(0),nameIsEmpty(true) {} + nsNameAndKind():nsId(0),nsRealId(0) {} nsNameAndKind(SystemState *sys, const tiny_string& _name, NS_KIND _kind); nsNameAndKind(SystemState* sys,const char* _name, NS_KIND _kind); nsNameAndKind(SystemState* sys,uint32_t _nameId, NS_KIND _kind); @@ -330,26 +329,26 @@ /* * Special version to create the empty bultin namespace */ - nsNameAndKind(uint32_t id):nsId(id),nsRealId(id),nameIsEmpty(true) + nsNameAndKind(uint32_t id):nsId(id),nsRealId(id) { assert(nsId==0); } - bool operator<(const nsNameAndKind& r) const + inline bool operator<(const nsNameAndKind& r) const { return nsId < r.nsId; } - bool operator>(const nsNameAndKind& r) const + inline bool operator>(const nsNameAndKind& r) const { return nsId > r.nsId; } - bool operator==(const nsNameAndKind& r) const + inline bool operator==(const nsNameAndKind& r) const { return nsId==r.nsId; } const nsNameAndKindImpl& getImpl(SystemState *sys) const; - bool hasEmptyName() const + inline bool hasEmptyName() const { - return nameIsEmpty; + return nsId==0; } };
View file
lightspark.tar.xz/src/tiny_string.cpp
Changed
@@ -17,7 +17,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. **************************************************************************/ -#include <glibmm/ustring.h> #include "tiny_string.h" #include "exceptions.h" #include "swf.h" @@ -335,14 +334,6 @@ (strncmp(buf+numBytes()-olen,o,olen) == 0); } -/* idx is an index of utf-8 characters */ -uint32_t tiny_string::charAt(uint32_t idx) const -{ - if (isASCII) - return buf[idx]; - return g_utf8_get_char(g_utf8_offset_to_pointer(buf,idx)); -} - /* start is an index of characters. * returns index of character */ uint32_t tiny_string::find(const tiny_string& needle, uint32_t start) const
View file
lightspark.tar.xz/src/tiny_string.h
Changed
@@ -26,6 +26,7 @@ #include <list> /* for utf8 handling */ #include <glib.h> +#include <glibmm/ustring.h> #include "compat.h" /* forward declare for tiny_string conversion */ @@ -190,7 +191,12 @@ bool startsWith(const char* o) const; bool endsWith(const char* o) const; /* idx is an index of utf-8 characters */ - uint32_t charAt(uint32_t idx) const; + uint32_t charAt(uint32_t idx) const + { + if (isASCII) + return buf[idx]; + return g_utf8_get_char(g_utf8_offset_to_pointer(buf,idx)); + } /* start is an index of characters. * returns index of character */ uint32_t find(const tiny_string& needle, uint32_t start = 0) const;
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.