From: Frank Lichtenheld <[email protected]> MultiByteToWideChar and similar functions take int and return int. Nothing we can do about that except cast.
Change-Id: I32f1edf8b289ea2f7fda35e32260909c6409344e Signed-off-by: Frank Lichtenheld <[email protected]> Acked-by: Razvan Cojocaru <[email protected]> Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/2357 --- This change was reviewed on Gerrit and approved by at least one developer. I request to merge it to master. Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/2357 This mail reflects revision 1 of this Change. Acked-by according to Gerrit (reflected above): Razvan Cojocaru <[email protected]> diff --git a/src/openvpnserv/common.c b/src/openvpnserv/common.c index de7847e..6c1250b 100644 --- a/src/openvpnserv/common.c +++ b/src/openvpnserv/common.c @@ -30,11 +30,6 @@ LPCWSTR service_instance = L""; static wchar_t win_sys_path[MAX_PATH]; -#if defined(__GNUC__) || defined(__clang__) -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wsign-conversion" -#endif - static DWORD GetRegString(HKEY key, LPCWSTR value, LPWSTR data, DWORD size, LPCWSTR default_value) { @@ -300,11 +295,11 @@ utf8to16_size(const char *utf8, int size) { int n = MultiByteToWideChar(CP_UTF8, 0, utf8, size, NULL, 0); - if (n == 0) + if (n <= 0) { return NULL; } - wchar_t *utf16 = malloc(n * sizeof(wchar_t)); + wchar_t *utf16 = malloc((size_t)n * sizeof(wchar_t)); if (!utf16) { return NULL; @@ -313,10 +308,6 @@ return utf16; } -#if defined(__GNUC__) || defined(__clang__) -#pragma GCC diagnostic pop -#endif - const wchar_t * get_win_sys_path(void) { diff --git a/src/openvpnserv/interactive.c b/src/openvpnserv/interactive.c index 0792a51..e99f8b5 100644 --- a/src/openvpnserv/interactive.c +++ b/src/openvpnserv/interactive.c @@ -2760,7 +2760,7 @@ size_t domains_len = strlen(domains); dom_size = (DWORD)domains_len + 2; /* len + the trailing NULs */ - wide_domains = utf8to16_size(domains, dom_size); + wide_domains = utf8to16_size(domains, (int)dom_size); if (!wide_domains) { return ERROR_OUTOFMEMORY; @@ -3917,9 +3917,9 @@ CloseHandleEx(&stdin_read); CloseHandleEx(&svc_pipe); - DWORD input_size = WideCharToMultiByte(CP_UTF8, 0, sud.std_input, -1, NULL, 0, NULL, NULL); + int input_size = WideCharToMultiByte(CP_UTF8, 0, sud.std_input, -1, NULL, 0, NULL, NULL); LPSTR input = NULL; - if (input_size && (input = malloc(input_size))) + if (input_size > 0 && (input = malloc((size_t)input_size))) { DWORD written; WideCharToMultiByte(CP_UTF8, 0, sud.std_input, -1, input, input_size, NULL, NULL); _______________________________________________ Openvpn-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/openvpn-devel
