From: kramm Date: Sat, 8 Sep 2007 18:01:49 +0000 (+0000) Subject: added missing const keywords X-Git-Tag: buttons-working~578 X-Git-Url: http://git.asbjorn.biz/?p=swftools.git;a=commitdiff_plain;h=80cc20b7784cccc9d8baf9839f9781db6bb6f539 added missing const keywords --- diff --git a/lib/args.h b/lib/args.h index 997f9b4..c0350e4 100644 --- a/lib/args.h +++ b/lib/args.h @@ -98,8 +98,8 @@ static void processargs(int argn2,char**argv2) struct options_t { - char*shortoption; - char*longoption; + const char*shortoption; + const char*longoption; }; static int args_long2shortoption(struct options_t*options, char*name, char*val) diff --git a/lib/devices/swf.c b/lib/devices/swf.c index 25eec62..ab6734f 100644 --- a/lib/devices/swf.c +++ b/lib/devices/swf.c @@ -178,7 +178,7 @@ static void swf_fillbitmap(gfxdevice_t*dev, gfxline_t*line, gfximage_t*img, gfxm static void swf_fillgradient(gfxdevice_t*dev, gfxline_t*line, gfxgradient_t*gradient, gfxgradienttype_t type, gfxmatrix_t*matrix); static void swf_drawchar(gfxdevice_t*dev, gfxfont_t*font, int glyph, gfxcolor_t*color, gfxmatrix_t*matrix); static void swf_addfont(gfxdevice_t*dev, gfxfont_t*font); -static void swf_drawlink(gfxdevice_t*dev, gfxline_t*line, char*action); +static void swf_drawlink(gfxdevice_t*dev, gfxline_t*line, const char*action); static void swf_startframe(gfxdevice_t*dev, int width, int height); static void swf_endframe(gfxdevice_t*dev); static gfxresult_t* swf_finish(gfxdevice_t*driver); @@ -1250,11 +1250,11 @@ void swfoutput_finalize(gfxdevice_t*dev) i->swf->compressed = 1; } - if(i->config_reordertags) - swf_Optimize(i->swf); +// if(i->config_reordertags) +// swf_Optimize(i->swf); } -int swfresult_save(gfxresult_t*gfx, char*filename) +int swfresult_save(gfxresult_t*gfx, const char*filename) { SWF*swf = (SWF*)gfx->internal; int fi; @@ -1280,7 +1280,7 @@ int swfresult_save(gfxresult_t*gfx, char*filename) close(fi); return 0; } -void* swfresult_get(gfxresult_t*gfx, char*name) +void* swfresult_get(gfxresult_t*gfx, const char*name) { SWF*swf = (SWF*)gfx->internal; if(!strcmp(name, "swf")) { @@ -1409,15 +1409,15 @@ static void swfoutput_setlinewidth(gfxdevice_t*dev, double _linewidth) static void drawlink(gfxdevice_t*dev, ActionTAG*,ActionTAG*, gfxline_t*points, char mouseover); static void swfoutput_namedlink(gfxdevice_t*dev, char*name, gfxline_t*points); static void swfoutput_linktopage(gfxdevice_t*dev, int page, gfxline_t*points); -static void swfoutput_linktourl(gfxdevice_t*dev, char*url, gfxline_t*points); +static void swfoutput_linktourl(gfxdevice_t*dev, const char*url, gfxline_t*points); -void swfoutput_drawlink(gfxdevice_t*dev, char*url, gfxline_t*points) +/*void swfoutput_drawlink(gfxdevice_t*dev, char*url, gfxline_t*points) { swfoutput_internal*i = (swfoutput_internal*)dev->internal; dev->drawlink(dev, points, url); -} +}*/ -void swf_drawlink(gfxdevice_t*dev, gfxline_t*points, char*url) +void swf_drawlink(gfxdevice_t*dev, gfxline_t*points, const char*url) { swfoutput_internal*i = (swfoutput_internal*)dev->internal; @@ -1443,7 +1443,7 @@ void swf_drawlink(gfxdevice_t*dev, gfxline_t*points, char*url) swfoutput_linktourl(dev, url, points); } } -void swfoutput_linktourl(gfxdevice_t*dev, char*url, gfxline_t*points) +void swfoutput_linktourl(gfxdevice_t*dev, const char*url, gfxline_t*points) { ActionTAG* actions = 0; swfoutput_internal*i = (swfoutput_internal*)dev->internal; @@ -2507,7 +2507,7 @@ static void swf_drawchar(gfxdevice_t*dev, gfxfont_t*font, int glyph, gfxcolor_t* swf_switchfont(dev, font->id); // set the current font } setfontscale(dev, matrix->m00, matrix->m01, matrix->m10, matrix->m11); - + /* printf("%f %f\n", m.m31, m.m32); { static int xpos = 40; diff --git a/lib/gfxdevice.h b/lib/gfxdevice.h index fd41895..d0e7d14 100644 --- a/lib/gfxdevice.h +++ b/lib/gfxdevice.h @@ -27,12 +27,12 @@ typedef struct _gfxglyph gfxcoord_t advance; int unicode; // array? - char*name; + const char*name; } gfxglyph_t; typedef struct _gfxfont { - char*id; + const char*id; int num_glyphs; int max_unicode; gfxglyph_t*glyphs; @@ -87,8 +87,8 @@ typedef struct _gfxbbox typedef struct _gfxresult { void (*write)(struct _gfxresult*gfx, int filedesc); - int (*save)(struct _gfxresult*gfx, char*filename); - void* (*get)(struct _gfxresult*gfx, char*name); + int (*save)(struct _gfxresult*gfx, const char*filename); + void* (*get)(struct _gfxresult*gfx, const char*name); void (*destroy)(struct _gfxresult*gfx); void*internal; @@ -96,7 +96,7 @@ typedef struct _gfxresult typedef struct _gfxdevice { - char* name; // gfx device name + const char* name; // gfx device name int (*setparameter)(struct _gfxdevice*dev, const char*key, const char*value); @@ -113,7 +113,7 @@ typedef struct _gfxdevice void (*drawchar)(struct _gfxdevice*dev, gfxfont_t*fontid, int glyph, gfxcolor_t*color, gfxmatrix_t*matrix); - void (*drawlink)(struct _gfxdevice*dev, gfxline_t*line, char*action); + void (*drawlink)(struct _gfxdevice*dev, gfxline_t*line, const char*action); void (*endpage)(struct _gfxdevice*dev); diff --git a/lib/gfxsource.h b/lib/gfxsource.h index 3ca3871..15ab936 100644 --- a/lib/gfxsource.h +++ b/lib/gfxsource.h @@ -33,8 +33,8 @@ struct _gfxpage; typedef struct _gfxsource { - void (*set_parameter)(char*name, char*value); - struct _gfxdocument* (*open)(char*filename); + void (*set_parameter)(const char*name, const char*value); + struct _gfxdocument* (*open)(const char*filename); void*internal; } gfxsource_t; @@ -42,10 +42,10 @@ typedef struct _gfxdocument { gfxsource_t*driver; int num_pages; - void* (*get)(struct _gfxdocument*gfx, char*name); + void* (*get)(struct _gfxdocument*gfx, const char*name); void (*destroy)(struct _gfxdocument*gfx); - void (*set_parameter)(struct _gfxdocument*gfx, char*name, char*value); - char* (*getinfo)(struct _gfxdocument*gfx, char*key); + void (*set_parameter)(struct _gfxdocument*gfx, const char*name, const char*value); + char* (*getinfo)(struct _gfxdocument*gfx, const char*key); struct _gfxpage* (*getpage)(struct _gfxdocument*gfx, int page); void*internal; } gfxdocument_t; diff --git a/lib/modules/swfaction.c b/lib/modules/swfaction.c index 44cbee2..051de9b 100644 --- a/lib/modules/swfaction.c +++ b/lib/modules/swfaction.c @@ -1015,7 +1015,7 @@ ActionTAG* action_PushLookup16(ActionTAG*atag, U16 index) *(U8*)&atag->tmp[2] = index>>8; return atag; } -ActionTAG* action_PushString(ActionTAG*atag, char*str) +ActionTAG* action_PushString(ActionTAG*atag, const char*str) { int l = strlen(str); char*ptr = (char*)rfx_alloc(l+2); diff --git a/lib/modules/swffont.c b/lib/modules/swffont.c index 9a9c744..e7ad1df 100644 --- a/lib/modules/swffont.c +++ b/lib/modules/swffont.c @@ -59,7 +59,7 @@ void swf_SetLoadFontParameters(int _scale, int _skip_unused, int _full_unicode) #define FT_SCALE 1 #define FT_SUBPIXELS 64 -static int ft_move_to(FT_Vector* _to, void* user) +static int ft_move_to(const FT_Vector* _to, void* user) { drawer_t* draw = (drawer_t*)user; FPOINT to; @@ -68,7 +68,7 @@ static int ft_move_to(FT_Vector* _to, void* user) draw->moveTo(draw, &to); return 0; } -static int ft_line_to(FT_Vector* _to, void* user) +static int ft_line_to(const FT_Vector* _to, void* user) { drawer_t* draw = (drawer_t*)user; FPOINT to; @@ -77,28 +77,28 @@ static int ft_line_to(FT_Vector* _to, void* user) draw->lineTo(draw, &to); return 0; } -static int ft_cubic_to(FT_Vector* _c1, FT_Vector* _c2, FT_Vector* _to, void* user) +static int ft_conic_to(const FT_Vector* _c, const FT_Vector* _to, void* user) { drawer_t* draw = (drawer_t*)user; - FPOINT c1,c2,to; + FPOINT c,to; to.x = _to->x*FT_SCALE/(float)FT_SUBPIXELS; to.y = -_to->y*FT_SCALE/(float)FT_SUBPIXELS; - c1.x = _c1->x*FT_SCALE/(float)FT_SUBPIXELS; - c1.y = -_c1->y*FT_SCALE/(float)FT_SUBPIXELS; - c2.x = _c2->x*FT_SCALE/(float)FT_SUBPIXELS; - c2.y = -_c2->y*FT_SCALE/(float)FT_SUBPIXELS; - draw_cubicTo(draw, &c1, &c2, &to); + c.x = _c->x*FT_SCALE/(float)FT_SUBPIXELS; + c.y = -_c->y*FT_SCALE/(float)FT_SUBPIXELS; + draw_conicTo(draw, &c, &to); return 0; } -static int ft_conic_to(FT_Vector* _c, FT_Vector* _to, void* user) +static int ft_cubic_to(const FT_Vector* _c1, const FT_Vector* _c2, const FT_Vector* _to, void* user) { drawer_t* draw = (drawer_t*)user; - FPOINT c,to; + FPOINT c1,c2,to; to.x = _to->x*FT_SCALE/(float)FT_SUBPIXELS; to.y = -_to->y*FT_SCALE/(float)FT_SUBPIXELS; - c.x = _c->x*FT_SCALE/(float)FT_SUBPIXELS; - c.y = -_c->y*FT_SCALE/(float)FT_SUBPIXELS; - draw_conicTo(draw, &c, &to); + c1.x = _c1->x*FT_SCALE/(float)FT_SUBPIXELS; + c1.y = -_c1->y*FT_SCALE/(float)FT_SUBPIXELS; + c2.x = _c2->x*FT_SCALE/(float)FT_SUBPIXELS; + c2.y = -_c2->y*FT_SCALE/(float)FT_SUBPIXELS; + draw_cubicTo(draw, &c1, &c2, &to); return 0; } static FT_Outline_Funcs outline_functions = diff --git a/lib/modules/swftext.c b/lib/modules/swftext.c index d9e4115..d7c0470 100644 --- a/lib/modules/swftext.c +++ b/lib/modules/swftext.c @@ -684,7 +684,7 @@ int swf_FontReduce_swfc(SWFFONT * f) } f->use->used_glyphs = j; for (i = 0; i < f->maxascii; i++) { - if(f->ascii2glyph[i] > -1) + if(f->ascii2glyph[i] > -1) { if (f->use->chars[f->ascii2glyph[i]]<0) { f->use->chars[f->ascii2glyph[i]] = 0; f->ascii2glyph[i] = -1; @@ -694,6 +694,7 @@ int swf_FontReduce_swfc(SWFFONT * f) max_unicode = i + 1; } } + } f->maxascii = max_unicode; f->use->is_reduced = 1; f->numchars = j; diff --git a/lib/os.c b/lib/os.c index 207c3c1..0e850ca 100755 --- a/lib/os.c +++ b/lib/os.c @@ -109,7 +109,7 @@ char* getInstallationPath() #endif } -char* concatPaths(char*base, char*add) +char* concatPaths(const char*base, const char*add) { int l1 = strlen(base); int l2 = strlen(add); @@ -127,11 +127,11 @@ char* concatPaths(char*base, char*add) return n; } -char* stripFilename(char*filename, char*newext) +char* stripFilename(const char*filename, const char*newext) { char*last1 = strrchr(filename, '/'); char*last2 = strrchr(filename, '\\'); - char*pos = filename; + const char*pos = filename; char*name; char*dot; if(last1>pos) pos = last1 + 1; @@ -161,7 +161,7 @@ static char* getTempDir() return dir; } -char* mktempname(char*ptr) { +char* mktempname(const char*ptr) { static char tmpbuf[128]; char*dir = getTempDir(); int l = strlen(dir); diff --git a/lib/os.h b/lib/os.h index 3dae4e6..2b321db 100755 --- a/lib/os.h +++ b/lib/os.h @@ -35,10 +35,10 @@ int setRegistryEntry(char*key,char*value); #endif char* getInstallationPath(); -char* concatPaths(char*base, char*add); -char* stripFilename(char*filename, char*newext); +char* concatPaths(const char*base, const char*add); +char* stripFilename(const char*filename, const char*newext); -char* mktempname(char*); +char* mktempname(const char*); #ifdef __cplusplus } diff --git a/lib/pdf/GFXOutputDev.h b/lib/pdf/GFXOutputDev.h index 5f92ccb..84769af 100644 --- a/lib/pdf/GFXOutputDev.h +++ b/lib/pdf/GFXOutputDev.h @@ -40,9 +40,9 @@ typedef struct _parameter struct _parameter*next; } parameter_t; -void addGlobalFont(char*filename); -void addGlobalLanguageDir(char*dir); -void addGlobalFontDir(char*dirname); +void addGlobalFont(const char*filename); +void addGlobalLanguageDir(const char*dir); +void addGlobalFontDir(const char*dirname); class GFXOutputDev: public OutputDev { public: @@ -203,9 +203,9 @@ public: void clipToGfxLine(GfxState *state, gfxline_t*line); void fillGfxLine(GfxState *state, gfxline_t*line); - void showfeature(char*feature,char fully, char warn); - void warnfeature(char*feature,char fully); - void infofeature(char*feature); + void showfeature(const char*feature,char fully, char warn); + void warnfeature(const char*feature,char fully); + void infofeature(const char*feature); char outer_clip_box; //whether the page clip box is still on @@ -220,7 +220,7 @@ public: PDFDoc*doc; XRef*xref; - char* searchFont(char*name); + char* searchFont(const char*name); char* substituteFont(GfxFont*gfxFont, char*oldname); char* writeEmbeddedFontToFile(XRef*ref, GfxFont*font); int t1id; @@ -235,8 +235,8 @@ public: char type3Warning; - char* substitutetarget[256]; - char* substitutesource[256]; + const char* substitutetarget[256]; + const char* substitutesource[256]; int substitutepos; int user_movex,user_movey; diff --git a/lib/rfxswf.h b/lib/rfxswf.h index 60b3561..99590c9 100644 --- a/lib/rfxswf.h +++ b/lib/rfxswf.h @@ -890,7 +890,7 @@ ActionTAG* action_SetTarget(ActionTAG*atag, char* target); ActionTAG* action_GotoLabel(ActionTAG*atag, char* label); ActionTAG* action_WaitForFrame2(ActionTAG*atag, U8 skip); ActionTAG* action_With(ActionTAG*atag, char*object); -ActionTAG* action_PushString(ActionTAG*atag, char*str); +ActionTAG* action_PushString(ActionTAG*atag, const char*str); ActionTAG* action_PushFloat(ActionTAG*atag, float f); ActionTAG* action_PushNULL(ActionTAG*atag); ActionTAG* action_PushRegister(ActionTAG*atag, U8 reg);