aboutsummaryrefslogtreecommitdiffstats
path: root/src/blind-rewrite-head.c
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2017-05-16 20:14:22 +0200
committerMattias Andrée <maandree@kth.se>2017-05-16 20:14:22 +0200
commit0f03cc378e6ce48f17a20e409f93bfc11345a6ed (patch)
treef4768c6fe96e1ac2a9c5833dee897924300d4a45 /src/blind-rewrite-head.c
parentAdd blind-tempral-mean (diff)
downloadblind-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 'src/blind-rewrite-head.c')
-rw-r--r--src/blind-rewrite-head.c11
1 files changed, 3 insertions, 8 deletions
diff --git a/src/blind-rewrite-head.c b/src/blind-rewrite-head.c
index 894e431..ca31006 100644
--- a/src/blind-rewrite-head.c
+++ b/src/blind-rewrite-head.c
@@ -1,10 +1,5 @@
/* See LICENSE file for copyright and license details. */
-#include "stream.h"
-#include "util.h"
-
-#include <sys/mman.h>
-#include <sys/stat.h>
-#include <string.h>
+#include "common.h"
USAGE("[-h] file [(frames | 'auto') [(width | 'same') (height | 'same') [format | 'same']]]")
@@ -40,7 +35,7 @@ rewrite(struct stream *stream, int frames_auto)
eprintf("%s: video is too long\n", stream->file);
if ((size_t)headlen > stream->headlen)
- if (ftruncate(stream->fd, length + headlen))
+ if (ftruncate(stream->fd, (off_t)length + (off_t)headlen))
eprintf("ftruncate %s:", stream->file);
data = mmap(0, length + (size_t)headlen, PROT_READ | PROT_WRITE, MAP_SHARED, stream->fd, 0);
@@ -52,7 +47,7 @@ rewrite(struct stream *stream, int frames_auto)
munmap(data, length + (size_t)headlen);
if ((size_t)headlen < stream->headlen)
- if (ftruncate(stream->fd, length + headlen))
+ if (ftruncate(stream->fd, (off_t)length + (off_t)headlen))
eprintf("ftruncate %s:", stream->file);
}