diff --git a/src/io.c b/src/io.c
index f9531e90..2d2b7e2d 100644
--- a/src/io.c
+++ b/src/io.c
@@ -2148,6 +2148,9 @@ int io_listen_accept(IO_PRIVHANDLE *phandle, IO_PRIVHANDLE *pchild,
struct sockaddr_in client;
SOCKET_T child_fd;
IO_SOCKET_PRIV *priv;
+#ifdef WIN32
+ long blocking = 0;
+#endif
ASSERT(phandle);
ASSERT(pchild);
@@ -2176,6 +2179,12 @@ int io_listen_accept(IO_PRIVHANDLE *phandle, IO_PRIVHANDLE *pchild,
return FALSE;
}
+#ifdef WIN32
+ if(ioctlsocket(child_fd,FIONBIO,&blocking)) {
+ io_err_printf(IO_LOG_LOG,"Couldn't set socket to blocking\n");
+ }
+#endif
+
io_err_printf(IO_LOG_DEBUG,"Got listen socket %d\n",child_fd);
/* copy host, if passed a buffer */
@@ -2277,7 +2286,7 @@ int io_socket_write(IO_PRIVHANDLE *phandle, unsigned char *buf,uint32_t *len) {
int slen;
uint32_t bytestowrite;
- ssize_t byteswritten;
+ ssize_t byteswritten=0;
uint32_t totalbytes;
unsigned char *bufp;
@@ -2318,8 +2327,10 @@ int io_socket_write(IO_PRIVHANDLE *phandle, unsigned char *buf,uint32_t *len) {
#endif
if((byteswritten == -1 ) && (errno != EINTR)) {
io_socket_seterr(phandle,IO_E_SOCKET_OTHER);
+ *len = totalbytes;
return FALSE;
}
+
if(byteswritten == -1)
byteswritten = 0;
totalbytes += byteswritten;
diff --git a/src/webserver.c b/src/webserver.c
index bb97ea9c..44cb4afc 100644
--- a/src/webserver.c
+++ b/src/webserver.c
@@ -1203,7 +1203,7 @@ int ws_writefd(WS_CONNINFO *pwsc, char *fmt, ...) {
}
WS_EXIT();
- return len;
+ return (int)len;
}
/**
diff --git a/src/win32.h b/src/win32.h
index df3f83ea..824d4989 100644
--- a/src/win32.h
+++ b/src/win32.h
@@ -75,6 +75,7 @@ typedef INT64 int64_t;
#define strncasecmp strnicmp
#define strcasecmp stricmp
#define snprintf _snprintf
+#define vsnprintf _vsnprintf
#define access _access
#define readdir_r os_readdir_r
diff --git a/win32/mt-daapd.vcproj b/win32/mt-daapd.vcproj
index df025c3f..7087f7ed 100644
--- a/win32/mt-daapd.vcproj
+++ b/win32/mt-daapd.vcproj
@@ -290,10 +290,6 @@
RelativePath="..\src\scan-mp3.c"
>
-
-
@@ -493,10 +489,6 @@
/>
-
-
diff --git a/win32/out-daap/out-daap.vcproj b/win32/out-daap/out-daap.vcproj
index 0c9cecc8..c0d10591 100644
--- a/win32/out-daap/out-daap.vcproj
+++ b/win32/out-daap/out-daap.vcproj
@@ -124,7 +124,7 @@
Name="VCCLCompilerTool"
AdditionalIncludeDirectories="..;..\..\src"
PreprocessorDefinitions="HAVE_CONFIG_H;WIN32"
- RuntimeLibrary="2"
+ RuntimeLibrary="0"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
diff --git a/win32/rsp.vcproj b/win32/rsp.vcproj
index 35e1f915..ed9b637b 100644
--- a/win32/rsp.vcproj
+++ b/win32/rsp.vcproj
@@ -45,7 +45,7 @@
PreprocessorDefinitions="_WIN32;HAVE_CONFIG_H;ZLIB_DLL;WIN32;PLUGIN"
MinimalRebuild="true"
BasicRuntimeChecks="3"
- RuntimeLibrary="3"
+ RuntimeLibrary="1"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
@@ -125,7 +125,7 @@
Name="VCCLCompilerTool"
AdditionalIncludeDirectories="..\win32;.;..\src"
PreprocessorDefinitions="_WIN32;HAVE_CONFIG_H;ZLIB_DLL;WIN32;PLUGIN"
- RuntimeLibrary="2"
+ RuntimeLibrary="0"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="true"