From 5126560900343dc71a873eb33055583cddc54602 Mon Sep 17 00:00:00 2001 From: Mathias Eggert Date: Mon, 2 Jul 2018 14:26:05 +0200 Subject: [PATCH 1/3] use ApiW from WIndows because we have LPWSTR --- Release/src/http/client/http_client_winhttp.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Release/src/http/client/http_client_winhttp.cpp b/Release/src/http/client/http_client_winhttp.cpp index 20bee17785..48470fda49 100644 --- a/Release/src/http/client/http_client_winhttp.cpp +++ b/Release/src/http/client/http_client_winhttp.cpp @@ -1226,7 +1226,7 @@ class winhttp_client : public _http_client_communicator const auto size = CertNameToStr(X509_ASN_ENCODING, pcert_name, CERT_X500_NAME_STR, nullptr, 0); auto nameString = std::unique_ptr(new utility::string_t::value_type [size]); - CertNameToStr(X509_ASN_ENCODING, pcert_name, CERT_X500_NAME_STR, nameString.get(), size); + CertNameToStrW(X509_ASN_ENCODING, pcert_name, CERT_X500_NAME_STR, nameString.get(), size); supported_ca.push_back(utility::conversions::to_string_t(nameString.get())); } From 7e28b63420923ebf200d5d682838a9116bdfa466 Mon Sep 17 00:00:00 2001 From: Mathias Eggert Date: Mon, 2 Jul 2018 14:27:43 +0200 Subject: [PATCH 2/3] fix unicode wstring and string conversion errors --- Release/src/json/json_parsing.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Release/src/json/json_parsing.cpp b/Release/src/json/json_parsing.cpp index 78d56d1665..1c6eb4f0b8 100644 --- a/Release/src/json/json_parsing.cpp +++ b/Release/src/json/json_parsing.cpp @@ -693,6 +693,14 @@ bool JSON_StringParser::CompleteComment(typename JSON_Parser return true; } +void convert_append_unicode_code_unit(JSON_Parser::Token &token, utf16string value) +{ + token.string_val.append(value); +} +void convert_append_unicode_code_unit(JSON_Parser::Token &token, utf16string value) +{ + token.string_val.append(::utility::conversions::utf16_to_utf8(value)); +} void convert_append_unicode_code_unit(JSON_Parser::Token &token, utf16char value) { token.string_val.push_back(value); @@ -784,7 +792,7 @@ inline bool JSON_Parser::handle_unescape_char(Token &token) utf16string compoundUTF16 = { static_cast(decoded), static_cast(decoded2) }; - token.string_val.append(::utility::conversions::utf16_to_utf8(compoundUTF16)); + convert_append_unicode_code_unit(token, compoundUTF16); } else { From 5befe09bf49c0089bc620e1e2ca15a34d0d9a3b1 Mon Sep 17 00:00:00 2001 From: Mathias Eggert Date: Mon, 2 Jul 2018 14:28:43 +0200 Subject: [PATCH 3/3] fix not used Token compile warning --- Release/src/json/json_parsing.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Release/src/json/json_parsing.cpp b/Release/src/json/json_parsing.cpp index 1c6eb4f0b8..fd0583c382 100644 --- a/Release/src/json/json_parsing.cpp +++ b/Release/src/json/json_parsing.cpp @@ -142,7 +142,7 @@ class JSON_Parser virtual bool CompleteComment(Token &token); virtual bool CompleteStringLiteral(Token &token); - int convert_unicode_to_code_point(Token &token); + int convert_unicode_to_code_point(); bool handle_unescape_char(Token &token); private: @@ -712,7 +712,7 @@ void convert_append_unicode_code_unit(JSON_Parser::Token &token, utf16char } template -int JSON_Parser::convert_unicode_to_code_point(Token &token) +int JSON_Parser::convert_unicode_to_code_point() { // A four-hexdigit Unicode character. // Transform into a 16 bit code point. @@ -777,7 +777,7 @@ inline bool JSON_Parser::handle_unescape_char(Token &token) return true; case 'u': { - int decoded = convert_unicode_to_code_point(token); + int decoded = convert_unicode_to_code_point(); if (decoded == -1) { return false; @@ -788,7 +788,7 @@ inline bool JSON_Parser::handle_unescape_char(Token &token) { // skip escape character NextCharacter(); NextCharacter(); - int decoded2 = convert_unicode_to_code_point(token); + int decoded2 = convert_unicode_to_code_point(); utf16string compoundUTF16 = { static_cast(decoded), static_cast(decoded2) };