X-Git-Url: http://git.asbjorn.biz/?p=swftools.git;a=blobdiff_plain;f=lib%2Frfxswf.c;h=278e504ce413322d104786ab2166e101ed795dec;hp=025bcaf4ec8d3815d543b3c30b4f0bf8e92d86c2;hb=98da96466d3a3d8b56da406f6231b8c524449021;hpb=275179c87d277416cfcc0d7a346ed60c4545ba31 diff --git a/lib/rfxswf.c b/lib/rfxswf.c index 025bcaf..278e504 100644 --- a/lib/rfxswf.c +++ b/lib/rfxswf.c @@ -474,6 +474,28 @@ void swf_SetF16(TAG * t, float f) swf_SetU16(t, result); } +float F16toFloat(U16 x) +{ + TAG t; + t.data = (void*)&x; + t.readBit = 0; + t.pos = 0; + t.len = 2; + return swf_GetF16(&t); +} + +float floatToF16(float f) +{ + U16 u = 0; + TAG t; + t.data = (void*)&u; + t.len = 0; + t.memsize = 2; + t.writeBit = 0; + swf_SetF16(&t, f); + return u; +} + double swf_GetD64(TAG*tag) { /* FIXME: this is not big-endian compatible */ @@ -1164,8 +1186,7 @@ TAG * swf_ReadTag(reader_t*reader, TAG * prev) if (len==0x3f) { - if (reader->read(reader, &len, 4) != 4) return NULL; - len = SWAP32(len); + len = reader_readU32(reader); } if (id==ST_DEFINESPRITE) len = 2*sizeof(U16); @@ -1242,14 +1263,7 @@ int swf_WriteTag2(writer_t*writer, TAG * t) return -1; } - len = SWAP32(len); - if (writer->write(writer,&len,4)!=4) - { - #ifdef DEBUG_RFXSWF - fprintf(stderr,"WriteTag() failed: Long Header (2).\n"); - #endif - return -1; - } + writer_writeU32(writer, len); } if (t->data) @@ -1859,7 +1873,7 @@ int swf_WriteCGI(SWF * swf) sprintf(s,"Content-type: application/x-shockwave-flash\n" "Accept-Ranges: bytes\n" - "Content-Length: %lu\n" + "Content-Length: %d\n" "Expires: Thu, 13 Apr 2000 23:59:59 GMT\n" "\n",len);