Make the "strings" pointer in a "header_field_info" structure a const
authorguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>
Thu, 28 Nov 2002 01:46:14 +0000 (01:46 +0000)
committerguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>
Thu, 28 Nov 2002 01:46:14 +0000 (01:46 +0000)
pointer, and put "const" into the casts in "VALS()" and "TFS()" macros,
so we don't un-constify pointers to "value_string" arrays and
"true_false_string" structures.

Make some things "const" to keep the compiler happy with the previous
change.

git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@6684 f5534014-38df-0310-8fa8-9805f1628bb7

epan/dfilter/semcheck.c
epan/proto.c
epan/proto.h

index 30f36b1b7d4c56dae4fd9805ebb9dcc53cfbb802..01d12685140a540b39f5708691b5ea215bd4cb68 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: semcheck.c,v 1.13 2002/08/28 20:40:55 jmayer Exp $
+ * $Id: semcheck.c,v 1.14 2002/11/28 01:46:14 guy Exp $
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@ethereal.com>
@@ -126,9 +126,9 @@ mk_uint32_fvalue(guint32 val)
 static fvalue_t*
 mk_fvalue_from_val_string(header_field_info *hfinfo, char *s)
 {
-       static true_false_string        default_tf = { "True", "False" };
-       true_false_string               *tf = &default_tf;
-       value_string                    *vals;
+       static const true_false_string  default_tf = { "True", "False" };
+       const true_false_string         *tf = &default_tf;
+       const value_string              *vals;
 
        /* Early return? */
        switch(hfinfo->type) {
index 468c8026883311a153ed14c50bf12b47c460deec..9a911793a93e0d4982b65e609228d22c92efb572 100644 (file)
@@ -1,7 +1,7 @@
 /* proto.c
  * Routines for protocol tree
  *
- * $Id: proto.c,v 1.76 2002/10/15 05:29:48 guy Exp $
+ * $Id: proto.c,v 1.77 2002/11/28 01:46:12 guy Exp $
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@ethereal.com>
@@ -2528,11 +2528,11 @@ fill_label_boolean(field_info *fi, gchar *label_str)
        guint32 value;
 
        header_field_info               *hfinfo = fi->hfinfo;
-       static true_false_string        default_tf = { "True", "False" };
-       true_false_string               *tfstring = &default_tf;
+       static const true_false_string  default_tf = { "True", "False" };
+       const true_false_string         *tfstring = &default_tf;
 
        if (hfinfo->strings) {
-               tfstring = (struct true_false_string*) hfinfo->strings;
+               tfstring = (const struct true_false_string*) hfinfo->strings;
        }
 
        value = fvalue_get_integer(fi->value);
index e41dacb6513118e6d7aed64fcf16d5bcaec2f673..97c849f4ffdc9b1e7ecafd03273f210d45dcfdc2 100644 (file)
@@ -1,7 +1,7 @@
 /* proto.h
  * Definitions for protocol display
  *
- * $Id: proto.h,v 1.36 2002/08/28 20:40:44 jmayer Exp $
+ * $Id: proto.h,v 1.37 2002/11/28 01:46:12 guy Exp $
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@ethereal.com>
@@ -44,10 +44,10 @@ struct _value_string;
 
 /* In order to make a const value_string[] look like a value_string*, I
  * need this macro */
-#define VALS(x)        (struct _value_string*)(x)
+#define VALS(x)        (const struct _value_string*)(x)
 
 /* ... and similarly, */
-#define TFS(x) (struct true_false_string*)(x)
+#define TFS(x) (const struct true_false_string*)(x)
 
 /* check protocol activation */
 #define CHECK_DISPLAY_AS_X(x_handle,index, tvb, pinfo, tree) { \
@@ -74,7 +74,7 @@ struct _header_field_info {
        char                            *abbrev;
        enum ftenum                     type;
        int                             display;        /* for integers only, so far. Base */
-       void                            *strings;       /* val_string or true_false_string */
+       const void                      *strings;       /* val_string or true_false_string */
        guint32                         bitmask;
        char                            *blurb;         /* Brief description of field. */