blind

suckless command-line video editing utility
git clone git://git.suckless.org/blind
Log | Files | Refs | README | LICENSE

commit c22007cc4be9b731d97006b983538388c4b36033
parent 19ad368f68164b99a2cfedb11747d7ca2d040ee0
Author: Mattias Andrée <maandree@kth.se>
Date:   Wed, 10 May 2017 21:36:00 +0200

Fix warnings

Signed-off-by: Mattias Andrée <maandree@kth.se>

Diffstat:
Msrc/blind-arithm.c | 9+++++++++
Msrc/blind-concat.c | 6+++---
Msrc/util.h | 2+-
3 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/src/blind-arithm.c b/src/blind-arithm.c @@ -31,6 +31,11 @@ typedef void (*process_func)(struct stream *left, struct stream *right, size_t n rh = ((TYPE *)(right->buf + i))[CHI],\ (ALGO)), 0) : 0) +#if defined(__GNUC__) && !defined(__clang__) +# pragma GCC diagnostic push +# pragma GCC diagnostic ignored "-Wunsafe-loop-optimizations" +#endif + #define X(NAME, ALGO, PIXFMT, TYPE)\ static void\ process_##PIXFMT##_##NAME(struct stream *left, struct stream *right, size_t n)\ @@ -48,6 +53,10 @@ LIST_OPERATORS(xyza, double,) LIST_OPERATORS(xyzaf, float, f) #undef X +#if defined(__GNUC__) && !defined(__clang__) +# pragma GCC diagnostic pop +#endif + static process_func get_process_xyza(const char *operation) { diff --git a/src/blind-concat.c b/src/blind-concat.c @@ -48,7 +48,7 @@ concat_to_file(int argc, char *argv[], char *output_file) int fd = eopen(output_file, O_RDWR | O_CREAT | O_TRUNC, 0666); char head[STREAM_HEAD_MAX]; ssize_t headlen; - size_t size = 0; + size_t size; off_t pos; char *data; @@ -72,9 +72,9 @@ concat_to_file(int argc, char *argv[], char *output_file) SPRINTF_HEAD_ZN(head, stream.frames, stream.width, stream.height, stream.pixfmt, &headlen); ewriteall(fd, head, (size_t)headlen, output_file); - if ((pos = elseek(fd, 0, SEEK_CUR, output_file)) > SIZE_MAX) + size = (size_t)(pos = elseek(fd, 0, SEEK_CUR, output_file)); + if ((uintmax_t)pos > SIZE_MAX) eprintf("%s\n", strerror(EFBIG)); - size = pos; data = mmap(0, size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); if (data == MAP_FAILED) diff --git a/src/util.h b/src/util.h @@ -6,7 +6,7 @@ #define MAX(A, B) ((A) > (B) ? (A) : (B)) #define CLIP(A, B, C) ((B) < (A) ? (A) : (B) > (C) ? (C) : (B)) #define STRLEN(STR) (sizeof(STR) - 1) -#define INTSTRLEN(TYPE) ((sizeof(TYPE) == 1 ? 3 : (5 * sizeof(TYPE) / 2)) + ((TYPE)-1 < 0)) +#define INTSTRLEN(TYPE) ((sizeof(TYPE) == 1 ? 3 : (5 * sizeof(TYPE) / 2)) + ((TYPE)-1 < 1)) #define USAGE(SYNOPSIS)\ static void usage(void)\