diff options
author | Guy Harris <guy@alum.mit.edu> | 2014-10-07 12:49:14 -0700 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2014-10-07 19:50:08 +0000 |
commit | 71550ba98a38508ae90df43bddd0644b2df2f717 (patch) | |
tree | 32705bb55493a9bbef53a9683d08d5170f71446e /wiretap/logcat.c | |
parent | d98debe6d04e3b2a07c8c9a03ad3a4de54ccbc27 (diff) |
Make the code a bit more like the pre-new-APIs code.
Change-Id: I40282d8825936d24480c9b77e2e7d9374b1de6b5
Reviewed-on: https://code.wireshark.org/review/4534
Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'wiretap/logcat.c')
-rw-r--r-- | wiretap/logcat.c | 30 |
1 files changed, 9 insertions, 21 deletions
diff --git a/wiretap/logcat.c b/wiretap/logcat.c index 26d7a0b2ce..63eea918a7 100644 --- a/wiretap/logcat.c +++ b/wiretap/logcat.c @@ -70,13 +70,9 @@ static gint detect_version(FILE_T fh, int *err, gchar **err_info) */ return -2; } - if (*err == WTAP_ERR_SHORT_READ) { - /* - * Not enough bytes for a packet, so not a logcat file. - */ - return 0; - } - return -1; + if (*err != WTAP_ERR_SHORT_READ) + return -1; + return 0; } payload_length = pletoh16(&tmp); @@ -89,13 +85,9 @@ static gint detect_version(FILE_T fh, int *err, gchar **err_info) /* 16-bit header length (or padding, equal to 0x0000) */ if (!wtap_read_bytes(fh, &tmp, 2, err, err_info)) { - if (*err == WTAP_ERR_SHORT_READ) { - /* - * Not enough bytes for a packet, so not a logcat file. - */ - return 0; - } - return -1; + if (*err != WTAP_ERR_SHORT_READ) + return -1; + return 0; } hdr_size = pletoh16(&tmp); read_sofar = 4; @@ -121,13 +113,9 @@ static gint detect_version(FILE_T fh, int *err, gchar **err_info) if (!wtap_read_bytes(fh, buffer + read_sofar, entry_len - read_sofar, err, err_info)) { g_free(buffer); - if (*err == WTAP_ERR_SHORT_READ) { - /* - * Not enough bytes for a packet, so not a logcat file. - */ - return 0; - } - return -1; + if (*err != WTAP_ERR_SHORT_READ) + return -1; + return 0; } read_sofar += entry_len - read_sofar; |