aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>2007-04-30 16:54:29 +0000
committerguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>2007-04-30 16:54:29 +0000
commitd2330b8bc4f032e3706460038a22abab7286896c (patch)
tree1e05dcc0c18fae11ecf77ed69983ee7edfe18d11
parentb2006b9c46ce0809549dc822a49b278d3ee8f836 (diff)
Yet another workaround for GArray's bad data type choice.
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@21626 f5534014-38df-0310-8fa8-9805f1628bb7
-rw-r--r--epan/dissectors/packet-rmt-norm.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/epan/dissectors/packet-rmt-norm.c b/epan/dissectors/packet-rmt-norm.c
index 4f99e4cebd..b03b680c75 100644
--- a/epan/dissectors/packet-rmt-norm.c
+++ b/epan/dissectors/packet-rmt-norm.c
@@ -227,7 +227,24 @@ static guint dissect_norm_hdrext(struct _norm *norm, struct _fec_ptr *f, proto_t
/* Add the extensions to the subtree */
for (i = 0; i < ext->len; i++) {
- struct _ext *e = &g_array_index(ext, struct _ext, i);
+ /*
+ * The data member of a GArray isn't a void *, as
+ * it should be; it's a guint8 *, so GCC will
+ * warn about attempts to cast it to the type of
+ * an array member if -Wcast-align is specified.
+ *
+ * The code in GLib that allocates the data
+ * presumably arranges that it's aligned
+ * strictly enough for any data type (as that's
+ * how most memory allocators work), so that warning
+ * is bogus.
+ *
+ * We work around this by not using g_array_index(),
+ * but doing the indexing ourselves, and casting
+ * to the data pointer to void * first.
+ */
+ struct _ext *ext_array = (void *)ext->data;
+ struct _ext *e = &ext_array[i];
lct_ext_decode(e, &lctp, tvb, ext_tree, ett.hdrext, *f);
/* fec_decode_ext_fti(e, tvb, ext_tree, ett.hdrext, *f); */