diff options
author | Laurent Bercot <ska-skaware@skarnet.org> | 2017-02-17 22:30:53 +0000 |
---|---|---|
committer | Laurent Bercot <ska-skaware@skarnet.org> | 2017-02-17 22:30:53 +0000 |
commit | fdffefb8032922ce7ffe4c00816072a8ff2148fc (patch) | |
tree | bc7313151a429c45d8bab8ad8b9dd32f4e51335f /src/libstddjb/siovec_seek.c | |
parent | a896ca2a8c617e5e00ffd5fc9e69331ad754e5b3 (diff) | |
download | skalibs-fdffefb8032922ce7ffe4c00816072a8ff2148fc.tar.xz |
More types changes
New disize
Add size_t to the autotypes list
Delete redundant and replace-libc files
dev_t/ino_t pass
Big size_t pass
More things missing, still not operational yet
Diffstat (limited to 'src/libstddjb/siovec_seek.c')
-rw-r--r-- | src/libstddjb/siovec_seek.c | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/src/libstddjb/siovec_seek.c b/src/libstddjb/siovec_seek.c index 34a8918..f03b20a 100644 --- a/src/libstddjb/siovec_seek.c +++ b/src/libstddjb/siovec_seek.c @@ -1,24 +1,26 @@ /* ISC license. */ +#include <sys/types.h> +#include <sys/uio.h> #include <skalibs/bytestr.h> #include <skalibs/siovec.h> -unsigned int siovec_seek (siovec_t *v, unsigned int n, unsigned int len) +size_t siovec_seek (struct iovec *v, unsigned int n, size_t len) { - unsigned int w = 0 ; + size_t w = 0 ; register unsigned int i = 0 ; for (; i < n ; i++) { - if (len < v[i].len) break ; - w += v[i].len ; - len -= v[i].len ; - v[i].s = 0 ; - v[i].len = 0 ; + if (len < v[i].iov_len) break ; + w += v[i].iov_len ; + len -= v[i].iov_len ; + v[i].iov_base = 0 ; + v[i].iov_len = 0 ; } if (i < n) { - v[i].s += len ; - v[i].len -= len ; + v[i].iov_base = (char *)v[i].iov_base + len ; + v[i].iov_len -= len ; w += len ; } return w ; |