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/+/2165?usp=email
to review the following change.
Change subject: buffer: Change return type of buf_forward_capacity_total to
size_t
......................................................................
buffer: Change return type of buf_forward_capacity_total to size_t
All callers already want a size_t, so make the
conversion implicit.
Change-Id: Ie2d784272184261a62c848e6ad3b7a4570ae6dc7
Signed-off-by: Frank Lichtenheld <[email protected]>
---
M src/openvpn/buffer.c
M src/openvpn/buffer.h
M tests/unit_tests/openvpn/test_dhcp.c
3 files changed, 3 insertions(+), 12 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/65/2165/1
diff --git a/src/openvpn/buffer.c b/src/openvpn/buffer.c
index 5f21de8..a4e2809 100644
--- a/src/openvpn/buffer.c
+++ b/src/openvpn/buffer.c
@@ -275,7 +275,7 @@
if (buf_forward_capacity(buf) <= 1)
{
size_t len = strlen(str) + 1;
- if (buf_size_valid(len) && (int)len < buf_forward_capacity_total(buf))
+ if (buf_size_valid(len) && len < buf_forward_capacity_total(buf))
{
memcpy(buf->data + buf->capacity - len, str, len);
}
diff --git a/src/openvpn/buffer.h b/src/openvpn/buffer.h
index ede3066..ae6dcb7 100644
--- a/src/openvpn/buffer.h
+++ b/src/openvpn/buffer.h
@@ -1068,7 +1068,7 @@
*
* @return Capacity minus offset, or 0 if \c buf is invalid.
*/
-static inline int
+static inline size_t
buf_forward_capacity_total(const struct buffer *buf)
{
if (buf_valid(buf))
@@ -1078,7 +1078,7 @@
{
ret = 0;
}
- return ret;
+ return (size_t)ret;
}
else
{
diff --git a/tests/unit_tests/openvpn/test_dhcp.c
b/tests/unit_tests/openvpn/test_dhcp.c
index e331d3d..3a84e1e 100644
--- a/tests/unit_tests/openvpn/test_dhcp.c
+++ b/tests/unit_tests/openvpn/test_dhcp.c
@@ -50,11 +50,6 @@
return "dummy";
}
-#if defined(__GNUC__) || defined(__clang__)
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wsign-conversion"
-#endif
-
static void
test_write_dhcp_search_str(void **state)
{
@@ -146,10 +141,6 @@
gc_free(&gc);
}
-#if defined(__GNUC__) || defined(__clang__)
-#pragma GCC diagnostic pop
-#endif
-
int
main(void)
{
--
To view, visit https://gerrit.openvpn.net/c/openvpn/+/2165?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: Ie2d784272184261a62c848e6ad3b7a4570ae6dc7
Gerrit-Change-Number: 2165
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