if (!t->readBit) t->readBit = 0x80;
while (nbits)
{ res<<=1;
+#ifdef DEBUG_RFXSWF
+ if (t->pos>=t->len)
+ { fprintf(stderr,"GetBits() out of bounds: TagID = %i, pos=%d, len=%d\n",t->id, t->pos, t->len);
+ int i,m=t->len>10?10:t->len;
+ for(i=-1;i<m;i++) {
+ fprintf(stderr, "(%d)%02x ", i, t->data[i]);
+ }
+ fprintf(stderr, "\n");
+ return res;
+ }
+#endif
if (t->data[t->pos]&t->readBit) res|=1;
t->readBit>>=1;
nbits--;
if (!t->readBit)
{ if (nbits) t->readBit = 0x80;
- #ifdef DEBUG_RFXSWF
- if (t->pos>=t->len)
- { fprintf(stderr,"GetBits() out of bounds: TagID = %i\n",t->id);
- return res;
- }
- #endif
t->pos++;
}
}
while(1) {
U8 b = swf_GetU8(tag);
nr++;
- s|=(b&127)<<shift;
+ nt i,m=t->len>10?10:t->len;
+ for(i=0;i<m;i++) {
+ fprintf(stderr, "%02x ", t->data[i]);
+ }
+ fprintf(stderr, "\n");
+ s|=(b&127)<<shift;
shift+=7;
if(!(b&128) || shift>=32) {
if(b&64) {
t = swf->firstTag;
frameCount = 0;
- len += WriteExtraTags(swf, 0);
+ if(swf->firstTag && !no_extra_tags) {
+ len += WriteExtraTags(swf, 0);
+ }
while(t) {
len += swf_WriteTag(-1,t);
if(t->id == ST_DEFINESPRITE && !swf_IsFolded(t)) inSprite++;
return -1;
}
- if(!no_extra_tags) {
+ if(swf->firstTag && !no_extra_tags) {
WriteExtraTags(swf, writer);
}
t = swf->firstTag;