From 0784a8a882e7b98299fb6a90f0f9a7ebb322562b Mon Sep 17 00:00:00 2001 From: kramm Date: Wed, 9 Jan 2008 09:33:41 +0000 Subject: [PATCH] win32 compile fixes --- configure.in | 2 +- lib/bitio.c | 3 +-- lib/devices/arts.c | 2 ++ lib/devices/artsutils.c | 1 + lib/devices/bbox.c | 3 +++ lib/devices/file.c | 5 ++++- lib/devices/ops.c | 3 +++ lib/devices/render.c | 5 +---- lib/devices/rescale.c | 4 ++++ lib/devices/swf.c | 3 +++ lib/drawer.c | 2 +- lib/log.c | 10 ++++------ lib/modules/swfabc.c | 16 ++++++++-------- lib/modules/swfbits.c | 10 +++++++--- lib/modules/swffont.c | 3 --- lib/modules/swfshape.c | 5 +---- lib/modules/swftext.c | 5 +---- lib/modules/swftools.c | 2 -- lib/pdf/InfoOutputDev.cc | 1 + lib/rfxswf.c | 12 ++++++------ lib/rfxswf.h | 10 ++++++++++ 21 files changed, 62 insertions(+), 45 deletions(-) diff --git a/configure.in b/configure.in index e3896c9..15999cc 100644 --- a/configure.in +++ b/configure.in @@ -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 # ------------------------------------------------------------------ diff --git a/lib/bitio.c b/lib/bitio.c index 0ea2967..920b4ce 100644 --- a/lib/bitio.c +++ b/lib/bitio.c @@ -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; diff --git a/lib/devices/arts.c b/lib/devices/arts.c index baf5cf0..ca03a80 100644 --- a/lib/devices/arts.c +++ b/lib/devices/arts.c @@ -21,7 +21,9 @@ #include #include #include +#ifndef WIN32 #include +#endif #include #include #include diff --git a/lib/devices/artsutils.c b/lib/devices/artsutils.c index 0da39eb..6b284e6 100644 --- a/lib/devices/artsutils.c +++ b/lib/devices/artsutils.c @@ -3,6 +3,7 @@ #include "../gfxdevice.h" #include "../gfxtools.h" #include "../art/libart.h" +#include "artsutils.h" #include #include diff --git a/lib/devices/bbox.c b/lib/devices/bbox.c index 5da181f..f46b60d 100644 --- a/lib/devices/bbox.c +++ b/lib/devices/bbox.c @@ -21,8 +21,11 @@ #include #include #include +#ifndef WIN32 #include +#endif #include +#include #include "../types.h" #include "../mem.h" #include "../gfxdevice.h" diff --git a/lib/devices/file.c b/lib/devices/file.c index 288a0a7..98aaaa2 100644 --- a/lib/devices/file.c +++ b/lib/devices/file.c @@ -20,7 +20,10 @@ #include #include +#ifndef WIN32 #include +#endif +#include #include #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); diff --git a/lib/devices/ops.c b/lib/devices/ops.c index e5e19af..8342930 100644 --- a/lib/devices/ops.c +++ b/lib/devices/ops.c @@ -21,8 +21,11 @@ #include #include #include +#ifndef WIN32 #include +#endif #include +#include #include "../types.h" #include "../mem.h" #include "../gfxdevice.h" diff --git a/lib/devices/render.c b/lib/devices/render.c index 88b9ce9..88e33ae 100644 --- a/lib/devices/render.c +++ b/lib/devices/render.c @@ -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"; diff --git a/lib/devices/rescale.c b/lib/devices/rescale.c index 21e8cb0..53d3623 100644 --- a/lib/devices/rescale.c +++ b/lib/devices/rescale.c @@ -21,9 +21,13 @@ #include #include #include +#ifndef WIN32 #include +#endif #include #include +#include +#include "rescale.h" #include "../types.h" #include "../mem.h" #include "../gfxdevice.h" diff --git a/lib/devices/swf.c b/lib/devices/swf.c index 2765d68..205163f 100644 --- a/lib/devices/swf.c +++ b/lib/devices/swf.c @@ -26,6 +26,9 @@ #ifdef HAVE_UNISTD_H #include #endif +#ifdef HAVE_IO_H +#include +#endif #ifdef HAVE_ASSERT_H #include #else diff --git a/lib/drawer.c b/lib/drawer.c index c025191..671ac84 100644 --- a/lib/drawer.c +++ b/lib/drawer.c @@ -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; diff --git a/lib/log.c b/lib/log.c index 05ac58f..1f7b96c 100644 --- a/lib/log.c +++ b/lib/log.c @@ -20,19 +20,17 @@ 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 #include +#include +#include +#ifdef WIN32 +//#include "stdafx.h" #include #if _MSC_VER > 1000 #pragma once #endif // _MSC_VER > 1000 #else #include -#include -#include -#include #include #endif diff --git a/lib/modules/swfabc.c b/lib/modules/swfabc.c index cdf9002..2598fad 100644 --- a/lib/modules/swfabc.c +++ b/lib/modules/swfabc.c @@ -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)); } diff --git a/lib/modules/swfbits.c b/lib/modules/swfbits.c index bbd8641..eda6829 100644 --- a/lib/modules/swfbits.c +++ b/lib/modules/swfbits.c @@ -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) { diff --git a/lib/modules/swffont.c b/lib/modules/swffont.c index c8c3efa..75069e3 100644 --- a/lib/modules/swffont.c +++ b/lib/modules/swffont.c @@ -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)) { diff --git a/lib/modules/swfshape.c b/lib/modules/swfshape.c index f41fb3d..c5a8835 100644 --- a/lib/modules/swfshape.c +++ b/lib/modules/swfshape.c @@ -534,7 +534,6 @@ static int parseFillStyleArray(TAG*tag, SHAPE2*shape) for(t=fillstylestart;tnumfillstyles;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; diff --git a/lib/modules/swftext.c b/lib/modules/swftext.c index 6c67b48..53abace 100644 --- a/lib/modules/swftext.c +++ b/lib/modules/swftext.c @@ -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 diff --git a/lib/modules/swftools.c b/lib/modules/swftools.c index fa0bb19..83f8c6a 100644 --- a/lib/modules/swftools.c +++ b/lib/modules/swftools.c @@ -471,7 +471,6 @@ void enumerateUsedIDs_styles(TAG * tag, void (*callback)(TAG*, int, void*), void for(t=0;tpos); 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); diff --git a/lib/pdf/InfoOutputDev.cc b/lib/pdf/InfoOutputDev.cc index d78c418..fd33452 100644 --- a/lib/pdf/InfoOutputDev.cc +++ b/lib/pdf/InfoOutputDev.cc @@ -1,3 +1,4 @@ +#include "Object.h" #include "SplashTypes.h" #include "SplashOutputDev.h" #include "SplashPath.h" diff --git a/lib/rfxswf.c b/lib/rfxswf.c index ac896f5..684c002 100644 --- a/lib/rfxswf.c +++ b/lib/rfxswf.c @@ -47,14 +47,15 @@ extern "C" { #include "lame/lame.h" #endif #endif -#ifdef __cplusplus -} -#endif #ifdef HAVE_TIME_H #include #endif +#ifdef HAVE_IO_H +#include +#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; diff --git a/lib/rfxswf.h b/lib/rfxswf.h index 2a07fdb..fe3c7e1 100644 --- a/lib/rfxswf.h +++ b/lib/rfxswf.h @@ -28,7 +28,9 @@ #include #include #include +#ifndef WIN32 #include +#endif #include #include #include "../config.h" @@ -37,6 +39,10 @@ #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 -- 1.7.10.4