forked from osmocom/wireshark
str_util.c: Although the glib documentation doesn't explicitly say so,
it looks like the thousands grouping (') modifier is supported so use it in format_size. capinfos.c: Set our locale. svn path=/trunk/; revision=47934daniel/osmux
parent
fb8f5b815a
commit
2f47e63a88
|
@ -62,6 +62,7 @@
|
|||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdarg.h>
|
||||
#include <locale.h>
|
||||
#include <errno.h>
|
||||
|
||||
#ifdef HAVE_UNISTD_H
|
||||
|
@ -1297,6 +1298,9 @@ main(int argc, char *argv[])
|
|||
}
|
||||
}
|
||||
|
||||
/* Set the C-language locale to the native environment. */
|
||||
setlocale(LC_ALL, "");
|
||||
|
||||
if ((argc - optind) < 1) {
|
||||
usage(TRUE);
|
||||
exit(1);
|
||||
|
@ -1372,5 +1376,6 @@ main(int argc, char *argv[])
|
|||
exit(status);
|
||||
}
|
||||
}
|
||||
|
||||
return overall_error_status;
|
||||
}
|
||||
|
|
|
@ -107,15 +107,15 @@ gchar *format_size(gint64 size, format_size_flags_e flags) {
|
|||
}
|
||||
|
||||
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]);
|
||||
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) {
|
||||
g_string_printf(human_str, "%" G_GINT64_MODIFIER "d %s", size / power / power / power, prefix[pfx_off+1]);
|
||||
g_string_printf(human_str, "%'" G_GINT64_MODIFIER "d %s", size / power / power / power, prefix[pfx_off+1]);
|
||||
} else if (size / power / power >= 10) {
|
||||
g_string_printf(human_str, "%" G_GINT64_MODIFIER "d %s", size / power / power, prefix[pfx_off+2]);
|
||||
g_string_printf(human_str, "%'" G_GINT64_MODIFIER "d %s", size / power / power, prefix[pfx_off+2]);
|
||||
} else if (size / power >= 10) {
|
||||
g_string_printf(human_str, "%" G_GINT64_MODIFIER "d %s", size / power, prefix[pfx_off+3]);
|
||||
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);
|
||||
g_string_printf(human_str, "%'" G_GINT64_MODIFIER "d ", size);
|
||||
is_small = TRUE;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue