summaryrefslogtreecommitdiff
path: root/ui/gtk/capture_if_details_dlg_win32.c
diff options
context:
space:
mode:
authorGerald Combs <gerald@wireshark.org>2012-10-10 19:17:31 +0000
committerGerald Combs <gerald@wireshark.org>2012-10-10 19:17:31 +0000
commit98b0812341cc2d0fa146b10f086c72c968068cc6 (patch)
tree83957bdea6d4b21887e3d18c2dc53d540d306738 /ui/gtk/capture_if_details_dlg_win32.c
parent2ea9adc0de37dac24226ae8a5451b6dd1d583c01 (diff)
downloadwireshark-98b0812341cc2d0fa146b10f086c72c968068cc6.tar.gz
Add a format_size function similar to g_format_size that renders a size
value in a human-readable format. Use it in the welcome screen, status bar, and Win32 interface details. Note that in the welcome screen and status bar we've switched from customary binary prefixes to strict SI. svn path=/trunk/; revision=45453
Diffstat (limited to 'ui/gtk/capture_if_details_dlg_win32.c')
-rw-r--r--ui/gtk/capture_if_details_dlg_win32.c26
1 files changed, 17 insertions, 9 deletions
diff --git a/ui/gtk/capture_if_details_dlg_win32.c b/ui/gtk/capture_if_details_dlg_win32.c
index fc2ffe7e09..c6c2673622 100644
--- a/ui/gtk/capture_if_details_dlg_win32.c
+++ b/ui/gtk/capture_if_details_dlg_win32.c
@@ -1788,6 +1788,7 @@ capture_if_details_general(GtkWidget *table, GtkWidget *main_vb, guint *row, LPA
int length;
unsigned short ushort_value;
int entries = 0;
+ gchar *size_str;
/* general */
@@ -1834,15 +1835,9 @@ capture_if_details_general(GtkWidget *table, GtkWidget *main_vb, guint *row, LPA
if (wpcap_packet_request_uint(adapter, OID_GEN_LINK_SPEED, &uint_value)) {
entries++;
uint_value *= 100;
- if(uint_value >= 1000 * 1000) {
- g_snprintf(string_buff, DETAILS_STR_MAX, "%d MBits/s", uint_value / 1000 / 1000);
- } else {
- if(uint_value >= 1000) {
- g_snprintf(string_buff, DETAILS_STR_MAX, "%d KBits/s", uint_value / 1000);
- } else {
- g_snprintf(string_buff, DETAILS_STR_MAX, "%d Bits/s", uint_value);
- }
- }
+ size_str = format_size(stat_buf.st_size, format_size_unit_bits_s|format_size_prefix_si);
+ g_strlcpy(string_buff, size_str, DETAILS_STR_MAX);
+ g_free(size_str);
} else {
g_snprintf(string_buff, DETAILS_STR_MAX, "-");
}
@@ -2389,3 +2384,16 @@ capture_if_has_details(char *iface) {
}
#endif /* HAVE_LIBPCAP && _WIN32 */
+
+/*
+ * Editor modelines - http://www.wireshark.org/tools/modelines.html
+ *
+ * Local variables:
+ * c-basic-offset: 4
+ * tab-width: 8
+ * indent-tabs-mode: nil
+ * End:
+ *
+ * vi: set shiftwidth=4 tabstop=8 expandtab:
+ * :indentSize=4:tabSize=8:noTabs=true:
+ */