win32 compile fixes
authorkramm <kramm>
Wed, 9 Jan 2008 09:33:41 +0000 (09:33 +0000)
committerkramm <kramm>
Wed, 9 Jan 2008 09:33:41 +0000 (09:33 +0000)
21 files changed:
configure.in
lib/bitio.c
lib/devices/arts.c
lib/devices/artsutils.c
lib/devices/bbox.c
lib/devices/file.c
lib/devices/ops.c
lib/devices/render.c
lib/devices/rescale.c
lib/devices/swf.c
lib/drawer.c
lib/log.c
lib/modules/swfabc.c
lib/modules/swfbits.c
lib/modules/swffont.c
lib/modules/swfshape.c
lib/modules/swftext.c
lib/modules/swftools.c
lib/pdf/InfoOutputDev.cc
lib/rfxswf.c
lib/rfxswf.h

index e3896c9..15999cc 100644 (file)
@@ -21,7 +21,7 @@ AC_ARG_ENABLE(lame,
 [  --disable-lame          don't compile any L.A.M.E. mp3 encoding code in], DISABLE_LAME=true)
 
 PACKAGE=swftools
-VERSION=2007-04-28-2027
+VERSION=2007-12-11-1640
 
 
 # ------------------------------------------------------------------
index 0ea2967..920b4ce 100644 (file)
@@ -178,13 +178,12 @@ static int writer_growmemwrite_write(writer_t*w, void* data, int len)
        exit(1);
     }
     if(mw->length - w->pos < len) {
-       unsigned char*newmem;
        int newlength = mw->length;
        while(newlength - w->pos < len) {
            newlength += mw->grow;
        }
 #ifdef NO_REALLOC
-       newmem = (unsigned char*)malloc(newlength);
+       unsigned char*newmem = (unsigned char*)malloc(newlength);
        memcpy(newmem, mw->data, mw->length);
        free(mw->data);
        mw->data = newmem;
index baf5cf0..ca03a80 100644 (file)
@@ -21,7 +21,9 @@
 #include <stdlib.h>
 #include <stdio.h>
 #include <stdarg.h>
+#ifndef WIN32
 #include <unistd.h>
+#endif
 #include <memory.h>
 #include <string.h>
 #include <math.h>
index 0da39eb..6b284e6 100644 (file)
@@ -3,6 +3,7 @@
 #include "../gfxdevice.h"
 #include "../gfxtools.h"
 #include "../art/libart.h"
+#include "artsutils.h"
 #include <assert.h>
 #include <math.h>
 
index 5da181f..f46b60d 100644 (file)
 #include <stdlib.h>
 #include <stdio.h>
 #include <stdarg.h>
+#ifndef WIN32
 #include <unistd.h>
+#endif
 #include <memory.h>
+#include <string.h>
 #include "../types.h"
 #include "../mem.h"
 #include "../gfxdevice.h"
index 288a0a7..98aaaa2 100644 (file)
 
 #include <stdlib.h>
 #include <stdio.h>
+#ifndef WIN32
 #include <unistd.h>
+#endif
+#include <string.h>
 #include <memory.h>
 #include "../gfxdevice.h"
 
@@ -112,7 +115,7 @@ void file_drawchar(struct _gfxdevice*dev, gfxfont_t*font, int glyph, gfxcolor_t*
     internal_t*i = (internal_t*)dev->internal;
 }
 
-void file_drawlink(struct _gfxdevice*dev, gfxline_t*line, char*action)
+void file_drawlink(struct _gfxdevice*dev, gfxline_t*line, const char*action)
 {
     internal_t*i = (internal_t*)dev->internal;
     fprintf(i->fi, "drawlink %s\n", action);
index e5e19af..8342930 100644 (file)
 #include <stdlib.h>
 #include <stdio.h>
 #include <stdarg.h>
+#ifndef WIN32
 #include <unistd.h>
+#endif
 #include <memory.h>
+#include <string.h>
 #include "../types.h"
 #include "../mem.h"
 #include "../gfxdevice.h"
index 88b9ce9..88e33ae 100644 (file)
@@ -502,8 +502,6 @@ void render_stroke(struct _gfxdevice*dev, gfxline_t*line, gfxcoord_t width, gfxc
     }*/
 
     while(line) {
-        int x1,y1,x2,y2,x3,y3;
-
         if(line->type == gfx_moveTo) {
         } else if(line->type == gfx_lineTo) {
            double x1=x*i->zoom,y1=y*i->zoom;
@@ -511,7 +509,7 @@ void render_stroke(struct _gfxdevice*dev, gfxline_t*line, gfxcoord_t width, gfxc
            add_solidline(dev, x1, y1, x3, y3, width * i->multiply);
            fill_solid(dev, color);
         } else if(line->type == gfx_splineTo) {
-           int t,parts,qparts;
+           int t,parts;
            double xx,yy;
            
            double x1=x*i->zoom,y1=y*i->zoom;
@@ -916,7 +914,6 @@ void render_drawlink(struct _gfxdevice*dev, gfxline_t*line, const char*action)
 void gfxdevice_render_init(gfxdevice_t*dev)
 {
     internal_t*i = (internal_t*)rfx_calloc(sizeof(internal_t));
-    int y;
     memset(dev, 0, sizeof(gfxdevice_t));
     
     dev->name = "render";
index 21e8cb0..53d3623 100644 (file)
 #include <stdlib.h>
 #include <stdio.h>
 #include <stdarg.h>
+#ifndef WIN32
 #include <unistd.h>
+#endif
 #include <memory.h>
 #include <math.h>
+#include <string.h>
+#include "rescale.h"
 #include "../types.h"
 #include "../mem.h"
 #include "../gfxdevice.h"
index 2765d68..205163f 100644 (file)
@@ -26,6 +26,9 @@
 #ifdef HAVE_UNISTD_H
 #include <unistd.h>
 #endif
+#ifdef HAVE_IO_H
+#include <io.h>
+#endif
 #ifdef HAVE_ASSERT_H
 #include <assert.h>
 #else
index c025191..671ac84 100644 (file)
@@ -254,7 +254,6 @@ static int approximate3(const struct cspline*s, struct qspline*q, int size, doub
        char left = 0,recurse=0;
        int t;
        int probes = 15;
-       double dx,dy;
 
        /* create simple approximation: a qspline which run's through the
           qspline point at 0.5 */
@@ -322,6 +321,7 @@ static int approximate3(const struct cspline*s, struct qspline*q, int size, doub
 
        /* convert control point representation to 
           d*x^3 + c*x^2 + b*x + a */
+       double dx,dy;
        dx= s->end.x  - s->control2.x*3 + s->control1.x*3 - s->start.x;
        dy= s->end.y  - s->control2.y*3 + s->control1.y*3 - s->start.y;
        
index 05ac58f..1f7b96c 100644 (file)
--- a/lib/log.c
+++ b/lib/log.c
    along with this program; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
 
-#ifdef __NT__
-#include "stdafx.h"
-#include <string.h>
 #include <stdlib.h>
+#include <string.h>
+#include <stdarg.h>
+#ifdef WIN32
+//#include "stdafx.h"
 #include <malloc.h>
 #if _MSC_VER > 1000
 #pragma once
 #endif // _MSC_VER > 1000
 #else
 #include <stdio.h>
-#include <stdlib.h>
-#include <stdarg.h>
-#include <string.h>
 #include <unistd.h>
 #endif
 
index cdf9002..2598fad 100644 (file)
@@ -51,7 +51,7 @@ void AVM2_InsertStops(SWF*swf)
     char pool2[26] = {0x01,0x00,0x00,0x00,0x73,0x74,0x6f,0x70,0x5f,0x66,0x6c,0x61,0x2e,0x4d,0x61,0x69
     ,0x6e,0x54,0x69,0x6d,0x65,0x6c,0x69,0x6e,0x65,0x00};
     TAG * classCall = swf_InsertTagBefore(swf, swf->firstTag, 0x04c);
-    swf_SetBlock(classCall, pool2, sizeof(pool2));
+    swf_SetBlock(classCall, (U8*)pool2, sizeof(pool2));
 
     //0x52 is the Flash9 equivalent to DoAction
     char init_pool[322] = { 0x01,0x00,0x00,0x00, /* Flag Parameter to 0x52 */
@@ -257,25 +257,25 @@ void AVM2_InsertStops(SWF*swf)
     TAG *classInit = swf_InsertTagBefore(swf, swf->firstTag, 0x052);
 
     /* Copy the environment Initialization code */
-    swf_SetBlock(classInit, init_pool,sizeof(init_pool));
+    swf_SetBlock(classInit, (U8*)init_pool,sizeof(init_pool));
     /* Copy Constructor Method header */
-    swf_SetBlock(classInit, constructor_header, sizeof(constructor_header));
+    swf_SetBlock(classInit, (U8*)constructor_header, sizeof(constructor_header));
     /* Add Code block size (u30) to the method header */
-    swf_SetBlock(classInit, code_len, clen_len);
+    swf_SetBlock(classInit, (U8*)code_len, clen_len);
 
     /* Copy Constructor Method body first part */
-    swf_SetBlock(classInit, constructor_first, sizeof(constructor_first));
+    swf_SetBlock(classInit, (U8*)constructor_first, sizeof(constructor_first));
 
     /* Register the callback for every frame */
     for (i = 0; i < frame_nums; ++i) {
        AVM2_uint32toU30(i,constructor_frame_register + 3); // Write current frame number
-       swf_SetBlock(classInit, constructor_frame_register, sizeof(constructor_frame_register));
+       swf_SetBlock(classInit, (U8*)constructor_frame_register, sizeof(constructor_frame_register));
     }
 
     /* Copy Constructor method body ending, just a return */
-    swf_SetBlock(classInit, constructor_return, sizeof(constructor_return));
+    swf_SetBlock(classInit, (U8*)constructor_return, sizeof(constructor_return));
 
     /* Copy the script init code */
-    swf_SetBlock(classInit, script_init_pool, sizeof(script_init_pool));
+    swf_SetBlock(classInit, (U8*)script_init_pool, sizeof(script_init_pool));
 }
 
index bbd8641..eda6829 100644 (file)
@@ -289,8 +289,8 @@ void swf_SetJPEGBits2(TAG * tag, U16 width, U16 height, RGBA * bitmap,
     JPEGBITS *jpeg;
     int y;
     jpeg = swf_SetJPEGBitsStart(tag, width, height, quality);
+       U8 *scanline = (U8*)rfx_alloc(3 * width);
     for (y = 0; y < height; y++) {
-       U8 scanline[3 * width];
        int x, p = 0;
        for (x = 0; x < width; x++) {
            scanline[p++] = bitmap[width * y + x].r;
@@ -299,6 +299,7 @@ void swf_SetJPEGBits2(TAG * tag, U16 width, U16 height, RGBA * bitmap,
        }
        swf_SetJPEGBitsLine(jpeg, scanline);
     }
+    rfx_free(scanline);
     swf_SetJPEGBitsFinish(jpeg);
 }
 
@@ -1060,8 +1061,8 @@ int swf_SetJPEGBits3(TAG * tag, U16 width, U16 height, RGBA * bitmap, int qualit
     pos = tag->len;
     swf_SetU32(tag, 0);                //placeholder
     jpeg = swf_SetJPEGBitsStart(tag, width, height, quality);
+       U8 *scanline = (U8*)rfx_alloc(3 * width);
     for (y = 0; y < height; y++) {
-       U8 scanline[3 * width];
        int x, p = 0;
        for (x = 0; x < width; x++) {
            //int ia = bitmap[width*y+x].a;
@@ -1078,6 +1079,7 @@ int swf_SetJPEGBits3(TAG * tag, U16 width, U16 height, RGBA * bitmap, int qualit
        }
        swf_SetJPEGBitsLine(jpeg, scanline);
     }
+    rfx_free(scanline);
     swf_SetJPEGBitsFinish(jpeg);
     PUT32(&tag->data[pos], tag->len - pos - 4);
 
@@ -1092,8 +1094,8 @@ int swf_SetJPEGBits3(TAG * tag, U16 width, U16 height, RGBA * bitmap, int qualit
     zs.next_out = data;
     zs.avail_out = OUTBUFFER_SIZE;
 
+       scanline = (U8*)rfx_alloc(width);
     for (y = 0; y < height; y++) {
-       U8 scanline[width];
        int x, p = 0;
        for (x = 0; x < width; x++) {
            scanline[p++] = bitmap[width * y + x].a;
@@ -1117,6 +1119,8 @@ int swf_SetJPEGBits3(TAG * tag, U16 width, U16 height, RGBA * bitmap, int qualit
        }
     }
 
+    rfx_free(scanline);
+
     while (1) {
        int ret = deflate(&zs, Z_FINISH);
        if (ret != Z_OK && ret != Z_STREAM_END) {
index c8c3efa..75069e3 100644 (file)
@@ -122,7 +122,6 @@ SWFFONT* swf_LoadTrueTypeFont(char*filename)
     SWFFONT* font;
     int t;
     int*glyph2glyph;
-    FT_Size size;
     int max_unicode = 0;
     int charmap = -1;
 
@@ -239,10 +238,8 @@ SWFFONT* swf_LoadTrueTypeFont(char*filename)
     for(t=0; t < face->num_glyphs; t++) {
        FT_Glyph glyph;
        FT_BBox bbox;
-       FT_Matrix matrix;
        char name[128];
        drawer_t draw;
-       int ret;
        char hasname = 0;
        name[0]=0;
        if(FT_HAS_GLYPH_NAMES(face)) {
index f41fb3d..c5a8835 100644 (file)
@@ -534,7 +534,6 @@ static int parseFillStyleArray(TAG*tag, SHAPE2*shape)
         for(t=fillstylestart;t<shape->numfillstyles;t++)
         {
             int type;
-            U8*pos;
             FILLSTYLE*dest = &shape->fillstyles[t];
             type = swf_GetU8(tag); //type
             shape->fillstyles[t].type = type;
@@ -877,7 +876,7 @@ void swf_ShapeSetBitmapRect(TAG*tag, U16 gfxid, int width, int height)
 void swf_Shape2ToShape(SHAPE2*shape2, SHAPE*shape)
 {
     TAG*tag = swf_InsertTag(0,0);
-    SHAPELINE*l,*next;
+    SHAPELINE*l;
     int newx=0,newy=0,lastx=0,lasty=0,oldls=0,oldfs0=0,oldfs1=0;
 
     memset(shape, 0, sizeof(SHAPE));
@@ -946,8 +945,6 @@ void swf_ParseDefineShape(TAG*tag, SHAPE2*shape)
 {
     int num = 0, id;
     U16 fill,line;
-    SRECT r;
-    SRECT r2;
     SHAPELINE*l;
     if(tag->id == ST_DEFINESHAPE)
        num = 1;
index 6c67b48..53abace 100644 (file)
@@ -237,8 +237,6 @@ int swf_FontExtract_DefineFontInfo(int id, SWFFONT * f, TAG * t)
 int swf_FontExtract_GlyphNames(int id, SWFFONT * f, TAG * tag)
 {
     U16 fid;
-    U16 maxcode;
-    U8 flags;
     swf_SaveTagPos(tag);
     swf_SetTagPos(tag, 0);
 
@@ -741,7 +739,7 @@ int swf_FontReduce(SWFFONT * f)
 
 void swf_FontSort(SWFFONT * font)
 {
-    int i, j, k;
+    int i, j;
     int *newplace;
     int *newpos;
     if (!font)
@@ -932,7 +930,6 @@ int swf_FontSetDefine2(TAG * tag, SWFFONT * f)
     U8 flags = 0;
     int t;
     int pos;
-    int pos2;
     swf_SetU16(tag, f->id);
 
     if (f->layout) flags |= 128;               // haslayout
index fa0bb19..83f8c6a 100644 (file)
@@ -471,7 +471,6 @@ void enumerateUsedIDs_styles(TAG * tag, void (*callback)(TAG*, int, void*), void
     for(t=0;t<count;t++)
     {
        int type;
-       U8*pos;
        type = swf_GetU8(tag); //type
        DEBUG_ENUMERATE printf("fill style %d) %02x (tagpos=%d)\n", t, type, tag->pos);
        if(type == 0) {
@@ -675,7 +674,6 @@ void enumerateUsedIDs(TAG * tag, int base, void (*callback)(TAG*, int, void*), v
            }
            while(1)
            {
-               U16 charid;
                if(!swf_GetU8(tag)) //flags
                    break; 
                callback(tag, tag->pos + base, callback_data);
index d78c418..fd33452 100644 (file)
@@ -1,3 +1,4 @@
+#include "Object.h"
 #include "SplashTypes.h"
 #include "SplashOutputDev.h"
 #include "SplashPath.h"
index ac896f5..684c002 100644 (file)
@@ -47,14 +47,15 @@ extern "C" {
 #include "lame/lame.h"
 #endif
 #endif
-#ifdef __cplusplus
-}
-#endif
 
 #ifdef HAVE_TIME_H
 #include <time.h>
 #endif
 
+#ifdef HAVE_IO_H
+#include <io.h>
+#endif
+
 #include "./bitio.h"
 #include "./MD5.h"
 
@@ -337,7 +338,6 @@ void swf_GetRGBA(TAG * t, RGBA * col)
 
 void swf_GetGradient(TAG * tag, GRADIENT * gradient, char alpha)
 {
-    GRADIENT dummy;
     int t;
     if(!tag) {
       memset(gradient, 0, sizeof(GRADIENT));
@@ -771,7 +771,7 @@ int swf_VerifyPassword(TAG * t, const char * password)
 {
     char*md5string1, *md5string2;
     char*x;
-    char*md5, *salt;
+    char*salt;
     int n;
 
     if(t->len >= 5 && t->pos==0 && 
@@ -1071,7 +1071,7 @@ void swf_UnFoldSprite(TAG * t)
 void swf_FoldSprite(TAG * t)
 {
   TAG*sprtag=t,*tmp;
-  U16 id,frames,tmpid;
+  U16 id,frames;
   int level;
   if(t->id!=ST_DEFINESPRITE)
       return;
index 2a07fdb..fe3c7e1 100644 (file)
@@ -28,7 +28,9 @@
 #include <stdlib.h>
 #include <math.h>
 #include <string.h>
+#ifndef WIN32
 #include <unistd.h>
+#endif
 #include <fcntl.h>
 #include <ctype.h>
 #include "../config.h"
 #include "./mem.h"
 #include "./types.h"
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 #define DEBUG_RFXSWF
 #ifdef RFXSWF_DISABLESOUND
 #define NO_MP3
@@ -1065,4 +1071,8 @@ FILTER*swf_NewFilter(U8 type);
 
 void AVM2_InsertStops(SWF*swf);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif