commit c22007cc4be9b731d97006b983538388c4b36033
Author:     Mattias Andrée <[email protected]>
AuthorDate: Wed May 10 21:36:00 2017 +0200
Commit:     Mattias Andrée <[email protected]>
CommitDate: Wed May 10 21:37:20 2017 +0200

    Fix warnings
    
    Signed-off-by: Mattias Andrée <[email protected]>

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)
diff --git a/src/util.h b/src/util.h
index 24fc2c4..4f94a88 100644
--- 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)\

Reply via email to