aboutsummaryrefslogtreecommitdiffstats
path: root/proto.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2000-03-14 06:03:26 +0000
committerGuy Harris <guy@alum.mit.edu>2000-03-14 06:03:26 +0000
commitbdd64cb62b759d6a3118711beb0c0d699499d098 (patch)
tree931af4a0c560f0c694a5b1d795499134ff602f4d /proto.c
parentfae651652098b2566cdbe6e48ceaf745111b6238 (diff)
Fix some errors discovered by making GCC do format string/argument
cross-checking, and by replacing "proto_tree_add_item_format()" by multiple routines to add items of various types. Make the arguments of "proto_tree_add_bytes_format()" and "proto_tree_add_string_format()" that specify the bytes or the string be "const" pointers, so that one can pass a "const" pointer without complaints from the compiler. Squelch a (bogus, but the compiler isn't in a position to know that) complaint about an uninitialized variable. svn path=/trunk/; revision=1716
Diffstat (limited to 'proto.c')
-rw-r--r--proto.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/proto.c b/proto.c
index 6935f491df..6abb4bfa08 100644
--- a/proto.c
+++ b/proto.c
@@ -1,7 +1,7 @@
/* proto.c
* Routines for protocol tree
*
- * $Id: proto.c,v 1.55 2000/03/12 04:47:54 gram Exp $
+ * $Id: proto.c,v 1.56 2000/03/14 06:03:25 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -106,11 +106,11 @@ proto_tree_add_pi(proto_tree *tree, int hfindex, gint start, gint length,
static void
proto_tree_set_value(field_info *fi, gint length, va_list ap);
static void
-proto_tree_set_bytes(field_info *fi, guint8* start_ptr, gint length);
+proto_tree_set_bytes(field_info *fi, const guint8* start_ptr, gint length);
static void
proto_tree_set_time(field_info *fi, struct timeval *value_ptr);
static void
-proto_tree_set_string(field_info *fi, char* value);
+proto_tree_set_string(field_info *fi, const char* value);
static void
proto_tree_set_ether(field_info *fi, guint8* value);
static void
@@ -463,7 +463,7 @@ proto_tree_add_protocol_format(proto_tree *tree, int hfindex, gint start, gint l
/* Add a FT_BYTES to a proto_tree */
proto_item *
proto_tree_add_bytes_format(proto_tree *tree, int hfindex, gint start, gint length,
- guint8 *start_ptr, const char *format, ...)
+ const guint8 *start_ptr, const char *format, ...)
{
proto_item *pi;
va_list ap;
@@ -487,7 +487,7 @@ proto_tree_add_bytes_format(proto_tree *tree, int hfindex, gint start, gint leng
/* Set the FT_BYTES value */
static void
-proto_tree_set_bytes(field_info *fi, guint8* start_ptr, gint length)
+proto_tree_set_bytes(field_info *fi, const guint8* start_ptr, gint length)
{
/* This g_malloc'ed memory is freed in
@@ -629,7 +629,7 @@ proto_tree_set_ipv6(field_info *fi, guint8* value_ptr)
/* Add a FT_STRING to a proto_tree */
proto_item *
proto_tree_add_string_format(proto_tree *tree, int hfindex, gint start, gint length,
- char* value, const char *format, ...)
+ const char* value, const char *format, ...)
{
proto_item *pi;
va_list ap;
@@ -653,7 +653,7 @@ proto_tree_add_string_format(proto_tree *tree, int hfindex, gint start, gint len
/* Set the FT_STRING value */
static void
-proto_tree_set_string(field_info *fi, char* value)
+proto_tree_set_string(field_info *fi, const char* value)
{
/* This g_strdup'ed memory is freed in proto_tree_free_node() */
fi->value.string = g_strdup(value);
@@ -760,7 +760,7 @@ proto_item *
proto_tree_add_uint_format(proto_tree *tree, int hfindex, gint start, gint length,
guint32 value, const char *format, ...)
{
- proto_item *pi;
+ proto_item *pi = NULL;
va_list ap;
field_info *new_fi;
header_field_info *hfinfo;