diff options
| author | Mattias Andrée <maandree@kth.se> | 2017-05-10 22:52:21 +0200 |
|---|---|---|
| committer | Mattias Andrée <maandree@kth.se> | 2017-05-10 22:52:21 +0200 |
| commit | 687e7aa9abf91f1bade59213a8b53f9bb4ec4186 (patch) | |
| tree | 98fd798df79322f72d35b375f451d8edb5c143f3 /src/stream.c | |
| parent | Fix warnings (diff) | |
| download | blind-687e7aa9abf91f1bade59213a8b53f9bb4ec4186.tar.gz blind-687e7aa9abf91f1bade59213a8b53f9bb4ec4186.tar.bz2 blind-687e7aa9abf91f1bade59213a8b53f9bb4ec4186.tar.xz | |
Fix errors from the latest commits
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to 'src/stream.c')
| -rw-r--r-- | src/stream.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/stream.c b/src/stream.c index 274ed25..7920ff7 100644 --- a/src/stream.c +++ b/src/stream.c @@ -279,17 +279,18 @@ enread_segment(int status, struct stream *stream, void *buf, size_t n) size_t ensend_frames(int status, struct stream *stream, int outfd, size_t frames, const char *outfname) { - size_t h, w, p; + size_t h, w, p, n; size_t ret = 0; for (ret = 0; ret < frames; ret++) { for (p = stream->pixel_size; p; p--) { for (h = stream->height; h; h--) { - for (w = stream->width; w; w -= stream->ptr, stream->ptr = 0) { + for (w = stream->width; w; w -= n, stream->ptr -= n) { if (!stream->ptr && !enread_stream(status, stream, w)) goto done; + n = MIN(stream->ptr, w); if (outfd >= 0) - enwriteall(status, outfd, stream->buf, stream->ptr, outfname); + enwriteall(status, outfd, stream->buf, n, outfname); } } } |
