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;
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;
}
}
-static void md5_pad(ctxt)
- md5_ctxt *ctxt;
+static void md5_pad(md5_ctxt *ctxt)
{
u_int gap;
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
#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;
#include <stdio.h>
#include <stdlib.h>
+#ifdef HAVE_UNISTD_H
#include <unistd.h>
+#endif
+#ifdef HAVE_IO_H
+#include <io.h>
+#endif
+#include <string.h>
#include <memory.h>
#include <fcntl.h>
}
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;
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;
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
- mw->data = realloc(mw->data, newlength);
+ mw->data = (unsigned char*)realloc(mw->data, newlength);
#endif
mw->length = newlength;
}
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->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;
}
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));
if(!len)
return 0;
- z->zs.next_out = data;
+ z->zs.next_out = (Bytef *)data;
z->zs.avail_out = len;
while(1) {
if(!len)
return 0;
- z->zs.next_in = data;
+ z->zs.next_in = (Bytef *)data;
z->zs.avail_in = len;
while(1) {
if(!b)
break;
}
- char*string = writer_growmemwrite_getmem(&g);
+ char*string = (char*)writer_growmemwrite_getmem(&g);
writer_growmemwrite_finish(&g);
return string;
}
w->write(w, &b7, 1);
w->write(w, &b8, 1);
}
-
-
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;
#include "../config.h"
#include "gfxdevice.h"
#include "gfxtools.h"
+#include "gfxfont.h"
static int loadfont_scale = 64;
static int full_unicode = 1;
int t;
int*glyph2glyph = 0;
int*glyph2unicode = 0;
- FT_Size size;
int max_unicode = 0;
int charmap = -1;
int isunicode = 1;
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->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(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 < face->num_glyphs; t++) {
FT_Glyph glyph;
- FT_BBox bbox;
- FT_Matrix matrix;
char name[128];
gfxdrawer_t draw;
gfxdrawinfo_t info;
- int ret;
char hasname = 0;
int omit = 0;
name[0]=0;
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];
#include <stdlib.h>
#include <memory.h>
#include <math.h>
+#include <string.h>
#include <assert.h>
#include "gfxtools.h"
#include "gfxfont.h"
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))) {
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
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
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) {
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;
#include <memory.h>
#include <stdio.h>
#include <stdlib.h>
+#include "mem.h"
// memory allocation
length = swf_GetU16(tag);
if(length) {
- data = rfx_alloc(length);
+ data = (U8*)rfx_alloc(length);
swf_GetBlock(tag, data, length);
} else {
data = 0;
case 'f':
return 2;
case 'u':
- return strlen(data)+1;
+ return strlen((const char*)data)+1;
case 't':
- return strlen(data)+1;
+ return strlen((const char*)data)+1;
case 'l':
- return strlen(data)+1;
+ return strlen((const char*)data)+1;
case 'c':
- return strlen(data)+1;
+ return strlen((const char*)data)+1;
case 'C':
return 2;
case 's':
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) {
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': {
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
+ int t;
for(t=0;t<4;t++) {
U8 tmp = a[t];
a[t]=a[7-t];
case 'u': {
if(type&TYPE_URL)
{
- replacelen = strlen(data);
+ replacelen = strlen((const char*)data);
replacepos = data;
- replacement = callback(data); // may be null
+ replacement = (U8*)callback((char*)data); // may be null
}
} break;
case 't': {
if(type&TYPE_TARGET)
{
- replacelen = strlen(data);
+ replacelen = strlen((const char*)data);
replacepos = data;
- replacement = callback(data); // may be null
+ replacement = (U8*)callback((char*)data); // may be null
}
} break;
case 'c': {
if(type&TYPE_STRING)
{
- replacelen = strlen(data);
+ replacelen = strlen((const char*)data);
replacepos = data;
- replacement = callback(data); // may be null
+ replacement = (U8*)callback((char*)data); // may be null
}
} break;
case 'C': {
} 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);
- replacepos = value;
- replacement = callback(value); // may be null
+ replacepos = (U8*)value;
+ replacement = (U8*)callback(value); // may be null
}
} else if (datatype == 8) { //lookup
}
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);
- atag->data = newdata;
+ atag->data = (U8*)newdata;
data = &atag->data[rpos+newlen+1];
}
}
{
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;
}
{
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);
- 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;}
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);
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)
int palette_overflow = 0;
U32 lastcol32 = 0;
- pal = malloc(65536*sizeof(U32));
+ pal = (U32*)malloc(65536*sizeof(U32));
memset(size, 0, sizeof(size));
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));
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);
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) {
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;
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 (!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;
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;
*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 (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);
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) {
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);
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;
// 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;
- strcpy(buf, PREFIX);
+ strcpy((char*)buf, (const char*)PREFIX);
if (var[0] == '_')
- { strcpy(&buf[sizeof(PREFIX)-1], &var[1]);
+ { strcpy((char*)&buf[sizeof(PREFIX)-1], (const char*)&var[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] = '_';
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] = '=';
- sprintf(newval, "%s#%s", buf, oldval);
+ sprintf((char*)newval, "%s#%s", buf, oldval);
c[0] = 0;
- oldval -= strlen(buf) + 1; // skip past VAR=
+ oldval -= strlen((const char*)buf) + 1; // skip past VAR=
}
else
{ c[0] = '=';
newval = buf;
}
- putenv(newval);
+ putenv((const char *)newval);
if (oldval)
{ rfx_free(oldval);
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 (!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);
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;
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);
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->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->gradient = rfx_calloc(sizeof(GRADIENT));
+ f->gradient = (GRADIENT*)rfx_calloc(sizeof(GRADIENT));
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]);
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->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);
{
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)
- f = rfx_calloc(sizeof(FILTER_GRADIENTGLOW));
+ f = (FILTER*)rfx_calloc(sizeof(FILTER_GRADIENTGLOW));
else if(type == FILTERTYPE_DROPSHADOW)
- f = rfx_calloc(sizeof(FILTER_DROPSHADOW));
+ f = (FILTER*)rfx_calloc(sizeof(FILTER_DROPSHADOW));
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)
return 0;
}
- font = rfx_calloc(sizeof(SWFFONT));
+ font = (SWFFONT*)rfx_calloc(sizeof(SWFFONT));
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->glyph2ascii = rfx_calloc(face->num_glyphs*sizeof(U16));
+ font->glyph2ascii = (U16*)rfx_calloc(face->num_glyphs*sizeof(U16));
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)) {
- 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;
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);
int l,t;
U8*data;
swf_ResetReadBits(tag);
- l = strlen(&tag->data[tag->pos]);
+ l = strlen((const char *)&tag->data[tag->pos]);
t = 0;
- data = rfx_alloc(l+1);
+ data = (U8*)rfx_alloc(l+1);
obj->name = data;
while((data[t++] = swf_GetU8(tag)));
}
vy = (-dx/d);
}
- segments = width/2;
+ segments = (int)(width/2);
if(segments < 2)
segments = 2;
{
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->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;
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);
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++) {
return;
}
- n = rfx_calloc(sizeof(layer_t));
+ n = (layer_t*)rfx_calloc(sizeof(layer_t));
if(DEBUG&2) printf("<+>");
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)
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;
- enum {none_type, shape_type, image_type, text_type, font_type, sprite_type} type;
+ enum CHARACTER_TYPE type;
union {
SHAPE2*shape;
font_t*font;
break;
tag = tag->next;
}
- placements = rfx_calloc(sizeof(SWFPLACEOBJECT)*numplacements);
+ placements = (SWFPLACEOBJECT*)rfx_calloc(sizeof(SWFPLACEOBJECT)*numplacements);
numplacements = 0;
tag = firstTag;
{
TAG*tag;
int t;
- int numplacements;
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);
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)) {
- 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;
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;
- 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 */
return 3;
}
else
- { swf_SetU8(t,n);
+ { swf_SetU8(t,(U8)n);
return 1;
}
}
// 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));
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));
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++)
{
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++)
{
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));
- 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);
- 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) {
- SHAPELINE*line2 = rfx_alloc(sizeof(SHAPELINE));
+ SHAPELINE*line2 = (SHAPELINE*)rfx_alloc(sizeof(SHAPELINE));
memcpy(line2, line, sizeof(SHAPELINE));
line2->next = 0;
if(prev)
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;
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;
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) {
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);
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));
}
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
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]);
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);
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;
}
}
}
- 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;
}
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->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;
}
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);
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);
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
- swf_SetString(t, "");
+ swf_SetString(t, (U8*)"");
}
}
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)
- swf_SetString(tag, text);
+ swf_SetString(tag, (U8*)text);
}
SRECT swf_SetDefineText(TAG * tag, SWFFONT * font, RGBA * rgb, char *text, int scale)
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");
*/
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);
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: {
swf_GetU16(t);
if(flags&PF_NAME) {
swf_ResetReadBits(t);
- name = &t->data[swf_GetTagPos(t)];
+ name = (char*)&t->data[swf_GetTagPos(t)];
}
}
break;
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;
- 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++)
{
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 */
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++) {
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]]);
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++) {
/* 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++) {
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;
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;
}
- 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;
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]);
#include <stdarg.h>
#include <stddef.h>
#include <string.h>
+#ifdef HAVE_UNISTD_H
#include <unistd.h>
+#endif
#include "../../config.h"
#include "../os.h"
#ifdef HAVE_DIRENT_H
#include "GHash.h"
#include "GFXOutputDev.h"
-//swftools header files
+// swftools header files
#include "../log.h"
#include "../gfxdevice.h"
#include "../gfxtools.h"
#include "../devices/render.h"
#include "../art/libart.h"
-#include "../devices/artsutils.c"
+#include "../devices/artsutils.h"
#include "../png.h"
#include "fonts.h"
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;
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:");
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;
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);
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;
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;
}
if(mask) {
- int i,j;
unsigned char buf[8];
int x,y;
unsigned char*pic = new unsigned char[width*height];
/* 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;
/* 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);
{
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);
}
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
}
+#include "fonts.h"
+
int d050000l_afm_len = 9381;
char* d050000l_afm =
"StartFontMetrics 3.0\nComment Copyright URW Software, Copyright 1997 by URW\nCom"
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];
}
-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;
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;
}
}
-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;
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;
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 HAVE_JPEGLIB
#define HAVE_BOOLEAN
+#ifdef __cplusplus
+extern "C" {
+#endif
#include <jpeglib.h>
+#ifdef __cplusplus
+}
+#endif
#endif // HAVE_JPEGLIB
#ifdef HAVE_ZLIB
#include "lame/lame.h"
#endif
#endif
+#ifdef __cplusplus
+}
+#endif
#ifdef HAVE_TIME_H
#include <time.h>
}
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));
}
{
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)
{
- 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));
}
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++)
{
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)
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
{
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* 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;
#ifndef __RFX_SWF_INCLUDED__
#define __RFX_SWF_INCLUDED__
-#ifdef __cplusplus
-extern "C" {
-#endif
-
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
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);
SRECT* bbox; // may be NULL
} SHAPE2;
+enum SHAPELINETYPE {moveTo, lineTo, splineTo};
typedef struct _SHAPELINE
{
- enum {moveTo, lineTo, splineTo} type;
+ enum SHAPELINETYPE type;
SCOORD x,y;
SCOORD sx,sy; //only if type==splineTo
int fillstyle0;
void AVM2_InsertStops(SWF*swf);
-#ifdef __cplusplus
-}
#endif
-
-#endif
-
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);
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);