[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnurl] 185/411: strerror: honor Unicode API choice on Windows
From: |
gnunet |
Subject: |
[gnurl] 185/411: strerror: honor Unicode API choice on Windows |
Date: |
Wed, 13 Jan 2021 01:20:00 +0100 |
This is an automated email from the git hooks/post-receive script.
nikita pushed a commit to branch master
in repository gnurl.
commit bed5f8454a4b673ab4103901362fbd7b3e0aa754
Author: Javier Blazquez <jblazquez@riotgames.com>
AuthorDate: Wed Sep 23 17:33:21 2020 -0700
strerror: honor Unicode API choice on Windows
Closes #6005
---
lib/strerror.c | 22 +++++++---------------
1 file changed, 7 insertions(+), 15 deletions(-)
diff --git a/lib/strerror.c b/lib/strerror.c
index 5893f49a9..fef5c2bca 100644
--- a/lib/strerror.c
+++ b/lib/strerror.c
@@ -44,6 +44,7 @@
#endif
#include "strerror.h"
+#include "curl_multibyte.h"
/* The last 3 #include files should be in this order */
#include "curl_printf.h"
#include "curl_memory.h"
@@ -661,28 +662,19 @@ get_winapi_error(int err, char *buf, size_t buflen)
*buf = '\0';
-#ifdef _WIN32_WCE
{
- wchar_t wbuf[256];
+ TCHAR wbuf[256];
wbuf[0] = L'\0';
if(FormatMessage((FORMAT_MESSAGE_FROM_SYSTEM |
FORMAT_MESSAGE_IGNORE_INSERTS), NULL, err,
- LANG_NEUTRAL, wbuf, sizeof(wbuf)/sizeof(wchar_t), NULL)) {
- size_t written = wcstombs(buf, wbuf, buflen - 1);
- if(written != (size_t)-1)
- buf[written] = '\0';
- else
- *buf = '\0';
+ LANG_NEUTRAL, wbuf, sizeof(wbuf)/sizeof(TCHAR), NULL)) {
+ char *msg = curlx_convert_tchar_to_UTF8(wbuf);
+ strncpy(buf, msg, buflen - 1);
+ buf[buflen-1] = '\0';
+ curlx_unicodefree(msg);
}
}
-#else
- if(!FormatMessageA((FORMAT_MESSAGE_FROM_SYSTEM |
- FORMAT_MESSAGE_IGNORE_INSERTS), NULL, err,
- LANG_NEUTRAL, buf, (DWORD)buflen, NULL)) {
- *buf = '\0';
- }
-#endif
/* Truncate multiple lines */
p = strchr(buf, '\n');
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
- [gnurl] 131/411: imap: set cselect_bits to CURL_CSELECT_IN initially, (continued)
- [gnurl] 131/411: imap: set cselect_bits to CURL_CSELECT_IN initially, gnunet, 2021/01/12
- [gnurl] 128/411: runtests: allow creating files without newlines, gnunet, 2021/01/12
- [gnurl] 147/411: TODO: add PR reference for native IDN support on macOS, gnunet, 2021/01/12
- [gnurl] 155/411: ftp: get rid of the PPSENDF macro, gnunet, 2021/01/12
- [gnurl] 167/411: parsedate: tune the date to epoch conversion, gnunet, 2021/01/12
- [gnurl] 146/411: tool_help.h: update copyright year range, gnunet, 2021/01/12
- [gnurl] 164/411: docs/MQTT: not experimental anymore, gnunet, 2021/01/12
- [gnurl] 178/411: dynbuf: make *addf() not require extra mallocs, gnunet, 2021/01/12
- [gnurl] 157/411: ftp: avoid risk of reading uninitialized integers, gnunet, 2021/01/12
- [gnurl] 170/411: setopt: return CURLE_BAD_FUNCTION_ARGUMENT on bad argument, gnunet, 2021/01/12
- [gnurl] 185/411: strerror: honor Unicode API choice on Windows,
gnunet <=
- [gnurl] 176/411: pingpong: remove a malloc per Curl_pp_vsendf call, gnunet, 2021/01/12
- [gnurl] 125/411: dynbuf: make sure Curl_dyn_tail() zero terminates, gnunet, 2021/01/12
- [gnurl] 144/411: tool_writeout: protect fputs() from NULL, gnunet, 2021/01/12
- [gnurl] 160/411: --help: strdup the category, gnunet, 2021/01/12
- [gnurl] 165/411: docs/MQTT: remove outdated paaragraphs, gnunet, 2021/01/12
- [gnurl] 175/411: symbian: drop support, gnunet, 2021/01/12
- [gnurl] 152/411: github: use new issue template feature, gnunet, 2021/01/12
- [gnurl] 171/411: http_proxy: do not count proxy headers in the header bytecount, gnunet, 2021/01/12
- [gnurl] 166/411: cmake: remove scary warning, gnunet, 2021/01/12
- [gnurl] 151/411: urlapi: use more Curl_safefree, gnunet, 2021/01/12