NOTE: according to SUSV2 and other implementations, numeric elements in

LC_MONETARY, LC_NUMERIC are byte-arrays, not ASCII strings!

Fix "C" locale, change "-1" to {CHAR_MAX, '\0'} according to standards.

This is only partial fix - locale loading procedure remains broken as before
and load too big values for all locales.  All numeric strings there should be
converted with something like atoi() and placed into bytes.  Maybe I do it
later, if someone will not fix it faster.
This commit is contained in:
ache 2001-02-10 00:43:32 +00:00
parent bc66105b1d
commit 55d37192a4
2 changed files with 8 additions and 4 deletions

View File

@ -26,6 +26,7 @@
* $FreeBSD$
*/
#include <limits.h>
#include "lmonetary.h"
#include "ldpart.h"
@ -34,7 +35,7 @@ extern int __mlocale_changed;
#define LCMONETARY_SIZE (sizeof(struct lc_monetary_T) / sizeof(char *))
static char empty[] = "";
static char numempty[] = "-1";
static char numempty[] = { CHAR_MAX, '\0' };
static const struct lc_monetary_T _C_monetary_locale = {
empty , /* int_curr_symbol */

View File

@ -26,6 +26,7 @@
* $FreeBSD$
*/
#include <limits.h>
#include "lnumeric.h"
#include "ldpart.h"
@ -33,10 +34,12 @@ extern int __nlocale_changed;
#define LCNUMERIC_SIZE (sizeof(struct lc_numeric_T) / sizeof(char *))
static char numempty[] = { CHAR_MAX, '\0' };
static const struct lc_numeric_T _C_numeric_locale = {
".", /* decimal_point */
"", /* thousands_sep */
"-1" /* grouping */
".", /* decimal_point */
"", /* thousands_sep */
numempty /* grouping */
};
static struct lc_numeric_T _numeric_locale;