Ethereal-dev: [Ethereal-dev] Use of C99 code in 0.10.8

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

Date: Wed, 29 Dec 2004 14:11:39 -0600
>From the SGI C compiler:
  cc-1028 cc: ERROR File = packet-bssgp.c, Line = 4292
    The expression used must have a constant value.

          BSSGP_IE_PRESENCE_M, BSSGP_IE_FORMAT_V, BSSGP_UNKNOWN, 4 },
                                                  ^

  cc-1028 cc: ERROR File = packet-bssgp.c, Line = 4295
    The expression used must have a constant value.

          BSSGP_IE_PRESENCE_M, BSSGP_IE_FORMAT_V, BSSGP_UNKNOWN, 3 },
                                                  ^
  ...

epan/dissectors/packet-bssgp.c has:
  const guint16 BSSGP_UNKNOWN = -1;

Why not just #define BSSGP_UNKNOWN?

Also:
  cc-1028 cc: ERROR File = packet-bssgp.c, Line = 5560
    The expression used must have a constant value.

      build_info_t bi = { tvb, 0, pinfo, NULL, tree, FALSE, FALSE };
                          ^

  cc-1028 cc: ERROR File = packet-bssgp.c, Line = 5560
    The expression used must have a constant value.

      build_info_t bi = { tvb, 0, pinfo, NULL, tree, FALSE, FALSE };
                                  ^

  cc-1028 cc: ERROR File = packet-bssgp.c, Line = 5560
    The expression used must have a constant value.

      build_info_t bi = { tvb, 0, pinfo, NULL, tree, FALSE, FALSE };
                                               ^

How's the attached patch?

-- 
albert chin (china@xxxxxxxxxxxxxxxxxx)

-- snip snip
--- epan/dissectors/packet-bssgp.c.orig	2004-12-29 13:23:50.000000000 -0600
+++ epan/dissectors/packet-bssgp.c	2004-12-29 13:42:31.000000000 -0600
@@ -54,7 +54,7 @@
 #define BSSGP_MOBILE_IDENTITY_TYPE_NO_IDENTITY 0
 #define BSSGP_SEP ", "
 #define BSSGP_NOT_DECODED "< Not decoded yet >"
-const guint16 BSSGP_UNKNOWN = -1;
+#define BSSGP_UNKNOWN -1
 
 static dissector_handle_t bssgp_handle;
 static dissector_handle_t llc_handle;
@@ -5557,11 +5557,15 @@
 dissect_bssgp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
 {
   guint8 pdutype;
-  build_info_t bi = { tvb, 0, pinfo, NULL, tree, FALSE, FALSE };
+  build_info_t bi = { NULL, 0, NULL, NULL, NULL, FALSE, FALSE };
 
   proto_item *ti;
   proto_tree *bssgp_tree;
 
+  bi.tvb = tvb;
+  bi.pinfo = pinfo;
+  bi.parent_tree = tree;
+
   pinfo->current_proto = "BSSGP";
 
   if (check_col(pinfo->cinfo, COL_PROTOCOL)) 
--- epan/dissectors/packet-nsip.c.orig	2004-12-29 13:52:58.000000000 -0600
+++ epan/dissectors/packet-nsip.c	2004-12-29 13:53:54.000000000 -0600
@@ -1038,12 +1038,16 @@
 static void
 dissect_nsip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) {
   guint8 pdu_type;
-  build_info_t bi = { tvb, 0, pinfo, NULL, tree };
+  build_info_t bi = { NULL, 0, NULL, NULL, NULL };
   proto_item *ti;
   proto_tree *nsip_tree;
   char ericsson_src[ERICSSON_DESCR_LEN];
   char ericsson_dst[ERICSSON_DESCR_LEN];
 
+  bi.tvb = tvb;
+  bi.pinfo = pinfo;
+  bi.parent_tree = tree;
+
   pinfo->current_proto = "NSIP";
 
   if (check_col(pinfo->cinfo, COL_PROTOCOL))