From d22b58b5cee40b003b7d5fa98aa659c88bbdf3d0 Mon Sep 17 00:00:00 2001
From: Biswapriyo Nath <nathbappai@gmail.com>
Date: Wed, 28 Apr 2021 18:25:21 +0530
Subject: [PATCH 1/3] CMake: Set ffmpeg and zlib optional in Win32.

---
 CMakeLists.txt | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 5c4189da917..2e53e89b103 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -758,13 +758,13 @@
 if(WIN32)
 	set(X11_FEATURE_TYPE "DISABLED")
 	set(WAYLAND_FEATURE_TYPE "DISABLED")
-	set(ZLIB_FEATURE_TYPE "DISABLED")
+	set(ZLIB_FEATURE_TYPE "OPTIONAL")
 	set(OSS_FEATURE_TYPE "DISABLED")
 	set(ALSA_FEATURE_TYPE "DISABLED")
 	set(PULSE_FEATURE_TYPE "DISABLED")
 	set(CUPS_FEATURE_TYPE "DISABLED")
 	set(PCSC_FEATURE_TYPE "DISABLED")
-	set(FFMPEG_FEATURE_TYPE "DISABLED")
+	set(FFMPEG_FEATURE_TYPE "OPTIONAL")
 	set(VAAPI_FEATURE_TYPE "DISABLED")
 	set(OPENSLES_FEATURE_TYPE "DISABLED")
 endif()
From 524214cd48efb4bfc55d060b25ecc6e7f3788a54 Mon Sep 17 00:00:00 2001
From: Biswapriyo Nath <nathbappai@gmail.com>
Date: Wed, 28 Apr 2021 18:30:24 +0530
Subject: [PATCH 2/3] Check _MSC_VER for MSVC specific pragma directives.

---
 client/Windows/wf_floatbar.c     | 2 ++
 libfreerdp/core/settings.c       | 4 ++--
 winpr/libwinpr/path/shell.c      | 2 +-
 winpr/libwinpr/utils/trio/trio.c | 4 ++--
 4 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/client/Windows/wf_floatbar.c b/client/Windows/wf_floatbar.c
index 512c66b473e..793569bc640 100644
--- a/client/Windows/wf_floatbar.c
+++ b/client/Windows/wf_floatbar.c
@@ -25,7 +25,9 @@
 #include "wf_client.h"
 #include "wf_floatbar.h"
 #include "wf_gdi.h"
+#ifdef _MSC_VER
 #pragma comment(lib, "Msimg32.lib")
+#endif
 
 #define TAG CLIENT_TAG("windows.floatbar")
 
diff --git a/libfreerdp/core/settings.c b/libfreerdp/core/settings.c
index 6539d43699d..b1703fec506 100644
--- a/libfreerdp/core/settings.c
+++ b/libfreerdp/core/settings.c
@@ -44,7 +44,7 @@
 
 #define TAG FREERDP_TAG("settings")
 
-#ifdef _WIN32
+#ifdef _MSC_VER
 #pragma warning(push)
 #pragma warning(disable : 4244)
 #endif
@@ -1112,6 +1112,6 @@ rdpSettings* freerdp_settings_clone(const rdpSettings* settings)
 	freerdp_settings_free(_settings);
 	return NULL;
 }
-#ifdef _WIN32
+#ifdef _MSC_VER
 #pragma warning(pop)
 #endif
diff --git a/winpr/libwinpr/path/shell.c b/winpr/libwinpr/path/shell.c
index c373f039925..fc536c6bab6 100644
--- a/winpr/libwinpr/path/shell.c
+++ b/winpr/libwinpr/path/shell.c
@@ -663,7 +663,7 @@ BOOL PathIsDirectoryEmptyW(LPCWSTR pszPath)
 
 #else
 
-#ifdef _WIN32
+#ifdef _MSC_VER
 #pragma comment(lib, "shlwapi.lib")
 #endif
 
diff --git a/winpr/libwinpr/utils/trio/trio.c b/winpr/libwinpr/utils/trio/trio.c
index b278f475b75..a2c0290bc54 100644
--- a/winpr/libwinpr/utils/trio/trio.c
+++ b/winpr/libwinpr/utils/trio/trio.c
@@ -406,7 +406,7 @@ typedef trio_longlong_t trio_int64_t;
  * Internal Definitions
  */
 
-#ifdef _WIN32
+#ifdef _MSC_VER
 #pragma warning(push)
 #pragma warning(disable : 4244)
 #endif
@@ -7189,6 +7189,6 @@ TRIO_PUBLIC TRIO_CONST char* trio_strerror TRIO_ARGS1((errorcode), int errorcode
 #endif
 }
 
-#ifdef _WIN32
+#ifdef _MSC_VER
 #pragma warning(pop)
 #endif

From 788849cb9b74540f8234b875d6b5622a96a64c73 Mon Sep 17 00:00:00 2001
From: Biswapriyo Nath <nathbappai@gmail.com>
Date: Wed, 28 Apr 2021 18:32:54 +0530
Subject: [PATCH 3/3] Fix intialization, remove some unused variables.

---
 client/Windows/wf_floatbar.c  | 16 ++++------------
 libfreerdp/utils/stopwatch.c  |  2 +-
 server/Windows/wf_mirage.c    |  1 -
 winpr/libwinpr/file/generic.c |  1 -
 winpr/libwinpr/synch/sleep.c  |  6 +++---
 5 files changed, 8 insertions(+), 18 deletions(-)

diff --git a/client/Windows/wf_floatbar.c b/client/Windows/wf_floatbar.c
index 793569bc640..b5fe3207d67 100644
--- a/client/Windows/wf_floatbar.c
+++ b/client/Windows/wf_floatbar.c
@@ -357,18 +357,10 @@ static BOOL floatbar_paint(wfFloatBar* const floatbar, const HDC hdc)
 	int bottom = BACKGROUND_H - 1;
 	int right = BACKGROUND_W - 1;
 	const int angleOffset = BACKGROUND_H - 1;
-	TRIVERTEX triVertext[2] = { left,
-		                        top,
-		                        GetRValue(rgbTop) << 8,
-		                        GetGValue(rgbTop) << 8,
-		                        GetBValue(rgbTop) << 8,
-		                        0x0000,
-		                        right,
-		                        bottom,
-		                        GetRValue(rgbBottom) << 8,
-		                        GetGValue(rgbBottom) << 8,
-		                        GetBValue(rgbBottom) << 8,
-		                        0x0000 };
+	TRIVERTEX triVertext[2] = { { left, top, GetRValue(rgbTop) << 8, GetGValue(rgbTop) << 8,
+		                          GetBValue(rgbTop) << 8, 0x0000 },
+		                        { right, bottom, GetRValue(rgbBottom) << 8,
+		                          GetGValue(rgbBottom) << 8, GetBValue(rgbBottom) << 8, 0x0000 } };
 
 	if (!floatbar)
 		return FALSE;
diff --git a/libfreerdp/utils/stopwatch.c b/libfreerdp/utils/stopwatch.c
index b30890cd990..4dc207b6576 100644
--- a/libfreerdp/utils/stopwatch.c
+++ b/libfreerdp/utils/stopwatch.c
@@ -27,7 +27,7 @@
 #include <freerdp/utils/stopwatch.h>
 
 #ifdef _WIN32
-LARGE_INTEGER stopwatch_freq = { 0, 0 };
+LARGE_INTEGER stopwatch_freq = { 0 };
 #else
 #include <sys/time.h>
 #endif
diff --git a/server/Windows/wf_mirage.c b/server/Windows/wf_mirage.c
index 272bcbc64af..524ff6e0eaa 100644
--- a/server/Windows/wf_mirage.c
+++ b/server/Windows/wf_mirage.c
@@ -195,7 +195,6 @@ void wf_mirror_driver_print_display_change_status(LONG status)
 
 BOOL wf_mirror_driver_update(wfInfo* wfi, int mode)
 {
-	HDC dc;
 	BOOL status;
 	DWORD* extHdr;
 	WORD drvExtraSaved;
diff --git a/winpr/libwinpr/file/generic.c b/winpr/libwinpr/file/generic.c
index 2faee83ad0a..7f230fe6d7e 100644
--- a/winpr/libwinpr/file/generic.c
+++ b/winpr/libwinpr/file/generic.c
@@ -1299,7 +1299,6 @@ int UnixChangeFileMode(const char* filename, int flags)
 #else
 	int rc;
 	WCHAR* wfl = NULL;
-	int fl = 0;
 
 	if (ConvertToUnicode(CP_UTF8, 0, filename, -1, &wfl, 0) <= 0)
 		return -1;
diff --git a/winpr/libwinpr/synch/sleep.c b/winpr/libwinpr/synch/sleep.c
index 05e7c53c535..7de1a3a521f 100644
--- a/winpr/libwinpr/synch/sleep.c
+++ b/winpr/libwinpr/synch/sleep.c
@@ -117,9 +117,9 @@ VOID USleep(DWORD dwMicroseconds)
 #ifndef _WIN32
 	usleep(dwMicroseconds);
 #else
-	static LARGE_INTEGER freq = { 0, 0 };
-	LARGE_INTEGER t1 = { 0, 0 };
-	LARGE_INTEGER t2 = { 0, 0 };
+	static LARGE_INTEGER freq = { 0 };
+	LARGE_INTEGER t1 = { 0 };
+	LARGE_INTEGER t2 = { 0 };
 
 	QueryPerformanceCounter(&t1);
 
