Re: [RFA] defs.h: Define GDB_DEFAULT_TARGET_[WIDE_]CHARSET for Cygwin and MingW builds

Tom Tromey
2010-03-03T21:15:57Z

>>>>> "Corinna" == Corinna Vinschen <vinschen@redhat.com> writes:

Corinna> Maybe something along these lines would help (untested!):

I'm adding the appended to my local patch.
This is just your patch with the new global put closer to the code, and
a different preprocessor check.

Let me know if this seems wrong somehow.

Tom

diff --git a/gdb/charset.c b/gdb/charset.c
index 21c4306..9c1e7f4 100644
--- a/gdb/charset.c
+++ b/gdb/charset.c
@@ -930,6 +930,15 @@ _initialize_charset (void)
if (!strcmp (auto_host_charset_name, "646") || !*auto_host_charset_name)
auto_host_charset_name = "ASCII";
auto_target_charset_name = auto_host_charset_name;
+#elif defined (USE_WIN32API)
+ {
+ static w32_host_default_charset[16]; /* "CP" + x<=5 digits + paranoia. */
+
+ snprintf (w32_host_default_charset, sizeof w32_host_default_charset,
+ "CP%d", GetACP());
+ auto_host_charset_name = w32_host_default_charset;
+ auto_target_charset_name = auto_host_charset_name;
+ }
#endif
#endif