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/radcom.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/radcom.c')
-rw-r--r-- | wiretap/radcom.c | 55 |
1 files changed, 15 insertions, 40 deletions
diff --git a/wiretap/radcom.c b/wiretap/radcom.c index bc19af68b4..188882fd24 100644 --- a/wiretap/radcom.c +++ b/wiretap/radcom.c @@ -122,14 +122,9 @@ int radcom_open(wtap *wth, int *err, gchar **err_info) * be located 32 bytes before the beginning of this string */ errno = WTAP_ERR_CANT_READ; if (!wtap_read_bytes(wth->fh, t_magic, 11, err, err_info)) { - if (*err == WTAP_ERR_SHORT_READ) { - /* - * Not enough bytes for the active time string, - * so not a RADCOM file. - */ - return 0; - } - return -1; + if (*err != WTAP_ERR_SHORT_READ) + return -1; + return 0; } while (memcmp(t_magic, active_time_magic, 11) != 0) { @@ -137,14 +132,9 @@ int radcom_open(wtap *wth, int *err, gchar **err_info) return -1; errno = WTAP_ERR_CANT_READ; if (!wtap_read_bytes(wth->fh, t_magic, 11, err, err_info)) { - if (*err == WTAP_ERR_SHORT_READ) { - /* - * Not enough bytes for the active time string, - * so not a RADCOM file. - */ - return 0; - } - return -1; + if (*err != WTAP_ERR_SHORT_READ) + return -1; + return 0; } } if (file_seek(wth->fh, -43, SEEK_CUR, err) == -1) return -1; @@ -153,14 +143,9 @@ int radcom_open(wtap *wth, int *err, gchar **err_info) errno = WTAP_ERR_CANT_READ; if (!wtap_read_bytes(wth->fh, &start_date, sizeof(struct frame_date), err, err_info)) { - if (*err == WTAP_ERR_SHORT_READ) { - /* - * Not enough bytes for the start time, so not - * a RADCOM file. - */ - return 0; - } - return -1; + if (*err != WTAP_ERR_SHORT_READ) + return -1; + return 0; } if (file_seek(wth->fh, sizeof(struct frame_date), SEEK_CUR, err) == -1) @@ -170,14 +155,9 @@ int radcom_open(wtap *wth, int *err, gchar **err_info) errno = WTAP_ERR_CANT_READ; if (!wtap_read_bytes(wth->fh, search_encap, 4, err, err_info)) { - if (*err == WTAP_ERR_SHORT_READ) { - /* - * Not enough bytes for the encapsulation, - * so not a RADCOM file. - */ - return 0; - } - return -1; + if (*err != WTAP_ERR_SHORT_READ) + return -1; + return 0; } if (memcmp(encap_magic, search_encap, 4) == 0) @@ -196,14 +176,9 @@ int radcom_open(wtap *wth, int *err, gchar **err_info) return -1; errno = WTAP_ERR_CANT_READ; if (!wtap_read_bytes(wth->fh, search_encap, 4, err, err_info)) { - if (*err == WTAP_ERR_SHORT_READ) { - /* - * Not enough bytes for the start time, so not - * a RADCOM file. - */ - return 0; - } - return -1; + if (*err != WTAP_ERR_SHORT_READ) + return -1; + return 0; } /* This is a radcom file */ |