You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stdcxx.apache.org by se...@apache.org on 2006/06/05 22:09:21 UTC

svn commit: r411903 - /incubator/stdcxx/trunk/etc/config/src/LOCALE_NAME_FMAT.cpp

Author: sebor
Date: Mon Jun  5 13:09:21 2006
New Revision: 411903

URL: http://svn.apache.org/viewvc?rev=411903&view=rev
Log:
2006-06-05  Martin Sebor  <se...@roguewave.com>

	STDCXX-189
	* LOCALE_NAME_FMAT.cpp (MAX_LOCALE_NAME_LEN): New macro defined
	to the maximum length of a locale name sufficiently large to
	handle excessively long names generated by GNU glibc.
	(main): Used it consistently throughout.

Modified:
    incubator/stdcxx/trunk/etc/config/src/LOCALE_NAME_FMAT.cpp

Modified: incubator/stdcxx/trunk/etc/config/src/LOCALE_NAME_FMAT.cpp
URL: http://svn.apache.org/viewvc/incubator/stdcxx/trunk/etc/config/src/LOCALE_NAME_FMAT.cpp?rev=411903&r1=411902&r2=411903&view=diff
==============================================================================
--- incubator/stdcxx/trunk/etc/config/src/LOCALE_NAME_FMAT.cpp (original)
+++ incubator/stdcxx/trunk/etc/config/src/LOCALE_NAME_FMAT.cpp Mon Jun  5 13:09:21 2006
@@ -19,6 +19,13 @@
 #undef strcat
 
 
+// the longest combined locale name handled by the test (GNU glibc
+// can generate some awfully long names since in addition to the
+// name of the locale name for each category it includes the name
+// of the category itself, e.g., "LC_CTYPE=en;LC_NUMERIC=es;...")
+#define MAX_LOCALE_NAME_LEN   1024
+
+
 #if 0   // disabled
 
 // enable for debugging to emulate a system with no locales installed
@@ -126,7 +133,7 @@
     char loc_name_cat_sep     = '\0';
     char loc_name_cat_eq      = '\0';
 
-    char namebuf [1024];
+    char namebuf [MAX_LOCALE_NAME_LEN];
     namebuf [0] = '\0';
 
     // determine whether setlocale(LC_ALL, name) returns
@@ -181,14 +188,14 @@
 
         // determine if the environment has any effect on setlocale()
         {
-            char def_locale [256];
+            char def_locale [MAX_LOCALE_NAME_LEN];
             def_locale [0] = '\0';
 
             const char *tmpname = setlocale (LC_ALL, "");
             if (tmpname)
                 strcpy (def_locale, tmpname);
 
-            char buf [256];
+            char buf [MAX_LOCALE_NAME_LEN];
             strcpy (buf, "LC_COLLATE=");
             strcat (buf, locname);
             putenv (buf);