From a910821506880c55c6dc1520b48460112182c7c8 Mon Sep 17 00:00:00 2001 From: varjolintu Date: Fri, 27 Apr 2018 19:38:08 +0300 Subject: [PATCH] Fix Windows build with socket size --- src/proxy/CMakeLists.txt | 3 +++ src/proxy/NativeMessagingHost.cpp | 6 +++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/proxy/CMakeLists.txt b/src/proxy/CMakeLists.txt index f4c197e39..4972043b5 100755 --- a/src/proxy/CMakeLists.txt +++ b/src/proxy/CMakeLists.txt @@ -55,4 +55,7 @@ if(WITH_XC_BROWSER) WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/src COMMENT "Changing linking of keepassxc-proxy") endif() + if(MINGW) + target_link_libraries(keepassxc-proxy Wtsapi32.lib Ws2_32.lib) + endif() endif() diff --git a/src/proxy/NativeMessagingHost.cpp b/src/proxy/NativeMessagingHost.cpp index 15416dc8d..aabeb01af 100755 --- a/src/proxy/NativeMessagingHost.cpp +++ b/src/proxy/NativeMessagingHost.cpp @@ -18,6 +18,10 @@ #include #include "NativeMessagingHost.h" +#ifdef Q_OS_WIN +#include +#endif + NativeMessagingHost::NativeMessagingHost() : NativeMessagingBase() { m_localSocket = new QLocalSocket(); @@ -27,7 +31,7 @@ NativeMessagingHost::NativeMessagingHost() : NativeMessagingBase() int socketDesc = m_localSocket->socketDescriptor(); if (socketDesc) { int max = NATIVE_MSG_MAX_LENGTH; - setsockopt(socketDesc, SOL_SOCKET, SO_SNDBUF, &max, sizeof(max)); + setsockopt(socketDesc, SOL_SOCKET, SO_SNDBUF, reinterpret_cast(&max), sizeof(max)); } #ifdef Q_OS_WIN m_running.store(true);