Attention is currently required from: Arne Schwabe.
Hello Arne Schwabe,
I'd like you to do a code review.
Please visit
https://gerrit.openvpn.net/c/openvpn/+/2357?usp=email
to review the following change.
Change subject: openvpnserv: Avoid sign conversion warnings related to string
conversion
......................................................................
openvpnserv: Avoid sign conversion warnings related to string conversion
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]>
---
M src/openvpnserv/common.c
M src/openvpnserv/interactive.c
2 files changed, 5 insertions(+), 14 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/57/2357/1
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);
--
To view, visit https://gerrit.openvpn.net/c/openvpn/+/2357?usp=email
To unsubscribe, or for help writing mail filters, visit
https://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: newchange
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I32f1edf8b289ea2f7fda35e32260909c6409344e
Gerrit-Change-Number: 2357
Gerrit-PatchSet: 1
Gerrit-Owner: Frank Lichtenheld <[email protected]>
Gerrit-Reviewer: Arne Schwabe <[email protected]>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: Arne Schwabe <[email protected]>
_______________________________________________
Openvpn-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openvpn-devel