cURL / Mailing Lists / curl-library / Single Mail

curl-library

warning with gcc 4.2.1 and mprintf.c

From: Guenter Knauf <eflash_at_gmx.net>
Date: Wed, 8 Aug 2007 19:51:50 +0200

Hi,
while testing with the latest MingW32 gcc 4.2.1 I got a warning in mprintf.c:

mprintf.c: In function 'dprintf_formatf':
mprintf.c:617: warning: passing argument 1 of 'dprintf_Pass1' discards qualifiers from pointer target type

I dont know what gcc 4.2.1 doesnt like here, but this patch makes it calm again:

--- mprintf.c.orig Wed Feb 28 15:45:50 2007
+++ mprintf.c Wed Aug 08 19:34:04 2007
@@ -296,10 +296,10 @@
  *
  ******************************************************************/
 
-static long dprintf_Pass1(char *format, va_stack_t *vto, char **endpos,
+static long dprintf_Pass1(const char *format, va_stack_t *vto, char **endpos,
                           va_list arglist)
 {
- char *fmt = format;
+ char *fmt = (char *)format;
   int param_num = 0;
   long this_param;
   long width;
@@ -614,7 +614,7 @@
   va_stack_t *p;
 
   /* Do the actual %-code parsing */
- dprintf_Pass1((char *)format, vto, endpos, ap_save);
+ dprintf_Pass1(format, vto, endpos, ap_save);
 
   end = &endpos[0]; /* the initial end-position from the list dprintf_Pass1()
                        created for us */

should I commit this, or is latest gcc just crazy?

Guen.
Received on 2007-08-08