Changes of Revision 83

lightspark.spec Changed
x
 
1
@@ -24,7 +24,7 @@
2
 %endif
3
 
4
 Name:           lightspark
5
-Version:        0.7.2.99+git20150906.1640
6
+Version:        0.7.2.99+git20150927.1629
7
 Release:        0
8
 Summary:        Modern, free, open-source flash player implementation
9
 License:        LGPL-3.0+
10
build.patch Changed
144
 
1
@@ -1,17 +1,39 @@
2
 diff --git a/CMakeLists.txt b/CMakeLists.txt
3
-index 81b6d9d..b31eacd 100644
4
+index 81b6d9d..0b9790d 100644
5
 --- a/CMakeLists.txt
6
 +++ b/CMakeLists.txt
7
 @@ -247,6 +247,9 @@ ENDIF(${LLVM_STRING_VERSION} VERSION_GREATER 3.4)
8
  IF(NOT (${LLVM_STRING_VERSION} VERSION_LESS 3.6))
9
    ADD_DEFINITIONS(-DLLVM_36)
10
  ENDIF(NOT (${LLVM_STRING_VERSION} VERSION_LESS 3.6))
11
-+IF(${LLVM_STRING_VERSION} VERSION_GREATER 3.6)
12
++IF(NOT ${LLVM_STRING_VERSION} VERSION_LESS 3.7)
13
 +  ADD_DEFINITIONS(-DLLVM_37)
14
-+ENDIF(${LLVM_STRING_VERSION} VERSION_GREATER 3.6)
15
++ENDIF(NOT ${LLVM_STRING_VERSION} VERSION_LESS 3.7)
16
  INCLUDE(FindZLIB REQUIRED)
17
  INCLUDE(FindFreetype REQUIRED)
18
  IF(NOT(ENABLE_GLES2))
19
+@@ -312,6 +315,8 @@ IF(ENABLE_LIBAVCODEC)
20
+   CHECK_FUNCTION_EXISTS(avcodec_open2 HAVE_AVCODEC_OPEN2)
21
+   CHECK_FUNCTION_EXISTS(avformat_close_input HAVE_AVFORMAT_CLOSE_INPUT)
22
+   CHECK_FUNCTION_EXISTS(avformat_find_stream_info HAVE_AVFORMAT_FIND_STREAM_INFO)
23
++  CHECK_FUNCTION_EXISTS(av_frame_alloc HAVE_AV_FRAME_ALLOC)
24
++  CHECK_FUNCTION_EXISTS(av_frame_unref HAVE_AV_FRAME_UNREF)
25
+   CHECK_C_SOURCE_COMPILES("#include <libavcodec/avcodec.h>\nint main() { enum AVCodecID c; return 0; }" HAVE_AVCODECID)
26
+ 
27
+   SET(CMAKE_REQUIRED_FLAGS)
28
+@@ -347,6 +352,12 @@ IF(ENABLE_LIBAVCODEC)
29
+   IF(LIBAVRESAMPLE_FOUND)
30
+     ADD_DEFINITIONS(-DHAVE_LIBAVRESAMPLE)
31
+   ENDIF(LIBAVRESAMPLE_FOUND)
32
++  IF(HAVE_AV_FRAME_ALLOC)
33
++    ADD_DEFINITIONS(-DHAVE_AV_FRAME_ALLOC)
34
++  ENDIF(HAVE_AV_FRAME_ALLOC)
35
++  IF(HAVE_AV_FRAME_UNREF)
36
++    ADD_DEFINITIONS(-DHAVE_AV_FRAME_UNREF)
37
++  ENDIF(HAVE_AV_FRAME_UNREF)
38
+   ADD_DEFINITIONS(-DENABLE_LIBAVCODEC)
39
+ ENDIF(ENABLE_LIBAVCODEC)
40
+ 
41
 diff --git a/conf/FindLLVM.cmake b/conf/FindLLVM.cmake
42
 index e60dd4a..0f4f950 100644
43
 --- a/conf/FindLLVM.cmake
44
@@ -48,10 +70,25 @@
45
    exec_program(${LLVM_CONFIG_EXECUTABLE} ARGS --cxxflags  OUTPUT_VARIABLE LLVM_COMPILE_FLAGS )
46
    MESSAGE(STATUS "LLVM CXX flags: " ${LLVM_COMPILE_FLAGS})
47
 diff --git a/src/backends/decoder.cpp b/src/backends/decoder.cpp
48
-index fbdfcdb..e1d6e95 100755
49
+index fbdfcdb..98151c4 100755
50
 --- a/src/backends/decoder.cpp
51
 +++ b/src/backends/decoder.cpp
52
-@@ -166,7 +166,7 @@ FFMpegVideoDecoder::FFMpegVideoDecoder(LS_VIDEO_CODEC codecId, uint8_t* initdata
53
+@@ -30,6 +30,14 @@
54
+ #define AVMEDIA_TYPE_AUDIO CODEC_TYPE_AUDIO
55
+ #endif
56
+ 
57
++#ifndef HAVE_AV_FRAME_ALLOC
58
++#define av_frame_alloc avcodec_alloc_frame
59
++#endif
60
++
61
++#ifndef HAVE_AV_FRAME_UNREF
62
++#define av_frame_unref avcodec_get_frame_defaults
63
++#endif
64
++
65
+ using namespace lightspark;
66
+ using namespace std;
67
+ 
68
+@@ -166,7 +174,7 @@ FFMpegVideoDecoder::FFMpegVideoDecoder(LS_VIDEO_CODEC codecId, uint8_t* initdata
69
    else
70
        status=INIT;
71
  
72
@@ -60,7 +97,7 @@
73
  }
74
  
75
  FFMpegVideoDecoder::FFMpegVideoDecoder(AVCodecContext* _c, double frameRateHint):
76
-@@ -201,7 +201,7 @@ FFMpegVideoDecoder::FFMpegVideoDecoder(AVCodecContext* _c, double frameRateHint)
77
+@@ -201,7 +209,7 @@ FFMpegVideoDecoder::FFMpegVideoDecoder(AVCodecContext* _c, double frameRateHint)
78
    if(fillDataAndCheckValidity())
79
        status=VALID;
80
  
81
@@ -69,7 +106,7 @@
82
  }
83
  
84
  FFMpegVideoDecoder::~FFMpegVideoDecoder()
85
-@@ -476,7 +476,7 @@ FFMpegAudioDecoder::FFMpegAudioDecoder(LS_AUDIO_CODEC audioCodec, uint8_t* initd
86
+@@ -476,7 +484,7 @@ FFMpegAudioDecoder::FFMpegAudioDecoder(LS_AUDIO_CODEC audioCodec, uint8_t* initd
87
    else
88
        status=INIT;
89
  #if HAVE_AVCODEC_DECODE_AUDIO4
90
@@ -78,7 +115,7 @@
91
  #endif
92
  }
93
  
94
-@@ -502,7 +502,7 @@ FFMpegAudioDecoder::FFMpegAudioDecoder(LS_AUDIO_CODEC lscodec, int sampleRate, i
95
+@@ -502,7 +510,7 @@ FFMpegAudioDecoder::FFMpegAudioDecoder(LS_AUDIO_CODEC lscodec, int sampleRate, i
96
    if(fillDataAndCheckValidity())
97
        status=VALID;
98
  #if HAVE_AVCODEC_DECODE_AUDIO4
99
@@ -87,7 +124,7 @@
100
  #endif
101
  }
102
  
103
-@@ -522,7 +522,7 @@ FFMpegAudioDecoder::FFMpegAudioDecoder(AVCodecContext* _c):ownedContext(false),c
104
+@@ -522,7 +530,7 @@ FFMpegAudioDecoder::FFMpegAudioDecoder(AVCodecContext* _c):ownedContext(false),c
105
    if(fillDataAndCheckValidity())
106
        status=VALID;
107
  #if HAVE_AVCODEC_DECODE_AUDIO4
108
@@ -96,7 +133,7 @@
109
  #endif
110
  }
111
  
112
-@@ -607,7 +607,7 @@ uint32_t FFMpegAudioDecoder::decodeData(uint8_t* data, int32_t datalen, uint32_t
113
+@@ -607,7 +615,7 @@ uint32_t FFMpegAudioDecoder::decodeData(uint8_t* data, int32_t datalen, uint32_t
114
    }
115
  
116
  #if HAVE_AVCODEC_DECODE_AUDIO4
117
@@ -105,7 +142,7 @@
118
    int frameOk=0;
119
    int32_t ret=avcodec_decode_audio4(codecContext, frameIn, &frameOk, &pkt);
120
    if(frameOk==0)
121
-@@ -664,7 +664,7 @@ uint32_t FFMpegAudioDecoder::decodePacket(AVPacket* pkt, uint32_t time)
122
+@@ -664,7 +672,7 @@ uint32_t FFMpegAudioDecoder::decodePacket(AVPacket* pkt, uint32_t time)
123
    int maxLen=AVCODEC_MAX_AUDIO_FRAME_SIZE;
124
  
125
  #if HAVE_AVCODEC_DECODE_AUDIO4
126
@@ -1424,7 +1461,7 @@
127
    uint low;
128
    uint high;
129
 diff --git a/src/scripting/flash/events/flashevents.cpp b/src/scripting/flash/events/flashevents.cpp
130
-index 20623c6..e6864b1 100644
131
+index 3e514f0..164810d 100644
132
 --- a/src/scripting/flash/events/flashevents.cpp
133
 +++ b/src/scripting/flash/events/flashevents.cpp
134
 @@ -189,13 +189,13 @@ ASFUNCTIONBODY(Event,clone)
135
@@ -1443,7 +1480,7 @@
136
    LOG(LOG_NOT_IMPLEMENTED,"Event.stopImmediatePropagation not implemented");
137
    return NULL;
138
  }
139
-@@ -1417,8 +1417,8 @@ void UncaughtErrorEvents::sinit(Class_base* c)
140
+@@ -1420,8 +1420,8 @@ void UncaughtErrorEvents::sinit(Class_base* c)
141
  
142
  ASFUNCTIONBODY(UncaughtErrorEvents, _constructor)
143
  {
144
lightspark.tar.xz/src/asobject.cpp Changed
17
 
1
@@ -201,6 +201,7 @@
2
    c->prototype->setVariableByQName("hasOwnProperty","",Class<IFunction>::getFunction(hasOwnProperty),DYNAMIC_TRAIT);
3
    c->prototype->setVariableByQName("isPrototypeOf","",Class<IFunction>::getFunction(isPrototypeOf),DYNAMIC_TRAIT);
4
    c->prototype->setVariableByQName("propertyIsEnumerable","",Class<IFunction>::getFunction(propertyIsEnumerable),DYNAMIC_TRAIT);
5
+   c->prototype->setVariableByQName("setPropertyIsEnumerable","",Class<IFunction>::getFunction(setPropertyIsEnumerable),DYNAMIC_TRAIT);
6
 
7
 }
8
 
9
@@ -1814,7 +1815,6 @@
10
                params[1] = varIt->second.var;
11
                params[1]->incRef();
12
                ASObject *funcret=replacer->call(getSys()->getNullRef(), params, 2);
13
-               LOG(LOG_ERROR,"funcall:"<<res<<"|"<<funcret);
14
                if (funcret)
15
                    res += funcret->toString();
16
                else
17
lightspark.tar.xz/src/backends/extscriptobject.cpp Changed
17
 
1
@@ -266,13 +266,14 @@
2
    case EV_OBJECT:
3
        {
4
            ExtObject* objValue = getObject();
5
+           /*
6
            auto it=objectsMap.find(objValue);
7
            if(it!=objectsMap.end())
8
            {
9
                it->second->incRef();
10
                return it->second;
11
            }
12
-
13
+           */
14
            uint32_t count;
15
 
16
            // We are converting an array, so lets set indexes
17
lightspark.tar.xz/src/backends/netutils.cpp Changed
23
 
1
@@ -287,9 +287,7 @@
2
  */
3
 void Downloader::setFailed()
4
 {
5
-   cache->markFinished(true);
6
-   //Set the final length
7
-   length = cache->getReceivedLength();
8
+   length = cache->markFinished(true);
9
 }
10
 
11
 /**
12
@@ -303,9 +301,7 @@
13
  */
14
 void Downloader::setFinished()
15
 {
16
-   cache->markFinished();
17
-   //Set the final length
18
-   length = cache->getReceivedLength();
19
+   length = cache->markFinished();
20
 }
21
 
22
 /**
23
lightspark.tar.xz/src/backends/streamcache.cpp Changed
20
 
1
@@ -33,15 +33,16 @@
2
 {
3
 }
4
 
5
-void StreamCache::markFinished(bool _failed)
6
+size_t StreamCache::markFinished(bool _failed)
7
 {
8
    Locker locker(stateMutex);
9
    if (terminated)
10
-       return;
11
+       return receivedLength;
12
 
13
    failed = _failed;
14
    terminated = true;
15
    stateCond.broadcast();
16
+   return receivedLength;
17
 }
18
 
19
 void StreamCache::waitForData(size_t currentOffset)
20
lightspark.tar.xz/src/backends/streamcache.h Changed
11
 
1
@@ -86,7 +86,8 @@
2
 
3
    // Writer should call this when all of the stream has been
4
    // append()'ed
5
-   void markFinished(bool failed=false);
6
+   // returns the received length
7
+   size_t markFinished(bool failed=false);
8
 
9
    // Create a streambuf for reading from this buffer (reader
10
    // thread). Every call returns a new, independent streambuf.
11
lightspark.tar.xz/src/parsing/crossdomainpolicy.cpp Changed
31
 
1
@@ -26,7 +26,6 @@
2
    type(_type),subtype(_subtype),master(_master),first(true),siteControlFound(false)
3
 {
4
    xml.load_buffer(buffer, length);
5
-   
6
 }
7
 
8
 CrossDomainPolicy::ELEMENT CrossDomainPolicy::getNextElement()
9
@@ -35,9 +34,10 @@
10
    {
11
        if (first)
12
        {
13
-           if (strcmp(xml.root().name(), "cross-domain-policy"))
14
-               return INVALID;
15
            currentnode = xml.root().first_child();
16
+           if (strcmp(currentnode.name(), "cross-domain-policy"))
17
+               return INVALID;
18
+           currentnode = currentnode.first_child();
19
        }
20
        else
21
            currentnode = currentnode.next_sibling();
22
@@ -48,8 +48,6 @@
23
        //We only handle elements
24
        if (currentnode.type() != pugi::node_element)
25
            continue;
26
-       if(!currentnode.empty())
27
-           return INVALID;
28
 
29
        tagName = currentnode.name();
30
        attrCount = 0;
31
lightspark.tar.xz/src/plugin/npscriptobject.cpp Changed
23
 
1
@@ -370,10 +370,12 @@
2
        {
3
            type = EV_OBJECT;
4
            NPObject* const npObj = NPVARIANT_TO_OBJECT(other);
5
+           /*
6
            auto it=objectsMap.find(npObj);
7
            if(it!=objectsMap.end())
8
                objectValue = it->second.get();
9
            else
10
+           */
11
                objectValue = new NPObjectObject(objectsMap, _instance, npObj);
12
            break;
13
        }
14
@@ -1028,7 +1030,7 @@
15
 {
16
    // The NPScriptObject should already be deleted _before_ we get to this point.
17
    // This is the only way we can guarantee that it is deleted _before_ SystemState is deleted.
18
-};
19
+}
20
 
21
 // Properties
22
 bool NPScriptObjectGW::getProperty(NPObject* obj, NPIdentifier id, NPVariant* result)
23
lightspark.tar.xz/src/scripting/abc.h Changed
19
 
1
@@ -248,7 +248,7 @@
2
        arg1->decRef();
3
        _R<ApplicationDomain> appDomain = getCurrentApplicationDomain(th);
4
        T ret=appDomain->readFromDomainMemory<T>(addr);
5
-       th->runtime_stack_push(abstract_ui(ret));
6
+       th->runtime_stack_push(abstract_i(ret));
7
    }
8
    template<class T>
9
    static void storeIntN(call_context* th)
10
@@ -257,7 +257,7 @@
11
        ASObject* arg2=th->runtime_stack_pop();
12
        uint32_t addr=arg1->toUInt();
13
        arg1->decRef();
14
-       uint32_t val=arg2->toUInt();
15
+       int32_t val=arg2->toInt();
16
        arg2->decRef();
17
        _R<ApplicationDomain> appDomain = getCurrentApplicationDomain(th);
18
        appDomain->writeToDomainMemory<T>(addr, val);
19
lightspark.tar.xz/src/scripting/flash/events/flashevents.cpp Changed
11
 
1
@@ -607,6 +607,9 @@
2
 ASFUNCTIONBODY(EventDispatcher,removeEventListener)
3
 {
4
    EventDispatcher* th=static_cast<EventDispatcher*>(obj);
5
+   
6
+   if (args[1]->getObjectType() == T_NULL) // it seems that null is allowed as function
7
+       return NULL;
8
    if(args[0]->getObjectType()!=T_STRING || args[1]->getObjectType()!=T_FUNCTION)
9
        throw RunTimeException("Type mismatch in EventDispatcher::removeEventListener");
10
 
11
lightspark.tar.xz/src/scripting/flash/media/flashmedia.cpp Changed
17
 
1
@@ -539,6 +539,7 @@
2
 void SoundChannel::playRaw()
3
 {
4
    assert(!stream.isNull());
5
+#ifdef ENABLE_LIBAVCODEC
6
    FFMpegAudioDecoder *decoder = new FFMpegAudioDecoder(format.codec,
7
                                 format.sampleRate,
8
                                 format.channels,
9
@@ -572,6 +573,7 @@
10
        incRef();
11
        getVm()->addEvent(_MR(this),_MR(Class<Event>::getInstanceS("soundComplete")));
12
    }
13
+#endif //ENABLE_LIBAVCODEC
14
 }
15
 
16
 void SoundChannel::jobFence()
17
lightspark.tar.xz/src/scripting/flash/xml/flashxml.cpp Changed
63
 
1
@@ -51,6 +51,8 @@
2
    c->setDeclaredMethodByQName("nodeValue","",Class<IFunction>::getFunction(_getNodeValue),GETTER_METHOD,true);
3
    c->setDeclaredMethodByQName("parentNode","",Class<IFunction>::getFunction(parentNode),GETTER_METHOD,true);
4
    c->setDeclaredMethodByQName("previousSibling","",Class<IFunction>::getFunction(previousSibling),GETTER_METHOD,true);
5
+   c->setDeclaredMethodByQName("localName","",Class<IFunction>::getFunction(_getLocalName),GETTER_METHOD,true);
6
+   c->setDeclaredMethodByQName("appendChild","",Class<IFunction>::getFunction(appendChild),NORMAL_METHOD,true);
7
 }
8
 
9
 void XMLNode::buildTraits(ASObject* o)
10
@@ -227,6 +229,29 @@
11
    return Class<ASString>::getInstanceS(th->toString_priv(th->node));
12
 }
13
 
14
+ASFUNCTIONBODY(XMLNode,_getLocalName)
15
+{
16
+   XMLNode* th=Class<XMLNode>::cast(obj);
17
+   tiny_string localname =th->node.name();
18
+   uint32_t pos = localname.find(".");
19
+   if (pos != tiny_string::npos)
20
+   {
21
+       localname = localname.substr(pos,localname.numChars()-pos);
22
+   }
23
+   return Class<ASString>::getInstanceS(localname);
24
+}
25
+ASFUNCTIONBODY(XMLNode,appendChild)
26
+{
27
+   XMLNode* th=Class<XMLNode>::cast(obj);
28
+   _NR<XMLNode> c;
29
+   ARG_UNPACK(c);
30
+   th->node.append_move(c->node);
31
+   if (!c->root.isNull())
32
+       c->root->decRef();
33
+   c->root = th->root;
34
+   th->root->incRef();
35
+   return NULL;
36
+}
37
 tiny_string XMLNode::toString()
38
 {
39
    return toString_priv(node);
40
@@ -258,6 +283,7 @@
41
    c->setDeclaredMethodByQName("parseXML","",Class<IFunction>::getFunction(parseXML),NORMAL_METHOD,true);
42
    c->setDeclaredMethodByQName("toString","",Class<IFunction>::getFunction(_toString),NORMAL_METHOD,true);
43
    c->setDeclaredMethodByQName("firstChild","",Class<IFunction>::getFunction(XMLDocument::firstChild),GETTER_METHOD,true);
44
+   c->setDeclaredMethodByQName("createElement","",Class<IFunction>::getFunction(XMLDocument::createElement),NORMAL_METHOD,true);
45
    REGISTER_GETTER_SETTER(c, ignoreWhite);
46
 }
47
 
48
@@ -326,3 +352,14 @@
49
    th->incRef();
50
    return Class<XMLNode>::getInstanceS(_MR(th),newNode);
51
 }
52
+ASFUNCTIONBODY(XMLDocument,createElement)
53
+{
54
+   XMLDocument* th=Class<XMLDocument>::cast(obj);
55
+   assert(th->node==NULL);
56
+   tiny_string name;
57
+   ARG_UNPACK(name);
58
+   pugi::xml_node newNode;
59
+   newNode.set_name(name.raw_buf());
60
+   th->incRef();
61
+   return Class<XMLNode>::getInstanceS(_MR(th),newNode);
62
+}
63
lightspark.tar.xz/src/scripting/flash/xml/flashxml.h Changed
22
 
1
@@ -53,10 +53,12 @@
2
    ASFUNCTION(_getNodeType);
3
    ASFUNCTION(_getNodeName);
4
    ASFUNCTION(_getNodeValue);
5
+   ASFUNCTION(_getLocalName);
6
    ASFUNCTION(nextSibling);
7
    ASFUNCTION(parentNode);
8
    ASFUNCTION(previousSibling);
9
    ASFUNCTION(_toString);
10
+   ASFUNCTION(appendChild);
11
 };
12
 
13
 class XMLDocument: public XMLNode, public XMLBase
14
@@ -75,6 +77,7 @@
15
    ASFUNCTION(parseXML);
16
    ASFUNCTION(firstChild);
17
    ASFUNCTION(_toString);
18
+   ASFUNCTION(createElement);
19
    //Serialization interface
20
    void serialize(ByteArray* out, std::map<tiny_string, uint32_t>& stringMap,
21
                std::map<const ASObject*, uint32_t>& objMap,
22
lightspark.tar.xz/src/scripting/toplevel/Integer.cpp Changed
11
 
1
@@ -148,8 +148,7 @@
2
        case T_INTEGER:
3
            return val==o->toInt();
4
        case T_UINTEGER:
5
-           //CHECK: somehow wrong
6
-           return val==o->toInt();
7
+           return val >= 0 && val==o->toInt();
8
        case T_NUMBER:
9
            return val==o->toNumber();
10
        case T_BOOLEAN:
11
lightspark.tar.xz/src/scripting/toplevel/XML.cpp Changed
25
 
1
@@ -1266,7 +1266,10 @@
2
 {
3
    XMLVector ret;
4
    tiny_string defns = "|";
5
-   defns += getVm()->getDefaultXMLNamespace();
6
+   if (nodenamespace_prefix == "" && nodenamespace_uri != "")
7
+       defns += nodenamespace_uri;
8
+   else
9
+       defns += getVm()->getDefaultXMLNamespace();
10
    defns += "|";
11
    tiny_string normalizedName= "";
12
    normalizedName= name.normalizedName();
13
@@ -2513,7 +2516,10 @@
14
    node->nodetype = srcnode.type();
15
    node->nodename = srcnode.name();
16
    node->nodevalue = srcnode.value();
17
-   node->nodenamespace_uri = getVm()->getDefaultXMLNamespace();
18
+   if (!node->parentNode.isNull() && node->parentNode->nodenamespace_prefix == "")
19
+       node->nodenamespace_uri = node->parentNode->nodenamespace_uri;
20
+   else
21
+       node->nodenamespace_uri = getVm()->getDefaultXMLNamespace();
22
    if (ignoreWhitespace && node->nodetype == pugi::node_pcdata)
23
        node->nodevalue = node->removeWhitespace(node->nodevalue);
24
    node->attributelist = _MR(Class<XMLList>::getInstanceS());
25
lightspark.tar.xz/src/scripting/toplevel/toplevel.cpp Changed
67
 
1
@@ -569,7 +569,7 @@
2
    Function* f=dynamic_cast<Function*>(r);
3
    if(f==NULL)
4
        return false;
5
-   return (val==f->val) && (closure_this==f->closure_this);
6
+   return (val==f->val) && (closure_this.isNull() || f->closure_this.isNull() || closure_this==f->closure_this);
7
 }
8
 
9
 bool Null::isEqual(ASObject* r)
10
@@ -1305,7 +1305,7 @@
11
 void Class_base::describeTraits(pugi::xml_node &root,
12
                std::vector<traits_info>& traits) const
13
 {
14
-   std::map<u30, pugi::xml_node*> accessorNodes;
15
+   std::map<u30, pugi::xml_node> accessorNodes;
16
    for(unsigned int i=0;i<traits.size();i++)
17
    {
18
        traits_info& t=traits[i];
19
@@ -1360,18 +1360,16 @@
20
            if(existing==accessorNodes.end())
21
            {
22
                node=root.append_child("accessor");
23
-               accessorNodes[t.name]=&node;
24
+               node.append_attribute("name").set_value(getSys()->getStringFromUniqueId(mname->name_s_id).raw_buf());
25
            }
26
            else
27
-               node=*existing->second;
28
-
29
-           node.append_attribute("name").set_value(getSys()->getStringFromUniqueId(mname->name_s_id).raw_buf());
30
+           {
31
+               node=existing->second;
32
+           }
33
 
34
            const char* access=NULL;
35
-           tiny_string oldAccess;
36
            pugi::xml_attribute oldAttr=node.attribute("access");
37
-           if (!oldAttr.empty())
38
-               oldAccess=oldAttr.value();
39
+           tiny_string oldAccess=oldAttr.value();
40
 
41
            if(kind==traits_info::Getter && oldAccess=="")
42
                access="readonly";
43
@@ -1381,13 +1379,8 @@
44
                (kind==traits_info::Setter && oldAccess=="readonly"))
45
                access="readwrite";
46
 
47
-           if(access)
48
-           {
49
-               if (oldAttr.empty())
50
-                   node.append_attribute("access").set_value(access);
51
-               else
52
-                   oldAttr.set_value(access);
53
-           }
54
+           node.remove_attribute("access");
55
+           node.append_attribute("access").set_value(access);
56
 
57
            tiny_string type;
58
            method_info& method=context->methods[t.method];
59
@@ -1410,6 +1403,7 @@
60
            node.append_attribute("declaredBy").set_value(getQualifiedClassName().raw_buf());
61
            
62
            describeMetadata(node, t);
63
+           accessorNodes[t.name]=node;
64
        }
65
    }
66
 }
67