Broadway: Allow Compilation on Windows/MSVC
-Don't include unistd.h unconditionally as it's not available in Visual Studio, but include io.h where necessary. -Avoid C99isms, and use _chsize_s in place of ftruncate when unistd.h is not available (as in the case of Visual Studio)
This commit is contained in:
committed by
Alexander Larsson
parent
4b49c44b0a
commit
2268e9d6c9
@ -12,7 +12,11 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
#ifdef HAVE_UNISTD_H
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
#elif defined (G_OS_WIN32)
|
||||||
|
#include <io.h>
|
||||||
|
#endif
|
||||||
#include <crypt.h>
|
#include <crypt.h>
|
||||||
#ifdef HAVE_SYS_MMAN_H
|
#ifdef HAVE_SYS_MMAN_H
|
||||||
#include <sys/mman.h>
|
#include <sys/mman.h>
|
||||||
@ -979,7 +983,7 @@ static gchar *
|
|||||||
generate_handshake_response_wsietf_v7 (const gchar *key)
|
generate_handshake_response_wsietf_v7 (const gchar *key)
|
||||||
{
|
{
|
||||||
gsize digest_len = 20;
|
gsize digest_len = 20;
|
||||||
guchar digest[digest_len];
|
guchar digest[20];
|
||||||
GChecksum *checksum;
|
GChecksum *checksum;
|
||||||
|
|
||||||
checksum = g_checksum_new (G_CHECKSUM_SHA1);
|
checksum = g_checksum_new (G_CHECKSUM_SHA1);
|
||||||
|
|||||||
@ -18,7 +18,12 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
#ifdef HAVE_UNISTD_H
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
#elif defined (G_OS_WIN32)
|
||||||
|
#include <io.h>
|
||||||
|
#define ftruncate _chsize_s
|
||||||
|
#endif
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#ifdef G_OS_WIN32
|
#ifdef G_OS_WIN32
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
|||||||
@ -37,7 +37,9 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
#ifdef HAVE_UNISTD_H
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
#endif
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
|
||||||
static void gdk_broadway_display_dispose (GObject *object);
|
static void gdk_broadway_display_dispose (GObject *object);
|
||||||
|
|||||||
@ -33,7 +33,9 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#ifdef HAVE_UNISTD_H
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
#endif
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user