code cleanup: dont include BLI_winstuff.h on non windows systems, also cleanup some defines/includes for windows.

This commit is contained in:
Campbell Barton 2012-04-15 07:54:07 +00:00
parent a8077c8222
commit a73d0d3e72
25 changed files with 134 additions and 124 deletions

View File

@ -43,7 +43,9 @@
#include "MEM_guardedalloc.h"
#include "MEM_sys_types.h"
#include "BLI_winstuff.h"
#ifdef WIN32
# include "BLI_winstuff.h"
#endif
#include "AVI_avi.h"
#include "avi_intern.h"

View File

@ -34,12 +34,13 @@
* \ingroup avi
*/
#include "AVI_avi.h"
#include "avi_intern.h"
#include "endian.h"
#include "BLI_winstuff.h"
#ifdef WIN32
# include "BLI_winstuff.h"
#endif
/* avi_set_compress_options gets its own file... now don't WE feel important? */

View File

@ -34,7 +34,10 @@
#include "MEM_guardedalloc.h"
#include "BLI_winstuff.h"
#ifdef WIN32
# include "BLI_winstuff.h"
#endif
#include "BLI_utildefines.h"
#include "BLI_listbase.h"
#include "BLI_ghash.h"

View File

@ -30,7 +30,9 @@
* \ingroup bke
*/
#include "BLI_winstuff.h"
#ifdef WIN32
# include "BLI_winstuff.h"
#endif
#include <string.h>
#include <stdio.h>

View File

@ -34,7 +34,10 @@
#include "BLI_math.h"
#include "BLI_string.h"
#include "BLI_string_utf8.h"
#include "BLI_winstuff.h"
#ifdef WIN32
# include "BLI_winstuff.h"
#endif
#define TEMP_STR_SIZE 256

View File

@ -33,28 +33,30 @@
* \brief Compatibility-like things for windows.
*/
#ifdef _WIN32
#ifndef FREE_WINDOWS
#pragma warning(once: 4761 4305 4244 4018)
#else
#ifdef WINVER
#undef WINVER
#ifndef _WIN32
# error "This include is for Windows only!"
#endif
#ifndef FREE_WINDOWS
# pragma warning(once: 4761 4305 4244 4018)
#else
# ifdef WINVER
# undef WINVER
# endif
/* Some stuff requires WINVER 0x500, but mingw's default is 0x400 */
#define WINVER 0x0501
# define WINVER 0x0501
#endif
#define WIN32_LEAN_AND_MEAN
#ifndef WIN32_SKIP_HKEY_PROTECTION
#undef HKEY
#define HKEY WIN32_HKEY // prevent competing definitions
#include <windows.h>
#undef HKEY
# undef HKEY
# define HKEY WIN32_HKEY // prevent competing definitions
# include <windows.h>
# undef HKEY
#else
#include <windows.h>
# include <windows.h>
#endif
#undef near
@ -83,10 +85,10 @@ extern "C" {
#define MAXPATHLEN MAX_PATH
#ifndef S_ISREG
#define S_ISREG(x) (((x)&_S_IFREG) == _S_IFREG)
# define S_ISREG(x) (((x)&_S_IFREG) == _S_IFREG)
#endif
#ifndef S_ISDIR
#define S_ISDIR(x) (((x)&_S_IFDIR) == _S_IFDIR)
# define S_ISDIR(x) (((x)&_S_IFDIR) == _S_IFDIR)
#endif
/* defines for using ISO C++ conformant names */
@ -98,21 +100,21 @@ typedef unsigned int mode_t;
/* use functions that take a 64 bit offset for files larger than 4GB */
#ifndef FREE_WINDOWS
#include <stdio.h>
#define fseek(stream, offset, origin) _fseeki64(stream, offset, origin)
#define ftell(stream) _ftelli64(stream)
#define lseek(fd, offset, origin) _lseeki64(fd, offset, origin)
#define tell(fd) _telli64(fd)
# include <stdio.h>
# define fseek(stream, offset, origin) _fseeki64(stream, offset, origin)
# define ftell(stream) _ftelli64(stream)
# define lseek(fd, offset, origin) _lseeki64(fd, offset, origin)
# define tell(fd) _telli64(fd)
#endif
/* mingw using _SSIZE_T_ to declare ssize_t type */
#ifndef _SSIZE_T_
#define _SSIZE_T_
# define _SSIZE_T_
/* python uses HAVE_SSIZE_T */
#ifndef HAVE_SSIZE_T
#define HAVE_SSIZE_T 1
# ifndef HAVE_SSIZE_T
# define HAVE_SSIZE_T 1
typedef long ssize_t;
#endif
# endif
#endif
struct dirent {
@ -148,7 +150,5 @@ int BLI_getInstallationDir(char *str);
}
#endif
#endif /* _WIN32 */
#endif /* __BLI_WINSTUFF_H__ */

View File

@ -43,16 +43,16 @@
#ifdef WIN32
#include <io.h>
#include "BLI_winstuff.h"
#include "BLI_callbacks.h"
#include "utf_winfunc.h"
#include "utfconv.h"
# include "BLI_winstuff.h"
# include "BLI_callbacks.h"
# include "utf_winfunc.h"
# include "utfconv.h"
#else
#include <unistd.h> // for read close
#include <sys/param.h>
#include <dirent.h>
#include <unistd.h>
#include <sys/stat.h>
# include <unistd.h> // for read close
# include <sys/param.h>
# include <dirent.h>
# include <unistd.h>
# include <sys/stat.h>
#endif
#include "MEM_guardedalloc.h"

View File

@ -68,20 +68,17 @@
#include <fcntl.h>
#include <string.h> /* strcpy etc.. */
#ifndef WIN32
#include <sys/ioctl.h>
#include <unistd.h> /* */
#include <pwd.h>
#endif
#ifdef WIN32
#include <io.h>
#include <direct.h>
#include "BLI_winstuff.h"
#include "utfconv.h"
# include <io.h>
# include <direct.h>
# include "BLI_winstuff.h"
# include "utfconv.h"
#else
# include <sys/ioctl.h>
# include <unistd.h>
# include <pwd.h>
#endif
/* lib includes */
#include "MEM_guardedalloc.h"

View File

@ -64,8 +64,8 @@
#include "BLO_sys_types.h" // needed for intptr_t
#ifdef _WIN32
#include "BLI_winstuff.h"
#ifdef WIN32
# include "BLI_winstuff.h"
#endif
/* local prototypes --------------------- */

View File

@ -42,11 +42,11 @@
#include <stdarg.h> /* for va_start/end */
#ifndef WIN32
#include <unistd.h> // for read close
# include <unistd.h> // for read close
#else
#include <io.h> // for open close read
#include "winsock2.h"
#include "BLI_winstuff.h"
# include <io.h> // for open close read
# include "winsock2.h"
# include "BLI_winstuff.h"
#endif
/* allow readfile to use deprecated functionality */

View File

@ -39,10 +39,10 @@
#include <errno.h>
#ifdef WIN32
#include <io.h> // read, open
#include "BLI_winstuff.h"
# include <io.h> // read, open
# include "BLI_winstuff.h"
#else // ! WIN32
#include <unistd.h> // read
# include <unistd.h> // read
#endif
#include "BLO_readfile.h"

View File

@ -81,12 +81,12 @@ Any case: direct data is ALWAYS after the lib block
#include "zlib.h"
#ifndef WIN32
#include <unistd.h>
# include <unistd.h>
#else
#include "winsock2.h"
#include <io.h>
#include <process.h> // for getpid
#include "BLI_winstuff.h"
# include "winsock2.h"
# include <io.h>
# include <process.h> // for getpid
# include "BLI_winstuff.h"
#endif
/* allow writefile to use deprecated functionality (for forward compatibility code) */

View File

@ -33,12 +33,13 @@
#include <string.h>
#ifndef WIN32
#include <unistd.h>
# include <unistd.h>
#else
#include <io.h>
#include <direct.h>
#include "BLI_winstuff.h"
#endif
# include <io.h>
# include <direct.h>
# include "BLI_winstuff.h"
#endif
#include "MEM_guardedalloc.h"
#include "GPU_extensions.h"

View File

@ -41,8 +41,9 @@
#include "MEM_guardedalloc.h"
#ifdef WIN32
#include "BLI_winstuff.h"
# include "BLI_winstuff.h"
#endif
#include "BLI_math.h"
#include "BLI_blenlib.h"
#include "BLI_dynstr.h"

View File

@ -28,7 +28,7 @@
#include <stdio.h>
#ifdef WIN32
#include "BLI_winstuff.h"
# include "BLI_winstuff.h"
#endif
#include "MEM_guardedalloc.h"

View File

@ -35,8 +35,9 @@
#include "BLI_blenlib.h"
#include "BLI_utildefines.h"
#include "BLI_dynstr.h"
#ifdef WIN32
#include "BLI_winstuff.h"
# include "BLI_winstuff.h"
#endif
#include "BIF_gl.h"

View File

@ -37,8 +37,9 @@
#include "BLI_blenlib.h"
#include "BLI_utildefines.h"
#ifdef WIN32
#include "BLI_winstuff.h"
# include "BLI_winstuff.h"
#endif
#include "ED_screen.h"

View File

@ -50,7 +50,7 @@
#include "BLI_utildefines.h"
#ifdef WIN32
#include "BLI_winstuff.h"
# include "BLI_winstuff.h"
#endif
#include "BKE_context.h"

View File

@ -36,22 +36,16 @@
#include <sys/stat.h>
#include <sys/types.h>
#ifdef WIN32
#include <io.h>
#include <direct.h>
#include "BLI_winstuff.h"
#else
#include <unistd.h>
#include <sys/times.h>
#endif
/* path/file handeling stuff */
#ifndef WIN32
#include <dirent.h>
#include <unistd.h>
#ifdef WIN32
# include <io.h>
# include <direct.h>
# include "BLI_winstuff.h"
#else
#include <io.h>
#include "BLI_winstuff.h"
# include <unistd.h>
# include <sys/times.h>
# include <dirent.h>
# include <unistd.h>
#endif
#include "DNA_space_types.h"

View File

@ -44,20 +44,20 @@
#include "BLI_dynstr.h"
#ifdef WIN32
#include <windows.h> /* need to include windows.h so _WIN32_IE is defined */
#ifndef _WIN32_IE
#define _WIN32_IE 0x0400 /* minimal requirements for SHGetSpecialFolderPath on MINGW MSVC has this defined already */
#endif
#include <shlobj.h> /* for SHGetSpecialFolderPath, has to be done before BLI_winstuff because 'near' is disabled through BLI_windstuff */
#include "BLI_winstuff.h"
# include <windows.h> /* need to include windows.h so _WIN32_IE is defined */
# ifndef _WIN32_IE
# define _WIN32_IE 0x0400 /* minimal requirements for SHGetSpecialFolderPath on MINGW MSVC has this defined already */
# endif
# include <shlobj.h> /* for SHGetSpecialFolderPath, has to be done before BLI_winstuff
* because 'near' is disabled through BLI_windstuff */
# include "BLI_winstuff.h"
#endif
#ifdef __APPLE__
/* XXX BIG WARNING: carbon.h can not be included in blender code, it conflicts with struct ID */
#define ID ID_
#include <CoreServices/CoreServices.h>
#endif
/* XXX BIG WARNING: carbon.h can not be included in blender code, it conflicts with struct ID */
# define ID ID_
# include <CoreServices/CoreServices.h>
#endif /* __APPLE__ */
#ifdef __linux__
#include <mntent.h>

View File

@ -39,10 +39,10 @@
#include <sys/stat.h>
#ifndef _WIN32
#include <unistd.h>
# include <unistd.h>
#else
#include <io.h>
#include "BLI_winstuff.h"
# include <io.h>
# include "BLI_winstuff.h"
#endif
#include "DNA_windowmanager_types.h"

View File

@ -51,7 +51,9 @@
#include <stdio.h>
#include <string.h>
#include "BLI_winstuff.h"
#ifdef WIN32
# include "BLI_winstuff.h"
#endif
/* Extensions support */

View File

@ -53,17 +53,18 @@
#include <stdio.h>
#ifdef WIN32
#include <windows.h> /* need to include windows.h so _WIN32_IE is defined */
#ifndef _WIN32_IE
#define _WIN32_IE 0x0400 /* minimal requirements for SHGetSpecialFolderPath on MINGW MSVC has this defined already */
#endif
#include <shlobj.h> /* for SHGetSpecialFolderPath, has to be done before BLI_winstuff because 'near' is disabled through BLI_windstuff */
#include <process.h> /* getpid */
#include <direct.h> /* chdir */
#include "BLI_winstuff.h"
#include "utfconv.h"
# include <windows.h> /* need to include windows.h so _WIN32_IE is defined */
# ifndef _WIN32_IE
# define _WIN32_IE 0x0400 /* minimal requirements for SHGetSpecialFolderPath on MINGW MSVC has this defined already */
# endif
# include <shlobj.h> /* for SHGetSpecialFolderPath, has to be done before BLI_winstuff
* because 'near' is disabled through BLI_windstuff */
# include <process.h> /* getpid */
# include <direct.h> /* chdir */
# include "BLI_winstuff.h"
# include "utfconv.h"
#else
#include <unistd.h>
# include <unistd.h>
#endif
#define URI_MAX FILE_MAX*3 + 8

View File

@ -38,15 +38,16 @@
#include "zlib.h" /* wm_read_exotic() */
#ifdef WIN32
#include <windows.h> /* need to include windows.h so _WIN32_IE is defined */
#ifndef _WIN32_IE
#define _WIN32_IE 0x0400 /* minimal requirements for SHGetSpecialFolderPath on MINGW MSVC has this defined already */
#endif
#include <shlobj.h> /* for SHGetSpecialFolderPath, has to be done before BLI_winstuff because 'near' is disabled through BLI_windstuff */
#include <process.h> /* getpid */
#include "BLI_winstuff.h"
# include <windows.h> /* need to include windows.h so _WIN32_IE is defined */
# ifndef _WIN32_IE
# define _WIN32_IE 0x0400 /* minimal requirements for SHGetSpecialFolderPath on MINGW MSVC has this defined already */
# endif
# include <shlobj.h> /* for SHGetSpecialFolderPath, has to be done before BLI_winstuff
* because 'near' is disabled through BLI_windstuff */
# include <process.h> /* getpid */
# include "BLI_winstuff.h"
#else
#include <unistd.h> /* getpid */
# include <unistd.h> /* getpid */
#endif
#include "MEM_guardedalloc.h"

View File

@ -54,7 +54,7 @@
#include "MEM_guardedalloc.h"
#ifdef WIN32
#include "BLI_winstuff.h"
# include "BLI_winstuff.h"
#endif
#include "BLI_args.h"