Browse Source

compiler warnings, etc.

David Rose 18 years ago
parent
commit
24d4175ca9

+ 1 - 1
panda/src/char/character.cxx

@@ -255,7 +255,7 @@ merge_bundles(PartBundle *old_bundle, PartBundle *new_bundle) {
     }
     ++index;
   }
-  nassertv_always(index < (int)_bundles.size());
+  nassertv_always(index < _bundles.size());
 
   if (old_bundle == new_bundle) {
     // Trivially return.

+ 11 - 0
panda/src/pipeline/thread.cxx

@@ -202,6 +202,17 @@ init_external_thread() {
   }
 }
 
+////////////////////////////////////////////////////////////////////
+//     Function: Thread::PStatsCallback::Destructor
+//       Access: Public, Virtual
+//  Description: Since this class is just an interface definition,
+//               there is no need to have a destructor.  However, we
+//               must have one anyway to stop gcc's annoying warning.
+////////////////////////////////////////////////////////////////////
+Thread::PStatsCallback::
+~PStatsCallback() {
+}
+
 ////////////////////////////////////////////////////////////////////
 //     Function: Thread::PStatsCallback::deactivate_hook
 //       Access: Public, Virtual

+ 1 - 0
panda/src/pipeline/thread.h

@@ -96,6 +96,7 @@ public:
   // SIMPLE_THREADS case.
   class EXPCL_PANDA PStatsCallback {
   public:
+    virtual ~PStatsCallback();
     virtual void deactivate_hook(Thread *thread);
     virtual void activate_hook(Thread *thread);
   };

+ 13 - 3
panda/src/pstatclient/config_pstats.cxx

@@ -31,10 +31,17 @@ ConfigVariableString pstats_name
 ("pstats-name", "Panda Stats");
 
 ConfigVariableDouble pstats_max_rate
-("pstats-max-rate", 1000.0);
+("pstats-max-rate", 1000.0,
+ PRC_DESC("The maximum number of packets per second, per thread, to send "
+          "to the remote PStats server.  A packet is defined as a single "
+          "UDP packet, or each 1024 bytes of a TCP message."));
 
 ConfigVariableBool pstats_threaded_write
-("pstats-threaded-write", false);
+("pstats-threaded-write", true,
+ PRC_DESC("Set this true to write to the PStats channel in a sub-thread, if "
+          "threading is available.  Can't think of any reason why you "
+          "wouldn't want this set true, unless you suspect something is "
+          "broken with the threaded network interfaces."));
 
 ConfigVariableDouble pstats_tcp_ratio
 ("pstats-tcp-ratio", 0.01,
@@ -51,7 +58,10 @@ ConfigVariableInt pstats_port
 ("pstats-port", 5185);
 
 ConfigVariableDouble pstats_target_frame_rate
-("pstats-target-frame-rate", 30.0);
+("pstats-target-frame-rate", 30.0,
+ PRC_DESC("Specify the target frame rate to highlight on the PStats graph.  "
+          "This frame rate is marked with a different-colored line; "
+          "otherwise, this setting has no effect."));
 
 // The rest are different in that they directly control the server,
 // not the client.

+ 12 - 0
panda/src/pstatclient/pStatClient.cxx

@@ -267,6 +267,10 @@ main_tick() {
         case TypeHandle::MC_deleted_chain_inactive:
           dc_inactive_total_usage += usage;
           break;
+
+        case TypeHandle::MC_limit:
+          // Not used.
+          break;
         }          
       }
     }
@@ -306,6 +310,10 @@ main_tick() {
             case TypeHandle::MC_deleted_chain_inactive:
               category = "MMap:NeverFree:Inactive";
               break;
+
+            case TypeHandle::MC_limit:
+              // Not used.
+              break;
             }
             ostringstream strm;
             strm << "System memory:" << category << ":" << type;
@@ -329,6 +337,10 @@ main_tick() {
           case TypeHandle::MC_deleted_chain_inactive:
             dc_inactive_other_usage -= usage;
             break;
+
+          case TypeHandle::MC_limit:
+            // Not used.
+            break;
           }
         }
       }

+ 2 - 2
panda/src/putil/bamCache.cxx

@@ -38,9 +38,9 @@ BamCache *BamCache::_global_ptr = NULL;
 BamCache::
 BamCache() :
   _active(true),
+  _read_only(false),
   _index(new BamCacheIndex),
-  _index_stale_since(0),
-  _read_only(false)
+  _index_stale_since(0)
 {
   ConfigVariableFilename model_cache_dir
     ("model-cache-dir", Filename(), 

+ 12 - 0
panda/src/putil/copyOnWritePointer.cxx

@@ -45,6 +45,12 @@ get_read_pointer() const {
     if (_object->_locking_thread == current_thread) {
       return _object;
     }
+    if (util_cat.is_debug()) {
+      util_cat.debug() 
+        << *current_thread << " waiting on " << _object->get_type()
+        << " " << _object << ", held by " << *_object->_locking_thread
+        << "\n";
+    }
     _object->_lock_cvar.wait();
   }
 
@@ -79,6 +85,12 @@ get_write_pointer() {
   MutexHolder holder(_object->_lock_mutex);
   while (_object->_lock_status == CopyOnWriteObject::LS_locked_write &&
          _object->_locking_thread != current_thread) {
+    if (util_cat.is_debug()) {
+      util_cat.debug() 
+        << *current_thread << " waiting on " << _object->get_type()
+        << " " << _object << ", held by " << *_object->_locking_thread
+        << "\n";
+    }
     _object->_lock_cvar.wait();
   }
 

+ 8 - 0
panda/src/putil/stringStreamBuf.cxx

@@ -172,6 +172,10 @@ seekoff(streamoff off, ios_seekdir dir, ios_openmode which) {
     case ios::end:
       new_pos = (size_t)((int)_data.size() + off);
       break;
+
+    default:
+      // Shouldn't get here.
+      break;
     }
 
     _gpos = new_pos;
@@ -197,6 +201,10 @@ seekoff(streamoff off, ios_seekdir dir, ios_openmode which) {
     case ios::end:
       new_pos = (size_t)((int)_data.size() + off);
       break;
+
+    default:
+      // Shouldn't get here.
+      break;
     }
 
     _ppos = new_pos;

+ 2 - 2
panda/src/text/textAssembler.I

@@ -244,7 +244,7 @@ get_num_rows() const {
 INLINE int TextAssembler::
 get_num_cols(int r) const {
   nassertr(r >= 0 && r <= (int)_text_block.size(), 0);
-  if (r == _text_block.size()) {
+  if (r == (int)_text_block.size()) {
     return 0;
   }
   return _text_block[r]._string.size();
@@ -318,7 +318,7 @@ get_width(int r, int c) const {
 INLINE float TextAssembler::
 get_ypos(int r, int) const {
   nassertr(r >= 0 && r <= (int)_text_block.size(), 0.0f);
-  if (r == _text_block.size()) {
+  if (r == (int)_text_block.size()) {
     return _next_row_ypos;
   } else {
     return _text_block[r]._ypos;

+ 3 - 3
panda/src/text/textAssembler.cxx

@@ -387,7 +387,7 @@ bool TextAssembler::
 calc_r_c(int &r, int &c, int n) const {
   nassertr(n >= 0 && n <= (int)_text_string.size(), false);
 
-  if (n == _text_string.size()) {
+  if (n == (int)_text_string.size()) {
     // A special case for one past the last character.
     if (_text_string.empty()) {
       r = 0;
@@ -456,7 +456,7 @@ calc_r_c(int &r, int &c, int n) const {
 int TextAssembler::
 calc_index(int r, int c) const {
   nassertr(r >= 0 && r <= (int)_text_block.size(), 0);
-  if (r == _text_block.size()) {
+  if (r == (int)_text_block.size()) {
     nassertr(c == 0, 0);
     return _text_string.size();
 
@@ -499,7 +499,7 @@ calc_index(int r, int c) const {
 float TextAssembler::
 get_xpos(int r, int c) const {
   nassertr(r >= 0 && r <= (int)_text_block.size(), 0.0f);
-  if (r == _text_block.size()) {
+  if (r == (int)_text_block.size()) {
     nassertr(c == 0, 0.0f);
     return 0.0f;