fix clang warnings, directly include wtypes.h (#4097)
authorBernhard Miklautz <bmiklautz@users.noreply.github.com>
Tue, 29 Aug 2017 07:09:38 +0000 (09:09 +0200)
committerakallabeth <akallabeth@users.noreply.github.com>
Tue, 29 Aug 2017 07:09:38 +0000 (09:09 +0200)
* build: clang use -Wno-unused-command-line-argument

With clang 5.0 builds are quite noisy otherwise.

* Directly include wtypes.h

Directly include winpr/wtypes.h where _fseeki64 or _ftelli64 is used.

* fix build warnings with clang 5

clang version: 5.0.0-svn310678-1~exp1 (branches/release_50)
Warning: parentheses-equality

* fix build warnings with clang 5

clang version: 5.0.0-svn310678-1~exp1 (branches/release_50)
Warning: tautological-compare

* fix build warnings with clang 5

clang version: 5.0.0-svn310678-1~exp1 (branches/release_50)
Warning:
incompatible pointer types passing 'size_t *' (aka 'unsigned
long *') to parameter of type 'UINT32 *' (aka 'unsigned int *')
[-Wincompatible-pointer-types]

21 files changed:
CMakeLists.txt
channels/tsmf/client/gstreamer/tsmf_X11.c
channels/tsmf/client/gstreamer/tsmf_gstreamer.c
client/common/file.c
libfreerdp/codec/bitmap.c
libfreerdp/codec/ncrush.c
libfreerdp/codec/test/TestFreeRDPCodecProgressive.c
libfreerdp/common/assistance.c
libfreerdp/core/certificate.c
libfreerdp/primitives/test/TestPrimitivesAlphaComp.c
libfreerdp/utils/pcap.c
rdtk/librdtk/rdtk_font.c
winpr/libwinpr/file/file.c
winpr/libwinpr/registry/registry_reg.c
winpr/libwinpr/sysinfo/cpufeatures/cpu-features.c
winpr/libwinpr/timezone/timezone.c
winpr/libwinpr/utils/image.c
winpr/libwinpr/utils/ini.c
winpr/libwinpr/utils/sam.c
winpr/libwinpr/utils/test/TestImage.c
winpr/libwinpr/utils/wlog/PacketMessage.c

index f7e9929..1b3b86f 100644 (file)
@@ -283,6 +283,7 @@ if(${CMAKE_C_COMPILER_ID} STREQUAL "Clang")
        set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unused-parameter")
        set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unused-macros -Wno-padded")
        set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-c11-extensions -Wno-gnu")
+       set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unused-command-line-argument")
        if(WITH_SSE2)
                set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mssse3")
        endif()
index 3f6002a..b57b927 100644 (file)
 #include <winpr/thread.h>
 #include <winpr/string.h>
 
+#if __clang__
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wparentheses-equality"
+#endif /* __clang__ */
 #include <gst/gst.h>
+#if __clang__
+#pragma clang diagnostic pop
+#endif /* __clang__ */
+
 #if GST_VERSION_MAJOR > 0
 #include <gst/video/videooverlay.h>
 #else
index bd22e6a..0addbe7 100644 (file)
 
 #include <winpr/string.h>
 
+#if __clang__
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wparentheses-equality"
+#endif /* __clang__ */
 #include <gst/gst.h>
+#if __clang__
+#pragma clang diagnostic pop
+#endif /* __clang__ */
+
 #include <gst/app/gstappsrc.h>
 #include <gst/app/gstappsink.h>
 
index 8eb0ae1..ac39697 100644 (file)
@@ -21,7 +21,6 @@
 #include "config.h"
 #endif
 
-
 #include <freerdp/client/file.h>
 #include <freerdp/client/cmdline.h>
 
@@ -41,6 +40,7 @@
 #include <unistd.h>
 #endif
 
+#include <winpr/wtypes.h>
 #include <winpr/crt.h>
 #include <freerdp/log.h>
 #define TAG CLIENT_TAG("common")
index aeb8e93..7cf4512 100644 (file)
 #define TEST_MIX \
                ((last_line == 0 && pixel == mix) || \
                                (last_line != 0 && pixel == (ypixel ^ mix)))
-#define TEST_FOM (TEST_FILL || TEST_MIX)
-#define TEST_COLOR (pixel == last_pixel)
+#define TEST_FOM TEST_FILL || TEST_MIX
+#define TEST_COLOR pixel == last_pixel
 #define TEST_BICOLOR \
                ( \
                                (pixel != last_pixel) && \
@@ -559,7 +559,7 @@ int freerdp_bitmap_compress(const char* srcData, int width, int height,
                                        mix_count = 0;
                                }
 
-                               if (!TEST_COLOR)
+                               if (!(TEST_COLOR))
                                {
                                        if (color_count > 3 &&
                                                        color_count >= fill_count &&
@@ -607,7 +607,7 @@ int freerdp_bitmap_compress(const char* srcData, int width, int height,
                                        bicolor_spin = 0;
                                }
 
-                               if (!TEST_FOM)
+                               if (!(TEST_FOM))
                                {
                                        if (fom_count > 3 &&
                                                        fom_count >= fill_count &&
@@ -852,7 +852,7 @@ int freerdp_bitmap_compress(const char* srcData, int width, int height,
                                        mix_count = 0;
                                }
 
-                               if (!TEST_COLOR)
+                               if (!(TEST_COLOR))
                                {
                                        if (color_count > 3 &&
                                                        color_count >= fill_count &&
@@ -900,7 +900,7 @@ int freerdp_bitmap_compress(const char* srcData, int width, int height,
                                        bicolor_spin = 0;
                                }
 
-                               if (!TEST_FOM)
+                               if (!(TEST_FOM))
                                {
                                        if (fom_count > 3 &&
                                                        fom_count >= fill_count &&
index d841c27..2b22bae 100644 (file)
@@ -1767,7 +1767,7 @@ int ncrush_decompress(NCRUSH_CONTEXT* ncrush, BYTE* pSrcData, UINT32 SrcSize, BY
 {
        UINT32 index;
        UINT32 bits;
-       UINT32 nbits;
+       INT32 nbits;
        BYTE* SrcPtr;
        BYTE* SrcEnd;
        UINT16 Mask;
index 789291c..e99c55a 100644 (file)
@@ -1,3 +1,4 @@
+#include <winpr/wtypes.h>
 #include <winpr/crt.h>
 #include <winpr/path.h>
 #include <winpr/image.h>
@@ -483,7 +484,7 @@ static int test_progressive_load_files(char* ms_sample_path, EGFX_SAMPLE_FILE fi
        return 1;
 }
 
-static BYTE* test_progressive_load_bitmap(char* path, char* file, UINT32* size, int quarter)
+static BYTE* test_progressive_load_bitmap(char* path, char* file, size_t* size, int quarter)
 {
        int status;
        BYTE* buffer;
index 660add7..22248f6 100644 (file)
@@ -21,6 +21,7 @@
 #include "config.h"
 #endif
 
+#include <winpr/wtypes.h>
 #include <winpr/crt.h>
 #include <winpr/crypto.h>
 #include <winpr/print.h>
index 4338d0d..2ce8057 100644 (file)
@@ -28,6 +28,7 @@
 #include <stdio.h>
 #include <string.h>
 
+#include <winpr/wtypes.h>
 #include <winpr/crt.h>
 #include <winpr/crypto.h>
 
index 4073197..92fe2c9 100644 (file)
@@ -75,19 +75,19 @@ static UINT32 colordist(
                UINT32 c2)
 {
        int d, maxd = 0;
-       d = ABS(ALF(c1) - ALF(c2));
+       d = ABS((INT32)(ALF(c1) - ALF(c2)));
 
        if (d > maxd) maxd = d;
 
-       d = ABS(RED(c1) - RED(c2));
+       d = ABS((INT32)(RED(c1) - RED(c2)));
 
        if (d > maxd) maxd = d;
 
-       d = ABS(GRN(c1) - GRN(c2));
+       d = ABS((INT32)(GRN(c1) - GRN(c2)));
 
        if (d > maxd) maxd = d;
 
-       d = ABS(BLU(c1) - BLU(c2));
+       d = ABS((INT32)(BLU(c1) - BLU(c2)));
 
        if (d > maxd) maxd = d;
 
index 603114e..11a277b 100644 (file)
@@ -25,6 +25,7 @@
 #include <stdlib.h>
 #include <string.h>
 
+#include <winpr/wtypes.h>
 #include <winpr/crt.h>
 #include <freerdp/log.h>
 
index e09a3af..aac7f3e 100644 (file)
@@ -20,6 +20,7 @@
 #include "config.h"
 #endif
 
+#include <winpr/wtypes.h>
 #include <winpr/crt.h>
 #include <winpr/path.h>
 #include <winpr/print.h>
index 702a3a8..1b17f73 100644 (file)
@@ -23,6 +23,7 @@
 #include "config.h"
 #endif /* HAVE_CONFIG_H */
 
+#include <winpr/wtypes.h>
 #include <winpr/crt.h>
 #include <winpr/file.h>
 
index 78e9341..ac9bc8d 100644 (file)
@@ -25,6 +25,7 @@
 #include <stdlib.h>
 #include <string.h>
 
+#include <winpr/wtypes.h>
 #include <winpr/crt.h>
 
 #include "registry_reg.h"
index adff1d7..acdfa34 100644 (file)
@@ -71,6 +71,7 @@
 #include <stdlib.h>
 #include <sys/system_properties.h>
 #include <unistd.h>
+#include <winpr/wtypes.h>
 
 static  pthread_once_t     g_once;
 static  int                g_inited;
index 9844d1e..5163154 100644 (file)
@@ -21,6 +21,7 @@
 #include "config.h"
 #endif
 
+#include <winpr/wtypes.h>
 #include <winpr/timezone.h>
 #include <winpr/crt.h>
 #include "../log.h"
index 0af4255..ce87e76 100644 (file)
@@ -23,6 +23,7 @@
 #include "config.h"
 #endif
 
+#include <winpr/wtypes.h>
 #include <winpr/crt.h>
 
 #include <winpr/image.h>
index 6edd6f4..112a6c5 100644 (file)
@@ -25,6 +25,7 @@
 #include <stdlib.h>
 #include <string.h>
 
+#include <winpr/wtypes.h>
 #include <winpr/crt.h>
 
 #include <winpr/ini.h>
index 5e20d78..f9287e9 100644 (file)
@@ -25,6 +25,7 @@
 #include <stdlib.h>
 #include <string.h>
 
+#include <winpr/wtypes.h>
 #include <winpr/crt.h>
 #include <winpr/sam.h>
 #include <winpr/print.h>
index 50b5181..0893765 100644 (file)
@@ -1,3 +1,4 @@
+#include <winpr/wtypes.h>
 #include <winpr/crt.h>
 #include <winpr/path.h>
 #include <winpr/print.h>
index 202a7ca..abd3038 100644 (file)
@@ -27,6 +27,7 @@
 
 #include "wlog/PacketMessage.h"
 
+#include <winpr/wtypes.h>
 #include <winpr/crt.h>
 #include <winpr/stream.h>