- fprintf(stderr, "swf_Relocate: Mapping id (%d) never encountered before in %s\n", id,
- swf_TagGetName(tag));
- ok = 0;
+ if(!id && bitmap[id]) {
+ /* id 0 is only used in SWF versions >=9. It's the ID of
+ the main timeline. It's used in e.g. SYMBOLTAG tags, but
+ never defined, so if we're asked to reallocate it, we have
+ to allocate an ID for it on the fly. */
+ int newid = 0;
+ for(current_id++;current_id<65536;current_id++) {
+ if(!bitmap[current_id]) {
+ newid = current_id;
+ break;
+ }
+ }
+ if(current_id==65536) {
+ fprintf(stderr, "swf_Relocate: Couldn't relocate: Out of IDs\n");
+ return 0;
+ }
+ bitmap[newid] = 1;
+ slaveids[id] = newid;
+ id = newid;
+ } else if(!bitmap[id]) {
+ /* well- we don't know this id, but it's not reserved anyway, so just
+ leave it alone */
+ } else {
+ fprintf(stderr, "swf_Relocate: Mapping id (%d) never encountered before in %s\n", id,
+ swf_TagGetName(tag));
+ ok = 0;
+ }