[S] Change in openvpn[master]: mbuf: Fix conversion warnings in mbuf and related code

"cron2 \(Code Review\) via Openvpn-devel" <[email protected]>
Newsgroups gmane.network.openvpn.devel
Message-ID <8cdece99ae84ba5d984337077fe95dcbf2d67f6b-EmailReplacePatchSet-HTML@gerrit.openvpn.net>
cron2 has uploaded a new patch set (#7) to the change originally created by flichtenheld. ( http://gerrit.openvpn.net/c/openvpn/+/1433?usp=email )

The following approvals got outdated and were removed:
Code-Review+2 by cron2


Change subject: mbuf: Fix conversion warnings in mbuf and related code
......................................................................

mbuf: Fix conversion warnings in mbuf and related code

Mostly these were actually hidden by casts, but fix
them as well by using more fitting types.

Change-Id: I1d4e0233cf1cb09725dbd2caa121acdbf62f0452
Signed-off-by: Frank Lichtenheld <[email protected]>
Acked-by: Gert Doering <[email protected]>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1433
Message-Id: <[email protected]>
URL: https://www.mail-archive.com/[email protected]/msg37182.html
Signed-off-by: Gert Doering <[email protected]>
---
M src/openvpn/buffer.c
M src/openvpn/mbuf.c
2 files changed, 5 insertions(+), 17 deletions(-)


  git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/33/1433/7

diff --git a/src/openvpn/buffer.c b/src/openvpn/buffer.c
index 1e19137..5f2b233 100644
--- a/src/openvpn/buffer.c
+++ b/src/openvpn/buffer.c
@@ -43,7 +43,7 @@
     unsigned long long res =
         (unsigned long long)m1 * (unsigned long long)m2 + (unsigned long long)extra;
     if (unlikely(m1 > limit) || unlikely(m2 > limit) || unlikely(extra > limit)
-        || unlikely(res > (unsigned long long)limit))
+        || unlikely(res > limit))
     {
         msg(M_FATAL, "attempted allocation of excessively large array");
     }
diff --git a/src/openvpn/mbuf.c b/src/openvpn/mbuf.c
index 5e1b585..7b790ed 100644
--- a/src/openvpn/mbuf.c
+++ b/src/openvpn/mbuf.c
@@ -34,11 +34,6 @@
 
 #include "memdbg.h"
 
-#if defined(__GNUC__) || defined(__clang__)
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wconversion"
-#endif
-
 struct mbuf_set *
 mbuf_init(unsigned int size)
 {
@@ -46,22 +41,17 @@
 
     struct mbuf_set *ret;
     ALLOC_OBJ_CLEAR(ret, struct mbuf_set);
-    ret->capacity = adjust_power_of_2(size);
+    ret->capacity = (unsigned int)adjust_power_of_2(size);
     ALLOC_ARRAY(ret->array, struct mbuf_item, ret->capacity);
     return ret;
 }
 
-#if defined(__GNUC__) || defined(__clang__)
-#pragma GCC diagnostic pop
-#endif
-
 void
 mbuf_free(struct mbuf_set *ms)
 {
     if (ms)
     {
-        int i;
-        for (i = 0; i < (int)ms->len; ++i)
+        for (unsigned int i = 0; i < ms->len; ++i)
         {
             struct mbuf_item *item = &ms->array[MBUF_INDEX(ms->head, i, ms->capacity)];
             mbuf_free_buf(item->buffer);
@@ -145,8 +135,7 @@
     struct multi_instance *ret = NULL;
     if (ms)
     {
-        int i;
-        for (i = 0; i < (int)ms->len; ++i)
+        for (unsigned int i = 0; i < ms->len; ++i)
         {
             struct mbuf_item *item = &ms->array[MBUF_INDEX(ms->head, i, ms->capacity)];
             if (item->instance)
@@ -164,8 +153,7 @@
 {
     if (ms)
     {
-        int i;
-        for (i = 0; i < (int)ms->len; ++i)
+        for (unsigned int i = 0; i < ms->len; ++i)
         {
             struct mbuf_item *item = &ms->array[MBUF_INDEX(ms->head, i, ms->capacity)];
             if (item->instance == mi)

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

Gerrit-MessageType: newpatchset
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I1d4e0233cf1cb09725dbd2caa121acdbf62f0452
Gerrit-Change-Number: 1433
Gerrit-PatchSet: 7
Gerrit-Owner: flichtenheld <[email protected]>
Gerrit-Reviewer: cron2 <[email protected]>
Gerrit-Reviewer: plaisthos <[email protected]>
Gerrit-CC: openvpn-devel <[email protected]>

_______________________________________________
Openvpn-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openvpn-devel
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.