Fix a copy+paste error and a missing include. Adjust the format_size

digit threshold.

svn path=/trunk/; revision=45456
This commit is contained in:
Gerald Combs 2012-10-10 20:19:18 +00:00
parent 5ba1ad12cc
commit f003add90f
2 changed files with 7 additions and 5 deletions

View File

@ -35,6 +35,8 @@
#include <epan/value_string.h>
#include <epan/addr_resolv.h>
#include <wsutil/str_util.h>
#include "../file.h"
#include "../capture.h"
@ -1835,7 +1837,7 @@ 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;
size_str = format_size(stat_buf.st_size, format_size_unit_bits_s|format_size_prefix_si);
size_str = format_size(uint_value, format_size_unit_bits_s|format_size_prefix_si);
g_strlcpy(string_buff, size_str, DETAILS_STR_MAX);
g_free(size_str);
} else {

View File

@ -106,13 +106,13 @@ gchar *format_size(gint64 size, format_size_flags_e flags) {
power = 1024;
}
if (size / power / power / power / power > 10) {
if (size / power / power / power / power >= 10) {
g_string_printf(human_str, "%" G_GINT64_MODIFIER "d %s", size / power / power / power / power, prefix[pfx_off]);
} else if (size / power / power / power > 10) {
} else if (size / power / power / power >= 10) {
g_string_printf(human_str, "%" G_GINT64_MODIFIER "d %s", size / power / power / power, prefix[pfx_off+1]);
} else if (size / power / power > 10) {
} else if (size / power / power >= 10) {
g_string_printf(human_str, "%" G_GINT64_MODIFIER "d %s", size / power / power, prefix[pfx_off+2]);
} else if (size / power > 10) {
} else if (size / power >= 10) {
g_string_printf(human_str, "%" G_GINT64_MODIFIER "d %s", size / power, prefix[pfx_off+3]);
} else {
g_string_printf(human_str, "%" G_GINT64_MODIFIER "d ", size);