[windows] Fix forward for CBF in artifact build (#30886)

* fix

* Update tchar.cc
pull/30891/head
Craig Tiller 2 years ago committed by GitHub
parent 7ba58bb925
commit fb4fd9ced0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 7
      src/core/lib/gprpp/tchar.cc

@ -25,7 +25,8 @@ TcharString CharToTchar(std::string input) {
int needed = MultiByteToWideChar(CP_UTF8, 0, input.c_str(), -1, NULL, 0);
if (needed <= 0) return TcharString();
TcharString ret(needed, L'\0');
MultiByteToWideChar(CP_UTF8, 0, input.c_str(), -1, ret.c_str(), needed);
MultiByteToWideChar(CP_UTF8, 0, input.c_str(), -1,
const_cast<LPTSTR>(ret.data()), needed);
return ret;
}
@ -34,8 +35,8 @@ std::string TcharToChar(TcharString input) {
WideCharToMultiByte(CP_UTF8, 0, input.c_str(), -1, NULL, 0, NULL, NULL);
if (needed <= 0) return std::string();
std::string ret(needed, '\0');
WideCharToMultiByte(CP_UTF8, 0, input.c_str(), -1, ret.c_str(), needed, NULL,
NULL);
WideCharToMultiByte(CP_UTF8, 0, input.c_str(), -1,
const_cast<LPSTR>(ret.data()), needed, NULL, NULL);
return ret;
}
#else

Loading…
Cancel
Save