Browse Source

Fix assortment of compilation issues and annoyances

rdb 11 years ago
parent
commit
bd86907181
33 changed files with 286 additions and 143 deletions
  1. 4 1
      dtool/src/dtoolbase/atomicAdjustWin32Impl.h
  2. 6 1
      dtool/src/dtoolbase/dlmalloc.h
  3. 9 1
      dtool/src/dtoolbase/dlmalloc_src.cxx
  4. 3 1
      dtool/src/dtoolbase/memoryHook.cxx
  5. 3 1
      dtool/src/dtoolbase/mutexWin32Impl.h
  6. 3 1
      dtool/src/dtoolbase/ptmalloc2_smp_src.cxx
  7. 3 1
      dtool/src/dtoolutil/pandaFileStreamBuf.h
  8. 3 1
      dtool/src/dtoolutil/pfstreamBuf.h
  9. 4 0
      makepanda/makepanda.py
  10. 5 3
      panda/src/display/graphicsWindowProc.h
  11. 4 0
      panda/src/display/pythonGraphicsWindowProc.cxx
  12. 11 5
      panda/src/display/pythonGraphicsWindowProc.h
  13. 3 1
      panda/src/dxgsg9/dxgsg9base.h
  14. 3 2
      panda/src/express/dcast.cxx
  15. 3 1
      panda/src/express/trueClock.cxx
  16. 3 1
      panda/src/express/windowsRegistry.cxx
  17. 99 39
      panda/src/glstuff/glCgShaderContext_src.cxx
  18. 3 1
      panda/src/gobj/vertexDataSaveFile.h
  19. 21 21
      panda/src/movies/microphoneAudioDS.cxx
  20. 5 1
      panda/src/nativenet/buffered_datagramconnection.h
  21. 11 9
      panda/src/ode/odeTriMeshData.h
  22. 3 1
      panda/src/pipeline/threadDummyImpl.h
  23. 3 1
      panda/src/pipeline/threadSimpleManager.h
  24. 3 1
      panda/src/pnmimagetypes/pnmFileTypeJPG.h
  25. 34 33
      panda/src/pnmimagetypes/pnmFileTypePNM.cxx
  26. 2 2
      panda/src/pnmimagetypes/pnmFileTypeTIFF.cxx
  27. 9 0
      panda/src/rocket/rocketInputHandler.cxx
  28. 4 0
      panda/src/rocket/rocketSystemInterface.cxx
  29. 3 1
      panda/src/vision/webcamVideoDS.cxx
  30. 3 1
      panda/src/wgldisplay/wglGraphicsBuffer.h
  31. 3 1
      panda/src/windisplay/winDetectDx9.cxx
  32. 9 10
      panda/src/windisplay/winGraphicsPipe.cxx
  33. 1 0
      panda/src/x11display/x11GraphicsWindow.cxx

+ 4 - 1
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 <windows.h>
 
 ////////////////////////////////////////////////////////////////////

+ 6 - 1
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();

+ 9 - 1
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 <windows.h>
 #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 ------------------------ */
 

+ 3 - 1
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 <windows.h>
 
 #else

+ 3 - 1
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 <windows.h>
 
 ////////////////////////////////////////////////////////////////////

+ 3 - 1
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 <windows.h>
 

+ 3 - 1
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 <windows.h>
 #endif
 

+ 3 - 1
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 <windows.h>
 
 #else  // WIN_PIPE_CALLS

+ 4 - 0
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:

+ 5 - 3
panda/src/display/graphicsWindowProc.h

@@ -12,7 +12,6 @@
 //
 ////////////////////////////////////////////////////////////////////
 
-
 #ifndef GRAPHICSWINDOWPROC_H
 #define GRAPHICSWINDOWPROC_H
 
@@ -25,6 +24,8 @@
 #include <windows.h>
 #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

+ 4 - 0
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

+ 11 - 5
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

+ 3 - 1
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

+ 3 - 2
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 <windows.h>  // for IsBadWritePtr()
 #endif
 
-
 #ifdef DO_DCAST
 ////////////////////////////////////////////////////////////////////
 //     Function: _dcast_verify

+ 3 - 1
panda/src/express/trueClock.cxx

@@ -30,7 +30,9 @@ TrueClock *TrueClock::_global_ptr = NULL;
 ////////////////////////////////////////////////////////////////////
 
 #include <sys/timeb.h>
-#define WIN32_LEAN_AND_MEAN
+#ifndef WIN32_LEAN_AND_MEAN
+#define WIN32_LEAN_AND_MEAN 1
+#endif
 #include <windows.h>
 
 static const double _0001 = 1.0 / 1000.0;

+ 3 - 1
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 <windows.h>
 
 ////////////////////////////////////////////////////////////////////

+ 99 - 39
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;
       }

+ 3 - 1
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 <windows.h>
 #endif
 

+ 21 - 21
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 <AudioBuf> 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 {

+ 5 - 1
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

+ 11 - 9
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;
   };
 

+ 3 - 1
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 <windows.h>  // For Sleep().
 #endif
 

+ 3 - 1
panda/src/pipeline/threadSimpleManager.h

@@ -31,7 +31,9 @@
 #include <pthread.h>  // 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 <windows.h>  // for DWORD, below
 #endif
 

+ 3 - 1
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 <windows.h>  // we need to include this before jpeglib.
 #endif
 

+ 34 - 33
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);
   }
 }

+ 2 - 2
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";

+ 9 - 0
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;
       }
     }
   }

+ 4 - 0
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;
 }

+ 3 - 1
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
 

+ 3 - 1
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 <windows.h>
 
 ////////////////////////////////////////////////////////////////////

+ 3 - 1
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 <d3d9.h>
 #include "graphicsStateGuardian.h"
 #include "graphicsPipe.h"

+ 9 - 10
panda/src/windisplay/winGraphicsPipe.cxx

@@ -25,21 +25,20 @@
 #include <intrin.h>
 #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);

+ 1 - 0
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) {