diff options
author | Fujii Hironori <fujii.hironori@gmail.com> | 2017-06-20 13:17:09 +0200 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2017-06-20 13:17:49 +0200 |
commit | 4d336756fa7f47aa0a79e98fb4dea5c3e1b35d31 (patch) | |
tree | 8080739c1996f09ceb9aa545f6f09a6a0738131c /winsup/utils | |
parent | c5ca43f35913a7d0b2ec786e27c629d1c5ed0715 (diff) | |
download | newlib-4d336756fa7f47aa0a79e98fb4dea5c3e1b35d31.zip newlib-4d336756fa7f47aa0a79e98fb4dea5c3e1b35d31.tar.gz newlib-4d336756fa7f47aa0a79e98fb4dea5c3e1b35d31.tar.bz2 |
cygwin: regtool: encode error messages correctly
Error messages of regtool can't be read, which are encoded in,
for instance, SHIFT_JIS in Japanese Windows. Fix by using
wide chars instead of multibyte.
Diffstat (limited to 'winsup/utils')
-rw-r--r-- | winsup/utils/regtool.cc | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/winsup/utils/regtool.cc b/winsup/utils/regtool.cc index ad746ad..a44d907 100644 --- a/winsup/utils/regtool.cc +++ b/winsup/utils/regtool.cc @@ -197,13 +197,14 @@ print_version () void Fail (unsigned int rv) { - char *buf; + wchar_t *buf; + if (!quiet) { - FormatMessage (FORMAT_MESSAGE_ALLOCATE_BUFFER - | FORMAT_MESSAGE_FROM_SYSTEM, - 0, rv, 0, (CHAR *) & buf, 0, 0); - fprintf (stderr, "Error (%d): %s\n", rv, buf); + FormatMessageW (FORMAT_MESSAGE_ALLOCATE_BUFFER + | FORMAT_MESSAGE_FROM_SYSTEM, + 0, rv, 0, (WCHAR *)& buf, 0, 0); + fprintf (stderr, "Error (%d): %ls\n", rv, buf); LocalFree (buf); } exit (1); |