applied MSVC compatibility patch from Dwight Kelly
authorkramm <kramm>
Wed, 12 Dec 2007 09:42:44 +0000 (09:42 +0000)
committerkramm <kramm>
Wed, 12 Dec 2007 09:42:44 +0000 (09:42 +0000)
26 files changed:
lib/MD5.c
lib/bitio.c
lib/drawer.c
lib/gfxfont.c
lib/gfxtools.c
lib/h.263/swfvideo.c
lib/mem.c
lib/modules/swfaction.c
lib/modules/swfbits.c
lib/modules/swfcgi.c
lib/modules/swfdraw.c
lib/modules/swffilter.c
lib/modules/swffont.c
lib/modules/swfobject.c
lib/modules/swfrender.c
lib/modules/swfshape.c
lib/modules/swftext.c
lib/modules/swftools.c
lib/os.c
lib/pdf/GFXOutputDev.cc
lib/pdf/fonts.c
lib/png.c
lib/png.h
lib/rfxswf.c
lib/rfxswf.h
lib/wav.c

index d1544ab..c12b761 100644 (file)
--- a/lib/MD5.c
+++ b/lib/MD5.c
@@ -408,8 +408,7 @@ static const u_int8_t md5_paddat[MD5_BUFLEN] = {
 
 static void md5_calc(u_int8_t *, md5_ctxt *);
 
 
 static void md5_calc(u_int8_t *, md5_ctxt *);
 
-static void md5_init(ctxt)
-       md5_ctxt *ctxt;
+static void md5_init(md5_ctxt *ctxt)
 {
        ctxt->md5_n = 0;
        ctxt->md5_i = 0;
 {
        ctxt->md5_n = 0;
        ctxt->md5_i = 0;
@@ -420,10 +419,7 @@ static void md5_init(ctxt)
        bzero(ctxt->md5_buf, sizeof(ctxt->md5_buf));
 }
 
        bzero(ctxt->md5_buf, sizeof(ctxt->md5_buf));
 }
 
-static void md5_loop(ctxt, input, len)
-       md5_ctxt *ctxt;
-       const u_int8_t *input;
-       u_int len; /* number of bytes */
+static void md5_loop(md5_ctxt *ctxt, const u_int8_t *input, u_int len)
 {
        u_int gap, i;
 
 {
        u_int gap, i;
 
@@ -448,8 +444,7 @@ static void md5_loop(ctxt, input, len)
        }
 }
 
        }
 }
 
-static void md5_pad(ctxt)
-       md5_ctxt *ctxt;
+static void md5_pad(md5_ctxt *ctxt)
 {
        u_int gap;
 
 {
        u_int gap;
 
@@ -487,9 +482,7 @@ static void md5_pad(ctxt)
        md5_calc(ctxt->md5_buf, ctxt);
 }
 
        md5_calc(ctxt->md5_buf, ctxt);
 }
 
-static void md5_result(digest, ctxt)
-       u_int8_t *digest;
-       md5_ctxt *ctxt;
+static void md5_result(u_int8_t *digest, md5_ctxt *ctxt)
 {
        /* 4 byte words */
 #if BYTE_ORDER == LITTLE_ENDIAN
 {
        /* 4 byte words */
 #if BYTE_ORDER == LITTLE_ENDIAN
@@ -507,9 +500,7 @@ static void md5_result(digest, ctxt)
 #endif
 }
 
 #endif
 }
 
-static void md5_calc(b64, ctxt)
-       u_int8_t *b64;
-       md5_ctxt *ctxt;
+static void md5_calc(u_int8_t *b64, md5_ctxt *ctxt)
 {
        u_int32_t A = ctxt->md5_sta;
        u_int32_t B = ctxt->md5_stb;
 {
        u_int32_t A = ctxt->md5_sta;
        u_int32_t B = ctxt->md5_stb;
index 189dc76..90c3fe6 100644 (file)
 
 #include <stdio.h>
 #include <stdlib.h>
 
 #include <stdio.h>
 #include <stdlib.h>
+#ifdef HAVE_UNISTD_H
 #include <unistd.h>
 #include <unistd.h>
+#endif
+#ifdef HAVE_IO_H
+#include <io.h>
+#endif
+#include <string.h>
 #include <memory.h>
 #include <fcntl.h>
 
 #include <memory.h>
 #include <fcntl.h>
 
@@ -101,8 +107,8 @@ static void reader_memread_dealloc(reader_t*reader)
 }
 void reader_init_memreader(reader_t*r, void*newdata, int newlength)
 {
 }
 void reader_init_memreader(reader_t*r, void*newdata, int newlength)
 {
-    struct memread_t*mr = malloc(sizeof(struct memread_t));
-    mr->data = newdata;
+    struct memread_t*mr = (struct memread_t*)malloc(sizeof(struct memread_t));
+    mr->data = (unsigned char*)newdata;
     mr->length = newlength;
     r->read = reader_memread;
     r->dealloc = reader_memread_dealloc;
     mr->length = newlength;
     r->read = reader_memread;
     r->dealloc = reader_memread_dealloc;
@@ -143,8 +149,8 @@ static void writer_memwrite_finish(writer_t*w)
 void writer_init_memwriter(writer_t*w, void*data, int len)
 {
     struct memwrite_t *mr;
 void writer_init_memwriter(writer_t*w, void*data, int len)
 {
     struct memwrite_t *mr;
-    mr = malloc(sizeof(struct memwrite_t));
-    mr->data = data;
+    mr = (memwrite_t *)malloc(sizeof(struct memwrite_t));
+    mr->data = (unsigned char *)data;
     mr->length = len;
     memset(w, 0, sizeof(writer_t));
     w->write = writer_memwrite_write;
     mr->length = len;
     memset(w, 0, sizeof(writer_t));
     w->write = writer_memwrite_write;
@@ -178,12 +184,12 @@ static int writer_growmemwrite_write(writer_t*w, void* data, int len)
            newlength += mw->grow;
        }
 #ifdef NO_REALLOC
            newlength += mw->grow;
        }
 #ifdef NO_REALLOC
-       newmem = malloc(newlength);
+       newmem = (unsigned char*)malloc(newlength);
        memcpy(newmem, mw->data, mw->length);
        free(mw->data);
        mw->data = newmem;
 #else
        memcpy(newmem, mw->data, mw->length);
        free(mw->data);
        mw->data = newmem;
 #else
-       mw->data = realloc(mw->data, newlength);
+       mw->data = (unsigned char*)realloc(mw->data, newlength);
 #endif
        mw->length = newlength;
     }
 #endif
        mw->length = newlength;
     }
@@ -214,9 +220,9 @@ void* writer_growmemwrite_getmem(writer_t*w)
 void writer_init_growingmemwriter(writer_t*w, U32 grow)
 {
     struct growmemwrite_t *mr;
 void writer_init_growingmemwriter(writer_t*w, U32 grow)
 {
     struct growmemwrite_t *mr;
-    mr = malloc(sizeof(struct growmemwrite_t));
+    mr = (struct growmemwrite_t *)malloc(sizeof(struct growmemwrite_t));
     mr->length = 4096;
     mr->length = 4096;
-    mr->data = malloc(mr->length);
+    mr->data = (unsigned char *)malloc(mr->length);
     mr->grow = grow;
     memset(w, 0, sizeof(writer_t));
     w->write = writer_growmemwrite_write;
     mr->grow = grow;
     memset(w, 0, sizeof(writer_t));
     w->write = writer_growmemwrite_write;
@@ -251,7 +257,7 @@ static void writer_filewrite_finish(writer_t*w)
 }
 void writer_init_filewriter(writer_t*w, int handle)
 {
 }
 void writer_init_filewriter(writer_t*w, int handle)
 {
-    struct filewrite_t *mr = malloc(sizeof(struct filewrite_t));
+    struct filewrite_t *mr = (struct filewrite_t *)malloc(sizeof(struct filewrite_t));
     mr->handle = handle;
     mr->free_handle = 0;
     memset(w, 0, sizeof(writer_t));
     mr->handle = handle;
     mr->free_handle = 0;
     memset(w, 0, sizeof(writer_t));
@@ -330,7 +336,7 @@ static int reader_zlibinflate(reader_t*reader, void* data, int len)
     if(!len)
        return 0;
     
     if(!len)
        return 0;
     
-    z->zs.next_out = data;
+    z->zs.next_out = (Bytef *)data;
     z->zs.avail_out = len;
 
     while(1) {
     z->zs.avail_out = len;
 
     while(1) {
@@ -432,7 +438,7 @@ static int writer_zlibdeflate_write(writer_t*writer, void* data, int len)
     if(!len)
        return 0;
     
     if(!len)
        return 0;
     
-    z->zs.next_in = data;
+    z->zs.next_in = (Bytef *)data;
     z->zs.avail_in = len;
 
     while(1) {
     z->zs.avail_in = len;
 
     while(1) {
@@ -636,7 +642,7 @@ char*reader_readString(reader_t*r)
        if(!b)
            break;
     }
        if(!b)
            break;
     }
-    char*string = writer_growmemwrite_getmem(&g);
+    char*string = (char*)writer_growmemwrite_getmem(&g);
     writer_growmemwrite_finish(&g);
     return string;
 }
     writer_growmemwrite_finish(&g);
     return string;
 }
@@ -705,5 +711,3 @@ void writer_writeDouble(writer_t*w, double f)
     w->write(w, &b7, 1);
     w->write(w, &b8, 1);
 }
     w->write(w, &b7, 1);
     w->write(w, &b8, 1);
 }
-
-
index f5196ca..c025191 100644 (file)
@@ -50,7 +50,7 @@ static char* getToken(const char**p)
     else while(**p && !strchr(" ,()\t\n\r", **p)) {
        (*p)++;
     }
     else while(**p && !strchr(" ,()\t\n\r", **p)) {
        (*p)++;
     }
-    result = malloc((*p)-start+1);
+    result = (char*)malloc((*p)-start+1);
     memcpy(result,start,(*p)-start+1);
     result[(*p)-start] = 0;
     return result;
     memcpy(result,start,(*p)-start+1);
     result[(*p)-start] = 0;
     return result;
index 64461a4..85af571 100644 (file)
@@ -24,6 +24,7 @@
 #include "../config.h"
 #include "gfxdevice.h"
 #include "gfxtools.h"
 #include "../config.h"
 #include "gfxdevice.h"
 #include "gfxtools.h"
+#include "gfxfont.h"
 
 static int loadfont_scale = 64;
 static int full_unicode = 1;
 
 static int loadfont_scale = 64;
 static int full_unicode = 1;
@@ -149,7 +150,6 @@ gfxfont_t* gfxfont_load(char*id, char*filename, unsigned int flags, double quali
     int t;
     int*glyph2glyph = 0;
     int*glyph2unicode = 0;
     int t;
     int*glyph2glyph = 0;
     int*glyph2unicode = 0;
-    FT_Size size;
     int max_unicode = 0;
     int charmap = -1;
     int isunicode = 1;
     int max_unicode = 0;
     int charmap = -1;
     int isunicode = 1;
@@ -177,7 +177,7 @@ gfxfont_t* gfxfont_load(char*id, char*filename, unsigned int flags, double quali
        return 0;
     }
 
        return 0;
     }
 
-    font = rfx_calloc(sizeof(gfxfont_t));
+    font = (gfxfont_t*)rfx_calloc(sizeof(gfxfont_t));
     //font->style =  ((face->style_flags&FT_STYLE_FLAG_ITALIC)?FONT_STYLE_ITALIC:0) |((face->style_flags&FT_STYLE_FLAG_BOLD)?FONT_STYLE_BOLD:0);
     //font->ascent = abs(face->ascender)*FT_SCALE*loadfont_scale*20/FT_SUBPIXELS/2; //face->bbox.xMin;
     //font->descent = abs(face->descender)*FT_SCALE*loadfont_scale*20/FT_SUBPIXELS/2; //face->bbox.xMax;
     //font->style =  ((face->style_flags&FT_STYLE_FLAG_ITALIC)?FONT_STYLE_ITALIC:0) |((face->style_flags&FT_STYLE_FLAG_BOLD)?FONT_STYLE_BOLD:0);
     //font->ascent = abs(face->ascender)*FT_SCALE*loadfont_scale*20/FT_SUBPIXELS/2; //face->bbox.xMin;
     //font->descent = abs(face->descender)*FT_SCALE*loadfont_scale*20/FT_SUBPIXELS/2; //face->bbox.xMax;
@@ -186,9 +186,9 @@ gfxfont_t* gfxfont_load(char*id, char*filename, unsigned int flags, double quali
     font->max_unicode = 0;
     font->id = strdup(id);
     
     font->max_unicode = 0;
     font->id = strdup(id);
     
-    font->glyphs = rfx_calloc(face->num_glyphs*sizeof(gfxglyph_t));
-    glyph2unicode = rfx_calloc(face->num_glyphs*sizeof(int));
-    glyph2glyph = rfx_calloc(face->num_glyphs*sizeof(int));
+    font->glyphs = (gfxglyph_t*)rfx_calloc(face->num_glyphs*sizeof(gfxglyph_t));
+    glyph2unicode = (int*)rfx_calloc(face->num_glyphs*sizeof(int));
+    glyph2glyph = (int*)rfx_calloc(face->num_glyphs*sizeof(int));
 
     if(FT_HAS_GLYPH_NAMES(face)) {
        //font->glyphnames = rfx_calloc(face->num_glyphs*sizeof(char*));
 
     if(FT_HAS_GLYPH_NAMES(face)) {
        //font->glyphnames = rfx_calloc(face->num_glyphs*sizeof(char*));
@@ -263,7 +263,7 @@ gfxfont_t* gfxfont_load(char*id, char*filename, unsigned int flags, double quali
     if(full_unicode)
        font->max_unicode = 65535;
     
     if(full_unicode)
        font->max_unicode = 65535;
     
-    font->unicode2glyph = rfx_calloc(font->max_unicode*sizeof(int));
+    font->unicode2glyph = (int*)rfx_calloc(font->max_unicode*sizeof(int));
     
     for(t=0;t<font->max_unicode;t++) {
        int g = FT_Get_Char_Index(face, t);
     
     for(t=0;t<font->max_unicode;t++) {
        int g = FT_Get_Char_Index(face, t);
@@ -298,12 +298,9 @@ gfxfont_t* gfxfont_load(char*id, char*filename, unsigned int flags, double quali
 
     for(t=0; t < face->num_glyphs; t++) {
        FT_Glyph glyph;
 
     for(t=0; t < face->num_glyphs; t++) {
        FT_Glyph glyph;
-       FT_BBox bbox;
-       FT_Matrix matrix;
        char name[128];
        gfxdrawer_t draw;
        gfxdrawinfo_t info;
        char name[128];
        gfxdrawer_t draw;
        gfxdrawinfo_t info;
-       int ret;
        char hasname = 0;
        int omit = 0;
        name[0]=0;
        char hasname = 0;
        int omit = 0;
        name[0]=0;
@@ -442,7 +439,7 @@ gfxfont_t* gfxfont_load(char*id, char*filename, unsigned int flags, double quali
           so that the encoding equals the char position, and
           remove the unicode table */
        int t;
           so that the encoding equals the char position, and
           remove the unicode table */
        int t;
-       gfxglyph_t*newglyphs = rfx_calloc(font->max_unicode*sizeof(gfxglyph_t));
+       gfxglyph_t*newglyphs = (gfxglyph_t*)rfx_calloc(font->max_unicode*sizeof(gfxglyph_t));
 
        for(t=0;t<max_unicode;t++) {
            int c = font->unicode2glyph[t];
 
        for(t=0;t<max_unicode;t++) {
            int c = font->unicode2glyph[t];
index cbe0017..5600776 100644 (file)
@@ -24,6 +24,7 @@
 #include <stdlib.h>
 #include <memory.h>
 #include <math.h>
 #include <stdlib.h>
 #include <memory.h>
 #include <math.h>
+#include <string.h>
 #include <assert.h>
 #include "gfxtools.h"
 #include "gfxfont.h"
 #include <assert.h>
 #include "gfxtools.h"
 #include "gfxfont.h"
@@ -37,7 +38,7 @@ typedef struct _linedraw_internal
 static void linedraw_moveTo(gfxdrawer_t*d, gfxcoord_t x, gfxcoord_t y)
 {
     linedraw_internal_t*i = (linedraw_internal_t*)d->internal;
 static void linedraw_moveTo(gfxdrawer_t*d, gfxcoord_t x, gfxcoord_t y)
 {
     linedraw_internal_t*i = (linedraw_internal_t*)d->internal;
-    gfxline_t*l = rfx_alloc(sizeof(gfxline_t));
+    gfxline_t*l = (gfxline_t*)rfx_alloc(sizeof(gfxline_t));
     l->type = gfx_moveTo;
     if((int)((d->x * 5120) == (int)(x * 5120)) &&
        (int)((d->y * 5120) == (int)(y * 5120))) {
     l->type = gfx_moveTo;
     if((int)((d->x * 5120) == (int)(x * 5120)) &&
        (int)((d->y * 5120) == (int)(y * 5120))) {
@@ -58,7 +59,7 @@ static void linedraw_moveTo(gfxdrawer_t*d, gfxcoord_t x, gfxcoord_t y)
 static void linedraw_lineTo(gfxdrawer_t*d, gfxcoord_t x, gfxcoord_t y)
 {
     linedraw_internal_t*i = (linedraw_internal_t*)d->internal;
 static void linedraw_lineTo(gfxdrawer_t*d, gfxcoord_t x, gfxcoord_t y)
 {
     linedraw_internal_t*i = (linedraw_internal_t*)d->internal;
-    gfxline_t*l = rfx_alloc(sizeof(gfxline_t));
+    gfxline_t*l = (gfxline_t*)rfx_alloc(sizeof(gfxline_t));
 
     if(!i->start) {
        /* starts with a line, not with a moveto. That needs we first
 
     if(!i->start) {
        /* starts with a line, not with a moveto. That needs we first
@@ -80,7 +81,7 @@ static void linedraw_lineTo(gfxdrawer_t*d, gfxcoord_t x, gfxcoord_t y)
 static void linedraw_splineTo(gfxdrawer_t*d, gfxcoord_t sx, gfxcoord_t sy, gfxcoord_t x, gfxcoord_t y)
 {
     linedraw_internal_t*i = (linedraw_internal_t*)d->internal;
 static void linedraw_splineTo(gfxdrawer_t*d, gfxcoord_t sx, gfxcoord_t sy, gfxcoord_t x, gfxcoord_t y)
 {
     linedraw_internal_t*i = (linedraw_internal_t*)d->internal;
-    gfxline_t*l = rfx_alloc(sizeof(gfxline_t));
+    gfxline_t*l = (gfxline_t*)rfx_alloc(sizeof(gfxline_t));
 
     if(!i->start) {
        /* starts with a line, not with a moveto. That needs we first
 
     if(!i->start) {
        /* starts with a line, not with a moveto. That needs we first
@@ -305,7 +306,7 @@ gfxline_t * gfxline_clone(gfxline_t*line)
     gfxline_t*dest = 0;
     gfxline_t*pos = 0;
     while(line) {
     gfxline_t*dest = 0;
     gfxline_t*pos = 0;
     while(line) {
-       gfxline_t*n = rfx_calloc(sizeof(gfxline_t));
+       gfxline_t*n = (gfxline_t*)rfx_calloc(sizeof(gfxline_t));
        *n = *line;
        n->next = 0;
        if(!pos) {
        *n = *line;
        n->next = 0;
        if(!pos) {
index 678d578..1b075ff 100644 (file)
@@ -1393,7 +1393,7 @@ void test_copy_diff()
     VIDEOSTREAM stream;
     VIDEOSTREAM* s = &stream;
     TAG*tag;
     VIDEOSTREAM stream;
     VIDEOSTREAM* s = &stream;
     TAG*tag;
-    RGBA*pic = rfx_alloc(256*256*sizeof(RGBA));
+    RGBA*pic = (RGBA*)rfx_alloc(256*256*sizeof(RGBA));
     block_t fb;
     int x,y;
     int bx,by;
     block_t fb;
     int x,y;
     int bx,by;
index 98f4b1d..b78a326 100644 (file)
--- a/lib/mem.c
+++ b/lib/mem.c
@@ -1,6 +1,7 @@
 #include <memory.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <memory.h>
 #include <stdio.h>
 #include <stdlib.h>
+#include "mem.h"
 
 // memory allocation
 
 
 // memory allocation
 
index 70ddf3e..9a44798 100644 (file)
@@ -167,7 +167,7 @@ ActionTAG* swf_ActionGet(TAG*tag)
            length = swf_GetU16(tag);
 
        if(length) {
            length = swf_GetU16(tag);
 
        if(length) {
-           data = rfx_alloc(length);
+           data = (U8*)rfx_alloc(length);
            swf_GetBlock(tag, data, length);
        } else {
          data = 0;
            swf_GetBlock(tag, data, length);
        } else {
          data = 0;
@@ -228,13 +228,13 @@ int OpAdvance(char c, U8*data)
        case 'f':
            return 2;
        case 'u':
        case 'f':
            return 2;
        case 'u':
-           return strlen(data)+1;
+           return strlen((const char*)data)+1;
        case 't':
        case 't':
-           return strlen(data)+1;
+           return strlen((const char*)data)+1;
        case 'l': 
        case 'l': 
-           return strlen(data)+1;
+           return strlen((const char*)data)+1;
        case 'c': 
        case 'c': 
-           return strlen(data)+1;
+           return strlen((const char*)data)+1;
        case 'C': 
            return 2;
        case 's':
        case 'C': 
            return 2;
        case 's':
@@ -248,7 +248,7 @@ int OpAdvance(char c, U8*data)
        case 'p': {
            U8 type = *data++;
            if(type == 0) {
        case 'p': {
            U8 type = *data++;
            if(type == 0) {
-               return 1+strlen(data)+1; //string
+               return 1+strlen((const char*)data)+1; //string
            } else if (type == 1) {
                return 1+4; //float
            } else if (type == 2) {
            } else if (type == 1) {
                return 1+4; //float
            } else if (type == 2) {
@@ -352,7 +352,7 @@ void swf_DumpActions(ActionTAG*atag, char*prefix)
                      printf(" String:\"%s\"", data);
 #ifdef MAX_LOOKUP
                      if (entry<MAX_LOOKUP)
                      printf(" String:\"%s\"", data);
 #ifdef MAX_LOOKUP
                      if (entry<MAX_LOOKUP)
-                       lookup[entry++] = strdup(data);
+                       lookup[entry++] = strdup((const char*)data);
 #endif
                  } break;
                  case 'C': {
 #endif
                  } break;
                  case 'C': {
@@ -440,10 +440,10 @@ void swf_DumpActions(ActionTAG*atag, char*prefix)
                          printf(" bool:%s", *value?"true":"false");
                      } else if (type == 6) {
                          U8 a[8];
                          printf(" bool:%s", *value?"true":"false");
                      } else if (type == 6) {
                          U8 a[8];
-                         int t;
                          memcpy(&a[4],value,4);
                          memcpy(a,&value[4],4);
 #ifdef WORDS_BIGENDIAN
                          memcpy(&a[4],value,4);
                          memcpy(a,&value[4],4);
 #ifdef WORDS_BIGENDIAN
+                         int t;
                          for(t=0;t<4;t++) {
                              U8 tmp = a[t];
                              a[t]=a[7-t];
                          for(t=0;t<4;t++) {
                              U8 tmp = a[t];
                              a[t]=a[7-t];
@@ -556,25 +556,25 @@ int swf_ActionEnumerate(ActionTAG*atag, char*(*callback)(char*), int type)
                    case 'u': {
                        if(type&TYPE_URL)
                        {
                    case 'u': {
                        if(type&TYPE_URL)
                        {
-                           replacelen = strlen(data);
+                           replacelen = strlen((const char*)data);
                            replacepos = data;
                            replacepos = data;
-                           replacement = callback(data); // may be null
+                           replacement = (U8*)callback((char*)data); // may be null
                        }
                    } break;
                    case 't': {
                        if(type&TYPE_TARGET)
                        {
                        }
                    } break;
                    case 't': {
                        if(type&TYPE_TARGET)
                        {
-                           replacelen = strlen(data);
+                           replacelen = strlen((const char*)data);
                            replacepos = data;
                            replacepos = data;
-                           replacement = callback(data); // may be null
+                           replacement = (U8*)callback((char*)data); // may be null
                        }
                    } break;
                    case 'c': {
                        if(type&TYPE_STRING)
                        {
                        }
                    } break;
                    case 'c': {
                        if(type&TYPE_STRING)
                        {
-                           replacelen = strlen(data);
+                           replacelen = strlen((const char*)data);
                            replacepos = data;
                            replacepos = data;
-                           replacement = callback(data); // may be null
+                           replacement = (U8*)callback((char*)data); // may be null
                        }
                    } break;
                    case 'C': {
                        }
                    } break;
                    case 'C': {
@@ -584,13 +584,13 @@ int swf_ActionEnumerate(ActionTAG*atag, char*(*callback)(char*), int type)
                    } break;
                    case 'p': {
                        U8 datatype = *data;
                    } break;
                    case 'p': {
                        U8 datatype = *data;
-                       char*value = &data[1];
+                       char*value = (char*)&data[1];
                        if(datatype == 0) { //string
                            if(type&TYPE_STRING)
                            {
                                replacelen = strlen(value);
                        if(datatype == 0) { //string
                            if(type&TYPE_STRING)
                            {
                                replacelen = strlen(value);
-                               replacepos = value;
-                               replacement = callback(value); // may be null
+                               replacepos = (U8*)value;
+                               replacement = (U8*)callback(value); // may be null
                            }
                        } else if (datatype == 8) { //lookup
                        }
                            }
                        } else if (datatype == 8) { //lookup
                        }
@@ -604,15 +604,15 @@ int swf_ActionEnumerate(ActionTAG*atag, char*(*callback)(char*), int type)
 
                if(replacement)
                {
 
                if(replacement)
                {
-                   int newlen = strlen(replacement);
-                   char * newdata = rfx_alloc(atag->len - replacelen + newlen);
+                   int newlen = strlen((const char *)replacement);
+                   char * newdata = (char*)rfx_alloc(atag->len - replacelen + newlen);
                    int rpos = replacepos - atag->data;
                    memcpy(newdata, atag->data, rpos);
                    memcpy(&newdata[rpos], replacement, newlen);
                    memcpy(&newdata[rpos+newlen], &replacepos[replacelen],
                            &data[atag->len] - &replacepos[replacelen]);
                    rfx_free(atag->data);
                    int rpos = replacepos - atag->data;
                    memcpy(newdata, atag->data, rpos);
                    memcpy(&newdata[rpos], replacement, newlen);
                    memcpy(&newdata[rpos+newlen], &replacepos[replacelen],
                            &data[atag->len] - &replacepos[replacelen]);
                    rfx_free(atag->data);
-                   atag->data = newdata;
+                   atag->data = (U8*)newdata;
                    data = &atag->data[rpos+newlen+1];
                }
            }
                    data = &atag->data[rpos+newlen+1];
                }
            }
@@ -1011,7 +1011,7 @@ ActionTAG* action_PushLookup16(ActionTAG*atag, U16 index)
 {
     atag = swf_AddActionTAG(atag, ACTION_PUSH, 0, 3);
     *(U8*)atag->tmp = 9; //lookup
 {
     atag = swf_AddActionTAG(atag, ACTION_PUSH, 0, 3);
     *(U8*)atag->tmp = 9; //lookup
-    *(U8*)&atag->tmp[1] = index;
+    *(U8*)&atag->tmp[1] = (U8)index;
     *(U8*)&atag->tmp[2] = index>>8;
     return atag;
 }
     *(U8*)&atag->tmp[2] = index>>8;
     return atag;
 }
@@ -1071,10 +1071,10 @@ ActionTAG* action_GetUrl(ActionTAG*atag, const char* url, char* label)
 {
     int l1= strlen(url);
     int l2= strlen(label);
 {
     int l1= strlen(url);
     int l2= strlen(label);
-    char*ptr = rfx_alloc(l1+l2+2);
+    char*ptr = (char*)rfx_alloc(l1+l2+2);
     strcpy(ptr, url);
     strcpy(&ptr[l1+1], label);
     strcpy(ptr, url);
     strcpy(&ptr[l1+1], label);
-    return swf_AddActionTAG(atag, ACTION_GETURL, ptr, l1+l2+2);
+    return swf_AddActionTAG(atag, ACTION_GETURL, (U8*)ptr, l1+l2+2);
 }
 //TODO:
 ActionTAG* action_DefineFunction(ActionTAG*atag, U8*data, int len) {return atag;}
 }
 //TODO:
 ActionTAG* action_DefineFunction(ActionTAG*atag, U8*data, int len) {return atag;}
@@ -1096,7 +1096,7 @@ ActionTAG* swf_ActionCompile(const char* source, int version)
     if(!ret || buffer==0 || len == 0)
        return 0;
 
     if(!ret || buffer==0 || len == 0)
        return 0;
 
-    swf_SetBlock(tag, buffer, len);
+    swf_SetBlock(tag, (U8*)buffer, len);
     swf_SetU8(tag, 0);
 
     rfx_free(buffer);
     swf_SetU8(tag, 0);
 
     rfx_free(buffer);
index 5327d68..bbd8641 100644 (file)
    along with this program; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
 
    along with this program; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+#include "jpeglib.h"
+#ifdef __cplusplus
+}
+#endif
+
 #define OUTBUFFER_SIZE 0x8000
 
 int swf_ImageHasAlpha(RGBA*img, int width, int height)
 #define OUTBUFFER_SIZE 0x8000
 
 int swf_ImageHasAlpha(RGBA*img, int width, int height)
@@ -112,7 +120,7 @@ int swf_ImageGetNumberOfPaletteEntries(RGBA*img, int width, int height, RGBA*pal
     int palette_overflow = 0;
     U32 lastcol32 = 0;
 
     int palette_overflow = 0;
     U32 lastcol32 = 0;
 
-    pal = malloc(65536*sizeof(U32));
+    pal = (U32*)malloc(65536*sizeof(U32));
 
     memset(size, 0, sizeof(size));
 
 
     memset(size, 0, sizeof(size));
 
@@ -468,7 +476,7 @@ void swf_SaveJPEG(char*filename, RGBA*pixels, int width, int height, int quality
        perror(buf);
        return;
     }
        perror(buf);
        return;
     }
-    data2 = rfx_calloc(width*3);
+    data2 = (unsigned char *)rfx_calloc(width*3);
 
     memset(&cinfo, 0, sizeof(cinfo));
     memset(&jerr, 0, sizeof(jerr));
 
     memset(&cinfo, 0, sizeof(cinfo));
     memset(&jerr, 0, sizeof(jerr));
@@ -602,7 +610,7 @@ RGBA *swf_JPEG2TagToImage(TAG * tag, int *width, int *height)
     jpeg_read_header(&cinfo, TRUE);
     *width = cinfo.image_width;
     *height = cinfo.image_height;
     jpeg_read_header(&cinfo, TRUE);
     *width = cinfo.image_width;
     *height = cinfo.image_height;
-    dest =
+    dest = (RGBA*)
        rfx_alloc(sizeof(RGBA) * cinfo.image_width * cinfo.image_height);
 
     jpeg_start_decompress(&cinfo);
        rfx_alloc(sizeof(RGBA) * cinfo.image_width * cinfo.image_height);
 
     jpeg_start_decompress(&cinfo);
@@ -660,7 +668,7 @@ RGBA *swf_JPEG2TagToImage(TAG * tag, int *width, int *height)
 
 int RFXSWF_deflate_wraper(TAG * t, z_stream * zs, boolean finish)
 {
 
 int RFXSWF_deflate_wraper(TAG * t, z_stream * zs, boolean finish)
 {
-    U8 *data = rfx_alloc(OUTBUFFER_SIZE);
+    U8 *data = (U8*)rfx_alloc(OUTBUFFER_SIZE);
     zs->next_out = data;
     zs->avail_out = OUTBUFFER_SIZE;
     while (1) {
     zs->next_out = data;
     zs->avail_out = OUTBUFFER_SIZE;
     while (1) {
@@ -716,7 +724,7 @@ int swf_SetLosslessBits(TAG * t, U16 width, U16 height, void *bitmap, U8 bitmap_
 
     switch (bitmap_flags) {
     case BMF_8BIT:
 
     switch (bitmap_flags) {
     case BMF_8BIT:
-       return swf_SetLosslessBitsIndexed(t, width, height, bitmap, NULL, 256);
+       return swf_SetLosslessBitsIndexed(t, width, height, (U8*)bitmap, NULL, 256);
     case BMF_16BIT:
        bps = BYTES_PER_SCANLINE(sizeof(U16) * width);
        break;
     case BMF_16BIT:
        bps = BYTES_PER_SCANLINE(sizeof(U16) * width);
        break;
@@ -741,7 +749,7 @@ int swf_SetLosslessBits(TAG * t, U16 width, U16 height, void *bitmap, U8 bitmap_
 
        if (deflateInit(&zs, Z_DEFAULT_COMPRESSION) == Z_OK) {
            zs.avail_in = bps * height;
 
        if (deflateInit(&zs, Z_DEFAULT_COMPRESSION) == Z_OK) {
            zs.avail_in = bps * height;
-           zs.next_in = bitmap;
+           zs.next_in = (Bytef *)bitmap;
 
            if (RFXSWF_deflate_wraper(t, &zs, TRUE) < 0)
                res = -3;
 
            if (RFXSWF_deflate_wraper(t, &zs, TRUE) < 0)
                res = -3;
@@ -762,7 +770,7 @@ int swf_SetLosslessBitsIndexed(TAG * t, U16 width, U16 height, U8 * bitmap, RGBA
     if (!pal)                  // create default palette for grayscale images
     {
        int i;
     if (!pal)                  // create default palette for grayscale images
     {
        int i;
-       pal = rfx_alloc(256 * sizeof(RGBA));
+       pal = (RGBA*)rfx_alloc(256 * sizeof(RGBA));
        for (i = 0; i < 256; i++) {
            pal[i].r = pal[i].g = pal[i].b = i;
            pal[i].a = 0xff;
        for (i = 0; i < 256; i++) {
            pal[i].r = pal[i].g = pal[i].b = i;
            pal[i].a = 0xff;
@@ -790,7 +798,7 @@ int swf_SetLosslessBitsIndexed(TAG * t, U16 width, U16 height, U8 * bitmap, RGBA
 
        if (deflateInit(&zs, Z_DEFAULT_COMPRESSION) == Z_OK) {
            U8 *zpal;           // compress palette
 
        if (deflateInit(&zs, Z_DEFAULT_COMPRESSION) == Z_OK) {
            U8 *zpal;           // compress palette
-           if ((zpal = rfx_alloc(ncolors * 4))) {
+           if ((zpal = (U8*)rfx_alloc(ncolors * 4))) {
                U8 *pp = zpal;
                int i;
 
                U8 *pp = zpal;
                int i;
 
@@ -956,7 +964,7 @@ RGBA *swf_DefineLosslessBitsTagToImage(TAG * tag, int *dwidth, int *dheight)
     *dwidth = width = swf_GetU16(tag);
     *dheight = height = swf_GetU16(tag);
 
     *dwidth = width = swf_GetU16(tag);
     *dheight = height = swf_GetU16(tag);
 
-    dest = rfx_alloc(sizeof(RGBA) * width * height);
+    dest = (RGBA*)rfx_alloc(sizeof(RGBA) * width * height);
 
     if (format == 3)
        cols = swf_GetU8(tag) + 1;
 
     if (format == 3)
        cols = swf_GetU8(tag) + 1;
@@ -969,7 +977,7 @@ RGBA *swf_DefineLosslessBitsTagToImage(TAG * tag, int *dwidth, int *dheight)
        if (data)
            rfx_free(data);
        datalen += 4096;
        if (data)
            rfx_free(data);
        datalen += 4096;
-       data = rfx_alloc(datalen);
+       data = (U8*)rfx_alloc(datalen);
        error =
            uncompress(data, &datalen, &tag->data[tag->pos],
                       tag->len - tag->pos);
        error =
            uncompress(data, &datalen, &tag->data[tag->pos],
                       tag->len - tag->pos);
@@ -1073,7 +1081,7 @@ int swf_SetJPEGBits3(TAG * tag, U16 width, U16 height, RGBA * bitmap, int qualit
     swf_SetJPEGBitsFinish(jpeg);
     PUT32(&tag->data[pos], tag->len - pos - 4);
 
     swf_SetJPEGBitsFinish(jpeg);
     PUT32(&tag->data[pos], tag->len - pos - 4);
 
-    data = rfx_alloc(OUTBUFFER_SIZE);
+    data = (U8*)rfx_alloc(OUTBUFFER_SIZE);
     memset(&zs, 0x00, sizeof(z_stream));
 
     if (deflateInit(&zs, Z_DEFAULT_COMPRESSION) != Z_OK) {
     memset(&zs, 0x00, sizeof(z_stream));
 
     if (deflateInit(&zs, Z_DEFAULT_COMPRESSION) != Z_OK) {
@@ -1221,7 +1229,7 @@ void swf_RemoveJPEGTables(SWF * swf)
        if (tag->id == ST_DEFINEBITSJPEG) {
            int len = tag->len;
            void *data = rfx_alloc(len);
        if (tag->id == ST_DEFINEBITSJPEG) {
            int len = tag->len;
            void *data = rfx_alloc(len);
-           swf_GetBlock(tag, data, tag->len);
+           swf_GetBlock(tag, (U8*)data, tag->len);
            swf_ResetTag(tag, ST_DEFINEBITSJPEG2);
            swf_SetBlock(tag, &((U8*)data)[0], 2); //id
            swf_SetBlock(tag, tables_tag->data, tables_tag->len);
            swf_ResetTag(tag, ST_DEFINEBITSJPEG2);
            swf_SetBlock(tag, &((U8*)data)[0], 2); //id
            swf_SetBlock(tag, tables_tag->data, tables_tag->len);
@@ -1248,7 +1256,7 @@ static int bicubic = 0;
 
 static scale_lookup_t**make_scale_lookup(int width, int newwidth)
 {
 
 static scale_lookup_t**make_scale_lookup(int width, int newwidth)
 {
-    scale_lookup_t*lookupx = malloc((width>newwidth?width:newwidth)*2*sizeof(scale_lookup_t));
+    scale_lookup_t*lookupx = (scale_lookup_t*)malloc((width>newwidth?width:newwidth)*2*sizeof(scale_lookup_t));
     scale_lookup_t**lblockx = (scale_lookup_t**)malloc((newwidth+1)*sizeof(scale_lookup_t**));
     double fx = ((double)width)/((double)newwidth);
     double px = 0;
     scale_lookup_t**lblockx = (scale_lookup_t**)malloc((newwidth+1)*sizeof(scale_lookup_t**));
     double fx = ((double)width)/((double)newwidth);
     double px = 0;
index fec09e3..21ca7ff 100644 (file)
@@ -69,15 +69,15 @@ static void swf_cgienv(unsigned char * var)
   // fprintf(stderr,"%s\n",var);
 
   
   // fprintf(stderr,"%s\n",var);
 
   
-  buf = (unsigned char*)rfx_alloc(strlen(var) + sizeof(PREFIX) + 2);
+  buf = (unsigned char*)rfx_alloc(strlen((const char*)var) + sizeof(PREFIX) + 2);
   if (!buf) return;
 
   if (!buf) return;
 
-  strcpy(buf, PREFIX);
+  strcpy((char*)buf, (const char*)PREFIX);
   if (var[0] == '_')
   if (var[0] == '_')
-  { strcpy(&buf[sizeof(PREFIX)-1], &var[1]);
+  { strcpy((char*)&buf[sizeof(PREFIX)-1], (const char*)&var[1]);
     despace = 1;
   }
     despace = 1;
   }
-  else strcpy(&buf[sizeof(PREFIX)-1], var);
+  else strcpy((char*)&buf[sizeof(PREFIX)-1], (const char*)var);
 
   for (c = buf; c[0] ; c++)
   { if (c[0] == '.') c[0] = '_';
 
   for (c = buf; c[0] ; c++)
   { if (c[0] == '.') c[0] = '_';
@@ -106,22 +106,22 @@ static void swf_cgienv(unsigned char * var)
     t[1] = 0;
   }
 
     t[1] = 0;
   }
 
-  if ((oldval = getenv(buf)))
-  { newval = (unsigned char*)rfx_alloc(strlen(oldval) + strlen(buf) + strlen(&c[1]) + 3);
+  if ((oldval = (unsigned char*)getenv((const char*)buf)))
+  { newval = (unsigned char*)rfx_alloc(strlen((const char*)oldval) + strlen((const char *)buf) + strlen((const char*)&c[1]) + 3);
     if (!newval) return;
 
     c[0] = '=';
     if (!newval) return;
 
     c[0] = '=';
-    sprintf(newval, "%s#%s", buf, oldval);
+    sprintf((char*)newval, "%s#%s", buf, oldval);
     c[0] = 0;
 
     c[0] = 0;
 
-    oldval -= strlen(buf) + 1; // skip past VAR= 
+    oldval -= strlen((const char*)buf) + 1; // skip past VAR= 
   }
   else 
   { c[0] = '=';
     newval = buf;
   }
   
   }
   else 
   { c[0] = '=';
     newval = buf;
   }
   
-  putenv(newval);
+  putenv((const char *)newval);
         
   if (oldval)
   { rfx_free(oldval);
         
   if (oldval)
   { rfx_free(oldval);
@@ -136,7 +136,7 @@ static void swf_scanquery(char * q)
   while (next)
   { next = strchr(q, '&');
     if (next) next[0] = 0;
   while (next)
   { next = strchr(q, '&');
     if (next) next[0] = 0;
-    swf_cgienv(q);
+    swf_cgienv((unsigned char*)q);
     if (next)
     { next[0] = '&';
       q = next+1;
     if (next)
     { next[0] = '&';
       q = next+1;
@@ -155,7 +155,7 @@ char * swf_postread()
   if (!buf) return NULL;
         
   size = atoi(buf);
   if (!buf) return NULL;
         
   size = atoi(buf);
-  buf = (unsigned char*)rfx_alloc(size + 1);
+  buf = (char*)rfx_alloc(size + 1);
   if (buf)
   { do
     { got = fread(buf + sofar, 1, size - sofar, stdin);
   if (buf)
   { do
     { got = fread(buf + sofar, 1, size - sofar, stdin);
index 40aa255..2613e0c 100644 (file)
@@ -23,7 +23,7 @@ static void swf_ShapeDrawerClear(drawer_t*draw);
 
 static void swf_ShapeDrawerInit(drawer_t*draw, TAG*tag, int fillstylebits, int linestylebits)
 {
 
 static void swf_ShapeDrawerInit(drawer_t*draw, TAG*tag, int fillstylebits, int linestylebits)
 {
-    SWFSHAPEDRAWER*sdraw = rfx_calloc(sizeof(SWFSHAPEDRAWER));
+    SWFSHAPEDRAWER*sdraw = (SWFSHAPEDRAWER*)rfx_calloc(sizeof(SWFSHAPEDRAWER));
     draw->internal = sdraw;
 
     draw->setLineStyle = swf_ShapeDrawerSetLineStyle;
     draw->internal = sdraw;
 
     draw->setLineStyle = swf_ShapeDrawerSetLineStyle;
@@ -196,7 +196,7 @@ SRECT swf_ShapeDrawerGetBBox(drawer_t*draw)
 SHAPE* swf_ShapeDrawerToShape(drawer_t*draw)
 {
     SWFSHAPEDRAWER*sdraw = (SWFSHAPEDRAWER*)draw->internal;
 SHAPE* swf_ShapeDrawerToShape(drawer_t*draw)
 {
     SWFSHAPEDRAWER*sdraw = (SWFSHAPEDRAWER*)draw->internal;
-    SHAPE* shape = rfx_alloc(sizeof(SHAPE));
+    SHAPE* shape = (SHAPE*)rfx_alloc(sizeof(SHAPE));
     if(!sdraw->isfinished) {
        fprintf(stderr, "Warning: you should Finish() your drawer before calling DrawerToShape");
        swf_ShapeDrawerFinish(draw);
     if(!sdraw->isfinished) {
        fprintf(stderr, "Warning: you should Finish() your drawer before calling DrawerToShape");
        swf_ShapeDrawerFinish(draw);
index 4a47474..6ca8739 100644 (file)
@@ -56,7 +56,7 @@ FILTER*swf_GetFilter(TAG*tag)
     U8 type = swf_GetU8(tag);
     FILTER*filter;
     if(type == FILTERTYPE_BLUR) {
     U8 type = swf_GetU8(tag);
     FILTER*filter;
     if(type == FILTERTYPE_BLUR) {
-       FILTER_BLUR* f = rfx_calloc(sizeof(FILTER_BLUR));
+       FILTER_BLUR* f = (FILTER_BLUR*)rfx_calloc(sizeof(FILTER_BLUR));
        f->type = type;
        f->blurx = swf_GetFixed(tag);
        f->blury = swf_GetFixed(tag);
        f->type = type;
        f->blurx = swf_GetFixed(tag);
        f->blury = swf_GetFixed(tag);
@@ -64,12 +64,12 @@ FILTER*swf_GetFilter(TAG*tag)
        f->passes = (flags&15)<<3;
        return (FILTER*)f;
     } else if(type == FILTERTYPE_GRADIENTGLOW) {
        f->passes = (flags&15)<<3;
        return (FILTER*)f;
     } else if(type == FILTERTYPE_GRADIENTGLOW) {
-       FILTER_GRADIENTGLOW* f = rfx_calloc(sizeof(FILTER_GRADIENTGLOW));
+       FILTER_GRADIENTGLOW* f = (FILTER_GRADIENTGLOW*)rfx_calloc(sizeof(FILTER_GRADIENTGLOW));
        f->type = type;
        f->type = type;
-       f->gradient = rfx_calloc(sizeof(GRADIENT));
+       f->gradient = (GRADIENT*)rfx_calloc(sizeof(GRADIENT));
        f->gradient->num = swf_GetU8(tag);
        f->gradient->num = swf_GetU8(tag);
-       f->gradient->rgba = rfx_calloc(sizeof(RGBA)*f->gradient->num);
-       f->gradient->ratios = rfx_calloc(sizeof(U8)*f->gradient->num);
+       f->gradient->rgba = (RGBA*)rfx_calloc(sizeof(RGBA)*f->gradient->num);
+       f->gradient->ratios = (U8*)rfx_calloc(sizeof(U8)*f->gradient->num);
        int s;
        for(s=0;s<f->gradient->num;s++)
            swf_GetRGBA(tag, &f->gradient->rgba[s]);
        int s;
        for(s=0;s<f->gradient->num;s++)
            swf_GetRGBA(tag, &f->gradient->rgba[s]);
@@ -89,7 +89,7 @@ FILTER*swf_GetFilter(TAG*tag)
        f->ontop = (flags>>4)&1;
        return (FILTER*)f;
     } else if(type == FILTERTYPE_DROPSHADOW) {
        f->ontop = (flags>>4)&1;
        return (FILTER*)f;
     } else if(type == FILTERTYPE_DROPSHADOW) {
-       FILTER_DROPSHADOW* f = rfx_calloc(sizeof(FILTER_DROPSHADOW));
+       FILTER_DROPSHADOW* f = (FILTER_DROPSHADOW*)rfx_calloc(sizeof(FILTER_DROPSHADOW));
        f->type = type;
        swf_GetRGBA(tag, &f->color);
        f->blurx = swf_GetFixed(tag);
        f->type = type;
        swf_GetRGBA(tag, &f->color);
        f->blurx = swf_GetFixed(tag);
@@ -104,7 +104,7 @@ FILTER*swf_GetFilter(TAG*tag)
        f->composite = (flags>>5)&1;
        return (FILTER*)f;
     } else if(type == FILTERTYPE_BEVEL) {
        f->composite = (flags>>5)&1;
        return (FILTER*)f;
     } else if(type == FILTERTYPE_BEVEL) {
-       FILTER_BEVEL* f = rfx_calloc(sizeof(FILTER_BEVEL));
+       FILTER_BEVEL* f = (FILTER_BEVEL*)rfx_calloc(sizeof(FILTER_BEVEL));
        f->type = type;
        swf_GetRGBA(tag, &f->shadow);
        swf_GetRGBA(tag, &f->highlight);
        f->type = type;
        swf_GetRGBA(tag, &f->shadow);
        swf_GetRGBA(tag, &f->highlight);
@@ -130,13 +130,13 @@ FILTER*swf_NewFilter(U8 type)
 {
     FILTER*f = 0;
     if(type == FILTERTYPE_BLUR)
 {
     FILTER*f = 0;
     if(type == FILTERTYPE_BLUR)
-       f = rfx_calloc(sizeof(FILTER_BLUR));
+       f = (FILTER*)rfx_calloc(sizeof(FILTER_BLUR));
     else if(type == FILTERTYPE_GRADIENTGLOW)
     else if(type == FILTERTYPE_GRADIENTGLOW)
-       f = rfx_calloc(sizeof(FILTER_GRADIENTGLOW));
+       f = (FILTER*)rfx_calloc(sizeof(FILTER_GRADIENTGLOW));
     else if(type == FILTERTYPE_DROPSHADOW)
     else if(type == FILTERTYPE_DROPSHADOW)
-       f = rfx_calloc(sizeof(FILTER_DROPSHADOW));
+       f = (FILTER*)rfx_calloc(sizeof(FILTER_DROPSHADOW));
     else if(type == FILTERTYPE_BEVEL)
     else if(type == FILTERTYPE_BEVEL)
-       f = rfx_calloc(sizeof(FILTER_BEVEL));
+       f = (FILTER*)rfx_calloc(sizeof(FILTER_BEVEL));
     else 
        fprintf(stderr, "Creation of filter type %02x not supported yet\n", type);
     if(f)
     else 
        fprintf(stderr, "Creation of filter type %02x not supported yet\n", type);
     if(f)
index e7ad1df..c8c3efa 100644 (file)
@@ -146,19 +146,19 @@ SWFFONT* swf_LoadTrueTypeFont(char*filename)
        return 0;
     }
 
        return 0;
     }
 
-    font = rfx_calloc(sizeof(SWFFONT));
+    font = (SWFFONT*)rfx_calloc(sizeof(SWFFONT));
     font->id = -1;
     font->version = 2;
     font->id = -1;
     font->version = 2;
-    font->layout = rfx_calloc(sizeof(SWFLAYOUT));
-    font->layout->bounds = rfx_calloc(face->num_glyphs*sizeof(SRECT));
+    font->layout = (SWFLAYOUT*)rfx_calloc(sizeof(SWFLAYOUT));
+    font->layout->bounds = (SRECT*)rfx_calloc(face->num_glyphs*sizeof(SRECT));
     font->style =  ((face->style_flags&FT_STYLE_FLAG_ITALIC)?FONT_STYLE_ITALIC:0)
                  |((face->style_flags&FT_STYLE_FLAG_BOLD)?FONT_STYLE_BOLD:0);
     font->encoding = FONT_ENCODING_UNICODE;
     font->style =  ((face->style_flags&FT_STYLE_FLAG_ITALIC)?FONT_STYLE_ITALIC:0)
                  |((face->style_flags&FT_STYLE_FLAG_BOLD)?FONT_STYLE_BOLD:0);
     font->encoding = FONT_ENCODING_UNICODE;
-    font->glyph2ascii = rfx_calloc(face->num_glyphs*sizeof(U16));
+    font->glyph2ascii = (U16*)rfx_calloc(face->num_glyphs*sizeof(U16));
     font->maxascii = 0;
     font->maxascii = 0;
-    font->glyph = rfx_calloc(face->num_glyphs*sizeof(SWFGLYPH));
+    font->glyph = (SWFGLYPH*)rfx_calloc(face->num_glyphs*sizeof(SWFGLYPH));
     if(FT_HAS_GLYPH_NAMES(face)) {
     if(FT_HAS_GLYPH_NAMES(face)) {
-       font->glyphnames = rfx_calloc(face->num_glyphs*sizeof(char*));
+       font->glyphnames = (char**)rfx_calloc(face->num_glyphs*sizeof(char*));
     }
 
     font->layout->ascent = abs(face->ascender)*FT_SCALE*loadfont_scale*20/FT_SUBPIXELS/2; //face->bbox.xMin;
     }
 
     font->layout->ascent = abs(face->ascender)*FT_SCALE*loadfont_scale*20/FT_SUBPIXELS/2; //face->bbox.xMin;
@@ -216,7 +216,7 @@ SWFFONT* swf_LoadTrueTypeFont(char*filename)
     if(full_unicode)
        font->maxascii = 65535;
     
     if(full_unicode)
        font->maxascii = 65535;
     
-    font->ascii2glyph = rfx_calloc(font->maxascii*sizeof(int));
+    font->ascii2glyph = (int*)rfx_calloc(font->maxascii*sizeof(int));
     
     for(t=0;t<font->maxascii;t++) {
        int g = FT_Get_Char_Index(face, t);
     
     for(t=0;t<font->maxascii;t++) {
        int g = FT_Get_Char_Index(face, t);
index c0abe75..ca6c6f3 100644 (file)
@@ -204,9 +204,9 @@ void swf_GetPlaceObject(TAG * tag,SWFPLACEOBJECT* obj)
             int l,t;
             U8*data;
             swf_ResetReadBits(tag);
             int l,t;
             U8*data;
             swf_ResetReadBits(tag);
-            l = strlen(&tag->data[tag->pos]);
+            l = strlen((const char *)&tag->data[tag->pos]);
             t = 0;
             t = 0;
-            data = rfx_alloc(l+1);
+            data = (U8*)rfx_alloc(l+1);
             obj->name = data;
             while((data[t++] = swf_GetU8(tag))); 
         }
             obj->name = data;
             while((data[t++] = swf_GetU8(tag))); 
         }
index e9bba74..e451329 100644 (file)
@@ -211,7 +211,7 @@ static void add_solidline(RENDERBUF*buf, double x1, double y1, double x2, double
         vy = (-dx/d);
     }
 
         vy = (-dx/d);
     }
 
-    segments = width/2;
+    segments = (int)(width/2);
     if(segments < 2)
         segments = 2;
 
     if(segments < 2)
         segments = 2;
 
@@ -330,11 +330,11 @@ void swf_Render_AddImage(RENDERBUF*buf, U16 id, RGBA*img, int width, int height)
 {
     renderbuf_internal*i = (renderbuf_internal*)buf->internal;
 
 {
     renderbuf_internal*i = (renderbuf_internal*)buf->internal;
 
-    bitmap_t*bm = rfx_calloc(sizeof(bitmap_t));
+    bitmap_t*bm = (bitmap_t*)rfx_calloc(sizeof(bitmap_t));
     bm->id = id;
     bm->width = width;
     bm->height = height;
     bm->id = id;
     bm->width = width;
     bm->height = height;
-    bm->data = rfx_alloc(width*height*4);
+    bm->data = (RGBA*)rfx_alloc(width*height*4);
     memcpy(bm->data, img, width*height*4);
 
     bm->next = i->bitmaps;
     memcpy(bm->data, img, width*height*4);
 
     bm->next = i->bitmaps;
@@ -380,7 +380,7 @@ void swf_Render_Delete(RENDERBUF*dest)
 
 static SHAPE2* linestyle2fillstyle(SHAPE2*shape)
 {
 
 static SHAPE2* linestyle2fillstyle(SHAPE2*shape)
 {
-    SHAPE2*s = rfx_calloc(sizeof(SHAPE2));
+    SHAPE2*s = (SHAPE2*)rfx_calloc(sizeof(SHAPE2));
     int t;
     s->numfillstyles = shape->numlinestyles;
     s->fillstyles = (FILLSTYLE*)rfx_calloc(sizeof(FILLSTYLE)*shape->numlinestyles);
     int t;
     s->numfillstyles = shape->numlinestyles;
     s->fillstyles = (FILLSTYLE*)rfx_calloc(sizeof(FILLSTYLE)*shape->numlinestyles);
@@ -482,7 +482,7 @@ void swf_RenderShape(RENDERBUF*dest, SHAPE2*shape, MATRIX*m, CXFORM*c, U16 _dept
             xx=x1;
            yy=y1;
 
             xx=x1;
            yy=y1;
 
-            parts = (int)(sqrt(c)/3);
+            parts = (int)(sqrt((float)c)/3);
             if(!parts) parts = 1;
 
             for(t=1;t<=parts;t++) {
             if(!parts) parts = 1;
 
             for(t=1;t<=parts;t++) {
@@ -783,7 +783,7 @@ static void change_state(int y, state_t* state, renderpoint_t*p)
             return;
         }
         
             return;
         }
         
-        n = rfx_calloc(sizeof(layer_t));
+        n = (layer_t*)rfx_calloc(sizeof(layer_t));
 
         if(DEBUG&2) printf("<+>");
 
 
         if(DEBUG&2) printf("<+>");
 
@@ -855,8 +855,8 @@ void swf_Process(RENDERBUF*dest, U32 clipdepth)
         for(n=0;n<num;n++) {
             renderpoint_t*p = &points[n];
             renderpoint_t*next= n<num-1?&points[n+1]:0;
         for(n=0;n<num;n++) {
             renderpoint_t*p = &points[n];
             renderpoint_t*next= n<num-1?&points[n+1]:0;
-            int startx = p->x;
-            int endx = next?next->x:i->width2;
+            int startx = (int)p->x;
+            int endx = (int)(next?next->x:i->width2);
             if(endx > i->width2)
                 endx = i->width2;
             if(startx < 0)
             if(endx > i->width2)
                 endx = i->width2;
             if(startx < 0)
@@ -956,11 +956,12 @@ typedef struct
     SHAPE2**glyphs;
 } font_t;
 
     SHAPE2**glyphs;
 } font_t;
 
+enum CHARACTER_TYPE {none_type, shape_type, image_type, text_type, font_type, sprite_type};
 typedef struct
 {
     TAG*tag;
     SRECT*bbox;
 typedef struct
 {
     TAG*tag;
     SRECT*bbox;
-    enum {none_type, shape_type, image_type, text_type, font_type, sprite_type} type;
+    enum CHARACTER_TYPE type;
     union {
         SHAPE2*shape;
         font_t*font;
     union {
         SHAPE2*shape;
         font_t*font;
@@ -1078,7 +1079,7 @@ static void renderFromTag(RENDERBUF*buf, character_t*idtable, TAG*firstTag, MATR
            break;
        tag = tag->next;
     }
            break;
        tag = tag->next;
     }
-    placements = rfx_calloc(sizeof(SWFPLACEOBJECT)*numplacements);
+    placements = (SWFPLACEOBJECT*)rfx_calloc(sizeof(SWFPLACEOBJECT)*numplacements);
     numplacements = 0;
 
     tag = firstTag;
     numplacements = 0;
 
     tag = firstTag;
@@ -1152,12 +1153,11 @@ void swf_RenderSWF(RENDERBUF*buf, SWF*swf)
 {
     TAG*tag;
     int t;
 {
     TAG*tag;
     int t;
-    int numplacements;
     RGBA color;
 
     swf_FoldAll(swf);
     
     RGBA color;
 
     swf_FoldAll(swf);
     
-    character_t* idtable = rfx_calloc(sizeof(character_t)*65536);            // id to character mapping
+    character_t* idtable = (character_t*)rfx_calloc(sizeof(character_t)*65536);            // id to character mapping
     
     /* set background color */
     color = swf_GetSWFBackgroundColor(swf);
     
     /* set background color */
     color = swf_GetSWFBackgroundColor(swf);
@@ -1169,11 +1169,11 @@ void swf_RenderSWF(RENDERBUF*buf, SWF*swf)
         if(swf_isDefiningTag(tag)) {
             int id = swf_GetDefineID(tag);
             idtable[id].tag = tag;
         if(swf_isDefiningTag(tag)) {
             int id = swf_GetDefineID(tag);
             idtable[id].tag = tag;
-            idtable[id].bbox = rfx_alloc(sizeof(SRECT));
+            idtable[id].bbox = (SRECT*)rfx_alloc(sizeof(SRECT));
             *idtable[id].bbox = swf_GetDefineBBox(tag);
 
             if(swf_isShapeTag(tag)) {
             *idtable[id].bbox = swf_GetDefineBBox(tag);
 
             if(swf_isShapeTag(tag)) {
-                SHAPE2* shape = rfx_calloc(sizeof(SHAPE2));
+                SHAPE2* shape = (SHAPE2*)rfx_calloc(sizeof(SHAPE2));
                 swf_ParseDefineShape(tag, shape);
                 idtable[id].type = shape_type;
                 idtable[id].obj.shape = shape;
                 swf_ParseDefineShape(tag, shape);
                 idtable[id].type = shape_type;
                 idtable[id].obj.shape = shape;
@@ -1187,11 +1187,11 @@ void swf_RenderSWF(RENDERBUF*buf, SWF*swf)
                       tag->id == ST_DEFINEFONT2) {
                int t;
                SWFFONT*swffont;
                       tag->id == ST_DEFINEFONT2) {
                int t;
                SWFFONT*swffont;
-               font_t*font = rfx_calloc(sizeof(font_t));
+               font_t*font = (font_t*)rfx_calloc(sizeof(font_t));
                idtable[id].obj.font = font;
                 swf_FontExtract(swf,id,&swffont);
                font->numchars = swffont->numchars;
                idtable[id].obj.font = font;
                 swf_FontExtract(swf,id,&swffont);
                font->numchars = swffont->numchars;
-               font->glyphs = rfx_calloc(sizeof(SHAPE2*)*font->numchars);
+               font->glyphs = (SHAPE2**)rfx_calloc(sizeof(SHAPE2*)*font->numchars);
                for(t=0;t<font->numchars;t++) {
                    if(!swffont->glyph[t].shape->fillstyle.n) {
                        /* the actual fill color will be overwritten while rendering */
                for(t=0;t<font->numchars;t++) {
                    if(!swffont->glyph[t].shape->fillstyle.n) {
                        /* the actual fill color will be overwritten while rendering */
index 7bb6424..f41fb3d 100644 (file)
@@ -203,7 +203,7 @@ int swf_SetShapeStyleCount(TAG * t,U16 n)
     return 3;
   }
   else
     return 3;
   }
   else
-  { swf_SetU8(t,n);
+  { swf_SetU8(t,(U8)n);
     return 1;
   }
 }
     return 1;
   }
 }
@@ -277,9 +277,9 @@ int swf_ShapeAddFillStyle(SHAPE * s,U8 type,MATRIX * m,RGBA * color,U16 id_bitma
   // handle memory
   
   if (s->fillstyle.data)
   // handle memory
   
   if (s->fillstyle.data)
-  { FILLSTYLE * new = (FILLSTYLE *)rfx_realloc(s->fillstyle.data,(s->fillstyle.n+1)*sizeof(FILLSTYLE));
-    if (!new) return -1;
-    s->fillstyle.data = new;
+  { FILLSTYLE * xnew = (FILLSTYLE *)rfx_realloc(s->fillstyle.data,(s->fillstyle.n+1)*sizeof(FILLSTYLE));
+    if (!xnew) return -1;
+    s->fillstyle.data = xnew;
   }
   else
   { s->fillstyle.data = (FILLSTYLE *)rfx_alloc(sizeof(FILLSTYLE));
   }
   else
   { s->fillstyle.data = (FILLSTYLE *)rfx_alloc(sizeof(FILLSTYLE));
@@ -323,9 +323,9 @@ int swf_ShapeAddLineStyle(SHAPE * s,U16 width,RGBA * color)
     def.r = def.g = def.b = 0; 
   }
   if (s->linestyle.data)
     def.r = def.g = def.b = 0; 
   }
   if (s->linestyle.data)
-  { LINESTYLE * new = (LINESTYLE *)rfx_realloc(s->linestyle.data,(s->linestyle.n+1)*sizeof(LINESTYLE));
-    if (!new) return -1;
-    s->linestyle.data = new;
+  { LINESTYLE * xnew = (LINESTYLE *)rfx_realloc(s->linestyle.data,(s->linestyle.n+1)*sizeof(LINESTYLE));
+    if (!xnew) return -1;
+    s->linestyle.data = xnew;
   }
   else
   { s->linestyle.data = (LINESTYLE *)rfx_alloc(sizeof(LINESTYLE));
   }
   else
   { s->linestyle.data = (LINESTYLE *)rfx_alloc(sizeof(LINESTYLE));
@@ -529,7 +529,7 @@ static int parseFillStyleArray(TAG*tag, SHAPE2*shape)
 
     shape->numfillstyles += count;
     if(shape->numfillstyles) {
 
     shape->numfillstyles += count;
     if(shape->numfillstyles) {
-       shape->fillstyles = rfx_realloc(shape->fillstyles, sizeof(FILLSTYLE)*shape->numfillstyles);
+       shape->fillstyles = (FILLSTYLE*)rfx_realloc(shape->fillstyles, sizeof(FILLSTYLE)*shape->numfillstyles);
 
         for(t=fillstylestart;t<shape->numfillstyles;t++)
         {
 
         for(t=fillstylestart;t<shape->numfillstyles;t++)
         {
@@ -576,7 +576,7 @@ static int parseFillStyleArray(TAG*tag, SHAPE2*shape)
 
     shape->numlinestyles += count;
     if(count) {
 
     shape->numlinestyles += count;
     if(count) {
-       shape->linestyles = rfx_realloc(shape->linestyles, sizeof(LINESTYLE)*shape->numlinestyles);
+       shape->linestyles = (LINESTYLE*)rfx_realloc(shape->linestyles, sizeof(LINESTYLE)*shape->numlinestyles);
         /* TODO: should we start with 1 and insert a correct definition of the
            "built in" linestyle 0? */
         for(t=linestylestart;t<shape->numlinestyles;t++) 
         /* TODO: should we start with 1 and insert a correct definition of the
            "built in" linestyle 0? */
         for(t=linestylestart;t<shape->numlinestyles;t++) 
@@ -791,15 +791,15 @@ SHAPE2* swf_Shape2Clone(SHAPE2 * s)
 {
     SHAPELINE*line = s->lines;
     SHAPELINE*prev = 0;
 {
     SHAPELINE*line = s->lines;
     SHAPELINE*prev = 0;
-    SHAPE2*s2 = rfx_alloc(sizeof(SHAPE2));
+    SHAPE2*s2 = (SHAPE2*)rfx_alloc(sizeof(SHAPE2));
     memcpy(s2,s,sizeof(SHAPE2));
     memcpy(s2,s,sizeof(SHAPE2));
-    s2->linestyles = rfx_alloc(sizeof(LINESTYLE)*s->numlinestyles);
+    s2->linestyles = (LINESTYLE*)rfx_alloc(sizeof(LINESTYLE)*s->numlinestyles);
     memcpy(s2->linestyles, s->linestyles, sizeof(LINESTYLE)*s->numlinestyles);
     memcpy(s2->linestyles, s->linestyles, sizeof(LINESTYLE)*s->numlinestyles);
-    s2->fillstyles = rfx_alloc(sizeof(FILLSTYLE)*s->numfillstyles);
+    s2->fillstyles = (FILLSTYLE*)rfx_alloc(sizeof(FILLSTYLE)*s->numfillstyles);
     memcpy(s2->fillstyles, s->fillstyles, sizeof(FILLSTYLE)*s->numfillstyles);
 
     while(line) {
     memcpy(s2->fillstyles, s->fillstyles, sizeof(FILLSTYLE)*s->numfillstyles);
 
     while(line) {
-       SHAPELINE*line2 = rfx_alloc(sizeof(SHAPELINE));
+       SHAPELINE*line2 = (SHAPELINE*)rfx_alloc(sizeof(SHAPELINE));
         memcpy(line2, line, sizeof(SHAPELINE));
         line2->next = 0;
         if(prev)
         memcpy(line2, line, sizeof(SHAPELINE));
         line2->next = 0;
         if(prev)
@@ -810,7 +810,7 @@ SHAPE2* swf_Shape2Clone(SHAPE2 * s)
        line = line->next;
     }
     if(s->bbox) {
        line = line->next;
     }
     if(s->bbox) {
-        s2->bbox = rfx_alloc(sizeof(SRECT));
+        s2->bbox = (SRECT*)rfx_alloc(sizeof(SRECT));
         memcpy(s2->bbox, s->bbox, sizeof(SRECT));
     }
     return s2;
         memcpy(s2->bbox, s->bbox, sizeof(SRECT));
     }
     return s2;
@@ -964,7 +964,7 @@ void swf_ParseDefineShape(TAG*tag, SHAPE2*shape)
 
     id = swf_GetU16(tag); //id
     memset(shape, 0, sizeof(SHAPE2));
 
     id = swf_GetU16(tag); //id
     memset(shape, 0, sizeof(SHAPE2));
-    shape->bbox = rfx_alloc(sizeof(SRECT));
+    shape->bbox = (SRECT*)rfx_alloc(sizeof(SRECT));
     swf_GetRect(tag, shape->bbox);
     if(num>=4) {
        SRECT r2;
     swf_GetRect(tag, shape->bbox);
     if(num>=4) {
        SRECT r2;
@@ -1004,8 +1004,8 @@ void swf_RecodeShapeData(U8*data, int bitlen, int in_bits_fill, int in_bits_line
     s2.lines = swf_ParseShapeData(data, bitlen, in_bits_fill, in_bits_line, 1, 0);
     s2.numfillstyles = out_bits_fill?1<<(out_bits_fill-1):0;
     s2.numlinestyles = out_bits_line?1<<(out_bits_line-1):0;
     s2.lines = swf_ParseShapeData(data, bitlen, in_bits_fill, in_bits_line, 1, 0);
     s2.numfillstyles = out_bits_fill?1<<(out_bits_fill-1):0;
     s2.numlinestyles = out_bits_line?1<<(out_bits_line-1):0;
-    s2.fillstyles = rfx_calloc(sizeof(FILLSTYLE)*s2.numfillstyles);
-    s2.linestyles = rfx_calloc(sizeof(LINESTYLE)*s2.numlinestyles);
+    s2.fillstyles = (FILLSTYLE*)rfx_calloc(sizeof(FILLSTYLE)*s2.numfillstyles);
+    s2.linestyles = (LINESTYLE*)rfx_calloc(sizeof(LINESTYLE)*s2.numlinestyles);
 
     line = s2.lines;
     while(line) {
 
     line = s2.lines;
     while(line) {
index 24bde3c..6c67b48 100644 (file)
@@ -157,7 +157,7 @@ int swf_FontExtract_DefineFont(int id, SWFFONT * f, TAG * t)
        of = swf_GetU16(t);
        n = of / 2;
        f->numchars = n;
        of = swf_GetU16(t);
        n = of / 2;
        f->numchars = n;
-       f->glyph = rfx_calloc(sizeof(SWFGLYPH) * n);
+       f->glyph = (SWFGLYPH*)rfx_calloc(sizeof(SWFGLYPH) * n);
 
        for (i = 1; i < n; i++)
            swf_GetU16(t);
 
        for (i = 1; i < n; i++)
            swf_GetU16(t);
@@ -247,7 +247,7 @@ int swf_FontExtract_GlyphNames(int id, SWFFONT * f, TAG * tag)
     if (fid == id) {
        int num = swf_GetU16(tag);
        int t;
     if (fid == id) {
        int num = swf_GetU16(tag);
        int t;
-       f->glyphnames = rfx_alloc(sizeof(char *) * num);
+       f->glyphnames = (char**)rfx_alloc(sizeof(char *) * num);
        for (t = 0; t < num; t++) {
            f->glyphnames[t] = strdup(swf_GetString(tag));
        }
        for (t = 0; t < num; t++) {
            f->glyphnames[t] = strdup(swf_GetString(tag));
        }
@@ -298,7 +298,7 @@ int swf_FontExtract_DefineFont2(int id, SWFFONT * font, TAG * tag)
     font->glyph = (SWFGLYPH *) rfx_calloc(sizeof(SWFGLYPH) * glyphcount);
     font->glyph2ascii = (U16 *) rfx_calloc(sizeof(U16) * glyphcount);
 
     font->glyph = (SWFGLYPH *) rfx_calloc(sizeof(SWFGLYPH) * glyphcount);
     font->glyph2ascii = (U16 *) rfx_calloc(sizeof(U16) * glyphcount);
 
-    offset = rfx_calloc(sizeof(U32)*(glyphcount+1));
+    offset = (U32*)rfx_calloc(sizeof(U32)*(glyphcount+1));
     offset_start = tag->pos;
 
     if (flags1 & 8) {          // wide offsets
     offset_start = tag->pos;
 
     if (flags1 & 8) {          // wide offsets
@@ -358,7 +358,7 @@ int swf_FontExtract_DefineFont2(int id, SWFFONT * font, TAG * tag)
            S16 advance = swf_GetS16(tag);
            font->glyph[t].advance = advance;
        }
            S16 advance = swf_GetS16(tag);
            font->glyph[t].advance = advance;
        }
-       font->layout->bounds = rfx_alloc(glyphcount * sizeof(SRECT));
+       font->layout->bounds = (SRECT*)rfx_alloc(glyphcount * sizeof(SRECT));
        for (t = 0; t < glyphcount; t++) {
            swf_ResetReadBits(tag);
            swf_GetRect(tag, &font->layout->bounds[t]);
        for (t = 0; t < glyphcount; t++) {
            swf_ResetReadBits(tag);
            swf_GetRect(tag, &font->layout->bounds[t]);
@@ -369,7 +369,7 @@ int swf_FontExtract_DefineFont2(int id, SWFFONT * font, TAG * tag)
 
        font->layout->kerning = (SWFKERNING *) rfx_alloc(sizeof(SWFKERNING) * kerningcount);
        if (kerningcount) {
 
        font->layout->kerning = (SWFKERNING *) rfx_alloc(sizeof(SWFKERNING) * kerningcount);
        if (kerningcount) {
-           font->layout->kerning = rfx_alloc(sizeof(*font->layout->kerning) * kerningcount);
+           font->layout->kerning = (SWFKERNING*)rfx_alloc(sizeof(*font->layout->kerning) * kerningcount);
            for (t = 0; t < kerningcount; t++) {
                if (flags1 & 4) {       // wide codes
                    font->layout->kerning[t].char1 = swf_GetU16(tag);
            for (t = 0; t < kerningcount; t++) {
                if (flags1 & 4) {       // wide codes
                    font->layout->kerning[t].char1 = swf_GetU16(tag);
@@ -747,7 +747,7 @@ void swf_FontSort(SWFFONT * font)
     if (!font)
        return;
 
     if (!font)
        return;
 
-    newplace = rfx_alloc(sizeof(int) * font->numchars);
+    newplace = (int*)rfx_alloc(sizeof(int) * font->numchars);
 
     for (i = 0; i < font->numchars; i++) {
        newplace[i] = i;
 
     for (i = 0; i < font->numchars; i++) {
        newplace[i] = i;
@@ -785,7 +785,7 @@ void swf_FontSort(SWFFONT * font)
                }
            }
        }
                }
            }
        }
-    newpos = rfx_alloc(sizeof(int) * font->numchars);
+    newpos = (int*)rfx_alloc(sizeof(int) * font->numchars);
     for (i = 0; i < font->numchars; i++) {
        newpos[newplace[i]] = i;
     }
     for (i = 0; i < font->numchars; i++) {
        newpos[newplace[i]] = i;
     }
@@ -813,10 +813,10 @@ int swf_FontInitUsage(SWFFONT * f)
        fprintf(stderr, "Usage initialized twice");
        return -1;
     }
        fprintf(stderr, "Usage initialized twice");
        return -1;
     }
-    f->use = rfx_alloc(sizeof(FONTUSAGE));
+    f->use = (FONTUSAGE*)rfx_alloc(sizeof(FONTUSAGE));
     f->use->is_reduced = 0;
     f->use->used_glyphs = 0;
     f->use->is_reduced = 0;
     f->use->used_glyphs = 0;
-    f->use->chars = rfx_calloc(sizeof(f->use->chars[0]) * f->numchars);
+    f->use->chars = (int*)rfx_calloc(sizeof(f->use->chars[0]) * f->numchars);
     return 0;
 }
 
     return 0;
 }
 
@@ -959,8 +959,8 @@ int swf_FontSetDefine2(TAG * tag, SWFFONT * f)
     swf_SetU8(tag, 0);         //reserved flags
     if (f->name) {
        /* font name */
     swf_SetU8(tag, 0);         //reserved flags
     if (f->name) {
        /* font name */
-       swf_SetU8(tag, strlen(f->name));
-       swf_SetBlock(tag, f->name, strlen(f->name));
+       swf_SetU8(tag, strlen((const char*)f->name));
+       swf_SetBlock(tag, f->name, strlen((const char*)f->name));
     } else {
        /* font name (="") */
        swf_SetU8(tag, 0);
     } else {
        /* font name (="") */
        swf_SetU8(tag, 0);
@@ -1062,7 +1062,7 @@ int swf_FontSetInfo(TAG * t, SWFFONT * f)
        return -1;
     swf_ResetWriteBits(t);
     swf_SetU16(t, f->id);
        return -1;
     swf_ResetWriteBits(t);
     swf_SetU16(t, f->id);
-    l = f->name ? strlen(f->name) : 0;
+    l = f->name ? strlen((const char *)f->name) : 0;
     if (l > 255)
        l = 255;
     swf_SetU8(t, l);
     if (l > 255)
        l = 255;
     swf_SetU8(t, l);
@@ -1412,9 +1412,9 @@ void swf_WriteFont(SWFFONT * font, char *filename)
        swf_SetU16(t, font->numchars);
        for (c = 0; c < font->numchars; c++) {
            if (font->glyphnames[c])
        swf_SetU16(t, font->numchars);
        for (c = 0; c < font->numchars; c++) {
            if (font->glyphnames[c])
-               swf_SetString(t, font->glyphnames[c]);
+               swf_SetString(t, (U8*)font->glyphnames[c]);
            else
            else
-               swf_SetString(t, "");
+               swf_SetString(t, (U8*)"");
        }
     }
 
        }
     }
 
@@ -1563,9 +1563,9 @@ void swf_SetEditText(TAG * tag, U16 flags, SRECT r, char *text, RGBA * color, in
        swf_SetU16(tag, layout->indent);        //indent
        swf_SetU16(tag, layout->leading);       //leading
     }
        swf_SetU16(tag, layout->indent);        //indent
        swf_SetU16(tag, layout->leading);       //leading
     }
-    swf_SetString(tag, variable);
+    swf_SetString(tag, (U8*)variable);
     if (flags & ET_HASTEXT)
     if (flags & ET_HASTEXT)
-       swf_SetString(tag, text);
+       swf_SetString(tag, (U8*)text);
 }
 
 SRECT swf_SetDefineText(TAG * tag, SWFFONT * font, RGBA * rgb, char *text, int scale)
 }
 
 SRECT swf_SetDefineText(TAG * tag, SWFFONT * font, RGBA * rgb, char *text, int scale)
@@ -1578,7 +1578,7 @@ SRECT swf_SetDefineText(TAG * tag, SWFFONT * font, RGBA * rgb, char *text, int s
     int pos = 0;
     int ystep = 0;
     if (font->layout) {
     int pos = 0;
     int ystep = 0;
     if (font->layout) {
-       r = swf_TextCalculateBBoxUTF8(font, text, scale * 20);
+       r = swf_TextCalculateBBoxUTF8(font, (U8*)text, scale * 20);
        ystep = font->layout->leading;
     } else {
        fprintf(stderr, "No layout information- can't compute text bbox accurately");
        ystep = font->layout->leading;
     } else {
        fprintf(stderr, "No layout information- can't compute text bbox accurately");
@@ -1602,7 +1602,7 @@ SRECT swf_SetDefineText(TAG * tag, SWFFONT * font, RGBA * rgb, char *text, int s
      */
     swf_SetMatrix(tag, 0);
 
      */
     swf_SetMatrix(tag, 0);
 
-    swf_TextCountBitsUTF8(font, text, scale * 20, &gbits, &abits);
+    swf_TextCountBitsUTF8(font, (U8*)text, scale * 20, &gbits, &abits);
     swf_SetU8(tag, gbits);
     swf_SetU8(tag, abits);
 
     swf_SetU8(tag, gbits);
     swf_SetU8(tag, abits);
 
index 313d082..fa0bb19 100644 (file)
@@ -388,7 +388,7 @@ char* swf_GetName(TAG * t)
     switch(swf_GetTagID(t))
     {
         case ST_FRAMELABEL:
     switch(swf_GetTagID(t))
     {
         case ST_FRAMELABEL:
-            name = &t->data[swf_GetTagPos(t)];
+            name = (char*)&t->data[swf_GetTagPos(t)];
         break;
         case ST_PLACEOBJECT3:
         case ST_PLACEOBJECT2: {   
         break;
         case ST_PLACEOBJECT3:
         case ST_PLACEOBJECT2: {   
@@ -408,7 +408,7 @@ char* swf_GetName(TAG * t)
               swf_GetU16(t);
             if(flags&PF_NAME) {
               swf_ResetReadBits(t);
               swf_GetU16(t);
             if(flags&PF_NAME) {
               swf_ResetReadBits(t);
-              name = &t->data[swf_GetTagPos(t)];
+              name = (char*)&t->data[swf_GetTagPos(t)];
             }
         }
         break;
             }
         }
         break;
@@ -427,13 +427,13 @@ void swf_GetMorphGradient(TAG * tag, GRADIENT * gradient1, GRADIENT * gradient2)
     
     if(gradient1) {
        gradient1->num = num;
     
     if(gradient1) {
        gradient1->num = num;
-       gradient1->rgba = rfx_calloc(sizeof(RGBA)*gradient1->num);
-       gradient1->ratios = rfx_calloc(sizeof(gradient1->ratios[0])*gradient1->num);
+       gradient1->rgba = (RGBA*)rfx_calloc(sizeof(RGBA)*gradient1->num);
+       gradient1->ratios = (U8*)rfx_calloc(sizeof(gradient1->ratios[0])*gradient1->num);
     }
     if(gradient2) {
        gradient2->num = num;
     }
     if(gradient2) {
        gradient2->num = num;
-       gradient2->rgba = rfx_calloc(sizeof(RGBA)*gradient2->num);
-       gradient2->ratios = rfx_calloc(sizeof(gradient2->ratios[0])*gradient2->num);
+       gradient2->rgba = (RGBA*)rfx_calloc(sizeof(RGBA)*gradient2->num);
+       gradient2->ratios = (U8*)rfx_calloc(sizeof(gradient2->ratios[0])*gradient2->num);
     }
     for(t=0;t<num;t++)
     {
     }
     for(t=0;t<num;t++)
     {
@@ -652,7 +652,7 @@ void enumerateUsedIDs(TAG * tag, int base, void (*callback)(TAG*, int, void*), v
                if(id == ST_END)
                    break;
                tag2->len = tag2->memsize = len;
                if(id == ST_END)
                    break;
                tag2->len = tag2->memsize = len;
-               tag2->data = rfx_alloc(len);
+               tag2->data = (U8*)rfx_alloc(len);
                memcpy(tag2->data, &tag->data[tag->pos], len);
                /* I never saw recursive sprites, but they are (theoretically) 
                   possible, so better add base here again */
                memcpy(tag2->data, &tag->data[tag->pos], len);
                /* I never saw recursive sprites, but they are (theoretically) 
                   possible, so better add base here again */
@@ -960,7 +960,7 @@ void swf_Relocate (SWF*swf, char*bitmap)
        
        num = swf_GetNumUsedIDs(tag);
        if(num) {
        
        num = swf_GetNumUsedIDs(tag);
        if(num) {
-           ptr = rfx_alloc(sizeof(int)*num);
+           ptr = (int*)rfx_alloc(sizeof(int)*num);
            swf_GetUsedIDs(tag, ptr);
 
            for(t=0;t<num;t++) {
            swf_GetUsedIDs(tag, ptr);
 
            for(t=0;t<num;t++) {
@@ -995,7 +995,7 @@ void swf_Relocate2(SWF*swf, int*id2id)
        if(num) {
            int *ptr;
            int t;
        if(num) {
            int *ptr;
            int t;
-           ptr = rfx_alloc(sizeof(int)*num);
+           ptr = (int*)rfx_alloc(sizeof(int)*num);
            swf_GetUsedIDs(tag, ptr);
            for(t=0;t<num;t++) {
                int id = GET16(&tag->data[ptr[t]]);
            swf_GetUsedIDs(tag, ptr);
            for(t=0;t<num;t++) {
                int id = GET16(&tag->data[ptr[t]]);
@@ -1161,10 +1161,10 @@ static int tagHash(TAG*tag)
 void swf_Optimize(SWF*swf)
 {
     const int hash_size = 131072;
 void swf_Optimize(SWF*swf)
 {
     const int hash_size = 131072;
-    char* dontremap = rfx_calloc(sizeof(char)*65536);
-    U16* remap = rfx_alloc(sizeof(U16)*65536);
-    TAG* id2tag = rfx_calloc(sizeof(TAG*)*65536);
-    TAG** hashmap = rfx_calloc(sizeof(TAG*)*hash_size);
+    char* dontremap = (char*)rfx_calloc(sizeof(char)*65536);
+    U16* remap = (U16*)rfx_alloc(sizeof(U16)*65536);
+    TAG* id2tag = (TAG*)rfx_calloc(sizeof(TAG*)*65536);
+    TAG** hashmap = (TAG**)rfx_calloc(sizeof(TAG*)*hash_size);
     TAG* tag;
     int t;
     for(t=0;t<65536;t++) {
     TAG* tag;
     int t;
     for(t=0;t<65536;t++) {
@@ -1192,7 +1192,7 @@ void swf_Optimize(SWF*swf)
 
         /* remap the tag */
         int num = swf_GetNumUsedIDs(tag);
 
         /* remap the tag */
         int num = swf_GetNumUsedIDs(tag);
-        int*positions = rfx_alloc(sizeof(int)*num);
+        int*positions = (int*)rfx_alloc(sizeof(int)*num);
         int t;
         swf_GetUsedIDs(tag, positions);
         for(t=0;t<num;t++) {
         int t;
         swf_GetUsedIDs(tag, positions);
         for(t=0;t<num;t++) {
@@ -1273,7 +1273,7 @@ void swf_SetDefineBBox(TAG * tag, SRECT newbbox)
              swf_ResetReadBits(tag);
              after_bbox_offset = tag->pos;
              len = tag->len - after_bbox_offset;
              swf_ResetReadBits(tag);
              after_bbox_offset = tag->pos;
              len = tag->len - after_bbox_offset;
-             data = malloc(len);
+             data = (U8*)malloc(len);
              memcpy(data, &tag->data[after_bbox_offset], len);
              tag->writeBit = 0;
              tag->len = 2;
              memcpy(data, &tag->data[after_bbox_offset], len);
              tag->writeBit = 0;
              tag->len = 2;
index 9c4e725..1554d35 100755 (executable)
--- a/lib/os.c
+++ b/lib/os.c
@@ -50,13 +50,13 @@ char* getRegistryEntry(char*path)
        fprintf(stderr, "RegOpenKeyEx failed\n");
        return 0;
     }
        fprintf(stderr, "RegOpenKeyEx failed\n");
        return 0;
     }
-    rc = RegQueryValueEx(key, NULL, 0, 0, 0, &size) ;
+    rc = RegQueryValueEx(key, NULL, 0, 0, 0, (LPDWORD)&size) ;
     if(rc != ERROR_SUCCESS) {
        fprintf(stderr, "RegQueryValueEx(1) failed: %d\n", rc);
        return 0;
     }
     if(rc != ERROR_SUCCESS) {
        fprintf(stderr, "RegQueryValueEx(1) failed: %d\n", rc);
        return 0;
     }
-    buf = malloc(size+1);
-    rc = RegQueryValueEx(key, NULL, 0, &type, (BYTE*)buf, &size);
+    buf = (char*)malloc(size+1);
+    rc = RegQueryValueEx(key, NULL, 0, &type, (BYTE*)buf, (LPDWORD)&size);
     if(rc != ERROR_SUCCESS) {
        fprintf(stderr, "RegQueryValueEx(2) failed: %d\n", rc);
        return 0;
     if(rc != ERROR_SUCCESS) {
        fprintf(stderr, "RegQueryValueEx(2) failed: %d\n", rc);
        return 0;
@@ -120,7 +120,7 @@ char* concatPaths(const char*base, const char*add)
     while(pos < l2 && add[pos] == seperator)
        pos++;
 
     while(pos < l2 && add[pos] == seperator)
        pos++;
 
-    n = malloc(l1 + (l2-pos) + 2);
+    n = (char*)malloc(l1 + (l2-pos) + 2);
     memcpy(n,base,l1);
     n[l1]=seperator;
     strcpy(&n[l1+1],&add[pos]);
     memcpy(n,base,l1);
     n[l1]=seperator;
     strcpy(&n[l1+1],&add[pos]);
index b497db5..2c41499 100644 (file)
@@ -22,7 +22,9 @@
 #include <stdarg.h>
 #include <stddef.h>
 #include <string.h>
 #include <stdarg.h>
 #include <stddef.h>
 #include <string.h>
+#ifdef HAVE_UNISTD_H
 #include <unistd.h>
 #include <unistd.h>
+#endif
 #include "../../config.h"
 #include "../os.h"
 #ifdef HAVE_DIRENT_H
 #include "../../config.h"
 #include "../os.h"
 #ifdef HAVE_DIRENT_H
@@ -57,7 +59,7 @@
 #include "GHash.h"
 #include "GFXOutputDev.h"
 
 #include "GHash.h"
 #include "GFXOutputDev.h"
 
-//swftools header files
+//  swftools header files
 #include "../log.h"
 #include "../gfxdevice.h"
 #include "../gfxtools.h"
 #include "../log.h"
 #include "../gfxdevice.h"
 #include "../gfxtools.h"
@@ -68,7 +70,7 @@
 #include "../devices/render.h"
 
 #include "../art/libart.h"
 #include "../devices/render.h"
 
 #include "../art/libart.h"
-#include "../devices/artsutils.c"
+#include "../devices/artsutils.h"
 
 #include "../png.h"
 #include "fonts.h"
 
 #include "../png.h"
 #include "fonts.h"
@@ -701,7 +703,7 @@ void GFXOutputDev::strokeGfxline(GfxState *state, gfxline_t*line, int flags)
        msg("<trace> %d dashes", dashnum);
        msg("<trace> |  phase: %f", dashphase);
        for(t=0;t<dashnum;t++) {
        msg("<trace> %d dashes", dashnum);
        msg("<trace> |  phase: %f", dashphase);
        for(t=0;t<dashnum;t++) {
-           dash[t] = ldash[t];
+           dash[t] = (float)ldash[t];
            msg("<trace> |  d%-3d: %f", t, ldash[t]);
        }
        dash[dashnum] = -1;
            msg("<trace> |  d%-3d: %f", t, ldash[t]);
        }
        dash[dashnum] = -1;
@@ -709,7 +711,7 @@ void GFXOutputDev::strokeGfxline(GfxState *state, gfxline_t*line, int flags)
            dump_outline(line);
        }
 
            dump_outline(line);
        }
 
-       line2 = gfxtool_dash_line(line, dash, dashphase);
+       line2 = gfxtool_dash_line(line, dash, (float)dashphase);
        line = line2;
        free(dash);
        msg("<trace> After dashing:");
        line = line2;
        free(dash);
        msg("<trace> After dashing:");
@@ -1149,7 +1151,7 @@ void GFXOutputDev::startPage(int pageNum, GfxState *state, double crop_x1, doubl
 
 void GFXOutputDev::processLink(Link *link, Catalog *catalog)
 {
 
 void GFXOutputDev::processLink(Link *link, Catalog *catalog)
 {
-    double x1, y1, x2, y2, w;
+    double x1, y1, x2, y2;
     gfxline_t points[5];
     int x, y;
     
     gfxline_t points[5];
     int x, y;
     
@@ -1518,6 +1520,7 @@ void GFXOutputDev::updateFont(GfxState *state)
     this->current_fontinfo = this->info->getFont(id);
     if(!this->current_fontinfo) {
        msg("<error> Internal Error: no fontinfo for font %s\n", id);
     this->current_fontinfo = this->info->getFont(id);
     if(!this->current_fontinfo) {
        msg("<error> Internal Error: no fontinfo for font %s\n", id);
+    return;
     }
     if(!this->current_fontinfo->seen) {
        dumpFontInfo("<verbose>", gfxFont);
     }
     if(!this->current_fontinfo->seen) {
        dumpFontInfo("<verbose>", gfxFont);
@@ -1546,7 +1549,6 @@ unsigned char* antialize(unsigned char*data, int width, int height, int newwidth
     unsigned char*newdata;
     int x,y;
     newdata= (unsigned char*)malloc(newwidth*newheight);
     unsigned char*newdata;
     int x,y;
     newdata= (unsigned char*)malloc(newwidth*newheight);
-    int t;
     double fx = (double)(width)/newwidth;
     double fy = (double)(height)/newheight;
     double px = 0;
     double fx = (double)(width)/newwidth;
     double fy = (double)(height)/newheight;
     double px = 0;
@@ -1619,9 +1621,6 @@ static void drawimage(gfxdevice_t*dev, gfxcolor_t* data, int sizex,int sizey,
      p5.y = (int)(p5.y*20)/20.0;
     }
     
      p5.y = (int)(p5.y*20)/20.0;
     }
     
-    float m00,m10,tx;
-    float m01,m11,ty;
-    
     gfxmatrix_t m;
     m.m00 = (p4.x-p1.x)/sizex; m.m10 = (p2.x-p1.x)/sizey;
     m.m01 = (p4.y-p1.y)/sizex; m.m11 = (p2.y-p1.y)/sizey;
     gfxmatrix_t m;
     m.m00 = (p4.x-p1.x)/sizex; m.m10 = (p2.x-p1.x)/sizey;
     m.m01 = (p4.y-p1.y)/sizex; m.m11 = (p2.y-p1.y)/sizey;
@@ -1746,7 +1745,6 @@ void GFXOutputDev::drawGeneralImage(GfxState *state, Object *ref, Stream *str,
   }
 
   if(mask) {
   }
 
   if(mask) {
-      int i,j;
       unsigned char buf[8];
       int x,y;
       unsigned char*pic = new unsigned char[width*height];
       unsigned char buf[8];
       int x,y;
       unsigned char*pic = new unsigned char[width*height];
@@ -1775,7 +1773,7 @@ void GFXOutputDev::drawGeneralImage(GfxState *state, Object *ref, Stream *str,
       /* the size of the drawn image is added to the identifier
         as the same image may require different bitmaps if displayed
         at different sizes (due to antialiasing): */
       /* the size of the drawn image is added to the identifier
         as the same image may require different bitmaps if displayed
         at different sizes (due to antialiasing): */
-      int t,found = -1;
+      int found = -1;
       if(type3active) {
          unsigned char*pic2 = 0;
          numpalette = 16;
       if(type3active) {
          unsigned char*pic2 = 0;
          numpalette = 16;
@@ -1795,7 +1793,7 @@ void GFXOutputDev::drawGeneralImage(GfxState *state, Object *ref, Stream *str,
          
          /* make a black/white palette */
 
          
          /* make a black/white palette */
 
-         float r = 255/(numpalette-1);
+         float r = 255./(float)(numpalette-1);
          int t;
          for(t=0;t<numpalette;t++) {
              pal[t].r = colToByte(rgb.r);
          int t;
          for(t=0;t<numpalette;t++) {
              pal[t].r = colToByte(rgb.r);
@@ -2021,7 +2019,6 @@ void addGlobalLanguageDir(const char*dir)
 {
     msg("<notice> Adding %s to language pack directories", dir);
 
 {
     msg("<notice> Adding %s to language pack directories", dir);
 
-    int l;
     FILE*fi = 0;
     char* config_file = (char*)malloc(strlen(dir) + 1 + sizeof("add-to-xpdfrc") + 1);
     strcpy(config_file, dir);
     FILE*fi = 0;
     char* config_file = (char*)malloc(strlen(dir) + 1 + sizeof("add-to-xpdfrc") + 1);
     strcpy(config_file, dir);
@@ -2075,7 +2072,7 @@ void addGlobalFontDir(const char*dirname)
     }
     closedir(dir);
 #else
     }
     closedir(dir);
 #else
-    msg("<warning> No dirent.h- unable to add font dir %s", dir);
+    msg("<warning> No dirent.h- unable to add font dir %s", dirname);
 #endif
 }
 
 #endif
 }
 
index e61ee7c..eeb83c6 100644 (file)
@@ -1,3 +1,5 @@
+#include "fonts.h"
+
 int d050000l_afm_len = 9381;
 char* d050000l_afm =
 "StartFontMetrics 3.0\nComment Copyright URW Software, Copyright 1997 by URW\nCom"
 int d050000l_afm_len = 9381;
 char* d050000l_afm =
 "StartFontMetrics 3.0\nComment Copyright URW Software, Copyright 1997 by URW\nCom"
index e305872..fac4f77 100644 (file)
--- a/lib/png.c
+++ b/lib/png.c
@@ -104,7 +104,7 @@ static int png_read_header(FILE*fi, struct png_header*header)
     while(png_read_chunk(&id, &len, &data, fi))
     {
        //printf("Chunk: %c%c%c%c (len:%d)\n", id[0],id[1],id[2],id[3], len);
     while(png_read_chunk(&id, &len, &data, fi))
     {
        //printf("Chunk: %c%c%c%c (len:%d)\n", id[0],id[1],id[2],id[3], len);
-       if(!strncasecmp(id, "IHDR", 4)) {
+       if(!strncmp(id, "IHDR", 4)) {
            char a,b,c,f,i;
            if(len < 8) exit(1);
            header->width = data[0]<<24|data[1]<<16|data[2]<<8|data[3];
            char a,b,c,f,i;
            if(len < 8) exit(1);
            header->width = data[0]<<24|data[1]<<16|data[2]<<8|data[3];
@@ -439,7 +439,7 @@ static void inline applyfilter4(int mode, unsigned char*src, unsigned char*old,
 }
 
 
 }
 
 
-EXPORT int getPNGdimensions(char*sname, int*destwidth, int*destheight)
+EXPORT int getPNGdimensions(const char*sname, int*destwidth, int*destheight)
 {
     FILE*fi;
     struct png_header header;
 {
     FILE*fi;
     struct png_header header;
@@ -457,7 +457,7 @@ EXPORT int getPNGdimensions(char*sname, int*destwidth, int*destheight)
     return 1;
 }
 
     return 1;
 }
 
-EXPORT int getPNG(char*sname, int*destwidth, int*destheight, unsigned char**destdata)
+EXPORT int getPNG(const char*sname, int*destwidth, int*destheight, unsigned char**destdata)
 {
     char tagid[4];
     int len;
 {
     char tagid[4];
     int len;
@@ -1009,7 +1009,7 @@ static void filter_line(int filtermode, unsigned char*dest, unsigned char*src, i
     }
 }
 
     }
 }
 
-EXPORT void writePNG(char*filename, unsigned char*data, int width, int height)
+EXPORT void writePNG(const char*filename, unsigned char*data, int width, int height)
 {
     FILE*fi;
     int crc;
 {
     FILE*fi;
     int crc;
@@ -1074,7 +1074,7 @@ EXPORT void writePNG(char*filename, unsigned char*data, int width, int height)
     long idatpos = png_start_chunk(fi, "IDAT", 0);
     
     memset(&zs,0,sizeof(z_stream));
     long idatpos = png_start_chunk(fi, "IDAT", 0);
     
     memset(&zs,0,sizeof(z_stream));
-    Bytef*writebuf = malloc(ZLIB_BUFFER_SIZE);
+    Bytef*writebuf = (Bytef*)malloc(ZLIB_BUFFER_SIZE);
     zs.zalloc = Z_NULL;
     zs.zfree  = Z_NULL;
     zs.opaque = Z_NULL;
     zs.zalloc = Z_NULL;
     zs.zfree  = Z_NULL;
     zs.opaque = Z_NULL;
index 95ababb..97eebac 100644 (file)
--- a/lib/png.h
+++ b/lib/png.h
@@ -23,9 +23,9 @@
 extern "C" {
 #endif
 
 extern "C" {
 #endif
 
-int getPNG(char*sname, int*destwidth, int*destheight, unsigned char**destdata);
-int getPNGdimensions(char*sname, int*destwidth, int*destheight);
-void writePNG(char*filename, unsigned char*data, int width, int height);
+int getPNG(const char*sname, int*destwidth, int*destheight, unsigned char**destdata);
+int getPNGdimensions(const char*sname, int*destwidth, int*destheight);
+void writePNG(const char*filename, unsigned char*data, int width, int height);
 
 #ifdef __cplusplus
 }
 
 #ifdef __cplusplus
 }
index adbdc5a..ac896f5 100644 (file)
 
 #ifdef HAVE_JPEGLIB
 #define HAVE_BOOLEAN
 
 #ifdef HAVE_JPEGLIB
 #define HAVE_BOOLEAN
+#ifdef __cplusplus
+extern "C" {
+#endif
 #include <jpeglib.h>
 #include <jpeglib.h>
+#ifdef __cplusplus
+}
+#endif
 #endif // HAVE_JPEGLIB
 
 #ifdef HAVE_ZLIB
 #endif // HAVE_JPEGLIB
 
 #ifdef HAVE_ZLIB
@@ -41,6 +47,9 @@
 #include "lame/lame.h"
 #endif
 #endif
 #include "lame/lame.h"
 #endif
 #endif
+#ifdef __cplusplus
+}
+#endif
 
 #ifdef HAVE_TIME_H
 #include <time.h>
 
 #ifdef HAVE_TIME_H
 #include <time.h>
@@ -268,7 +277,7 @@ double swf_GetFixed(TAG * t)
 }
 void swf_SetFixed(TAG * t, double f)
 {
 }
 void swf_SetFixed(TAG * t, double f)
 {
-  U16 fr = (f-(int)f)*65536;
+  U16 fr = (U16)(f-(int)f)*65536;
   swf_SetU16(t, fr);
   swf_SetU16(t, (U16)f - (f<0 && fr!=0));
 }
   swf_SetU16(t, fr);
   swf_SetU16(t, (U16)f - (f<0 && fr!=0));
 }
@@ -276,11 +285,11 @@ float swf_GetFixed8(TAG * t)
 {
   U8 low =  swf_GetU8(t);
   U8 high = swf_GetU8(t);
 {
   U8 low =  swf_GetU8(t);
   U8 high = swf_GetU8(t);
-  return high + low*(1/256.0);
+  return (float)(high + low*(1/256.0));
 }
 void swf_SetFixed8(TAG * t, float f)
 {
 }
 void swf_SetFixed8(TAG * t, float f)
 {
-  U8 fr = (f-(int)f)*256;
+  U8 fr = (U8)(f-(int)f)*256;
   swf_SetU8(t, fr);
   swf_SetU8(t, (U8)f - (f<0 && fr!=0));
 }
   swf_SetU8(t, fr);
   swf_SetU8(t, (U8)f - (f<0 && fr!=0));
 }
@@ -337,8 +346,8 @@ void swf_GetGradient(TAG * tag, GRADIENT * gradient, char alpha)
     U8 num = swf_GetU8(tag) & 15;
     if(gradient) {
        gradient->num = num;
     U8 num = swf_GetU8(tag) & 15;
     if(gradient) {
        gradient->num = num;
-       gradient->rgba = rfx_calloc(sizeof(RGBA)*gradient->num);
-       gradient->ratios = rfx_calloc(sizeof(gradient->ratios[0])*gradient->num);
+       gradient->rgba = (RGBA*)rfx_calloc(sizeof(RGBA)*gradient->num);
+       gradient->ratios = (U8*)rfx_calloc(sizeof(gradient->ratios[0])*gradient->num);
     }
     for(t=0;t<num;t++)
     {
     }
     for(t=0;t<num;t++)
     {
@@ -755,7 +764,7 @@ void  swf_SetPassword(TAG * t, const char * password)
     md5string = crypt_md5(password, salt);
 
     swf_SetU16(t,0);
     md5string = crypt_md5(password, salt);
 
     swf_SetU16(t,0);
-    swf_SetString(t, md5string);
+    swf_SetString(t, (U8*)md5string);
 }
 
 int swf_VerifyPassword(TAG * t, const char * password)
 }
 
 int swf_VerifyPassword(TAG * t, const char * password)
@@ -1291,7 +1300,7 @@ int  swf_WriteSWF2(writer_t*writer, SWF * swf)     // Writes SWF to file, return
   if ((swf->firstTag && swf->firstTag->id != ST_REFLEX) &&
       (!swf->firstTag->next || swf->firstTag->next->id != ST_REFLEX)) 
   {
   if ((swf->firstTag && swf->firstTag->id != ST_REFLEX) &&
       (!swf->firstTag->next || swf->firstTag->next->id != ST_REFLEX)) 
   {
-      swf_SetBlock(swf_InsertTagBefore(swf, swf->firstTag,ST_REFLEX),"rfx",3);
+      swf_SetBlock(swf_InsertTagBefore(swf, swf->firstTag,ST_REFLEX),(U8*)"rfx",3);
   }
 
 #endif // INSERT_RFX_TAG
   }
 
 #endif // INSERT_RFX_TAG
@@ -1306,7 +1315,7 @@ int  swf_WriteSWF2(writer_t*writer, SWF * swf)     // Writes SWF to file, return
     {
        TAG*scene = swf_InsertTagBefore(swf, swf->firstTag,ST_SCENEDESCRIPTION);
        swf_SetU16(scene, 1);
     {
        TAG*scene = swf_InsertTagBefore(swf, swf->firstTag,ST_SCENEDESCRIPTION);
        swf_SetU16(scene, 1);
-       swf_SetString(scene, "Scene 1");
+       swf_SetString(scene, (U8*)"Scene 1");
        swf_SetU8(scene, 0);
     }
   }
        swf_SetU8(scene, 0);
     }
   }
@@ -1493,7 +1502,7 @@ int swf_WriteCGI(SWF * swf)
 
 SWF* swf_CopySWF(SWF*swf)
 {
 
 SWF* swf_CopySWF(SWF*swf)
 {
-    SWF*nswf = rfx_alloc(sizeof(SWF));
+    SWF*nswf = (SWF*)rfx_alloc(sizeof(SWF));
     TAG*tag, *ntag;
     memcpy(nswf, swf, sizeof(SWF));
     nswf->firstTag = 0;
     TAG*tag, *ntag;
     memcpy(nswf, swf, sizeof(SWF));
     nswf->firstTag = 0;
index d246cd2..2a07fdb 100644 (file)
 #ifndef __RFX_SWF_INCLUDED__
 #define __RFX_SWF_INCLUDED__
 
 #ifndef __RFX_SWF_INCLUDED__
 #define __RFX_SWF_INCLUDED__
 
-#ifdef __cplusplus
-extern "C" {
-#endif
-
 #include <stdio.h>
 #include <stdlib.h>
 #include <math.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <math.h>
@@ -227,7 +223,7 @@ int   swf_SetU8(TAG * t,U8 v);              // resets Bitcount
 int   swf_SetU16(TAG * t,U16 v);
 void  swf_SetS16(TAG * t,int v);
 int   swf_SetU32(TAG * t,U32 v);
 int   swf_SetU16(TAG * t,U16 v);
 void  swf_SetS16(TAG * t,int v);
 int   swf_SetU32(TAG * t,U32 v);
-#define swf_SetString(t,s)  swf_SetBlock(t,s,strlen(s)+1)
+#define swf_SetString(t,s)  swf_SetBlock(t,s,strlen((const char *)s)+1)
 
 //int   swf_GetPoint(TAG * t,SPOINT * p);     // resets Bitcount
 int   swf_GetRect(TAG * t,SRECT * r);
 
 //int   swf_GetPoint(TAG * t,SPOINT * p);     // resets Bitcount
 int   swf_GetRect(TAG * t,SRECT * r);
@@ -397,9 +393,10 @@ typedef struct _SHAPE2
     SRECT* bbox; // may be NULL
 } SHAPE2;
 
     SRECT* bbox; // may be NULL
 } SHAPE2;
 
+enum SHAPELINETYPE {moveTo, lineTo, splineTo};
 typedef struct _SHAPELINE
 {
 typedef struct _SHAPELINE
 {
-    enum {moveTo, lineTo, splineTo} type;
+    enum SHAPELINETYPE type;
     SCOORD x,y;
     SCOORD sx,sy; //only if type==splineTo
     int fillstyle0;
     SCOORD x,y;
     SCOORD sx,sy; //only if type==splineTo
     int fillstyle0;
@@ -1068,9 +1065,4 @@ FILTER*swf_NewFilter(U8 type);
 
 void AVM2_InsertStops(SWF*swf);
 
 
 void AVM2_InsertStops(SWF*swf);
 
-#ifdef __cplusplus
-}
 #endif
 #endif
-
-#endif
-
index 72d9502..86a8bb3 100644 (file)
--- a/lib/wav.c
+++ b/lib/wav.c
@@ -89,7 +89,7 @@ int wav_read(struct WAV*wav, char* filename)
         fclose(fi);
                return 0;
     }
         fclose(fi);
                return 0;
     }
-    if(strncmp(b, "WAVE", 4))
+    if(strncmp((const char*)b, "WAVE", 4))
     {
         fprintf(stderr, "wav_read: not a WAV file (2)\n");
         fclose(fi);
     {
         fprintf(stderr, "wav_read: not a WAV file (2)\n");
         fclose(fi);
@@ -123,7 +123,7 @@ int wav_read(struct WAV*wav, char* filename)
                 if (!strncmp(block.id, "data", 4))
                 {
                     int l;
                 if (!strncmp(block.id, "data", 4))
                 {
                     int l;
-                    wav->data = malloc(block.size);
+                    wav->data = (unsigned char*)malloc(block.size);
                     if(!wav->data)
                     {
                         fprintf(stderr, "Out of memory (%d bytes needed)", block.size);
                     if(!wav->data)
                     {
                         fprintf(stderr, "Out of memory (%d bytes needed)", block.size);