[vlc-commits] access/dtv + stream_filter/decomp: fix initialization of struct iovec

Filip Roséen git at videolan.org
Sun Mar 5 23:35:19 CET 2017


vlc | branch: master | Filip Roséen <filip at atch.se> | Sun Feb 26 16:56:00 2017 +0100| [fb5a3a3d82843ef7df71b56e2de342ba3ed984a2] | committer: Jean-Baptiste Kempf

access/dtv + stream_filter/decomp: fix initialization of struct iovec

The order, and number, of data-members inside struct iovec is not
guaranteed according to the POSIX specification; as such these changes
make sure that we initialize what we expect to initialize by using
designated-initializers.

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

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

 modules/access/dtv/en50221.c   | 4 ++--
 modules/stream_filter/decomp.c | 5 ++++-
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/modules/access/dtv/en50221.c b/modules/access/dtv/en50221.c
index a31f4fa..9976a2d 100644
--- a/modules/access/dtv/en50221.c
+++ b/modules/access/dtv/en50221.c
@@ -244,8 +244,8 @@ static int TPDUSend( cam_t * p_cam, uint8_t i_slot, uint8_t i_tag,
     Dump( true, p_data, p - p_data );
 
     const struct iovec iov[2] = {
-        { p_data, p - p_data },
-        { (void *)p_content, i_length },
+        { .iov_base = p_data, .iov_len = p - p_data },
+        { .iov_base = (void *)p_content, .iov_len = i_length },
     };
 
     if ( writev( p_cam->fd, iov, 2 ) <= 0 )
diff --git a/modules/stream_filter/decomp.c b/modules/stream_filter/decomp.c
index e3d9af3..7e7b021 100644
--- a/modules/stream_filter/decomp.c
+++ b/modules/stream_filter/decomp.c
@@ -150,7 +150,10 @@ static void *Thread (void *data)
                 j = write (fd, buf + i, len - i);
             else
             {
-                struct iovec iov = { buf + i, (len - i) & ~page_mask, };
+                struct iovec iov = {
+                    .iov_base = buf + i,
+                    .iov_len = (len - i) & ~page_mask };
+
                 j = vmsplice (fd, &iov, 1, SPLICE_F_GIFT);
             }
             if (j == -1 && errno == ENOSYS) /* vmsplice() not supported */



More information about the vlc-commits mailing list