chiark / gitweb /
Assorted char * -> const char * API changes.
authorSimon Tatham <anakin@pobox.com>
Sun, 1 Oct 2017 13:04:47 +0000 (14:04 +0100)
committerSimon Tatham <anakin@pobox.com>
Sun, 1 Oct 2017 15:35:00 +0000 (16:35 +0100)
I went through all the char * parameters and return values I could see
in puzzles.h by eye and spotted ones that surely ought to have been
const all along.

16 files changed:
combi.c
devel.but
drawing.c
emcc.c
gtk.c
midend.c
misc.c
nestedvm.c
nullfe.c
osx.m
ps.c
puzzles.h
unequal.c
unfinished/path.c
untangle.c
windows.c

diff --git a/combi.c b/combi.c
index 4c5d1077aa07ae6b83e5a550b4cb6649abe54597..3460183c9c4e397f4ee1ca314fef4286e98f5d31 100644 (file)
--- a/combi.c
+++ b/combi.c
@@ -79,7 +79,7 @@ void free_combi(combi_ctx *combi)
 
 #include <stdio.h>
 
-void fatal(char *fmt, ...)
+void fatal(const char *fmt, ...)
 {
     abort();
 }
index c7112bbaabb5b85d4f6781784545e3c1d12332fb..af6920240119c4369a4a2b58024a1b53517a42e3 100644 (file)
--- a/devel.but
+++ b/devel.but
@@ -1961,7 +1961,8 @@ This ensures that thin lines are visible even at small scales.
 \S{drawing-draw-text} \cw{draw_text()}
 
 \c void draw_text(drawing *dr, int x, int y, int fonttype,
-\c                int fontsize, int align, int colour, char *text);
+\c                int fontsize, int align, int colour,
+\c                const char *text);
 
 Draws text in the puzzle window.
 
@@ -2122,7 +2123,7 @@ printing routines, that code may safely call \cw{draw_update()}.)
 
 \S{drawing-status-bar} \cw{status_bar()}
 
-\c void status_bar(drawing *dr, char *text);
+\c void status_bar(drawing *dr, const char *text);
 
 Sets the text in the game's status bar to \c{text}. The text is copied
 from the supplied buffer, so the caller is free to deallocate or
@@ -2393,7 +2394,8 @@ function \cw{drawing_new()} (see \k{drawing-new}).
 \S{drawingapi-draw-text} \cw{draw_text()}
 
 \c void (*draw_text)(void *handle, int x, int y, int fonttype,
-\c                   int fontsize, int align, int colour, char *text);
+\c                   int fontsize, int align, int colour,
+\c                   const char *text);
 
 This function behaves exactly like the back end \cw{draw_text()}
 function; see \k{drawing-draw-text}.
@@ -2496,7 +2498,7 @@ called unless drawing is attempted.
 
 \S{drawingapi-status-bar} \cw{status_bar()}
 
-\c void (*status_bar)(void *handle, char *text);
+\c void (*status_bar)(void *handle, const char *text);
 
 This function behaves exactly like the back end \cw{status_bar()}
 function; see \k{drawing-status-bar}.
@@ -3178,7 +3180,7 @@ using \cw{midend_size()} and eventually perform a refresh using
 
 \H{midend-game-id} \cw{midend_game_id()}
 
-\c const char *midend_game_id(midend *me, char *id);
+\c const char *midend_game_id(midend *me, const char *id);
 
 Passes the mid-end a string game ID (of any of the valid forms
 \cq{params}, \cq{params:description} or \cq{params#seed}) which the
@@ -3507,7 +3509,7 @@ calling \cw{midend_timer()}.
 
 \H{frontend-fatal} \cw{fatal()}
 
-\c void fatal(char *fmt, ...);
+\c void fatal(const char *fmt, ...);
 
 This is called by some utility functions if they encounter a
 genuinely fatal error such as running out of memory. It is a
index a10a7f06d68553c827347c7e249c704cc8fea272..caf0b4b43af16036072b39f4d1a80e9387f1486e 100644 (file)
--- a/drawing.c
+++ b/drawing.c
@@ -71,7 +71,7 @@ void drawing_free(drawing *dr)
 }
 
 void draw_text(drawing *dr, int x, int y, int fonttype, int fontsize,
-               int align, int colour, char *text)
+               int align, int colour, const char *text)
 {
     dr->api->draw_text(dr->handle, x, y, fonttype, fontsize, align,
                       colour, text);
@@ -190,7 +190,7 @@ char *text_fallback(drawing *dr, const char *const *strings, int nstrings)
     return NULL;                      /* placate optimiser */
 }
 
-void status_bar(drawing *dr, char *text)
+void status_bar(drawing *dr, const char *text)
 {
     char *rewritten;
 
diff --git a/emcc.c b/emcc.c
index 7a748331cb7b0c9c308679aa9fb36f5350e060ac..dbb4ab974df5c022b13a11f423cf9d8d4acee89a 100644 (file)
--- a/emcc.c
+++ b/emcc.c
@@ -122,7 +122,7 @@ void get_random_seed(void **randseed, int *randseedsize)
  * Fatal error, called in cases of complete despair such as when
  * malloc() has returned NULL.
  */
-void fatal(char *fmt, ...)
+void fatal(const char *fmt, ...)
 {
     char buf[512];
     va_list ap;
@@ -136,7 +136,7 @@ void fatal(char *fmt, ...)
     js_error_box(buf);
 }
 
-void debug_printf(char *fmt, ...)
+void debug_printf(const char *fmt, ...)
 {
     char buf[512];
     va_list ap;
@@ -384,7 +384,8 @@ static void js_unclip(void *handle)
 }
 
 static void js_draw_text(void *handle, int x, int y, int fonttype,
-                         int fontsize, int align, int colour, char *text)
+                         int fontsize, int align, int colour,
+                         const char *text)
 {
     char fontstyle[80];
     int halign;
@@ -515,7 +516,7 @@ static void js_end_draw(void *handle)
     js_canvas_end_draw();
 }
 
-static void js_status_bar(void *handle, char *text)
+static void js_status_bar(void *handle, const char *text)
 {
     js_canvas_set_statusbar(text);
 }
diff --git a/gtk.c b/gtk.c
index 8c342f5ff0d33e79556b0cf5ef1ad37e066da360..089143c7c0cb7ea7a7f2929ece33a655f5f4cd9c 100644 (file)
--- a/gtk.c
+++ b/gtk.c
@@ -71,7 +71,7 @@
 #ifdef DEBUGGING
 static FILE *debug_fp = NULL;
 
-void dputs(char *buf)
+void dputs(const char *buf)
 {
     if (!debug_fp) {
         debug_fp = fopen("debug.log", "w");
@@ -85,7 +85,7 @@ void dputs(char *buf)
     }
 }
 
-void debug_printf(char *fmt, ...)
+void debug_printf(const char *fmt, ...)
 {
     char buf[4096];
     va_list ap;
@@ -101,7 +101,7 @@ void debug_printf(char *fmt, ...)
  * Error reporting functions used elsewhere.
  */
 
-void fatal(char *fmt, ...)
+void fatal(const char *fmt, ...)
 {
     va_list ap;
 
@@ -264,7 +264,7 @@ void frontend_default_colour(frontend *fe, float *output)
 #endif
 }
 
-void gtk_status_bar(void *handle, char *text)
+void gtk_status_bar(void *handle, const char *text)
 {
     frontend *fe = (frontend *)handle;
 
@@ -1000,7 +1000,7 @@ void gtk_unclip(void *handle)
 }
 
 void gtk_draw_text(void *handle, int x, int y, int fonttype, int fontsize,
-                  int align, int colour, char *text)
+                  int align, int colour, const char *text)
 {
     frontend *fe = (frontend *)handle;
     int i;
index db038bd63419db43f053f563321f193a47e7d878..cf1a5ae4ecd3fb67c01309b83e6e730798476c78 100644 (file)
--- a/midend.c
+++ b/midend.c
@@ -1320,7 +1320,8 @@ void midend_request_id_changes(midend *me, void (*notify)(void *), void *ctx)
     me->game_id_change_notify_ctx = ctx;
 }
 
-void midend_supersede_game_desc(midend *me, char *desc, char *privdesc)
+void midend_supersede_game_desc(midend *me, const char *desc,
+                                const char *privdesc)
 {
     sfree(me->desc);
     sfree(me->privdesc);
@@ -1393,10 +1394,11 @@ config_item *midend_get_config(midend *me, int which, char **wintitle)
     return NULL;
 }
 
-static const char *midend_game_id_int(midend *me, char *id, int defmode)
+static const char *midend_game_id_int(midend *me, const char *id, int defmode)
 {
     const char *error;
-    char *par, *desc, *seed;
+    char *par = NULL;
+    const char *desc, *seed;
     game_params *newcurparams, *newparams, *oldparams1, *oldparams2;
     int free_params;
 
@@ -1409,8 +1411,10 @@ static const char *midend_game_id_int(midend *me, char *id, int defmode)
          * description. So `par' now points to the parameters
          * string, and `desc' to the description string.
          */
-        *desc++ = '\0';
-        par = id;
+        par = snewn(desc-id + 1, char);
+        strncpy(par, id, desc-id);
+        par[desc-id] = '\0';
+        desc++;
         seed = NULL;
     } else if (seed && (!desc || seed < desc)) {
         /*
@@ -1418,8 +1422,10 @@ static const char *midend_game_id_int(midend *me, char *id, int defmode)
          * So `par' now points to the parameters string, and `seed'
          * to the seed string.
          */
-        *seed++ = '\0';
-        par = id;
+        par = snewn(seed-id + 1, char);
+        strncpy(par, id, seed-id);
+        par[seed-id] = '\0';
+        seed++;
         desc = NULL;
     } else {
         /*
@@ -1428,12 +1434,14 @@ static const char *midend_game_id_int(midend *me, char *id, int defmode)
          */
         if (defmode == DEF_SEED) {
             seed = id;
-            par = desc = NULL;
+            par = NULL;
+            desc = NULL;
         } else if (defmode == DEF_DESC) {
             desc = id;
-            par = seed = NULL;
+            par = NULL;
+            seed = NULL;
         } else {
-            par = id;
+            par = dupstr(id);
             seed = desc = NULL;
         }
     }
@@ -1563,10 +1571,12 @@ static const char *midend_game_id_int(midend *me, char *id, int defmode)
         me->genmode = GOT_SEED;
     }
 
+    sfree(par);
+
     return NULL;
 }
 
-const char *midend_game_id(midend *me, char *id)
+const char *midend_game_id(midend *me, const char *id)
 {
     return midend_game_id_int(me, id, DEF_PARAMS);
 }
@@ -1721,7 +1731,7 @@ int midend_status(midend *me)
     return me->ourgame->status(me->states[me->statepos-1].state);
 }
 
-char *midend_rewrite_statusbar(midend *me, char *text)
+char *midend_rewrite_statusbar(midend *me, const char *text)
 {
     /*
      * An important special case is that we are occasionally called
diff --git a/misc.c b/misc.c
index d555ad261a9be39c2e93477a5e854edb421e051c..b6a190bef1ef9884ff655ebd6017d0d5088b4139 100644 (file)
--- a/misc.c
+++ b/misc.c
@@ -351,7 +351,7 @@ void pos2c(int w, int h, int pos, int *cx, int *cy)
 
 void draw_text_outline(drawing *dr, int x, int y, int fonttype,
                        int fontsize, int align,
-                       int text_colour, int outline_colour, char *text)
+                       int text_colour, int outline_colour, const char *text)
 {
     if (outline_colour > -1) {
         draw_text(dr, x-1, y, fonttype, fontsize, align, outline_colour, text);
index b7782801ab75fff0409d951de5f5208c0c134c02..0ad0f3fab487f1e80a3c97da0d6d7784d3d3caa0 100644 (file)
@@ -17,7 +17,7 @@
 extern void _pause();
 extern int _call_java(int cmd, int arg1, int arg2, int arg3);
 
-void fatal(char *fmt, ...)
+void fatal(const char *fmt, ...)
 {
     va_list ap;
     fprintf(stderr, "fatal error: ");
@@ -53,7 +53,7 @@ void frontend_default_colour(frontend *fe, float *output)
     output[0] = output[1]= output[2] = 0.8f;
 }
 
-void nestedvm_status_bar(void *handle, char *text)
+void nestedvm_status_bar(void *handle, const char *text)
 {
     _call_java(4,0,(int)text,0);
 }
@@ -79,7 +79,7 @@ void nestedvm_unclip(void *handle)
 }
 
 void nestedvm_draw_text(void *handle, int x, int y, int fonttype, int fontsize,
-                  int align, int colour, char *text)
+                        int align, int colour, const char *text)
 {
     frontend *fe = (frontend *)handle;
     _call_java(5, x + fe->ox, y + fe->oy, 
index ad381a135b05e399d50bb3e680e762f05af25efa..14b6e096c00e91fad306352395e9f2225292599d 100644 (file)
--- a/nullfe.c
+++ b/nullfe.c
@@ -10,7 +10,7 @@
 
 void frontend_default_colour(frontend *fe, float *output) {}
 void draw_text(drawing *dr, int x, int y, int fonttype, int fontsize,
-               int align, int colour, char *text) {}
+               int align, int colour, const char *text) {}
 void draw_rect(drawing *dr, int x, int y, int w, int h, int colour) {}
 void draw_line(drawing *dr, int x1, int y1, int x2, int y2, int colour) {}
 void draw_thick_line(drawing *dr, float thickness,
@@ -41,15 +41,16 @@ int print_rgb_hatched_colour(drawing *dr, float r, float g, float b, int hatch)
 { return 0; }
 void print_line_width(drawing *dr, int width) {}
 void print_line_dotted(drawing *dr, int dotted) {}
-void midend_supersede_game_desc(midend *me, char *desc, char *privdesc) {}
-void status_bar(drawing *dr, char *text) {}
+void midend_supersede_game_desc(midend *me, const char *desc,
+                                const char *privdesc) {}
+void status_bar(drawing *dr, const char *text) {}
 struct preset_menu *preset_menu_new(void) {return NULL;}
 struct preset_menu *preset_menu_add_submenu(struct preset_menu *parent,
                                             char *title) {return NULL;}
 void preset_menu_add_preset(struct preset_menu *parent,
                             char *title, game_params *params) {}
 
-void fatal(char *fmt, ...)
+void fatal(const char *fmt, ...)
 {
     va_list ap;
 
@@ -64,7 +65,7 @@ void fatal(char *fmt, ...)
 }
 
 #ifdef DEBUGGING
-void debug_printf(char *fmt, ...)
+void debug_printf(const char *fmt, ...)
 {
     va_list ap;
     va_start(ap, fmt);
diff --git a/osx.m b/osx.m
index 64cbb1644b46c611f005b93b856eb8eb1a21085a..9403faedc9399501f2f074ede58db110282a0236 100644 (file)
--- a/osx.m
+++ b/osx.m
@@ -111,7 +111,7 @@ NSApplication *app;
  * clearly defined subsystem.
  */
 
-void fatal(char *fmt, ...)
+void fatal(const char *fmt, ...)
 {
     va_list ap;
     char errorbuf[2048];
@@ -275,7 +275,7 @@ id initnewitem(NSMenuItem *item, NSMenu *parent, const char *title,
     return item;
 }
 
-NSMenuItem *newitem(NSMenu *parent, char *title, char *key,
+NSMenuItem *newitem(NSMenu *parent, const char *title, const char *key,
                    id target, SEL action)
 {
     return initnewitem([NSMenuItem allocWithZone:[NSMenu menuZone]],
@@ -437,7 +437,7 @@ struct frontend {
 - (void)keyDown:(NSEvent *)ev;
 - (void)activateTimer;
 - (void)deactivateTimer;
-- (void)setStatusLine:(char *)text;
+- (void)setStatusLine:(const char *)text;
 - (void)resizeForNewGameParams;
 - (void)updateTypeMenuTick;
 @end
@@ -726,7 +726,7 @@ struct frontend {
     last_time = now;
 }
 
-- (void)showError:(char *)message
+- (void)showError:(const char *)message
 {
     NSAlert *alert;
 
@@ -1300,7 +1300,7 @@ struct frontend {
     if (update) {
        int k;
        config_item *i;
-       char *error;
+       const char *error;
 
        k = 0;
        for (i = cfg; i->type != C_END; i++) {
@@ -1348,7 +1348,7 @@ struct frontend {
     [self sheetEndWithStatus:NO];
 }
 
-- (void)setStatusLine:(char *)text
+- (void)setStatusLine:(const char *)text
 {
     [[status cell] setTitle:[NSString stringWithUTF8String:text]];
 }
@@ -1461,7 +1461,8 @@ static void osx_draw_rect(void *handle, int x, int y, int w, int h, int colour)
     NSRectFill(r);
 }
 static void osx_draw_text(void *handle, int x, int y, int fonttype,
-                         int fontsize, int align, int colour, char *text)
+                         int fontsize, int align, int colour,
+                          const char *text)
 {
     frontend *fe = (frontend *)handle;
     NSString *string = [NSString stringWithUTF8String:text];
@@ -1612,7 +1613,7 @@ static void osx_end_draw(void *handle)
     frontend *fe = (frontend *)handle;
     [fe->image unlockFocus];
 }
-static void osx_status_bar(void *handle, char *text)
+static void osx_status_bar(void *handle, const char *text)
 {
     frontend *fe = (frontend *)handle;
     [fe->window setStatusLine:text];
diff --git a/ps.c b/ps.c
index 2394cc5e8e07499949ec69264a138bde632dff4b..6ec8aacc19f90e2a10106ab107c979bc8a9dff55 100644 (file)
--- a/ps.c
+++ b/ps.c
@@ -102,7 +102,8 @@ static void ps_stroke(psdata *ps, int colour)
 }
 
 static void ps_draw_text(void *handle, int x, int y, int fonttype,
-                        int fontsize, int align, int colour, char *text)
+                        int fontsize, int align, int colour,
+                         const char *text)
 {
     psdata *ps = (psdata *)handle;
 
index 662bcfe19fd4b3ec59c7886f3598bef06656e65b..11542a58e76798bb8a794a47294ee75b3d5faea8 100644 (file)
--- a/puzzles.h
+++ b/puzzles.h
@@ -224,12 +224,12 @@ game_params *preset_menu_lookup_by_id(struct preset_menu *menu, int id);
 /* We can't use #ifdef DEBUG, because Cygwin defines it by default. */
 #ifdef DEBUGGING
 #define debug(x) (debug_printf x)
-void debug_printf(char *fmt, ...);
+void debug_printf(const char *fmt, ...);
 #else
 #define debug(x)
 #endif
 
-void fatal(char *fmt, ...);
+void fatal(const char *fmt, ...);
 void frontend_default_colour(frontend *fe, float *output);
 void deactivate_timer(frontend *fe);
 void activate_timer(frontend *fe);
@@ -241,7 +241,7 @@ void get_random_seed(void **randseed, int *randseedsize);
 drawing *drawing_new(const drawing_api *api, midend *me, void *handle);
 void drawing_free(drawing *dr);
 void draw_text(drawing *dr, int x, int y, int fonttype, int fontsize,
-               int align, int colour, char *text);
+               int align, int colour, const char *text);
 void draw_rect(drawing *dr, int x, int y, int w, int h, int colour);
 void draw_line(drawing *dr, int x1, int y1, int x2, int y2, int colour);
 void draw_polygon(drawing *dr, int *coords, int npoints,
@@ -256,7 +256,7 @@ void start_draw(drawing *dr);
 void draw_update(drawing *dr, int x, int y, int w, int h);
 void end_draw(drawing *dr);
 char *text_fallback(drawing *dr, const char *const *strings, int nstrings);
-void status_bar(drawing *dr, char *text);
+void status_bar(drawing *dr, const char *text);
 blitter *blitter_new(drawing *dr, int w, int h);
 void blitter_free(drawing *dr, blitter *bl);
 /* save puts the portion of the current display with top-left corner
@@ -312,7 +312,7 @@ int midend_wants_statusbar(midend *me);
 enum { CFG_SETTINGS, CFG_SEED, CFG_DESC, CFG_FRONTEND_SPECIFIC };
 config_item *midend_get_config(midend *me, int which, char **wintitle);
 const char *midend_set_config(midend *me, int which, config_item *cfg);
-const char *midend_game_id(midend *me, char *id);
+const char *midend_game_id(midend *me, const char *id);
 char *midend_get_game_id(midend *me);
 char *midend_get_random_seed(midend *me);
 int midend_can_format_as_text_now(midend *me);
@@ -321,8 +321,9 @@ const char *midend_solve(midend *me);
 int midend_status(midend *me);
 int midend_can_undo(midend *me);
 int midend_can_redo(midend *me);
-void midend_supersede_game_desc(midend *me, char *desc, char *privdesc);
-char *midend_rewrite_statusbar(midend *me, char *text);
+void midend_supersede_game_desc(midend *me, const char *desc,
+                                const char *privdesc);
+char *midend_rewrite_statusbar(midend *me, const char *text);
 void midend_serialise(midend *me,
                       void (*write)(void *ctx, void *buf, int len),
                       void *wctx);
@@ -392,7 +393,7 @@ void pos2c(int w, int h, int pos, int *cx, int *cy);
  * by one pixel; useful for highlighting. Outline is omitted if -1. */
 void draw_text_outline(drawing *dr, int x, int y, int fonttype,
                        int fontsize, int align,
-                       int text_colour, int outline_colour, char *text);
+                       int text_colour, int outline_colour, const char *text);
 
 /* Copies text left-justified with spaces. Length of string must be
  * less than buffer size. */
@@ -645,7 +646,7 @@ struct game {
  */
 struct drawing_api {
     void (*draw_text)(void *handle, int x, int y, int fonttype, int fontsize,
-                     int align, int colour, char *text);
+                     int align, int colour, const char *text);
     void (*draw_rect)(void *handle, int x, int y, int w, int h, int colour);
     void (*draw_line)(void *handle, int x1, int y1, int x2, int y2,
                      int colour);
@@ -658,7 +659,7 @@ struct drawing_api {
     void (*unclip)(void *handle);
     void (*start_draw)(void *handle);
     void (*end_draw)(void *handle);
-    void (*status_bar)(void *handle, char *text);
+    void (*status_bar)(void *handle, const char *text);
     blitter *(*blitter_new)(void *handle, int w, int h);
     void (*blitter_free)(void *handle, blitter *bl);
     void (*blitter_save)(void *handle, blitter *bl, int x, int y);
index cdea0a0416960f1e76b5f4b83d0cfb32ca9998e9..ccb00dd2993ba69628c7bc764a9b8cedc7128ea6 100644 (file)
--- a/unequal.c
+++ b/unequal.c
@@ -2039,7 +2039,7 @@ const char *quis = NULL;
 
 #if 0 /* currently unused */
 
-static void debug_printf(char *fmt, ...)
+static void debug_printf(const char *fmt, ...)
 {
     char buf[4096];
     va_list ap;
index 61d6c61c6a07ab89431407471e094baf07445882..d4ec5d87cc08ec6744a29cb1480f8c06f698d686 100644 (file)
@@ -770,7 +770,7 @@ int main(void)
 #ifdef TEST_GENERAL
 #include <stdarg.h>
 
-void fatal(char *fmt, ...)
+void fatal(const char *fmt, ...)
 {
     va_list ap;
 
index 10114b589be75ffac86a21d96b205276e4ca3abb..a693378570bb4621ca13f32f7dcab1dce008e753 100644 (file)
@@ -656,7 +656,7 @@ static char *new_game_desc(const game_params *params, random_state *rs,
      */
     ret = NULL;
     {
-       char *sep;
+       const char *sep;
        char buf[80];
        int retlen;
        edge *ea;
index 84cf5ec96d5baaff8d62b6cb840bf80c97e4a7a4..0a43c5d2785c93caa23cc6808251d34d446f049e 100644 (file)
--- a/windows.c
+++ b/windows.c
@@ -150,7 +150,7 @@ void dputs(char *buf)
     OutputDebugString(buf);
 }
 
-void debug_printf(char *fmt, ...)
+void debug_printf(const char *fmt, ...)
 {
     char buf[4096];
     va_list ap;
@@ -258,7 +258,7 @@ void frontend_free(frontend *fe)
 static void update_type_menu_tick(frontend *fe);
 static void update_copy_menu_greying(frontend *fe);
 
-void fatal(char *fmt, ...)
+void fatal(const char *fmt, ...)
 {
     char buf[2048];
     va_list ap;
@@ -304,7 +304,7 @@ void get_random_seed(void **randseed, int *randseedsize)
     *randseedsize = sizeof(SYSTEMTIME);
 }
 
-static void win_status_bar(void *handle, char *text)
+static void win_status_bar(void *handle, const char *text)
 {
 #ifdef _WIN32_WCE
     TCHAR wText[255];
@@ -556,7 +556,8 @@ static void win_unclip(void *handle)
 }
 
 static void win_draw_text(void *handle, int x, int y, int fonttype,
-                         int fontsize, int align, int colour, char *text)
+                         int fontsize, int align, int colour,
+                          const char *text)
 {
     frontend *fe = (frontend *)handle;
     POINT xy;