aboutsummaryrefslogtreecommitdiffstats
path: root/wiretap
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2014-03-14 18:36:36 -0700
committerGuy Harris <guy@alum.mit.edu>2014-03-15 01:37:03 +0000
commit3158a5b22e91f406c6ced070e73cc6efeb125485 (patch)
tree3739676abf8c62f3c55df041340eb9407b01a2da /wiretap
parentba7e5e322e28909228bd3bfd251d5a727bc73ff4 (diff)
Use vwr->STATS_LEN instead of numbers, and eliminate redundant checks.
Instead of throwing in 48 and 64 as numbers, use vwr->STATS_LEN to indicate what the lengths are. Yeah, it has to be fetched at run time, but big deal. That also shows that, as we've already rejected records whose size is less than vwr->STATS_LEN, we don't have to check for that, so eliminate those checks. Change-Id: Id4822b3e5a02abfffb2da96a50999e36548a4279 Reviewed-on: https://code.wireshark.org/review/663 Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'wiretap')
-rw-r--r--wiretap/vwr.c10
1 files changed, 2 insertions, 8 deletions
diff --git a/wiretap/vwr.c b/wiretap/vwr.c
index 2074f5d83e..a05f09452e 100644
--- a/wiretap/vwr.c
+++ b/wiretap/vwr.c
@@ -1078,12 +1078,9 @@ static int parse_s1_W_stats(vwr_t *vwr, struct wtap_pkthdr *phdr, guint8 *rec,
float phyRate;
- if (rec_size<64)
- rec_size = 64;
-
/* Calculate the start of the statistics block in the buffer */
/* Also get a bunch of fields from the stats block */
- s_ptr = &(rec[rec_size - 64]); /* point to it */
+ s_ptr = &(rec[rec_size - vwr->STATS_LEN]); /* point to it */
m_type = s_ptr[1] & 0x7;
f_tx = !(s_ptr[1] & 0x8);
octets = pntoh16(&s_ptr[8]);
@@ -1254,13 +1251,10 @@ static int parse_s2_W_stats(vwr_t *vwr, struct wtap_pkthdr *phdr,
guint64 delta_b; /* Used for calculating latency */
- if (rec_size<48)
- rec_size = 48;
-
/* Calculate the start of the statistics block in the buffer */
/* Also get a bunch of fields from the stats block */
s_start_ptr = &(rec[0]);
- s_trail_ptr = &(rec[rec_size - 48]); /* point to it */
+ s_trail_ptr = &(rec[rec_size - vwr->STATS_LEN]); /* point to it */
/* L1p info is different for series III and for Series II - need to check */
l1p_1 = s_start_ptr[0];