diff options
author | Laslo Hunhold <dev@frign.de> | 2018-04-11 11:51:01 +0200 |
---|---|---|
committer | Laslo Hunhold <dev@frign.de> | 2018-04-11 11:51:01 +0200 |
commit | 02b051634969f701ccee57505140c9e7f334e22c (patch) | |
tree | 5fe33152959cbe29996754dee7529ccc07bf9440 /jpg2ff.c | |
parent | a9877de22960f14fb16e862cf46290a477779e98 (diff) |
Add efread() and efwrite()
Given we have a util.c anyway it does not make any sense to duplicate
code here. This way, error handling and output is in one place and one
does not have to change things in multiple different files. This also
reduces code duplication by a lot.
It also solves an older bug where the error reporting was not on point:
$ echo "farb" | ff2png
ff2png: fread: Success
(It also lacked a newline)
Now it properly reports
$ echo "farb" | ff2png
ff2png: fread: Unexpected end of file
I also fixed some other minor details, for instance that all error
messages should begin with a capital letter.
Diffstat (limited to 'jpg2ff.c')
-rw-r--r-- | jpg2ff.c | 5 |
1 files changed, 1 insertions, 4 deletions
@@ -80,10 +80,7 @@ main(int argc, char *argv[]) row[4 * i + 3] = htons(65535); } - if (fwrite(row, sizeof(uint16_t), rowlen, stdout) != rowlen) { - fprintf(stderr, "%s: fwrite: %s\n", argv0, strerror(errno)); - return 1; - } + efwrite(row, sizeof(uint16_t), rowlen, stdout); } /* clean up */ |