aboutsummaryrefslogtreecommitdiff
path: root/lib/idn_win32.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/idn_win32.c')
-rw-r--r--lib/idn_win32.c24
1 files changed, 14 insertions, 10 deletions
diff --git a/lib/idn_win32.c b/lib/idn_win32.c
index 8b5baf73b..8dc300b36 100644
--- a/lib/idn_win32.c
+++ b/lib/idn_win32.c
@@ -65,12 +65,13 @@ WINBASEAPI int WINAPI IdnToUnicode(DWORD dwFlags,
#define IDN_MAX_LENGTH 255
-int curl_win32_idn_to_ascii(const char *in, char **out);
-int curl_win32_ascii_to_idn(const char *in, char **out);
+bool curl_win32_idn_to_ascii(const char *in, char **out);
+bool curl_win32_ascii_to_idn(const char *in, char **out);
-int curl_win32_idn_to_ascii(const char *in, char **out)
+bool curl_win32_idn_to_ascii(const char *in, char **out)
{
- int ret = 0;
+ bool success = FALSE;
+
wchar_t *in_w = Curl_convert_UTF8_to_wchar(in);
if(in_w) {
wchar_t punycode[IDN_MAX_LENGTH];
@@ -79,15 +80,17 @@ int curl_win32_idn_to_ascii(const char *in, char **out)
if(chars) {
*out = Curl_convert_wchar_to_UTF8(punycode);
if(*out)
- ret = 1; /* success */
+ success = TRUE;
}
}
- return ret;
+
+ return success;
}
-int curl_win32_ascii_to_idn(const char *in, char **out)
+bool curl_win32_ascii_to_idn(const char *in, char **out)
{
- int ret = 0;
+ bool success = FALSE;
+
wchar_t *in_w = Curl_convert_UTF8_to_wchar(in);
if(in_w) {
size_t in_len = wcslen(in_w) + 1;
@@ -98,10 +101,11 @@ int curl_win32_ascii_to_idn(const char *in, char **out)
if(chars) {
*out = Curl_convert_wchar_to_UTF8(unicode);
if(*out)
- ret = 1; /* success */
+ success = TRUE;
}
}
- return ret;
+
+ return success;
}
#endif /* USE_WIN32_IDN */