[vlc-devel] [PATCH] network/httpd: use designated initializers for struct iovec
Filip Roséen
filip at atch.se
Sun Feb 26 15:03:16 CET 2017
Given that POSIX does not guarantee the order (nor the number) of the
data-members within "struct iovec", we should either use designated
initializers, or direct member-access, to initialize struct iovec.{iov_base,
iov_len}.
--
See the below:
- http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_uio.h.html
---
src/network/httpd.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/network/httpd.c b/src/network/httpd.c
index 4ba8f69fe2..19e1dad6da 100644
--- a/src/network/httpd.c
+++ b/src/network/httpd.c
@@ -1241,7 +1241,7 @@ static
ssize_t httpd_NetRecv (httpd_client_t *cl, uint8_t *p, size_t i_len)
{
vlc_tls_t *sock = cl->sock;
- struct iovec iov = { p, i_len };
+ struct iovec iov = { .iov_base = p, .iov_len = i_len };
return sock->readv(sock, &iov, 1);
}
@@ -1249,7 +1249,7 @@ static
ssize_t httpd_NetSend (httpd_client_t *cl, const uint8_t *p, size_t i_len)
{
vlc_tls_t *sock = cl->sock;
- const struct iovec iov = { (void *)p, i_len };
+ const struct iovec iov = { .iov_base = (void *)p, .iov_len = i_len };
return sock->writev(sock, &iov, 1);
}
--
2.11.1
More information about the vlc-devel
mailing list