[glib] g_format_size: fix on Windows
- From: Ryan Lortie <ryanl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib] g_format_size: fix on Windows
- Date: Tue, 26 Jul 2011 11:30:45 +0000 (UTC)
commit d62d0336b8fb2d3369f02758c20c6ea38bee9464
Author: Ryan Lortie <desrt desrt ca>
Date: Tue Jul 26 13:29:01 2011 +0200
g_format_size: fix on Windows
The long format that displays the exact number of bytes with separators
(ie: "123,456,789 bytes") uses the ' format modifier, which is
unsupported on Windows. Disable that for now, until we come up with a
better solution.
glib/gfileutils.c | 10 ++++++++++
1 files changed, 10 insertions(+), 0 deletions(-)
---
diff --git a/glib/gfileutils.c b/glib/gfileutils.c
index 0101255..b7cd2d5 100644
--- a/glib/gfileutils.c
+++ b/glib/gfileutils.c
@@ -1940,7 +1940,17 @@ g_format_size_full (guint64 size,
/* Translators: the %s in "%s bytes" will always be replaced by a number. */
translated_format = g_dngettext(GETTEXT_PACKAGE, "%s byte", "%s bytes", plural_form);
+ /* XXX: Windows doesn't support the "'" format modifier, so we
+ * must not use it there. Instead, just display the number
+ * without separation. Bug #655336 is open until a solution is
+ * found.
+ */
+#ifndef G_OS_WIN32
formatted_number = g_strdup_printf ("%'"G_GUINT64_FORMAT, size);
+#else
+ formatted_number = g_strdup_printf ("%"G_GUINT64_FORMAT, size);
+#endif
+
g_string_append (string, " (");
g_string_append_printf (string, translated_format, formatted_number);
g_free (formatted_number);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]