Skip to content

Commit

Permalink
Fix error: 'WC_ERR_INVALID_CHARS' was not declared in this scope
Browse files Browse the repository at this point in the history
  • Loading branch information
zm1060 committed Oct 16, 2023
1 parent 335e4a3 commit 96fb38c
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/sysinfo.cc
Original file line number Diff line number Diff line change
Expand Up @@ -428,11 +428,14 @@ std::string GetSystemName() {
#ifndef UNICODE
str = std::string(hostname, DWCOUNT);
#else
#ifndef WC_ERR_INVALID_CHARS
#define WC_ERR_INVALID_CHARS 0x00000080
#endif
// `WideCharToMultiByte` returns `0` when conversion fails.
int len = WideCharToMultiByte(CP_UTF8, MB_ERR_INVALID_CHARS, hostname,
int len = WideCharToMultiByte(CP_UTF8, WC_ERR_INVALID_CHARS, hostname,
DWCOUNT, NULL, 0, NULL, NULL);
str.resize(len);
WideCharToMultiByte(CP_UTF8, MB_ERR_INVALID_CHARS, hostname, DWCOUNT, &str[0],
WideCharToMultiByte(CP_UTF8, WC_ERR_INVALID_CHARS, hostname, DWCOUNT, &str[0],
str.size(), NULL, NULL);
#endif
return str;
Expand Down

0 comments on commit 96fb38c

Please sign in to comment.