Attention is currently required from: plaisthos.

Hello plaisthos,

I'd like you to do a code review.
Please visit

    http://gerrit.openvpn.net/c/openvpn/+/1501?usp=email

to review the following change.


Change subject: error: Use SOCKET_UNDEFINED instead of -1 to avoid sign error 
on Windows
......................................................................

error: Use SOCKET_UNDEFINED instead of -1 to avoid sign error on Windows

While here also mark a comparison we know is safe
with an explicit cast.

Change-Id: I96b6acffd7e5149d4c9488a06e43c62711b31cfc
Signed-off-by: Frank Lichtenheld <[email protected]>
---
M src/openvpn/error.c
1 file changed, 13 insertions(+), 24 deletions(-)



  git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/01/1501/1

diff --git a/src/openvpn/error.c b/src/openvpn/error.c
index 6fb4f32..2900352 100644
--- a/src/openvpn/error.c
+++ b/src/openvpn/error.c
@@ -97,15 +97,10 @@
     forked = true;
 }

-#if defined(__GNUC__) || defined(__clang__)
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wsign-compare"
-#endif
-
 bool
 set_debug_level(const int level, const unsigned int flags)
 {
-    if (level >= 0 && level <= M_DEBUG_LEVEL)
+    if (level >= 0 && (unsigned int)level <= M_DEBUG_LEVEL)
     {
         x_debug_level = (msglvl_t)level;
         return true;
@@ -118,10 +113,6 @@
     return false;
 }
 
-#if defined(__GNUC__) || defined(__clang__)
-#pragma GCC diagnostic pop
-#endif
-
 bool
 set_mute_cutoff(const int cutoff)
 {
@@ -621,11 +612,6 @@
     x_cs_verbose_level = verbose_level;
 }

-#if defined(__GNUC__) || defined(__clang__)
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wsign-compare"
-#endif
-
 /*
  * Called after most socket or tun/tap operations, via the inline
  * function check_status().
@@ -674,15 +660,22 @@
         {
             if (extended_msg)
             {
-                msg(x_cs_info_level, "%s %s [%s]: %s (fd=" SOCKET_PRINTF 
",code=%d)", description,
-                    sock ? proto2ascii(sock->info.proto, sock->info.af, true) 
: "", extended_msg,
-                    openvpn_strerror(my_errno, crt_error, &gc), sock ? 
sock->sd : -1, my_errno);
+                msg(x_cs_info_level, "%s %s [%s]: %s (fd=" SOCKET_PRINTF 
",code=%d)",
+                    description,
+                    sock ? proto2ascii(sock->info.proto, sock->info.af, true) 
: "",
+                    extended_msg,
+                    openvpn_strerror(my_errno, crt_error, &gc),
+                    sock ? sock->sd : SOCKET_UNDEFINED,
+                    my_errno);
             }
             else
             {
-                msg(x_cs_info_level, "%s %s: %s (fd=" SOCKET_PRINTF 
",code=%d)", description,
+                msg(x_cs_info_level, "%s %s: %s (fd=" SOCKET_PRINTF 
",code=%d)",
+                    description,
                     sock ? proto2ascii(sock->info.proto, sock->info.af, true) 
: "",
-                    openvpn_strerror(my_errno, crt_error, &gc), sock ? 
sock->sd : -1, my_errno);
+                    openvpn_strerror(my_errno, crt_error, &gc),
+                    sock ? sock->sd : SOCKET_UNDEFINED,
+                    my_errno);
             }

             if (x_cs_err_delay_ms)
@@ -694,10 +687,6 @@
     }
 }

-#if defined(__GNUC__) || defined(__clang__)
-#pragma GCC diagnostic pop
-#endif
-
 /*
  * In multiclient mode, put a client-specific prefix
  * before each message.

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1501?usp=email
To unsubscribe, or for help writing mail filters, visit 
http://gerrit.openvpn.net/settings?usp=email

Gerrit-MessageType: newchange
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I96b6acffd7e5149d4c9488a06e43c62711b31cfc
Gerrit-Change-Number: 1501
Gerrit-PatchSet: 1
Gerrit-Owner: flichtenheld <[email protected]>
Gerrit-Reviewer: plaisthos <[email protected]>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]>
_______________________________________________
Openvpn-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openvpn-devel

Reply via email to