diff --git a/source/blender/avi/intern/avi.c b/source/blender/avi/intern/avi.c index 0658317a0bd..59ce879520e 100644 --- a/source/blender/avi/intern/avi.c +++ b/source/blender/avi/intern/avi.c @@ -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" diff --git a/source/blender/avi/intern/options.c b/source/blender/avi/intern/options.c index 483b708bee6..a2fd756ddaa 100644 --- a/source/blender/avi/intern/options.c +++ b/source/blender/avi/intern/options.c @@ -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? */ diff --git a/source/blender/blenkernel/intern/depsgraph.c b/source/blender/blenkernel/intern/depsgraph.c index 39fa5d2f7e7..366e808d32c 100644 --- a/source/blender/blenkernel/intern/depsgraph.c +++ b/source/blender/blenkernel/intern/depsgraph.c @@ -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" diff --git a/source/blender/blenkernel/intern/screen.c b/source/blender/blenkernel/intern/screen.c index 158fc91c03c..af0c5eae9a8 100644 --- a/source/blender/blenkernel/intern/screen.c +++ b/source/blender/blenkernel/intern/screen.c @@ -30,7 +30,9 @@ * \ingroup bke */ -#include "BLI_winstuff.h" +#ifdef WIN32 +# include "BLI_winstuff.h" +#endif #include #include diff --git a/source/blender/blenkernel/intern/unit.c b/source/blender/blenkernel/intern/unit.c index b3c979afac4..7a71853641d 100644 --- a/source/blender/blenkernel/intern/unit.c +++ b/source/blender/blenkernel/intern/unit.c @@ -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 diff --git a/source/blender/blenlib/BLI_winstuff.h b/source/blender/blenlib/BLI_winstuff.h index 821946727f2..33ca7d235fa 100644 --- a/source/blender/blenlib/BLI_winstuff.h +++ b/source/blender/blenlib/BLI_winstuff.h @@ -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 -#undef HKEY +# undef HKEY +# define HKEY WIN32_HKEY // prevent competing definitions +# include +# undef HKEY #else -#include +# include #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 -#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 +# 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__ */ diff --git a/source/blender/blenlib/intern/fileops.c b/source/blender/blenlib/intern/fileops.c index 1b734c674e2..93312f04692 100644 --- a/source/blender/blenlib/intern/fileops.c +++ b/source/blender/blenlib/intern/fileops.c @@ -43,16 +43,16 @@ #ifdef WIN32 #include -#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 // for read close -#include -#include -#include -#include +# include // for read close +# include +# include +# include +# include #endif #include "MEM_guardedalloc.h" diff --git a/source/blender/blenlib/intern/storage.c b/source/blender/blenlib/intern/storage.c index b0c0f106f06..9bcbdcce12e 100644 --- a/source/blender/blenlib/intern/storage.c +++ b/source/blender/blenlib/intern/storage.c @@ -68,20 +68,17 @@ #include #include /* strcpy etc.. */ -#ifndef WIN32 -#include -#include /* */ -#include -#endif - #ifdef WIN32 -#include -#include -#include "BLI_winstuff.h" -#include "utfconv.h" +# include +# include +# include "BLI_winstuff.h" +# include "utfconv.h" +#else +# include +# include +# include #endif - /* lib includes */ #include "MEM_guardedalloc.h" diff --git a/source/blender/blenloader/intern/readblenentry.c b/source/blender/blenloader/intern/readblenentry.c index ccf0c226570..49990a953f6 100644 --- a/source/blender/blenloader/intern/readblenentry.c +++ b/source/blender/blenloader/intern/readblenentry.c @@ -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 --------------------- */ diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index e9a5dada044..55f0ccebf95 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -42,11 +42,11 @@ #include /* for va_start/end */ #ifndef WIN32 - #include // for read close +# include // for read close #else - #include // for open close read -#include "winsock2.h" -#include "BLI_winstuff.h" +# include // for open close read +# include "winsock2.h" +# include "BLI_winstuff.h" #endif /* allow readfile to use deprecated functionality */ diff --git a/source/blender/blenloader/intern/runtime.c b/source/blender/blenloader/intern/runtime.c index 814061b7318..2f86c810da0 100644 --- a/source/blender/blenloader/intern/runtime.c +++ b/source/blender/blenloader/intern/runtime.c @@ -39,10 +39,10 @@ #include #ifdef WIN32 -#include // read, open -#include "BLI_winstuff.h" +# include // read, open +# include "BLI_winstuff.h" #else // ! WIN32 -#include // read +# include // read #endif #include "BLO_readfile.h" diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c index 7f2bb72bf49..dc5546d38dd 100644 --- a/source/blender/blenloader/intern/writefile.c +++ b/source/blender/blenloader/intern/writefile.c @@ -81,12 +81,12 @@ Any case: direct data is ALWAYS after the lib block #include "zlib.h" #ifndef WIN32 -#include +# include #else -#include "winsock2.h" -#include -#include // for getpid -#include "BLI_winstuff.h" +# include "winsock2.h" +# include +# include // for getpid +# include "BLI_winstuff.h" #endif /* allow writefile to use deprecated functionality (for forward compatibility code) */ diff --git a/source/blender/editors/interface/interface_icons.c b/source/blender/editors/interface/interface_icons.c index ba7c12d164b..e20b60cd77e 100644 --- a/source/blender/editors/interface/interface_icons.c +++ b/source/blender/editors/interface/interface_icons.c @@ -33,12 +33,13 @@ #include #ifndef WIN32 -#include +# include #else -#include -#include -#include "BLI_winstuff.h" -#endif +# include +# include +# include "BLI_winstuff.h" +#endif + #include "MEM_guardedalloc.h" #include "GPU_extensions.h" diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c index 18f3094fa31..9f7cc7a75b1 100644 --- a/source/blender/editors/sculpt_paint/paint_image.c +++ b/source/blender/editors/sculpt_paint/paint_image.c @@ -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" diff --git a/source/blender/editors/space_console/space_console.c b/source/blender/editors/space_console/space_console.c index b71ca6c36c4..39757aa393a 100644 --- a/source/blender/editors/space_console/space_console.c +++ b/source/blender/editors/space_console/space_console.c @@ -28,7 +28,7 @@ #include #ifdef WIN32 -#include "BLI_winstuff.h" +# include "BLI_winstuff.h" #endif #include "MEM_guardedalloc.h" diff --git a/source/blender/editors/space_file/file_draw.c b/source/blender/editors/space_file/file_draw.c index d312ccf8aa1..516f6532c4a 100644 --- a/source/blender/editors/space_file/file_draw.c +++ b/source/blender/editors/space_file/file_draw.c @@ -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" diff --git a/source/blender/editors/space_file/file_ops.c b/source/blender/editors/space_file/file_ops.c index 62b7aafb187..eb706dcca75 100644 --- a/source/blender/editors/space_file/file_ops.c +++ b/source/blender/editors/space_file/file_ops.c @@ -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" diff --git a/source/blender/editors/space_file/filelist.c b/source/blender/editors/space_file/filelist.c index 71ead483d06..a48fc6b23f6 100644 --- a/source/blender/editors/space_file/filelist.c +++ b/source/blender/editors/space_file/filelist.c @@ -50,7 +50,7 @@ #include "BLI_utildefines.h" #ifdef WIN32 -#include "BLI_winstuff.h" +# include "BLI_winstuff.h" #endif #include "BKE_context.h" diff --git a/source/blender/editors/space_file/filesel.c b/source/blender/editors/space_file/filesel.c index 55093c7e5de..a7197cb31e6 100644 --- a/source/blender/editors/space_file/filesel.c +++ b/source/blender/editors/space_file/filesel.c @@ -36,22 +36,16 @@ #include #include -#ifdef WIN32 -#include -#include -#include "BLI_winstuff.h" -#else -#include -#include -#endif - /* path/file handeling stuff */ -#ifndef WIN32 - #include - #include +#ifdef WIN32 +# include +# include +# include "BLI_winstuff.h" #else - #include - #include "BLI_winstuff.h" +# include +# include +# include +# include #endif #include "DNA_space_types.h" diff --git a/source/blender/editors/space_file/fsmenu.c b/source/blender/editors/space_file/fsmenu.c index ddd4b31d145..48449ac8870 100644 --- a/source/blender/editors/space_file/fsmenu.c +++ b/source/blender/editors/space_file/fsmenu.c @@ -44,20 +44,20 @@ #include "BLI_dynstr.h" #ifdef WIN32 -#include /* 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 /* for SHGetSpecialFolderPath, has to be done before BLI_winstuff because 'near' is disabled through BLI_windstuff */ -#include "BLI_winstuff.h" +# include /* 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 /* 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 - -#endif + /* XXX BIG WARNING: carbon.h can not be included in blender code, it conflicts with struct ID */ +# define ID ID_ +# include +#endif /* __APPLE__ */ #ifdef __linux__ #include diff --git a/source/blender/editors/space_text/text_header.c b/source/blender/editors/space_text/text_header.c index a7b455a6ff3..b0cd6aeaab4 100644 --- a/source/blender/editors/space_text/text_header.c +++ b/source/blender/editors/space_text/text_header.c @@ -39,10 +39,10 @@ #include #ifndef _WIN32 -#include +# include #else -#include -#include "BLI_winstuff.h" +# include +# include "BLI_winstuff.h" #endif #include "DNA_windowmanager_types.h" diff --git a/source/blender/gpu/intern/gpu_extensions.c b/source/blender/gpu/intern/gpu_extensions.c index 40e6a8b2a35..605b2d8901e 100644 --- a/source/blender/gpu/intern/gpu_extensions.c +++ b/source/blender/gpu/intern/gpu_extensions.c @@ -51,7 +51,9 @@ #include #include -#include "BLI_winstuff.h" +#ifdef WIN32 +# include "BLI_winstuff.h" +#endif /* Extensions support */ diff --git a/source/blender/imbuf/intern/thumbs.c b/source/blender/imbuf/intern/thumbs.c index f5c22b67c1b..5c54fbab0cf 100644 --- a/source/blender/imbuf/intern/thumbs.c +++ b/source/blender/imbuf/intern/thumbs.c @@ -53,17 +53,18 @@ #include #ifdef WIN32 -#include /* 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 /* for SHGetSpecialFolderPath, has to be done before BLI_winstuff because 'near' is disabled through BLI_windstuff */ -#include /* getpid */ -#include /* chdir */ -#include "BLI_winstuff.h" -#include "utfconv.h" +# include /* 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 /* for SHGetSpecialFolderPath, has to be done before BLI_winstuff + * because 'near' is disabled through BLI_windstuff */ +# include /* getpid */ +# include /* chdir */ +# include "BLI_winstuff.h" +# include "utfconv.h" #else -#include +# include #endif #define URI_MAX FILE_MAX*3 + 8 diff --git a/source/blender/windowmanager/intern/wm_files.c b/source/blender/windowmanager/intern/wm_files.c index 763f1e3b11b..0ffd9e00f7e 100644 --- a/source/blender/windowmanager/intern/wm_files.c +++ b/source/blender/windowmanager/intern/wm_files.c @@ -38,15 +38,16 @@ #include "zlib.h" /* wm_read_exotic() */ #ifdef WIN32 -#include /* 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 /* for SHGetSpecialFolderPath, has to be done before BLI_winstuff because 'near' is disabled through BLI_windstuff */ -#include /* getpid */ -#include "BLI_winstuff.h" +# include /* 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 /* for SHGetSpecialFolderPath, has to be done before BLI_winstuff + * because 'near' is disabled through BLI_windstuff */ +# include /* getpid */ +# include "BLI_winstuff.h" #else -#include /* getpid */ +# include /* getpid */ #endif #include "MEM_guardedalloc.h" diff --git a/source/creator/creator.c b/source/creator/creator.c index 1093f71260c..140fdc7ff7e 100644 --- a/source/creator/creator.c +++ b/source/creator/creator.c @@ -54,7 +54,7 @@ #include "MEM_guardedalloc.h" #ifdef WIN32 -#include "BLI_winstuff.h" +# include "BLI_winstuff.h" #endif #include "BLI_args.h"