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:
Chun-wei Fan
2013-07-01 14:51:03 +02:00
committed by Alexander Larsson
parent 4b49c44b0a
commit 2268e9d6c9
4 changed files with 14 additions and 1 deletions

View File

@ -18,7 +18,12 @@
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#elif defined (G_OS_WIN32)
#include <io.h>
#define ftruncate _chsize_s
#endif
#include <sys/types.h>
#ifdef G_OS_WIN32
#include <windows.h>