Huge thanks to our Platinum Members Endace and LiveAction,
and our Silver Member Veeam, for supporting the Wireshark Foundation and project.

Ethereal-dev: [Ethereal-dev] Help with "different 'const' qualifiers", "pointer mismatch for a

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: "Francisco Alcoba (TS/EEM)" <francisco.alcoba@xxxxxxxxxxxx>
Date: Mon, 7 Feb 2005 08:31:52 +0100
Hi,

I'm finding lots of warnings "different 'const' qualifiers", followed by 
"pointer mismatch for actual parameters" when trying to g_free or 
g_memmove data fields from an "address" structure. address is defined in address.h as:
 
typedef struct _address {
  address_type  type;		/* type of address */
  int           len;		/* length of address, in bytes */
  const guint8 *data;		/* bytes that constitute address */
} address; 

So, if I have

	address tmp_src, tmp_dst;
	guint32 ipv4_address;

and do
      g_free(tmp_src.data);
or
	g_memmove(tmp_src.data,&ipv4_address,4);

I get both warnings in a row. I do not have them if I do

 	g_free((void *)tmp_src.data)

but I'm not sure this is OK -meaning, it will do what I need without breaking anything
else-. I've found a reference to a similar situation, that claims this to be some sort 
of VC6-specific behaviour, at:  

	http://lists.gnu.org/archive/html/bug-cvs/2004-04/msg00043.html

which was solved like this:

	http://lists.gnu.org/archive/html/bug-cvs/2004-04/msg00110.html

but I don't really know how to apply this here. Can anybody help?

Regards,

  Francisco