From: Frank Lichtenheld <[email protected]> All callers already want a size_t, so make the conversion implicit.
Change-Id: Ie2d784272184261a62c848e6ad3b7a4570ae6dc7 Signed-off-by: Frank Lichtenheld <[email protected]> Acked-by: Razvan Cojocaru <[email protected]> Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/2165 --- This change was reviewed on Gerrit and approved by at least one developer. I request to merge it to master. Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/2165 This mail reflects revision 1 of this Change. Acked-by according to Gerrit (reflected above): Razvan Cojocaru <[email protected]> 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) { _______________________________________________ Openvpn-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/openvpn-devel
