Don't bother setting phdr->pkt_encap to wth->file_encap.
wtap_read() and wtap_seek_read() now do so before calling the read or seek-read routine, so there's no need to do so in those routines. Rename hcidump_process_packet() to hcidump_read_packet() while we're at it, as it doesn't just process an already-read packet, it does the reading as well as the processing. Change-Id: Ic13da6a2096e68550d80f2eff31f03d0edb58147 Reviewed-on: https://code.wireshark.org/review/13998 Reviewed-by: Guy Harris <guy@alum.mit.edu>
This commit is contained in:
parent
7a5c04e243
commit
1e8905ca8e
|
@ -198,7 +198,6 @@ static gboolean btsnoop_read_record(wtap *wth, FILE_T fh,
|
|||
ts -= KUnixTimeBase;
|
||||
|
||||
phdr->rec_type = REC_TYPE_PACKET;
|
||||
phdr->pkt_encap = wth->file_encap;
|
||||
phdr->presence_flags = WTAP_HAS_TS|WTAP_HAS_CAP_LEN;
|
||||
phdr->ts.secs = (guint)(ts / 1000000);
|
||||
phdr->ts.nsecs = (guint)((ts % 1000000) * 1000);
|
||||
|
|
|
@ -33,7 +33,7 @@ struct dump_hdr {
|
|||
|
||||
#define DUMP_HDR_SIZE (sizeof(struct dump_hdr))
|
||||
|
||||
static gboolean hcidump_process_packet(wtap *wth, FILE_T fh, struct wtap_pkthdr *phdr,
|
||||
static gboolean hcidump_read_packet(FILE_T fh, struct wtap_pkthdr *phdr,
|
||||
Buffer *buf, int *err, gchar **err_info)
|
||||
{
|
||||
struct dump_hdr dh;
|
||||
|
@ -55,7 +55,6 @@ static gboolean hcidump_process_packet(wtap *wth, FILE_T fh, struct wtap_pkthdr
|
|||
}
|
||||
|
||||
phdr->rec_type = REC_TYPE_PACKET;
|
||||
phdr->pkt_encap = wth->file_encap;
|
||||
phdr->presence_flags = WTAP_HAS_TS;
|
||||
phdr->ts.secs = GUINT32_FROM_LE(dh.ts_sec);
|
||||
phdr->ts.nsecs = GUINT32_FROM_LE(dh.ts_usec) * 1000;
|
||||
|
@ -72,7 +71,7 @@ static gboolean hcidump_read(wtap *wth, int *err, gchar **err_info,
|
|||
{
|
||||
*data_offset = file_tell(wth->fh);
|
||||
|
||||
return hcidump_process_packet(wth, wth->fh, &wth->phdr, wth->frame_buffer,
|
||||
return hcidump_read_packet(wth->fh, &wth->phdr, wth->frame_buffer,
|
||||
err, err_info);
|
||||
}
|
||||
|
||||
|
@ -82,7 +81,7 @@ static gboolean hcidump_seek_read(wtap *wth, gint64 seek_off,
|
|||
if (file_seek(wth->random_fh, seek_off, SEEK_SET, err) == -1)
|
||||
return FALSE;
|
||||
|
||||
return hcidump_process_packet(wth, wth->random_fh, phdr, buf, err, err_info);
|
||||
return hcidump_read_packet(wth->random_fh, phdr, buf, err, err_info);
|
||||
}
|
||||
|
||||
wtap_open_return_val hcidump_open(wtap *wth, int *err, gchar **err_info)
|
||||
|
|
|
@ -195,7 +195,6 @@ packetlogger_read_packet(wtap *wth, FILE_T fh, struct wtap_pkthdr *phdr, Buffer
|
|||
}
|
||||
|
||||
phdr->rec_type = REC_TYPE_PACKET;
|
||||
phdr->pkt_encap = wth->file_encap;
|
||||
phdr->presence_flags = WTAP_HAS_TS;
|
||||
|
||||
phdr->len = pl_hdr.len - 8;
|
||||
|
|
|
@ -1540,8 +1540,6 @@ pcap_process_pseudo_header(FILE_T fh, int file_type, int wtap_encap,
|
|||
int phdr_len = 0;
|
||||
guint size;
|
||||
|
||||
phdr->pkt_encap = wtap_encap;
|
||||
|
||||
switch (wtap_encap) {
|
||||
|
||||
case WTAP_ENCAP_ATM_PDUS:
|
||||
|
|
Loading…
Reference in New Issue