From: Julien Ramseier <j.ramseier@gmail.com>
To: musl@lists.openwall.com
Subject: localeconv and char values
Date: Mon, 21 Sep 2015 12:21:34 +0200 [thread overview]
Message-ID: <89422A70-4BF6-4733-9400-0932A85857F9@gmail.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 447 bytes --]
Hello,
Currently, all the char fields of the lconv struct returned by localeconv are set to -1.
According to http://pubs.opengroup.org/onlinepubs/9699919799/functions/localeconv.html <http://pubs.opengroup.org/onlinepubs/9699919799/functions/localeconv.html>,
negative values are not valid and CHAR_MAX should be used to indicate non-available values.
If I’m not missing anything, here’s the corresponding patch:
—
Julien
[-- Attachment #2.1: Type: text/html, Size: 847 bytes --]
[-- Attachment #2.2: fix-localeconv-char.diff --]
[-- Type: application/octet-stream, Size: 1214 bytes --]
diff --git a/src/locale/localeconv.c b/src/locale/localeconv.c
index cbc75d7..4cbb9dc 100644
--- a/src/locale/localeconv.c
+++ b/src/locale/localeconv.c
@@ -1,4 +1,5 @@
#include <locale.h>
+#include <limits.h>
static const struct lconv posix_lconv = {
.decimal_point = ".",
@@ -11,20 +12,20 @@ static const struct lconv posix_lconv = {
.mon_grouping = "",
.positive_sign = "",
.negative_sign = "",
- .int_frac_digits = -1,
- .frac_digits = -1,
- .p_cs_precedes = -1,
- .p_sep_by_space = -1,
- .n_cs_precedes = -1,
- .n_sep_by_space = -1,
- .p_sign_posn = -1,
- .n_sign_posn = -1,
- .int_p_cs_precedes = -1,
- .int_p_sep_by_space = -1,
- .int_n_cs_precedes = -1,
- .int_n_sep_by_space = -1,
- .int_p_sign_posn = -1,
- .int_n_sign_posn = -1,
+ .int_frac_digits = CHAR_MAX,
+ .frac_digits = CHAR_MAX,
+ .p_cs_precedes = CHAR_MAX,
+ .p_sep_by_space = CHAR_MAX,
+ .n_cs_precedes = CHAR_MAX,
+ .n_sep_by_space = CHAR_MAX,
+ .p_sign_posn = CHAR_MAX,
+ .n_sign_posn = CHAR_MAX,
+ .int_p_cs_precedes = CHAR_MAX,
+ .int_p_sep_by_space = CHAR_MAX,
+ .int_n_cs_precedes = CHAR_MAX,
+ .int_n_sep_by_space = CHAR_MAX,
+ .int_p_sign_posn = CHAR_MAX,
+ .int_n_sign_posn = CHAR_MAX,
};
struct lconv *localeconv(void)
[-- Attachment #2.3: Type: text/html, Size: 345 bytes --]
next reply other threads:[~2015-09-21 10:21 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-21 10:21 Julien Ramseier [this message]
2015-09-21 14:54 ` Rich Felker
2015-09-21 20:23 ` Rich Felker
2015-09-22 7:37 ` Julien Ramseier
2015-09-24 6:45 ` Rich Felker
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=89422A70-4BF6-4733-9400-0932A85857F9@gmail.com \
--to=j.ramseier@gmail.com \
--cc=musl@lists.openwall.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/musl/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).