ANNOUNCEMENT: Live Wireshark University & Allegro Packets online APAC Wireshark Training Session
July 17th, 2024 | 10:00am-11:55am SGT (UTC+8) | Online

Ethereal-users: Re: [Ethereal-users] Errors during compile on AIX 5.1.0.0

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

From: Guy Harris <guy@xxxxxxxxxx>
Date: Tue, 5 Feb 2002 14:47:05 -0800 (PST)
> Yes, they do, but they're not trying to get a logarithm, they're trying
> to log a message!
> 
> "log()" is specified in the ANSI C89 standard; we should pick a
> different name for our internal routine.

It's a function pointer argument, not an internal routine.

Here is a patch that fixes routines in "epan/ftypes" to use "logfunc",
rather than "log", as the argument name.
Index: epan/ftypes/ftype-bytes.c
===================================================================
RCS file: /usr/local/cvsroot/ethereal/epan/ftypes/ftype-bytes.c,v
retrieving revision 1.9
diff -c -r1.9 epan/ftypes/ftype-bytes.c
*** epan/ftypes/ftype-bytes.c	2002/01/21 07:37:39	1.9
--- epan/ftypes/ftype-bytes.c	2002/02/05 22:42:46
***************
*** 98,104 ****
  }
  	
  static gboolean
! val_from_string(fvalue_t *fv, char *s, LogFunc log)
  {
  	GByteArray	*bytes;
  	guint8		val;
--- 98,104 ----
  }
  	
  static gboolean
! val_from_string(fvalue_t *fv, char *s, LogFunc logfunc)
  {
  	GByteArray	*bytes;
  	guint8		val;
***************
*** 182,189 ****
  	}
  
  	if (fail) {
! 		if (log != NULL)
! 			log("\"%s\" is not a valid byte string.", s);
  		g_byte_array_free(bytes, TRUE);
  		return FALSE;
  	}
--- 182,189 ----
  	}
  
  	if (fail) {
! 		if (logfunc != NULL)
! 			logfunc("\"%s\" is not a valid byte string.", s);
  		g_byte_array_free(bytes, TRUE);
  		return FALSE;
  	}
***************
*** 195,201 ****
  }
  
  static gboolean
! ether_from_string(fvalue_t *fv, char *s, LogFunc log)
  {
  	guint8	*mac;
  
--- 195,201 ----
  }
  
  static gboolean
! ether_from_string(fvalue_t *fv, char *s, LogFunc logfunc)
  {
  	guint8	*mac;
  
***************
*** 210,216 ****
  
  	mac = get_ether_addr(s);
  	if (!mac) {
! 		log("\"%s\" is not a valid hostname or Ethernet address.", s);
  		return FALSE;
  	}
  
--- 210,217 ----
  
  	mac = get_ether_addr(s);
  	if (!mac) {
! 		logfunc("\"%s\" is not a valid hostname or Ethernet address.",
! 		    s);
  		return FALSE;
  	}
  
***************
*** 219,230 ****
  }
  
  static gboolean
! ipv6_from_string(fvalue_t *fv, char *s, LogFunc log)
  {
  	guint8	buffer[16];
  
  	if (!get_host_ipaddr6(s, (struct e_in6_addr*)buffer)) {
! 		log("\"%s\" is not a valid hostname or IPv6 address.", s);
  		return FALSE;
  	}
  
--- 220,231 ----
  }
  
  static gboolean
! ipv6_from_string(fvalue_t *fv, char *s, LogFunc logfunc)
  {
  	guint8	buffer[16];
  
  	if (!get_host_ipaddr6(s, (struct e_in6_addr*)buffer)) {
! 		logfunc("\"%s\" is not a valid hostname or IPv6 address.", s);
  		return FALSE;
  	}
  
***************
*** 233,244 ****
  }
  
  static gboolean
! u64_from_string(fvalue_t *fv, char *s, LogFunc log)
  {
  	guint8	buffer[8];
  
  	if (atou64(s, buffer) == NULL) {
! 		log("\"%s\" is not a valid integer", s);
  		return FALSE;
  	}
  
--- 234,245 ----
  }
  
  static gboolean
! u64_from_string(fvalue_t *fv, char *s, LogFunc logfunc)
  {
  	guint8	buffer[8];
  
  	if (atou64(s, buffer) == NULL) {
! 		logfunc("\"%s\" is not a valid integer", s);
  		return FALSE;
  	}
  
***************
*** 247,258 ****
  }
  
  static gboolean
! i64_from_string(fvalue_t *fv, char *s, LogFunc log)
  {
  	guint8	buffer[8];
  
  	if (atoi64(s, buffer) == NULL) {
! 		log("\"%s\" is not a valid integer", s);
  		return FALSE;
  	}
  
--- 248,259 ----
  }
  
  static gboolean
! i64_from_string(fvalue_t *fv, char *s, LogFunc logfunc)
  {
  	guint8	buffer[8];
  
  	if (atoi64(s, buffer) == NULL) {
! 		logfunc("\"%s\" is not a valid integer", s);
  		return FALSE;
  	}
  
Index: epan/ftypes/ftype-double.c
===================================================================
RCS file: /usr/local/cvsroot/ethereal/epan/ftypes/ftype-double.c,v
retrieving revision 1.4
diff -c -r1.4 epan/ftypes/ftype-double.c
*** epan/ftypes/ftype-double.c	2001/07/13 00:55:56	1.4
--- epan/ftypes/ftype-double.c	2002/02/05 22:42:46
***************
*** 1,11 ****
  /*
-  *
   * $Id: ftype-double.c,v 1.4 2001/07/13 00:55:56 guy Exp $
   *
   * Ethereal - Network traffic analyzer
!  * By Gerald Combs <gerald@xxxxxxxx>
   * Copyright 2001 Gerald Combs
-  *
   * 
   * This program is free software; you can redistribute it and/or
   * modify it under the terms of the GNU General Public License
--- 1,9 ----
  /*
   * $Id: ftype-double.c,v 1.4 2001/07/13 00:55:56 guy Exp $
   *
   * Ethereal - Network traffic analyzer
!  * By Gerald Combs <gerald@xxxxxxxxxxxx>
   * Copyright 2001 Gerald Combs
   * 
   * This program is free software; you can redistribute it and/or
   * modify it under the terms of the GNU General Public License
***************
*** 50,56 ****
  }
  
  static gboolean
! val_from_string(fvalue_t *fv, char *s, LogFunc log)
  {
  	char    *endptr = NULL;
  
--- 48,54 ----
  }
  
  static gboolean
! val_from_string(fvalue_t *fv, char *s, LogFunc logfunc)
  {
  	char    *endptr = NULL;
  
***************
*** 58,75 ****
  
  	if (endptr == s || *endptr != '\0') {
  		/* This isn't a valid number. */
! 		log("\"%s\" is not a valid number.", s);
  		return FALSE;
  	}
  	if (errno == ERANGE) {
  		if (fv->value.floating == 0) {
! 			log("\"%s\" causes floating-point underflow.", s);
  		}
  		else if (fv->value.floating == HUGE_VAL) {
! 			log("\"%s\" causes floating-point overflow.", s);
  		}
  		else {
! 			log("\"%s\" is not a valid floating-point number.", s);
  		}
  		return FALSE;
  	}
--- 56,74 ----
  
  	if (endptr == s || *endptr != '\0') {
  		/* This isn't a valid number. */
! 		logfunc("\"%s\" is not a valid number.", s);
  		return FALSE;
  	}
  	if (errno == ERANGE) {
  		if (fv->value.floating == 0) {
! 			logfunc("\"%s\" causes floating-point underflow.", s);
  		}
  		else if (fv->value.floating == HUGE_VAL) {
! 			logfunc("\"%s\" causes floating-point overflow.", s);
  		}
  		else {
! 			logfunc("\"%s\" is not a valid floating-point number.",
! 			    s);
  		}
  		return FALSE;
  	}
Index: epan/ftypes/ftype-integer.c
===================================================================
RCS file: /usr/local/cvsroot/ethereal/epan/ftypes/ftype-integer.c,v
retrieving revision 1.7
diff -c -r1.7 epan/ftypes/ftype-integer.c
*** epan/ftypes/ftype-integer.c	2002/01/21 07:37:39	1.7
--- epan/ftypes/ftype-integer.c	2002/02/05 22:42:46
***************
*** 54,60 ****
  }
  
  static gboolean
! val_from_string(fvalue_t *fv, char *s, LogFunc log)
  {
  	char    *endptr;
  
--- 54,60 ----
  }
  
  static gboolean
! val_from_string(fvalue_t *fv, char *s, LogFunc logfunc)
  {
  	char    *endptr;
  
***************
*** 62,78 ****
  
  	if (endptr == s || *endptr != '\0') {
  		/* This isn't a valid number. */
! 		if (log != NULL)
! 			log("\"%s\" is not a valid number.", s);
  		return FALSE;
  	}
  	if (errno == ERANGE) {
! 		if (log != NULL) {
  			if (fv->value.integer == ULONG_MAX) {
! 				log("\"%s\" causes an integer overflow.", s);
  			}
  			else {
! 				log("\"%s\" is not an integer.", s);
  			}
  		}
  		return FALSE;
--- 62,79 ----
  
  	if (endptr == s || *endptr != '\0') {
  		/* This isn't a valid number. */
! 		if (logfunc != NULL)
! 			logfunc("\"%s\" is not a valid number.", s);
  		return FALSE;
  	}
  	if (errno == ERANGE) {
! 		if (logfunc != NULL) {
  			if (fv->value.integer == ULONG_MAX) {
! 				logfunc("\"%s\" causes an integer overflow.",
! 				    s);
  			}
  			else {
! 				logfunc("\"%s\" is not an integer.", s);
  			}
  		}
  		return FALSE;
***************
*** 82,88 ****
  }
  
  static gboolean
! ipxnet_from_string(fvalue_t *fv, char *s, LogFunc log)
  {
  	guint32 	val;
  	gboolean	known;
--- 83,89 ----
  }
  
  static gboolean
! ipxnet_from_string(fvalue_t *fv, char *s, LogFunc logfunc)
  {
  	guint32 	val;
  	gboolean	known;
***************
*** 102,108 ****
  		return TRUE;
  	}
  
! 	log("\"%s\" is not a valid IPX network name or address.", s);
  	return FALSE;
  }
  
--- 103,109 ----
  		return TRUE;
  	}
  
! 	logfunc("\"%s\" is not a valid IPX network name or address.", s);
  	return FALSE;
  }
  
Index: epan/ftypes/ftype-ipv4.c
===================================================================
RCS file: /usr/local/cvsroot/ethereal/epan/ftypes/ftype-ipv4.c,v
retrieving revision 1.7
diff -c -r1.7 epan/ftypes/ftype-ipv4.c
*** epan/ftypes/ftype-ipv4.c	2002/01/21 07:37:39	1.7
--- epan/ftypes/ftype-ipv4.c	2002/02/05 22:42:46
***************
*** 45,51 ****
  }
  
  static gboolean
! val_from_string(fvalue_t *fv, char *s, LogFunc log)
  {
  	guint32	addr;
  	unsigned int nmask_bits;
--- 45,51 ----
  }
  
  static gboolean
! val_from_string(fvalue_t *fv, char *s, LogFunc logfunc)
  {
  	guint32	addr;
  	unsigned int nmask_bits;
***************
*** 65,71 ****
  		/* I just checked for slash! I shouldn't get NULL here.
  		 * Double check just in case. */
  		if (!addr_str) {
! 			log("Unexpected strtok() error parsing IP address: %s", s_copy);
  			g_free(s_copy);
  			return FALSE;
  		}
--- 65,72 ----
  		/* I just checked for slash! I shouldn't get NULL here.
  		 * Double check just in case. */
  		if (!addr_str) {
! 			logfunc("Unexpected strtok() error parsing IP address: %s",
! 			    s_copy);
  			g_free(s_copy);
  			return FALSE;
  		}
***************
*** 75,81 ****
  	}
  
  	if (!get_host_ipaddr(addr_str, &addr)) {
! 		log("\"%s\" is not a valid hostname or IPv4 address.", addr_str);
  		if (has_slash) {
  			g_free(s_copy);
  		}
--- 76,83 ----
  	}
  
  	if (!get_host_ipaddr(addr_str, &addr)) {
! 		logfunc("\"%s\" is not a valid hostname or IPv4 address.",
! 		    addr_str);
  		if (has_slash) {
  			g_free(s_copy);
  		}
***************
*** 90,101 ****
  		/* I checked for slash! I shouldn't get NULL here.
  		 * Double check just in case. */
  		if (!net_str) {
! 			log("Unexpected strtok() error parsing netmask: %s", s_copy);
  			g_free(s_copy);
  			return FALSE;
  		}
  
! 		nmask_fvalue = fvalue_from_string(FT_UINT32, net_str, log);
  		g_free(s_copy);
  		if (!nmask_fvalue) {
  			return FALSE;
--- 92,104 ----
  		/* I checked for slash! I shouldn't get NULL here.
  		 * Double check just in case. */
  		if (!net_str) {
! 			logfunc("Unexpected strtok() error parsing netmask: %s",
! 			    s_copy);
  			g_free(s_copy);
  			return FALSE;
  		}
  
! 		nmask_fvalue = fvalue_from_string(FT_UINT32, net_str, logfunc);
  		g_free(s_copy);
  		if (!nmask_fvalue) {
  			return FALSE;
***************
*** 104,110 ****
  		fvalue_free(nmask_fvalue);
  
  		if (nmask_bits > 32) {
! 			log("Netmask bits in a CIDR IPv4 address should be <= 32, not %u",
  					nmask_bits);
  			return FALSE;
  		}
--- 107,113 ----
  		fvalue_free(nmask_fvalue);
  
  		if (nmask_bits > 32) {
! 			logfunc("Netmask bits in a CIDR IPv4 address should be <= 32, not %u",
  					nmask_bits);
  			return FALSE;
  		}
Index: epan/ftypes/ftype-string.c
===================================================================
RCS file: /usr/local/cvsroot/ethereal/epan/ftypes/ftype-string.c,v
retrieving revision 1.4
diff -c -r1.4 epan/ftypes/ftype-string.c
*** epan/ftypes/ftype-string.c	2001/07/15 20:31:02	1.4
--- epan/ftypes/ftype-string.c	2002/02/05 22:42:46
***************
*** 2,10 ****
   * $Id: ftype-string.c,v 1.4 2001/07/15 20:31:02 guy Exp $
   *
   * Ethereal - Network traffic analyzer
!  * By Gerald Combs <gerald@xxxxxxxx>
   * Copyright 2001 Gerald Combs
-  *
   * 
   * This program is free software; you can redistribute it and/or
   * modify it under the terms of the GNU General Public License
--- 2,9 ----
   * $Id: ftype-string.c,v 1.4 2001/07/15 20:31:02 guy Exp $
   *
   * Ethereal - Network traffic analyzer
!  * By Gerald Combs <gerald@xxxxxxxxxxxx>
   * Copyright 2001 Gerald Combs
   * 
   * This program is free software; you can redistribute it and/or
   * modify it under the terms of the GNU General Public License
***************
*** 61,67 ****
  }
  
  static gboolean
! val_from_string(fvalue_t *fv, char *s, LogFunc log)
  {
  	fv->value.string = g_strdup(s);
  	return TRUE;
--- 60,66 ----
  }
  
  static gboolean
! val_from_string(fvalue_t *fv, char *s, LogFunc logfunc)
  {
  	fv->value.string = g_strdup(s);
  	return TRUE;
Index: epan/ftypes/ftype-time.c
===================================================================
RCS file: /usr/local/cvsroot/ethereal/epan/ftypes/ftype-time.c,v
retrieving revision 1.15
diff -c -r1.15 epan/ftypes/ftype-time.c
*** epan/ftypes/ftype-time.c	2002/01/30 10:19:44	1.15
--- epan/ftypes/ftype-time.c	2002/02/05 22:42:47
***************
*** 167,173 ****
  }
  
  static gboolean
! relative_val_from_string(fvalue_t *fv, char *s, LogFunc log)
  {
  	char    *curptr, *endptr;
  
--- 167,173 ----
  }
  
  static gboolean
! relative_val_from_string(fvalue_t *fv, char *s, LogFunc logfunc)
  {
  	char    *curptr, *endptr;
  
***************
*** 218,231 ****
  	return TRUE;
  
  fail:
! 	if (log != NULL)
! 		log("\"%s\" is not a valid time.", s);
  	return FALSE;
  }
  
  
  static gboolean
! absolute_val_from_string(fvalue_t *fv, char *s, LogFunc log)
  {
  	struct tm tm;
  	char    *curptr;
--- 218,231 ----
  	return TRUE;
  
  fail:
! 	if (logfunc != NULL)
! 		logfunc("\"%s\" is not a valid time.", s);
  	return FALSE;
  }
  
  
  static gboolean
! absolute_val_from_string(fvalue_t *fv, char *s, LogFunc logfunc)
  {
  	struct tm tm;
  	char    *curptr;
***************
*** 271,278 ****
  	return TRUE;
  
  fail:
! 	if (log != NULL)
! 		log("\"%s\" is not a valid absolute time. Example: \"Nov 12, 1999 08:55:44.123\"",
  		    s);
  	return FALSE;
  }
--- 271,278 ----
  	return TRUE;
  
  fail:
! 	if (logfunc != NULL)
! 		logfunc("\"%s\" is not a valid absolute time. Example: \"Nov 12, 1999 08:55:44.123\"",
  		    s);
  	return FALSE;
  }
Index: epan/ftypes/ftypes.c
===================================================================
RCS file: /usr/local/cvsroot/ethereal/epan/ftypes/ftypes.c,v
retrieving revision 1.5
diff -c -r1.5 ftypes.c
*** ftypes.c	2001/10/26 17:29:12	1.5
--- ftypes.c	2002/02/05 22:42:47
***************
*** 2,10 ****
   * $Id: ftypes.c,v 1.5 2001/10/26 17:29:12 gram Exp $
   *
   * Ethereal - Network traffic analyzer
!  * By Gerald Combs <gerald@xxxxxxxx>
   * Copyright 2001 Gerald Combs
-  *
   * 
   * This program is free software; you can redistribute it and/or
   * modify it under the terms of the GNU General Public License
--- 2,9 ----
   * $Id: ftypes.c,v 1.5 2001/10/26 17:29:12 gram Exp $
   *
   * Ethereal - Network traffic analyzer
!  * By Gerald Combs <gerald@xxxxxxxxxxxx>
   * Copyright 2001 Gerald Combs
   * 
   * This program is free software; you can redistribute it and/or
   * modify it under the terms of the GNU General Public License
***************
*** 238,255 ****
  
  
  fvalue_t*
! fvalue_from_string(ftenum_t ftype, char *s, LogFunc log)
  {
  	fvalue_t	*fv;
  
  	fv = fvalue_new(ftype);
  	if (fv->ftype->val_from_string) {
! 		if (fv->ftype->val_from_string(fv, s, log)) {
  			return fv;
  		}
  	}
  	else {
! 		log("\"%s\" cannot be converted to %s.",
  				s, ftype_pretty_name(ftype));
  	}
  	fvalue_free(fv);
--- 237,254 ----
  
  
  fvalue_t*
! fvalue_from_string(ftenum_t ftype, char *s, LogFunc logfunc)
  {
  	fvalue_t	*fv;
  
  	fv = fvalue_new(ftype);
  	if (fv->ftype->val_from_string) {
! 		if (fv->ftype->val_from_string(fv, s, logfunc)) {
  			return fv;
  		}
  	}
  	else {
! 		logfunc("\"%s\" cannot be converted to %s.",
  				s, ftype_pretty_name(ftype));
  	}
  	fvalue_free(fv);