Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F145545190
D53913.id167104.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D53913.id167104.diff
View Options
diff --git a/lib/libc/stdlib/strfmon.c b/lib/libc/stdlib/strfmon.c
--- a/lib/libc/stdlib/strfmon.c
+++ b/lib/libc/stdlib/strfmon.c
@@ -239,6 +239,16 @@
goto format_error;
}
+ /* Set default values when sign_posn is unspecified */
+ if (lc->p_sign_posn < 0 || lc->p_sign_posn > 4)
+ lc->p_sign_posn = 1;
+ if (lc->n_sign_posn < 0 || lc->n_sign_posn > 4)
+ lc->n_sign_posn = 1;
+ if (lc->int_p_sign_posn < 0 || lc->int_p_sign_posn > 4)
+ lc->int_p_sign_posn = 1;
+ if (lc->int_n_sign_posn < 0 || lc->int_n_sign_posn > 4)
+ lc->int_n_sign_posn = 1;
+
if (currency_symbol != NULL)
free(currency_symbol);
if (flags & USE_INTL_CURRENCY) {
diff --git a/lib/libc/tests/stdlib/strfmon_test.c b/lib/libc/tests/stdlib/strfmon_test.c
--- a/lib/libc/tests/stdlib/strfmon_test.c
+++ b/lib/libc/tests/stdlib/strfmon_test.c
@@ -205,8 +205,8 @@
{ "%(i", "C", "[123.45] [(123.45)]" },
{ "%(n", "en_US.UTF-8", "[$123.45] [($123.45)]" },
{ "%(i", "en_US.UTF-8", "[USD123.45] [(USD123.45)]" },
- { "%n", "C", "[123.45] [(123.45)]" }, /* XXX */
- { "%i", "C", "[123.45] [(123.45)]" }, /* XXX */
+ { "%n", "C", "[123.45] [-123.45]" },
+ { "%i", "C", "[123.45] [-123.45]" },
{ "%n", "en_US.UTF-8", "[$123.45] [-$123.45]" },
{ "%i", "en_US.UTF-8", "[USD123.45] [-USD123.45]" },
};
@@ -253,7 +253,7 @@
const char *locale;
const char *expected;
} tests[] = {
- { "C", "[ **1234.57 ] [ **1234.57 ]" }, /* XXX */
+ { "C", "[ **1234.57] [ **1234.57]" },
{ "de_DE.UTF-8", "[ **1234,57 €] [ **1.234,57 EUR]" },
{ "en_GB.UTF-8", "[ £**1234.57] [ GBP**1,234.57]" },
};
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Feb 22, 6:45 AM (8 h, 36 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
28933590
Default Alt Text
D53913.id167104.diff (1 KB)
Attached To
Mode
D53913: strfmon: Fix negative sign handling for C locale
Attached
Detach File
Event Timeline
Log In to Comment