Package: libgd2-noxpm-dev
Version: 2.0.33-1.1
Severity: normal

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 *'.

Here is an example program demonstrating the issue.  The program is
not supposed to run (the other arguments are bogus. :) Compile with
gcc -Wall to see the warnings:

/*
 * Demonstrate the following warning in gd.h:

x.c: In function `main':
x.c:5: warning: passing arg 4 of `gdImageStringFT' discards qualifiers from 
pointer target type
x.c:5: warning: passing arg 9 of `gdImageStringFT' discards qualifiers from 
pointer target type

 */
#include <gd.h>
const char fontlist[] = "font";
const char string[] = "hello world";
int main(int argc, char *argv[]) {
  const char *fontlist = "font";
  char *s = gdImageStringFT (NULL, NULL, 0, fontlist, 0.0, 0.0, 0, 0, string);
  return s ? 0 : 1;
}

-- System Information:
Debian Release: 3.1
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: i386 (i686)
Kernel: Linux 2.4.26-1-686
Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968)

Versions of packages libgd2-noxpm-dev depends on:
ii  libc6-dev                   2.3.2.ds1-20 GNU C Library: Development Librari
ii  libfreetype6-dev            2.1.7-2.3    FreeType 2 font engine, developmen
ii  libgd2-noxpm                2.0.33-1.1   GD Graphics Library version 2 (wit
ii  libjpeg62-dev               6b-9         Development files for the IJG JPEG
ii  libpng12-dev [libpng12-0-de 1.2.8rel-1   PNG library - development
ii  zlib1g-dev                  1:1.2.2-4    compression library - development

-- no debconf information


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to