X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=lib%2Frfxswf.c;h=616be52cc534d75f76bb2c32f7c2f6b4fdce6fc0;hb=da143dcc87b39085a4e6a4d51e145af7c11c815e;hp=2f80c888a4b48f17ac6706ef072fb952db1e218a;hpb=607c5dadd6089768b618cc99346de1b37a2c46f1;p=swftools.git diff --git a/lib/rfxswf.c b/lib/rfxswf.c index 2f80c88..616be52 100644 --- a/lib/rfxswf.c +++ b/lib/rfxswf.c @@ -61,8 +61,8 @@ void* rfx_alloc(int size) ptr = malloc(size); if(!ptr) { - fprintf(stderr, "FATAL: Out of memory\n"); - /* TODO: we should send a signal, so that the debugger kicks in */ + fprintf(stderr, "FATAL: Out of memory (while trying to claim %d bytes)\n", size); + /* TODO: we should send a signal, so that the debugger kicks in? */ exit(1); } return ptr; @@ -83,8 +83,8 @@ void* rfx_realloc(void*data, int size) } if(!ptr) { - fprintf(stderr, "FATAL: Out of memory\n"); - /* TODO: we should send a signal, so that the debugger kicks in */ + fprintf(stderr, "FATAL: Out of memory (while trying to claim %d bytes)\n", size); + /* TODO: we should send a signal, so that the debugger kicks in? */ exit(1); } return ptr; @@ -103,8 +103,8 @@ void* rfx_calloc(int size) ptr = malloc(size); #endif if(!ptr) { - fprintf(stderr, "FATAL: Out of memory\n"); - /* TODO: we should send a signal, so that the debugger kicks in */ + fprintf(stderr, "FATAL: Out of memory (while trying to claim %d bytes)\n", size); + /* TODO: we should send a signal, so that the debugger kicks in? */ exit(1); } #ifndef HAVE_CALLOC @@ -668,7 +668,7 @@ int swf_SetMatrix(TAG * t,MATRIX * m) return 0; } -int swf_GetCXForm(TAG * t,CXFORM * cx,U8 alpha) //FIXME: alpha should be type bool +int swf_GetCXForm(TAG * t,CXFORM * cx,U8 alpha) { CXFORM cxf; int hasadd; int hasmul; @@ -782,6 +782,7 @@ void swf_SetPassword(TAG * t, const char * password) fprintf(stderr, "rfxswf: Warning- no usable random generator found\n"); fprintf(stderr, "Your password will be vulnerable to dictionary attacks\n"); #endif + salt[2] = 0; md5string = crypt_md5(password, salt); @@ -1229,7 +1230,10 @@ void swf_OptimizeTagOrder(SWF*swf) tag->next = level0; tag->prev = level0->prev; level0->prev = tag; - tag->prev->next = tag; + if(tag->prev) + tag->prev->next = tag; + else + swf->firstTag = tag; changes = 1; } } @@ -1433,6 +1437,7 @@ int swf_WriteSWF(int handle, SWF * swf) // Writes SWF to file, returns leng if(handle<0) { writer_init_nullwriter(&writer); len = swf_WriteSWF2(&writer, swf); + return len; } writer_init_filewriter(&writer, handle); len = swf_WriteSWF2(&writer, swf); @@ -1493,10 +1498,11 @@ int swf_WriteCGI(SWF * swf) SWF* swf_CopySWF(SWF*swf) { SWF*nswf = rfx_alloc(sizeof(SWF)); + TAG*tag, *ntag; memcpy(nswf, swf, sizeof(SWF)); nswf->firstTag = 0; - TAG*tag = swf->firstTag; - TAG*ntag = 0; + tag = swf->firstTag; + ntag = 0; while(tag) { ntag = swf_CopyTag(ntag, tag); if(!nswf->firstTag)