Short-term hack to fix bug 5855 - don't try to process all the

frame_data structures for all the packets if we don't actually *have*
any frame_data structures for any packets, e.g. in TShark in one-pass
mode.

Also:

Use #if 0/#endif instead of commenting out.

Consistently use 4-space indentation.

svn path=/trunk/; revision=36879
This commit is contained in:
Guy Harris 2011-04-26 23:17:47 +00:00
parent b205288622
commit e403a2f0b2
1 changed files with 150 additions and 133 deletions

View File

@ -71,8 +71,15 @@ static void packet_range_calc(packet_range_t *range) {
range->displayed_ignored_mark_range_cnt = 0L;
range->displayed_ignored_user_range_cnt = 0L;
/* The next for-loop is used to obtain the amount of packets to be processed
* and is used to present the information in the Save/Print As widget.
/* This doesn't work unless you have a full set of frame_data
* structures for all packets in the capture, which is not,
* for example, the case when TShark is doing a one-pass
* read of a file or a live capture.
*/
if (cfile.ptree_root != NULL) {
/* The next for-loop is used to obtain the amount of packets
* to be processed and is used to present the information in
* the Save/Print As widget.
* We have different types of ranges: All the packets, the number
* of packets of a marked range, a single packet, and a user specified
* packet range. The last one is not calculated here since this
@ -144,15 +151,18 @@ static void packet_range_calc(packet_range_t *range) {
}
}
#if 0
/* in case we marked just one packet, we add 1. */
/*if (cfile.marked_count != 0) {
if (cfile.marked_count != 0) {
range->mark_range = mark_high - mark_low + 1;
}*/
}
/* in case we marked just one packet, we add 1. */
/*if (range->displayed_marked_cnt != 0) {
if (range->displayed_marked_cnt != 0) {
range->displayed_mark_range = displayed_mark_high - displayed_mark_low + 1;
}*/
}
#endif
}
}
@ -166,6 +176,12 @@ static void packet_range_calc_user(packet_range_t *range) {
range->displayed_user_range_cnt = 0L;
range->displayed_ignored_user_range_cnt = 0L;
/* This doesn't work unless you have a full set of frame_data
* structures for all packets in the capture, which is not,
* for example, the case when TShark is doing a one-pass
* read of a file or a live capture.
*/
if (cfile.ptree_root != NULL) {
for(framenum = 1; framenum <= cfile.count; framenum++) {
packet = cap_file_find_fdata(&cfile, framenum);
@ -182,6 +198,7 @@ static void packet_range_calc_user(packet_range_t *range) {
}
}
}
}
}