Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2012-04-15 11:54:07 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-04-15 11:54:07 +0400
commita73d0d3e72940ecd0e3e60c8e4e858c7e00ff5e2 (patch)
tree554c462fa090dad417a0e0371a7647007c33b1ba
parenta8077c8222876bdc67cfbc9ae56b04a12c8657e9 (diff)
code cleanup: dont include BLI_winstuff.h on non windows systems, also cleanup some defines/includes for windows.
-rw-r--r--source/blender/avi/intern/avi.c4
-rw-r--r--source/blender/avi/intern/options.c5
-rw-r--r--source/blender/blenkernel/intern/depsgraph.c5
-rw-r--r--source/blender/blenkernel/intern/screen.c4
-rw-r--r--source/blender/blenkernel/intern/unit.c5
-rw-r--r--source/blender/blenlib/BLI_winstuff.h48
-rw-r--r--source/blender/blenlib/intern/fileops.c18
-rw-r--r--source/blender/blenlib/intern/storage.c19
-rw-r--r--source/blender/blenloader/intern/readblenentry.c4
-rw-r--r--source/blender/blenloader/intern/readfile.c8
-rw-r--r--source/blender/blenloader/intern/runtime.c6
-rw-r--r--source/blender/blenloader/intern/writefile.c10
-rw-r--r--source/blender/editors/interface/interface_icons.c11
-rw-r--r--source/blender/editors/sculpt_paint/paint_image.c3
-rw-r--r--source/blender/editors/space_console/space_console.c2
-rw-r--r--source/blender/editors/space_file/file_draw.c3
-rw-r--r--source/blender/editors/space_file/file_ops.c3
-rw-r--r--source/blender/editors/space_file/filelist.c2
-rw-r--r--source/blender/editors/space_file/filesel.c22
-rw-r--r--source/blender/editors/space_file/fsmenu.c22
-rw-r--r--source/blender/editors/space_text/text_header.c6
-rw-r--r--source/blender/gpu/intern/gpu_extensions.c4
-rw-r--r--source/blender/imbuf/intern/thumbs.c21
-rw-r--r--source/blender/windowmanager/intern/wm_files.c17
-rw-r--r--source/creator/creator.c2
25 files changed, 132 insertions, 122 deletions
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 <string.h>
#include <stdio.h>
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 _WIN32
+# error "This include is for Windows only!"
+#endif
#ifndef FREE_WINDOWS
-#pragma warning(once: 4761 4305 4244 4018)
+# pragma warning(once: 4761 4305 4244 4018)
#else
-#ifdef WINVER
-#undef WINVER
-#endif
+# 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__ */
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 <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"
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 <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"
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 <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 */
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 <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"
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 <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) */
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 <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"
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 <stdio.h>
#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 <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"
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 <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>
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 <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"
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 <stdio.h>
#include <string.h>
-#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 <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
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 <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"
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"