This is the mail archive of the newlib@sourceware.org mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Read locale settings from environment


On Feb 20 13:09, Corinna Vinschen wrote:
> Ok, here's my new setlocale implementation.  It fixes the following
> problems:
> 
> - Make the static locale buffers bigger (16 instead of 12 bytes).  The
>   reason is that the longest currently supported locale, "C-ISO-8859-1",
>   has a strlen of 12 bytes.  Uh oh...
> 
> - Fix the potential access of a byte beyond the incoming locale string
>   in case the locale string is "".
> 
> - Don't return the *previous* locale setting of the category, rather
>   return the *current* locale setting, as per POSIX.  Consequentially
>   remove the last_lc_ctype and last_lc_messages variables.
> 
> - Per POSIX allow the required "POSIX" locale.  Map it to the "C" locale
>   as on Linux.
> 
> - If locale is "", honor the environment in the order required by POSIX
>   for all supported categories.
> 
> - If category is LC_ALL, return a colon separated list of the current
>   settings of all supported categories.
> 
> - If category is LC_ALL, check if the incoming locale contains a colon.
>   If so, use the input to set all supported categories accordingly.

I forgot to send the patch to libc/ctype/local.h:

	* libc/ctype/local.h (__lc_ctype): Raise size to 16 bytes in
	declaration.

Index: libc/ctype/local.h
===================================================================
RCS file: /cvs/src/src/newlib/libc/ctype/local.h,v
retrieving revision 1.1
diff -u -p -r1.1 local.h
--- libc/ctype/local.h	20 Sep 2002 20:13:10 -0000	1.1
+++ libc/ctype/local.h	23 Feb 2009 10:28:13 -0000
@@ -20,7 +20,7 @@
 #define WC_UPPER	11
 #define WC_XDIGIT	12
 
-extern char __lc_ctype[12];
+extern char __lc_ctype[16];
 
 /* Japanese encoding types supported */
 #define JP_JIS		1


Corinna

-- 
Corinna Vinschen
Cygwin Project Co-Leader
Red Hat


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]