code cleanup: dont include BLI_winstuff.h on non windows systems, also cleanup some...
authorCampbell Barton <ideasman42@gmail.com>
Sun, 15 Apr 2012 07:54:07 +0000 (07:54 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Sun, 15 Apr 2012 07:54:07 +0000 (07:54 +0000)
25 files changed:
source/blender/avi/intern/avi.c
source/blender/avi/intern/options.c
source/blender/blenkernel/intern/depsgraph.c
source/blender/blenkernel/intern/screen.c
source/blender/blenkernel/intern/unit.c
source/blender/blenlib/BLI_winstuff.h
source/blender/blenlib/intern/fileops.c
source/blender/blenlib/intern/storage.c
source/blender/blenloader/intern/readblenentry.c
source/blender/blenloader/intern/readfile.c
source/blender/blenloader/intern/runtime.c
source/blender/blenloader/intern/writefile.c
source/blender/editors/interface/interface_icons.c
source/blender/editors/sculpt_paint/paint_image.c
source/blender/editors/space_console/space_console.c
source/blender/editors/space_file/file_draw.c
source/blender/editors/space_file/file_ops.c
source/blender/editors/space_file/filelist.c
source/blender/editors/space_file/filesel.c
source/blender/editors/space_file/fsmenu.c
source/blender/editors/space_text/text_header.c
source/blender/gpu/intern/gpu_extensions.c
source/blender/imbuf/intern/thumbs.c
source/blender/windowmanager/intern/wm_files.c
source/creator/creator.c

index 0658317a0bd8f1ce506283d7b4540ff3f3ad52fb..59ce879520edaeb63d3fef7e53bad1c843d0d8ae 100644 (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"
index 483b708bee65375270dcef2ac5907214d4233c01..a2fd756ddaacf72dee6e5b88662a7579d3918195 100644 (file)
  *  \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? */
 
index 39fa5d2f7e7e4423cd0d4fd5cbf30154f5f5edcd..366e808d32c22ba39037a68df9ee6dc552e10a4a 100644 (file)
 
 #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"
index 158fc91c03c2d18a99c196035fc8151f9dd1b221..af0c5eae9a8c03f75ca46042c7db02742a57172a 100644 (file)
@@ -30,7 +30,9 @@
  *  \ingroup bke
  */
 
-#include "BLI_winstuff.h"
+#ifdef WIN32
+#  include "BLI_winstuff.h"
+#endif
 
 #include <string.h>
 #include <stdio.h>
index b3c979afac4a114deb1fe57f9d80c237e3c71f1c..7a71853641d941a43ec7caff47eaa4982dc478f6 100644 (file)
 #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
 
index 821946727f22e0e10b5dd609875ffb1c62637571..33ca7d235fa6dcdc910a6eb7f10d2eea9fb960fd 100644 (file)
  *  \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__ */
 
index 1b734c674e29bf4067d1c62918868ff0a9f94197..93312f046928f42a7c71b4cbe3a6edba9fe17b0b 100644 (file)
 
 #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"
index b0c0f106f06ebdbae5d1fd0d8e00b8a9e7bc249b..9bcbdcce12e44ddddf54651dd7288614b981cd6a 100644 (file)
 #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"
 
index ccf0c2265703fd28f73971333ef7fa5effbc8d9d..49990a953f6ecc44578f20f51668df2d82d92cdc 100644 (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 --------------------- */
index e9a5dada0440aa3b4ffbbed8a42ef7f9e236c3eb..55f0ccebf958cfdfe43c71ed61f2220b3349fb57 100644 (file)
 #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 */
index 814061b731818dab4fef0ea9e14377e558e75cd3..2f86c810da0370d0c043d876a474301e5165fa84 100644 (file)
 #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"
index 7f2bb72bf492374891912c7e904f67e9b9f59924..dc5546d38dd1e2df46da47a32b493be22bd7a662 100644 (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) */
index ba7c12d164b3020a50f9585344736d6b0239fd38..e20b60cd77e10ddb537c74452d8e8074b244588f 100644 (file)
 #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"
index 18f3094fa318afb684292a0900279ea89be8816b..9f7cc7a75b19bd844b63170b6c8e6ed1624f24a7 100644 (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"
index b71ca6c36c4f8fcb0a1d8a524f17c10e0e499a6a..39757aa393a588e74f7c9ca14f5d39a13b8b6e2c 100644 (file)
@@ -28,7 +28,7 @@
 #include <stdio.h>
 
 #ifdef WIN32
-#include "BLI_winstuff.h"
+#  include "BLI_winstuff.h"
 #endif
 
 #include "MEM_guardedalloc.h"
index d312ccf8aa1b1855de9ff1a03ff830c21fe881dc..516f6532c4a39702a48e3e141fbbead45e959c63 100644 (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"
index 62b7aafb187a164c630e57339fd035e63aa5bdb2..eb706dcca75f33bf0362a9003fc47f556ef14708 100644 (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"
index 71ead483d0616a8adb75e388cdec8dce1ff1a037..a48fc6b23f61eaae6a1e40c254bebd42c95dbca9 100644 (file)
@@ -50,7 +50,7 @@
 #include "BLI_utildefines.h"
 
 #ifdef WIN32
-#include "BLI_winstuff.h"
+#  include "BLI_winstuff.h"
 #endif
 
 #include "BKE_context.h"
index 55093c7e5de6754b91dd30961d04b7dc3230d8a9..a7197cb31e63e23a6aa1e4117534fb618abdd34b 100644 (file)
 #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"
index ddd4b31d145c0cea27d199693b011fe273fc8609..48449ac8870a3a5e2f251abb980465455590fde4 100644 (file)
 #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>
index a7b455a6ff3436ff123d8ce549cde9b6c99f327b..b0cd6aeaab48e1bb836751fe8777472a9242f03d 100644 (file)
 #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"
index 40e6a8b2a35dff1a6922a40713ff49577faf1a92..605b2d8901ec4d7c1717eb2b31cc10c80435aefa 100644 (file)
@@ -51,7 +51,9 @@
 #include <stdio.h>
 #include <string.h>
 
-#include "BLI_winstuff.h"
+#ifdef WIN32
+#  include "BLI_winstuff.h"
+#endif
 
 /* Extensions support */
 
index f5c22b67c1b558f0d5066e08c8763beeef28707e..5c54fbab0cf1acc0e0481784d475251aae7d911e 100644 (file)
 #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
index 763f1e3b11b71cdfe8b5c71b7e1934fce105980a..0ffd9e00f7e3ebea591dcb374a97eff56bb96823 100644 (file)
 #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"
index 1093f71260cedf8a50bd0d8c1c51fd4cc40c84ed..140fdc7ff7ea8d99d5bf76808bae902e70bce48d 100644 (file)
@@ -54,7 +54,7 @@
 #include "MEM_guardedalloc.h"
 
 #ifdef WIN32
-#include "BLI_winstuff.h"
+#  include "BLI_winstuff.h"
 #endif
 
 #include "BLI_args.h"