From bd869071812dfec00de7393a9924901919ef0550 Mon Sep 17 00:00:00 2001 From: rdb Date: Sun, 8 Feb 2015 20:21:14 +0100 Subject: [PATCH] Fix assortment of compilation issues and annoyances --- dtool/src/dtoolbase/atomicAdjustWin32Impl.h | 5 +- dtool/src/dtoolbase/dlmalloc.h | 7 +- dtool/src/dtoolbase/dlmalloc_src.cxx | 10 +- dtool/src/dtoolbase/memoryHook.cxx | 4 +- dtool/src/dtoolbase/mutexWin32Impl.h | 4 +- dtool/src/dtoolbase/ptmalloc2_smp_src.cxx | 4 +- dtool/src/dtoolutil/pandaFileStreamBuf.h | 4 +- dtool/src/dtoolutil/pfstreamBuf.h | 4 +- makepanda/makepanda.py | 4 + panda/src/display/graphicsWindowProc.h | 8 +- .../src/display/pythonGraphicsWindowProc.cxx | 4 + panda/src/display/pythonGraphicsWindowProc.h | 16 +- panda/src/dxgsg9/dxgsg9base.h | 4 +- panda/src/express/dcast.cxx | 5 +- panda/src/express/trueClock.cxx | 4 +- panda/src/express/windowsRegistry.cxx | 4 +- panda/src/glstuff/glCgShaderContext_src.cxx | 138 +++++++++++++----- panda/src/gobj/vertexDataSaveFile.h | 4 +- panda/src/movies/microphoneAudioDS.cxx | 42 +++--- .../nativenet/buffered_datagramconnection.h | 6 +- panda/src/ode/odeTriMeshData.h | 20 +-- panda/src/pipeline/threadDummyImpl.h | 4 +- panda/src/pipeline/threadSimpleManager.h | 4 +- panda/src/pnmimagetypes/pnmFileTypeJPG.h | 4 +- panda/src/pnmimagetypes/pnmFileTypePNM.cxx | 67 ++++----- panda/src/pnmimagetypes/pnmFileTypeTIFF.cxx | 4 +- panda/src/rocket/rocketInputHandler.cxx | 9 ++ panda/src/rocket/rocketSystemInterface.cxx | 4 + panda/src/vision/webcamVideoDS.cxx | 4 +- panda/src/wgldisplay/wglGraphicsBuffer.h | 4 +- panda/src/windisplay/winDetectDx9.cxx | 4 +- panda/src/windisplay/winGraphicsPipe.cxx | 19 ++- panda/src/x11display/x11GraphicsWindow.cxx | 1 + 33 files changed, 286 insertions(+), 143 deletions(-) diff --git a/dtool/src/dtoolbase/atomicAdjustWin32Impl.h b/dtool/src/dtoolbase/atomicAdjustWin32Impl.h index a7844da3f0..2ead06d0fe 100644 --- a/dtool/src/dtoolbase/atomicAdjustWin32Impl.h +++ b/dtool/src/dtoolbase/atomicAdjustWin32Impl.h @@ -21,7 +21,10 @@ #ifdef WIN32_VC #include "numeric_types.h" -#define WIN32_LEAN_AND_MEAN + +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN 1 +#endif #include //////////////////////////////////////////////////////////////////// diff --git a/dtool/src/dtoolbase/dlmalloc.h b/dtool/src/dtoolbase/dlmalloc.h index 1bb3ed8abc..c79fb95e76 100644 --- a/dtool/src/dtoolbase/dlmalloc.h +++ b/dtool/src/dtoolbase/dlmalloc.h @@ -148,10 +148,15 @@ void* dlvalloc(size_t); */ int dlmallopt(int, int); +#ifndef M_TRIM_THRESHOLD #define M_TRIM_THRESHOLD (-1) +#endif +#ifndef M_GRANULARITY #define M_GRANULARITY (-2) +#endif +#ifndef M_MMAP_THRESHOLD #define M_MMAP_THRESHOLD (-3) - +#endif /* malloc_footprint(); diff --git a/dtool/src/dtoolbase/dlmalloc_src.cxx b/dtool/src/dtoolbase/dlmalloc_src.cxx index 93e843ea75..4e21f4c914 100644 --- a/dtool/src/dtoolbase/dlmalloc_src.cxx +++ b/dtool/src/dtoolbase/dlmalloc_src.cxx @@ -462,7 +462,9 @@ DEFAULT_MMAP_THRESHOLD default: 256K #endif /* _WIN32 */ #endif /* WIN32 */ #ifdef WIN32 -#define WIN32_LEAN_AND_MEAN +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN 1 +#endif #include #define HAVE_MMAP 1 #define HAVE_MORECORE 0 @@ -597,9 +599,15 @@ DEFAULT_MMAP_THRESHOLD default: 256K malloc does support the following options. */ +#ifndef M_TRIM_THRESHOLD #define M_TRIM_THRESHOLD (-1) +#endif +#ifndef M_GRANULARITY #define M_GRANULARITY (-2) +#endif +#ifndef M_MMAP_THRESHOLD #define M_MMAP_THRESHOLD (-3) +#endif /* ------------------------ Mallinfo declarations ------------------------ */ diff --git a/dtool/src/dtoolbase/memoryHook.cxx b/dtool/src/dtoolbase/memoryHook.cxx index 567097e213..b132ed5754 100644 --- a/dtool/src/dtoolbase/memoryHook.cxx +++ b/dtool/src/dtoolbase/memoryHook.cxx @@ -19,7 +19,9 @@ #ifdef WIN32 // Windows case. -#define WIN32_LEAN_AND_MEAN +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN 1 +#endif #include #else diff --git a/dtool/src/dtoolbase/mutexWin32Impl.h b/dtool/src/dtoolbase/mutexWin32Impl.h index 5513d120a8..1c66583a9c 100644 --- a/dtool/src/dtoolbase/mutexWin32Impl.h +++ b/dtool/src/dtoolbase/mutexWin32Impl.h @@ -19,7 +19,9 @@ #include "selectThreadImpl.h" #ifdef WIN32_VC -#define WIN32_LEAN_AND_MEAN +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN 1 +#endif #include //////////////////////////////////////////////////////////////////// diff --git a/dtool/src/dtoolbase/ptmalloc2_smp_src.cxx b/dtool/src/dtoolbase/ptmalloc2_smp_src.cxx index 1de71ccb98..7ecfde41f1 100644 --- a/dtool/src/dtoolbase/ptmalloc2_smp_src.cxx +++ b/dtool/src/dtoolbase/ptmalloc2_smp_src.cxx @@ -482,7 +482,9 @@ int tsd_key_next; #elif defined(WIN32) /* Win32 emulation */ -#define WIN32_LEAN_AND_MEAN +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN 1 +#endif #define _WIN32_WINNT 0x600 #include diff --git a/dtool/src/dtoolutil/pandaFileStreamBuf.h b/dtool/src/dtoolutil/pandaFileStreamBuf.h index 4421251afd..0561c3bcba 100644 --- a/dtool/src/dtoolutil/pandaFileStreamBuf.h +++ b/dtool/src/dtoolutil/pandaFileStreamBuf.h @@ -20,7 +20,9 @@ #ifdef USE_PANDAFILESTREAM #if defined(_WIN32) -#define WIN32_LEAN_AND_MEAN +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN 1 +#endif #include #endif diff --git a/dtool/src/dtoolutil/pfstreamBuf.h b/dtool/src/dtoolutil/pfstreamBuf.h index 02243f0af6..5e35723997 100644 --- a/dtool/src/dtoolutil/pfstreamBuf.h +++ b/dtool/src/dtoolutil/pfstreamBuf.h @@ -28,7 +28,9 @@ #endif #ifdef WIN_PIPE_CALLS -#define WIN32_LEAN_AND_MEAN +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN 1 +#endif #include #else // WIN_PIPE_CALLS diff --git a/makepanda/makepanda.py b/makepanda/makepanda.py index ddb29a8c93..66efcad0aa 100755 --- a/makepanda/makepanda.py +++ b/makepanda/makepanda.py @@ -1518,6 +1518,10 @@ def CompileLink(dll, obj, opts): else: cmd = cxx + ' -shared' if ("MODULE" not in opts): cmd += " -Wl,-soname=" + os.path.basename(dll) + if GetOrigExt(dll) == ".pyd" and not os.path.basename(dll).startswith('core'): + # Tell the other libraries where to find core.so. + # Not sure if this is the best way to do that, but it works. + cmd += " -Wl,-rpath '-Wl,$ORIGIN'" cmd += ' -o ' + dll + ' -L' + GetOutputDir() + '/lib -L' + GetOutputDir() + '/tmp' for x in obj: diff --git a/panda/src/display/graphicsWindowProc.h b/panda/src/display/graphicsWindowProc.h index 88df028bfd..a5458a0113 100644 --- a/panda/src/display/graphicsWindowProc.h +++ b/panda/src/display/graphicsWindowProc.h @@ -12,7 +12,6 @@ // //////////////////////////////////////////////////////////////////// - #ifndef GRAPHICSWINDOWPROC_H #define GRAPHICSWINDOWPROC_H @@ -25,6 +24,8 @@ #include #endif +class GraphicsWindow; + //////////////////////////////////////////////////////////////////// // Class : GraphicsWindowProc // Description : Defines an interface for storing platform-specific @@ -34,9 +35,10 @@ class GraphicsWindowProc{ public: GraphicsWindowProc(); #if defined(__WIN32__) || defined(_WIN32) - virtual LONG wnd_proc(GraphicsWindow* graphicsWindow, HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam); + virtual LONG wnd_proc(GraphicsWindow* graphicsWindow, HWND hwnd, + UINT msg, WPARAM wparam, LPARAM lparam); #endif //purely virtual class }; -#endif //GRAPHICSWINDOWPROC_H +#endif // GRAPHICSWINDOWPROC_H diff --git a/panda/src/display/pythonGraphicsWindowProc.cxx b/panda/src/display/pythonGraphicsWindowProc.cxx index 0037641a50..4e829d5c59 100644 --- a/panda/src/display/pythonGraphicsWindowProc.cxx +++ b/panda/src/display/pythonGraphicsWindowProc.cxx @@ -15,6 +15,8 @@ #include "pythonGraphicsWindowProc.h" #include "graphicsWindowProcCallbackData.h" +#ifdef HAVE_PYTHON + TypeHandle PythonGraphicsWindowProc::_type_handle; //////////////////////////////////////////////////////////////////// @@ -72,3 +74,5 @@ PyObject* PythonGraphicsWindowProc:: get_name(){ return _name; } + +#endif // HAVE_PYTHON diff --git a/panda/src/display/pythonGraphicsWindowProc.h b/panda/src/display/pythonGraphicsWindowProc.h index 6ce1c7c5be..5160ca6372 100644 --- a/panda/src/display/pythonGraphicsWindowProc.h +++ b/panda/src/display/pythonGraphicsWindowProc.h @@ -19,25 +19,29 @@ #include "graphicsWindowProc.h" #include "pythonCallbackObject.h" +#ifdef HAVE_PYTHON + //////////////////////////////////////////////////////////////////// // Class : PythonGraphicsWindowProc // Description : Extends GraphicsWindowProc to provde callback functionality // to a python program. //////////////////////////////////////////////////////////////////// -class PythonGraphicsWindowProc: public GraphicsWindowProc, public PythonCallbackObject{ +class PythonGraphicsWindowProc: public GraphicsWindowProc, + public PythonCallbackObject { public: PythonGraphicsWindowProc(PyObject *function, PyObject* name); virtual ~PythonGraphicsWindowProc(); ALLOC_DELETED_CHAIN(PythonGraphicsWindowProc); #ifdef WIN32 - virtual LONG wnd_proc(GraphicsWindow* graphicsWindow, HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam); + virtual LONG wnd_proc(GraphicsWindow* graphicsWindow, HWND hwnd, + UINT msg, WPARAM wparam, LPARAM lparam); #endif - PyObject* get_name(); + PyObject *get_name(); private: - PyObject* _name; + PyObject *_name; public: static TypeHandle get_class_type() { @@ -57,4 +61,6 @@ private: static TypeHandle _type_handle; }; -#endif //PYTHONGRAPHICSWINDOWPROC_H +#endif // HAVE_PYTHON + +#endif // PYTHONGRAPHICSWINDOWPROC_H diff --git a/panda/src/dxgsg9/dxgsg9base.h b/panda/src/dxgsg9/dxgsg9base.h index a31730b47e..9c00e41816 100755 --- a/panda/src/dxgsg9/dxgsg9base.h +++ b/panda/src/dxgsg9/dxgsg9base.h @@ -19,7 +19,9 @@ #include "graphicsWindow.h" #include "pmap.h" -#define WIN32_LEAN_AND_MEAN // get rid of mfc win32 hdr stuff +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN 1 // get rid of mfc win32 hdr stuff +#endif #ifndef STRICT // enable strict type checking in windows.h, see msdn #define STRICT diff --git a/panda/src/express/dcast.cxx b/panda/src/express/dcast.cxx index ecdedb6506..34517ff28c 100644 --- a/panda/src/express/dcast.cxx +++ b/panda/src/express/dcast.cxx @@ -16,11 +16,12 @@ #include "config_express.h" #ifdef _WIN32 -#define WIN32_LEAN_AND_MEAN +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN 1 +#endif #include // for IsBadWritePtr() #endif - #ifdef DO_DCAST //////////////////////////////////////////////////////////////////// // Function: _dcast_verify diff --git a/panda/src/express/trueClock.cxx b/panda/src/express/trueClock.cxx index e6d9a73125..aeb2a28e56 100644 --- a/panda/src/express/trueClock.cxx +++ b/panda/src/express/trueClock.cxx @@ -30,7 +30,9 @@ TrueClock *TrueClock::_global_ptr = NULL; //////////////////////////////////////////////////////////////////// #include -#define WIN32_LEAN_AND_MEAN +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN 1 +#endif #include static const double _0001 = 1.0 / 1000.0; diff --git a/panda/src/express/windowsRegistry.cxx b/panda/src/express/windowsRegistry.cxx index f186476dd1..60865ddfad 100755 --- a/panda/src/express/windowsRegistry.cxx +++ b/panda/src/express/windowsRegistry.cxx @@ -17,7 +17,9 @@ #include "textEncoder.h" #if defined(WIN32_VC) -#define WIN32_LEAN_AND_MEAN +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN 1 +#endif #include //////////////////////////////////////////////////////////////////// diff --git a/panda/src/glstuff/glCgShaderContext_src.cxx b/panda/src/glstuff/glCgShaderContext_src.cxx index cb7d50678e..85b18b6f9d 100755 --- a/panda/src/glstuff/glCgShaderContext_src.cxx +++ b/panda/src/glstuff/glCgShaderContext_src.cxx @@ -215,72 +215,132 @@ issue_parameters(int altered) { switch (ptr_data->_type) { case Shader::SPT_float: switch(_ptr._info._class) { - case Shader::SAC_scalar: cgSetParameter1fv(p,(float*)ptr_data->_ptr); continue; + case Shader::SAC_scalar: + cgSetParameter1fv(p, (float*)ptr_data->_ptr); + continue; + case Shader::SAC_vector: switch (_ptr._info._type) { - case Shader::SAT_vec1: cgSetParameter1fv(p,(float*)ptr_data->_ptr); continue; - case Shader::SAT_vec2: cgSetParameter2fv(p,(float*)ptr_data->_ptr); continue; - case Shader::SAT_vec3: cgSetParameter3fv(p,(float*)ptr_data->_ptr); continue; - case Shader::SAT_vec4: cgSetParameter4fv(p,(float*)ptr_data->_ptr); continue; - default: nassertd(false) continue; + case Shader::SAT_vec1: + cgSetParameter1fv(p, (float*)ptr_data->_ptr); + continue; + case Shader::SAT_vec2: + cgSetParameter2fv(p, (float*)ptr_data->_ptr); + continue; + case Shader::SAT_vec3: + cgSetParameter3fv(p, (float*)ptr_data->_ptr); + continue; + case Shader::SAT_vec4: + cgSetParameter4fv(p, (float*)ptr_data->_ptr); + continue; + default: + nassertd(false) continue; } - case Shader::SAC_matrix: cgGLSetMatrixParameterfc(p,(float*)ptr_data->_ptr); continue; - case Shader::SAC_array: { + continue; + + case Shader::SAC_matrix: + cgGLSetMatrixParameterfc(p, (float*)ptr_data->_ptr); + continue; + + case Shader::SAC_array: switch (_ptr._info._subclass) { case Shader::SAC_scalar: - cgGLSetParameterArray1f(p,0,_ptr._dim[0],(float*)ptr_data->_ptr); continue; + cgGLSetParameterArray1f(p, 0, _ptr._dim[0], (float*)ptr_data->_ptr); + continue; case Shader::SAC_vector: switch (_ptr._dim[2]) { - case 1: cgGLSetParameterArray1f(p,0,_ptr._dim[0],(float*)ptr_data->_ptr); continue; - case 2: cgGLSetParameterArray2f(p,0,_ptr._dim[0],(float*)ptr_data->_ptr); continue; - case 3: cgGLSetParameterArray3f(p,0,_ptr._dim[0],(float*)ptr_data->_ptr); continue; - case 4: cgGLSetParameterArray4f(p,0,_ptr._dim[0],(float*)ptr_data->_ptr); continue; + case 1: cgGLSetParameterArray1f(p, 0, _ptr._dim[0], (float*)ptr_data->_ptr); continue; + case 2: cgGLSetParameterArray2f(p, 0, _ptr._dim[0], (float*)ptr_data->_ptr); continue; + case 3: cgGLSetParameterArray3f(p, 0, _ptr._dim[0], (float*)ptr_data->_ptr); continue; + case 4: cgGLSetParameterArray4f(p, 0, _ptr._dim[0], (float*)ptr_data->_ptr); continue; + default: + nassertd(_ptr._dim[2] > 0 && _ptr._dim[2] <= 4) continue; } + continue; case Shader::SAC_matrix: - cgGLSetMatrixParameterArrayfc(p,0,_ptr._dim[0],(float*)ptr_data->_ptr); continue; + cgGLSetMatrixParameterArrayfc(p, 0, _ptr._dim[0], (float*)ptr_data->_ptr); + continue; + default: + nassertd(false) continue; } + default: + nassertd(false) continue; } - } + case Shader::SPT_double: switch(_ptr._info._class) { - case Shader::SAC_scalar: cgSetParameter1dv(p,(double*)ptr_data->_ptr); continue; + case Shader::SAC_scalar: + cgSetParameter1dv(p, (double*)ptr_data->_ptr); + continue; + case Shader::SAC_vector: - switch(_ptr._info._type) { - case Shader::SAT_vec1: cgSetParameter1dv(p,(double*)ptr_data->_ptr); continue; - case Shader::SAT_vec2: cgSetParameter2dv(p,(double*)ptr_data->_ptr); continue; - case Shader::SAT_vec3: cgSetParameter3dv(p,(double*)ptr_data->_ptr); continue; - case Shader::SAT_vec4: cgSetParameter4dv(p,(double*)ptr_data->_ptr); continue; - default: nassertd(false) continue; + switch (_ptr._info._type) { + case Shader::SAT_vec1: + cgSetParameter1dv(p, (double*)ptr_data->_ptr); + continue; + case Shader::SAT_vec2: + cgSetParameter2dv(p, (double*)ptr_data->_ptr); + continue; + case Shader::SAT_vec3: + cgSetParameter3dv(p, (double*)ptr_data->_ptr); + continue; + case Shader::SAT_vec4: + cgSetParameter4dv(p, (double*)ptr_data->_ptr); + continue; + default: + nassertd(false) continue; } - case Shader::SAC_matrix: cgGLSetMatrixParameterdc(p,(double*)ptr_data->_ptr); continue; - case Shader::SAC_array: { - switch(_ptr._info._subclass) { + continue; + + case Shader::SAC_matrix: + cgGLSetMatrixParameterdc(p, (double*)ptr_data->_ptr); + continue; + + case Shader::SAC_array: + switch (_ptr._info._subclass) { case Shader::SAC_scalar: - cgGLSetParameterArray1d(p,0,_ptr._dim[0],(double*)ptr_data->_ptr); continue; + cgGLSetParameterArray1d(p, 0, _ptr._dim[0], (double*)ptr_data->_ptr); + continue; case Shader::SAC_vector: - switch(_ptr._dim[2]) { - case 1: cgGLSetParameterArray1d(p,0,_ptr._dim[0],(double*)ptr_data->_ptr); continue; - case 2: cgGLSetParameterArray2d(p,0,_ptr._dim[0],(double*)ptr_data->_ptr); continue; - case 3: cgGLSetParameterArray3d(p,0,_ptr._dim[0],(double*)ptr_data->_ptr); continue; - case 4: cgGLSetParameterArray4d(p,0,_ptr._dim[0],(double*)ptr_data->_ptr); continue; + switch (_ptr._dim[2]) { + case 1: cgGLSetParameterArray1d(p, 0, _ptr._dim[0], (double*)ptr_data->_ptr); continue; + case 2: cgGLSetParameterArray2d(p, 0, _ptr._dim[0], (double*)ptr_data->_ptr); continue; + case 3: cgGLSetParameterArray3d(p, 0, _ptr._dim[0], (double*)ptr_data->_ptr); continue; + case 4: cgGLSetParameterArray4d(p, 0, _ptr._dim[0], (double*)ptr_data->_ptr); continue; + default: + nassertd(_ptr._dim[2] > 0 && _ptr._dim[2] <= 4) continue; } + continue; case Shader::SAC_matrix: - cgGLSetMatrixParameterArraydc(p,0,_ptr._dim[0],(double*)ptr_data->_ptr); continue; + cgGLSetMatrixParameterArraydc(p, 0, _ptr._dim[0], (double*)ptr_data->_ptr); + continue; + default: + nassertd(false) continue; } + default: + nassertd(false) continue; } - } + continue; + case Shader::SPT_int: switch(_ptr._info._class) { - case Shader::SAC_scalar: cgSetParameter1iv(p,(int*)ptr_data->_ptr); continue; + case Shader::SAC_scalar: + cgSetParameter1iv(p, (int*)ptr_data->_ptr); + continue; case Shader::SAC_vector: switch(_ptr._info._type) { - case Shader::SAT_vec1: cgSetParameter1iv(p,(int*)ptr_data->_ptr); continue; - case Shader::SAT_vec2: cgSetParameter2iv(p,(int*)ptr_data->_ptr); continue; - case Shader::SAT_vec3: cgSetParameter3iv(p,(int*)ptr_data->_ptr); continue; - case Shader::SAT_vec4: cgSetParameter4iv(p,(int*)ptr_data->_ptr); continue; + case Shader::SAT_vec1: cgSetParameter1iv(p, (int*)ptr_data->_ptr); continue; + case Shader::SAT_vec2: cgSetParameter2iv(p, (int*)ptr_data->_ptr); continue; + case Shader::SAT_vec3: cgSetParameter3iv(p, (int*)ptr_data->_ptr); continue; + case Shader::SAT_vec4: cgSetParameter4iv(p, (int*)ptr_data->_ptr); continue; + default: + nassertd(false) continue; } + default: + nassertd(false) continue; } - default: GLCAT.error() << _ptr._id._name << ":" << "unrecognized parameter type\n"; + default: + GLCAT.error() << _ptr._id._name << ":" << "unrecognized parameter type\n"; release_resources(); return; } diff --git a/panda/src/gobj/vertexDataSaveFile.h b/panda/src/gobj/vertexDataSaveFile.h index 948d8a7ba8..be943ff179 100644 --- a/panda/src/gobj/vertexDataSaveFile.h +++ b/panda/src/gobj/vertexDataSaveFile.h @@ -21,7 +21,9 @@ #include "pmutex.h" #if defined(_WIN32) -#define WIN32_LEAN_AND_MEAN +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN 1 +#endif #include #endif diff --git a/panda/src/movies/microphoneAudioDS.cxx b/panda/src/movies/microphoneAudioDS.cxx index be8a55b658..7215e29365 100644 --- a/panda/src/movies/microphoneAudioDS.cxx +++ b/panda/src/movies/microphoneAudioDS.cxx @@ -22,7 +22,9 @@ #ifdef HAVE_DIRECTCAM -#define WIN32_LEAN_AND_MEAN +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN 1 +#endif #undef Configure @@ -33,9 +35,7 @@ // Class : MicrophoneAudioDS // Description : The directshow implementation of microphones. //////////////////////////////////////////////////////////////////// - -class MicrophoneAudioDS : public MicrophoneAudio -{ +class MicrophoneAudioDS : public MicrophoneAudio { public: static void find_all_microphones_ds(); friend void find_all_microphones_ds(); @@ -56,7 +56,7 @@ private: typedef pvector AudioBuffers; static void delete_buffers(AudioBuffers &buffers); - + friend class MicrophoneAudioCursorDS; public: @@ -90,7 +90,7 @@ public: typedef MicrophoneAudioDS::AudioBuffers AudioBuffers; MicrophoneAudioCursorDS(MicrophoneAudioDS *src, AudioBuffers &bufs, HWAVEIN hwav); virtual ~MicrophoneAudioCursorDS(); - + AudioBuffers _buffers; HWAVEIN _hwavein; int _samples_per_buffer; @@ -105,7 +105,7 @@ public: HWAVEIN _handle; int _next; // Which buffer is the next one to read from. int _offset; // How many samples to skip in the buffer. - + public: static TypeHandle get_class_type() { return _type_handle; @@ -129,7 +129,7 @@ TypeHandle MicrophoneAudioCursorDS::_type_handle; //////////////////////////////////////////////////////////////////// // Function: MicrophoneAudioDS::find_all_microphones_ds // Access: Public, Static -// Description: Finds all DirectShow microphones and adds them to +// Description: Finds all DirectShow microphones and adds them to // the global list _all_microphones. //////////////////////////////////////////////////////////////////// void MicrophoneAudioDS:: @@ -205,7 +205,7 @@ delete_buffers(AudioBuffers &buffers) { //////////////////////////////////////////////////////////////////// PT(MovieAudioCursor) MicrophoneAudioDS:: open() { - + // Allocate the buffers. 64 buffers, not quite 1/20 sec each. int samples; switch (_rate) { @@ -248,7 +248,7 @@ open() { nassert_raise("Could not allocate audio input buffers."); return NULL; } - + WAVEFORMATEX format; format.wFormatTag = WAVE_FORMAT_PCM; format.nChannels = _channels; @@ -260,7 +260,7 @@ open() { HWAVEIN hwav; MMRESULT stat = waveInOpen(&hwav, _device_id, &format, NULL, NULL, CALLBACK_NULL); - + if (stat != MMSYSERR_NOERROR) { delete_buffers(buffers); nassert_raise("Could not open audio input device."); @@ -284,7 +284,7 @@ open() { waveInClose(hwav); delete_buffers(buffers); nassert_raise("Could not start recording on input device."); - return NULL; + return NULL; } return new MicrophoneAudioCursorDS(this, buffers, hwav); } @@ -292,7 +292,7 @@ open() { //////////////////////////////////////////////////////////////////// // Function: MicrophoneAudioCursorDS::Constructor // Access: Published -// Description: +// Description: //////////////////////////////////////////////////////////////////// MicrophoneAudioCursorDS:: MicrophoneAudioCursorDS(MicrophoneAudioDS *src, AudioBuffers &bufs, HWAVEIN hwav) : @@ -314,7 +314,7 @@ MicrophoneAudioCursorDS(MicrophoneAudioDS *src, AudioBuffers &bufs, HWAVEIN hwav //////////////////////////////////////////////////////////////////// // Function: MicrophoneAudioCursorDS::cleanup // Access: Published -// Description: +// Description: //////////////////////////////////////////////////////////////////// void MicrophoneAudioCursorDS:: cleanup() { @@ -330,7 +330,7 @@ cleanup() { //////////////////////////////////////////////////////////////////// // Function: MicrophoneAudioCursorDS::Destructor // Access: Published -// Description: +// Description: //////////////////////////////////////////////////////////////////// MicrophoneAudioCursorDS:: ~MicrophoneAudioCursorDS() { @@ -340,7 +340,7 @@ MicrophoneAudioCursorDS:: //////////////////////////////////////////////////////////////////// // Function: MicrophoneAudioCursorDS::read_samples // Access: Published -// Description: +// Description: //////////////////////////////////////////////////////////////////// void MicrophoneAudioCursorDS:: read_samples(int n, PN_int16 *data) { @@ -351,19 +351,19 @@ read_samples(int n, PN_int16 *data) { if ((_buffers[index]._header->dwFlags & WHDR_DONE)==0) { break; } - + // Find start of data in buffer. PN_int16 *src = (PN_int16*)(_buffers[index]._storage); src += (_offset * _audio_channels); - + // Decide how many samples to extract from this buffer. int samples = _samples_per_buffer; samples -= _offset; if (samples > n) samples = n; - + // Copy data to output buffer. memcpy(data, src, samples * 2 * _audio_channels); - + // Advance pointers. data += samples * _audio_channels; n -= samples; @@ -397,7 +397,7 @@ read_samples(int n, PN_int16 *data) { //////////////////////////////////////////////////////////////////// // Function: MicrophoneAudioCursorDS::ready // Access: Published -// Description: +// Description: //////////////////////////////////////////////////////////////////// int MicrophoneAudioCursorDS:: ready() const { diff --git a/panda/src/nativenet/buffered_datagramconnection.h b/panda/src/nativenet/buffered_datagramconnection.h index 2bc949cbcc..2ea996d7e5 100755 --- a/panda/src/nativenet/buffered_datagramconnection.h +++ b/panda/src/nativenet/buffered_datagramconnection.h @@ -11,6 +11,7 @@ // 3. Handle Framing and Unframing properly .. // //////////////////////////////////////////////////////////////////// + #include "pandabase.h" #include "socket_base.h" #include "datagram.h" @@ -19,9 +20,12 @@ #include "buffered_datagramwriter.h" #include "config_nativenet.h" +#ifdef HAVE_PYTHON +#include "py_panda.h" +#endif //////////////////////////////////////////////////////////////// -// there are 3 states +// there are 3 states // // 1. Socket not even assigned,,,, // 2. Socket Assigned and trying to get a active connect open diff --git a/panda/src/ode/odeTriMeshData.h b/panda/src/ode/odeTriMeshData.h index 70b6eaa4dd..e126fcb8c5 100755 --- a/panda/src/ode/odeTriMeshData.h +++ b/panda/src/ode/odeTriMeshData.h @@ -28,9 +28,11 @@ #include "geomTriangles.h" #include "geomTristrips.h" +#include "config_ode.h" + //////////////////////////////////////////////////////////////////// // Class : OdeTriMeshData -// Description : +// Description : //////////////////////////////////////////////////////////////////// class EXPCL_PANDAODE OdeTriMeshData : public TypedReferenceCount { public: @@ -54,7 +56,7 @@ PUBLISHED: virtual ~OdeTriMeshData(); void destroy(); - + // INLINE void set(int data_id, void* in_data); // INLINE void* get(int data_id); // INLINE void get_buffer(unsigned char** buf, int* buf_len) const; @@ -63,7 +65,7 @@ PUBLISHED: virtual void write(ostream &out = cout, unsigned int indent=0) const; void write_faces(ostream &out) const; -public: +public: INLINE void build_single(const void* vertices, int vertex_stride, int vertex_count, \ const void* indices, int index_count, int tri_stride); INLINE void build_single1(const void* vertices, int vertex_stride, int vertex_count, \ @@ -96,7 +98,7 @@ private: void process_model(const NodePath& model, bool &use_normals); void process_geom_node(const GeomNode *geomNode); void process_geom(const Geom *geom); - void process_primitive(const GeomPrimitive *primitive, + void process_primitive(const GeomPrimitive *primitive, CPT(GeomVertexData) vData); void analyze(const GeomNode *geomNode); void analyze(const Geom *geom); @@ -104,15 +106,15 @@ private: OdeTriMeshData(const OdeTriMeshData &other); void operator = (const OdeTriMeshData &other); - + protected: - struct StridedVertex{ + struct StridedVertex { dReal Vertex[3]; - }; - struct StridedTri{ + }; + struct StridedTri { int Indices[3]; }; - struct FaceNormal{ + struct FaceNormal { dVector3 Normal; }; diff --git a/panda/src/pipeline/threadDummyImpl.h b/panda/src/pipeline/threadDummyImpl.h index 4084f2f181..689e6386e6 100644 --- a/panda/src/pipeline/threadDummyImpl.h +++ b/panda/src/pipeline/threadDummyImpl.h @@ -26,7 +26,9 @@ class Thread; #ifdef WIN32 -#define WIN32_LEAN_AND_MEAN +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN 1 +#endif #include // For Sleep(). #endif diff --git a/panda/src/pipeline/threadSimpleManager.h b/panda/src/pipeline/threadSimpleManager.h index e839ac2f5a..34314907f5 100644 --- a/panda/src/pipeline/threadSimpleManager.h +++ b/panda/src/pipeline/threadSimpleManager.h @@ -31,7 +31,9 @@ #include // for pthread_t, below #endif #ifdef WIN32 -#define WIN32_LEAN_AND_MEAN +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN 1 +#endif #include // for DWORD, below #endif diff --git a/panda/src/pnmimagetypes/pnmFileTypeJPG.h b/panda/src/pnmimagetypes/pnmFileTypeJPG.h index 8dfa27af9f..936e349568 100644 --- a/panda/src/pnmimagetypes/pnmFileTypeJPG.h +++ b/panda/src/pnmimagetypes/pnmFileTypeJPG.h @@ -24,7 +24,9 @@ #include "pnmWriter.h" #if defined(_WIN32) -#define WIN32_LEAN_AND_MEAN +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN 1 +#endif #include // we need to include this before jpeglib. #endif diff --git a/panda/src/pnmimagetypes/pnmFileTypePNM.cxx b/panda/src/pnmimagetypes/pnmFileTypePNM.cxx index 45f1888371..8a080fc953 100644 --- a/panda/src/pnmimagetypes/pnmFileTypePNM.cxx +++ b/panda/src/pnmimagetypes/pnmFileTypePNM.cxx @@ -136,8 +136,8 @@ pm_allocarray(int const cols, int const rows, int const size ) { /* We couldn't get the whole heap in one block, so try fragmented format. */ - unsigned int row; - + int row; + rowIndex[rows] = NULL; /* Declare it fragmented format */ for (row = 0; row < rows; ++row) { @@ -149,7 +149,7 @@ pm_allocarray(int const cols, int const rows, int const size ) { } } else { /* It's unfragmented format */ - unsigned int row; + int row; rowIndex[rows] = rowheap; /* Declare it unfragmented format */ for (row = 0; row < rows; ++row) @@ -159,17 +159,18 @@ pm_allocarray(int const cols, int const rows, int const size ) { } void -pm_freearray(char ** const rowIndex, +pm_freearray(char ** const rowIndex, int const rows) { void * const rowheap = rowIndex[rows]; - if (rowheap != NULL) + if (rowheap != NULL) { PANDA_FREE_ARRAY(rowheap); - else { - unsigned int row; - for (row = 0; row < rows; ++row) + } else { + int row; + for (row = 0; row < rows; ++row) { pm_freerow(rowIndex[row]); + } } PANDA_FREE_ARRAY(rowIndex); } @@ -191,7 +192,7 @@ pm_getuint(istream * const ifP) { -----------------------------------------------------------------------------*/ char ch; unsigned int i; - + // skip whitespace do { ch = ifP->get(); @@ -400,7 +401,7 @@ pgm_readpgmrow(istream* const file, gray* const grayrow, } } break; - + case PBM_FORMAT: case RPBM_FORMAT: { @@ -414,22 +415,22 @@ pgm_readpgmrow(istream* const file, gray* const grayrow, pbm_freerow(bitrow); } break; - + default: pm_error( "can't happen" ); } } static void -ppm_readppmrow(istream* const fileP, - pixel* const pixelrow, - int const cols, - pixval const maxval, +ppm_readppmrow(istream* const fileP, + pixel* const pixelrow, + int const cols, + pixval const maxval, int const format) { switch (format) { case PPM_FORMAT: { - unsigned int col; + int col; for (col = 0; col < cols; ++col) { pixval const r = pm_getuint(fileP); pixval const g = pm_getuint(fileP); @@ -440,7 +441,7 @@ ppm_readppmrow(istream* const fileP, break; case RPPM_FORMAT: { - unsigned int col; + int col; for (col = 0; col < cols; ++col) { pixval const r = pgm_getrawsample(fileP, maxval); pixval const g = pgm_getrawsample(fileP, maxval); @@ -453,7 +454,7 @@ ppm_readppmrow(istream* const fileP, case PGM_FORMAT: case RPGM_FORMAT: { gray * const grayrow = pgm_allocrow(cols); - unsigned int col; + int col; pgm_readpgmrow(fileP, grayrow, cols, maxval, format); for (col = 0; col < cols; ++col) { @@ -467,7 +468,7 @@ ppm_readppmrow(istream* const fileP, case PBM_FORMAT: case RPBM_FORMAT: { bit * const bitrow = pbm_allocrow(cols); - unsigned int col; + int col; pbm_readpbmrow(fileP, bitrow, cols, format); for (col = 0; col < cols; ++col) { @@ -626,7 +627,7 @@ packBitsGeneric(ostream * const fileP, Don't use any special CPU facilities to do the packing. -----------------------------------------------------------------------------*/ - unsigned int col; + int col; #define iszero(x) ((x) == 0 ? 0 : 1) @@ -653,7 +654,7 @@ writePackedRawRow(ostream * const fileP, fileP->write((const char *)packed_bits, pbm_packed_bytes(cols)); if (fileP->fail()) pm_error("I/O error writing packed row to raw PBM file."); -} +} static void writePbmRowRaw(ostream * const fileP, @@ -900,24 +901,24 @@ ppm_writeppmrow(ostream * const fileP, } static void -pnm_writepnmrow(ostream * const fileP, - xel * const xelrow, - int const cols, - xelval const maxval, - int const format, +pnm_writepnmrow(ostream * const fileP, + xel * const xelrow, + int const cols, + xelval const maxval, + int const format, int const forceplain) { bool const plainFormat = forceplain || pm_plain_output; - + switch (PNM_FORMAT_TYPE(format)) { case PPM_TYPE: - ppm_writeppmrow(fileP, (pixel*) xelrow, cols, (pixval) maxval, + ppm_writeppmrow(fileP, (pixel*) xelrow, cols, (pixval) maxval, plainFormat); break; case PGM_TYPE: { gray* grayrow; - unsigned int col; + int col; grayrow = pgm_allocrow(cols); @@ -932,7 +933,7 @@ pnm_writepnmrow(ostream * const fileP, case PBM_TYPE: { bit* bitrow; - unsigned int col; + int col; bitrow = pbm_allocrow(cols); @@ -942,12 +943,12 @@ pnm_writepnmrow(ostream * const fileP, pbm_writepbmrow(fileP, bitrow, cols, plainFormat); pbm_freerow(bitrow); - } + } break; - + default: pm_error("invalid format argument received by pnm_writepnmrow(): %d" - "PNM_FORMAT_TYPE(format) must be %d, %d, or %d", + "PNM_FORMAT_TYPE(format) must be %d, %d, or %d", format, PBM_TYPE, PGM_TYPE, PPM_TYPE); } } diff --git a/panda/src/pnmimagetypes/pnmFileTypeTIFF.cxx b/panda/src/pnmimagetypes/pnmFileTypeTIFF.cxx index 1461ed2f98..e16b857d61 100644 --- a/panda/src/pnmimagetypes/pnmFileTypeTIFF.cxx +++ b/panda/src/pnmimagetypes/pnmFileTypeTIFF.cxx @@ -589,7 +589,7 @@ PNMFileTypeTIFF::Reader:: //////////////////////////////////////////////////////////////////// bool PNMFileTypeTIFF::Reader:: is_floating_point() { - return sample_format = SAMPLEFORMAT_IEEEFP; + return (sample_format == SAMPLEFORMAT_IEEEFP); } //////////////////////////////////////////////////////////////////// @@ -988,7 +988,7 @@ write_pfm(const PfmFile &pfm) { const vector_float &table = pfm.get_table(); for (int yi = 0; yi < y_size; ++yi) { const float *row = &table[(yi * x_size) * _num_channels]; - + if (TIFFWriteScanline(tif, (tdata_t)row, yi, 0 ) < 0) { pnmimage_tiff_cat.error() << "failed a scanline write on row " << yi << "\n"; diff --git a/panda/src/rocket/rocketInputHandler.cxx b/panda/src/rocket/rocketInputHandler.cxx index 4abb0366d2..58408ae08e 100644 --- a/panda/src/rocket/rocketInputHandler.cxx +++ b/panda/src/rocket/rocketInputHandler.cxx @@ -259,6 +259,15 @@ do_transmit_data(DataGraphTraverser *trav, const DataNodeTransmit &input, case ButtonEvent::T_move: break; + + case ButtonEvent::T_candidate: + break; + + case ButtonEvent::T_raw_down: + break; + + case ButtonEvent::T_raw_up: + break; } } } diff --git a/panda/src/rocket/rocketSystemInterface.cxx b/panda/src/rocket/rocketSystemInterface.cxx index c417c60339..2f0d3acce6 100644 --- a/panda/src/rocket/rocketSystemInterface.cxx +++ b/panda/src/rocket/rocketSystemInterface.cxx @@ -51,6 +51,10 @@ LogMessage(Rocket::Core::Log::Type type, const Rocket::Core::String& message) { return true; case Rocket::Core::Log::LT_DEBUG: rocket_cat->debug() << message.CString() << "\n"; + return true; + case Rocket::Core::Log::LT_MAX: + // Not really sent; just to keep compiler happy + break; } return true; } diff --git a/panda/src/vision/webcamVideoDS.cxx b/panda/src/vision/webcamVideoDS.cxx index 66743387e0..bdbdc8d798 100644 --- a/panda/src/vision/webcamVideoDS.cxx +++ b/panda/src/vision/webcamVideoDS.cxx @@ -31,7 +31,9 @@ #if defined(HAVE_DIRECTCAM) && !defined(CPPPARSER) -#define WIN32_LEAN_AND_MEAN +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN 1 +#endif #undef Configure diff --git a/panda/src/wgldisplay/wglGraphicsBuffer.h b/panda/src/wgldisplay/wglGraphicsBuffer.h index 72aac1247b..6e4fb286e8 100644 --- a/panda/src/wgldisplay/wglGraphicsBuffer.h +++ b/panda/src/wgldisplay/wglGraphicsBuffer.h @@ -22,7 +22,9 @@ // This must be included after we have included glgsg.h (which // includes gl.h). #include "wglext.h" -#define WIN32_LEAN_AND_MEAN +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN 1 +#endif #include //////////////////////////////////////////////////////////////////// diff --git a/panda/src/windisplay/winDetectDx9.cxx b/panda/src/windisplay/winDetectDx9.cxx index 3689451cce..3a592331ed 100644 --- a/panda/src/windisplay/winDetectDx9.cxx +++ b/panda/src/windisplay/winDetectDx9.cxx @@ -16,7 +16,9 @@ #ifdef HAVE_DX9 -#define WIN32_LEAN_AND_MEAN +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN 1 +#endif #include #include "graphicsStateGuardian.h" #include "graphicsPipe.h" diff --git a/panda/src/windisplay/winGraphicsPipe.cxx b/panda/src/windisplay/winGraphicsPipe.cxx index 90a17ab557..1fd25e52e1 100644 --- a/panda/src/windisplay/winGraphicsPipe.cxx +++ b/panda/src/windisplay/winGraphicsPipe.cxx @@ -25,21 +25,20 @@ #include #endif - TypeHandle WinGraphicsPipe::_type_handle; +#ifndef MAXIMUM_PROCESSORS #define MAXIMUM_PROCESSORS 32 +#endif -typedef struct _PROCESSOR_POWER_INFORMATION -{ - ULONG Number; - ULONG MaxMhz; - ULONG CurrentMhz; - ULONG MhzLimit; - ULONG MaxIdleState; +typedef struct _PROCESSOR_POWER_INFORMATION { + ULONG Number; + ULONG MaxMhz; + ULONG CurrentMhz; + ULONG MhzLimit; + ULONG MaxIdleState; ULONG CurrentIdleState; -} -PROCESSOR_POWER_INFORMATION, *PPROCESSOR_POWER_INFORMATION; +} PROCESSOR_POWER_INFORMATION, *PPROCESSOR_POWER_INFORMATION; typedef BOOL (WINAPI *GetProcessMemoryInfoType) (HANDLE Process, PROCESS_MEMORY_COUNTERS *ppsmemCounters, DWORD cb); typedef BOOL (WINAPI *GlobalMemoryStatusExType) (LPMEMORYSTATUSEX lpBuffer); diff --git a/panda/src/x11display/x11GraphicsWindow.cxx b/panda/src/x11display/x11GraphicsWindow.cxx index 592b404218..7f090ecd5c 100644 --- a/panda/src/x11display/x11GraphicsWindow.cxx +++ b/panda/src/x11display/x11GraphicsWindow.cxx @@ -47,6 +47,7 @@ static int xcursor_read(XcursorFile *file, unsigned char *buf, int len) { static int xcursor_write(XcursorFile *file, unsigned char *buf, int len) { // Not implemented, we don't need it. nassertr_always(false, 0); + return 0; } static int xcursor_seek(XcursorFile *file, long offset, int whence) {