Gert Doering has uploaded a new patch set (#2) to the change originally created 
by Frank Lichtenheld. ( https://gerrit.openvpn.net/c/openvpn/+/2357?usp=email )

The following approvals got outdated and were removed:
Code-Review+2 by Răzvan Cojocaru


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]>
Acked-by: Razvan Cojocaru <[email protected]>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/2357
Message-Id: <[email protected]>
URL: 
https://www.mail-archive.com/[email protected]/msg42064.html
Signed-off-by: Gert Doering <[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/2

diff --git a/src/openvpnserv/common.c b/src/openvpnserv/common.c
index e20feb7..ca4fc15 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)
 {
@@ -301,11 +296,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;
@@ -314,10 +309,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 1cb191a..e94ece3 100644
--- a/src/openvpnserv/interactive.c
+++ b/src/openvpnserv/interactive.c
@@ -2766,7 +2766,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;
@@ -3920,9 +3920,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: newpatchset
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I32f1edf8b289ea2f7fda35e32260909c6409344e
Gerrit-Change-Number: 2357
Gerrit-PatchSet: 2
Gerrit-Owner: Frank Lichtenheld <[email protected]>
Gerrit-Reviewer: Arne Schwabe <[email protected]>
Gerrit-Reviewer: Răzvan Cojocaru <[email protected]>
Gerrit-CC: openvpn-devel <[email protected]>
_______________________________________________
Openvpn-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openvpn-devel

Reply via email to