diff options
author | Gilbert Ramirez <gram@alumni.rice.edu> | 2014-01-30 09:43:52 -0800 |
---|---|---|
committer | Alexis La Goutte <alexis.lagoutte@gmail.com> | 2014-02-03 09:26:10 +0000 |
commit | 4cc694839d45d767f4880988da3b88389774b5db (patch) | |
tree | 40905d9cf9345c56314cdfdfd04a65c6e25764df /epan/uat.c | |
parent | 479d27c69e46add652acbdd321fd3f88cfb50900 (diff) | |
download | wireshark-4cc694839d45d767f4880988da3b88389774b5db.tar.gz |
Fix all -fstrict-alias warnings found by gcc 4.1.2
The majority of the fixes are for calls to uat_new(). Instead of
having each caller cast its private data to (void**), we use void*
in the uat_new() API itself. Inside uat_new(), we cast the void*
to void**.
Some dissectors use val64_string arrays, so a VALS64() macro was
added for those, to avoid using VALS(), which is useful only for
value_string arrays.
packet-mq.c was changed because dissect_nt_sid() requires
a char**, not a guint**. All other callers of dissect_nt_sid() use
char*'s (and take the address of it) for their local storage. So,
this was changed to follow the other practices.
A confusion between gint and absolute_time_display_e in packet-time.c
was cleared up.
The ugliest fix is the addition of ip6_guint8_to_str(), for exactly
one caller. The caller uses one type of ip6 address byte array,
while ip6_to_str() expects another. This new function is in place
until the various address implementations can be consolidated.
Add VALS64() to the developer documentation.
Change-Id: If93ff5c6c8c7cc3c9510d7fb78fa9108e4552805
Reviewed-on: https://code.wireshark.org/review/48
Reviewed-by: Evan Huus <eapache@gmail.com>
Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Diffstat (limited to 'epan/uat.c')
-rw-r--r-- | epan/uat.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/epan/uat.c b/epan/uat.c index a2db7e1874..f9b4ce81f5 100644 --- a/epan/uat.c +++ b/epan/uat.c @@ -58,7 +58,7 @@ uat_t* uat_new(const char* name, size_t size, const char* filename, gboolean from_profile, - void** data_ptr, + void* data_ptr, guint* numitems_ptr, guint flags, const char* help, @@ -85,7 +85,12 @@ uat_t* uat_new(const char* name, uat->record_size = size; uat->filename = g_strdup(filename); uat->from_profile = from_profile; - uat->user_ptr = data_ptr; + /* Callers of uat_new() pass in (void*) for data_ptr, because + * that is the "universal" pointer type that can be cast to + * anything. However, for our purposes, we want a (void**). + * So, we cast (void*) data_ptr to (void**) here. That keeps + * gcc -fstrict-aliasing from complaining. */ + uat->user_ptr = (void**) data_ptr; uat->nrows_p = numitems_ptr; uat->copy_cb = copy_cb; uat->update_cb = update_cb; @@ -115,7 +120,7 @@ uat_t* uat_new(const char* name, uat->ncols = i; - *data_ptr = NULL; + *((void**)data_ptr) = NULL; *numitems_ptr = 0; return uat; |