martinzink commented on code in PR #1634:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1634#discussion_r1320127072
##########
libminifi/src/utils/OsUtils.cpp:
##########
@@ -336,4 +337,34 @@ std::optional<std::string> OsUtils::getHostName() {
return {hostname};
}
+#ifdef WIN32
+std::wstring OsUtils::stringToWideString(const std::string& string) {
+ if (string.empty())
+ return {};
+
+ const auto size_needed = MultiByteToWideChar(CP_UTF8, 0, &string.at(0),
static_cast<int>(string.size()), nullptr, 0);
+ if (size_needed <= 0) {
+ throw std::runtime_error("MultiByteToWideChar() failed: " +
std::to_string(size_needed));
+ }
+
+ std::wstring result(size_needed, 0);
Review Comment:
👍
https://github.com/apache/nifi-minifi-cpp/pull/1634/commits/3b513dcd2120d5e5ab361e8230060721450c6551#diff-b5759f3732506d7ec0f1b4b4ba184a6f83b4c4b142a2a9202c47afd3ae014cbcR351
##########
libminifi/src/utils/OsUtils.cpp:
##########
@@ -336,4 +337,34 @@ std::optional<std::string> OsUtils::getHostName() {
return {hostname};
}
+#ifdef WIN32
+std::wstring OsUtils::stringToWideString(const std::string& string) {
+ if (string.empty())
+ return {};
+
+ const auto size_needed = MultiByteToWideChar(CP_UTF8, 0, &string.at(0),
static_cast<int>(string.size()), nullptr, 0);
+ if (size_needed <= 0) {
+ throw std::runtime_error("MultiByteToWideChar() failed: " +
std::to_string(size_needed));
+ }
+
+ std::wstring result(size_needed, 0);
Review Comment:
👍
https://github.com/apache/nifi-minifi-cpp/pull/1634/commits/3b513dcd2120d5e5ab361e8230060721450c6551#diff-b5759f3732506d7ec0f1b4b4ba184a6f83b4c4b142a2a9202c47afd3ae014cbcR351
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]