test HAVE_JPEGLIB_H before including the jpeglib header
[swftools.git] / lib / rfxswf.c
index 2912350..d7cbb03 100644 (file)
 \r
 #include "rfxswf.h"\r
 \r
+#ifdef HAVE_JPEGLIB_H\r
 #include <jpeglib.h>\r
 #define _JPEGLIB_INCLUDED_\r
+#endif\r
 \r
 // Win32 support may be broken since it was only tested in an older version for Watcom C\r
 #ifdef __NT__\r
@@ -42,8 +44,8 @@ LPTAG PrevTag(LPTAG t) { return t->prev; }
 int   GetFrameNo(LPTAG t)  { return t->frame; }\r
 U16   GetTagID(LPTAG t)    { return t->id; }\r
 U32   GetDataSize(LPTAG t) { return t->len; }\r
+U8*   GetDataSizePtr(LPTAG t) { return &(t->data[t->len]); }\r
 U32   GetTagPos(LPTAG t)   { return t->pos; }\r
-U8*   GetTagPosPtr(LPTAG t)   { return &t->data[t->pos]; }\r
 \r
 // Basic Data Access Functions\r
 \r
@@ -487,6 +489,7 @@ LPTAG InsertTag(LPTAG after,U16 id)     // updates frames, if nescessary
   if (t)\r
   { memset(t,0x00,sizeof(TAG));\r
     t->id = id;\r
+    t->bitcount = 0x80;\r
     \r
     if (after)\r
     { t->frame = after->frame;\r
@@ -759,10 +762,10 @@ int WriteCGI(LPSWF swf)
 \r
   if (len<0) return -1;\r
 \r
-  sprintf(s,"Content-type: application/x-shockwave-flash\n"\\r
-            "Accept-Ranges: bytes\n"\\r
-            "Content-Length: %lu\n"\\r
-            "Expires: Thu, 13 Apr 2000 23:59:59 GMT\n"\\r
+  sprintf(s,"Content-type: application/x-shockwave-flash\n"\r
+            "Accept-Ranges: bytes\n"\r
+            "Content-Length: %lu\n"\r
+            "Expires: Thu, 13 Apr 2000 23:59:59 GMT\n"\r
             "\n",len);\r
             \r
   write(fileno(stdout),s,strlen(s));\r
@@ -789,9 +792,9 @@ void FreeTags(LPSWF swf)                 // Frees all malloc'ed memory for tags
 #include "modules\swftext.c"\r
 #include "modules\swfobject.c"\r
 #include "modules\swfbutton.c"\r
-#include "modules\swfbits.c"\r
 #include "modules\swftools.c"\r
 #include "modules\swfcgi.c"\r
+#include "modules\swfbits.c"\r
 \r
 #else\r
 \r
@@ -800,9 +803,9 @@ void FreeTags(LPSWF swf)                 // Frees all malloc'ed memory for tags
 #include "modules/swftext.c"\r
 #include "modules/swfobject.c"\r
 #include "modules/swfbutton.c"\r
-#include "modules/swfbits.c"\r
 #include "modules/swftools.c"\r
 #include "modules/swfcgi.c"\r
+#include "modules/swfbits.c"\r
 \r
 #endif\r
 \r