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 0658317..59ce879 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 483b708..a2fd756 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 39fa5d2..366e808 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 158fc91..af0c5ea 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 b3c979a..7a71853 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 8219467..33ca7d2 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 1b734c6..93312f0 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 b0c0f10..9bcbdcc 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 ccf0c22..49990a9 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 e9a5dad..55f0cce 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 814061b..2f86c81 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 7f2bb72..dc5546d 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 ba7c12d..e20b60c 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 18f3094..9f7cc7a 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 b71ca6c..39757aa 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 d312ccf..516f653 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 62b7aaf..eb706dc 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 71ead48..a48fc6b 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 55093c7..a7197cb 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 ddd4b31..48449ac 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 a7b455a..b0cd6ae 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 40e6a8b..605b2d8 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 f5c22b6..5c54fba 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 763f1e3..0ffd9e0 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 1093f71..140fdc7 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"