Browse Source

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@videolan.org>
pull/54/merge
Filip Roséen 10 years ago
committed by Jean-Baptiste Kempf
parent
commit
fb5a3a3d82
  1. 4
      modules/access/dtv/en50221.c
  2. 5
      modules/stream_filter/decomp.c

4
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 )

5
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 */

Loading…
Cancel
Save