diff options
author | Guy Harris <guy@alum.mit.edu> | 2013-06-16 00:20:00 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2013-06-16 00:20:00 +0000 |
commit | 8c9edf12800bc6d68894dc457e7ebaf994429da8 (patch) | |
tree | ec6efefbd4e7f8227a7b96661f721ff4ba2986c3 /wiretap/erf.c | |
parent | 3846abe34d6861c6ee0bba61fcd5baa4d213885c (diff) |
Have the seek-read routines take a Buffer rather than a guint8 pointer
as the "where to put the packet data" argument.
This lets more of the libwiretap code be common between the read and
seek-read code paths, and also allows for more flexibility in the "fill
in the data" path - we can expand the buffer as needed in both cases.
svn path=/trunk/; revision=49949
Diffstat (limited to 'wiretap/erf.c')
-rw-r--r-- | wiretap/erf.c | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/wiretap/erf.c b/wiretap/erf.c index c7c3555db8..02bb093e73 100644 --- a/wiretap/erf.c +++ b/wiretap/erf.c @@ -68,7 +68,7 @@ static int erf_read_header(FILE_T fh, static gboolean erf_read(wtap *wth, int *err, gchar **err_info, gint64 *data_offset); static gboolean erf_seek_read(wtap *wth, gint64 seek_off, - struct wtap_pkthdr *phdr, guint8 *pd, + struct wtap_pkthdr *phdr, Buffer *buf, int length, int *err, gchar **err_info); static const struct { @@ -297,10 +297,9 @@ static gboolean erf_read(wtap *wth, int *err, gchar **err_info, return FALSE; } - buffer_assure_space(wth->frame_buffer, packet_size); - - wtap_file_read_expected_bytes(buffer_start_ptr(wth->frame_buffer), - (gint32)(packet_size), wth->fh, err, err_info); + if (!wtap_read_packet_bytes(wth->fh, wth->frame_buffer, packet_size, + err, err_info)) + return FALSE; } while ( erf_header.type == ERF_TYPE_PAD ); @@ -308,7 +307,7 @@ static gboolean erf_read(wtap *wth, int *err, gchar **err_info, } static gboolean erf_seek_read(wtap *wth, gint64 seek_off, - struct wtap_pkthdr *phdr, guint8 *pd, + struct wtap_pkthdr *phdr, Buffer *buf, int length _U_, int *err, gchar **err_info) { erf_header_t erf_header; @@ -323,10 +322,8 @@ static gboolean erf_seek_read(wtap *wth, gint64 seek_off, return FALSE; } while ( erf_header.type == ERF_TYPE_PAD ); - wtap_file_read_expected_bytes(pd, (int)packet_size, wth->random_fh, err, - err_info); - - return TRUE; + return wtap_read_packet_bytes(wth->random_fh, buf, packet_size, + err, err_info); } static int erf_read_header(FILE_T fh, |