# HG changeset patch
# Node ID 2af97c39c405
# Parent  00c472cd0fff
diff --git a/libpurple/protocols/ircv3/purpleircv3capabilities.c b/libpurple/protocols/ircv3/purpleircv3capabilities.c
--- a/libpurple/protocols/ircv3/purpleircv3capabilities.c
+++ b/libpurple/protocols/ircv3/purpleircv3capabilities.c
@@ -28,6 +28,14 @@
 };
 static GParamSpec *properties[N_PROPERTIES] = {NULL, };
 
+/* Windows is does something weird with signal handling that includes defining
+ * SIG_ACK. We don't care about that here, so we undef it if we find it.
+ * See https://learn.microsoft.com/en-us/cpp/c-runtime-library/signal-action-constants?view=msvc-170
+ */
+#ifdef SIG_ACK
+# undef SIG_ACK
+#endif /* SIG_ACK */
+
 enum {
 	SIG_READY,
 	SIG_ACK,
diff --git a/pidgin/meson.build b/pidgin/meson.build
--- a/pidgin/meson.build
+++ b/pidgin/meson.build
@@ -176,11 +176,13 @@
 	    input : 'win32/pidgin_exe_rc.rc.in',
 	    output : 'pidgin_exe_rc.rc',
 	    configuration : version_conf)
+
+	pidgin_WIN32_RESOURCES = windows.compile_resources(pidgin_exe_rc,
+		include_directories : include_directories('win32'))
+
 	pidgin_SOURCES = [
-	    'win32/winpidgin.c',
-	    windows.compile_resources(pidgin_exe_rc,
-	        include_directories : include_directories('win32')
-	    )
+		'win32/winpidgin.c',
+		pidgin_WIN32_RESOURCES,
 	]
 endif
 
diff --git a/pidgin/win32/gtkwin32dep.c b/pidgin/win32/gtkwin32dep.c
--- a/pidgin/win32/gtkwin32dep.c
+++ b/pidgin/win32/gtkwin32dep.c
@@ -132,7 +132,7 @@
 		purple_debug_misc("winpidgin", "winpidgin_init start\n");
 
 	exchndl_dll_path = g_build_filename(wpurple_bin_dir(), "exchndl.dll", NULL);
-	MySetLogFile = (LPFNSETLOGFILE) wpurple_find_and_loadproc(exchndl_dll_path, "SetLogFile");
+	MySetLogFile = (gpointer)wpurple_find_and_loadproc(exchndl_dll_path, "SetLogFile");
 	g_free(exchndl_dll_path);
 	exchndl_dll_path = NULL;
 	if (MySetLogFile) {
@@ -168,7 +168,7 @@
 /* DLL initializer */
 /* suppress gcc "no previous prototype" warning */
 BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved);
-BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) {
+BOOL WINAPI DllMain(HINSTANCE hinstDLL, G_GNUC_UNUSED DWORD fdwReason, G_GNUC_UNUSED LPVOID lpvReserved) {
 	dll_hInstance = hinstDLL;
 	return TRUE;
 }
diff --git a/pidgin/win32/winpidgin.c b/pidgin/win32/winpidgin.c
--- a/pidgin/win32/winpidgin.c
+++ b/pidgin/win32/winpidgin.c
@@ -41,6 +41,15 @@
 #include <sys/types.h>
 #include <sys/stat.h>
 
+/* We can't include glib.h per the above warning, so we define our own unused
+ * parameter macro.
+ */
+#ifdef __GNUC__
+# define PIDGIN_WIN32_UNUSED __attribute__((unused))
+#else
+# define PIDGIN_WIN32_UNUSED
+#endif
+
 typedef int (__cdecl* LPFNPIDGINMAIN)(HINSTANCE, int, char**);
 typedef BOOL (WINAPI* LPFNSETDLLDIRECTORY)(LPCWSTR);
 typedef BOOL (WINAPI* LPFNATTACHCONSOLE)(DWORD);
@@ -175,9 +184,12 @@
 }
 
 
-int _stdcall
-WinMain (struct HINSTANCE__ *hInstance, struct HINSTANCE__ *hPrevInstance,
-		char *lpszCmdLine, int nCmdShow) {
+int __stdcall
+WinMain(struct HINSTANCE__ *hInstance,
+        PIDGIN_WIN32_UNUSED struct HINSTANCE__ *hPrevInstance,
+        PIDGIN_WIN32_UNUSED char *lpszCmdLine,
+        PIDGIN_WIN32_UNUSED int nCmdShow)
+{
 	wchar_t errbuf[512];
 	wchar_t pidgin_dir[MAX_PATH];
 	wchar_t *pidgin_dir_start = NULL;
@@ -220,7 +232,7 @@
 	/* Permanently enable DEP if the OS supports it */
 	if ((hmod = GetModuleHandleW(L"kernel32.dll"))) {
 		LPFNSETPROCESSDEPPOLICY MySetProcessDEPPolicy =
-			(LPFNSETPROCESSDEPPOLICY)
+			(void *)
 			GetProcAddress(hmod, "SetProcessDEPPolicy");
 		if (MySetProcessDEPPolicy)
 			MySetProcessDEPPolicy(1); //PROCESS_DEP_ENABLE
@@ -233,7 +245,7 @@
 			LPFNATTACHCONSOLE MyAttachConsole = NULL;
 			if (hmod)
 				MyAttachConsole =
-					(LPFNATTACHCONSOLE)
+					(void *)
 					GetProcAddress(hmod, "AttachConsole");
 			if ((MyAttachConsole && MyAttachConsole(ATTACH_PARENT_PROCESS))
 					|| AllocConsole()) {
@@ -274,7 +286,7 @@
 				/* Temporarily override exchndl.dll's logfile
 				 * to something sane (Pidgin will override it
 				 * again when it initializes) */
-				MySetLogFile = (LPFNSETLOGFILE) GetProcAddress(hmod, "SetLogFile");
+				MySetLogFile = (void *)GetProcAddress(hmod, "SetLogFile");
 				if (MySetLogFile) {
 					if (GetTempPathA(sizeof(debug_dir), debug_dir) != 0) {
 						strcat(debug_dir, "pidgin.RPT");
@@ -285,7 +297,7 @@
 				}
 				/* The function signature for SetDebugInfoDir is the same as SetLogFile,
 				 * so we can reuse the variable */
-				MySetLogFile = (LPFNSETLOGFILE) GetProcAddress(hmod, "SetDebugInfoDir");
+				MySetLogFile = (void *)GetProcAddress(hmod, "SetDebugInfoDir");
 				if (MySetLogFile) {
 					char *pidgin_dir_ansi = NULL;
 					/* Restore pidgin_dir to point to where the executable is */
@@ -330,7 +342,7 @@
 			hmod = GetModuleHandleW(L"kernel32.dll");
 
 			if (hmod != NULL) {
-				MySetDllDirectory = (LPFNSETDLLDIRECTORY) GetProcAddress(hmod, "SetDllDirectoryW");
+				MySetDllDirectory = (void *)GetProcAddress(hmod, "SetDllDirectoryW");
 				if (MySetDllDirectory == NULL) {
 					DWORD dw = GetLastError();
 					const wchar_t *err_msg = get_win32_error_message(dw);
@@ -370,7 +382,7 @@
 
 	/* Now we are ready for Pidgin .. */
 	if ((hmod = LoadLibraryW(LIBPIDGIN_DLL_NAMEW)))
-		pidgin_main = (LPFNPIDGINMAIN) GetProcAddress(hmod, "pidgin_main");
+		pidgin_main = (void *)GetProcAddress(hmod, "pidgin_main");
 
 	if (!pidgin_main) {
 		DWORD dw = GetLastError();
