X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=lib%2Fpython%2Ftaglist.c;h=e4eeffc2bb39aea5c5bd008638a83717b53fc6b0;hb=a6d5a31e91e224064e105b5383ebbdce79060997;hp=27b3a6662ea48777cbf9bb7582ce40e1bedf417a;hpb=726d172d02228a2e9b084efba8d3173994343c2b;p=swftools.git diff --git a/lib/python/taglist.c b/lib/python/taglist.c index 27b3a66..e4eeffc 100644 --- a/lib/python/taglist.c +++ b/lib/python/taglist.c @@ -19,7 +19,7 @@ typedef struct { PyObject * taglist_new() { TagListObject* taglist = PyObject_New(TagListObject, &TagListClass); - mylog("+%08x(%d) taglist_new2", (int)taglist, taglist->ob_refcnt); + mylog("+%08x(%d) taglist_new", (int)taglist, taglist->ob_refcnt); taglist->tagmap = tagmap_new(); taglist->taglist = PyList_New(0); return (PyObject*)taglist; @@ -28,21 +28,28 @@ PyObject * taglist_new() PyObject * taglist_new2(TAG*tag) { TagListObject* taglist = PyObject_New(TagListObject, &TagListClass); - mylog("+%08x(%d) taglist_new2", (int)taglist, taglist->ob_refcnt); + mylog("+%08x(%d) taglist_new2 tag=%08x", (int)taglist, taglist->ob_refcnt, tag); taglist->tagmap = tagmap_new(); int nr=0; TAG*t = tag; while(t) {nr++;t=t->next;} taglist->taglist = PyList_New(nr); + + mylog("+%08x(%d) taglist_new2: %d items", (int)taglist, taglist->ob_refcnt, nr); nr = 0; t = tag; while(t) { - PyObject*newtag = tag_new(tag); + PyObject*newtag = tag_new2(t, taglist->tagmap); + if(newtag==NULL) { + // pass through exception + return NULL; + } PyList_SET_ITEM(taglist->taglist,nr,newtag);Py_INCREF(newtag); if(swf_isDefiningTag(t)) { - tagmap_add(taglist->tagmap, newtag); + int id = swf_GetDefineID(t); + tagmap_addMapping(taglist->tagmap, id, newtag); } nr++; t=t->next; @@ -70,6 +77,7 @@ TAG* taglist_getTAGs(PyObject*self) tag = tag_getTAG(item, tag, taglist->tagmap); if(!firstTag) firstTag = tag; + mylog(" %08x(%d) taglist_getTAGs: added tag %08x", (int)self, self->ob_refcnt, tag); } return firstTag; }