summaryrefslogtreecommitdiff
path: root/wiretap/logcat.c
diff options
context:
space:
mode:
authorMichal Labedzki <michal.labedzki@tieto.com>2014-07-23 12:26:05 +0200
committerMichal Labedzki <michal.labedzki@tieto.com>2014-09-22 10:52:03 +0000
commit56a09d24dcdcaddae1cb67a18bbc2fd588c427ed (patch)
treea9961e4700a00680f7247d714709e6164f9e5d9d /wiretap/logcat.c
parentc1d6a4123a2e100a77ae8ec2b3d01544f168febc (diff)
downloadwireshark-56a09d24dcdcaddae1cb67a18bbc2fd588c427ed.tar.gz
Try to fix some buildbot warnings
Most interesting are: warning: cannot optimize loop, the loop counter may overflow [-Wunsafe-loop-optimizations] warning: ISO C forbids zero-size array [-Wpedantic] warning: ISO C90 doesn't support unnamed structs/unions [-Wpedantic] warning: cast discards '__attribute__((const))' qualifier from pointer target type [-Wcast-qual warning: initializer element is not computable at load time [enabled by default] Change-Id: I5573c6bdca856a304877d9bef643f8c0fa93cdaf Reviewed-on: https://code.wireshark.org/review/3174 Petri-Dish: Michal Labedzki <michal.labedzki@tieto.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michal Labedzki <michal.labedzki@tieto.com>
Diffstat (limited to 'wiretap/logcat.c')
-rw-r--r--wiretap/logcat.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/wiretap/logcat.c b/wiretap/logcat.c
index ff80f99a39..d71f583b9d 100644
--- a/wiretap/logcat.c
+++ b/wiretap/logcat.c
@@ -50,7 +50,9 @@ static gint detect_version(wtap *wth, int *err, gchar **err_info)
struct logger_entry_v2 *log_entry_v2;
guint8 *buffer;
guint16 tmp;
- guint8 *msg_payload, *msg_part, *msg_end;
+ guint8 *msg_payload;
+ guint8 *msg_part;
+ guint8 *msg_end;
guint16 msg_len;
/* 16-bit payload length */
@@ -90,11 +92,11 @@ static gint detect_version(wtap *wth, int *err, gchar **err_info)
* version is in use. First assume the smallest msg. */
for (version = 1; version <= 2; ++version) {
if (version == 1) {
- msg_payload = log_entry->msg;
+ msg_payload = (guint8 *) (log_entry + 1);
entry_len = sizeof(*log_entry) + payload_length;
} else if (version == 2) {
/* v2 is 4 bytes longer */
- msg_payload = log_entry_v2->msg;
+ msg_payload = (guint8 *) (log_entry_v2 + 1);
entry_len = sizeof(*log_entry_v2) + payload_length;
if (hdr_size != sizeof(*log_entry_v2))
continue;
@@ -137,18 +139,18 @@ static gint detect_version(wtap *wth, int *err, gchar **err_info)
}
gint logcat_exported_pdu_length(const guint8 *pd) {
- guint16 *tag;
- guint16 *tag_length;
- gint length = 0;
+ const guint16 *tag;
+ const guint16 *tag_length;
+ gint length = 0;
- tag = (guint16 *) pd;
+ tag = (const guint16 *) pd;
while(GINT16_FROM_BE(*tag)) {
- tag_length = (guint16 *) (pd + 2);
+ tag_length = (const guint16 *) (pd + 2);
length += 2 + 2 + GINT16_FROM_BE(*tag_length);
pd += 2 + 2 + GINT16_FROM_BE(*tag_length);
- tag = (guint16 *) pd;
+ tag = (const guint16 *) pd;
}
length += 2 + 2;