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 2007/06/27 21:03:16 UTC

svn commit: r551274 - /incubator/stdcxx/trunk/tests/src/locale.cpp

Author: sebor
Date: Wed Jun 27 12:03:15 2007
New Revision: 551274

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

	* locale.cpp [Solaris] (rw_locales): Avoided all locale names
	starting with "iso_8859_" and the name "common" on SunOS, not
	just iso_8859_1. They're all known to cause setlocale() to
	fail.

Modified:
    incubator/stdcxx/trunk/tests/src/locale.cpp

Modified: incubator/stdcxx/trunk/tests/src/locale.cpp
URL: http://svn.apache.org/viewvc/incubator/stdcxx/trunk/tests/src/locale.cpp?view=diff&rev=551274&r1=551273&r2=551274
==============================================================================
--- incubator/stdcxx/trunk/tests/src/locale.cpp (original)
+++ incubator/stdcxx/trunk/tests/src/locale.cpp Wed Jun 27 12:03:15 2007
@@ -404,12 +404,19 @@
         // if successful, construct a char array with the locales
         while (fgets (linebuf, sizeof linebuf, file)) {
 
-            linebuf [strlen (linebuf) - 1] = '\0';
+            const size_t linelen = strlen (linebuf);
+
+            linebuf [linelen ? linelen - 1 : 0] = '\0';
 
 #ifdef _RWSTD_OS_SUNOS
 
-            // avoid the bad locale named iso_8859_1 on SunOS
-            if (!strcmp ("iso_8859_1", linebuf))
+            const char iso_8859_pfx[] = "iso_8859_";
+
+            // avoid locales named common and iso_8859_* on SunOS
+            // since they are known to cause setlocale() to fail
+            if (   !strcmp ("common", linebuf)
+                || sizeof iso_8859_pfx <= linelen 
+                && !memcmp (iso_8859_pfx, linebuf, sizeof iso_8859_pfx - 1))
                 continue;
 
 #endif   // _RWSTD_OS_SUNOS