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/camins.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/camins.c')
-rw-r--r-- | wiretap/camins.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/wiretap/camins.c b/wiretap/camins.c index b3b481ff6b..44381ed34d 100644 --- a/wiretap/camins.c +++ b/wiretap/camins.c @@ -311,12 +311,13 @@ camins_read(wtap *wth, int *err, gchar **err_info, gint64 *data_offset) static gboolean camins_seek_read(wtap *wth, gint64 seek_off, - struct wtap_pkthdr *pkthdr, guint8 *pd, int length, + struct wtap_pkthdr *pkthdr, Buffer *buf, int length, int *err, gchar **err_info) { guint8 dat_trans_type; guint16 dat_len; gboolean ret; + guint8 *p; gint offset, bytes_read; if (-1 == file_seek(wth->random_fh, seek_off, SEEK_SET, err)) @@ -327,19 +328,21 @@ camins_seek_read(wtap *wth, gint64 seek_off, if (!ret) return FALSE; + buffer_assure_space(buf, DVB_CI_PSEUDO_HDR_LEN+dat_len); + p = buffer_start_ptr(buf); /* in the pseudo-header, we always store the length that we obtained from parsing the file (there's error conditions where this length field does not match the number of data bytes present in the file, we'll leave this to the dissector) */ - offset = create_pseudo_hdr(pd, dat_trans_type, dat_len); + offset = create_pseudo_hdr(p, dat_trans_type, dat_len); if (offset<0) return FALSE; /* we only read the number of bytes requested by wtap in order to ensure we're not overflowing the buffer */ bytes_read = read_packet_data(wth->random_fh, dat_trans_type, - &pd[offset], length, err, err_info); + &p[offset], length, err, err_info); /* see comment in camins_read() */ if (bytes_read < 0) return FALSE; |