From fb649d5824ccccca544c905209ba64340dc1bded Mon Sep 17 00:00:00 2001 From: Nathan Letwory Date: Sun, 6 Sep 2009 13:20:05 +0000 Subject: * cleaning up warnings (mostly windows). A collection of other warning fixes too (undefined function, assuming int, etc.) This compiled fine with scons/msvc and scons/mingw (gcc 4.4.0). Please test and report any problems. --- intern/iksolver/intern/TNT/tntmath.h | 4 ++- intern/smoke/intern/tnt/tnt_math_utils.h | 4 ++- intern/string/STR_String.h | 4 +++ source/blender/blenkernel/intern/image.c | 5 ++++ source/blender/blenkernel/intern/packedFile.c | 8 +++++ source/blender/blenkernel/intern/pointcache.c | 16 ++-------- source/blender/blenkernel/intern/sound.c | 2 +- source/blender/blenlib/BLI_fileops.h | 2 -- source/blender/blenlib/BLI_winstuff.h | 31 +++++++++----------- source/blender/blenlib/intern/bpath.c | 34 ++++++++++++---------- source/blender/blenlib/intern/fileops.c | 14 +++++---- source/blender/blenlib/intern/storage.c | 15 +++++----- source/blender/blenloader/intern/readblenentry.c | 9 ++++-- source/blender/blenloader/intern/readfile.c | 7 ++--- source/blender/blenloader/intern/writefile.c | 14 ++++----- .../editors/armature/editarmature_generate.c | 1 + source/blender/editors/interface/interface_icons.c | 1 + source/blender/editors/mesh/meshtools.c | 1 + source/blender/editors/space_buttons/buttons_ops.c | 1 + source/blender/imbuf/intern/anim5.c | 6 ++++ source/blender/imbuf/intern/hamx.c | 10 +++---- source/blender/imbuf/intern/iff.c | 7 +++-- source/blender/imbuf/intern/thumbs.c | 20 ++++++------- source/blender/imbuf/intern/writeimage.c | 8 ++--- source/blender/python/intern/bpy_interface.c | 11 +++---- .../blender/readblenfile/intern/BLO_readblenfile.c | 1 + source/blender/windowmanager/intern/wm_files.c | 2 +- .../gameengine/Converter/KX_ConvertProperties.cpp | 10 +++---- source/gameengine/Ketsji/KX_PythonInit.cpp | 14 ++++----- source/gameengine/VideoTexture/SConscript | 1 - 30 files changed, 142 insertions(+), 121 deletions(-) diff --git a/intern/iksolver/intern/TNT/tntmath.h b/intern/iksolver/intern/TNT/tntmath.h index 5773900caf9..55a79e2aba0 100644 --- a/intern/iksolver/intern/TNT/tntmath.h +++ b/intern/iksolver/intern/TNT/tntmath.h @@ -35,7 +35,9 @@ // conventional functions required by several matrix algorithms - +#ifdef _WIN32 +#define hypot _hypot +#endif namespace TNT { diff --git a/intern/smoke/intern/tnt/tnt_math_utils.h b/intern/smoke/intern/tnt/tnt_math_utils.h index 6e14a1d9b90..f6aad8eaf38 100644 --- a/intern/smoke/intern/tnt/tnt_math_utils.h +++ b/intern/smoke/intern/tnt/tnt_math_utils.h @@ -4,7 +4,9 @@ /* needed for fabs, sqrt() below */ #include - +#ifdef _WIN32 +#define hypot _hypot +#endif namespace TNT { diff --git a/intern/string/STR_String.h b/intern/string/STR_String.h index a5e7a0721ec..d8023a06f81 100644 --- a/intern/string/STR_String.h +++ b/intern/string/STR_String.h @@ -54,6 +54,10 @@ using namespace std; #include "MEM_guardedalloc.h" #endif +#ifdef _WIN32 +#define stricmp _stricmp +#endif + class STR_String; typedef unsigned long dword; diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c index eb8872c43a5..cdb175ed661 100644 --- a/source/blender/blenkernel/intern/image.c +++ b/source/blender/blenkernel/intern/image.c @@ -38,6 +38,11 @@ #include +#ifdef _WIN32 +#define open _open +#define close _close +#endif + #include "MEM_guardedalloc.h" #include "IMB_imbuf_types.h" diff --git a/source/blender/blenkernel/intern/packedFile.c b/source/blender/blenkernel/intern/packedFile.c index 3e47c1006e5..bd0b1a5e36e 100644 --- a/source/blender/blenkernel/intern/packedFile.c +++ b/source/blender/blenkernel/intern/packedFile.c @@ -63,6 +63,14 @@ #include "BKE_packedFile.h" #include "BKE_report.h" +#ifdef _WIN32 +#define open _open +#define close _close +#define read _read +#define write _write +#endif + + int seekPackedFile(PackedFile *pf, int offset, int whence) { int oldseek = -1, seek = 0; diff --git a/source/blender/blenkernel/intern/pointcache.c b/source/blender/blenkernel/intern/pointcache.c index 3e429749953..912acc4786f 100644 --- a/source/blender/blenkernel/intern/pointcache.c +++ b/source/blender/blenkernel/intern/pointcache.c @@ -67,23 +67,13 @@ /* needed for directory lookup */ +/* untitled blend's need getpid for a unique name */ #ifndef WIN32 #include +#include #else - #include "BLI_winstuff.h" -#endif - -/* untitled blend's need getpid for a unique name */ -#ifdef WIN32 #include -#else -#include -#endif - -#ifdef _WIN32 -#ifndef snprintf -#define snprintf _snprintf -#endif + #include "BLI_winstuff.h" #endif static void ptcache_data_to(void **data, int type, int index, void *to); diff --git a/source/blender/blenkernel/intern/sound.c b/source/blender/blenkernel/intern/sound.c index 06ef8a23142..2d5d8dad7a8 100644 --- a/source/blender/blenkernel/intern/sound.c +++ b/source/blender/blenkernel/intern/sound.c @@ -250,12 +250,12 @@ void sound_free(struct bSound* sound) void sound_unlink(struct bContext *C, struct bSound* sound) { - bSound *snd; Scene *scene; SoundHandle *handle; // XXX unused currently #if 0 + bSound *snd; for(snd = CTX_data_main(C)->sound.first; snd; snd = snd->id.next) { if(snd->child_sound == sound) diff --git a/source/blender/blenlib/BLI_fileops.h b/source/blender/blenlib/BLI_fileops.h index d2dd40b21a5..0c1cdbc4d3a 100644 --- a/source/blender/blenlib/BLI_fileops.h +++ b/source/blender/blenlib/BLI_fileops.h @@ -36,8 +36,6 @@ #ifndef BLI_FILEOPS_H #define BLI_FILEOPS_H - - void BLI_recurdir_fileops(char *dirname); int BLI_link(char *file, char *to); int BLI_is_writable(char *filename); diff --git a/source/blender/blenlib/BLI_winstuff.h b/source/blender/blenlib/BLI_winstuff.h index fad45f1b6c3..b46ebebacd5 100644 --- a/source/blender/blenlib/BLI_winstuff.h +++ b/source/blender/blenlib/BLI_winstuff.h @@ -65,24 +65,7 @@ extern "C" { #endif -# ifndef _WIN64 - #ifndef M_PI - #define M_PI 3.14159265358979323846 - #endif - #ifndef M_PI_2 - #define M_PI_2 1.57079632679489661923 - #endif - #ifndef M_SQRT2 - #define M_SQRT2 1.41421356237309504880 - #endif - #ifndef M_SQRT1_2 - #define M_SQRT1_2 0.70710678118654752440 - #endif - #ifndef M_1_PI - #define M_1_PI 0.318309886183790671538 - #endif -#endif - +#define _USE_MATH_DEFINES #define MAXPATHLEN MAX_PATH #ifndef S_ISREG @@ -92,6 +75,18 @@ extern "C" { #define S_ISDIR(x) ((x&S_IFMT) == S_IFDIR) #endif +/* defines for using ISO C++ conformant names */ +#define open _open +#define close _close +#define write _write +#define read _read +#define getcwd _getcwd +#define chdir _chdir +#define strdup _strdup +#define lseek _lseek +#define getpid _getpid +#define snprintf _snprintf + #ifndef FREE_WINDOWS typedef unsigned int mode_t; #endif diff --git a/source/blender/blenlib/intern/bpath.c b/source/blender/blenlib/intern/bpath.c index 6c89afe7173..cadf8d2bdd1 100644 --- a/source/blender/blenlib/intern/bpath.c +++ b/source/blender/blenlib/intern/bpath.c @@ -26,6 +26,24 @@ * ***** END GPL LICENSE BLOCK ***** */ +#include +#include + +#include +#include +#include +#include +#include + +/* path/file handeling stuff */ +#ifndef WIN32 + #include + #include +#else + #include + #include "BLI_winstuff.h" +#endif + #include "MEM_guardedalloc.h" #include "DNA_ID.h" /* Library */ @@ -53,23 +71,7 @@ //XXX define below from BSE_sequence.h - otherwise potentially odd behaviour #define SEQ_HAS_PATH(seq) (seq->type==SEQ_MOVIE || seq->type==SEQ_IMAGE) -/* path/file handeling stuff */ -#ifndef WIN32 - #include - #include -#else - #include "BLI_winstuff.h" - #include -#endif -#include -#include - -#include -#include -#include -#include -#include #define FILE_MAX 240 diff --git a/source/blender/blenlib/intern/fileops.c b/source/blender/blenlib/intern/fileops.c index 0228032df01..e7dc9b0eb1f 100644 --- a/source/blender/blenlib/intern/fileops.c +++ b/source/blender/blenlib/intern/fileops.c @@ -31,27 +31,29 @@ #include #include +#include +#include +#include + +#include + #include "zlib.h" #ifdef WIN32 -#include "BLI_winstuff.h" #include +#include "BLI_winstuff.h" #else #include // for read close #include #endif + #include "BLI_blenlib.h" #include "BLI_storage.h" #include "BLI_fileops.h" #include "BLI_callbacks.h" -#include -#include -#include - #include "BKE_utildefines.h" -#include #include "BLO_sys_types.h" // for intptr_t support diff --git a/source/blender/blenlib/intern/storage.c b/source/blender/blenlib/intern/storage.c index 7cbef85b938..cdc5cec705f 100644 --- a/source/blender/blenlib/intern/storage.c +++ b/source/blender/blenlib/intern/storage.c @@ -33,13 +33,6 @@ #include #include -#ifdef WIN32 -#include "BLI_winstuff.h" -#include -#include -#include -#endif - #ifndef WIN32 #include #endif @@ -82,6 +75,14 @@ #include #endif +#ifdef WIN32 +#include +#include +#include +#include "BLI_winstuff.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 33641a0b004..1c21c1817e6 100644 --- a/source/blender/blenloader/intern/readblenentry.c +++ b/source/blender/blenloader/intern/readblenentry.c @@ -32,13 +32,14 @@ #include #endif -#include "BLI_storage.h" /* _LARGEFILE_SOURCE */ - #include #include #include #include + +#include "BLI_storage.h" /* _LARGEFILE_SOURCE */ + #include "MEM_guardedalloc.h" #include "BLI_blenlib.h" @@ -67,6 +68,10 @@ #include "BLO_sys_types.h" // needed for intptr_t +#ifdef _WIN32 +#include "BLI_winstuff.h" +#endif + /** * IDType stuff, I plan to move this * out into its own file + prefix, and diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 6a26a71ee3d..0c4835a79b7 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -29,11 +29,6 @@ #include "zlib.h" -#ifdef WIN32 -#include "winsock2.h" -#include "BLI_winstuff.h" -#endif - #include #include // for printf fopen fwrite fclose sprintf FILE #include // for getenv atoi @@ -46,6 +41,8 @@ #include // for MAXPATHLEN #else #include // for open close read +#include "winsock2.h" +#include "BLI_winstuff.h" #endif #include "DNA_anim_types.h" diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c index c4a94660932..a22e4f66c8d 100644 --- a/source/blender/blenloader/intern/writefile.c +++ b/source/blender/blenloader/intern/writefile.c @@ -72,23 +72,23 @@ Any case: direct data is ALWAYS after the lib block #include #endif +#include +#include +#include +#include +#include + #include "zlib.h" #ifndef WIN32 #include #else #include "winsock2.h" -#include "BLI_winstuff.h" #include #include // for getpid +#include "BLI_winstuff.h" #endif -#include -#include -#include -#include -#include - #include "DNA_anim_types.h" #include "DNA_armature_types.h" #include "DNA_action_types.h" diff --git a/source/blender/editors/armature/editarmature_generate.c b/source/blender/editors/armature/editarmature_generate.c index 6c0eab16af0..d327ed34839 100644 --- a/source/blender/editors/armature/editarmature_generate.c +++ b/source/blender/editors/armature/editarmature_generate.c @@ -30,6 +30,7 @@ #include #include +#include #include "MEM_guardedalloc.h" diff --git a/source/blender/editors/interface/interface_icons.c b/source/blender/editors/interface/interface_icons.c index 549164c23a1..6c4110c8c37 100644 --- a/source/blender/editors/interface/interface_icons.c +++ b/source/blender/editors/interface/interface_icons.c @@ -34,6 +34,7 @@ #else #include #include +#include "BLI_winstuff.h" #endif #include "MEM_guardedalloc.h" diff --git a/source/blender/editors/mesh/meshtools.c b/source/blender/editors/mesh/meshtools.c index 2ef1d3b214d..4aa99820a6e 100644 --- a/source/blender/editors/mesh/meshtools.c +++ b/source/blender/editors/mesh/meshtools.c @@ -34,6 +34,7 @@ #include #include #include +#include #include "MEM_guardedalloc.h" diff --git a/source/blender/editors/space_buttons/buttons_ops.c b/source/blender/editors/space_buttons/buttons_ops.c index 60480a9f165..1567f393d87 100644 --- a/source/blender/editors/space_buttons/buttons_ops.c +++ b/source/blender/editors/space_buttons/buttons_ops.c @@ -74,6 +74,7 @@ #include "ED_curve.h" #include "ED_mesh.h" +#include "ED_particle.h" #include "RNA_access.h" #include "RNA_define.h" diff --git a/source/blender/imbuf/intern/anim5.c b/source/blender/imbuf/intern/anim5.c index b6f29b6a145..4fe4217cd2c 100644 --- a/source/blender/imbuf/intern/anim5.c +++ b/source/blender/imbuf/intern/anim5.c @@ -31,6 +31,7 @@ #include "BLI_blenlib.h" /* BLI_remlink BLI_filesize BLI_addtail BLI_countlist BLI_stringdec */ + #include "imbuf.h" #include "imbuf_patch.h" @@ -46,6 +47,11 @@ #include "IMB_anim5.h" +#ifdef _WIN32 +#include +#include "BLI_winstuff.h" +#endif + typedef struct Anhd{ unsigned char type, mask; unsigned short w, h; diff --git a/source/blender/imbuf/intern/hamx.c b/source/blender/imbuf/intern/hamx.c index 2f32d155407..258c196fcdf 100644 --- a/source/blender/imbuf/intern/hamx.c +++ b/source/blender/imbuf/intern/hamx.c @@ -31,11 +31,6 @@ #include "BLI_blenlib.h" -#ifdef WIN32 -#include -#endif - - #include "imbuf.h" #include "imbuf_patch.h" #include "IMB_imbuf_types.h" @@ -46,6 +41,11 @@ #include "IMB_ham.h" #include "IMB_hamx.h" +#ifdef WIN32 +#include +#include "BLI_winstuff.h" +#endif + /* actually hard coded endianness */ #define GET_BIG_LONG(x) (((uchar *) (x))[0] << 24 | ((uchar *) (x))[1] << 16 | ((uchar *) (x))[2] << 8 | ((uchar *) (x))[3]) #define GET_LITTLE_LONG(x) (((uchar *) (x))[3] << 24 | ((uchar *) (x))[2] << 16 | ((uchar *) (x))[1] << 8 | ((uchar *) (x))[0]) diff --git a/source/blender/imbuf/intern/iff.c b/source/blender/imbuf/intern/iff.c index c3695173068..5fd823e78c1 100644 --- a/source/blender/imbuf/intern/iff.c +++ b/source/blender/imbuf/intern/iff.c @@ -29,14 +29,15 @@ * $Id$ */ -#ifdef WIN32 -#include -#endif #include "BLI_blenlib.h" #include "imbuf.h" #include "imbuf_patch.h" #include "IMB_imbuf_types.h" #include "IMB_iff.h" +#ifdef WIN32 +#include +#include "BLI_winstuff.h" +#endif unsigned short imb_start_iff(struct ImBuf *ibuf, int file) { diff --git a/source/blender/imbuf/intern/thumbs.c b/source/blender/imbuf/intern/thumbs.c index 86ca43824f3..6053c5556f1 100644 --- a/source/blender/imbuf/intern/thumbs.c +++ b/source/blender/imbuf/intern/thumbs.c @@ -39,31 +39,29 @@ #include "IMB_thumbs.h" #include "IMB_imginfo.h" - #include "md5.h" +#include +#include +#include +#include +#include +#include +#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 "BLI_winstuff.h" #include /* getpid */ #include /* chdir */ +#include "BLI_winstuff.h" #else #include #endif -#include -#include -#include -#include -#include -#include -#include -#include - #define URI_MAX FILE_MAX*3 + 8 static int get_thumb_dir( char* dir , ThumbSize size) diff --git a/source/blender/imbuf/intern/writeimage.c b/source/blender/imbuf/intern/writeimage.c index 7e1120bf3e4..b3af727190a 100644 --- a/source/blender/imbuf/intern/writeimage.c +++ b/source/blender/imbuf/intern/writeimage.c @@ -29,10 +29,6 @@ * $Id$ */ -#ifdef WIN32 -#include -#endif - #include #include "BKE_global.h" @@ -71,6 +67,10 @@ #include "IMB_bitplanes.h" #include "IMB_divers.h" +#ifdef WIN32 +#include +#include "BLI_winstuff.h" +#endif /* added facility to copy with saving non-float rects */ short IMB_saveiff(struct ImBuf *ibuf, char *name, int flags) diff --git a/source/blender/python/intern/bpy_interface.c b/source/blender/python/intern/bpy_interface.c index a935b517f77..a85bcd011a6 100644 --- a/source/blender/python/intern/bpy_interface.c +++ b/source/blender/python/intern/bpy_interface.c @@ -28,11 +28,6 @@ #include #include -#ifndef WIN32 -#include -#else -#include "BLI_winstuff.h" -#endif /* grr, python redefines */ #ifdef _POSIX_C_SOURCE @@ -48,6 +43,12 @@ #include "bpy_ui.h" #include "bpy_util.h" +#ifndef WIN32 +#include +#else +#include "BLI_winstuff.h" +#endif + #include "DNA_anim_types.h" #include "DNA_space_types.h" #include "DNA_text_types.h" diff --git a/source/blender/readblenfile/intern/BLO_readblenfile.c b/source/blender/readblenfile/intern/BLO_readblenfile.c index 40a991ad702..5672b9f4cb2 100644 --- a/source/blender/readblenfile/intern/BLO_readblenfile.c +++ b/source/blender/readblenfile/intern/BLO_readblenfile.c @@ -43,6 +43,7 @@ #ifdef WIN32 #include // read, open +#include "BLI_winstuff.h" #else // ! WIN32 #include // read #endif diff --git a/source/blender/windowmanager/intern/wm_files.c b/source/blender/windowmanager/intern/wm_files.c index 3921da4f062..a6e38a61e0f 100644 --- a/source/blender/windowmanager/intern/wm_files.c +++ b/source/blender/windowmanager/intern/wm_files.c @@ -37,8 +37,8 @@ #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 /* getpid */ +#include "BLI_winstuff.h" #else #include /* getpid */ #endif diff --git a/source/gameengine/Converter/KX_ConvertProperties.cpp b/source/gameengine/Converter/KX_ConvertProperties.cpp index 5e8d6f3cbf0..1c22d2a0600 100644 --- a/source/gameengine/Converter/KX_ConvertProperties.cpp +++ b/source/gameengine/Converter/KX_ConvertProperties.cpp @@ -32,26 +32,26 @@ #include #endif -/* This little block needed for linking to Blender... */ -#ifdef WIN32 -#include "BLI_winstuff.h" -#endif #include "DNA_object_types.h" #include "DNA_property_types.h" /* end of blender include block */ + #include "Value.h" #include "VectorValue.h" #include "BoolValue.h" #include "StringValue.h" #include "FloatValue.h" #include "KX_GameObject.h" -//#include "ListValue.h" #include "IntValue.h" #include "SCA_TimeEventManager.h" #include "SCA_IScene.h" +/* This little block needed for linking to Blender... */ +#ifdef WIN32 +#include "BLI_winstuff.h" +#endif void BL_ConvertProperties(Object* object,KX_GameObject* gameobj,SCA_TimeEventManager* timemgr,SCA_IScene* scene, bool isInActiveLayer) { diff --git a/source/gameengine/Ketsji/KX_PythonInit.cpp b/source/gameengine/Ketsji/KX_PythonInit.cpp index 9e81bcb3871..298d485aaaf 100644 --- a/source/gameengine/Ketsji/KX_PythonInit.cpp +++ b/source/gameengine/Ketsji/KX_PythonInit.cpp @@ -32,11 +32,6 @@ // directory header for py function getBlendFileList #include -#ifndef WIN32 - #include -#else - #include "BLI_winstuff.h" -#endif #ifdef WIN32 #pragma warning (disable : 4786) @@ -80,8 +75,6 @@ extern "C" { #include "InputParser.h" #include "KX_Scene.h" -#include "NG_NetworkScene.h" //Needed for sendMessage() - #include "BL_Shader.h" #include "KX_PyMath.h" @@ -111,6 +104,13 @@ extern "C" { #include "BLI_blenlib.h" #include "GPU_material.h" +#ifndef WIN32 + #include +#else + #include "BLI_winstuff.h" +#endif +#include "NG_NetworkScene.h" //Needed for sendMessage() + static void setSandbox(TPythonSecurityLevel level); // 'local' copy of canvas ptr, for window height/width python scripts diff --git a/source/gameengine/VideoTexture/SConscript b/source/gameengine/VideoTexture/SConscript index 0d3e495f3e2..119bd1c9954 100644 --- a/source/gameengine/VideoTexture/SConscript +++ b/source/gameengine/VideoTexture/SConscript @@ -25,6 +25,5 @@ incs += ' ' + env['BF_PYTHON_INC'] if env['WITH_BF_FFMPEG']: defs.append('WITH_FFMPEG') incs += ' ' + env['BF_FFMPEG_INC'] + ' ' + env['BF_PTHREADS_INC'] - defs.append('__STDC_CONSTANT_MACROS') env.BlenderLib ( 'bf_videotex', sources, Split(incs), defs, libtype=['core','player'], priority=[300,205], cxx_compileflags=env['BGE_CXXFLAGS']) -- cgit v1.2.3