This is the mail archive of the cygwin-cvs@cygwin.com mailing list for the Cygwin 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]

[newlib-cygwin] Drop has_always_all_codepages flag


https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=ed0ff4b9407492e976302d8a60142bfe54598d80

commit ed0ff4b9407492e976302d8a60142bfe54598d80
Author: Corinna Vinschen <corinna@vinschen.de>
Date:   Tue Dec 15 15:10:33 2015 +0100

    Drop has_always_all_codepages flag

Diff:
---
 newlib/libc/locale/locale.c |  2 --
 winsup/cygwin/nlsfuncs.cc   | 47 +--------------------------------------------
 winsup/cygwin/wincap.cc     |  7 -------
 winsup/cygwin/wincap.h      |  2 --
 4 files changed, 1 insertion(+), 57 deletions(-)

diff --git a/newlib/libc/locale/locale.c b/newlib/libc/locale/locale.c
index 77b53a9..161f99a 100644
--- a/newlib/libc/locale/locale.c
+++ b/newlib/libc/locale/locale.c
@@ -1022,7 +1022,6 @@ _DEFUN(_localeconv_r, (data),
 
 #ifndef _REENT_ONLY
 
-#ifndef __CYGWIN__
 /* Cygwin provides its own version of setlocale to perform some more
    initialization work.  It calls _setlocale_r, though. */
 char *
@@ -1032,7 +1031,6 @@ _DEFUN(setlocale, (category, locale),
 {
   return _setlocale_r (_REENT, category, locale);
 }
-#endif /* __CYGWIN__ */
 
 struct lconv *
 _DEFUN_VOID(localeconv)
diff --git a/winsup/cygwin/nlsfuncs.cc b/winsup/cygwin/nlsfuncs.cc
index 1fc3086..093464a 100644
--- a/winsup/cygwin/nlsfuncs.cc
+++ b/winsup/cygwin/nlsfuncs.cc
@@ -1557,35 +1557,6 @@ __set_locale_from_locale_alias (const char *locale, char *new_locale)
   return ret;
 }
 
-static char *
-check_codepage (char *ret)
-{
-  if (!wincap.has_always_all_codepages ())
-    {
-      /* Prior to Windows Vista, many codepages are not installed by
-	 default, or can be deinstalled.  The following codepages require
-	 that the respective conversion tables are installed into the OS.
-	 So we check if they are installed and if not, setlocale should
-	 fail. */
-      CPINFO cpi;
-      UINT cp = 0;
-      if (__mbtowc == __sjis_mbtowc)
-	cp = 932;
-      else if (__mbtowc == __eucjp_mbtowc)
-	cp = 20932;
-      else if (__mbtowc == __gbk_mbtowc)
-	cp = 936;
-      else if (__mbtowc == __kr_mbtowc)
-	cp = 949;
-      else if (__mbtowc == __big5_mbtowc)
-	cp = 950;
-      if (cp && !GetCPInfo (cp, &cpi)
-	  && GetLastError () == ERROR_INVALID_PARAMETER)
-	return NULL;
-    }
-  return ret;
-}
-
 /* Can be called via cygwin_internal (CW_INTERNAL_SETLOCALE) for application
    which really (think they) know what they are doing. */
 extern "C" void
@@ -1650,22 +1621,6 @@ void
 initial_setlocale ()
 {
   char *ret = _setlocale_r (_REENT, LC_CTYPE, "");
-  if (ret && check_codepage (ret))
+  if (ret)
     internal_setlocale ();
 }
-
-/* Like newlib's setlocale, but additionally check if the charset needs
-   OS support and the required codepage is actually installed.  If codepage
-   is not available, revert to previous locale and return NULL.  For details
-   about codepage availability, see the comment in check_codepage() above. */
-extern "C" char *
-setlocale (int category, const char *locale)
-{
-  char old[(LC_MESSAGES + 1) * (ENCODING_LEN + 1/*"/"*/ + 1)];
-  if (locale && !wincap.has_always_all_codepages ())
-    stpcpy (old, _setlocale_r (_REENT, category, NULL));
-  char *ret = _setlocale_r (_REENT, category, locale);
-  if (ret && locale && !(ret = check_codepage (ret)))
-    _setlocale_r (_REENT, category, old);
-  return ret;
-}
diff --git a/winsup/cygwin/wincap.cc b/winsup/cygwin/wincap.cc
index e3da924..5d0db71 100644
--- a/winsup/cygwin/wincap.cc
+++ b/winsup/cygwin/wincap.cc
@@ -25,7 +25,6 @@ wincaps wincap_xpsp2 __attribute__((section (".cygwin_dll_common"), shared)) = {
   has_gaa_largeaddress_bug:false,
   has_transactions:false,
   has_broken_alloc_console:false,
-  has_always_all_codepages:false,
   has_localenames:false,
   has_fast_cwd:false,
   has_restricted_raw_disk_access:false,
@@ -53,7 +52,6 @@ wincaps wincap_2003 __attribute__((section (".cygwin_dll_common"), shared)) = {
   has_gaa_largeaddress_bug:false,
   has_transactions:false,
   has_broken_alloc_console:false,
-  has_always_all_codepages:false,
   has_localenames:false,
   has_fast_cwd:false,
   has_restricted_raw_disk_access:false,
@@ -81,7 +79,6 @@ wincaps wincap_vista __attribute__((section (".cygwin_dll_common"), shared)) = {
   has_gaa_largeaddress_bug:true,
   has_transactions:true,
   has_broken_alloc_console:false,
-  has_always_all_codepages:true,
   has_localenames:true,
   has_fast_cwd:true,
   has_restricted_raw_disk_access:true,
@@ -109,7 +106,6 @@ wincaps wincap_7 __attribute__((section (".cygwin_dll_common"), shared)) = {
   has_gaa_largeaddress_bug:true,
   has_transactions:true,
   has_broken_alloc_console:true,
-  has_always_all_codepages:true,
   has_localenames:true,
   has_fast_cwd:true,
   has_restricted_raw_disk_access:true,
@@ -137,7 +133,6 @@ wincaps wincap_8 __attribute__((section (".cygwin_dll_common"), shared)) = {
   has_gaa_largeaddress_bug:false,
   has_transactions:true,
   has_broken_alloc_console:true,
-  has_always_all_codepages:true,
   has_localenames:true,
   has_fast_cwd:true,
   has_restricted_raw_disk_access:true,
@@ -165,7 +160,6 @@ wincaps wincap_10 __attribute__((section (".cygwin_dll_common"), shared)) = {
   has_gaa_largeaddress_bug:false,
   has_transactions:true,
   has_broken_alloc_console:true,
-  has_always_all_codepages:true,
   has_localenames:true,
   has_fast_cwd:true,
   has_restricted_raw_disk_access:true,
@@ -193,7 +187,6 @@ wincaps wincap_10_1511 __attribute__((section (".cygwin_dll_common"), shared)) =
   has_gaa_largeaddress_bug:false,
   has_transactions:true,
   has_broken_alloc_console:true,
-  has_always_all_codepages:true,
   has_localenames:true,
   has_fast_cwd:true,
   has_restricted_raw_disk_access:true,
diff --git a/winsup/cygwin/wincap.h b/winsup/cygwin/wincap.h
index 529e7d7..5950e59 100644
--- a/winsup/cygwin/wincap.h
+++ b/winsup/cygwin/wincap.h
@@ -18,7 +18,6 @@ struct wincaps
   unsigned has_gaa_largeaddress_bug			: 1;
   unsigned has_transactions				: 1;
   unsigned has_broken_alloc_console			: 1;
-  unsigned has_always_all_codepages			: 1;
   unsigned has_localenames				: 1;
   unsigned has_fast_cwd					: 1;
   unsigned has_restricted_raw_disk_access		: 1;
@@ -71,7 +70,6 @@ public:
   bool	IMPLEMENT (has_gaa_largeaddress_bug)
   bool	IMPLEMENT (has_transactions)
   bool	IMPLEMENT (has_broken_alloc_console)
-  bool	IMPLEMENT (has_always_all_codepages)
   bool	IMPLEMENT (has_localenames)
   bool	IMPLEMENT (has_fast_cwd)
   bool	IMPLEMENT (has_restricted_raw_disk_access)


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