#ifdef HAVE_LIBJPEG
#ifdef HAVE_JPEGLIB_H
+#define HAVE_BOOLEAN
#include <jpeglib.h>
#define _JPEGLIB_INCLUDED_
#endif // HAVE_JPEGLIB_H
TAG * swf_PrevTag(TAG * t) { return t->prev; }
int swf_GetFrameNo(TAG * t) { return t->frame; }
U16 swf_GetTagID(TAG * t) { return t->id; }
-U32 swf_GetDataSize(TAG * t) { return t->len; }
-U8* swf_GetDataSizePtr(TAG * t) { return &(t->data[t->len]); }
+U32 swf_GetTagLen(TAG * t) { return t->len; }
+U8* swf_GetTagLenPtr(TAG * t) { return &(t->data[t->len]); }
U32 swf_GetTagPos(TAG * t) { return t->pos; }
// Basic Data Access Functions
{ swf_SetBits(t,1,1);
nbits = swf_CountBits(m->sx,0);
nbits = swf_CountBits(m->sy,nbits);
+ if(nbits>=32) {
+ fprintf(stderr,"rfxswf: Error: matrix values too large\n");
+ nbits = 31;
+ }
swf_SetBits(t,nbits,5);
swf_SetBits(t,m->sx,nbits);
swf_SetBits(t,m->sy,nbits);
{ swf_SetBits(t,1,1);
nbits = swf_CountBits(m->r0,0);
nbits = swf_CountBits(m->r1,nbits);
+ if(nbits>=32) {
+ fprintf(stderr,"rfxswf: Error: matrix values too large\n");
+ nbits = 31;
+ }
swf_SetBits(t,nbits,5);
swf_SetBits(t,m->r0,nbits);
swf_SetBits(t,m->r1,nbits);
nbits = swf_CountBits(m->tx,0);
nbits = swf_CountBits(m->ty,nbits);
+ if(nbits>=32) {
+ fprintf(stderr,"rfxswf: Error: matrix values too large\n");
+ nbits = 31;
+ }
swf_SetBits(t,nbits,5);
swf_SetBits(t,m->tx,nbits);
swf_SetBits(t,m->ty,nbits);
if (t)
{ memset(t,0x00,sizeof(TAG));
t->id = id;
- t->writeBit = 0x80;
if (after)
{ t->frame = after->frame;
int id;
if (read(handle,&raw,2)!=2) return NULL;
+ raw = SWAP16(raw);
len = raw&0x3f;
id = raw>>6;
if (len==0x3f)
- { if (read(handle,&len,4)!=4) return NULL;
+ {
+ if (read(handle,&len,4)!=4) return NULL;
+ len = SWAP32(len);
}
if (id==ST_DEFINESPRITE) len = 2*sizeof(U16);
if (handle>=0)
{ if (short_tag)
- { raw[0] = len|((t->id&0x3ff)<<6);
+ { raw[0] = SWAP16(len|((t->id&0x3ff)<<6));
if (write(handle,raw,2)!=2)
{
#ifdef DEBUG_RFXSWF
}
}
else
- { raw[0] = (t->id<<6)|0x3f;
- raw[1] = (U16)(len&0xffff);
- raw[2] = (U16)(len>>16);
- if (write(handle,raw,6)!=6)
+ {
+ raw[0] = SWAP16((t->id<<6)|0x3f);
+ if (write(handle,raw,2)!=2)
+ {
+#ifdef DEBUG_RFXSWF
+ fprintf(stderr,"WriteTag() failed: Long Header (1).\n");
+#endif
+ return -1;
+ }
+
+ len = SWAP32(len);
+ if (write(handle,&len,4)!=4)
{
#ifdef DEBUG_RFXSWF
- fprintf(stderr,"WriteTag() failed: Long Header.\n");
+ fprintf(stderr,"WriteTag() failed: Long Header (2).\n");
#endif
return -1;
}
swf_SetU16(&t1,swf->frameRate);
swf_SetU16(&t1,swf->frameCount);
- l = swf_GetDataSize(&t1);
+ l = swf_GetTagLen(&t1);
swf->fileSize = l+len;
t1.len = 4; // bad & ugly trick !
swf_SetU32(&t1,swf->fileSize);
return (int)swf->fileSize;
}
-int WriteCGI(SWF * swf)
+int swf_WriteCGI(SWF * swf)
{ int len;
char s[1024];