iov: don't use void* in pointer arithmetic in headers
PATCH 1/1 iov: don't use void* in pointer arithmetic in headers
void* pointer arithmetic is a GCC extentension
which could not be available in other build tools
(e.g. C++). This changes removes this assumption.
--- include/qemu/iov.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
include/qemu/iov.h +2 -2
@@ -43,7 +43,7 @@ iov_from_buf(const struct iovec *iov, unsigned int iov_cnt, {if (__builtin_constant_p (bytes) && iov_cnt && offset <= iov[0 ].iov_len && bytes <= iov[0 ].iov_len - offset) { -memcpy (iov[0 ].iov_base + offset, buf, bytes); +memcpy ((char *)iov[0 ].iov_base + offset, buf, bytes);return bytes; }else {return iov_from_buf_full (iov, iov_cnt, offset, buf, bytes);
@@ -56,7 +56,7 @@ iov_to_buf(const struct iovec *iov, const unsigned int iov_cnt, {if (__builtin_constant_p (bytes) && iov_cnt && offset <= iov[0 ].iov_len && bytes <= iov[0 ].iov_len - offset) { -memcpy (buf, iov[0 ].iov_base + offset, bytes); +memcpy (buf, (const char *)iov[0 ].iov_base + offset, bytes);return bytes; }else {return iov_to_buf_full (iov, iov_cnt, offset, buf, bytes);
Signature · 1 line
2.45.2.803.g4e1b14247a-goog
Quoted 6 lines · Roman Kiryanov
void* pointer arithmetic is a GCC extentension
which could not be available in other build tools
(e.g. C++). This changes removes this assumption.Signed-off-by Roman Kiryanov <[email protected]>
We had the question on a previous "make this C++ compatible" patch of "how much of this stuff is there?".
https://lore.kernel.org/qemu-devel/[email protected]/
Please can you give us an idea of how much of this stuff there is that you're planning to send out and what its scope is, rather than just sending one "well this looks small on its own" patch a week?
thanks
-- PMM
Hi Peter, thank you for looking into this.
Quoted 2 lines · Peter Maydell
We had the question on a previous "make this C++ compatible" patch of "how much of this stuff is there?".
Unfortunately, we don't know yet (we are still upgrading to QEMU8).
If this is a burden for QEMU, we can keep the changes on our end and send them once we have a bigger picture (e.g. when upgrading to QEMU9).
Regards,
Roman.