diff options
| author | Mattias Andrée <maandree@kth.se> | 2017-05-10 21:36:00 +0200 |
|---|---|---|
| committer | Mattias Andrée <maandree@kth.se> | 2017-05-10 21:37:20 +0200 |
| commit | c22007cc4be9b731d97006b983538388c4b36033 (patch) | |
| tree | babca238e7be3fbc111d62318e1f919107a37e2b /src | |
| parent | Cleaner code (diff) | |
| download | blind-c22007cc4be9b731d97006b983538388c4b36033.tar.gz blind-c22007cc4be9b731d97006b983538388c4b36033.tar.bz2 blind-c22007cc4be9b731d97006b983538388c4b36033.tar.xz | |
Fix warnings
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to '')
| -rw-r--r-- | src/blind-arithm.c | 9 | ||||
| -rw-r--r-- | src/blind-concat.c | 6 | ||||
| -rw-r--r-- | src/util.h | 2 |
3 files changed, 13 insertions, 4 deletions
diff --git a/src/blind-arithm.c b/src/blind-arithm.c index 1c2c11b..5dc3cd9 100644 --- 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 index f7d31e3..25cf19d 100644 --- 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) @@ -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)\ |
