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/tnef.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/tnef.c')
-rw-r--r-- | wiretap/tnef.c | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/wiretap/tnef.c b/wiretap/tnef.c index f2c34703c8..ad0ed42923 100644 --- a/wiretap/tnef.c +++ b/wiretap/tnef.c @@ -46,7 +46,6 @@ static void tnef_set_pkthdr(struct wtap_pkthdr *phdr, int packet_size) static gboolean tnef_read(wtap *wth, int *err, gchar **err_info, gint64 *data_offset) { gint64 offset; - guint8 *buf; gint64 file_size; int packet_size; @@ -77,17 +76,13 @@ static gboolean tnef_read(wtap *wth, int *err, gchar **err_info, gint64 *data_of tnef_set_pkthdr(&wth->phdr, packet_size); - buffer_assure_space(wth->frame_buffer, packet_size); - buf = buffer_start_ptr(wth->frame_buffer); - - wtap_file_read_expected_bytes(buf, packet_size, wth->fh, err, err_info); - - return TRUE; + return wtap_read_packet_bytes(wth->fh, wth->frame_buffer, packet_size, + err, err_info); } static gboolean tnef_seek_read(wtap *wth, gint64 seek_off, struct wtap_pkthdr *phdr, - guint8 *pd, int length, int *err, gchar **err_info) + Buffer *buf, int length, int *err, gchar **err_info) { int packet_size = length; @@ -102,9 +97,8 @@ static gboolean tnef_seek_read(wtap *wth, gint64 seek_off, tnef_set_pkthdr(phdr, packet_size); - wtap_file_read_expected_bytes(pd, packet_size, wth->random_fh, err, err_info); - - return TRUE; + return wtap_read_packet_bytes(wth->random_fh, buf, packet_size, + err, err_info); } int tnef_open(wtap *wth, int *err, gchar **err_info) |