Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed compiler error when building on Windows with #define UNICODE #2317

Merged
merged 1 commit into from
Mar 24, 2022

Conversation

risa2000
Copy link
Contributor

The original InetPton expands to InetPtonW when building with UNICODE defined and expects the string parameter to be wchar_t. On the other hand macro TEXT() just adds prefix L to a string literal (just making it wchar_t literal). The proper way here would be converting host.c_str() result from UTF-8(?) into wchar_t (UNICODE) string, but this seems to be an overkill since the host is typically an IP address or a host/domain name. So assuming an ASCII input should be reasonably safe.

The original `InetPton` expands to `InetPtonW` when building with UNICODE defined and expects the string parameter to be wchar_t. On the other hand macro `TEXT()` just adds prefix `L` to a string literal (just making it wchar_t literal). The proper way here would be converting `host.c_str()` result from UTF-8(?) into wchar_t (UNICODE) string, but this seems to be an overkill since the host is typically an IP address or a host/domain name. So assuming an ASCII input should be reasonably safe.
@gabime gabime merged commit a49456f into gabime:v1.x Mar 24, 2022
@gabime
Copy link
Owner

gabime commented Mar 24, 2022

Thanks @risa2000

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants