diff options
| author | Mattias Andrée <maandree@kth.se> | 2017-05-16 20:14:22 +0200 |
|---|---|---|
| committer | Mattias Andrée <maandree@kth.se> | 2017-05-16 20:14:22 +0200 |
| commit | 0f03cc378e6ce48f17a20e409f93bfc11345a6ed (patch) | |
| tree | f4768c6fe96e1ac2a9c5833dee897924300d4a45 /src/util.c | |
| parent | Add blind-tempral-mean (diff) | |
| download | blind-0f03cc378e6ce48f17a20e409f93bfc11345a6ed.tar.gz blind-0f03cc378e6ce48f17a20e409f93bfc11345a6ed.tar.bz2 blind-0f03cc378e6ce48f17a20e409f93bfc11345a6ed.tar.xz | |
Fix errors and warnings and make the code cleaner
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to '')
| -rw-r--r-- | src/util.c | 23 |
1 files changed, 5 insertions, 18 deletions
@@ -1,18 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "util.h" - -#include <sys/wait.h> -#include <ctype.h> -#include <errno.h> -#include <fcntl.h> -#include <limits.h> -#include <signal.h> -#include <stdarg.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <strings.h> -#include <unistd.h> +#include "common.h" char *argv0; @@ -139,17 +126,17 @@ readall(int fd, void *buf, size_t n) } int -pwriteall(int fd, void *buf, size_t n, size_t ptr) +pwriteall(int fd, void *buf, size_t n, off_t ptr) { char *buffer = buf; ssize_t r; while (n) { - r = pwrite(fd, buffer, n, ptr); + r = pwrite(fd, buffer, n, (off_t)ptr); if (r < 0) return -1; buffer += (size_t)r; n -= (size_t)r; - ptr += (size_t)r; + ptr += (off_t)r; } return 0; } @@ -171,7 +158,7 @@ getfile(int fd, void *buffer, size_t *restrict ptr, size_t *restrict size) { char *restrict *restrict buf = buffer; void *new; - size_t r; + ssize_t r; for (;;) { if (*ptr == *size) { |
