On Sat, Feb 12, 2005 at 01:51:42PM +0100, Petter Reinholdtsen wrote: > At the moment, the gcc will issue a warning when using gdImageStringFT() > with const strings. I discovered this while compiling mapserver with > lots of warning flags. > > The declaration in /usr/include/gd.h currently look like this: > > /* FreeType 2 text output */ > BGD_DECLARE(char *) gdImageStringFT (gdImage * im, int *brect, int fg, > char *fontlist, double ptsize, double angle, int x, > int y, char *string); > > The problem is the use of 'char *' instead of 'const char *'. This > example program demonstrate the problem. As far as I can see, the > code do not write to the strings, so it should be safe to convert the > function to use 'const char *'.
FWIW, as of gd-2.3.0 the function accepts 'const char *', cf. <https://github.com/libgd/libgd/commit/3385b9aebf548ea778dc9cbd4f65e90ab38a1bf5>, and I can confirm that with libgd-dev_2.3.0-2 Petter's example program does not trigger any gcc warnings anymore. Cheers, Flo
signature.asc
Description: PGP signature