Projects
Essentials
lightspark
Sign Up
Log In
Username
Password
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
Expand all
Collapse all
Changes of Revision 98
View file
lightspark.spec
Changed
@@ -20,7 +20,7 @@ %bcond_without librtmp Name: lightspark -Version: 0.7.2.99+git20160214.1643 +Version: 0.7.2.99+git20160228.0950 Release: 0 Summary: Modern, free, open-source flash player implementation License: LGPL-3.0+
View file
lightspark.tar.xz/src/parsing/streams.cpp
Changed
@@ -249,7 +249,20 @@ pos += nbytes; } } - +uint8_t memorystream::readbyte() +{ + if (pos < len) + { + pos++; + return code[pos-1]; + } + else + { + pos = len; + read_past_end = true; + return 0; + } +} bool memorystream::eof() const { return read_past_end; @@ -257,8 +270,7 @@ memorystream& lightspark::operator>>(memorystream& in, lightspark::u8& v) { - uint8_t t; - in.read((char*)&t,1); + uint8_t t = in.readbyte(); v.val= t; return in; } @@ -289,7 +301,7 @@ uint8_t t; do { - in.read((char*)&t,1); + t = in.readbyte(); //No more than 5 bytes should be read if(i==28) {
View file
lightspark.tar.xz/src/parsing/streams.h
Changed
@@ -112,6 +112,7 @@ unsigned int tellg() const; void seekg(unsigned int offset); void read(char *out, unsigned int nbytes); + uint8_t readbyte(); bool eof() const; };
View file
lightspark.tar.xz/src/scripting/abc.cpp
Changed
@@ -2117,6 +2117,7 @@ MemoryAccount* memoryAccount = getSys()->allocateMemoryAccount(className.name); Class_inherit* ci=new (getSys()->unaccountedMemory) Class_inherit(className, memoryAccount); + ci->isInterface = true; ci->setDeclaredMethodByQName("toString",AS3,Class<IFunction>::getFunction(Class_base::_toString),NORMAL_METHOD,false); LOG(LOG_CALLS,_("Building class traits")); for(unsigned int i=0;i<classes[t->classi].trait_count;i++)
View file
lightspark.tar.xz/src/scripting/abc_interpreter.cpp
Changed
@@ -514,8 +514,7 @@ case 0x24: { //pushbyte - int8_t t; - code.read((char*)&t,1); + int8_t t = code.readbyte(); context->runtime_stack_push(abstract_i(t)); pushByte(t); break; @@ -1622,13 +1621,11 @@ { //debug LOG(LOG_CALLS, _("debug") ); - uint8_t debug_type; u30 index; - uint8_t reg; u30 extra; - code.read((char*)&debug_type,1); + code.readbyte(); code >> index; - code.read((char*)®,1); + code.readbyte(); code >> extra; break; }
View file
lightspark.tar.xz/src/scripting/abc_opcodes.cpp
Changed
@@ -2211,6 +2211,7 @@ ret->isFinal = th->context->instances[n].isFinal(); ret->isSealed = th->context->instances[n].isSealed(); + ret->isInterface = th->context->instances[n].isInterface(); assert_and_throw(th->context); ret->context=th->context;
View file
lightspark.tar.xz/src/scripting/class.h
Changed
@@ -305,6 +305,7 @@ QName name(ClassName<T>::name,ClassName<T>::ns); MemoryAccount* memoryAccount = getSys()->allocateMemoryAccount(name.name); ret=new (getSys()->unaccountedMemory) InterfaceClass<T>(name, memoryAccount); + ret->isInterface = true; ret->incRef(); *retAddr=ret; }
View file
lightspark.tar.xz/src/scripting/toplevel/toplevel.cpp
Changed
@@ -767,14 +767,14 @@ Class_base::Class_base(const QName& name, MemoryAccount* m):ASObject(Class_object::getClass()),protected_ns("",NAMESPACE),constructor(NULL), borrowedVariables(m), - context(NULL),class_name(name),memoryAccount(m),length(1),class_index(-1),isFinal(false),isSealed(false),use_protected(false) + context(NULL),class_name(name),memoryAccount(m),length(1),class_index(-1),isFinal(false),isSealed(false),isInterface(false),use_protected(false) { type=T_CLASS; } Class_base::Class_base(const Class_object*):ASObject((MemoryAccount*)NULL),protected_ns("",NAMESPACE),constructor(NULL), borrowedVariables(NULL), - context(NULL),class_name("Class",""),memoryAccount(NULL),length(1),class_index(-1),isFinal(false),isSealed(false),use_protected(false) + context(NULL),class_name("Class",""),memoryAccount(NULL),length(1),class_index(-1),isFinal(false),isSealed(false),isInterface(false),use_protected(false) { type=T_CLASS; //We have tested that (Class is Class == true) so the classdef is 'this' @@ -1145,8 +1145,9 @@ { assert(class_index!=-1); //Recursively link interfaces implemented by this interface - for(unsigned int i=0;i<getInterfaces().size();i++) - getInterfaces()[i]->linkInterface(c); + const std::vector<Class_base*> interfaces = getInterfaces(); + for(unsigned int i=0;i<interfaces.size();i++) + interfaces[i]->linkInterface(c); assert_and_throw(context); @@ -1172,11 +1173,13 @@ return true; //Now check the interfaces - if (considerInterfaces) + //an interface can't be subclass of a normal class, we only check the interfaces if cls is an interface itself + if (considerInterfaces && cls->isInterface) { - for(unsigned int i=0;i<getInterfaces().size();i++) + const std::vector<Class_base*> interfaces = getInterfaces(); + for(unsigned int i=0;i<interfaces.size();i++) { - if(getInterfaces()[i]->isSubClass(cls, considerInterfaces)) + if(interfaces[i]->isSubClass(cls, considerInterfaces)) return true; } }
View file
lightspark.tar.xz/src/scripting/toplevel/toplevel.h
Changed
@@ -175,6 +175,7 @@ int32_t class_index; bool isFinal:1; bool isSealed:1; + bool isInterface:1; private: //TODO: move in Class_inherit bool use_protected:1;
View file
lightspark.tar.xz/src/tiny_string.cpp
Changed
@@ -65,6 +65,7 @@ buf=r.buf; this->isASCII = r.isASCII; this->hasNull = r.hasNull; + this->numchars = r.numchars; return; } if(stringSize > STATIC_SIZE) @@ -72,6 +73,7 @@ memcpy(buf,r.buf,stringSize); this->isASCII = r.isASCII; this->hasNull = r.hasNull; + this->numchars = r.numchars; } tiny_string::tiny_string(const std::string& r):_buf_static(),buf(_buf_static),stringSize(r.size()+1),type(STATIC) @@ -105,6 +107,7 @@ } this->isASCII = s.isASCII; this->hasNull = s.hasNull; + this->numchars = s.numchars; return *this; } @@ -210,6 +213,7 @@ this->isASCII = r.isASCII; if (!this->hasNull) this->hasNull = r.hasNull; + this->numchars += r.numchars; return *this; } @@ -321,6 +325,8 @@ /* returns the length in utf-8 characters, not counting the trailing \0 */ uint32_t tiny_string::numChars() const { + return numchars; + /* if (isASCII) return stringSize-1; if (!hasNull) @@ -335,6 +341,7 @@ ++len; } return len; + */ } char* tiny_string::strchr(char c) const @@ -440,17 +447,32 @@ _buf_static[0] = '\0'; buf=_buf_static; type=STATIC; - init(); } void tiny_string::init() { + numchars = 0; isASCII = true; hasNull = false; + unsigned char utfpos=0; for (uint i = 0; i < stringSize-1; i++) { if (buf[i] & 0x80) + { + if (utfpos == 0) + { + utfpos = buf[i]; + } + utfpos = utfpos << 1; + if (!(utfpos & 0x80)) + { + numchars++; + utfpos = 0; + } isASCII = false; + } + else + numchars++; if (buf[i] == 0) hasNull = true; } @@ -461,10 +483,11 @@ tiny_string ret; ret.buf = ret._buf_static; ret.type = STATIC; - ret.stringSize = g_unichar_to_utf8(c,ret.buf) + 1; + ret.stringSize = c&0x80 ? 2 : g_unichar_to_utf8(c,ret.buf) + 1; ret.buf[ret.stringSize-1] = '\0'; ret.isASCII = c<0x80; ret.hasNull = c == 0; + ret.numchars = 1; return ret; } @@ -497,7 +520,9 @@ memcpy(ret.buf,buf+start,len); ret.buf[len]=0; ret.stringSize = len+1; - if (!this->isASCII || this->hasNull) + if (this->isASCII && !this->hasNull) + ret.numchars = len; + else ret.init(); return ret; }
View file
lightspark.tar.xz/src/tiny_string.h
Changed
@@ -96,6 +96,7 @@ stringSize includes the trailing \0 */ uint32_t stringSize; + uint32_t numchars; TYPE type; #ifdef MEMORY_USAGE_PROFILING //Implemented in memory_support.cpp @@ -115,7 +116,7 @@ public: static const uint32_t npos = (uint32_t)(-1); - tiny_string():_buf_static(),buf(_buf_static),stringSize(1),type(STATIC),isASCII(true),hasNull(false){buf[0]=0;} + tiny_string():_buf_static(),buf(_buf_static),stringSize(1),numchars(0),type(STATIC),isASCII(true),hasNull(false){buf[0]=0;} /* construct from utf character */ static tiny_string fromChar(uint32_t c); tiny_string(const char* s,bool copy=false);
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
.