aboutsummaryrefslogtreecommitdiffstats
path: root/packet-rsvp.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2002-04-25 06:34:42 +0000
committerGuy Harris <guy@alum.mit.edu>2002-04-25 06:34:42 +0000
commit3af29ce7bf91b2c589dceff324dcb180aab8c600 (patch)
tree7eec1a1901f90288559f3ae6e4888ccf91ae9720 /packet-rsvp.c
parent16510d5c56f3b2f18d452ff8eeac76da1f8ecb43 (diff)
Use "%.10g", rather than "%f", for floating-point numbers. That will
display values that would fit in a 32-bit integer as integers, leaving out all trailing zeroes after the decimal point (and leaving out the decimal point if there are no digits left after the decimal point once trailing zeroes are removed), and will use scientific notation for small fractions or large numbers. svn path=/trunk/; revision=5248
Diffstat (limited to 'packet-rsvp.c')
-rw-r--r--packet-rsvp.c30
1 files changed, 15 insertions, 15 deletions
diff --git a/packet-rsvp.c b/packet-rsvp.c
index fedc259cb2..c06c42ef5c 100644
--- a/packet-rsvp.c
+++ b/packet-rsvp.c
@@ -3,7 +3,7 @@
*
* (c) Copyright Ashok Narayanan <ashokn@cisco.com>
*
- * $Id: packet-rsvp.c,v 1.61 2002/04/24 20:06:06 guy Exp $
+ * $Id: packet-rsvp.c,v 1.62 2002/04/25 06:34:42 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -1570,13 +1570,13 @@ dissect_rsvp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
param_id,
tvb_get_ntohs(tvb, offset2+2));
proto_tree_add_text(tspec_tree, tvb, offset2+4, 4,
- "Token bucket rate: %f",
+ "Token bucket rate: %.10g",
tvb_get_ntohieee_float(tvb, offset2+4));
proto_tree_add_text(tspec_tree, tvb, offset2+8, 4,
- "Token bucket size: %f",
+ "Token bucket size: %.10g",
tvb_get_ntohieee_float(tvb, offset2+8));
proto_tree_add_text(tspec_tree, tvb, offset2+12, 4,
- "Peak data rate: %f",
+ "Peak data rate: %.10g",
tvb_get_ntohieee_float(tvb, offset2+12));
proto_tree_add_text(tspec_tree, tvb, offset2+16, 4,
"Minimum policed unit [m]: %u",
@@ -1584,9 +1584,9 @@ dissect_rsvp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
proto_tree_add_text(tspec_tree, tvb, offset2+20, 4,
"Maximum packet size [M]: %u",
tvb_get_ntohl(tvb, offset2+20));
- proto_item_append_text(ti, "Token Bucket, %f bytes/sec. ",
+ proto_item_append_text(ti, "Token Bucket, %.10g bytes/sec. ",
tvb_get_ntohieee_float(tvb, offset2+4));
- proto_item_append_text(ti2, "Rate=%f Burst=%f Peak=%f m=%u M=%u",
+ proto_item_append_text(ti2, "Rate=%.10g Burst=%.10g Peak=%.10g m=%u M=%u",
tvb_get_ntohieee_float(tvb, offset2+4),
tvb_get_ntohieee_float(tvb, offset2+8),
tvb_get_ntohieee_float(tvb, offset2+12),
@@ -1747,13 +1747,13 @@ dissect_rsvp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
param_id,
tvb_get_ntohs(tvb, offset2+2));
proto_tree_add_text(flowspec_tree, tvb, offset2+4, 4,
- "Token bucket rate: %f",
+ "Token bucket rate: %.10g",
tvb_get_ntohieee_float(tvb, offset2+4));
proto_tree_add_text(flowspec_tree, tvb, offset2+8, 4,
- "Token bucket size: %f",
+ "Token bucket size: %.10g",
tvb_get_ntohieee_float(tvb, offset2+8));
proto_tree_add_text(flowspec_tree, tvb, offset2+12, 4,
- "Peak data rate: %f",
+ "Peak data rate: %.10g",
tvb_get_ntohieee_float(tvb, offset2+12));
proto_tree_add_text(flowspec_tree, tvb, offset2+16, 4,
"Minimum policed unit [m]: %u",
@@ -1761,9 +1761,9 @@ dissect_rsvp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
proto_tree_add_text(flowspec_tree, tvb, offset2+20, 4,
"Maximum packet size [M]: %u",
tvb_get_ntohl(tvb, offset2+20));
- proto_item_append_text(ti, "Token Bucket, %f bytes/sec. ",
+ proto_item_append_text(ti, "Token Bucket, %.10g bytes/sec. ",
tvb_get_ntohieee_float(tvb, offset2+4));
- proto_item_append_text(ti2, "Rate=%f Burst=%f Peak=%f m=%u M=%u",
+ proto_item_append_text(ti2, "Rate=%.10g Burst=%.10g Peak=%.10g m=%u M=%u",
tvb_get_ntohieee_float(tvb, offset2+4),
tvb_get_ntohieee_float(tvb, offset2+8),
tvb_get_ntohieee_float(tvb, offset2+12),
@@ -1792,14 +1792,14 @@ dissect_rsvp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
tvb_get_ntohs(tvb, offset2+2));
proto_tree_add_text(flowspec_tree, tvb, offset2+4, 4,
- "Rate: %f",
+ "Rate: %.10g",
tvb_get_ntohieee_float(tvb, offset2+4));
proto_tree_add_text(flowspec_tree, tvb, offset2+8, 4,
"Slack term: %u",
tvb_get_ntohl(tvb, offset2+8));
- proto_item_append_text(ti, "RSpec, %f bytes/sec. ",
+ proto_item_append_text(ti, "RSpec, %.10g bytes/sec. ",
tvb_get_ntohieee_float(tvb, offset2+4));
- proto_item_append_text(ti2, "R=%f, s=%u",
+ proto_item_append_text(ti2, "R=%.10g, s=%u",
tvb_get_ntohieee_float(tvb, offset2+4),
tvb_get_ntohl(tvb, offset2+8));
break;
@@ -1924,7 +1924,7 @@ dissect_rsvp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
/* IEEE float */
proto_tree_add_text(adspec_tree, tvb, offset2,
(phdr_length+1)<<2,
- "%s - %f (type %u, length %u)",
+ "%s - %.10g (type %u, length %u)",
str,
tvb_get_ntohieee_float(tvb, offset2+4),
id, phdr_length);