[vlc-commits] network/httpd: use designated initializers for struct iovec

Filip Roséen git at videolan.org
Sun Feb 26 15:43:40 CET 2017


vlc | branch: master | Filip Roséen <filip at atch.se> | Sun Feb 26 15:03:16 2017 +0100| [7464613093938de4a18ceee2ce562fe6af7d89f2] | committer: Rémi Denis-Courmont

network/httpd: use designated initializers for struct iovec

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

Signed-off-by: Rémi Denis-Courmont <remi at remlab.net>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=7464613093938de4a18ceee2ce562fe6af7d89f2
---

 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 4ba8f69..19e1dad 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);
 }
 



More information about the vlc-commits mailing list