diff options
| author | Mattias Andrée <maandree@kth.se> | 2017-01-12 11:27:40 +0100 |
|---|---|---|
| committer | Mattias Andrée <maandree@kth.se> | 2017-01-12 11:27:40 +0100 |
| commit | bc7830ba80267a4a228ed1de62e0f65045b3d174 (patch) | |
| tree | 31a8844a209b5fa0cfdaa84e20a2ec16bb99a3b4 /src/util/io.h | |
| parent | vu-from-image: fix sRGB to CIE XYZ conversion: deapply transfer function (diff) | |
| download | blind-bc7830ba80267a4a228ed1de62e0f65045b3d174.tar.gz blind-bc7830ba80267a4a228ed1de62e0f65045b3d174.tar.bz2 blind-bc7830ba80267a4a228ed1de62e0f65045b3d174.tar.xz | |
Fix and improve vu-from-image
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to 'src/util/io.h')
| -rw-r--r-- | src/util/io.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/util/io.h b/src/util/io.h index 25f360c..ac326c8 100644 --- a/src/util/io.h +++ b/src/util/io.h @@ -1,6 +1,7 @@ /* See LICENSE file for copyright and license details. */ #define ewriteall(...) enwriteall(1, __VA_ARGS__) +#define ereadall(...) enreadall(1, __VA_ARGS__) int writeall(int fd, void *buf, size_t n); @@ -10,3 +11,14 @@ enwriteall(int status, int fd, void *buf, size_t n, const char *fname) if (writeall(fd, buf, n)) enprintf(status, "write %s:", fname); } + +ssize_t readall(int fd, void *buf, size_t n); + +static inline size_t +enreadall(int status, int fd, void *buf, size_t n, const char *fname) +{ + ssize_t r = readall(fd, buf, n); + if (r < 0) + enprintf(status, "read %s:", fname); + return (size_t)r; +} |
