From 1275d05913e7ad40208fd34746748ff9ac3324b3 Mon Sep 17 00:00:00 2001 From: Michal Labedzki Date: Mon, 22 Sep 2014 10:25:32 +0200 Subject: Reduce compilator warnings warning: cast from 'const guint8 *' (aka 'const unsigned char *') to 'const guint16 *' (aka 'const unsigned short *') increases required alignment from 1 to 2 [-Wcast-align] warning: cast from 'const guint8 *' (aka 'const unsigned char *') to 'const struct logger_entry *' increases required alignment from 1 to 4 [-Wcast-align] Change-Id: I1ef8bfedb31c3f633166405689d8d788d45365db Reviewed-on: https://code.wireshark.org/review/4236 Petri-Dish: Michal Labedzki Tested-by: Petri Dish Buildbot Tested-by: Michal Labedzki Reviewed-by: Michal Labedzki --- wiretap/logcat.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'wiretap/logcat.c') diff --git a/wiretap/logcat.c b/wiretap/logcat.c index d71f583b9d..f50b118fe3 100644 --- a/wiretap/logcat.c +++ b/wiretap/logcat.c @@ -85,8 +85,8 @@ static gint detect_version(wtap *wth, int *err, gchar **err_info) /* ensure buffer is large enough for all versions */ buffer = (guint8 *) g_malloc(sizeof(*log_entry_v2) + payload_length); - log_entry_v2 = (struct logger_entry_v2 *) buffer; - log_entry = (struct logger_entry *) buffer; + log_entry_v2 = (struct logger_entry_v2 *)(void *) buffer; + log_entry = (struct logger_entry *)(void *) buffer; /* cannot rely on __pad being 0 for v1, use heuristics to find out what * version is in use. First assume the smallest msg. */ @@ -143,14 +143,14 @@ gint logcat_exported_pdu_length(const guint8 *pd) { const guint16 *tag_length; gint length = 0; - tag = (const guint16 *) pd; + tag = (const guint16 *)(const void *) pd; while(GINT16_FROM_BE(*tag)) { - tag_length = (const guint16 *) (pd + 2); + tag_length = (const guint16 *)(const void *) (pd + 2); length += 2 + 2 + GINT16_FROM_BE(*tag_length); pd += 2 + 2 + GINT16_FROM_BE(*tag_length); - tag = (const guint16 *) pd; + tag = (const guint16 *)(const void *) pd; } length += 2 + 2; @@ -187,7 +187,7 @@ static gboolean logcat_read_packet(struct logcat_phdr *logcat, FILE_T fh, ws_buffer_assure_space(buf, packet_size); pd = ws_buffer_start_ptr(buf); - log_entry = (struct logger_entry *) pd; + log_entry = (struct logger_entry *)(void *) pd; /* Copy the first two bytes of the packet. */ memcpy(pd, tmp, 2); -- cgit v1.2.1