Explorar o código

general: Replace NULL (and 0 as pointer) with C++11 nullptr

Exceptions to this replacement are:
- .c files
- Headers included by a .c file
- stb_image.h
- dr_flac.h
- Strings
- Comments
Sam Edwards %!s(int64=7) %!d(string=hai) anos
pai
achega
e2b4353800
Modificáronse 100 ficheiros con 1899 adicións e 1899 borrados
  1. 47 47
      contrib/src/ai/aiBehaviors.cxx
  2. 3 3
      contrib/src/ai/aiNode.cxx
  3. 3 3
      contrib/src/ai/aiPathFinder.cxx
  4. 2 2
      contrib/src/ai/aiWorld.cxx
  5. 3 3
      contrib/src/ai/arrival.cxx
  6. 3 3
      contrib/src/ai/meshNode.cxx
  7. 15 15
      contrib/src/ai/pathFind.cxx
  8. 2 2
      direct/src/dcparse/dcparse.cxx
  9. 5 5
      direct/src/dcparser/dcArrayParameter.cxx
  10. 4 4
      direct/src/dcparser/dcAtomicField.cxx
  11. 44 44
      direct/src/dcparser/dcClass.cxx
  12. 2 2
      direct/src/dcparser/dcClassParameter.cxx
  13. 4 4
      direct/src/dcparser/dcDeclaration.cxx
  14. 22 22
      direct/src/dcparser/dcField.cxx
  15. 12 12
      direct/src/dcparser/dcFile.cxx
  16. 2 2
      direct/src/dcparser/dcKeywordList.cxx
  17. 5 5
      direct/src/dcparser/dcLexer.lxx
  18. 2 2
      direct/src/dcparser/dcMolecularField.cxx
  19. 4 4
      direct/src/dcparser/dcPackData.I
  20. 1 1
      direct/src/dcparser/dcPackData.cxx
  21. 40 40
      direct/src/dcparser/dcPacker.I
  22. 74 74
      direct/src/dcparser/dcPacker.cxx
  23. 12 12
      direct/src/dcparser/dcPackerCatalog.cxx
  24. 14 14
      direct/src/dcparser/dcPackerInterface.cxx
  25. 1 1
      direct/src/dcparser/dcPackerInterface.h
  26. 9 9
      direct/src/dcparser/dcParameter.cxx
  27. 57 57
      direct/src/dcparser/dcParser.yxx
  28. 6 6
      direct/src/dcparser/dcSimpleParameter.cxx
  29. 25 25
      direct/src/dcparser/dcSwitch.cxx
  30. 3 3
      direct/src/dcparser/dcSwitchParameter.cxx
  31. 3 3
      direct/src/directd/directd.cxx
  32. 39 39
      direct/src/distributed/cConnectionRepository.cxx
  33. 6 6
      direct/src/distributed/cDistributedSmoothNodeBase.cxx
  34. 11 11
      direct/src/interval/cIntervalManager.cxx
  35. 5 5
      direct/src/interval/cLerpNodePathInterval.cxx
  36. 2 2
      direct/src/interval/cMetaInterval.I
  37. 2 2
      direct/src/interval/cMetaInterval.cxx
  38. 7 7
      direct/src/motiontrail/cMotionTrail.cxx
  39. 19 19
      direct/src/plugin/binaryXml.cxx
  40. 13 13
      direct/src/plugin/fileSpec.cxx
  41. 14 14
      direct/src/plugin/find_root_dir.cxx
  42. 4 4
      direct/src/plugin/handleStreamBuf.cxx
  43. 89 89
      direct/src/plugin/load_plugin.cxx
  44. 4 4
      direct/src/plugin/mkdir_complete.cxx
  45. 15 15
      direct/src/plugin/p3dAuthSession.cxx
  46. 1 1
      direct/src/plugin/p3dCInstance.cxx
  47. 48 48
      direct/src/plugin/p3dCert.cxx
  48. 37 37
      direct/src/plugin/p3dCert_wx.cxx
  49. 4 4
      direct/src/plugin/p3dConcreteSequence.cxx
  50. 5 5
      direct/src/plugin/p3dConcreteStruct.cxx
  51. 3 3
      direct/src/plugin/p3dConditionVar.cxx
  52. 3 3
      direct/src/plugin/p3dDownload.cxx
  53. 3 3
      direct/src/plugin/p3dFileParams.cxx
  54. 1 1
      direct/src/plugin/p3dHost.I
  55. 47 47
      direct/src/plugin/p3dHost.cxx
  56. 4 4
      direct/src/plugin/p3dInstance.I
  57. 170 170
      direct/src/plugin/p3dInstance.cxx
  58. 41 41
      direct/src/plugin/p3dInstanceManager.cxx
  59. 27 27
      direct/src/plugin/p3dMainObject.cxx
  60. 8 8
      direct/src/plugin/p3dMultifileReader.cxx
  61. 14 14
      direct/src/plugin/p3dObject.cxx
  62. 5 5
      direct/src/plugin/p3dOsxSplashWindow.I
  63. 39 39
      direct/src/plugin/p3dOsxSplashWindow.cxx
  64. 58 58
      direct/src/plugin/p3dPackage.cxx
  65. 24 24
      direct/src/plugin/p3dPatchFinder.cxx
  66. 9 9
      direct/src/plugin/p3dPythonMain.cxx
  67. 21 21
      direct/src/plugin/p3dPythonObject.cxx
  68. 123 123
      direct/src/plugin/p3dPythonRun.cxx
  69. 51 51
      direct/src/plugin/p3dSession.cxx
  70. 3 3
      direct/src/plugin/p3dSplashWindow.cxx
  71. 1 1
      direct/src/plugin/p3dWinSplashWindow.I
  72. 46 46
      direct/src/plugin/p3dWinSplashWindow.cxx
  73. 26 26
      direct/src/plugin/p3dX11SplashWindow.cxx
  74. 5 5
      direct/src/plugin/p3d_lock.h
  75. 33 33
      direct/src/plugin/p3d_plugin.cxx
  76. 1 1
      direct/src/plugin/p3d_plugin.h
  77. 1 1
      direct/src/plugin/p3d_plugin_common.h
  78. 1 1
      direct/src/plugin/run_p3dpython.cxx
  79. 3 3
      direct/src/plugin/wstring_encode.cxx
  80. 1 1
      direct/src/plugin/xml_helpers.cxx
  81. 4 4
      direct/src/plugin_activex/PPDownloadRequest.h
  82. 2 2
      direct/src/plugin_npapi/npruntime.h
  83. 10 10
      direct/src/plugin_npapi/ppBrowserObject.cxx
  84. 1 1
      direct/src/plugin_npapi/ppInstance.I
  85. 125 125
      direct/src/plugin_npapi/ppInstance.cxx
  86. 1 1
      direct/src/plugin_npapi/ppPandaObject.I
  87. 17 17
      direct/src/plugin_npapi/ppPandaObject.cxx
  88. 6 6
      direct/src/plugin_npapi/ppToplevelObject.cxx
  89. 17 17
      direct/src/plugin_npapi/startup.cxx
  90. 2 2
      direct/src/plugin_standalone/p3dEmbed.cxx
  91. 21 21
      direct/src/plugin_standalone/panda3d.cxx
  92. 25 25
      direct/src/plugin_standalone/panda3dBase.cxx
  93. 2 2
      direct/src/plugin_standalone/panda3dMac.cxx
  94. 10 10
      dtool/src/cppparser/cppArrayType.cxx
  95. 116 116
      dtool/src/cppparser/cppBison.yxx
  96. 5 5
      dtool/src/cppparser/cppClassTemplateParameter.cxx
  97. 1 1
      dtool/src/cppparser/cppClassTemplateParameter.h
  98. 4 4
      dtool/src/cppparser/cppClosureType.cxx
  99. 1 1
      dtool/src/cppparser/cppClosureType.h
  100. 3 3
      dtool/src/cppparser/cppConstType.cxx

+ 47 - 47
contrib/src/ai/aiBehaviors.cxx

@@ -21,16 +21,16 @@ AIBehaviors::AIBehaviors() {
   _previous_conflict = false;
   _previous_conflict = false;
   _conflict = false;
   _conflict = false;
 
 
-  _seek_obj = NULL;
-  _flee_obj = NULL;
-  _pursue_obj = NULL;
-  _evade_obj = NULL;
-  _arrival_obj = NULL;
-  _wander_obj = NULL;
-  _flock_group = NULL;
-  _path_follow_obj = NULL;
-  _path_find_obj = NULL;
-  _obstacle_avoidance_obj = NULL;
+  _seek_obj = nullptr;
+  _flee_obj = nullptr;
+  _pursue_obj = nullptr;
+  _evade_obj = nullptr;
+  _arrival_obj = nullptr;
+  _wander_obj = nullptr;
+  _flock_group = nullptr;
+  _path_follow_obj = nullptr;
+  _path_find_obj = nullptr;
+  _obstacle_avoidance_obj = nullptr;
 
 
   turn_off("seek");
   turn_off("seek");
   turn_off("flee");
   turn_off("flee");
@@ -267,7 +267,7 @@ LVecBase3 AIBehaviors::calculate_prioritized() {
     accumulate_force("obstacle_avoidance", force);
     accumulate_force("obstacle_avoidance", force);
   }
   }
 
 
-  if(_path_follow_obj!=NULL) {
+  if(_path_follow_obj!=nullptr) {
     if(_path_follow_obj->_start) {
     if(_path_follow_obj->_start) {
       _path_follow_obj->do_follow();
       _path_follow_obj->do_follow();
     }
     }
@@ -286,13 +286,13 @@ LVecBase3 AIBehaviors::calculate_prioritized() {
   }
   }
 
 
   if(is_on(_arrival)) {
   if(is_on(_arrival)) {
-    if(_seek_obj != NULL) {
+    if(_seek_obj != nullptr) {
       LVecBase3 dirn = _steering_force;
       LVecBase3 dirn = _steering_force;
       dirn.normalize();
       dirn.normalize();
       _steering_force = ((_steering_force.length() - _arrival_force.length()) * dirn);
       _steering_force = ((_steering_force.length() - _arrival_force.length()) * dirn);
     }
     }
 
 
-    if(_pursue_obj != NULL) {
+    if(_pursue_obj != nullptr) {
       LVecBase3 dirn = _steering_force;
       LVecBase3 dirn = _steering_force;
       dirn.normalize();
       dirn.normalize();
       _steering_force = ((_steering_force.length() - _arrival_force.length()) * _arrival_obj->_arrival_direction);
       _steering_force = ((_steering_force.length() - _arrival_force.length()) * _arrival_obj->_arrival_direction);
@@ -320,10 +320,10 @@ void AIBehaviors::remove_ai(string ai_type) {
             }
             }
 
 
     case 1:  {
     case 1:  {
-              if(_seek_obj != NULL) {
+              if(_seek_obj != nullptr) {
                 turn_off("seek");
                 turn_off("seek");
                 delete _seek_obj;
                 delete _seek_obj;
-                _seek_obj = NULL;
+                _seek_obj = nullptr;
               }
               }
               break;
               break;
             }
             }
@@ -338,10 +338,10 @@ void AIBehaviors::remove_ai(string ai_type) {
             }
             }
 
 
     case 3: {
     case 3: {
-              if(_pursue_obj != NULL) {
+              if(_pursue_obj != nullptr) {
                 turn_off("pursue");
                 turn_off("pursue");
                 delete _pursue_obj;
                 delete _pursue_obj;
-                _pursue_obj = NULL;
+                _pursue_obj = nullptr;
               }
               }
               break;
               break;
             }
             }
@@ -356,59 +356,59 @@ void AIBehaviors::remove_ai(string ai_type) {
             }
             }
 
 
     case 5: {
     case 5: {
-              if(_arrival_obj != NULL) {
+              if(_arrival_obj != nullptr) {
                 turn_off("arrival");
                 turn_off("arrival");
                 turn_off("arrival_activate");
                 turn_off("arrival_activate");
                 delete _arrival_obj;
                 delete _arrival_obj;
-                _arrival_obj = NULL;
+                _arrival_obj = nullptr;
               }
               }
               break;
               break;
             }
             }
 
 
     case 6: {
     case 6: {
-              if(_flock_group != NULL) {
+              if(_flock_group != nullptr) {
                 turn_off("flock");
                 turn_off("flock");
                 turn_off("flock_activate");
                 turn_off("flock_activate");
-                _flock_group = NULL;
+                _flock_group = nullptr;
               }
               }
               break;
               break;
             }
             }
 
 
     case 7: {
     case 7: {
-              if(_wander_obj != NULL) {
+              if(_wander_obj != nullptr) {
                 turn_off("wander");
                 turn_off("wander");
                 delete _wander_obj;
                 delete _wander_obj;
-                _wander_obj = NULL;
+                _wander_obj = nullptr;
               }
               }
               break;
               break;
             }
             }
 
 
     case 8: {
     case 8: {
-              if(_obstacle_avoidance_obj !=NULL) {
+              if(_obstacle_avoidance_obj !=nullptr) {
                 turn_off("obstacle_avoidance");
                 turn_off("obstacle_avoidance");
                 delete _obstacle_avoidance_obj;
                 delete _obstacle_avoidance_obj;
-                _obstacle_avoidance_obj = NULL;
+                _obstacle_avoidance_obj = nullptr;
               }
               }
               break;
               break;
             }
             }
 
 
     case 9: {
     case 9: {
-              if(_pursue_obj != NULL && _path_follow_obj != NULL) {
+              if(_pursue_obj != nullptr && _path_follow_obj != nullptr) {
                 turn_off("pursue");
                 turn_off("pursue");
                 delete _pursue_obj;
                 delete _pursue_obj;
-                _pursue_obj = NULL;
+                _pursue_obj = nullptr;
                 delete _path_follow_obj;
                 delete _path_follow_obj;
-                _path_follow_obj = NULL;
+                _path_follow_obj = nullptr;
               }
               }
               break;
               break;
             }
             }
     case 16: {
     case 16: {
-              if(_pursue_obj != NULL && _path_follow_obj != NULL) {
+              if(_pursue_obj != nullptr && _path_follow_obj != nullptr) {
                 turn_off("pursue");
                 turn_off("pursue");
                 delete _pursue_obj;
                 delete _pursue_obj;
-                _pursue_obj = NULL;
+                _pursue_obj = nullptr;
                 delete _path_follow_obj;
                 delete _path_follow_obj;
-                _path_follow_obj = NULL;
+                _path_follow_obj = nullptr;
               }
               }
               break;
               break;
             }
             }
@@ -436,7 +436,7 @@ void AIBehaviors::pause_ai(string ai_type) {
             }
             }
 
 
     case 1:  {
     case 1:  {
-              if(_seek_obj != NULL) {
+              if(_seek_obj != nullptr) {
                 turn_off("seek");
                 turn_off("seek");
               }
               }
               break;
               break;
@@ -451,7 +451,7 @@ void AIBehaviors::pause_ai(string ai_type) {
             }
             }
 
 
     case 3: {
     case 3: {
-              if(_pursue_obj != NULL) {
+              if(_pursue_obj != nullptr) {
                 turn_off("pursue");
                 turn_off("pursue");
               }
               }
               break;
               break;
@@ -466,7 +466,7 @@ void AIBehaviors::pause_ai(string ai_type) {
             }
             }
 
 
     case 5: {
     case 5: {
-              if(_arrival_obj != NULL) {
+              if(_arrival_obj != nullptr) {
                 turn_off("arrival");
                 turn_off("arrival");
                 turn_off("arrival_activate");
                 turn_off("arrival_activate");
               }
               }
@@ -474,7 +474,7 @@ void AIBehaviors::pause_ai(string ai_type) {
             }
             }
 
 
     case 6: {
     case 6: {
-              if(_flock_group != NULL) {
+              if(_flock_group != nullptr) {
                 turn_off("flock");
                 turn_off("flock");
                 turn_off("flock_activate");
                 turn_off("flock_activate");
               }
               }
@@ -482,14 +482,14 @@ void AIBehaviors::pause_ai(string ai_type) {
             }
             }
 
 
     case 7: {
     case 7: {
-              if(_wander_obj != NULL) {
+              if(_wander_obj != nullptr) {
                 turn_off("wander");
                 turn_off("wander");
               }
               }
               break;
               break;
             }
             }
 
 
     case 8: {
     case 8: {
-              if(_obstacle_avoidance_obj != NULL) {
+              if(_obstacle_avoidance_obj != nullptr) {
                 turn_off("obstacle_avoidance");
                 turn_off("obstacle_avoidance");
                 turn_off("obstacle_avoidance_activate");
                 turn_off("obstacle_avoidance_activate");
               }
               }
@@ -497,14 +497,14 @@ void AIBehaviors::pause_ai(string ai_type) {
             }
             }
 
 
     case 9: {
     case 9: {
-              if(_pursue_obj != NULL && _path_follow_obj != NULL) {
+              if(_pursue_obj != nullptr && _path_follow_obj != nullptr) {
                 turn_off("pursue");
                 turn_off("pursue");
                 _path_follow_obj->_start = false;
                 _path_follow_obj->_start = false;
               }
               }
               break;
               break;
             }
             }
     case 16: {
     case 16: {
-              if(_pursue_obj != NULL && _path_follow_obj != NULL) {
+              if(_pursue_obj != nullptr && _path_follow_obj != nullptr) {
                 turn_off("pursue");
                 turn_off("pursue");
                 _path_follow_obj->_start = false;
                 _path_follow_obj->_start = false;
               }
               }
@@ -534,7 +534,7 @@ void AIBehaviors::resume_ai(string ai_type) {
             }
             }
 
 
     case 1:  {
     case 1:  {
-              if(_seek_obj != NULL) {
+              if(_seek_obj != nullptr) {
                 turn_on("seek");
                 turn_on("seek");
               }
               }
               break;
               break;
@@ -548,7 +548,7 @@ void AIBehaviors::resume_ai(string ai_type) {
             }
             }
 
 
     case 3: {
     case 3: {
-              if(_pursue_obj != NULL) {
+              if(_pursue_obj != nullptr) {
                 turn_on("pursue");
                 turn_on("pursue");
               }
               }
               break;
               break;
@@ -562,42 +562,42 @@ void AIBehaviors::resume_ai(string ai_type) {
             }
             }
 
 
     case 5: {
     case 5: {
-              if(_arrival_obj != NULL) {
+              if(_arrival_obj != nullptr) {
                 turn_on("arrival");
                 turn_on("arrival");
               }
               }
               break;
               break;
             }
             }
 
 
     case 6: {
     case 6: {
-              if(_flock_group != NULL) {
+              if(_flock_group != nullptr) {
                 turn_on("flock");
                 turn_on("flock");
               }
               }
               break;
               break;
             }
             }
 
 
     case 7: {
     case 7: {
-              if(_wander_obj != NULL) {
+              if(_wander_obj != nullptr) {
                 turn_on("wander");
                 turn_on("wander");
               }
               }
               break;
               break;
             }
             }
 
 
     case 8: {
     case 8: {
-              if(_obstacle_avoidance_obj != NULL) {
+              if(_obstacle_avoidance_obj != nullptr) {
                 turn_on("obstacle_avoidance");
                 turn_on("obstacle_avoidance");
               }
               }
               break;
               break;
             }
             }
 
 
     case 9: {
     case 9: {
-              if(_pursue_obj != NULL && _path_follow_obj != NULL) {
+              if(_pursue_obj != nullptr && _path_follow_obj != nullptr) {
                 turn_on("pursue");
                 turn_on("pursue");
                 _path_follow_obj->_start = true;
                 _path_follow_obj->_start = true;
               }
               }
               break;
               break;
             }
             }
     case 16: {
     case 16: {
-              if(_pursue_obj != NULL && _path_follow_obj != NULL) {
+              if(_pursue_obj != nullptr && _path_follow_obj != nullptr) {
                 turn_off("pursue");
                 turn_off("pursue");
                 _path_follow_obj->_start = false;
                 _path_follow_obj->_start = false;
               }
               }

+ 3 - 3
contrib/src/ai/aiNode.cxx

@@ -15,7 +15,7 @@
 
 
 AINode::AINode(int grid_x, int grid_y, LVecBase3 pos, float w, float l, float h) {
 AINode::AINode(int grid_x, int grid_y, LVecBase3 pos, float w, float l, float h) {
   for (int i = 0; i < 8; ++i) {
   for (int i = 0; i < 8; ++i) {
-    _neighbours[i] = NULL;
+    _neighbours[i] = nullptr;
   }
   }
 
 
   _position = pos;
   _position = pos;
@@ -29,8 +29,8 @@ AINode::AINode(int grid_x, int grid_y, LVecBase3 pos, float w, float l, float h)
   _score = 0;
   _score = 0;
   _cost = 0;
   _cost = 0;
   _heuristic = 0;
   _heuristic = 0;
-  _next = NULL;
-  _prv_node =  NULL;
+  _next = nullptr;
+  _prv_node =  nullptr;
 }
 }
 
 
 AINode::~AINode() {
 AINode::~AINode() {

+ 3 - 3
contrib/src/ai/aiPathFinder.cxx

@@ -87,7 +87,7 @@ void PathFinder::identify_neighbors(Node *parent_node) {
   // while adding new nodes to the open list heap.
   // while adding new nodes to the open list heap.
   remove_from_olist();
   remove_from_olist();
   for(int i = 0; i < 8; ++i) {
   for(int i = 0; i < 8; ++i) {
-    if(parent_node->_neighbours[i] != NULL) {
+    if(parent_node->_neighbours[i] != nullptr) {
       if(parent_node->_neighbours[i]->_status == parent_node->_neighbours[i]->neutral
       if(parent_node->_neighbours[i]->_status == parent_node->_neighbours[i]->neutral
         && parent_node->_neighbours[i]->_type == true) {
         && parent_node->_neighbours[i]->_type == true) {
         // Link the neighbor to the parent node.
         // Link the neighbor to the parent node.
@@ -340,10 +340,10 @@ Node* find_in_mesh(NavMesh nav_mesh, LVecBase3 pos, int grid_size) {
 
 
   for(int i = 0; i < size; ++i) {
   for(int i = 0; i < size; ++i) {
     for(int j = 0; j < size; ++j) {
     for(int j = 0; j < size; ++j) {
-      if(nav_mesh[i][j] != NULL && nav_mesh[i][j]->contains(x, y)) {
+      if(nav_mesh[i][j] != nullptr && nav_mesh[i][j]->contains(x, y)) {
         return(nav_mesh[i][j]);
         return(nav_mesh[i][j]);
       }
       }
     }
     }
   }
   }
-  return NULL;
+  return nullptr;
 }
 }

+ 2 - 2
contrib/src/ai/aiWorld.cxx

@@ -99,7 +99,7 @@ Flock AIWorld::get_flock(unsigned int flock_id) {
       return *_flock_pool[i];
       return *_flock_pool[i];
     }
     }
   }
   }
-  Flock *null_flock = NULL;
+  Flock *null_flock = nullptr;
   return *null_flock;
   return *null_flock;
 }
 }
 
 
@@ -112,7 +112,7 @@ void AIWorld::remove_flock(unsigned int flock_id) {
        for(unsigned int j = 0; j < _flock_pool[i]->_ai_char_list.size(); ++j) {
        for(unsigned int j = 0; j < _flock_pool[i]->_ai_char_list.size(); ++j) {
          _flock_pool[i]->_ai_char_list[j]->get_ai_behaviors()->turn_off("flock_activate");
          _flock_pool[i]->_ai_char_list[j]->get_ai_behaviors()->turn_off("flock_activate");
          _flock_pool[i]->_ai_char_list[j]->get_ai_behaviors()->turn_off("flock");
          _flock_pool[i]->_ai_char_list[j]->get_ai_behaviors()->turn_off("flock");
-         _flock_pool[i]->_ai_char_list[j]->get_ai_behaviors()->_flock_group = NULL;
+         _flock_pool[i]->_ai_char_list[j]->get_ai_behaviors()->_flock_group = nullptr;
        }
        }
        _flock_pool.erase(_flock_pool.begin() + i);
        _flock_pool.erase(_flock_pool.begin() + i);
        break;
        break;

+ 3 - 3
contrib/src/ai/arrival.cxx

@@ -48,7 +48,7 @@ LVecBase3 Arrival::do_arrival() {
     _ai_char->_steering->_steering_force = LVecBase3(0.0, 0.0, 0.0);
     _ai_char->_steering->_steering_force = LVecBase3(0.0, 0.0, 0.0);
     _ai_char->_steering->_arrival_force = LVecBase3(0.0, 0.0, 0.0);
     _ai_char->_steering->_arrival_force = LVecBase3(0.0, 0.0, 0.0);
 
 
-    if(_ai_char->_steering->_seek_obj != NULL) {
+    if(_ai_char->_steering->_seek_obj != nullptr) {
       _ai_char->_steering->turn_off("arrival");
       _ai_char->_steering->turn_off("arrival");
       _ai_char->_steering->turn_on("arrival_activate");
       _ai_char->_steering->turn_on("arrival_activate");
     }
     }
@@ -62,11 +62,11 @@ LVecBase3 Arrival::do_arrival() {
   double u = _ai_char->get_velocity().length();
   double u = _ai_char->get_velocity().length();
   LVecBase3 desired_force = ((u * u) / (2 * distance)) * _ai_char->get_mass();
   LVecBase3 desired_force = ((u * u) / (2 * distance)) * _ai_char->get_mass();
 
 
-  if(_ai_char->_steering->_seek_obj != NULL) {
+  if(_ai_char->_steering->_seek_obj != nullptr) {
     return(desired_force);
     return(desired_force);
   }
   }
 
 
-  if(_ai_char->_steering->_pursue_obj != NULL) {
+  if(_ai_char->_steering->_pursue_obj != nullptr) {
 
 
     if(distance > _arrival_distance) {
     if(distance > _arrival_distance) {
       _ai_char->_steering->turn_off("arrival");
       _ai_char->_steering->turn_off("arrival");

+ 3 - 3
contrib/src/ai/meshNode.cxx

@@ -3,7 +3,7 @@
 
 
 Node::Node(int grid_x, int grid_y, LVecBase3 pos, float w, float l, float h) {
 Node::Node(int grid_x, int grid_y, LVecBase3 pos, float w, float l, float h) {
   for(int i = 0; i < 8; ++i) {
   for(int i = 0; i < 8; ++i) {
-    _neighbours[i] = NULL;
+    _neighbours[i] = nullptr;
   }
   }
 
 
   _position = pos;
   _position = pos;
@@ -17,8 +17,8 @@ Node::Node(int grid_x, int grid_y, LVecBase3 pos, float w, float l, float h) {
   _score = 0;
   _score = 0;
   _cost = 0;
   _cost = 0;
   _heuristic = 0;
   _heuristic = 0;
-  _next = NULL;
-  _prv_node =  NULL;
+  _next = nullptr;
+  _prv_node =  nullptr;
 }
 }
 
 
 Node::~Node() {
 Node::~Node() {

+ 15 - 15
contrib/src/ai/pathFind.cxx

@@ -23,7 +23,7 @@ PathFind::PathFind(AICharacter *ai_ch) {
   _pen->set_color(1.0, 0.0, 0.0);
   _pen->set_color(1.0, 0.0, 0.0);
   _pen->set_thickness(2.0);
   _pen->set_thickness(2.0);
 
 
-  _path_finder_obj = NULL;
+  _path_finder_obj = nullptr;
   _dynamic_avoid = false;
   _dynamic_avoid = false;
 }
 }
 
 
@@ -58,7 +58,7 @@ void PathFind::create_nav_mesh(const char* navmesh_filename) {
     for(int r = 0; r < _grid_size; ++r) {
     for(int r = 0; r < _grid_size; ++r) {
       _nav_mesh.push_back(std::vector<Node*>());
       _nav_mesh.push_back(std::vector<Node*>());
       for(int c = 0; c < _grid_size; ++c) {
       for(int c = 0; c < _grid_size; ++c) {
-        _nav_mesh[r].push_back(NULL);
+        _nav_mesh[r].push_back(nullptr);
       }
       }
     }
     }
 
 
@@ -150,7 +150,7 @@ void PathFind::assign_neighbor_nodes(const char* navmesh_filename){
           }
           }
           else if(fields_n[0] == "1" && fields_n[1] == "1") {
           else if(fields_n[0] == "1" && fields_n[1] == "1") {
             // NULL neighbor.
             // NULL neighbor.
-            _nav_mesh[gd_y][gd_x]->_neighbours[i] = NULL;
+            _nav_mesh[gd_y][gd_x]->_neighbours[i] = nullptr;
           }
           }
           else {
           else {
             cout<<"Warning: Corrupt data!"<<endl;
             cout<<"Warning: Corrupt data!"<<endl;
@@ -183,7 +183,7 @@ void PathFind::set_path_find(const char* navmesh_filename) {
 
 
   if(_path_finder_obj) {
   if(_path_finder_obj) {
     delete _path_finder_obj;
     delete _path_finder_obj;
-    _path_finder_obj = NULL;
+    _path_finder_obj = nullptr;
   }
   }
 
 
   _path_finder_obj = new PathFinder(_nav_mesh);
   _path_finder_obj = new PathFinder(_nav_mesh);
@@ -207,17 +207,17 @@ void PathFind::path_find(LVecBase3 pos, string type) {
 
 
   Node* src = find_in_mesh(_nav_mesh, _ai_char->_ai_char_np.get_pos(_ai_char->_window_render), _grid_size);
   Node* src = find_in_mesh(_nav_mesh, _ai_char->_ai_char_np.get_pos(_ai_char->_window_render), _grid_size);
 
 
-  if(src == NULL) {
+  if(src == nullptr) {
     cout<<"couldnt find source"<<endl;
     cout<<"couldnt find source"<<endl;
   }
   }
 
 
   Node* dst = find_in_mesh(_nav_mesh, pos, _grid_size);
   Node* dst = find_in_mesh(_nav_mesh, pos, _grid_size);
 
 
-  if(dst == NULL) {
+  if(dst == nullptr) {
     cout<<"couldnt find destination"<<endl;
     cout<<"couldnt find destination"<<endl;
   }
   }
 
 
-  if(src != NULL && dst != NULL) {
+  if(src != nullptr && dst != nullptr) {
     _path_finder_obj->find_path(src, dst);
     _path_finder_obj->find_path(src, dst);
     trace_path(src);
     trace_path(src);
   }
   }
@@ -248,22 +248,22 @@ void PathFind::path_find(NodePath target, string type) {
 
 
   Node* src = find_in_mesh(_nav_mesh, _ai_char->_ai_char_np.get_pos(_ai_char->_window_render), _grid_size);
   Node* src = find_in_mesh(_nav_mesh, _ai_char->_ai_char_np.get_pos(_ai_char->_window_render), _grid_size);
 
 
-  if(src == NULL) {
+  if(src == nullptr) {
     cout<<"couldnt find source"<<endl;
     cout<<"couldnt find source"<<endl;
   }
   }
 
 
   Node* dst = find_in_mesh(_nav_mesh, _prev_position, _grid_size);
   Node* dst = find_in_mesh(_nav_mesh, _prev_position, _grid_size);
 
 
-  if(dst == NULL) {
+  if(dst == nullptr) {
     cout<<"couldnt find destination"<<endl;
     cout<<"couldnt find destination"<<endl;
   }
   }
 
 
-  if(src != NULL && dst != NULL) {
+  if(src != nullptr && dst != nullptr) {
     _path_finder_obj->find_path(src, dst);
     _path_finder_obj->find_path(src, dst);
     trace_path(src);
     trace_path(src);
   }
   }
 
 
-  if(_ai_char->_steering->_path_follow_obj!=NULL) {
+  if(_ai_char->_steering->_path_follow_obj!=nullptr) {
     if(!_ai_char->_steering->_path_follow_obj->_start) {
     if(!_ai_char->_steering->_path_follow_obj->_start) {
       _ai_char->_steering->start_follow("pathfind");
       _ai_char->_steering->start_follow("pathfind");
     }
     }
@@ -277,12 +277,12 @@ void PathFind::clear_path() {
   // Initialize to zero
   // Initialize to zero
   for(int i = 0; i < _grid_size; ++i) {
   for(int i = 0; i < _grid_size; ++i) {
     for(int j = 0; j < _grid_size; ++j) {
     for(int j = 0; j < _grid_size; ++j) {
-      if(_nav_mesh[i][j] != NULL) {
+      if(_nav_mesh[i][j] != nullptr) {
         _nav_mesh[i][j]->_status = _nav_mesh[i][j]->neutral;
         _nav_mesh[i][j]->_status = _nav_mesh[i][j]->neutral;
         _nav_mesh[i][j]->_cost = 0;
         _nav_mesh[i][j]->_cost = 0;
         _nav_mesh[i][j]->_heuristic = 0;
         _nav_mesh[i][j]->_heuristic = 0;
         _nav_mesh[i][j]->_score = 0;
         _nav_mesh[i][j]->_score = 0;
-        _nav_mesh[i][j]->_prv_node = NULL;
+        _nav_mesh[i][j]->_prv_node = nullptr;
       }
       }
     }
     }
   }
   }
@@ -333,7 +333,7 @@ void PathFind::add_obstacle_to_mesh(NodePath obstacle) {
 
 
   Node* temp = find_in_mesh(_nav_mesh, obstacle.get_pos(), _grid_size);
   Node* temp = find_in_mesh(_nav_mesh, obstacle.get_pos(), _grid_size);
 
 
-  if(temp != NULL) {
+  if(temp != nullptr) {
     float left = temp->_position.get_x() - np_sphere->get_radius();
     float left = temp->_position.get_x() - np_sphere->get_radius();
     float right = temp->_position.get_x() + np_sphere->get_radius();
     float right = temp->_position.get_x() + np_sphere->get_radius();
     float top = temp->_position.get_y() + np_sphere->get_radius();
     float top = temp->_position.get_y() + np_sphere->get_radius();
@@ -341,7 +341,7 @@ void PathFind::add_obstacle_to_mesh(NodePath obstacle) {
 
 
     for(int i = 0; i < _grid_size; ++i) {
     for(int i = 0; i < _grid_size; ++i) {
         for(int j = 0; j < _grid_size; ++j) {
         for(int j = 0; j < _grid_size; ++j) {
-          if(_nav_mesh[i][j] != NULL && _nav_mesh[i][j]->_type == true) {
+          if(_nav_mesh[i][j] != nullptr && _nav_mesh[i][j]->_type == true) {
             if(_nav_mesh[i][j]->_position.get_x() >= left && _nav_mesh[i][j]->_position.get_x() <= right &&
             if(_nav_mesh[i][j]->_position.get_x() >= left && _nav_mesh[i][j]->_position.get_x() <= right &&
                _nav_mesh[i][j]->_position.get_y() >= down && _nav_mesh[i][j]->_position.get_y() <= top) {
                _nav_mesh[i][j]->_position.get_y() >= down && _nav_mesh[i][j]->_position.get_y() <= top) {
               _nav_mesh[i][j]->_type = false;
               _nav_mesh[i][j]->_type = false;

+ 2 - 2
direct/src/dcparse/dcparse.cxx

@@ -103,8 +103,8 @@ write_complete_field_list(const DCFile &file) {
         cout << field->get_class()->get_name() << "::";
         cout << field->get_class()->get_name() << "::";
       }
       }
       cout << field->get_name();
       cout << field->get_name();
-      if (field->as_atomic_field() != (DCAtomicField *)NULL ||
-          field->as_molecular_field() != (DCMolecularField *)NULL) {
+      if (field->as_atomic_field() != nullptr ||
+          field->as_molecular_field() != nullptr) {
         // It's a "method".
         // It's a "method".
         cout << "()";
         cout << "()";
       }
       }

+ 5 - 5
direct/src/dcparser/dcArrayParameter.cxx

@@ -58,7 +58,7 @@ DCArrayParameter(DCParameter *element_type, const DCUnsignedIntRange &size) :
   _pack_type = PT_array;
   _pack_type = PT_array;
 
 
   DCSimpleParameter *simple_type = _element_type->as_simple_parameter();
   DCSimpleParameter *simple_type = _element_type->as_simple_parameter();
-  if (simple_type != (DCSimpleParameter *)NULL) {
+  if (simple_type != nullptr) {
     if (simple_type->get_type() == ST_char) {
     if (simple_type->get_type() == ST_char) {
       // We make a special case for char[] arrays: these we format as a
       // We make a special case for char[] arrays: these we format as a
       // string.  (It will still accept an array of ints packed into it.)  We
       // string.  (It will still accept an array of ints packed into it.)  We
@@ -148,7 +148,7 @@ get_array_size() const {
  */
  */
 DCParameter *DCArrayParameter::
 DCParameter *DCArrayParameter::
 append_array_specification(const DCUnsignedIntRange &size) {
 append_array_specification(const DCUnsignedIntRange &size) {
-  if (get_typedef() != (DCTypedef *)NULL) {
+  if (get_typedef() != nullptr) {
     // If this was a typedef, wrap it directly.
     // If this was a typedef, wrap it directly.
     return new DCArrayParameter(this, size);
     return new DCArrayParameter(this, size);
   }
   }
@@ -203,7 +203,7 @@ validate_num_nested_fields(int num_nested_fields) const {
 void DCArrayParameter::
 void DCArrayParameter::
 output_instance(ostream &out, bool brief, const string &prename,
 output_instance(ostream &out, bool brief, const string &prename,
                 const string &name, const string &postname) const {
                 const string &name, const string &postname) const {
-  if (get_typedef() != (DCTypedef *)NULL) {
+  if (get_typedef() != nullptr) {
     output_typedef_name(out, brief, prename, name, postname);
     output_typedef_name(out, brief, prename, name, postname);
 
 
   } else {
   } else {
@@ -236,7 +236,7 @@ pack_string(DCPackData &pack_data, const string &value,
             bool &pack_error, bool &range_error) const {
             bool &pack_error, bool &range_error) const {
   // We can only pack a string if the array element type is char or int8.
   // We can only pack a string if the array element type is char or int8.
   DCSimpleParameter *simple_type = _element_type->as_simple_parameter();
   DCSimpleParameter *simple_type = _element_type->as_simple_parameter();
-  if (simple_type == (DCSimpleParameter *)NULL) {
+  if (simple_type == nullptr) {
     pack_error = true;
     pack_error = true;
     return;
     return;
   }
   }
@@ -306,7 +306,7 @@ unpack_string(const char *data, size_t length, size_t &p, string &value,
               bool &pack_error, bool &range_error) const {
               bool &pack_error, bool &range_error) const {
   // We can only unpack a string if the array element type is char or int8.
   // We can only unpack a string if the array element type is char or int8.
   DCSimpleParameter *simple_type = _element_type->as_simple_parameter();
   DCSimpleParameter *simple_type = _element_type->as_simple_parameter();
-  if (simple_type == (DCSimpleParameter *)NULL) {
+  if (simple_type == nullptr) {
     pack_error = true;
     pack_error = true;
     return;
     return;
   }
   }

+ 4 - 4
direct/src/dcparser/dcAtomicField.cxx

@@ -73,7 +73,7 @@ get_num_elements() const {
  */
  */
 DCParameter *DCAtomicField::
 DCParameter *DCAtomicField::
 get_element(int n) const {
 get_element(int n) const {
-  nassertr(n >= 0 && n < (int)_elements.size(), NULL);
+  nassertr(n >= 0 && n < (int)_elements.size(), nullptr);
   return _elements[n];
   return _elements[n];
 }
 }
 
 
@@ -127,7 +127,7 @@ DCSubatomicType DCAtomicField::
 get_element_type(int n) const {
 get_element_type(int n) const {
   nassertr(n >= 0 && n < (int)_elements.size(), ST_invalid);
   nassertr(n >= 0 && n < (int)_elements.size(), ST_invalid);
   DCSimpleParameter *simple_parameter = _elements[n]->as_simple_parameter();
   DCSimpleParameter *simple_parameter = _elements[n]->as_simple_parameter();
-  nassertr(simple_parameter != (DCSimpleParameter *)NULL, ST_invalid);
+  nassertr(simple_parameter != nullptr, ST_invalid);
   return simple_parameter->get_type();
   return simple_parameter->get_type();
 }
 }
 
 
@@ -143,7 +143,7 @@ int DCAtomicField::
 get_element_divisor(int n) const {
 get_element_divisor(int n) const {
   nassertr(n >= 0 && n < (int)_elements.size(), 1);
   nassertr(n >= 0 && n < (int)_elements.size(), 1);
   DCSimpleParameter *simple_parameter = _elements[n]->as_simple_parameter();
   DCSimpleParameter *simple_parameter = _elements[n]->as_simple_parameter();
-  nassertr(simple_parameter != (DCSimpleParameter *)NULL, 1);
+  nassertr(simple_parameter != nullptr, 1);
   return simple_parameter->get_divisor();
   return simple_parameter->get_divisor();
 }
 }
 
 
@@ -207,7 +207,7 @@ generate_hash(HashGenerator &hashgen) const {
  */
  */
 DCPackerInterface *DCAtomicField::
 DCPackerInterface *DCAtomicField::
 get_nested_field(int n) const {
 get_nested_field(int n) const {
-  nassertr(n >= 0 && n < (int)_elements.size(), NULL);
+  nassertr(n >= 0 && n < (int)_elements.size(), nullptr);
   return _elements[n];
   return _elements[n];
 }
 }
 
 

+ 44 - 44
direct/src/dcparser/dcClass.cxx

@@ -80,11 +80,11 @@ DCClass(DCFile *dc_file, const string &name, bool is_struct, bool bogus_class) :
   _bogus_class(bogus_class)
   _bogus_class(bogus_class)
 {
 {
   _number = -1;
   _number = -1;
-  _constructor = NULL;
+  _constructor = nullptr;
 
 
 #ifdef HAVE_PYTHON
 #ifdef HAVE_PYTHON
-  _class_def = NULL;
-  _owner_class_def = NULL;
+  _class_def = nullptr;
+  _owner_class_def = nullptr;
 #endif
 #endif
 }
 }
 
 
@@ -93,7 +93,7 @@ DCClass(DCFile *dc_file, const string &name, bool is_struct, bool bogus_class) :
  */
  */
 DCClass::
 DCClass::
 ~DCClass() {
 ~DCClass() {
-  if (_constructor != (DCField *)NULL) {
+  if (_constructor != nullptr) {
     delete _constructor;
     delete _constructor;
   }
   }
 
 
@@ -137,7 +137,7 @@ get_num_parents() const {
  */
  */
 DCClass *DCClass::
 DCClass *DCClass::
 get_parent(int n) const {
 get_parent(int n) const {
-  nassertr(n >= 0 && n < (int)_parents.size(), NULL);
+  nassertr(n >= 0 && n < (int)_parents.size(), nullptr);
   return _parents[n];
   return _parents[n];
 }
 }
 
 
@@ -147,7 +147,7 @@ get_parent(int n) const {
  */
  */
 bool DCClass::
 bool DCClass::
 has_constructor() const {
 has_constructor() const {
-  return (_constructor != (DCField *)NULL);
+  return (_constructor != nullptr);
 }
 }
 
 
 /**
 /**
@@ -183,7 +183,7 @@ get_field(int n) const {
     // __asm { int 3 }
     // __asm { int 3 }
   }
   }
   #endif //]
   #endif //]
-  nassertr_always(n >= 0 && n < (int)_fields.size(), NULL);
+  nassertr_always(n >= 0 && n < (int)_fields.size(), nullptr);
   return _fields[n];
   return _fields[n];
 }
 }
 
 
@@ -205,13 +205,13 @@ get_field_by_name(const string &name) const {
   Parents::const_iterator pi;
   Parents::const_iterator pi;
   for (pi = _parents.begin(); pi != _parents.end(); ++pi) {
   for (pi = _parents.begin(); pi != _parents.end(); ++pi) {
     DCField *result = (*pi)->get_field_by_name(name);
     DCField *result = (*pi)->get_field_by_name(name);
-    if (result != (DCField *)NULL) {
+    if (result != nullptr) {
       return result;
       return result;
     }
     }
   }
   }
 
 
   // Nobody knew what this field is.
   // Nobody knew what this field is.
-  return (DCField *)NULL;
+  return nullptr;
 }
 }
 
 
 /**
 /**
@@ -232,7 +232,7 @@ get_field_by_index(int index_number) const {
   Parents::const_iterator pi;
   Parents::const_iterator pi;
   for (pi = _parents.begin(); pi != _parents.end(); ++pi) {
   for (pi = _parents.begin(); pi != _parents.end(); ++pi) {
     DCField *result = (*pi)->get_field_by_index(index_number);
     DCField *result = (*pi)->get_field_by_index(index_number);
-    if (result != (DCField *)NULL) {
+    if (result != nullptr) {
       // Cache this result for future lookups.
       // Cache this result for future lookups.
       ((DCClass *)this)->_fields_by_index[index_number] = result;
       ((DCClass *)this)->_fields_by_index[index_number] = result;
       return result;
       return result;
@@ -240,7 +240,7 @@ get_field_by_index(int index_number) const {
   }
   }
 
 
   // Nobody knew what this field is.
   // Nobody knew what this field is.
-  return (DCField *)NULL;
+  return nullptr;
 }
 }
 
 
 /**
 /**
@@ -250,7 +250,7 @@ get_field_by_index(int index_number) const {
 int DCClass::
 int DCClass::
 get_num_inherited_fields() const {
 get_num_inherited_fields() const {
   if (dc_multiple_inheritance && dc_virtual_inheritance &&
   if (dc_multiple_inheritance && dc_virtual_inheritance &&
-      _dc_file != (DCFile *)NULL) {
+      _dc_file != nullptr) {
     _dc_file->check_inherited_fields();
     _dc_file->check_inherited_fields();
     if (_inherited_fields.empty()) {
     if (_inherited_fields.empty()) {
       ((DCClass *)this)->rebuild_inherited_fields();
       ((DCClass *)this)->rebuild_inherited_fields();
@@ -283,12 +283,12 @@ get_num_inherited_fields() const {
 DCField *DCClass::
 DCField *DCClass::
 get_inherited_field(int n) const {
 get_inherited_field(int n) const {
   if (dc_multiple_inheritance && dc_virtual_inheritance &&
   if (dc_multiple_inheritance && dc_virtual_inheritance &&
-      _dc_file != (DCFile *)NULL) {
+      _dc_file != nullptr) {
     _dc_file->check_inherited_fields();
     _dc_file->check_inherited_fields();
     if (_inherited_fields.empty()) {
     if (_inherited_fields.empty()) {
       ((DCClass *)this)->rebuild_inherited_fields();
       ((DCClass *)this)->rebuild_inherited_fields();
     }
     }
-    nassertr(n >= 0 && n < (int)_inherited_fields.size(), NULL);
+    nassertr(n >= 0 && n < (int)_inherited_fields.size(), nullptr);
     return _inherited_fields[n];
     return _inherited_fields[n];
 
 
   } else {
   } else {
@@ -349,7 +349,7 @@ output(ostream &out) const {
  */
  */
 bool DCClass::
 bool DCClass::
 has_class_def() const {
 has_class_def() const {
-  return (_class_def != NULL);
+  return (_class_def != nullptr);
 }
 }
 #endif  // HAVE_PYTHON
 #endif  // HAVE_PYTHON
 
 
@@ -373,7 +373,7 @@ set_class_def(PyObject *class_def) {
  */
  */
 PyObject *DCClass::
 PyObject *DCClass::
 get_class_def() const {
 get_class_def() const {
-  if (_class_def == NULL) {
+  if (_class_def == nullptr) {
     Py_INCREF(Py_None);
     Py_INCREF(Py_None);
     return Py_None;
     return Py_None;
   }
   }
@@ -390,7 +390,7 @@ get_class_def() const {
  */
  */
 bool DCClass::
 bool DCClass::
 has_owner_class_def() const {
 has_owner_class_def() const {
-  return (_owner_class_def != NULL);
+  return (_owner_class_def != nullptr);
 }
 }
 #endif  // HAVE_PYTHON
 #endif  // HAVE_PYTHON
 
 
@@ -414,7 +414,7 @@ set_owner_class_def(PyObject *owner_class_def) {
  */
  */
 PyObject *DCClass::
 PyObject *DCClass::
 get_owner_class_def() const {
 get_owner_class_def() const {
-  if (_owner_class_def == NULL) {
+  if (_owner_class_def == nullptr) {
     Py_INCREF(Py_None);
     Py_INCREF(Py_None);
     return Py_None;
     return Py_None;
   }
   }
@@ -441,7 +441,7 @@ receive_update(PyObject *distobj, DatagramIterator &di) const {
 
 
     int field_id = packer.raw_unpack_uint16();
     int field_id = packer.raw_unpack_uint16();
     DCField *field = get_field_by_index(field_id);
     DCField *field = get_field_by_index(field_id);
-    if (field == (DCField *)NULL) {
+    if (field == nullptr) {
             ostringstream strm;
             ostringstream strm;
             strm
             strm
                 << "Received update for field " << field_id << ", not in class "
                 << "Received update for field " << field_id << ", not in class "
@@ -478,7 +478,7 @@ receive_update_broadcast_required(PyObject *distobj, DatagramIterator &di) const
   int num_fields = get_num_inherited_fields();
   int num_fields = get_num_inherited_fields();
   for (int i = 0; i < num_fields && !PyErr_Occurred(); ++i) {
   for (int i = 0; i < num_fields && !PyErr_Occurred(); ++i) {
     DCField *field = get_inherited_field(i);
     DCField *field = get_inherited_field(i);
-    if (field->as_molecular_field() == (DCMolecularField *)NULL &&
+    if (field->as_molecular_field() == nullptr &&
         field->is_required() && field->is_broadcast()) {
         field->is_required() && field->is_broadcast()) {
       packer.begin_unpack(field);
       packer.begin_unpack(field);
       field->receive_update(packer, distobj);
       field->receive_update(packer, distobj);
@@ -513,7 +513,7 @@ receive_update_broadcast_required_owner(PyObject *distobj,
   int num_fields = get_num_inherited_fields();
   int num_fields = get_num_inherited_fields();
   for (int i = 0; i < num_fields && !PyErr_Occurred(); ++i) {
   for (int i = 0; i < num_fields && !PyErr_Occurred(); ++i) {
     DCField *field = get_inherited_field(i);
     DCField *field = get_inherited_field(i);
-    if (field->as_molecular_field() == (DCMolecularField *)NULL &&
+    if (field->as_molecular_field() == nullptr &&
         field->is_required() && (field->is_ownrecv() || field->is_broadcast())) {
         field->is_required() && (field->is_ownrecv() || field->is_broadcast())) {
       packer.begin_unpack(field);
       packer.begin_unpack(field);
       field->receive_update(packer, distobj);
       field->receive_update(packer, distobj);
@@ -546,7 +546,7 @@ receive_update_all_required(PyObject *distobj, DatagramIterator &di) const {
   int num_fields = get_num_inherited_fields();
   int num_fields = get_num_inherited_fields();
   for (int i = 0; i < num_fields && !PyErr_Occurred(); ++i) {
   for (int i = 0; i < num_fields && !PyErr_Occurred(); ++i) {
     DCField *field = get_inherited_field(i);
     DCField *field = get_inherited_field(i);
-    if (field->as_molecular_field() == (DCMolecularField *)NULL &&
+    if (field->as_molecular_field() == nullptr &&
         field->is_required()) {
         field->is_required()) {
       packer.begin_unpack(field);
       packer.begin_unpack(field);
       field->receive_update(packer, distobj);
       field->receive_update(packer, distobj);
@@ -585,7 +585,7 @@ void DCClass::
 direct_update(PyObject *distobj, const string &field_name,
 direct_update(PyObject *distobj, const string &field_name,
               const string &value_blob) {
               const string &value_blob) {
   DCField *field = get_field_by_name(field_name);
   DCField *field = get_field_by_name(field_name);
-  nassertv_always(field != NULL);
+  nassertv_always(field != nullptr);
 
 
   DCPacker packer;
   DCPacker packer;
   packer.set_unpack_data(value_blob);
   packer.set_unpack_data(value_blob);
@@ -645,7 +645,7 @@ bool DCClass::
 pack_required_field(DCPacker &packer, PyObject *distobj,
 pack_required_field(DCPacker &packer, PyObject *distobj,
                     const DCField *field) const {
                     const DCField *field) const {
   const DCParameter *parameter = field->as_parameter();
   const DCParameter *parameter = field->as_parameter();
-  if (parameter != (DCParameter *)NULL) {
+  if (parameter != nullptr) {
     // This is the easy case: to pack a parameter, we just look on the class
     // This is the easy case: to pack a parameter, we just look on the class
     // object for the data element.
     // object for the data element.
     string field_name = field->get_name();
     string field_name = field->get_name();
@@ -668,7 +668,7 @@ pack_required_field(DCPacker &packer, PyObject *distobj,
     }
     }
     PyObject *result =
     PyObject *result =
       PyObject_GetAttrString(distobj, (char *)field_name.c_str());
       PyObject_GetAttrString(distobj, (char *)field_name.c_str());
-    nassertr(result != (PyObject *)NULL, false);
+    nassertr(result != nullptr, false);
 
 
     // Now pack the value into the datagram.
     // Now pack the value into the datagram.
     bool pack_ok = parameter->pack_args(packer, result);
     bool pack_ok = parameter->pack_args(packer, result);
@@ -677,7 +677,7 @@ pack_required_field(DCPacker &packer, PyObject *distobj,
     return pack_ok;
     return pack_ok;
   }
   }
 
 
-  if (field->as_molecular_field() != (DCMolecularField *)NULL) {
+  if (field->as_molecular_field() != nullptr) {
     ostringstream strm;
     ostringstream strm;
     strm << "Cannot pack molecular field " << field->get_name()
     strm << "Cannot pack molecular field " << field->get_name()
          << " for generate";
          << " for generate";
@@ -686,7 +686,7 @@ pack_required_field(DCPacker &packer, PyObject *distobj,
   }
   }
 
 
   const DCAtomicField *atom = field->as_atomic_field();
   const DCAtomicField *atom = field->as_atomic_field();
-  nassertr(atom != (DCAtomicField *)NULL, false);
+  nassertr(atom != nullptr, false);
 
 
   // We need to get the initial value of this field.  There isn't a good,
   // We need to get the initial value of this field.  There isn't a good,
   // robust way to get this; presently, we just mangle the "setFoo()" name of
   // robust way to get this; presently, we just mangle the "setFoo()" name of
@@ -740,13 +740,13 @@ pack_required_field(DCPacker &packer, PyObject *distobj,
   }
   }
   PyObject *func =
   PyObject *func =
     PyObject_GetAttrString(distobj, (char *)getter_name.c_str());
     PyObject_GetAttrString(distobj, (char *)getter_name.c_str());
-  nassertr(func != (PyObject *)NULL, false);
+  nassertr(func != nullptr, false);
 
 
   PyObject *empty_args = PyTuple_New(0);
   PyObject *empty_args = PyTuple_New(0);
   PyObject *result = PyObject_CallObject(func, empty_args);
   PyObject *result = PyObject_CallObject(func, empty_args);
   Py_DECREF(empty_args);
   Py_DECREF(empty_args);
   Py_DECREF(func);
   Py_DECREF(func);
-  if (result == (PyObject *)NULL) {
+  if (result == nullptr) {
     // We don't set this as an exception, since presumably the Python method
     // We don't set this as an exception, since presumably the Python method
     // itself has already triggered a Python exception.
     // itself has already triggered a Python exception.
     cerr << "Error when calling " << getter_name << "\n";
     cerr << "Error when calling " << getter_name << "\n";
@@ -789,7 +789,7 @@ Datagram DCClass::
 client_format_update(const string &field_name, DOID_TYPE do_id,
 client_format_update(const string &field_name, DOID_TYPE do_id,
                      PyObject *args) const {
                      PyObject *args) const {
   DCField *field = get_field_by_name(field_name);
   DCField *field = get_field_by_name(field_name);
-  if (field == (DCField *)NULL) {
+  if (field == nullptr) {
     ostringstream strm;
     ostringstream strm;
     strm << "No field named " << field_name << " in class " << get_name()
     strm << "No field named " << field_name << " in class " << get_name()
          << "\n";
          << "\n";
@@ -810,7 +810,7 @@ Datagram DCClass::
 ai_format_update(const string &field_name, DOID_TYPE do_id,
 ai_format_update(const string &field_name, DOID_TYPE do_id,
                  CHANNEL_TYPE to_id, CHANNEL_TYPE from_id, PyObject *args) const {
                  CHANNEL_TYPE to_id, CHANNEL_TYPE from_id, PyObject *args) const {
   DCField *field = get_field_by_name(field_name);
   DCField *field = get_field_by_name(field_name);
-  if (field == (DCField *)NULL) {
+  if (field == nullptr) {
     ostringstream strm;
     ostringstream strm;
     strm << "No field named " << field_name << " in class " << get_name()
     strm << "No field named " << field_name << " in class " << get_name()
          << "\n";
          << "\n";
@@ -832,7 +832,7 @@ Datagram DCClass::
 ai_format_update_msg_type(const string &field_name, DOID_TYPE do_id,
 ai_format_update_msg_type(const string &field_name, DOID_TYPE do_id,
                  CHANNEL_TYPE to_id, CHANNEL_TYPE from_id, int msg_type, PyObject *args) const {
                  CHANNEL_TYPE to_id, CHANNEL_TYPE from_id, int msg_type, PyObject *args) const {
   DCField *field = get_field_by_name(field_name);
   DCField *field = get_field_by_name(field_name);
-  if (field == (DCField *)NULL) {
+  if (field == nullptr) {
     ostringstream strm;
     ostringstream strm;
     strm << "No field named " << field_name << " in class " << get_name()
     strm << "No field named " << field_name << " in class " << get_name()
          << "\n";
          << "\n";
@@ -871,7 +871,7 @@ client_format_generate_CMU(PyObject *distobj, DOID_TYPE do_id,
   int num_fields = get_num_inherited_fields();
   int num_fields = get_num_inherited_fields();
   for (int i = 0; i < num_fields; ++i) {
   for (int i = 0; i < num_fields; ++i) {
     DCField *field = get_inherited_field(i);
     DCField *field = get_inherited_field(i);
-    if (field->is_required() && field->as_molecular_field() == NULL) {
+    if (field->is_required() && field->as_molecular_field() == nullptr) {
       packer.begin_pack(field);
       packer.begin_pack(field);
       if (!pack_required_field(packer, distobj, field)) {
       if (!pack_required_field(packer, distobj, field)) {
         return Datagram();
         return Datagram();
@@ -897,7 +897,7 @@ client_format_generate_CMU(PyObject *distobj, DOID_TYPE do_id,
     Py_XDECREF(py_field_name);
     Py_XDECREF(py_field_name);
 
 
     DCField *field = get_field_by_name(field_name);
     DCField *field = get_field_by_name(field_name);
-    if (field == (DCField *)NULL) {
+    if (field == nullptr) {
       ostringstream strm;
       ostringstream strm;
       strm << "No field named " << field_name << " in class " << get_name()
       strm << "No field named " << field_name << " in class " << get_name()
            << "\n";
            << "\n";
@@ -956,7 +956,7 @@ ai_format_generate(PyObject *distobj, DOID_TYPE do_id,
   int num_fields = get_num_inherited_fields();
   int num_fields = get_num_inherited_fields();
   for (int i = 0; i < num_fields; ++i) {
   for (int i = 0; i < num_fields; ++i) {
     DCField *field = get_inherited_field(i);
     DCField *field = get_inherited_field(i);
-    if (field->is_required() && field->as_molecular_field() == NULL) {
+    if (field->is_required() && field->as_molecular_field() == nullptr) {
       packer.begin_pack(field);
       packer.begin_pack(field);
       if (!pack_required_field(packer, distobj, field)) {
       if (!pack_required_field(packer, distobj, field)) {
         return Datagram();
         return Datagram();
@@ -980,7 +980,7 @@ ai_format_generate(PyObject *distobj, DOID_TYPE do_id,
       Py_XDECREF(py_field_name);
       Py_XDECREF(py_field_name);
 
 
       DCField *field = get_field_by_name(field_name);
       DCField *field = get_field_by_name(field_name);
-      if (field == (DCField *)NULL) {
+      if (field == nullptr) {
         ostringstream strm;
         ostringstream strm;
         strm << "No field named " << field_name << " in class " << get_name()
         strm << "No field named " << field_name << " in class " << get_name()
              << "\n";
              << "\n";
@@ -1042,7 +1042,7 @@ write(ostream &out, bool brief, int indent_level) const {
   }
   }
   out << "\n";
   out << "\n";
 
 
-  if (_constructor != (DCField *)NULL) {
+  if (_constructor != nullptr) {
     _constructor->write(out, brief, indent_level + 2);
     _constructor->write(out, brief, indent_level + 2);
   }
   }
 
 
@@ -1098,7 +1098,7 @@ output_instance(ostream &out, bool brief, const string &prename,
 
 
   out << " {";
   out << " {";
 
 
-  if (_constructor != (DCField *)NULL) {
+  if (_constructor != nullptr) {
     _constructor->output(out, brief);
     _constructor->output(out, brief);
     out << "; ";
     out << "; ";
   }
   }
@@ -1134,7 +1134,7 @@ generate_hash(HashGenerator &hashgen) const {
     hashgen.add_int((*pi)->get_number());
     hashgen.add_int((*pi)->get_number());
   }
   }
 
 
-  if (_constructor != (DCField *)NULL) {
+  if (_constructor != nullptr) {
     _constructor->generate_hash(hashgen);
     _constructor->generate_hash(hashgen);
   }
   }
 
 
@@ -1247,20 +1247,20 @@ shadow_inherited_field(const string &name) {
  */
  */
 bool DCClass::
 bool DCClass::
 add_field(DCField *field) {
 add_field(DCField *field) {
-  nassertr(field->get_class() == this || field->get_class() == NULL, false);
+  nassertr(field->get_class() == this || field->get_class() == nullptr, false);
   field->set_class(this);
   field->set_class(this);
-  if (_dc_file != (DCFile *)NULL) {
+  if (_dc_file != nullptr) {
     _dc_file->mark_inherited_fields_stale();
     _dc_file->mark_inherited_fields_stale();
   }
   }
 
 
   if (!field->get_name().empty()) {
   if (!field->get_name().empty()) {
     if (field->get_name() == _name) {
     if (field->get_name() == _name) {
       // This field is a constructor.
       // This field is a constructor.
-      if (_constructor != (DCField *)NULL) {
+      if (_constructor != nullptr) {
         // We already have a constructor.
         // We already have a constructor.
         return false;
         return false;
       }
       }
-      if (field->as_atomic_field() == (DCAtomicField *)NULL) {
+      if (field->as_atomic_field() == nullptr) {
         // The constructor must be an atomic field.
         // The constructor must be an atomic field.
         return false;
         return false;
       }
       }
@@ -1278,7 +1278,7 @@ add_field(DCField *field) {
     }
     }
   }
   }
 
 
-  if (_dc_file != (DCFile *)NULL &&
+  if (_dc_file != nullptr &&
       ((dc_virtual_inheritance && dc_sort_inheritance_by_file) || !is_struct())) {
       ((dc_virtual_inheritance && dc_sort_inheritance_by_file) || !is_struct())) {
     if (dc_multiple_inheritance) {
     if (dc_multiple_inheritance) {
       _dc_file->set_new_index_number(field);
       _dc_file->set_new_index_number(field);

+ 2 - 2
direct/src/dcparser/dcClassParameter.cxx

@@ -119,7 +119,7 @@ get_class() const {
  */
  */
 DCPackerInterface *DCClassParameter::
 DCPackerInterface *DCClassParameter::
 get_nested_field(int n) const {
 get_nested_field(int n) const {
-  nassertr(n >= 0 && n < (int)_nested_fields.size(), NULL);
+  nassertr(n >= 0 && n < (int)_nested_fields.size(), nullptr);
   return _nested_fields[n];
   return _nested_fields[n];
 }
 }
 
 
@@ -130,7 +130,7 @@ get_nested_field(int n) const {
 void DCClassParameter::
 void DCClassParameter::
 output_instance(ostream &out, bool brief, const string &prename,
 output_instance(ostream &out, bool brief, const string &prename,
                 const string &name, const string &postname) const {
                 const string &name, const string &postname) const {
-  if (get_typedef() != (DCTypedef *)NULL) {
+  if (get_typedef() != nullptr) {
     output_typedef_name(out, brief, prename, name, postname);
     output_typedef_name(out, brief, prename, name, postname);
 
 
   } else {
   } else {

+ 4 - 4
direct/src/dcparser/dcDeclaration.cxx

@@ -26,7 +26,7 @@ DCDeclaration::
  */
  */
 DCClass *DCDeclaration::
 DCClass *DCDeclaration::
 as_class() {
 as_class() {
-  return (DCClass *)NULL;
+  return nullptr;
 }
 }
 
 
 /**
 /**
@@ -34,7 +34,7 @@ as_class() {
  */
  */
 const DCClass *DCDeclaration::
 const DCClass *DCDeclaration::
 as_class() const {
 as_class() const {
-  return (DCClass *)NULL;
+  return nullptr;
 }
 }
 
 
 /**
 /**
@@ -42,7 +42,7 @@ as_class() const {
  */
  */
 DCSwitch *DCDeclaration::
 DCSwitch *DCDeclaration::
 as_switch() {
 as_switch() {
-  return (DCSwitch *)NULL;
+  return nullptr;
 }
 }
 
 
 /**
 /**
@@ -50,7 +50,7 @@ as_switch() {
  */
  */
 const DCSwitch *DCDeclaration::
 const DCSwitch *DCDeclaration::
 as_switch() const {
 as_switch() const {
-  return (DCSwitch *)NULL;
+  return nullptr;
 }
 }
 
 
 /**
 /**

+ 22 - 22
direct/src/dcparser/dcField.cxx

@@ -31,7 +31,7 @@
  */
  */
 DCField::
 DCField::
 DCField() :
 DCField() :
-  _dclass(NULL)
+  _dclass(nullptr)
 #ifdef WITHIN_PANDA
 #ifdef WITHIN_PANDA
   ,
   ,
   _field_update_pcollector("DCField")
   _field_update_pcollector("DCField")
@@ -108,7 +108,7 @@ as_field() const {
  */
  */
 DCAtomicField *DCField::
 DCAtomicField *DCField::
 as_atomic_field() {
 as_atomic_field() {
-  return (DCAtomicField *)NULL;
+  return nullptr;
 }
 }
 
 
 /**
 /**
@@ -117,7 +117,7 @@ as_atomic_field() {
  */
  */
 const DCAtomicField *DCField::
 const DCAtomicField *DCField::
 as_atomic_field() const {
 as_atomic_field() const {
-  return (DCAtomicField *)NULL;
+  return nullptr;
 }
 }
 
 
 /**
 /**
@@ -126,7 +126,7 @@ as_atomic_field() const {
  */
  */
 DCMolecularField *DCField::
 DCMolecularField *DCField::
 as_molecular_field() {
 as_molecular_field() {
-  return (DCMolecularField *)NULL;
+  return nullptr;
 }
 }
 
 
 /**
 /**
@@ -135,7 +135,7 @@ as_molecular_field() {
  */
  */
 const DCMolecularField *DCField::
 const DCMolecularField *DCField::
 as_molecular_field() const {
 as_molecular_field() const {
-  return (DCMolecularField *)NULL;
+  return nullptr;
 }
 }
 
 
 /**
 /**
@@ -143,7 +143,7 @@ as_molecular_field() const {
  */
  */
 DCParameter *DCField::
 DCParameter *DCField::
 as_parameter() {
 as_parameter() {
-  return (DCParameter *)NULL;
+  return nullptr;
 }
 }
 
 
 /**
 /**
@@ -151,7 +151,7 @@ as_parameter() {
  */
  */
 const DCParameter *DCField::
 const DCParameter *DCField::
 as_parameter() const {
 as_parameter() const {
-  return (DCParameter *)NULL;
+  return nullptr;
 }
 }
 
 
 /**
 /**
@@ -235,7 +235,7 @@ pack_args(DCPacker &packer, PyObject *sequence) const {
     ostringstream strm;
     ostringstream strm;
     PyObject *exc_type = PyExc_Exception;
     PyObject *exc_type = PyExc_Exception;
 
 
-    if (as_parameter() != (DCParameter *)NULL) {
+    if (as_parameter() != nullptr) {
       // If it's a parameter-type field, the value may or may not be a
       // If it's a parameter-type field, the value may or may not be a
       // sequence.
       // sequence.
       if (packer.had_pack_error()) {
       if (packer.had_pack_error()) {
@@ -251,7 +251,7 @@ pack_args(DCPacker &packer, PyObject *sequence) const {
     } else {
     } else {
       // If it's a molecular or atomic field, the value should be a sequence.
       // If it's a molecular or atomic field, the value should be a sequence.
       PyObject *tuple = PySequence_Tuple(sequence);
       PyObject *tuple = PySequence_Tuple(sequence);
-      if (tuple == (PyObject *)NULL) {
+      if (tuple == nullptr) {
         strm << "Value for " << get_name() << " not a sequence: " \
         strm << "Value for " << get_name() << " not a sequence: " \
              << get_pystr(sequence);
              << get_pystr(sequence);
         exc_type = PyExc_TypeError;
         exc_type = PyExc_TypeError;
@@ -287,8 +287,8 @@ pack_args(DCPacker &packer, PyObject *sequence) const {
  */
  */
 PyObject *DCField::
 PyObject *DCField::
 unpack_args(DCPacker &packer) const {
 unpack_args(DCPacker &packer) const {
-  nassertr(!packer.had_error(), NULL);
-  nassertr(packer.get_current_field() == this, NULL);
+  nassertr(!packer.had_error(), nullptr);
+  nassertr(packer.get_current_field() == this, nullptr);
 
 
   size_t start_byte = packer.get_num_unpacked_bytes();
   size_t start_byte = packer.get_num_unpacked_bytes();
   PyObject *object = packer.unpack_object();
   PyObject *object = packer.unpack_object();
@@ -329,7 +329,7 @@ unpack_args(DCPacker &packer) const {
   }
   }
 
 
   Py_XDECREF(object);
   Py_XDECREF(object);
-  return NULL;
+  return nullptr;
 }
 }
 #endif  // HAVE_PYTHON
 #endif  // HAVE_PYTHON
 
 
@@ -340,10 +340,10 @@ unpack_args(DCPacker &packer) const {
  */
  */
 void DCField::
 void DCField::
 receive_update(DCPacker &packer, PyObject *distobj) const {
 receive_update(DCPacker &packer, PyObject *distobj) const {
-  if (as_parameter() != (DCParameter *)NULL) {
+  if (as_parameter() != nullptr) {
     // If it's a parameter-type field, just store a new value on the object.
     // If it's a parameter-type field, just store a new value on the object.
     PyObject *value = unpack_args(packer);
     PyObject *value = unpack_args(packer);
-    if (value != (PyObject *)NULL) {
+    if (value != nullptr) {
       PyObject_SetAttrString(distobj, (char *)_name.c_str(), value);
       PyObject_SetAttrString(distobj, (char *)_name.c_str(), value);
     }
     }
     Py_DECREF(value);
     Py_DECREF(value);
@@ -362,9 +362,9 @@ receive_update(DCPacker &packer, PyObject *distobj) const {
       // method.
       // method.
       PyObject *args = unpack_args(packer);
       PyObject *args = unpack_args(packer);
 
 
-      if (args != (PyObject *)NULL) {
+      if (args != nullptr) {
         PyObject *func = PyObject_GetAttrString(distobj, (char *)_name.c_str());
         PyObject *func = PyObject_GetAttrString(distobj, (char *)_name.c_str());
-        nassertv(func != (PyObject *)NULL);
+        nassertv(func != nullptr);
 
 
         PyObject *result;
         PyObject *result;
         {
         {
@@ -499,7 +499,7 @@ pack_default_value(DCPackData &pack_data, bool &) const {
 void DCField::
 void DCField::
 set_name(const string &name) {
 set_name(const string &name) {
   DCPackerInterface::set_name(name);
   DCPackerInterface::set_name(name);
-  if (_dclass != (DCClass *)NULL) {
+  if (_dclass != nullptr) {
     _dclass->_dc_file->mark_inherited_fields_stale();
     _dclass->_dc_file->mark_inherited_fields_stale();
   }
   }
 }
 }
@@ -510,12 +510,12 @@ set_name(const string &name) {
  */
  */
 string DCField::
 string DCField::
 get_pystr(PyObject *value) {
 get_pystr(PyObject *value) {
-  if (value == NULL) {
+  if (value == nullptr) {
     return "(null)";
     return "(null)";
   }
   }
 
 
   PyObject *str = PyObject_Str(value);
   PyObject *str = PyObject_Str(value);
-  if (str != NULL) {
+  if (str != nullptr) {
 #if PY_MAJOR_VERSION >= 3
 #if PY_MAJOR_VERSION >= 3
     string result = PyUnicode_AsUTF8(str);
     string result = PyUnicode_AsUTF8(str);
 #else
 #else
@@ -526,7 +526,7 @@ get_pystr(PyObject *value) {
   }
   }
 
 
   PyObject *repr = PyObject_Repr(value);
   PyObject *repr = PyObject_Repr(value);
-  if (repr != NULL) {
+  if (repr != nullptr) {
 #if PY_MAJOR_VERSION >= 3
 #if PY_MAJOR_VERSION >= 3
     string result = PyUnicode_AsUTF8(repr);
     string result = PyUnicode_AsUTF8(repr);
 #else
 #else
@@ -536,9 +536,9 @@ get_pystr(PyObject *value) {
     return result;
     return result;
   }
   }
 
 
-  if (value->ob_type != NULL) {
+  if (value->ob_type != nullptr) {
     PyObject *typestr = PyObject_Str((PyObject *)(value->ob_type));
     PyObject *typestr = PyObject_Str((PyObject *)(value->ob_type));
-    if (typestr != NULL) {
+    if (typestr != nullptr) {
 #if PY_MAJOR_VERSION >= 3
 #if PY_MAJOR_VERSION >= 3
       string result = PyUnicode_AsUTF8(typestr);
       string result = PyUnicode_AsUTF8(typestr);
 #else
 #else

+ 12 - 12
direct/src/dcparser/dcFile.cxx

@@ -123,7 +123,7 @@ read(Filename filename) {
   filename.set_text();
   filename.set_text();
   VirtualFileSystem *vfs = VirtualFileSystem::get_global_ptr();
   VirtualFileSystem *vfs = VirtualFileSystem::get_global_ptr();
   istream *in = vfs->open_read_file(filename, true);
   istream *in = vfs->open_read_file(filename, true);
-  if (in == (istream *)NULL) {
+  if (in == nullptr) {
     cerr << "Cannot open " << filename << " for reading.\n";
     cerr << "Cannot open " << filename << " for reading.\n";
     return false;
     return false;
   }
   }
@@ -247,7 +247,7 @@ get_num_classes() const {
  */
  */
 DCClass *DCFile::
 DCClass *DCFile::
 get_class(int n) const {
 get_class(int n) const {
-  nassertr(n >= 0 && n < (int)_classes.size(), NULL);
+  nassertr(n >= 0 && n < (int)_classes.size(), nullptr);
   return _classes[n];
   return _classes[n];
 }
 }
 
 
@@ -263,7 +263,7 @@ get_class_by_name(const string &name) const {
     return (*ni).second->as_class();
     return (*ni).second->as_class();
   }
   }
 
 
-  return (DCClass *)NULL;
+  return nullptr;
 }
 }
 
 
 /**
 /**
@@ -278,7 +278,7 @@ get_switch_by_name(const string &name) const {
     return (*ni).second->as_switch();
     return (*ni).second->as_switch();
   }
   }
 
 
-  return (DCSwitch *)NULL;
+  return nullptr;
 }
 }
 
 
 /**
 /**
@@ -291,13 +291,13 @@ get_switch_by_name(const string &name) const {
  */
  */
 DCField *DCFile::
 DCField *DCFile::
 get_field_by_index(int index_number) const {
 get_field_by_index(int index_number) const {
-  nassertr(dc_multiple_inheritance, NULL);
+  nassertr(dc_multiple_inheritance, nullptr);
 
 
   if (index_number >= 0 && index_number < (int)_fields_by_index.size()) {
   if (index_number >= 0 && index_number < (int)_fields_by_index.size()) {
     return _fields_by_index[index_number];
     return _fields_by_index[index_number];
   }
   }
 
 
-  return NULL;
+  return nullptr;
 }
 }
 
 
 /**
 /**
@@ -352,7 +352,7 @@ get_num_typedefs() const {
  */
  */
 DCTypedef *DCFile::
 DCTypedef *DCFile::
 get_typedef(int n) const {
 get_typedef(int n) const {
-  nassertr(n >= 0 && n < (int)_typedefs.size(), NULL);
+  nassertr(n >= 0 && n < (int)_typedefs.size(), nullptr);
   return _typedefs[n];
   return _typedefs[n];
 }
 }
 
 
@@ -368,7 +368,7 @@ get_typedef_by_name(const string &name) const {
     return (*ni).second;
     return (*ni).second;
   }
   }
 
 
-  return NULL;
+  return nullptr;
 }
 }
 
 
 /**
 /**
@@ -394,9 +394,9 @@ get_keyword(int n) const {
 const DCKeyword *DCFile::
 const DCKeyword *DCFile::
 get_keyword_by_name(const string &name) const {
 get_keyword_by_name(const string &name) const {
   const DCKeyword *keyword = _keywords.get_keyword_by_name(name);
   const DCKeyword *keyword = _keywords.get_keyword_by_name(name);
-  if (keyword == (const DCKeyword *)NULL) {
+  if (keyword == nullptr) {
     keyword = _default_keywords.get_keyword_by_name(name);
     keyword = _default_keywords.get_keyword_by_name(name);
-    if (keyword != (const DCKeyword *)NULL) {
+    if (keyword != nullptr) {
       // One of the historical default keywords was used, but wasn't defined.
       // One of the historical default keywords was used, but wasn't defined.
       // Define it implicitly right now.
       // Define it implicitly right now.
       ((DCFile *)this)->_keywords.add_keyword(keyword);
       ((DCFile *)this)->_keywords.add_keyword(keyword);
@@ -612,11 +612,11 @@ setup_default_keywords() {
     { "clrecv", 0x0040 },
     { "clrecv", 0x0040 },
     { "ownsend", 0x0080 },
     { "ownsend", 0x0080 },
     { "airecv", 0x0100 },
     { "airecv", 0x0100 },
-    { NULL, 0 }
+    { nullptr, 0 }
   };
   };
 
 
   _default_keywords.clear_keywords();
   _default_keywords.clear_keywords();
-  for (int i = 0; default_keywords[i].name != NULL; ++i) {
+  for (int i = 0; default_keywords[i].name != nullptr; ++i) {
     DCKeyword *keyword =
     DCKeyword *keyword =
       new DCKeyword(default_keywords[i].name,
       new DCKeyword(default_keywords[i].name,
                     default_keywords[i].flag);
                     default_keywords[i].flag);

+ 2 - 2
direct/src/dcparser/dcKeywordList.cxx

@@ -83,7 +83,7 @@ get_num_keywords() const {
  */
  */
 const DCKeyword *DCKeywordList::
 const DCKeyword *DCKeywordList::
 get_keyword(int n) const {
 get_keyword(int n) const {
-  nassertr(n >= 0 && n < (int)_keywords.size(), NULL);
+  nassertr(n >= 0 && n < (int)_keywords.size(), nullptr);
   return _keywords[n];
   return _keywords[n];
 }
 }
 
 
@@ -99,7 +99,7 @@ get_keyword_by_name(const string &name) const {
     return (*ni).second;
     return (*ni).second;
   }
   }
 
 
-  return NULL;
+  return nullptr;
 }
 }
 
 
 /**
 /**

+ 5 - 5
direct/src/dcparser/dcLexer.lxx

@@ -35,7 +35,7 @@ static int error_count = 0;
 static int warning_count = 0;
 static int warning_count = 0;
 
 
 // This is the pointer to the current input stream.
 // This is the pointer to the current input stream.
-static istream *input_p = NULL;
+static istream *input_p = nullptr;
 
 
 // This is the name of the dc file we're parsing.  We keep it so we
 // This is the name of the dc file we're parsing.  We keep it so we
 // can print it out for error messages.
 // can print it out for error messages.
@@ -129,7 +129,7 @@ dcyywarning(const string &msg) {
 // stdio FILE pointer.  This is flex-specific.
 // stdio FILE pointer.  This is flex-specific.
 static void
 static void
 input_chars(char *buffer, int &result, int max_size) {
 input_chars(char *buffer, int &result, int max_size) {
-  nassertv(input_p != NULL);
+  nassertv(input_p != nullptr);
   if (*input_p) {
   if (*input_p) {
     input_p->read(buffer, max_size);
     input_p->read(buffer, max_size);
     result = input_p->gcount();
     result = input_p->gcount();
@@ -150,7 +150,7 @@ input_chars(char *buffer, int &result, int max_size) {
 
 
       // Truncate it at the newline.
       // Truncate it at the newline.
       char *end = strchr(current_line, '\n');
       char *end = strchr(current_line, '\n');
-      if (end != NULL) {
+      if (end != nullptr) {
         *end = '\0';
         *end = '\0';
       }
       }
     }
     }
@@ -733,9 +733,9 @@ REALNUM              ([+-]?(([0-9]+[.])|([0-9]*[.][0-9]+))([eE][+-]?[0-9]+)?)
   accept();
   accept();
   dcyylval.str = dcyytext;
   dcyylval.str = dcyytext;
 
 
-  if (dc_file != (DCFile *)NULL) {
+  if (dc_file != nullptr) {
     const DCKeyword *keyword = dc_file->get_keyword_by_name(dcyylval.str);
     const DCKeyword *keyword = dc_file->get_keyword_by_name(dcyylval.str);
-    if (keyword != (DCKeyword *)NULL) {
+    if (keyword != nullptr) {
       dcyylval.u.keyword = keyword;
       dcyylval.u.keyword = keyword;
       return KEYWORD;
       return KEYWORD;
     }
     }

+ 2 - 2
direct/src/dcparser/dcMolecularField.cxx

@@ -59,7 +59,7 @@ get_num_atomics() const {
  */
  */
 DCAtomicField *DCMolecularField::
 DCAtomicField *DCMolecularField::
 get_atomic(int n) const {
 get_atomic(int n) const {
-  nassertr(n >= 0 && n < (int)_fields.size(), NULL);
+  nassertr(n >= 0 && n < (int)_fields.size(), nullptr);
   return _fields[n];
   return _fields[n];
 }
 }
 
 
@@ -161,7 +161,7 @@ generate_hash(HashGenerator &hashgen) const {
  */
  */
 DCPackerInterface *DCMolecularField::
 DCPackerInterface *DCMolecularField::
 get_nested_field(int n) const {
 get_nested_field(int n) const {
-  nassertr(n >= 0 && n < (int)_nested_fields.size(), NULL);
+  nassertr(n >= 0 && n < (int)_nested_fields.size(), nullptr);
   return _nested_fields[n];
   return _nested_fields[n];
 }
 }
 
 

+ 4 - 4
direct/src/dcparser/dcPackData.I

@@ -16,7 +16,7 @@
  */
  */
 INLINE DCPackData::
 INLINE DCPackData::
 DCPackData() {
 DCPackData() {
-  _buffer = NULL;
+  _buffer = nullptr;
   _allocated_size = 0;
   _allocated_size = 0;
   _used_length = 0;
   _used_length = 0;
 }
 }
@@ -26,7 +26,7 @@ DCPackData() {
  */
  */
 INLINE DCPackData::
 INLINE DCPackData::
 ~DCPackData() {
 ~DCPackData() {
-  if (_buffer != (const char *)NULL) {
+  if (_buffer != nullptr) {
     delete[] _buffer;
     delete[] _buffer;
   }
   }
 }
 }
@@ -82,7 +82,7 @@ rewrite_data(size_t position, const char *buffer, size_t size) {
  */
  */
 INLINE char *DCPackData::
 INLINE char *DCPackData::
 get_rewrite_pointer(size_t position, size_t size) {
 get_rewrite_pointer(size_t position, size_t size) {
-  nassertr(position + size <= _used_length, NULL);
+  nassertr(position + size <= _used_length, nullptr);
   return _buffer + position;
   return _buffer + position;
 }
 }
 
 
@@ -129,7 +129,7 @@ INLINE char *DCPackData::
 take_data() {
 take_data() {
   char *data = _buffer;
   char *data = _buffer;
 
 
-  _buffer = NULL;
+  _buffer = nullptr;
   _allocated_size = 0;
   _allocated_size = 0;
   _used_length = 0;
   _used_length = 0;
 
 

+ 1 - 1
direct/src/dcparser/dcPackData.cxx

@@ -27,7 +27,7 @@ set_used_length(size_t size) {
     if (_used_length > 0) {
     if (_used_length > 0) {
       memcpy(new_buf, _buffer, _used_length);
       memcpy(new_buf, _buffer, _used_length);
     }
     }
-    if (_buffer != NULL) {
+    if (_buffer != nullptr) {
       delete[] _buffer;
       delete[] _buffer;
     }
     }
     _buffer = new_buf;
     _buffer = new_buf;

+ 40 - 40
direct/src/dcparser/dcPacker.I

@@ -24,7 +24,7 @@ clear_data() {
     delete[] _unpack_data;
     delete[] _unpack_data;
     _owns_unpack_data = false;
     _owns_unpack_data = false;
   }
   }
-  _unpack_data = NULL;
+  _unpack_data = nullptr;
 }
 }
 
 
 /**
 /**
@@ -35,7 +35,7 @@ clear_data() {
  */
  */
 INLINE bool DCPacker::
 INLINE bool DCPacker::
 has_nested_fields() const {
 has_nested_fields() const {
-  if (_current_field == NULL) {
+  if (_current_field == nullptr) {
     return false;
     return false;
   } else {
   } else {
     return _current_field->has_nested_fields();
     return _current_field->has_nested_fields();
@@ -65,7 +65,7 @@ get_num_nested_fields() const {
  */
  */
 INLINE bool DCPacker::
 INLINE bool DCPacker::
 more_nested_fields() const {
 more_nested_fields() const {
-  return (_current_field != (DCPackerInterface *)NULL && !_pack_error);
+  return (_current_field != nullptr && !_pack_error);
 }
 }
 
 
 /**
 /**
@@ -112,7 +112,7 @@ get_last_switch() const {
  */
  */
 INLINE DCPackType DCPacker::
 INLINE DCPackType DCPacker::
 get_pack_type() const {
 get_pack_type() const {
-  if (_current_field == NULL) {
+  if (_current_field == nullptr) {
     return PT_invalid;
     return PT_invalid;
   } else {
   } else {
     return _current_field->get_pack_type();
     return _current_field->get_pack_type();
@@ -125,7 +125,7 @@ get_pack_type() const {
  */
  */
 INLINE string DCPacker::
 INLINE string DCPacker::
 get_current_field_name() const {
 get_current_field_name() const {
-  if (_current_field == NULL) {
+  if (_current_field == nullptr) {
     return string();
     return string();
   } else {
   } else {
     return _current_field->get_name();
     return _current_field->get_name();
@@ -138,7 +138,7 @@ get_current_field_name() const {
 INLINE void DCPacker::
 INLINE void DCPacker::
 pack_double(double value) {
 pack_double(double value) {
   nassertv(_mode == M_pack || _mode == M_repack);
   nassertv(_mode == M_pack || _mode == M_repack);
-  if (_current_field == NULL) {
+  if (_current_field == nullptr) {
     _pack_error = true;
     _pack_error = true;
   } else {
   } else {
     _current_field->pack_double(_pack_data, value, _pack_error, _range_error);
     _current_field->pack_double(_pack_data, value, _pack_error, _range_error);
@@ -152,7 +152,7 @@ pack_double(double value) {
 INLINE void DCPacker::
 INLINE void DCPacker::
 pack_int(int value) {
 pack_int(int value) {
   nassertv(_mode == M_pack || _mode == M_repack);
   nassertv(_mode == M_pack || _mode == M_repack);
-  if (_current_field == NULL) {
+  if (_current_field == nullptr) {
     _pack_error = true;
     _pack_error = true;
   } else {
   } else {
     _current_field->pack_int(_pack_data, value, _pack_error, _range_error);
     _current_field->pack_int(_pack_data, value, _pack_error, _range_error);
@@ -166,7 +166,7 @@ pack_int(int value) {
 INLINE void DCPacker::
 INLINE void DCPacker::
 pack_uint(unsigned int value) {
 pack_uint(unsigned int value) {
   nassertv(_mode == M_pack || _mode == M_repack);
   nassertv(_mode == M_pack || _mode == M_repack);
-  if (_current_field == NULL) {
+  if (_current_field == nullptr) {
     _pack_error = true;
     _pack_error = true;
   } else {
   } else {
     _current_field->pack_uint(_pack_data, value, _pack_error, _range_error);
     _current_field->pack_uint(_pack_data, value, _pack_error, _range_error);
@@ -180,7 +180,7 @@ pack_uint(unsigned int value) {
 INLINE void DCPacker::
 INLINE void DCPacker::
 pack_int64(int64_t value) {
 pack_int64(int64_t value) {
   nassertv(_mode == M_pack || _mode == M_repack);
   nassertv(_mode == M_pack || _mode == M_repack);
-  if (_current_field == NULL) {
+  if (_current_field == nullptr) {
     _pack_error = true;
     _pack_error = true;
   } else {
   } else {
     _current_field->pack_int64(_pack_data, value, _pack_error, _range_error);
     _current_field->pack_int64(_pack_data, value, _pack_error, _range_error);
@@ -194,7 +194,7 @@ pack_int64(int64_t value) {
 INLINE void DCPacker::
 INLINE void DCPacker::
 pack_uint64(uint64_t value) {
 pack_uint64(uint64_t value) {
   nassertv(_mode == M_pack || _mode == M_repack);
   nassertv(_mode == M_pack || _mode == M_repack);
-  if (_current_field == NULL) {
+  if (_current_field == nullptr) {
     _pack_error = true;
     _pack_error = true;
   } else {
   } else {
     _current_field->pack_uint64(_pack_data, value, _pack_error, _range_error);
     _current_field->pack_uint64(_pack_data, value, _pack_error, _range_error);
@@ -208,7 +208,7 @@ pack_uint64(uint64_t value) {
 INLINE void DCPacker::
 INLINE void DCPacker::
 pack_string(const string &value) {
 pack_string(const string &value) {
   nassertv(_mode == M_pack || _mode == M_repack);
   nassertv(_mode == M_pack || _mode == M_repack);
-  if (_current_field == NULL) {
+  if (_current_field == nullptr) {
     _pack_error = true;
     _pack_error = true;
   } else {
   } else {
     _current_field->pack_string(_pack_data, value, _pack_error, _range_error);
     _current_field->pack_string(_pack_data, value, _pack_error, _range_error);
@@ -223,7 +223,7 @@ pack_string(const string &value) {
 INLINE void DCPacker::
 INLINE void DCPacker::
 pack_literal_value(const string &value) {
 pack_literal_value(const string &value) {
   nassertv(_mode == M_pack || _mode == M_repack);
   nassertv(_mode == M_pack || _mode == M_repack);
-  if (_current_field == NULL) {
+  if (_current_field == nullptr) {
     _pack_error = true;
     _pack_error = true;
   } else {
   } else {
     _pack_data.append_data(value.data(), value.length());
     _pack_data.append_data(value.data(), value.length());
@@ -238,7 +238,7 @@ INLINE double DCPacker::
 unpack_double() {
 unpack_double() {
   double value = 0.0;
   double value = 0.0;
   nassertr(_mode == M_unpack, value);
   nassertr(_mode == M_unpack, value);
-  if (_current_field == NULL) {
+  if (_current_field == nullptr) {
     _pack_error = true;
     _pack_error = true;
 
 
   } else {
   } else {
@@ -257,7 +257,7 @@ INLINE int DCPacker::
 unpack_int() {
 unpack_int() {
   int value = 0;
   int value = 0;
   nassertr(_mode == M_unpack, value);
   nassertr(_mode == M_unpack, value);
-  if (_current_field == NULL) {
+  if (_current_field == nullptr) {
     _pack_error = true;
     _pack_error = true;
 
 
   } else {
   } else {
@@ -276,7 +276,7 @@ INLINE unsigned int DCPacker::
 unpack_uint() {
 unpack_uint() {
   unsigned int value = 0;
   unsigned int value = 0;
   nassertr(_mode == M_unpack, value);
   nassertr(_mode == M_unpack, value);
-  if (_current_field == NULL) {
+  if (_current_field == nullptr) {
     _pack_error = true;
     _pack_error = true;
 
 
   } else {
   } else {
@@ -295,7 +295,7 @@ INLINE int64_t DCPacker::
 unpack_int64() {
 unpack_int64() {
   int64_t value = 0;
   int64_t value = 0;
   nassertr(_mode == M_unpack, value);
   nassertr(_mode == M_unpack, value);
-  if (_current_field == NULL) {
+  if (_current_field == nullptr) {
     _pack_error = true;
     _pack_error = true;
 
 
   } else {
   } else {
@@ -314,7 +314,7 @@ INLINE uint64_t DCPacker::
 unpack_uint64() {
 unpack_uint64() {
   uint64_t value = 0;
   uint64_t value = 0;
   nassertr(_mode == M_unpack, value);
   nassertr(_mode == M_unpack, value);
-  if (_current_field == NULL) {
+  if (_current_field == nullptr) {
     _pack_error = true;
     _pack_error = true;
 
 
   } else {
   } else {
@@ -333,7 +333,7 @@ INLINE string DCPacker::
 unpack_string() {
 unpack_string() {
   string value;
   string value;
   nassertr(_mode == M_unpack, value);
   nassertr(_mode == M_unpack, value);
-  if (_current_field == NULL) {
+  if (_current_field == nullptr) {
     _pack_error = true;
     _pack_error = true;
 
 
   } else {
   } else {
@@ -363,7 +363,7 @@ unpack_literal_value() {
 INLINE void DCPacker::
 INLINE void DCPacker::
 unpack_double(double &value) {
 unpack_double(double &value) {
   nassertv(_mode == M_unpack);
   nassertv(_mode == M_unpack);
-  if (_current_field == NULL) {
+  if (_current_field == nullptr) {
     _pack_error = true;
     _pack_error = true;
 
 
   } else {
   } else {
@@ -379,7 +379,7 @@ unpack_double(double &value) {
 INLINE void DCPacker::
 INLINE void DCPacker::
 unpack_int(int &value) {
 unpack_int(int &value) {
   nassertv(_mode == M_unpack);
   nassertv(_mode == M_unpack);
-  if (_current_field == NULL) {
+  if (_current_field == nullptr) {
     _pack_error = true;
     _pack_error = true;
 
 
   } else {
   } else {
@@ -395,7 +395,7 @@ unpack_int(int &value) {
 INLINE void DCPacker::
 INLINE void DCPacker::
 unpack_uint(unsigned int &value) {
 unpack_uint(unsigned int &value) {
   nassertv(_mode == M_unpack);
   nassertv(_mode == M_unpack);
-  if (_current_field == NULL) {
+  if (_current_field == nullptr) {
     _pack_error = true;
     _pack_error = true;
 
 
   } else {
   } else {
@@ -411,7 +411,7 @@ unpack_uint(unsigned int &value) {
 INLINE void DCPacker::
 INLINE void DCPacker::
 unpack_int64(int64_t &value) {
 unpack_int64(int64_t &value) {
   nassertv(_mode == M_unpack);
   nassertv(_mode == M_unpack);
-  if (_current_field == NULL) {
+  if (_current_field == nullptr) {
     _pack_error = true;
     _pack_error = true;
 
 
   } else {
   } else {
@@ -427,7 +427,7 @@ unpack_int64(int64_t &value) {
 INLINE void DCPacker::
 INLINE void DCPacker::
 unpack_uint64(uint64_t &value) {
 unpack_uint64(uint64_t &value) {
   nassertv(_mode == M_unpack);
   nassertv(_mode == M_unpack);
-  if (_current_field == NULL) {
+  if (_current_field == nullptr) {
     _pack_error = true;
     _pack_error = true;
 
 
   } else {
   } else {
@@ -443,7 +443,7 @@ unpack_uint64(uint64_t &value) {
 INLINE void DCPacker::
 INLINE void DCPacker::
 unpack_string(string &value) {
 unpack_string(string &value) {
   nassertv(_mode == M_unpack);
   nassertv(_mode == M_unpack);
-  if (_current_field == NULL) {
+  if (_current_field == nullptr) {
     _pack_error = true;
     _pack_error = true;
 
 
   } else {
   } else {
@@ -613,7 +613,7 @@ append_data(const char *buffer, size_t size) {
  */
  */
 INLINE char *DCPacker::
 INLINE char *DCPacker::
 get_write_pointer(size_t size) {
 get_write_pointer(size_t size) {
-  nassertr(_mode == M_idle, NULL);
+  nassertr(_mode == M_idle, nullptr);
   return _pack_data.get_write_pointer(size);
   return _pack_data.get_write_pointer(size);
 }
 }
 
 
@@ -773,7 +773,7 @@ raw_unpack_int64() {
  */
  */
 INLINE void DCPacker::
 INLINE void DCPacker::
 raw_unpack_int8(int &value) {
 raw_unpack_int8(int &value) {
-  nassertv(_mode == M_idle && _unpack_data != NULL);
+  nassertv(_mode == M_idle && _unpack_data != nullptr);
   if (_unpack_p + 1 > _unpack_length) {
   if (_unpack_p + 1 > _unpack_length) {
     _pack_error = true;
     _pack_error = true;
     return;
     return;
@@ -787,7 +787,7 @@ raw_unpack_int8(int &value) {
  */
  */
 INLINE void DCPacker::
 INLINE void DCPacker::
 raw_unpack_int16(int &value) {
 raw_unpack_int16(int &value) {
-  nassertv(_mode == M_idle && _unpack_data != NULL);
+  nassertv(_mode == M_idle && _unpack_data != nullptr);
   if (_unpack_p + 2 > _unpack_length) {
   if (_unpack_p + 2 > _unpack_length) {
     _pack_error = true;
     _pack_error = true;
     return;
     return;
@@ -801,7 +801,7 @@ raw_unpack_int16(int &value) {
  */
  */
 INLINE void DCPacker::
 INLINE void DCPacker::
 raw_unpack_int32(int &value) {
 raw_unpack_int32(int &value) {
-  nassertv(_mode == M_idle && _unpack_data != NULL);
+  nassertv(_mode == M_idle && _unpack_data != nullptr);
   if (_unpack_p + 4 > _unpack_length) {
   if (_unpack_p + 4 > _unpack_length) {
     _pack_error = true;
     _pack_error = true;
     return;
     return;
@@ -875,7 +875,7 @@ raw_unpack_string() {
  */
  */
 INLINE void DCPacker::
 INLINE void DCPacker::
 raw_unpack_int64(int64_t &value) {
 raw_unpack_int64(int64_t &value) {
-  nassertv(_mode == M_idle && _unpack_data != NULL);
+  nassertv(_mode == M_idle && _unpack_data != nullptr);
   if (_unpack_p + 8 > _unpack_length) {
   if (_unpack_p + 8 > _unpack_length) {
     _pack_error = true;
     _pack_error = true;
     return;
     return;
@@ -889,7 +889,7 @@ raw_unpack_int64(int64_t &value) {
  */
  */
 INLINE void DCPacker::
 INLINE void DCPacker::
 raw_unpack_uint8(unsigned int &value) {
 raw_unpack_uint8(unsigned int &value) {
-  nassertv(_mode == M_idle && _unpack_data != NULL);
+  nassertv(_mode == M_idle && _unpack_data != nullptr);
   if (_unpack_p + 1 > _unpack_length) {
   if (_unpack_p + 1 > _unpack_length) {
     _pack_error = true;
     _pack_error = true;
     return;
     return;
@@ -903,7 +903,7 @@ raw_unpack_uint8(unsigned int &value) {
  */
  */
 INLINE void DCPacker::
 INLINE void DCPacker::
 raw_unpack_uint16(unsigned int &value) {
 raw_unpack_uint16(unsigned int &value) {
-  nassertv(_mode == M_idle && _unpack_data != NULL);
+  nassertv(_mode == M_idle && _unpack_data != nullptr);
   if (_unpack_p + 2 > _unpack_length) {
   if (_unpack_p + 2 > _unpack_length) {
     _pack_error = true;
     _pack_error = true;
     return;
     return;
@@ -917,7 +917,7 @@ raw_unpack_uint16(unsigned int &value) {
  */
  */
 INLINE void DCPacker::
 INLINE void DCPacker::
 raw_unpack_uint32(unsigned int &value) {
 raw_unpack_uint32(unsigned int &value) {
-  nassertv(_mode == M_idle && _unpack_data != NULL);
+  nassertv(_mode == M_idle && _unpack_data != nullptr);
   if (_unpack_p + 4 > _unpack_length) {
   if (_unpack_p + 4 > _unpack_length) {
     _pack_error = true;
     _pack_error = true;
     return;
     return;
@@ -931,7 +931,7 @@ raw_unpack_uint32(unsigned int &value) {
  */
  */
 INLINE void DCPacker::
 INLINE void DCPacker::
 raw_unpack_uint64(uint64_t &value) {
 raw_unpack_uint64(uint64_t &value) {
-  nassertv(_mode == M_idle && _unpack_data != NULL);
+  nassertv(_mode == M_idle && _unpack_data != nullptr);
   if (_unpack_p + 8 > _unpack_length) {
   if (_unpack_p + 8 > _unpack_length) {
     _pack_error = true;
     _pack_error = true;
     return;
     return;
@@ -945,7 +945,7 @@ raw_unpack_uint64(uint64_t &value) {
  */
  */
 INLINE void DCPacker::
 INLINE void DCPacker::
 raw_unpack_float64(double &value) {
 raw_unpack_float64(double &value) {
-  nassertv(_mode == M_idle && _unpack_data != NULL);
+  nassertv(_mode == M_idle && _unpack_data != nullptr);
   if (_unpack_p + 8 > _unpack_length) {
   if (_unpack_p + 8 > _unpack_length) {
     _pack_error = true;
     _pack_error = true;
     return;
     return;
@@ -959,7 +959,7 @@ raw_unpack_float64(double &value) {
  */
  */
 INLINE void DCPacker::
 INLINE void DCPacker::
 raw_unpack_string(string &value) {
 raw_unpack_string(string &value) {
-  nassertv(_mode == M_idle && _unpack_data != NULL);
+  nassertv(_mode == M_idle && _unpack_data != nullptr);
   unsigned int string_length = raw_unpack_uint16();
   unsigned int string_length = raw_unpack_uint16();
 
 
   if (_unpack_p + string_length > _unpack_length) {
   if (_unpack_p + string_length > _unpack_length) {
@@ -981,13 +981,13 @@ advance() {
       _current_field_index >= _num_nested_fields) {
       _current_field_index >= _num_nested_fields) {
     // Done with all the fields on this parent.  The caller must now call
     // Done with all the fields on this parent.  The caller must now call
     // pop().
     // pop().
-    _current_field = NULL;
+    _current_field = nullptr;
 
 
     // But if the parent is a switch record, we make a special case so we can
     // But if the parent is a switch record, we make a special case so we can
     // get the alternate fields.
     // get the alternate fields.
-    if (_current_parent != (DCPackerInterface *)NULL) {
+    if (_current_parent != nullptr) {
       const DCSwitchParameter *switch_parameter = ((DCPackerInterface *)_current_parent)->as_switch_parameter();
       const DCSwitchParameter *switch_parameter = ((DCPackerInterface *)_current_parent)->as_switch_parameter();
-      if (switch_parameter != (DCSwitchParameter *)NULL) {
+      if (switch_parameter != nullptr) {
         handle_switch(switch_parameter);
         handle_switch(switch_parameter);
       }
       }
     }
     }
@@ -995,7 +995,7 @@ advance() {
   } else if (_pop_marker != 0 && _unpack_p >= _pop_marker) {
   } else if (_pop_marker != 0 && _unpack_p >= _pop_marker) {
     // Done with all the fields on this parent.  The caller must now call
     // Done with all the fields on this parent.  The caller must now call
     // pop().
     // pop().
-    _current_field = NULL;
+    _current_field = nullptr;
 
 
   } else {
   } else {
     // We have another field to advance to.
     // We have another field to advance to.
@@ -1009,7 +1009,7 @@ advance() {
  */
  */
 INLINE void *DCPacker::StackElement::
 INLINE void *DCPacker::StackElement::
 operator new(size_t size) {
 operator new(size_t size) {
-  if (_deleted_chain != (DCPacker::StackElement *)NULL) {
+  if (_deleted_chain != nullptr) {
     StackElement *obj = _deleted_chain;
     StackElement *obj = _deleted_chain;
     _deleted_chain = _deleted_chain->_next;
     _deleted_chain = _deleted_chain->_next;
     return obj;
     return obj;

+ 74 - 74
direct/src/dcparser/dcPacker.cxx

@@ -23,7 +23,7 @@
 #include "py_panda.h"
 #include "py_panda.h"
 #endif
 #endif
 
 
-DCPacker::StackElement *DCPacker::StackElement::_deleted_chain = NULL;
+DCPacker::StackElement *DCPacker::StackElement::_deleted_chain = nullptr;
 int DCPacker::StackElement::_num_ever_allocated = 0;
 int DCPacker::StackElement::_num_ever_allocated = 0;
 
 
 /**
 /**
@@ -32,15 +32,15 @@ int DCPacker::StackElement::_num_ever_allocated = 0;
 DCPacker::
 DCPacker::
 DCPacker() {
 DCPacker() {
   _mode = M_idle;
   _mode = M_idle;
-  _unpack_data = NULL;
+  _unpack_data = nullptr;
   _unpack_length = 0;
   _unpack_length = 0;
   _owns_unpack_data = false;
   _owns_unpack_data = false;
   _unpack_p = 0;
   _unpack_p = 0;
-  _live_catalog = NULL;
+  _live_catalog = nullptr;
   _parse_error = false;
   _parse_error = false;
   _pack_error = false;
   _pack_error = false;
   _range_error = false;
   _range_error = false;
-  _stack = NULL;
+  _stack = nullptr;
 
 
   clear();
   clear();
 }
 }
@@ -73,11 +73,11 @@ begin_pack(const DCPackerInterface *root) {
   _range_error = false;
   _range_error = false;
 
 
   _root = root;
   _root = root;
-  _catalog = NULL;
-  _live_catalog = NULL;
+  _catalog = nullptr;
+  _live_catalog = nullptr;
 
 
   _current_field = root;
   _current_field = root;
-  _current_parent = NULL;
+  _current_parent = nullptr;
   _current_field_index = 0;
   _current_field_index = 0;
   _num_nested_fields = 0;
   _num_nested_fields = 0;
 }
 }
@@ -94,7 +94,7 @@ end_pack() {
 
 
   _mode = M_idle;
   _mode = M_idle;
 
 
-  if (_stack != NULL || _current_field != NULL || _current_parent != NULL) {
+  if (_stack != nullptr || _current_field != nullptr || _current_parent != nullptr) {
     _pack_error = true;
     _pack_error = true;
   }
   }
 
 
@@ -146,7 +146,7 @@ set_unpack_data(const char *unpack_data, size_t unpack_length,
 void DCPacker::
 void DCPacker::
 begin_unpack(const DCPackerInterface *root) {
 begin_unpack(const DCPackerInterface *root) {
   nassertv(_mode == M_idle);
   nassertv(_mode == M_idle);
-  nassertv(_unpack_data != NULL);
+  nassertv(_unpack_data != nullptr);
 
 
   _mode = M_unpack;
   _mode = M_unpack;
   _parse_error = false;
   _parse_error = false;
@@ -154,11 +154,11 @@ begin_unpack(const DCPackerInterface *root) {
   _range_error = false;
   _range_error = false;
 
 
   _root = root;
   _root = root;
-  _catalog = NULL;
-  _live_catalog = NULL;
+  _catalog = nullptr;
+  _live_catalog = nullptr;
 
 
   _current_field = root;
   _current_field = root;
-  _current_parent = NULL;
+  _current_parent = nullptr;
   _current_field_index = 0;
   _current_field_index = 0;
   _num_nested_fields = 0;
   _num_nested_fields = 0;
 }
 }
@@ -175,13 +175,13 @@ end_unpack() {
 
 
   _mode = M_idle;
   _mode = M_idle;
 
 
-  if (_stack != NULL || _current_field != NULL || _current_parent != NULL) {
+  if (_stack != nullptr || _current_field != nullptr || _current_parent != nullptr) {
     // This happens if we have not unpacked all of the fields.  However, this
     // This happens if we have not unpacked all of the fields.  However, this
     // is not an error if we have called seek() during the unpack session (in
     // is not an error if we have called seek() during the unpack session (in
     // which case the _catalog will be non-NULL).  On the other hand, if the
     // which case the _catalog will be non-NULL).  On the other hand, if the
     // catalog is still NULL, then we have never called seek() and it is an
     // catalog is still NULL, then we have never called seek() and it is an
     // error not to unpack all values.
     // error not to unpack all values.
-    if (_catalog == (DCPackerCatalog *)NULL) {
+    if (_catalog == nullptr) {
       _pack_error = true;
       _pack_error = true;
     }
     }
   }
   }
@@ -206,7 +206,7 @@ end_unpack() {
 void DCPacker::
 void DCPacker::
 begin_repack(const DCPackerInterface *root) {
 begin_repack(const DCPackerInterface *root) {
   nassertv(_mode == M_idle);
   nassertv(_mode == M_idle);
-  nassertv(_unpack_data != NULL);
+  nassertv(_unpack_data != nullptr);
   nassertv(_unpack_p == 0);
   nassertv(_unpack_p == 0);
 
 
   _mode = M_repack;
   _mode = M_repack;
@@ -220,14 +220,14 @@ begin_repack(const DCPackerInterface *root) {
   _root = root;
   _root = root;
   _catalog = _root->get_catalog();
   _catalog = _root->get_catalog();
   _live_catalog = _catalog->get_live_catalog(_unpack_data, _unpack_length);
   _live_catalog = _catalog->get_live_catalog(_unpack_data, _unpack_length);
-  if (_live_catalog == NULL) {
+  if (_live_catalog == nullptr) {
     _pack_error = true;
     _pack_error = true;
   }
   }
 
 
   // We don't begin at the first field in repack mode.  Instead, you must
   // We don't begin at the first field in repack mode.  Instead, you must
   // explicitly call seek().
   // explicitly call seek().
-  _current_field = NULL;
-  _current_parent = NULL;
+  _current_field = nullptr;
+  _current_parent = nullptr;
   _current_field_index = 0;
   _current_field_index = 0;
   _num_nested_fields = 0;
   _num_nested_fields = 0;
 }
 }
@@ -262,12 +262,12 @@ end_repack() {
  */
  */
 bool DCPacker::
 bool DCPacker::
 seek(const string &field_name) {
 seek(const string &field_name) {
-  if (_catalog == (DCPackerCatalog *)NULL) {
+  if (_catalog == nullptr) {
     _catalog = _root->get_catalog();
     _catalog = _root->get_catalog();
     _live_catalog = _catalog->get_live_catalog(_unpack_data, _unpack_length);
     _live_catalog = _catalog->get_live_catalog(_unpack_data, _unpack_length);
   }
   }
-  nassertr(_catalog != (DCPackerCatalog *)NULL, false);
-  if (_live_catalog == NULL) {
+  nassertr(_catalog != nullptr, false);
+  if (_live_catalog == nullptr) {
     _pack_error = true;
     _pack_error = true;
     return false;
     return false;
   }
   }
@@ -292,12 +292,12 @@ seek(const string &field_name) {
  */
  */
 bool DCPacker::
 bool DCPacker::
 seek(int seek_index) {
 seek(int seek_index) {
-  if (_catalog == (DCPackerCatalog *)NULL) {
+  if (_catalog == nullptr) {
     _catalog = _root->get_catalog();
     _catalog = _root->get_catalog();
     _live_catalog = _catalog->get_live_catalog(_unpack_data, _unpack_length);
     _live_catalog = _catalog->get_live_catalog(_unpack_data, _unpack_length);
   }
   }
-  nassertr(_catalog != (DCPackerCatalog *)NULL, false);
-  if (_live_catalog == NULL) {
+  nassertr(_catalog != nullptr, false);
+  if (_live_catalog == nullptr) {
     _pack_error = true;
     _pack_error = true;
     return false;
     return false;
   }
   }
@@ -324,9 +324,9 @@ seek(int seek_index) {
     return true;
     return true;
 
 
   } else if (_mode == M_repack) {
   } else if (_mode == M_repack) {
-    nassertr(_catalog != (DCPackerCatalog *)NULL, false);
+    nassertr(_catalog != nullptr, false);
 
 
-    if (_stack != NULL || _current_field != NULL) {
+    if (_stack != nullptr || _current_field != nullptr) {
       // It is an error to reseek while the stack is nonempty--that means we
       // It is an error to reseek while the stack is nonempty--that means we
       // haven't finished packing the current field.
       // haven't finished packing the current field.
       _pack_error = true;
       _pack_error = true;
@@ -334,7 +334,7 @@ seek(int seek_index) {
     }
     }
     const DCPackerCatalog::Entry &entry = _live_catalog->get_entry(seek_index);
     const DCPackerCatalog::Entry &entry = _live_catalog->get_entry(seek_index);
 
 
-    if (entry._parent->as_switch_parameter() != (DCSwitchParameter *)NULL) {
+    if (entry._parent->as_switch_parameter() != nullptr) {
       // If the parent is a DCSwitch, that can only mean that the seeked field
       // If the parent is a DCSwitch, that can only mean that the seeked field
       // is a switch parameter.  We can't support seeking to a switch
       // is a switch parameter.  We can't support seeking to a switch
       // parameter and modifying it directly--what would happen to all of the
       // parameter and modifying it directly--what would happen to all of the
@@ -357,7 +357,7 @@ seek(int seek_index) {
       _catalog->release_live_catalog(_live_catalog);
       _catalog->release_live_catalog(_live_catalog);
       _live_catalog = _catalog->get_live_catalog(_unpack_data, _unpack_length);
       _live_catalog = _catalog->get_live_catalog(_unpack_data, _unpack_length);
 
 
-      if (_live_catalog == NULL) {
+      if (_live_catalog == nullptr) {
         _pack_error = true;
         _pack_error = true;
         return false;
         return false;
       }
       }
@@ -470,7 +470,7 @@ push() {
 
 
     if (_num_nested_fields >= 0 &&
     if (_num_nested_fields >= 0 &&
         _current_field_index >= _num_nested_fields) {
         _current_field_index >= _num_nested_fields) {
-      _current_field = NULL;
+      _current_field = nullptr;
 
 
     } else {
     } else {
       _current_field = _current_parent->get_nested_field(_current_field_index);
       _current_field = _current_parent->get_nested_field(_current_field_index);
@@ -487,7 +487,7 @@ push() {
  */
  */
 void DCPacker::
 void DCPacker::
 pop() {
 pop() {
-  if (_current_field != NULL && _num_nested_fields >= 0) {
+  if (_current_field != nullptr && _num_nested_fields >= 0) {
     // Oops, didn't pack or unpack enough values.
     // Oops, didn't pack or unpack enough values.
     _pack_error = true;
     _pack_error = true;
 
 
@@ -497,7 +497,7 @@ pop() {
     _pack_error = true;
     _pack_error = true;
   }
   }
 
 
-  if (_stack == NULL) {
+  if (_stack == nullptr) {
     // Unbalanced pop().
     // Unbalanced pop().
     _pack_error = true;
     _pack_error = true;
 
 
@@ -528,7 +528,7 @@ pop() {
     _current_field_index = _stack->_current_field_index;
     _current_field_index = _stack->_current_field_index;
     _push_marker = _stack->_push_marker;
     _push_marker = _stack->_push_marker;
     _pop_marker = _stack->_pop_marker;
     _pop_marker = _stack->_pop_marker;
-    _num_nested_fields = (_current_parent == NULL) ? 0 : _current_parent->get_num_nested_fields();
+    _num_nested_fields = (_current_parent == nullptr) ? 0 : _current_parent->get_num_nested_fields();
 
 
     StackElement *next = _stack->_next;
     StackElement *next = _stack->_next;
     delete _stack;
     delete _stack;
@@ -545,7 +545,7 @@ pop() {
 void DCPacker::
 void DCPacker::
 pack_default_value() {
 pack_default_value() {
   nassertv(_mode == M_pack || _mode == M_repack);
   nassertv(_mode == M_pack || _mode == M_repack);
-  if (_current_field == NULL) {
+  if (_current_field == nullptr) {
     _pack_error = true;
     _pack_error = true;
   } else {
   } else {
     if (_current_field->pack_default_value(_pack_data, _pack_error)) {
     if (_current_field->pack_default_value(_pack_data, _pack_error)) {
@@ -571,7 +571,7 @@ pack_default_value() {
 void DCPacker::
 void DCPacker::
 unpack_validate() {
 unpack_validate() {
   nassertv(_mode == M_unpack);
   nassertv(_mode == M_unpack);
-  if (_current_field == NULL) {
+  if (_current_field == nullptr) {
     _pack_error = true;
     _pack_error = true;
 
 
   } else {
   } else {
@@ -597,7 +597,7 @@ unpack_validate() {
 void DCPacker::
 void DCPacker::
 unpack_skip() {
 unpack_skip() {
   nassertv(_mode == M_unpack);
   nassertv(_mode == M_unpack);
-  if (_current_field == NULL) {
+  if (_current_field == nullptr) {
     _pack_error = true;
     _pack_error = true;
 
 
   } else {
   } else {
@@ -739,11 +739,11 @@ pack_object(PyObject *object) {
       (PyObject_HasAttrString(object, "__len__") != 0);
       (PyObject_HasAttrString(object, "__len__") != 0);
     bool is_instance = false;
     bool is_instance = false;
 
 
-    const DCClass *dclass = NULL;
+    const DCClass *dclass = nullptr;
     const DCPackerInterface *current_field = get_current_field();
     const DCPackerInterface *current_field = get_current_field();
-    if (current_field != (DCPackerInterface *)NULL) {
+    if (current_field != nullptr) {
       const DCClassParameter *class_param = get_current_field()->as_class_parameter();
       const DCClassParameter *class_param = get_current_field()->as_class_parameter();
-      if (class_param != (DCClassParameter *)NULL) {
+      if (class_param != nullptr) {
         dclass = class_param->get_class();
         dclass = class_param->get_class();
 
 
         if (dclass->has_class_def()) {
         if (dclass->has_class_def()) {
@@ -771,7 +771,7 @@ pack_object(PyObject *object) {
 
 
     // (3) Otherwise, it is considered to be a class object.
     // (3) Otherwise, it is considered to be a class object.
 
 
-    if (dclass != (DCClass *)NULL && (is_instance || !is_sequence)) {
+    if (dclass != nullptr && (is_instance || !is_sequence)) {
       // The supplied object is either an instance of the expected class
       // The supplied object is either an instance of the expected class
       // object, or it is not a sequence--this is case (1) or (3).
       // object, or it is not a sequence--this is case (1) or (3).
       pack_class_object(dclass, object);
       pack_class_object(dclass, object);
@@ -782,7 +782,7 @@ pack_object(PyObject *object) {
       int size = PySequence_Size(object);
       int size = PySequence_Size(object);
       for (int i = 0; i < size; ++i) {
       for (int i = 0; i < size; ++i) {
         PyObject *element = PySequence_GetItem(object, i);
         PyObject *element = PySequence_GetItem(object, i);
-        if (element != (PyObject *)NULL) {
+        if (element != nullptr) {
           pack_object(element);
           pack_object(element);
           Py_DECREF(element);
           Py_DECREF(element);
         } else {
         } else {
@@ -812,7 +812,7 @@ pack_object(PyObject *object) {
  */
  */
 PyObject *DCPacker::
 PyObject *DCPacker::
 unpack_object() {
 unpack_object() {
-  PyObject *object = NULL;
+  PyObject *object = nullptr;
 
 
   DCPackType pack_type = get_pack_type();
   DCPackType pack_type = get_pack_type();
 
 
@@ -896,13 +896,13 @@ unpack_object() {
   case PT_class:
   case PT_class:
     {
     {
       const DCClassParameter *class_param = get_current_field()->as_class_parameter();
       const DCClassParameter *class_param = get_current_field()->as_class_parameter();
-      if (class_param != (DCClassParameter *)NULL) {
+      if (class_param != nullptr) {
         const DCClass *dclass = class_param->get_class();
         const DCClass *dclass = class_param->get_class();
         if (dclass->has_class_def()) {
         if (dclass->has_class_def()) {
           // If we know what kind of class object this is and it has a valid
           // If we know what kind of class object this is and it has a valid
           // constructor, create the class object instead of just a tuple.
           // constructor, create the class object instead of just a tuple.
           object = unpack_class_object(dclass);
           object = unpack_class_object(dclass);
-          if (object == (PyObject *)NULL) {
+          if (object == nullptr) {
             cerr << "Unable to construct object of class "
             cerr << "Unable to construct object of class "
                  << dclass->get_name() << "\n";
                  << dclass->get_name() << "\n";
           } else {
           } else {
@@ -939,7 +939,7 @@ unpack_object() {
     break;
     break;
   }
   }
 
 
-  nassertr(object != (PyObject *)NULL, NULL);
+  nassertr(object != nullptr, nullptr);
   return object;
   return object;
 }
 }
 #endif  // HAVE_PYTHON
 #endif  // HAVE_PYTHON
@@ -995,10 +995,10 @@ unpack_and_format(ostream &out, bool show_field_names) {
   DCPackType pack_type = get_pack_type();
   DCPackType pack_type = get_pack_type();
 
 
   if (show_field_names && !get_current_field_name().empty()) {
   if (show_field_names && !get_current_field_name().empty()) {
-    nassertv(_current_field != (DCPackerInterface *)NULL);
+    nassertv(_current_field != nullptr);
     const DCField *field = _current_field->as_field();
     const DCField *field = _current_field->as_field();
-    if (field != (DCField *)NULL &&
-        field->as_parameter() != (DCParameter *)NULL) {
+    if (field != nullptr &&
+        field->as_parameter() != nullptr) {
       out << field->get_name() << " = ";
       out << field->get_name() << " = ";
     }
     }
   }
   }
@@ -1135,7 +1135,7 @@ void DCPacker::
 handle_switch(const DCSwitchParameter *switch_parameter) {
 handle_switch(const DCSwitchParameter *switch_parameter) {
   // First, get the value from the key.  This is either found in the unpack or
   // First, get the value from the key.  This is either found in the unpack or
   // the pack data, depending on what mode we're in.
   // the pack data, depending on what mode we're in.
-  const DCPackerInterface *new_parent = NULL;
+  const DCPackerInterface *new_parent = nullptr;
 
 
   if (_mode == M_pack || _mode == M_repack) {
   if (_mode == M_pack || _mode == M_repack) {
     const char *data = _pack_data.get_data();
     const char *data = _pack_data.get_data();
@@ -1147,7 +1147,7 @@ handle_switch(const DCSwitchParameter *switch_parameter) {
       (_unpack_data + _push_marker, _unpack_p - _push_marker);
       (_unpack_data + _push_marker, _unpack_p - _push_marker);
   }
   }
 
 
-  if (new_parent == (DCPackerInterface *)NULL) {
+  if (new_parent == nullptr) {
     // This means an invalid value was packed for the key.
     // This means an invalid value was packed for the key.
     _range_error = true;
     _range_error = true;
     return;
     return;
@@ -1173,20 +1173,20 @@ handle_switch(const DCSwitchParameter *switch_parameter) {
 void DCPacker::
 void DCPacker::
 clear() {
 clear() {
   clear_stack();
   clear_stack();
-  _current_field = NULL;
-  _current_parent = NULL;
+  _current_field = nullptr;
+  _current_parent = nullptr;
   _current_field_index = 0;
   _current_field_index = 0;
   _num_nested_fields = 0;
   _num_nested_fields = 0;
   _push_marker = 0;
   _push_marker = 0;
   _pop_marker = 0;
   _pop_marker = 0;
-  _last_switch = NULL;
+  _last_switch = nullptr;
 
 
-  if (_live_catalog != (DCPackerCatalog::LiveCatalog *)NULL) {
+  if (_live_catalog != nullptr) {
     _catalog->release_live_catalog(_live_catalog);
     _catalog->release_live_catalog(_live_catalog);
-    _live_catalog = NULL;
+    _live_catalog = nullptr;
   }
   }
-  _catalog = NULL;
-  _root = NULL;
+  _catalog = nullptr;
+  _root = nullptr;
 }
 }
 
 
 /**
 /**
@@ -1194,7 +1194,7 @@ clear() {
  */
  */
 void DCPacker::
 void DCPacker::
 clear_stack() {
 clear_stack() {
-  while (_stack != (StackElement *)NULL) {
+  while (_stack != nullptr) {
     StackElement *next = _stack->_next;
     StackElement *next = _stack->_next;
     delete _stack;
     delete _stack;
     _stack = next;
     _stack = next;
@@ -1212,7 +1212,7 @@ pack_class_object(const DCClass *dclass, PyObject *object) {
   push();
   push();
   while (more_nested_fields() && !_pack_error) {
   while (more_nested_fields() && !_pack_error) {
     const DCField *field = get_current_field()->as_field();
     const DCField *field = get_current_field()->as_field();
-    nassertv(field != (DCField *)NULL);
+    nassertv(field != nullptr);
     get_class_element(dclass, object, field);
     get_class_element(dclass, object, field);
   }
   }
   pop();
   pop();
@@ -1227,36 +1227,36 @@ pack_class_object(const DCClass *dclass, PyObject *object) {
 PyObject *DCPacker::
 PyObject *DCPacker::
 unpack_class_object(const DCClass *dclass) {
 unpack_class_object(const DCClass *dclass) {
   PyObject *class_def = dclass->get_class_def();
   PyObject *class_def = dclass->get_class_def();
-  nassertr(class_def != (PyObject *)NULL, NULL);
+  nassertr(class_def != nullptr, nullptr);
 
 
-  PyObject *object = NULL;
+  PyObject *object = nullptr;
 
 
   if (!dclass->has_constructor()) {
   if (!dclass->has_constructor()) {
     // If the class uses a default constructor, go ahead and create the Python
     // If the class uses a default constructor, go ahead and create the Python
     // object for it now.
     // object for it now.
-    object = PyObject_CallObject(class_def, NULL);
-    if (object == (PyObject *)NULL) {
-      return NULL;
+    object = PyObject_CallObject(class_def, nullptr);
+    if (object == nullptr) {
+      return nullptr;
     }
     }
   }
   }
 
 
   push();
   push();
-  if (object == (PyObject *)NULL && more_nested_fields()) {
+  if (object == nullptr && more_nested_fields()) {
     // The first nested field will be the constructor.
     // The first nested field will be the constructor.
     const DCField *field = get_current_field()->as_field();
     const DCField *field = get_current_field()->as_field();
-    nassertr(field != (DCField *)NULL, object);
+    nassertr(field != nullptr, object);
     nassertr(field == dclass->get_constructor(), object);
     nassertr(field == dclass->get_constructor(), object);
 
 
     set_class_element(class_def, object, field);
     set_class_element(class_def, object, field);
 
 
     // By now, the object should have been constructed.
     // By now, the object should have been constructed.
-    if (object == (PyObject *)NULL) {
-      return NULL;
+    if (object == nullptr) {
+      return nullptr;
     }
     }
   }
   }
   while (more_nested_fields()) {
   while (more_nested_fields()) {
     const DCField *field = get_current_field()->as_field();
     const DCField *field = get_current_field()->as_field();
-    nassertr(field != (DCField *)NULL, object);
+    nassertr(field != nullptr, object);
 
 
     set_class_element(class_def, object, field);
     set_class_element(class_def, object, field);
   }
   }
@@ -1287,8 +1287,8 @@ set_class_element(PyObject *class_def, PyObject *&object,
       push();
       push();
       while (more_nested_fields()) {
       while (more_nested_fields()) {
         const DCField *field = get_current_field()->as_field();
         const DCField *field = get_current_field()->as_field();
-        nassertv(field != (DCField *)NULL);
-        nassertv(object != (PyObject *)NULL);
+        nassertv(field != nullptr);
+        nassertv(object != nullptr);
         set_class_element(class_def, object, field);
         set_class_element(class_def, object, field);
       }
       }
       pop();
       pop();
@@ -1307,7 +1307,7 @@ set_class_element(PyObject *class_def, PyObject *&object,
     PyObject *element = unpack_object();
     PyObject *element = unpack_object();
 
 
     if (pack_type == PT_field) {
     if (pack_type == PT_field) {
-      if (object == (PyObject *)NULL) {
+      if (object == nullptr) {
         // If the object hasn't been constructed yet, assume this is the
         // If the object hasn't been constructed yet, assume this is the
         // constructor.
         // constructor.
         object = PyObject_CallObject(class_def, element);
         object = PyObject_CallObject(class_def, element);
@@ -1315,7 +1315,7 @@ set_class_element(PyObject *class_def, PyObject *&object,
       } else {
       } else {
         if (PyObject_HasAttrString(object, (char *)field_name.c_str())) {
         if (PyObject_HasAttrString(object, (char *)field_name.c_str())) {
           PyObject *func = PyObject_GetAttrString(object, (char *)field_name.c_str());
           PyObject *func = PyObject_GetAttrString(object, (char *)field_name.c_str());
-          if (func != (PyObject *)NULL) {
+          if (func != nullptr) {
             PyObject *result = PyObject_CallObject(func, element);
             PyObject *result = PyObject_CallObject(func, element);
             Py_XDECREF(result);
             Py_XDECREF(result);
             Py_DECREF(func);
             Py_DECREF(func);
@@ -1324,7 +1324,7 @@ set_class_element(PyObject *class_def, PyObject *&object,
       }
       }
 
 
     } else {
     } else {
-      nassertv(object != (PyObject *)NULL);
+      nassertv(object != nullptr);
       PyObject_SetAttrString(object, (char *)field_name.c_str(), element);
       PyObject_SetAttrString(object, (char *)field_name.c_str(), element);
     }
     }
 
 
@@ -1353,7 +1353,7 @@ get_class_element(const DCClass *dclass, PyObject *object,
       push();
       push();
       while (more_nested_fields() && !_pack_error) {
       while (more_nested_fields() && !_pack_error) {
         const DCField *field = get_current_field()->as_field();
         const DCField *field = get_current_field()->as_field();
-        nassertv(field != (DCField *)NULL);
+        nassertv(field != nullptr);
         get_class_element(dclass, object, field);
         get_class_element(dclass, object, field);
       }
       }
       pop();
       pop();

+ 12 - 12
direct/src/dcparser/dcPackerCatalog.cxx

@@ -21,7 +21,7 @@
  */
  */
 DCPackerCatalog::
 DCPackerCatalog::
 DCPackerCatalog(const DCPackerInterface *root) : _root(root) {
 DCPackerCatalog(const DCPackerInterface *root) : _root(root) {
-  _live_catalog = NULL;
+  _live_catalog = nullptr;
 }
 }
 
 
 /**
 /**
@@ -34,7 +34,7 @@ DCPackerCatalog(const DCPackerCatalog &copy) :
   _entries_by_name(copy._entries_by_name),
   _entries_by_name(copy._entries_by_name),
   _entries_by_field(copy._entries_by_field)
   _entries_by_field(copy._entries_by_field)
 {
 {
-  _live_catalog = NULL;
+  _live_catalog = nullptr;
 }
 }
 
 
 /**
 /**
@@ -42,7 +42,7 @@ DCPackerCatalog(const DCPackerCatalog &copy) :
  */
  */
 DCPackerCatalog::
 DCPackerCatalog::
 ~DCPackerCatalog() {
 ~DCPackerCatalog() {
-  if (_live_catalog != (LiveCatalog *)NULL) {
+  if (_live_catalog != nullptr) {
     delete _live_catalog;
     delete _live_catalog;
   }
   }
 
 
@@ -92,7 +92,7 @@ find_entry_by_field(const DCPackerInterface *field) const {
  */
  */
 const DCPackerCatalog::LiveCatalog *DCPackerCatalog::
 const DCPackerCatalog::LiveCatalog *DCPackerCatalog::
 get_live_catalog(const char *data, size_t length) const {
 get_live_catalog(const char *data, size_t length) const {
-  if (_live_catalog != (LiveCatalog *)NULL) {
+  if (_live_catalog != nullptr) {
     // Return the previously-allocated live catalog; it will be the same as
     // Return the previously-allocated live catalog; it will be the same as
     // this one since it's based on a fixed-length field.
     // this one since it's based on a fixed-length field.
     return _live_catalog;
     return _live_catalog;
@@ -111,13 +111,13 @@ get_live_catalog(const char *data, size_t length) const {
   DCPacker packer;
   DCPacker packer;
   packer.set_unpack_data(data, length, false);
   packer.set_unpack_data(data, length, false);
   packer.begin_unpack(_root);
   packer.begin_unpack(_root);
-  const DCSwitchParameter *last_switch = NULL;
+  const DCSwitchParameter *last_switch = nullptr;
   r_fill_live_catalog(live_catalog, packer, last_switch);
   r_fill_live_catalog(live_catalog, packer, last_switch);
   bool okflag = packer.end_unpack();
   bool okflag = packer.end_unpack();
 
 
   if (!okflag) {
   if (!okflag) {
     delete live_catalog;
     delete live_catalog;
-    return NULL;
+    return nullptr;
   }
   }
 
 
   if (_root->has_fixed_structure()) {
   if (_root->has_fixed_structure()) {
@@ -188,7 +188,7 @@ r_fill_catalog(const string &name_prefix, const DCPackerInterface *field,
                const DCPackerInterface *parent, int field_index) {
                const DCPackerInterface *parent, int field_index) {
   string next_name_prefix = name_prefix;
   string next_name_prefix = name_prefix;
 
 
-  if (parent != (const DCPackerInterface *)NULL && !field->get_name().empty()) {
+  if (parent != nullptr && !field->get_name().empty()) {
     // Record this entry in the catalog.
     // Record this entry in the catalog.
     next_name_prefix += field->get_name();
     next_name_prefix += field->get_name();
     add_entry(next_name_prefix, field, parent, field_index);
     add_entry(next_name_prefix, field, parent, field_index);
@@ -197,7 +197,7 @@ r_fill_catalog(const string &name_prefix, const DCPackerInterface *field,
   }
   }
 
 
   const DCSwitchParameter *switch_parameter = field->as_switch_parameter();
   const DCSwitchParameter *switch_parameter = field->as_switch_parameter();
-  if (switch_parameter != (DCSwitchParameter *)NULL) {
+  if (switch_parameter != nullptr) {
     // If we come upon a DCSwitch while building the catalog, save the
     // If we come upon a DCSwitch while building the catalog, save the
     // name_prefix at this point so we'll have it again when we later
     // name_prefix at this point so we'll have it again when we later
     // encounter the switch while unpacking a live record (and so we can
     // encounter the switch while unpacking a live record (and so we can
@@ -211,7 +211,7 @@ r_fill_catalog(const string &name_prefix, const DCPackerInterface *field,
     // It's ok if num_nested is -1.
     // It's ok if num_nested is -1.
     for (int i = 0; i < num_nested; i++) {
     for (int i = 0; i < num_nested; i++) {
       DCPackerInterface *nested = field->get_nested_field(i);
       DCPackerInterface *nested = field->get_nested_field(i);
-      if (nested != (DCPackerInterface *)NULL) {
+      if (nested != nullptr) {
         r_fill_catalog(next_name_prefix, nested, field, i);
         r_fill_catalog(next_name_prefix, nested, field, i);
       }
       }
     }
     }
@@ -255,10 +255,10 @@ r_fill_live_catalog(LiveCatalog *live_catalog, DCPacker &packer,
     last_switch = packer.get_last_switch();
     last_switch = packer.get_last_switch();
 
 
     const DCPackerInterface *switch_case = packer.get_current_parent();
     const DCPackerInterface *switch_case = packer.get_current_parent();
-    nassertv(switch_case != (DCPackerInterface *)NULL);
+    nassertv(switch_case != nullptr);
     const DCPackerCatalog *switch_catalog =
     const DCPackerCatalog *switch_catalog =
       live_catalog->_catalog->update_switch_fields(last_switch, switch_case);
       live_catalog->_catalog->update_switch_fields(last_switch, switch_case);
-    nassertv(switch_catalog != (DCPackerCatalog *)NULL);
+    nassertv(switch_catalog != nullptr);
     live_catalog->_catalog = switch_catalog;
     live_catalog->_catalog = switch_catalog;
 
 
     // And we also have to expand the live catalog to hold the new entries.
     // And we also have to expand the live catalog to hold the new entries.
@@ -317,7 +317,7 @@ update_switch_fields(const DCSwitchParameter *switch_parameter,
   int num_nested = switch_case->get_num_nested_fields();
   int num_nested = switch_case->get_num_nested_fields();
   for (int i = 1; i < num_nested; i++) {
   for (int i = 1; i < num_nested; i++) {
     DCPackerInterface *nested = switch_case->get_nested_field(i);
     DCPackerInterface *nested = switch_case->get_nested_field(i);
-    if (nested != (DCPackerInterface *)NULL) {
+    if (nested != nullptr) {
       switch_catalog->r_fill_catalog(name_prefix, nested, switch_case, i);
       switch_catalog->r_fill_catalog(name_prefix, nested, switch_case, i);
     }
     }
   }
   }

+ 14 - 14
direct/src/dcparser/dcPackerInterface.cxx

@@ -32,7 +32,7 @@ DCPackerInterface(const string &name) :
   _has_nested_fields = false;
   _has_nested_fields = false;
   _num_nested_fields = -1;
   _num_nested_fields = -1;
   _pack_type = PT_invalid;
   _pack_type = PT_invalid;
-  _catalog = NULL;
+  _catalog = nullptr;
 }
 }
 
 
 /**
 /**
@@ -50,7 +50,7 @@ DCPackerInterface(const DCPackerInterface &copy) :
   _num_nested_fields(copy._num_nested_fields),
   _num_nested_fields(copy._num_nested_fields),
   _pack_type(copy._pack_type)
   _pack_type(copy._pack_type)
 {
 {
-  _catalog = NULL;
+  _catalog = nullptr;
 }
 }
 
 
 /**
 /**
@@ -58,7 +58,7 @@ DCPackerInterface(const DCPackerInterface &copy) :
  */
  */
 DCPackerInterface::
 DCPackerInterface::
 ~DCPackerInterface() {
 ~DCPackerInterface() {
-  if (_catalog != (DCPackerCatalog *)NULL) {
+  if (_catalog != nullptr) {
     delete _catalog;
     delete _catalog;
   }
   }
 }
 }
@@ -83,7 +83,7 @@ find_seek_index(const string &name) const {
  */
  */
 DCField *DCPackerInterface::
 DCField *DCPackerInterface::
 as_field() {
 as_field() {
-  return (DCField *)NULL;
+  return nullptr;
 }
 }
 
 
 /**
 /**
@@ -91,7 +91,7 @@ as_field() {
  */
  */
 const DCField *DCPackerInterface::
 const DCField *DCPackerInterface::
 as_field() const {
 as_field() const {
-  return (DCField *)NULL;
+  return nullptr;
 }
 }
 
 
 /**
 /**
@@ -99,7 +99,7 @@ as_field() const {
  */
  */
 DCSwitchParameter *DCPackerInterface::
 DCSwitchParameter *DCPackerInterface::
 as_switch_parameter() {
 as_switch_parameter() {
-  return (DCSwitchParameter *)NULL;
+  return nullptr;
 }
 }
 
 
 /**
 /**
@@ -107,7 +107,7 @@ as_switch_parameter() {
  */
  */
 const DCSwitchParameter *DCPackerInterface::
 const DCSwitchParameter *DCPackerInterface::
 as_switch_parameter() const {
 as_switch_parameter() const {
-  return (DCSwitchParameter *)NULL;
+  return nullptr;
 }
 }
 
 
 /**
 /**
@@ -115,7 +115,7 @@ as_switch_parameter() const {
  */
  */
 DCClassParameter *DCPackerInterface::
 DCClassParameter *DCPackerInterface::
 as_class_parameter() {
 as_class_parameter() {
-  return (DCClassParameter *)NULL;
+  return nullptr;
 }
 }
 
 
 /**
 /**
@@ -123,7 +123,7 @@ as_class_parameter() {
  */
  */
 const DCClassParameter *DCPackerInterface::
 const DCClassParameter *DCPackerInterface::
 as_class_parameter() const {
 as_class_parameter() const {
-  return (DCClassParameter *)NULL;
+  return nullptr;
 }
 }
 
 
 /**
 /**
@@ -145,7 +145,7 @@ check_match(const string &description, DCFile *dcfile) const {
   dc_cleanup_parser();
   dc_cleanup_parser();
 
 
   DCField *field = dc_get_parameter_description();
   DCField *field = dc_get_parameter_description();
-  if (field != NULL) {
+  if (field != nullptr) {
     match = check_match(field);
     match = check_match(field);
     delete field;
     delete field;
   }
   }
@@ -184,7 +184,7 @@ calc_num_nested_fields(size_t) const {
  */
  */
 DCPackerInterface *DCPackerInterface::
 DCPackerInterface *DCPackerInterface::
 get_nested_field(int) const {
 get_nested_field(int) const {
-  return NULL;
+  return nullptr;
 }
 }
 
 
 /**
 /**
@@ -367,7 +367,7 @@ unpack_skip(const char *data, size_t length, size_t &p,
  */
  */
 const DCPackerCatalog *DCPackerInterface::
 const DCPackerCatalog *DCPackerInterface::
 get_catalog() const {
 get_catalog() const {
-  if (_catalog == (DCPackerCatalog *)NULL) {
+  if (_catalog == nullptr) {
     ((DCPackerInterface *)this)->make_catalog();
     ((DCPackerInterface *)this)->make_catalog();
   }
   }
   return _catalog;
   return _catalog;
@@ -432,8 +432,8 @@ do_check_match_molecular_field(const DCMolecularField *) const {
  */
  */
 void DCPackerInterface::
 void DCPackerInterface::
 make_catalog() {
 make_catalog() {
-  nassertv(_catalog == (DCPackerCatalog *)NULL);
+  nassertv(_catalog == nullptr);
   _catalog = new DCPackerCatalog(this);
   _catalog = new DCPackerCatalog(this);
 
 
-  _catalog->r_fill_catalog("", this, NULL, 0);
+  _catalog->r_fill_catalog("", this, nullptr, 0);
 }
 }

+ 1 - 1
direct/src/dcparser/dcPackerInterface.h

@@ -82,7 +82,7 @@ PUBLISHED:
   virtual const DCClassParameter *as_class_parameter() const;
   virtual const DCClassParameter *as_class_parameter() const;
 
 
   INLINE bool check_match(const DCPackerInterface *other) const;
   INLINE bool check_match(const DCPackerInterface *other) const;
-  bool check_match(const string &description, DCFile *dcfile = NULL) const;
+  bool check_match(const string &description, DCFile *dcfile = nullptr) const;
 
 
 public:
 public:
   virtual void set_name(const string &name);
   virtual void set_name(const string &name);

+ 9 - 9
direct/src/dcparser/dcParameter.cxx

@@ -22,7 +22,7 @@
  */
  */
 DCParameter::
 DCParameter::
 DCParameter() {
 DCParameter() {
-  _typedef = NULL;
+  _typedef = nullptr;
   _has_fixed_byte_size = false;
   _has_fixed_byte_size = false;
   _has_fixed_structure = false;
   _has_fixed_structure = false;
   _num_nested_fields = -1;
   _num_nested_fields = -1;
@@ -66,7 +66,7 @@ as_parameter() const {
  */
  */
 DCSimpleParameter *DCParameter::
 DCSimpleParameter *DCParameter::
 as_simple_parameter() {
 as_simple_parameter() {
-  return NULL;
+  return nullptr;
 }
 }
 
 
 /**
 /**
@@ -74,7 +74,7 @@ as_simple_parameter() {
  */
  */
 const DCSimpleParameter *DCParameter::
 const DCSimpleParameter *DCParameter::
 as_simple_parameter() const {
 as_simple_parameter() const {
-  return NULL;
+  return nullptr;
 }
 }
 
 
 /**
 /**
@@ -82,7 +82,7 @@ as_simple_parameter() const {
  */
  */
 DCClassParameter *DCParameter::
 DCClassParameter *DCParameter::
 as_class_parameter() {
 as_class_parameter() {
-  return NULL;
+  return nullptr;
 }
 }
 
 
 /**
 /**
@@ -90,7 +90,7 @@ as_class_parameter() {
  */
  */
 const DCClassParameter *DCParameter::
 const DCClassParameter *DCParameter::
 as_class_parameter() const {
 as_class_parameter() const {
-  return NULL;
+  return nullptr;
 }
 }
 
 
 /**
 /**
@@ -98,7 +98,7 @@ as_class_parameter() const {
  */
  */
 DCSwitchParameter *DCParameter::
 DCSwitchParameter *DCParameter::
 as_switch_parameter() {
 as_switch_parameter() {
-  return NULL;
+  return nullptr;
 }
 }
 
 
 /**
 /**
@@ -106,7 +106,7 @@ as_switch_parameter() {
  */
  */
 const DCSwitchParameter *DCParameter::
 const DCSwitchParameter *DCParameter::
 as_switch_parameter() const {
 as_switch_parameter() const {
-  return NULL;
+  return nullptr;
 }
 }
 
 
 /**
 /**
@@ -114,7 +114,7 @@ as_switch_parameter() const {
  */
  */
 DCArrayParameter *DCParameter::
 DCArrayParameter *DCParameter::
 as_array_parameter() {
 as_array_parameter() {
-  return NULL;
+  return nullptr;
 }
 }
 
 
 /**
 /**
@@ -122,7 +122,7 @@ as_array_parameter() {
  */
  */
 const DCArrayParameter *DCParameter::
 const DCArrayParameter *DCParameter::
 as_array_parameter() const {
 as_array_parameter() const {
-  return NULL;
+  return nullptr;
 }
 }
 
 
 /**
 /**

+ 57 - 57
direct/src/dcparser/dcParser.yxx

@@ -29,18 +29,18 @@
 #define YYINITDEPTH 1000
 #define YYINITDEPTH 1000
 #define YYMAXDEPTH 1000
 #define YYMAXDEPTH 1000
 
 
-DCFile *dc_file = (DCFile *)NULL;
-static DCClass *current_class = (DCClass *)NULL;
-static DCSwitch *current_switch = (DCSwitch *)NULL;
-static DCAtomicField *current_atomic = (DCAtomicField *)NULL;
-static DCMolecularField *current_molecular = (DCMolecularField *)NULL;
-static DCParameter *current_parameter = (DCParameter *)NULL;
+DCFile *dc_file = nullptr;
+static DCClass *current_class = nullptr;
+static DCSwitch *current_switch = nullptr;
+static DCAtomicField *current_atomic = nullptr;
+static DCMolecularField *current_molecular = nullptr;
+static DCParameter *current_parameter = nullptr;
 static DCKeywordList current_keyword_list;
 static DCKeywordList current_keyword_list;
 static DCPacker default_packer;
 static DCPacker default_packer;
 static DCPacker *current_packer;
 static DCPacker *current_packer;
 static DCDoubleRange double_range;
 static DCDoubleRange double_range;
 static DCUnsignedIntRange uint_range;
 static DCUnsignedIntRange uint_range;
-static DCField *parameter_description = (DCField *)NULL;
+static DCField *parameter_description = nullptr;
 
 
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 // Defining the interface to the parser.
 // Defining the interface to the parser.
@@ -55,7 +55,7 @@ dc_init_parser(istream &in, const string &filename, DCFile &file) {
 void
 void
 dc_init_parser_parameter_value(istream &in, const string &filename, 
 dc_init_parser_parameter_value(istream &in, const string &filename, 
                                DCPacker &packer) {
                                DCPacker &packer) {
-  dc_file = NULL;
+  dc_file = nullptr;
   current_packer = &packer;
   current_packer = &packer;
   dc_init_lexer(in, filename);
   dc_init_lexer(in, filename);
   dc_start_parameter_value();
   dc_start_parameter_value();
@@ -66,7 +66,7 @@ dc_init_parser_parameter_description(istream &in, const string &filename,
                                      DCFile *file) {
                                      DCFile *file) {
   dc_file = file;
   dc_file = file;
   dc_init_lexer(in, filename);
   dc_init_lexer(in, filename);
-  parameter_description = NULL;
+  parameter_description = nullptr;
   dc_start_parameter_description();
   dc_start_parameter_description();
 }
 }
 
 
@@ -77,7 +77,7 @@ dc_get_parameter_description() {
 
 
 void
 void
 dc_cleanup_parser() {
 dc_cleanup_parser() {
-  dc_file = (DCFile *)NULL;
+  dc_file = nullptr;
 }
 }
 
 
 %}
 %}
@@ -181,7 +181,7 @@ dc:
 {
 {
   if (!dc_file->add_class($2)) {
   if (!dc_file->add_class($2)) {
     DCClass *old_class = dc_file->get_class_by_name($2->get_name());
     DCClass *old_class = dc_file->get_class_by_name($2->get_name());
-    if (old_class != (DCClass *)NULL && old_class->is_bogus_class()) {
+    if (old_class != nullptr && old_class->is_bogus_class()) {
       yyerror("Base class defined after its first reference: " + $2->get_name());
       yyerror("Base class defined after its first reference: " + $2->get_name());
     } else {
     } else {
       yyerror("Duplicate class name: " + $2->get_name());
       yyerror("Duplicate class name: " + $2->get_name());
@@ -249,7 +249,7 @@ import_symbol_list:
 typedef_decl:
 typedef_decl:
         KW_TYPEDEF parameter_with_default
         KW_TYPEDEF parameter_with_default
 {
 {
-  if ($2 != (DCParameter *)NULL) {
+  if ($2 != nullptr) {
     DCTypedef *dtypedef = new DCTypedef($2);
     DCTypedef *dtypedef = new DCTypedef($2);
     
     
     if (!dc_file->add_typedef(dtypedef)) {
     if (!dc_file->add_typedef(dtypedef)) {
@@ -304,13 +304,13 @@ dclass:
 dclass_name:
 dclass_name:
         IDENTIFIER
         IDENTIFIER
 {
 {
-  if (dc_file == (DCFile *)NULL) {
+  if (dc_file == nullptr) {
     yyerror("No DCFile available, so no class names are predefined.");
     yyerror("No DCFile available, so no class names are predefined.");
-    $$ = NULL;
+    $$ = nullptr;
 
 
   } else {
   } else {
     DCClass *dclass = dc_file->get_class_by_name($1);
     DCClass *dclass = dc_file->get_class_by_name($1);
-    if (dclass == (DCClass *)NULL) {
+    if (dclass == nullptr) {
       // Create a bogus class as a forward reference.
       // Create a bogus class as a forward reference.
       dclass = new DCClass(dc_file, $1, false, true);
       dclass = new DCClass(dc_file, $1, false, true);
       dc_file->add_class(dclass);
       dc_file->add_class(dclass);
@@ -332,7 +332,7 @@ dclass_derivation:
 dclass_base_list:
 dclass_base_list:
         dclass_name
         dclass_name
 {
 {
-  if ($1 != (DCClass *)NULL) {
+  if ($1 != nullptr) {
     current_class->add_parent($1);
     current_class->add_parent($1);
   }
   }
 }
 }
@@ -342,7 +342,7 @@ dclass_base_list:
     yyerror("Multiple inheritance is not supported without \"dc-multiple-inheritance 1\" in your Config.prc file.");
     yyerror("Multiple inheritance is not supported without \"dc-multiple-inheritance 1\" in your Config.prc file.");
 
 
   } else {
   } else {
-    if ($3 != (DCClass *)NULL) {
+    if ($3 != nullptr) {
       current_class->add_parent($3);
       current_class->add_parent($3);
     }
     }
   }
   }
@@ -354,7 +354,7 @@ dclass_fields:
         | dclass_fields ';'
         | dclass_fields ';'
         | dclass_fields dclass_field ';'
         | dclass_fields dclass_field ';'
 {
 {
-  if ($2 == (DCField *)NULL) {
+  if ($2 == nullptr) {
     // Pass this error up.
     // Pass this error up.
   } else if (!current_class->add_field($2)) {
   } else if (!current_class->add_field($2)) {
     yyerror("Duplicate field name: " + $2->get_name());
     yyerror("Duplicate field name: " + $2->get_name());
@@ -367,7 +367,7 @@ dclass_fields:
 dclass_field:
 dclass_field:
         atomic_field keyword_list
         atomic_field keyword_list
 {
 {
-  if ($1 != (DCField *)NULL) {
+  if ($1 != nullptr) {
     if ($1->get_name().empty()) {
     if ($1->get_name().empty()) {
       yyerror("Field name required.");
       yyerror("Field name required.");
     }
     }
@@ -379,14 +379,14 @@ dclass_field:
         | unnamed_parameter_with_default keyword_list
         | unnamed_parameter_with_default keyword_list
 {
 {
   yyerror("Unnamed parameters are not allowed on a dclass");
   yyerror("Unnamed parameters are not allowed on a dclass");
-  if ($1 != (DCField *)NULL) {
+  if ($1 != nullptr) {
     $1->copy_keywords(current_keyword_list);
     $1->copy_keywords(current_keyword_list);
   }
   }
   $$ = $1;
   $$ = $1;
 }
 }
         | named_parameter_with_default keyword_list
         | named_parameter_with_default keyword_list
 {
 {
-  if ($1 != (DCField *)NULL) {
+  if ($1 != nullptr) {
     $1->copy_keywords(current_keyword_list);
     $1->copy_keywords(current_keyword_list);
   }
   }
   $$ = $1;
   $$ = $1;
@@ -408,13 +408,13 @@ struct:
 struct_name:
 struct_name:
         IDENTIFIER
         IDENTIFIER
 {
 {
-  if (dc_file == (DCFile *)NULL) {
+  if (dc_file == nullptr) {
     yyerror("No DCFile available, so no struct names are predefined.");
     yyerror("No DCFile available, so no struct names are predefined.");
-    $$ = NULL;
+    $$ = nullptr;
 
 
   } else {
   } else {
     DCClass *dstruct = dc_file->get_class_by_name($1);
     DCClass *dstruct = dc_file->get_class_by_name($1);
-    if (dstruct == (DCClass *)NULL) {
+    if (dstruct == nullptr) {
       // Create a bogus class as a forward reference.
       // Create a bogus class as a forward reference.
       dstruct = new DCClass(dc_file, $1, false, true);
       dstruct = new DCClass(dc_file, $1, false, true);
       dc_file->add_class(dstruct);
       dc_file->add_class(dstruct);
@@ -436,13 +436,13 @@ struct_derivation:
 struct_base_list:
 struct_base_list:
         struct_name
         struct_name
 {
 {
-  if ($1 != (DCClass *)NULL) {
+  if ($1 != nullptr) {
     current_class->add_parent($1);
     current_class->add_parent($1);
   }
   }
 }
 }
         | struct_base_list ',' struct_name
         | struct_base_list ',' struct_name
 {
 {
-  if ($3 != (DCClass *)NULL) {
+  if ($3 != nullptr) {
     current_class->add_parent($3);
     current_class->add_parent($3);
   }
   }
 }
 }
@@ -453,7 +453,7 @@ struct_fields:
         | struct_fields ';'
         | struct_fields ';'
         | struct_fields struct_field ';'
         | struct_fields struct_field ';'
 {
 {
-  if ($2 == (DCField *)NULL) {
+  if ($2 == nullptr) {
     // Pass this error up.
     // Pass this error up.
   } else if (!current_class->add_field($2)) {
   } else if (!current_class->add_field($2)) {
     yyerror("Duplicate field name: " + $2->get_name());
     yyerror("Duplicate field name: " + $2->get_name());
@@ -483,7 +483,7 @@ struct_field:
 atomic_field:
 atomic_field:
         optional_name '('
         optional_name '('
 {
 {
-  if (current_class == (DCClass *)NULL) {
+  if (current_class == nullptr) {
     yyerror("Cannot define a method outside of a struct or class.");
     yyerror("Cannot define a method outside of a struct or class.");
     DCClass *temp_class = new DCClass(dc_file, "temp", false, false);  // memory leak.
     DCClass *temp_class = new DCClass(dc_file, "temp", false, false);  // memory leak.
     current_atomic = new DCAtomicField($1, temp_class, false);
     current_atomic = new DCAtomicField($1, temp_class, false);
@@ -511,7 +511,7 @@ nonempty_parameter_list:
 atomic_element:
 atomic_element:
         parameter_with_default
         parameter_with_default
 {
 {
-  if ($1 != (DCParameter *)NULL) {
+  if ($1 != nullptr) {
     current_atomic->add_element($1);
     current_atomic->add_element($1);
   }
   }
 }
 }
@@ -538,14 +538,14 @@ named_parameter_with_default:
 {
 {
   current_packer = &default_packer;
   current_packer = &default_packer;
   current_packer->clear_data();
   current_packer->clear_data();
-  if ($1 != (DCField *)NULL) {
+  if ($1 != nullptr) {
     current_packer->begin_pack($1);
     current_packer->begin_pack($1);
   }
   }
 }
 }
         parameter_value
         parameter_value
 {
 {
   bool is_valid = false;
   bool is_valid = false;
-  if ($1 != (DCField *)NULL) {
+  if ($1 != nullptr) {
     is_valid = $1->is_valid();
     is_valid = $1->is_valid();
   }
   }
   if (current_packer->end_pack()) {
   if (current_packer->end_pack()) {
@@ -568,14 +568,14 @@ unnamed_parameter_with_default:
 {
 {
   current_packer = &default_packer;
   current_packer = &default_packer;
   current_packer->clear_data();
   current_packer->clear_data();
-  if ($1 != (DCField *)NULL) {
+  if ($1 != nullptr) {
     current_packer->begin_pack($1);
     current_packer->begin_pack($1);
   }
   }
 }
 }
         parameter_value
         parameter_value
 {
 {
   bool is_valid = false;
   bool is_valid = false;
-  if ($1 != (DCField *)NULL) {
+  if ($1 != nullptr) {
     is_valid = $1->is_valid();
     is_valid = $1->is_valid();
   }
   }
   if (current_packer->end_pack()) {
   if (current_packer->end_pack()) {
@@ -636,7 +636,7 @@ simple_type_name:
         | simple_type_name '(' double_range ')'
         | simple_type_name '(' double_range ')'
 {
 {
   DCSimpleParameter *simple_param = $1->as_simple_parameter();
   DCSimpleParameter *simple_param = $1->as_simple_parameter();
-  nassertr(simple_param != (DCSimpleParameter *)NULL, 0);
+  nassertr(simple_param != nullptr, 0);
   if (!simple_param->set_range(double_range)) {
   if (!simple_param->set_range(double_range)) {
     yyerror("Inappropriate range for type");
     yyerror("Inappropriate range for type");
   }
   }
@@ -645,7 +645,7 @@ simple_type_name:
         | simple_type_name '/' small_unsigned_integer
         | simple_type_name '/' small_unsigned_integer
 {
 {
   DCSimpleParameter *simple_param = $1->as_simple_parameter();
   DCSimpleParameter *simple_param = $1->as_simple_parameter();
-  nassertr(simple_param != (DCSimpleParameter *)NULL, 0);
+  nassertr(simple_param != nullptr, 0);
   if (!simple_param->is_numeric_type()) {
   if (!simple_param->is_numeric_type()) {
     yyerror("A divisor is only valid on a numeric type.");
     yyerror("A divisor is only valid on a numeric type.");
 
 
@@ -661,7 +661,7 @@ simple_type_name:
         | simple_type_name '%' number
         | simple_type_name '%' number
 { 
 { 
   DCSimpleParameter *simple_param = $1->as_simple_parameter();
   DCSimpleParameter *simple_param = $1->as_simple_parameter();
-  nassertr(simple_param != (DCSimpleParameter *)NULL, 0);
+  nassertr(simple_param != nullptr, 0);
   if (!simple_param->is_numeric_type()) {
   if (!simple_param->is_numeric_type()) {
     yyerror("A divisor is only valid on a numeric type.");
     yyerror("A divisor is only valid on a numeric type.");
 
 
@@ -676,22 +676,22 @@ type_name:
         simple_type_name
         simple_type_name
         | IDENTIFIER
         | IDENTIFIER
 {
 {
-  if (dc_file == (DCFile *)NULL) {
+  if (dc_file == nullptr) {
     yyerror("Invalid type.");
     yyerror("Invalid type.");
-    $$ = NULL;
+    $$ = nullptr;
 
 
   } else {
   } else {
     DCTypedef *dtypedef = dc_file->get_typedef_by_name($1);
     DCTypedef *dtypedef = dc_file->get_typedef_by_name($1);
-    if (dtypedef == (DCTypedef *)NULL) {
+    if (dtypedef == nullptr) {
       // Maybe it's a class name.
       // Maybe it's a class name.
       DCClass *dclass = dc_file->get_class_by_name($1);
       DCClass *dclass = dc_file->get_class_by_name($1);
-      if (dclass != (DCClass *)NULL) {
+      if (dclass != nullptr) {
         // Create an implicit typedef for this.
         // Create an implicit typedef for this.
         dtypedef = new DCTypedef(new DCClassParameter(dclass), true);
         dtypedef = new DCTypedef(new DCClassParameter(dclass), true);
       } else {
       } else {
         // Maybe it's a switch name.
         // Maybe it's a switch name.
         DCSwitch *dswitch = dc_file->get_switch_by_name($1);
         DCSwitch *dswitch = dc_file->get_switch_by_name($1);
-        if (dswitch != (DCSwitch *)NULL) {
+        if (dswitch != nullptr) {
           // This also gets an implicit typedef.
           // This also gets an implicit typedef.
           dtypedef = new DCTypedef(new DCSwitchParameter(dswitch), true);
           dtypedef = new DCTypedef(new DCSwitchParameter(dswitch), true);
         } else {
         } else {
@@ -709,10 +709,10 @@ type_name:
         | struct
         | struct
 {
 {
   // This is an inline struct definition.
   // This is an inline struct definition.
-  if ($1 == (DCClass *)NULL) {
-    $$ = NULL;
+  if ($1 == nullptr) {
+    $$ = nullptr;
   } else {
   } else {
-    if (dc_file != (DCFile *)NULL) {
+    if (dc_file != nullptr) {
       dc_file->add_thing_to_delete($1);
       dc_file->add_thing_to_delete($1);
     } else {
     } else {
       // This is a memory leak--this happens when we put an anonymous
       // This is a memory leak--this happens when we put an anonymous
@@ -725,10 +725,10 @@ type_name:
         | switch
         | switch
 {
 {
   // This is an inline switch definition.
   // This is an inline switch definition.
-  if ($1 == (DCSwitch *)NULL) {
-    $$ = NULL;
+  if ($1 == nullptr) {
+    $$ = nullptr;
   } else {
   } else {
-    if (dc_file != (DCFile *)NULL) {
+    if (dc_file != nullptr) {
       dc_file->add_thing_to_delete($1);
       dc_file->add_thing_to_delete($1);
     } else {
     } else {
       // This is a memory leak--this happens when we put an anonymous
       // This is a memory leak--this happens when we put an anonymous
@@ -840,8 +840,8 @@ type_definition:
         type_name
         type_name
         | type_definition '[' uint_range ']'
         | type_definition '[' uint_range ']'
 {
 {
-  if ($1 == (DCParameter *)NULL) {
-    $$ = NULL;
+  if ($1 == nullptr) {
+    $$ = nullptr;
   } else {
   } else {
     $$ = $1->append_array_specification(uint_range);
     $$ = $1->append_array_specification(uint_range);
   }
   }
@@ -857,7 +857,7 @@ parameter_definition:
         | parameter_definition '/' small_unsigned_integer
         | parameter_definition '/' small_unsigned_integer
 {
 {
   DCSimpleParameter *simple_param = $1->as_simple_parameter();
   DCSimpleParameter *simple_param = $1->as_simple_parameter();
-  if (simple_param == NULL || simple_param->get_typedef() != (DCTypedef *)NULL) {
+  if (simple_param == nullptr || simple_param->get_typedef() != nullptr) {
     yyerror("A divisor is only allowed on a primitive type.");
     yyerror("A divisor is only allowed on a primitive type.");
 
 
   } else if (!simple_param->is_numeric_type()) {
   } else if (!simple_param->is_numeric_type()) {
@@ -872,7 +872,7 @@ parameter_definition:
         | parameter_definition '%' number
         | parameter_definition '%' number
 {
 {
   DCSimpleParameter *simple_param = $1->as_simple_parameter();
   DCSimpleParameter *simple_param = $1->as_simple_parameter();
-  if (simple_param == NULL || simple_param->get_typedef() != (DCTypedef *)NULL) {
+  if (simple_param == nullptr || simple_param->get_typedef() != nullptr) {
     yyerror("A modulus is only allowed on a primitive type.");
     yyerror("A modulus is only allowed on a primitive type.");
 
 
   } else if (!simple_param->is_numeric_type()) {
   } else if (!simple_param->is_numeric_type()) {
@@ -1184,8 +1184,8 @@ atomic_name:
         IDENTIFIER
         IDENTIFIER
 {
 {
   DCField *field = current_class->get_field_by_name($1);
   DCField *field = current_class->get_field_by_name($1);
-  $$ = (DCAtomicField *)NULL;
-  if (field == (DCField *)NULL) {
+  $$ = nullptr;
+  if (field == nullptr) {
     // Maybe the field is unknown because the class is partially
     // Maybe the field is unknown because the class is partially
     // bogus.  In that case, allow it for now; create a bogus field as
     // bogus.  In that case, allow it for now; create a bogus field as
     // a placeholder.
     // a placeholder.
@@ -1200,7 +1200,7 @@ atomic_name:
 
 
   } else {
   } else {
     $$ = field->as_atomic_field();
     $$ = field->as_atomic_field();
-    if ($$ == (DCAtomicField *)NULL) {
+    if ($$ == nullptr) {
       yyerror("Not an atomic field: " + $1);
       yyerror("Not an atomic field: " + $1);
     }
     }
   }
   }
@@ -1210,13 +1210,13 @@ atomic_name:
 molecular_atom_list:
 molecular_atom_list:
         atomic_name
         atomic_name
 {
 {
-  if ($1 != (DCAtomicField *)NULL) {
+  if ($1 != nullptr) {
     current_molecular->add_atomic($1);
     current_molecular->add_atomic($1);
   }
   }
 }
 }
         | molecular_atom_list ',' atomic_name
         | molecular_atom_list ',' atomic_name
 {
 {
-  if ($3 != (DCAtomicField *)NULL) {
+  if ($3 != nullptr) {
     current_molecular->add_atomic($3);
     current_molecular->add_atomic($3);
     if (!$3->is_bogus_field() && !current_molecular->compare_keywords(*$3)) {
     if (!$3->is_bogus_field() && !current_molecular->compare_keywords(*$3)) {
       yyerror("Mismatched keywords in molecule between " + 
       yyerror("Mismatched keywords in molecule between " + 
@@ -1258,7 +1258,7 @@ switch_fields:
 {
 {
   if (!current_switch->is_field_valid()) {
   if (!current_switch->is_field_valid()) {
     yyerror("case declaration required before first element");
     yyerror("case declaration required before first element");
-  } else if ($2 != (DCField *)NULL) {
+  } else if ($2 != nullptr) {
     if (!current_switch->add_field($2)) {
     if (!current_switch->add_field($2)) {
       yyerror("Duplicate field name: " + $2->get_name());
       yyerror("Duplicate field name: " + $2->get_name());
     }
     }

+ 6 - 6
direct/src/dcparser/dcSimpleParameter.cxx

@@ -21,7 +21,7 @@
 #include <math.h>
 #include <math.h>
 
 
 DCSimpleParameter::NestedFieldMap DCSimpleParameter::_nested_field_map;
 DCSimpleParameter::NestedFieldMap DCSimpleParameter::_nested_field_map;
-DCClassParameter *DCSimpleParameter::_uint32uint8_type = NULL;
+DCClassParameter *DCSimpleParameter::_uint32uint8_type = nullptr;
 
 
 /**
 /**
  *
  *
@@ -186,7 +186,7 @@ DCSimpleParameter(DCSubatomicType type, unsigned int divisor) :
     _nested_field = create_uint32uint8_type();
     _nested_field = create_uint32uint8_type();
 
 
   } else {
   } else {
-    _nested_field = NULL;
+    _nested_field = nullptr;
   }
   }
 }
 }
 
 
@@ -2173,7 +2173,7 @@ unpack_skip(const char *data, size_t length, size_t &p,
 void DCSimpleParameter::
 void DCSimpleParameter::
 output_instance(ostream &out, bool brief, const string &prename,
 output_instance(ostream &out, bool brief, const string &prename,
                 const string &name, const string &postname) const {
                 const string &name, const string &postname) const {
-  if (get_typedef() != (DCTypedef *)NULL) {
+  if (get_typedef() != nullptr) {
     output_typedef_name(out, brief, prename, name, postname);
     output_typedef_name(out, brief, prename, name, postname);
 
 
   } else {
   } else {
@@ -2342,7 +2342,7 @@ do_check_match_array_parameter(const DCArrayParameter *other) const {
     // We cannot match a fixed-size array.
     // We cannot match a fixed-size array.
     return false;
     return false;
   }
   }
-  if (_nested_field == NULL) {
+  if (_nested_field == nullptr) {
     // Only an array-style simple parameter can match a DCArrayParameter.
     // Only an array-style simple parameter can match a DCArrayParameter.
     return false;
     return false;
   }
   }
@@ -2374,8 +2374,8 @@ create_nested_field(DCSubatomicType type, unsigned int divisor) {
  */
  */
 DCPackerInterface *DCSimpleParameter::
 DCPackerInterface *DCSimpleParameter::
 create_uint32uint8_type() {
 create_uint32uint8_type() {
-  if (_uint32uint8_type == NULL) {
-    DCClass *dclass = new DCClass(NULL, "", true, false);
+  if (_uint32uint8_type == nullptr) {
+    DCClass *dclass = new DCClass(nullptr, "", true, false);
     dclass->add_field(new DCSimpleParameter(ST_uint32));
     dclass->add_field(new DCSimpleParameter(ST_uint32));
     dclass->add_field(new DCSimpleParameter(ST_uint8));
     dclass->add_field(new DCSimpleParameter(ST_uint8));
     _uint32uint8_type = new DCClassParameter(dclass);
     _uint32uint8_type = new DCClassParameter(dclass);

+ 25 - 25
direct/src/dcparser/dcSwitch.cxx

@@ -27,7 +27,7 @@ DCSwitch(const string &name, DCField *key_parameter) :
   _name(name),
   _name(name),
   _key_parameter(key_parameter)
   _key_parameter(key_parameter)
 {
 {
-  _default_case = NULL;
+  _default_case = nullptr;
   _fields_added = false;
   _fields_added = false;
 }
 }
 
 
@@ -36,7 +36,7 @@ DCSwitch(const string &name, DCField *key_parameter) :
  */
  */
 DCSwitch::
 DCSwitch::
 ~DCSwitch() {
 ~DCSwitch() {
-  nassertv(_key_parameter != (DCField *)NULL);
+  nassertv(_key_parameter != nullptr);
   delete _key_parameter;
   delete _key_parameter;
 
 
   Cases::iterator ci;
   Cases::iterator ci;
@@ -121,7 +121,7 @@ get_case_by_value(const string &case_value) const {
  */
  */
 DCPackerInterface *DCSwitch::
 DCPackerInterface *DCSwitch::
 get_case(int n) const {
 get_case(int n) const {
-  nassertr(n >= 0 && n < (int)_cases.size(), NULL);
+  nassertr(n >= 0 && n < (int)_cases.size(), nullptr);
   return _cases[n]->_fields;
   return _cases[n]->_fields;
 }
 }
 
 
@@ -157,8 +157,8 @@ get_num_fields(int case_index) const {
  */
  */
 DCField *DCSwitch::
 DCField *DCSwitch::
 get_field(int case_index, int n) const {
 get_field(int case_index, int n) const {
-  nassertr(case_index >= 0 && case_index < (int)_cases.size(), NULL);
-  nassertr(n >= 0 && n < (int)_cases[case_index]->_fields->_fields.size(), NULL);
+  nassertr(case_index >= 0 && case_index < (int)_cases.size(), nullptr);
+  nassertr(n >= 0 && n < (int)_cases[case_index]->_fields->_fields.size(), nullptr);
   return _cases[case_index]->_fields->_fields[n];
   return _cases[case_index]->_fields->_fields[n];
 }
 }
 
 
@@ -168,7 +168,7 @@ get_field(int case_index, int n) const {
  */
  */
 DCField *DCSwitch::
 DCField *DCSwitch::
 get_field_by_name(int case_index, const string &name) const {
 get_field_by_name(int case_index, const string &name) const {
-  nassertr(case_index >= 0 && case_index < (int)_cases.size(), NULL);
+  nassertr(case_index >= 0 && case_index < (int)_cases.size(), nullptr);
 
 
   const FieldsByName &fields_by_name = _cases[case_index]->_fields->_fields_by_name;
   const FieldsByName &fields_by_name = _cases[case_index]->_fields->_fields_by_name;
   FieldsByName::const_iterator ni;
   FieldsByName::const_iterator ni;
@@ -177,7 +177,7 @@ get_field_by_name(int case_index, const string &name) const {
     return (*ni).second;
     return (*ni).second;
   }
   }
 
 
-  return NULL;
+  return nullptr;
 }
 }
 
 
 /**
 /**
@@ -226,7 +226,7 @@ add_invalid_case() {
  */
  */
 bool DCSwitch::
 bool DCSwitch::
 add_default() {
 add_default() {
-  if (_default_case != (SwitchFields *)NULL) {
+  if (_default_case != nullptr) {
     add_invalid_case();
     add_invalid_case();
     return false;
     return false;
   }
   }
@@ -286,12 +286,12 @@ apply_switch(const char *value_data, size_t length) const {
   }
   }
 
 
   // Unexpected value--use the default.
   // Unexpected value--use the default.
-  if (_default_case != (SwitchFields *)NULL) {
+  if (_default_case != nullptr) {
     return _default_case;
     return _default_case;
   }
   }
 
 
   // No default.
   // No default.
-  return NULL;
+  return nullptr;
 }
 }
 
 
 /**
 /**
@@ -326,26 +326,26 @@ output_instance(ostream &out, bool brief, const string &prename,
   _key_parameter->output(out, brief);
   _key_parameter->output(out, brief);
   out << ") {";
   out << ") {";
 
 
-  const SwitchFields *last_fields = NULL;
+  const SwitchFields *last_fields = nullptr;
 
 
   Cases::const_iterator ci;
   Cases::const_iterator ci;
   for (ci = _cases.begin(); ci != _cases.end(); ++ci) {
   for (ci = _cases.begin(); ci != _cases.end(); ++ci) {
     const SwitchCase *dcase = (*ci);
     const SwitchCase *dcase = (*ci);
-    if (dcase->_fields != last_fields && last_fields != (SwitchFields *)NULL) {
+    if (dcase->_fields != last_fields && last_fields != nullptr) {
       last_fields->output(out, brief);
       last_fields->output(out, brief);
     }
     }
     last_fields = dcase->_fields;
     last_fields = dcase->_fields;
     out << "case " << _key_parameter->format_data(dcase->_value, false) << ": ";
     out << "case " << _key_parameter->format_data(dcase->_value, false) << ": ";
   }
   }
 
 
-  if (_default_case != (SwitchFields *)NULL) {
-    if (_default_case != last_fields && last_fields != (SwitchFields *)NULL) {
+  if (_default_case != nullptr) {
+    if (_default_case != last_fields && last_fields != nullptr) {
       last_fields->output(out, brief);
       last_fields->output(out, brief);
     }
     }
     last_fields = _default_case;
     last_fields = _default_case;
     out << "default: ";
     out << "default: ";
   }
   }
-  if (last_fields != (SwitchFields *)NULL) {
+  if (last_fields != nullptr) {
     last_fields->output(out, brief);
     last_fields->output(out, brief);
   }
   }
 
 
@@ -372,12 +372,12 @@ write_instance(ostream &out, bool brief, int indent_level,
   _key_parameter->output(out, brief);
   _key_parameter->output(out, brief);
   out << ") {\n";
   out << ") {\n";
 
 
-  const SwitchFields *last_fields = NULL;
+  const SwitchFields *last_fields = nullptr;
 
 
   Cases::const_iterator ci;
   Cases::const_iterator ci;
   for (ci = _cases.begin(); ci != _cases.end(); ++ci) {
   for (ci = _cases.begin(); ci != _cases.end(); ++ci) {
     const SwitchCase *dcase = (*ci);
     const SwitchCase *dcase = (*ci);
-    if (dcase->_fields != last_fields && last_fields != (SwitchFields *)NULL) {
+    if (dcase->_fields != last_fields && last_fields != nullptr) {
       last_fields->write(out, brief, indent_level + 2);
       last_fields->write(out, brief, indent_level + 2);
     }
     }
     last_fields = dcase->_fields;
     last_fields = dcase->_fields;
@@ -385,15 +385,15 @@ write_instance(ostream &out, bool brief, int indent_level,
       << "case " << _key_parameter->format_data(dcase->_value, false) << ":\n";
       << "case " << _key_parameter->format_data(dcase->_value, false) << ":\n";
   }
   }
 
 
-  if (_default_case != (SwitchFields *)NULL) {
-    if (_default_case != last_fields && last_fields != (SwitchFields *)NULL) {
+  if (_default_case != nullptr) {
+    if (_default_case != last_fields && last_fields != nullptr) {
       last_fields->write(out, brief, indent_level + 2);
       last_fields->write(out, brief, indent_level + 2);
     }
     }
     last_fields = _default_case;
     last_fields = _default_case;
     indent(out, indent_level)
     indent(out, indent_level)
       << "default:\n";
       << "default:\n";
   }
   }
-  if (last_fields != (SwitchFields *)NULL) {
+  if (last_fields != nullptr) {
     last_fields->write(out, brief, indent_level + 2);
     last_fields->write(out, brief, indent_level + 2);
   }
   }
 
 
@@ -428,7 +428,7 @@ generate_hash(HashGenerator &hashgen) const {
     }
     }
   }
   }
 
 
-  if (_default_case != (SwitchFields *)NULL) {
+  if (_default_case != nullptr) {
     const SwitchFields *fields = _default_case;
     const SwitchFields *fields = _default_case;
     hashgen.add_int(fields->_fields.size());
     hashgen.add_int(fields->_fields.size());
     Fields::const_iterator fi;
     Fields::const_iterator fi;
@@ -446,7 +446,7 @@ generate_hash(HashGenerator &hashgen) const {
  */
  */
 bool DCSwitch::
 bool DCSwitch::
 pack_default_value(DCPackData &pack_data, bool &pack_error) const {
 pack_default_value(DCPackData &pack_data, bool &pack_error) const {
-  SwitchFields *fields = NULL;
+  SwitchFields *fields = nullptr;
   DCPacker packer;
   DCPacker packer;
   packer.begin_pack(_key_parameter);
   packer.begin_pack(_key_parameter);
   if (!_cases.empty()) {
   if (!_cases.empty()) {
@@ -466,7 +466,7 @@ pack_default_value(DCPackData &pack_data, bool &pack_error) const {
     pack_error = true;
     pack_error = true;
   }
   }
 
 
-  if (fields == (SwitchFields *)NULL) {
+  if (fields == nullptr) {
     pack_error = true;
     pack_error = true;
 
 
   } else {
   } else {
@@ -528,7 +528,7 @@ do_check_match_switch(const DCSwitch *other) const {
  */
  */
 DCSwitch::SwitchFields *DCSwitch::
 DCSwitch::SwitchFields *DCSwitch::
 start_new_case() {
 start_new_case() {
-  SwitchFields *fields = NULL;
+  SwitchFields *fields = nullptr;
 
 
   if (_current_fields.empty() || _fields_added) {
   if (_current_fields.empty() || _fields_added) {
     // If we have recently encountered a break (which removes all of the
     // If we have recently encountered a break (which removes all of the
@@ -587,7 +587,7 @@ DCSwitch::SwitchFields::
  */
  */
 DCPackerInterface *DCSwitch::SwitchFields::
 DCPackerInterface *DCSwitch::SwitchFields::
 get_nested_field(int n) const {
 get_nested_field(int n) const {
-  nassertr(n >= 0 && n < (int)_fields.size(), NULL);
+  nassertr(n >= 0 && n < (int)_fields.size(), nullptr);
   return _fields[n];
   return _fields[n];
 }
 }
 
 

+ 3 - 3
direct/src/dcparser/dcSwitchParameter.cxx

@@ -66,7 +66,7 @@ DCSwitchParameter(const DCSwitch *dswitch) :
   // Also consider the default case, if there is one.
   // Also consider the default case, if there is one.
   const DCSwitch::SwitchFields *fields =
   const DCSwitch::SwitchFields *fields =
     (DCSwitch::SwitchFields *)_dswitch->get_default_case();
     (DCSwitch::SwitchFields *)_dswitch->get_default_case();
-  if (fields != (DCSwitch::SwitchFields *)NULL) {
+  if (fields != nullptr) {
     if (!fields->has_fixed_byte_size() ||
     if (!fields->has_fixed_byte_size() ||
         fields->get_fixed_byte_size() != _fixed_byte_size) {
         fields->get_fixed_byte_size() != _fixed_byte_size) {
       _has_fixed_byte_size = false;
       _has_fixed_byte_size = false;
@@ -155,7 +155,7 @@ apply_switch(const char *value_data, size_t length) const {
 void DCSwitchParameter::
 void DCSwitchParameter::
 output_instance(ostream &out, bool brief, const string &prename,
 output_instance(ostream &out, bool brief, const string &prename,
                 const string &name, const string &postname) const {
                 const string &name, const string &postname) const {
-  if (get_typedef() != (DCTypedef *)NULL) {
+  if (get_typedef() != nullptr) {
     output_typedef_name(out, brief, prename, name, postname);
     output_typedef_name(out, brief, prename, name, postname);
 
 
   } else {
   } else {
@@ -171,7 +171,7 @@ void DCSwitchParameter::
 write_instance(ostream &out, bool brief, int indent_level,
 write_instance(ostream &out, bool brief, int indent_level,
                const string &prename, const string &name,
                const string &prename, const string &name,
                const string &postname) const {
                const string &postname) const {
-  if (get_typedef() != (DCTypedef *)NULL) {
+  if (get_typedef() != nullptr) {
     write_typedef_name(out, brief, indent_level, prename, name, postname);
     write_typedef_name(out, brief, indent_level, prename, name, postname);
 
 
   } else {
   } else {

+ 3 - 3
direct/src/directd/directd.cxx

@@ -83,7 +83,7 @@ namespace {
     // If we can't open the process with PROCESS_TERMINATE rights, then we
     // If we can't open the process with PROCESS_TERMINATE rights, then we
     // give up immediately.
     // give up immediately.
     hProc = OpenProcess(SYNCHRONIZE|PROCESS_TERMINATE, FALSE, dwPID);
     hProc = OpenProcess(SYNCHRONIZE|PROCESS_TERMINATE, FALSE, dwPID);
-    if(hProc == NULL) {
+    if(hProc == nullptr) {
        return TA_FAILED;
        return TA_FAILED;
     }
     }
 
 
@@ -115,7 +115,7 @@ namespace {
     ZeroMemory(&si, sizeof(STARTUPINFO));
     ZeroMemory(&si, sizeof(STARTUPINFO));
     si.cb = sizeof(STARTUPINFO);
     si.cb = sizeof(STARTUPINFO);
     ZeroMemory(&pi, sizeof(PROCESS_INFORMATION));
     ZeroMemory(&pi, sizeof(PROCESS_INFORMATION));
-    if (CreateProcess(NULL, (char*)cmd.c_str(),
+    if (CreateProcess(nullptr, (char*)cmd.c_str(),
         0, 0, 1, NORMAL_PRIORITY_CLASS,
         0, 0, 1, NORMAL_PRIORITY_CLASS,
         0, 0, &si, &pi)) {
         0, 0, &si, &pi)) {
       pid=pi.dwProcessId;
       pid=pi.dwProcessId;
@@ -228,7 +228,7 @@ DirectD::start_app(const string& cmd) {
     ZeroMemory(&si, sizeof(STARTUPINFO));
     ZeroMemory(&si, sizeof(STARTUPINFO));
     si.cb = sizeof(STARTUPINFO);
     si.cb = sizeof(STARTUPINFO);
     ZeroMemory(&pi, sizeof(PROCESS_INFORMATION));
     ZeroMemory(&pi, sizeof(PROCESS_INFORMATION));
-    if (CreateProcess(NULL, (char*)cmd.c_str(),
+    if (CreateProcess(nullptr, (char*)cmd.c_str(),
         0, 0, 1, NORMAL_PRIORITY_CLASS | CREATE_SUSPENDED,
         0, 0, 1, NORMAL_PRIORITY_CLASS | CREATE_SUSPENDED,
         0, 0, &si, &pi)) {
         0, 0, &si, &pi)) {
       // The process must be created with CREATE_SUSPENDED to give us a chance
       // The process must be created with CREATE_SUSPENDED to give us a chance

+ 39 - 39
direct/src/distributed/cConnectionRepository.cxx

@@ -41,10 +41,10 @@ CConnectionRepository::
 CConnectionRepository(bool has_owner_view, bool threaded_net) :
 CConnectionRepository(bool has_owner_view, bool threaded_net) :
   _lock("CConnectionRepository::_lock"),
   _lock("CConnectionRepository::_lock"),
 #ifdef HAVE_PYTHON
 #ifdef HAVE_PYTHON
-  _python_repository(NULL),
+  _python_repository(nullptr),
 #endif
 #endif
 #ifdef HAVE_OPENSSL
 #ifdef HAVE_OPENSSL
-  _http_conn(NULL),
+  _http_conn(nullptr),
 #endif
 #endif
 #ifdef HAVE_NET
 #ifdef HAVE_NET
   _cw(&_qcm, threaded_net ? 1 : 0),
   _cw(&_qcm, threaded_net ? 1 : 0),
@@ -95,7 +95,7 @@ set_tcp_header_size(int tcp_header_size) {
   _tcp_header_size = tcp_header_size;
   _tcp_header_size = tcp_header_size;
 
 
 #ifdef HAVE_OPENSSL
 #ifdef HAVE_OPENSSL
-  if (_http_conn != (SocketStream *)NULL) {
+  if (_http_conn != nullptr) {
     _http_conn->set_tcp_header_size(tcp_header_size);
     _http_conn->set_tcp_header_size(tcp_header_size);
   }
   }
 #endif
 #endif
@@ -157,7 +157,7 @@ try_connect_net(const URLSpec &url) {
     _qcm.open_TCP_client_connection(url.get_server(), url.get_port(),
     _qcm.open_TCP_client_connection(url.get_server(), url.get_port(),
                                     game_server_timeout_ms);
                                     game_server_timeout_ms);
 
 
-  if (_net_conn != (Connection *)NULL) {
+  if (_net_conn != nullptr) {
     _net_conn->set_no_delay(true);
     _net_conn->set_no_delay(true);
     _qcr.add_connection(_net_conn);
     _qcr.add_connection(_net_conn);
     return true;
     return true;
@@ -209,7 +209,7 @@ start_delay(double min_delay, double max_delay) {
     _qcr.start_delay(min_delay, max_delay);
     _qcr.start_delay(min_delay, max_delay);
 #endif  // HAVE_NET
 #endif  // HAVE_NET
 #ifdef HAVE_OPENSSL
 #ifdef HAVE_OPENSSL
-    if (_http_conn != (SocketStream *)NULL) {
+    if (_http_conn != nullptr) {
       _http_conn->start_delay(min_delay, max_delay);
       _http_conn->start_delay(min_delay, max_delay);
     }
     }
 #endif  // HAVE_OPENSSL
 #endif  // HAVE_OPENSSL
@@ -233,7 +233,7 @@ stop_delay() {
   _qcr.stop_delay();
   _qcr.stop_delay();
 #endif  // HAVE_NET
 #endif  // HAVE_NET
 #ifdef HAVE_OPENSSL
 #ifdef HAVE_OPENSSL
-  if (_http_conn != (SocketStream *)NULL) {
+  if (_http_conn != nullptr) {
     _http_conn->stop_delay();
     _http_conn->stop_delay();
   }
   }
 #endif  // HAVE_OPENSSL
 #endif  // HAVE_OPENSSL
@@ -278,7 +278,7 @@ check_datagram() {
 #ifdef HAVE_PYTHON
 #ifdef HAVE_PYTHON
       // For now, we need to stuff this field onto the Python structure, to
       // For now, we need to stuff this field onto the Python structure, to
       // support legacy code that expects to find it there.
       // support legacy code that expects to find it there.
-      if (_python_repository != (PyObject *)NULL) {
+      if (_python_repository != nullptr) {
 #if defined(HAVE_THREADS) && !defined(SIMPLE_THREADS)
 #if defined(HAVE_THREADS) && !defined(SIMPLE_THREADS)
         PyGILState_STATE gstate;
         PyGILState_STATE gstate;
         gstate = PyGILState_Ensure();
         gstate = PyGILState_Ensure();
@@ -353,7 +353,7 @@ is_connected() {
         _qcm.close_connection(reset_connection);
         _qcm.close_connection(reset_connection);
         if (reset_connection == _net_conn) {
         if (reset_connection == _net_conn) {
           // Whoops, lost our connection.
           // Whoops, lost our connection.
-          _net_conn = NULL;
+          _net_conn = nullptr;
           return false;
           return false;
         }
         }
       }
       }
@@ -370,7 +370,7 @@ is_connected() {
 
 
     // Connection lost.
     // Connection lost.
     delete _http_conn;
     delete _http_conn;
-    _http_conn = NULL;
+    _http_conn = nullptr;
   }
   }
 #endif  // HAVE_OPENSSL
 #endif  // HAVE_OPENSSL
 
 
@@ -607,7 +607,7 @@ disconnect() {
   #ifdef HAVE_NET
   #ifdef HAVE_NET
   if (_net_conn) {
   if (_net_conn) {
     _qcm.close_connection(_net_conn);
     _qcm.close_connection(_net_conn);
-    _net_conn = NULL;
+    _net_conn = nullptr;
   }
   }
   #endif  // HAVE_NET
   #endif  // HAVE_NET
 
 
@@ -615,7 +615,7 @@ disconnect() {
   if (_http_conn) {
   if (_http_conn) {
     _http_conn->close();
     _http_conn->close();
     delete _http_conn;
     delete _http_conn;
-    _http_conn = NULL;
+    _http_conn = nullptr;
   }
   }
   #endif  // HAVE_OPENSSL
   #endif  // HAVE_OPENSSL
 
 
@@ -684,11 +684,11 @@ handle_update_field() {
 
 
   PStatTimer timer(_update_pcollector);
   PStatTimer timer(_update_pcollector);
   unsigned int do_id = _di.get_uint32();
   unsigned int do_id = _di.get_uint32();
-  if (_python_repository != (PyObject *)NULL)
+  if (_python_repository != nullptr)
   {
   {
     PyObject *doId2do =
     PyObject *doId2do =
       PyObject_GetAttrString(_python_repository, "doId2do");
       PyObject_GetAttrString(_python_repository, "doId2do");
-    nassertr(doId2do != NULL, false);
+    nassertr(doId2do != nullptr, false);
 
 
     #ifdef USE_PYTHON_2_2_OR_EARLIER
     #ifdef USE_PYTHON_2_2_OR_EARLIER
     PyObject *doId = PyInt_FromLong(do_id);
     PyObject *doId = PyInt_FromLong(do_id);
@@ -699,14 +699,14 @@ handle_update_field() {
     Py_DECREF(doId);
     Py_DECREF(doId);
     Py_DECREF(doId2do);
     Py_DECREF(doId2do);
 
 
-    if (distobj != NULL) {
+    if (distobj != nullptr) {
       PyObject *dclass_obj = PyObject_GetAttrString(distobj, "dclass");
       PyObject *dclass_obj = PyObject_GetAttrString(distobj, "dclass");
-      nassertr(dclass_obj != NULL, false);
+      nassertr(dclass_obj != nullptr, false);
 
 
 
 
       PyObject *dclass_this = PyObject_GetAttrString(dclass_obj, "this");
       PyObject *dclass_this = PyObject_GetAttrString(dclass_obj, "this");
       Py_DECREF(dclass_obj);
       Py_DECREF(dclass_obj);
-      nassertr(dclass_this != NULL, false);
+      nassertr(dclass_this != nullptr, false);
 
 
       DCClass *dclass = (DCClass *)PyLong_AsVoidPtr(dclass_this);
       DCClass *dclass = (DCClass *)PyLong_AsVoidPtr(dclass_this);
       Py_DECREF(dclass_this);
       Py_DECREF(dclass_this);
@@ -715,7 +715,7 @@ handle_update_field() {
       // 'neverDisable' attribute set to non-zero
       // 'neverDisable' attribute set to non-zero
       if (_in_quiet_zone) {
       if (_in_quiet_zone) {
         PyObject *neverDisable = PyObject_GetAttrString(distobj, "neverDisable");
         PyObject *neverDisable = PyObject_GetAttrString(distobj, "neverDisable");
-        nassertr(neverDisable != NULL, false);
+        nassertr(neverDisable != nullptr, false);
 
 
         unsigned int cNeverDisable = PyLong_AsLong(neverDisable);
         unsigned int cNeverDisable = PyLong_AsLong(neverDisable);
         if (!cNeverDisable) {
         if (!cNeverDisable) {
@@ -772,14 +772,14 @@ handle_update_field_owner() {
 
 
   PStatTimer timer(_update_pcollector);
   PStatTimer timer(_update_pcollector);
   unsigned int do_id = _di.get_uint32();
   unsigned int do_id = _di.get_uint32();
-  if (_python_repository != (PyObject *)NULL) {
+  if (_python_repository != nullptr) {
     PyObject *doId2do =
     PyObject *doId2do =
       PyObject_GetAttrString(_python_repository, "doId2do");
       PyObject_GetAttrString(_python_repository, "doId2do");
-    nassertr(doId2do != NULL, false);
+    nassertr(doId2do != nullptr, false);
 
 
     PyObject *doId2ownerView =
     PyObject *doId2ownerView =
       PyObject_GetAttrString(_python_repository, "doId2ownerView");
       PyObject_GetAttrString(_python_repository, "doId2ownerView");
-    nassertr(doId2ownerView != NULL, false);
+    nassertr(doId2ownerView != nullptr, false);
 
 
     #ifdef USE_PYTHON_2_2_OR_EARLIER
     #ifdef USE_PYTHON_2_2_OR_EARLIER
     PyObject *doId = PyInt_FromLong(do_id);
     PyObject *doId = PyInt_FromLong(do_id);
@@ -791,13 +791,13 @@ handle_update_field_owner() {
     PyObject *distobjOV = PyDict_GetItem(doId2ownerView, doId);
     PyObject *distobjOV = PyDict_GetItem(doId2ownerView, doId);
     Py_DECREF(doId2ownerView);
     Py_DECREF(doId2ownerView);
 
 
-    if (distobjOV != NULL) {
+    if (distobjOV != nullptr) {
       PyObject *dclass_obj = PyObject_GetAttrString(distobjOV, "dclass");
       PyObject *dclass_obj = PyObject_GetAttrString(distobjOV, "dclass");
-      nassertr(dclass_obj != NULL, false);
+      nassertr(dclass_obj != nullptr, false);
 
 
       PyObject *dclass_this = PyObject_GetAttrString(dclass_obj, "this");
       PyObject *dclass_this = PyObject_GetAttrString(dclass_obj, "this");
       Py_DECREF(dclass_obj);
       Py_DECREF(dclass_obj);
-      nassertr(dclass_this != NULL, false);
+      nassertr(dclass_this != nullptr, false);
 
 
       DCClass *dclass = (DCClass *)PyLong_AsVoidPtr(dclass_this);
       DCClass *dclass = (DCClass *)PyLong_AsVoidPtr(dclass_this);
       Py_DECREF(dclass_this);
       Py_DECREF(dclass_this);
@@ -834,13 +834,13 @@ handle_update_field_owner() {
     Py_DECREF(doId);
     Py_DECREF(doId);
     Py_DECREF(doId2do);
     Py_DECREF(doId2do);
 
 
-    if (distobj != NULL) {
+    if (distobj != nullptr) {
       PyObject *dclass_obj = PyObject_GetAttrString(distobj, "dclass");
       PyObject *dclass_obj = PyObject_GetAttrString(distobj, "dclass");
-      nassertr(dclass_obj != NULL, false);
+      nassertr(dclass_obj != nullptr, false);
 
 
       PyObject *dclass_this = PyObject_GetAttrString(dclass_obj, "this");
       PyObject *dclass_this = PyObject_GetAttrString(dclass_obj, "this");
       Py_DECREF(dclass_obj);
       Py_DECREF(dclass_obj);
-      nassertr(dclass_this != NULL, false);
+      nassertr(dclass_this != nullptr, false);
 
 
       DCClass *dclass = (DCClass *)PyLong_AsVoidPtr(dclass_this);
       DCClass *dclass = (DCClass *)PyLong_AsVoidPtr(dclass_this);
       Py_DECREF(dclass_this);
       Py_DECREF(dclass_this);
@@ -915,19 +915,19 @@ describe_message(ostream &out, const string &prefix,
     string msgName;
     string msgName;
 
 
     #ifdef HAVE_PYTHON
     #ifdef HAVE_PYTHON
-    if (_python_repository != (PyObject *)NULL) {
+    if (_python_repository != nullptr) {
       PyObject *msgId = PyLong_FromLong(msg_type);
       PyObject *msgId = PyLong_FromLong(msg_type);
-      nassertv(msgId != NULL);
+      nassertv(msgId != nullptr);
 #if PY_MAJOR_VERSION >= 3
 #if PY_MAJOR_VERSION >= 3
       PyObject *methodName = PyUnicode_FromString("_getMsgName");
       PyObject *methodName = PyUnicode_FromString("_getMsgName");
 #else
 #else
       PyObject *methodName = PyString_FromString("_getMsgName");
       PyObject *methodName = PyString_FromString("_getMsgName");
 #endif
 #endif
-      nassertv(methodName != NULL);
+      nassertv(methodName != nullptr);
 
 
       PyObject *result = PyObject_CallMethodObjArgs(_python_repository, methodName,
       PyObject *result = PyObject_CallMethodObjArgs(_python_repository, methodName,
-                                                    msgId, NULL);
-      nassertv(result != NULL);
+                                                    msgId, nullptr);
+      nassertv(result != nullptr);
 
 
 #if PY_MAJOR_VERSION >= 3
 #if PY_MAJOR_VERSION >= 3
       msgName += string(PyUnicode_AsUTF8(result));
       msgName += string(PyUnicode_AsUTF8(result));
@@ -952,13 +952,13 @@ describe_message(ostream &out, const string &prefix,
     // It's an update message.  Figure out what dclass the object is based on
     // It's an update message.  Figure out what dclass the object is based on
     // its doId, so we can decode the rest of the message.
     // its doId, so we can decode the rest of the message.
     do_id = packer.raw_unpack_uint32();
     do_id = packer.raw_unpack_uint32();
-    DCClass *dclass = NULL;
+    DCClass *dclass = nullptr;
 
 
     #ifdef HAVE_PYTHON
     #ifdef HAVE_PYTHON
-    if (_python_repository != (PyObject *)NULL) {
+    if (_python_repository != nullptr) {
       PyObject *doId2do =
       PyObject *doId2do =
         PyObject_GetAttrString(_python_repository, "doId2do");
         PyObject_GetAttrString(_python_repository, "doId2do");
-      nassertv(doId2do != NULL);
+      nassertv(doId2do != nullptr);
 
 
       #ifdef USE_PYTHON_2_2_OR_EARLIER
       #ifdef USE_PYTHON_2_2_OR_EARLIER
       PyObject *doId = PyInt_FromLong(do_id);
       PyObject *doId = PyInt_FromLong(do_id);
@@ -969,13 +969,13 @@ describe_message(ostream &out, const string &prefix,
       Py_DECREF(doId);
       Py_DECREF(doId);
       Py_DECREF(doId2do);
       Py_DECREF(doId2do);
 
 
-      if (distobj != NULL) {
+      if (distobj != nullptr) {
         PyObject *dclass_obj = PyObject_GetAttrString(distobj, "dclass");
         PyObject *dclass_obj = PyObject_GetAttrString(distobj, "dclass");
-        nassertv(dclass_obj != NULL);
+        nassertv(dclass_obj != nullptr);
 
 
         PyObject *dclass_this = PyObject_GetAttrString(dclass_obj, "this");
         PyObject *dclass_this = PyObject_GetAttrString(dclass_obj, "this");
         Py_DECREF(dclass_obj);
         Py_DECREF(dclass_obj);
-        nassertv(dclass_this != NULL);
+        nassertv(dclass_this != nullptr);
 
 
         dclass = (DCClass *)PyLong_AsVoidPtr(dclass_this);
         dclass = (DCClass *)PyLong_AsVoidPtr(dclass_this);
         Py_DECREF(dclass_this);
         Py_DECREF(dclass_this);
@@ -985,7 +985,7 @@ describe_message(ostream &out, const string &prefix,
 
 
     int field_id = packer.raw_unpack_uint16();
     int field_id = packer.raw_unpack_uint16();
 
 
-    if (dclass == (DCClass *)NULL) {
+    if (dclass == nullptr) {
       out << full_prefix << "update for unknown object " << do_id
       out << full_prefix << "update for unknown object " << do_id
           << ", field " << field_id << "\n";
           << ", field " << field_id << "\n";
 
 
@@ -993,7 +993,7 @@ describe_message(ostream &out, const string &prefix,
       out << full_prefix <<
       out << full_prefix <<
         ":" << dclass->get_name() << "(" << do_id << ").";
         ":" << dclass->get_name() << "(" << do_id << ").";
       DCField *field = dclass->get_field_by_index(field_id);
       DCField *field = dclass->get_field_by_index(field_id);
-      if (field == (DCField *)NULL) {
+      if (field == nullptr) {
         out << "unknown field " << field_id << "\n";
         out << "unknown field " << field_id << "\n";
 
 
       } else {
       } else {

+ 6 - 6
direct/src/distributed/cDistributedSmoothNodeBase.cxx

@@ -26,12 +26,12 @@ static const double network_time_precision = 100.0;  // Matches ClockDelta.py
  */
  */
 CDistributedSmoothNodeBase::
 CDistributedSmoothNodeBase::
 CDistributedSmoothNodeBase() {
 CDistributedSmoothNodeBase() {
-  _repository = NULL;
+  _repository = nullptr;
   _is_ai = false;
   _is_ai = false;
   _ai_id = 0;
   _ai_id = 0;
 
 
 #ifdef HAVE_PYTHON
 #ifdef HAVE_PYTHON
-  _clock_delta = NULL;
+  _clock_delta = nullptr;
 #endif
 #endif
 
 
   _currL[0] = 0;
   _currL[0] = 0;
@@ -270,7 +270,7 @@ broadcast_pos_hpr_xy() {
 void CDistributedSmoothNodeBase::
 void CDistributedSmoothNodeBase::
 begin_send_update(DCPacker &packer, const string &field_name) {
 begin_send_update(DCPacker &packer, const string &field_name) {
   DCField *field = _dclass->get_field_by_name(field_name);
   DCField *field = _dclass->get_field_by_name(field_name);
-  nassertv(field != (DCField *)NULL);
+  nassertv(field != nullptr);
 
 
   if (_is_ai) {
   if (_is_ai) {
 
 
@@ -298,9 +298,9 @@ begin_send_update(DCPacker &packer, const string &field_name) {
 void CDistributedSmoothNodeBase::
 void CDistributedSmoothNodeBase::
 finish_send_update(DCPacker &packer) {
 finish_send_update(DCPacker &packer) {
 #ifdef HAVE_PYTHON
 #ifdef HAVE_PYTHON
-  nassertv(_clock_delta != NULL);
+  nassertv(_clock_delta != nullptr);
   PyObject *clock_delta = PyObject_GetAttrString(_clock_delta, "delta");
   PyObject *clock_delta = PyObject_GetAttrString(_clock_delta, "delta");
-  nassertv(clock_delta != NULL);
+  nassertv(clock_delta != nullptr);
   double delta = PyFloat_AsDouble(clock_delta);
   double delta = PyFloat_AsDouble(clock_delta);
   Py_DECREF(clock_delta);
   Py_DECREF(clock_delta);
 #else
 #else
@@ -319,7 +319,7 @@ finish_send_update(DCPacker &packer) {
   bool pack_ok = packer.end_pack();
   bool pack_ok = packer.end_pack();
   if (pack_ok) {
   if (pack_ok) {
     Datagram dg(packer.get_data(), packer.get_length());
     Datagram dg(packer.get_data(), packer.get_length());
-    nassertv(_repository != NULL);
+    nassertv(_repository != nullptr);
     _repository->send_datagram(dg);
     _repository->send_datagram(dg);
 
 
   } else {
   } else {

+ 11 - 11
direct/src/interval/cIntervalManager.cxx

@@ -125,7 +125,7 @@ CInterval *CIntervalManager::
 get_c_interval(int index) const {
 get_c_interval(int index) const {
   MutexHolder holder(_lock);
   MutexHolder holder(_lock);
 
 
-  nassertr(index >= 0 && index < (int)_intervals.size(), NULL);
+  nassertr(index >= 0 && index < (int)_intervals.size(), nullptr);
   return _intervals[index]._interval;
   return _intervals[index]._interval;
 }
 }
 
 
@@ -140,14 +140,14 @@ remove_c_interval(int index) {
 
 
   nassertv(index >= 0 && index < (int)_intervals.size());
   nassertv(index >= 0 && index < (int)_intervals.size());
   IntervalDef &def = _intervals[index];
   IntervalDef &def = _intervals[index];
-  nassertv(def._interval != (CInterval *)NULL);
+  nassertv(def._interval != nullptr);
 
 
   NameIndex::iterator ni = _name_index.find(def._interval->get_name());
   NameIndex::iterator ni = _name_index.find(def._interval->get_name());
   nassertv(ni != _name_index.end());
   nassertv(ni != _name_index.end());
   nassertv((*ni).second == index);
   nassertv((*ni).second == index);
   _name_index.erase(ni);
   _name_index.erase(ni);
 
 
-  def._interval = (CInterval *)NULL;
+  def._interval = nullptr;
   def._next_slot = _first_slot;
   def._next_slot = _first_slot;
   _first_slot = index;
   _first_slot = index;
 }
 }
@@ -171,7 +171,7 @@ interrupt() {
   while (ni != _name_index.end()) {
   while (ni != _name_index.end()) {
     int index = (*ni).second;
     int index = (*ni).second;
     const IntervalDef &def = _intervals[index];
     const IntervalDef &def = _intervals[index];
-    nassertr(def._interval != (CInterval *)NULL, num_paused);
+    nassertr(def._interval != nullptr, num_paused);
     if (def._interval->get_auto_pause() || def._interval->get_auto_finish()) {
     if (def._interval->get_auto_pause() || def._interval->get_auto_finish()) {
       // This interval may be interrupted.
       // This interval may be interrupted.
       if (def._interval->get_auto_pause()) {
       if (def._interval->get_auto_pause()) {
@@ -262,7 +262,7 @@ step() {
   while (ni != _name_index.end()) {
   while (ni != _name_index.end()) {
     int index = (*ni).second;
     int index = (*ni).second;
     const IntervalDef &def = _intervals[index];
     const IntervalDef &def = _intervals[index];
-    nassertv(def._interval != (CInterval *)NULL);
+    nassertv(def._interval != nullptr);
     if (!def._interval->step_play()) {
     if (!def._interval->step_play()) {
       // This interval is finished and wants to be removed from the active
       // This interval is finished and wants to be removed from the active
       // list.
       // list.
@@ -299,7 +299,7 @@ get_next_event() {
 
 
   while (_next_event_index < (int)_intervals.size()) {
   while (_next_event_index < (int)_intervals.size()) {
     IntervalDef &def = _intervals[_next_event_index];
     IntervalDef &def = _intervals[_next_event_index];
-    if (def._interval != (CInterval *)NULL) {
+    if (def._interval != nullptr) {
       if ((def._flags & F_external) != 0 &&
       if ((def._flags & F_external) != 0 &&
           def._interval->check_t_callback()) {
           def._interval->check_t_callback()) {
         return _next_event_index;
         return _next_event_index;
@@ -338,7 +338,7 @@ get_next_removal() {
 
 
     nassertr(index >= 0 && index < (int)_intervals.size(), -1);
     nassertr(index >= 0 && index < (int)_intervals.size(), -1);
     IntervalDef &def = _intervals[index];
     IntervalDef &def = _intervals[index];
-    def._interval = (CInterval *)NULL;
+    def._interval = nullptr;
     def._next_slot = _first_slot;
     def._next_slot = _first_slot;
     _first_slot = index;
     _first_slot = index;
     return index;
     return index;
@@ -373,7 +373,7 @@ write(ostream &out) const {
     int index = (*ni).second;
     int index = (*ni).second;
     nassertv(index >= 0 && index < (int)_intervals.size());
     nassertv(index >= 0 && index < (int)_intervals.size());
     const IntervalDef &def = _intervals[index];
     const IntervalDef &def = _intervals[index];
-    nassertv(def._interval != (CInterval *)NULL);
+    nassertv(def._interval != nullptr);
     out << *def._interval << "\n";
     out << *def._interval << "\n";
   }
   }
 
 
@@ -384,7 +384,7 @@ write(ostream &out) const {
       int index = (*ri);
       int index = (*ri);
       nassertv(index >= 0 && index < (int)_intervals.size());
       nassertv(index >= 0 && index < (int)_intervals.size());
       const IntervalDef &def = _intervals[index];
       const IntervalDef &def = _intervals[index];
-      nassertv(def._interval != (CInterval *)NULL);
+      nassertv(def._interval != nullptr);
       out << "(R)" << *def._interval << "\n";
       out << "(R)" << *def._interval << "\n";
     }
     }
   }
   }
@@ -395,7 +395,7 @@ write(ostream &out) const {
  */
  */
 CIntervalManager *CIntervalManager::
 CIntervalManager *CIntervalManager::
 get_global_ptr() {
 get_global_ptr() {
-  if (_global_ptr == (CIntervalManager *)NULL) {
+  if (_global_ptr == nullptr) {
     _global_ptr = new CIntervalManager;
     _global_ptr = new CIntervalManager;
   }
   }
   return _global_ptr;
   return _global_ptr;
@@ -433,7 +433,7 @@ remove_index(int index) {
   if ((def._flags & F_external) != 0) {
   if ((def._flags & F_external) != 0) {
     _removed.push_back(index);
     _removed.push_back(index);
   } else {
   } else {
-    def._interval = (CInterval *)NULL;
+    def._interval = nullptr;
     def._next_slot = _first_slot;
     def._next_slot = _first_slot;
     _first_slot = index;
     _first_slot = index;
   }
   }

+ 5 - 5
direct/src/interval/cLerpNodePathInterval.cxx

@@ -57,7 +57,7 @@ CLerpNodePathInterval(const string &name, double duration,
   _flags(0),
   _flags(0),
   _texture_stage(TextureStage::get_default()),
   _texture_stage(TextureStage::get_default()),
   _override(0),
   _override(0),
-  _slerp(NULL)
+  _slerp(nullptr)
 {
 {
   if (bake_in_start) {
   if (bake_in_start) {
     _flags |= F_bake_in_start;
     _flags |= F_bake_in_start;
@@ -191,7 +191,7 @@ priv_step(double t) {
           _flags &= ~F_slerp_setup;
           _flags &= ~F_slerp_setup;
         }
         }
       }
       }
-      nassertv(_slerp != NULL);
+      nassertv(_slerp != nullptr);
       (this->*_slerp)(quat, d);
       (this->*_slerp)(quat, d);
     }
     }
     if ((_flags & F_end_scale) != 0) {
     if ((_flags & F_end_scale) != 0) {
@@ -404,7 +404,7 @@ priv_step(double t) {
         color.set(1.0f, 1.0f, 1.0f, 1.0f);
         color.set(1.0f, 1.0f, 1.0f, 1.0f);
         const RenderAttrib *attrib =
         const RenderAttrib *attrib =
           state->get_attrib(ColorAttrib::get_class_type());
           state->get_attrib(ColorAttrib::get_class_type());
-        if (attrib != (const RenderAttrib *)NULL) {
+        if (attrib != nullptr) {
           const ColorAttrib *ca = DCAST(ColorAttrib, attrib);
           const ColorAttrib *ca = DCAST(ColorAttrib, attrib);
           if (ca->get_color_type() == ColorAttrib::T_flat) {
           if (ca->get_color_type() == ColorAttrib::T_flat) {
             color = ca->get_color();
             color = ca->get_color();
@@ -428,7 +428,7 @@ priv_step(double t) {
         color_scale.set(1.0f, 1.0f, 1.0f, 1.0f);
         color_scale.set(1.0f, 1.0f, 1.0f, 1.0f);
         const RenderAttrib *attrib =
         const RenderAttrib *attrib =
           state->get_attrib(ColorScaleAttrib::get_class_type());
           state->get_attrib(ColorScaleAttrib::get_class_type());
-        if (attrib != (const RenderAttrib *)NULL) {
+        if (attrib != nullptr) {
           const ColorScaleAttrib *csa = DCAST(ColorScaleAttrib, attrib);
           const ColorScaleAttrib *csa = DCAST(ColorScaleAttrib, attrib);
           color_scale = csa->get_scale();
           color_scale = csa->get_scale();
         }
         }
@@ -446,7 +446,7 @@ priv_step(double t) {
       const RenderAttrib *attrib =
       const RenderAttrib *attrib =
         state->get_attrib(TexMatrixAttrib::get_class_type());
         state->get_attrib(TexMatrixAttrib::get_class_type());
       CPT(TexMatrixAttrib) tma;
       CPT(TexMatrixAttrib) tma;
-      if (attrib != (const TexMatrixAttrib *)NULL) {
+      if (attrib != nullptr) {
         tma = DCAST(TexMatrixAttrib, attrib);
         tma = DCAST(TexMatrixAttrib, attrib);
         transform = tma->get_transform(_texture_stage);
         transform = tma->get_transform(_texture_stage);
       } else {
       } else {

+ 2 - 2
direct/src/interval/cMetaInterval.I

@@ -58,8 +58,8 @@ get_def_type(int n) const {
  */
  */
 INLINE CInterval *CMetaInterval::
 INLINE CInterval *CMetaInterval::
 get_c_interval(int n) const {
 get_c_interval(int n) const {
-  nassertr(n >= 0 && n < (int)_defs.size(), NULL);
-  nassertr(_defs[n]._type == DT_c_interval, NULL);
+  nassertr(n >= 0 && n < (int)_defs.size(), nullptr);
+  nassertr(_defs[n]._type == DT_c_interval, nullptr);
   return _defs[n]._c_interval;
   return _defs[n]._c_interval;
 }
 }
 
 

+ 2 - 2
direct/src/interval/cMetaInterval.cxx

@@ -66,7 +66,7 @@ clear_intervals() {
   Defs::iterator di;
   Defs::iterator di;
   for (di = _defs.begin(); di != _defs.end(); ++di) {
   for (di = _defs.begin(); di != _defs.end(); ++di) {
     IntervalDef &def = (*di);
     IntervalDef &def = (*di);
-    if (def._c_interval != (CInterval *)NULL) {
+    if (def._c_interval != nullptr) {
       CInterval::Parents::iterator pi =
       CInterval::Parents::iterator pi =
         find(def._c_interval->_parents.begin(),
         find(def._c_interval->_parents.begin(),
              def._c_interval->_parents.end(),
              def._c_interval->_parents.end(),
@@ -122,7 +122,7 @@ int CMetaInterval::
 add_c_interval(CInterval *c_interval,
 add_c_interval(CInterval *c_interval,
                double rel_time, RelativeStart rel_to) {
                double rel_time, RelativeStart rel_to) {
   nassertr(_event_queue.empty() && !_processing_events, -1);
   nassertr(_event_queue.empty() && !_processing_events, -1);
-  nassertr(c_interval != (CInterval *)NULL, -1);
+  nassertr(c_interval != nullptr, -1);
 
 
   c_interval->_parents.push_back(this);
   c_interval->_parents.push_back(this);
   c_interval->_ival_pcollector = PStatCollector(_ival_pcollector, c_interval->_pname);
   c_interval->_ival_pcollector = PStatCollector(_ival_pcollector, c_interval->_pname);

+ 7 - 7
direct/src/motiontrail/cMotionTrail.cxx

@@ -55,14 +55,14 @@ CMotionTrail ( ) {
   _resolution_distance = 0.5f;
   _resolution_distance = 0.5f;
 
 
   // node path states
   // node path states
-  _geom_node = 0;
+  _geom_node = nullptr;
 
 
   // real-time data
   // real-time data
   _vertex_index = 0;
   _vertex_index = 0;
-  _vertex_data = 0;
-  _triangles = 0;
+  _vertex_data = nullptr;
+  _triangles = nullptr;
 
 
-  _vertex_array = 0;
+  _vertex_array = nullptr;
 }
 }
 
 
 /**
 /**
@@ -298,7 +298,7 @@ add_geometry_quad (LVector4 &v0, LVector4 &v1, LVector4 &v2, LVector4 &v3, LVect
  */
  */
 void CMotionTrail::end_geometry ( ) {
 void CMotionTrail::end_geometry ( ) {
   static CPT(RenderState) state;
   static CPT(RenderState) state;
-  if (state == (RenderState *)NULL) {
+  if (state == nullptr) {
     state = RenderState::make(ColorAttrib::make_vertex());
     state = RenderState::make(ColorAttrib::make_vertex());
   }
   }
 
 
@@ -674,7 +674,7 @@ update_motion_trail (PN_stdfloat current_time, LMatrix4 *transform) {
       }
       }
 
 
       for (index = 0; index < total_vertices; index++) {
       for (index = 0; index < total_vertices; index++) {
-        nurbs_curve_result_array [index] = 0;
+        nurbs_curve_result_array [index] = nullptr;
       }
       }
 
 
       delete[] nurbs_curve_result_array;
       delete[] nurbs_curve_result_array;
@@ -804,6 +804,6 @@ update_motion_trail (PN_stdfloat current_time, LMatrix4 *transform) {
     this -> end_geometry ( );
     this -> end_geometry ( );
 
 
     delete[] _vertex_array;
     delete[] _vertex_array;
-    _vertex_array = 0;
+    _vertex_array = nullptr;
   }
   }
 }
 }

+ 19 - 19
direct/src/plugin/binaryXml.cxx

@@ -69,11 +69,11 @@ write_xml_node(ostream &out, TiXmlNode *xnode) {
 
 
   // Now write out the node type.
   // Now write out the node type.
   NodeType type = NT_element;
   NodeType type = NT_element;
-  if (xnode->ToDocument() != NULL) {
+  if (xnode->ToDocument() != nullptr) {
     type = NT_document;
     type = NT_document;
-  } else if (xnode->ToElement() != NULL) {
+  } else if (xnode->ToElement() != nullptr) {
     type = NT_element;
     type = NT_element;
-  } else if (xnode->ToText() != NULL) {
+  } else if (xnode->ToText() != nullptr) {
     type = NT_text;
     type = NT_text;
   } else {
   } else {
     type = NT_unknown;
     type = NT_unknown;
@@ -88,10 +88,10 @@ write_xml_node(ostream &out, TiXmlNode *xnode) {
   if (type == NT_element) {
   if (type == NT_element) {
     // Write the element attributes.
     // Write the element attributes.
     TiXmlElement *xelement = xnode->ToElement();
     TiXmlElement *xelement = xnode->ToElement();
-    assert(xelement != NULL);
+    assert(xelement != nullptr);
     const TiXmlAttribute *xattrib = xelement->FirstAttribute();
     const TiXmlAttribute *xattrib = xelement->FirstAttribute();
 
 
-    while (xattrib != NULL) {
+    while (xattrib != nullptr) {
       // We have an attribute.
       // We have an attribute.
       out.put((char)true);
       out.put((char)true);
 
 
@@ -114,7 +114,7 @@ write_xml_node(ostream &out, TiXmlNode *xnode) {
 
 
   // Now write all of the children.
   // Now write all of the children.
   TiXmlNode *xchild = xnode->FirstChild();
   TiXmlNode *xchild = xnode->FirstChild();
-  while (xchild != NULL) {
+  while (xchild != nullptr) {
     // We have a child.
     // We have a child.
     out.put((char)true);
     out.put((char)true);
     write_xml_node(out, xchild);
     write_xml_node(out, xchild);
@@ -136,13 +136,13 @@ read_xml_node(istream &in, char *&buffer, xml_uint32 &buffer_length,
   xml_uint32 value_length;
   xml_uint32 value_length;
   in.read((char *)&value_length, sizeof(value_length));
   in.read((char *)&value_length, sizeof(value_length));
   if (in.gcount() != sizeof(value_length)) {
   if (in.gcount() != sizeof(value_length)) {
-    return NULL;
+    return nullptr;
   }
   }
   xml_uint32 value_proof_expect = (value_length + length_nonce1) * length_nonce2;
   xml_uint32 value_proof_expect = (value_length + length_nonce1) * length_nonce2;
   xml_uint32 value_proof;
   xml_uint32 value_proof;
   in.read((char *)&value_proof, sizeof(value_proof));
   in.read((char *)&value_proof, sizeof(value_proof));
   if (in.gcount() != sizeof(value_proof)) {
   if (in.gcount() != sizeof(value_proof)) {
-    return NULL;
+    return nullptr;
   }
   }
   if (value_proof != value_proof_expect) {
   if (value_proof != value_proof_expect) {
     // Hey, we ran into garbage: the proof value didn't match our expected
     // Hey, we ran into garbage: the proof value didn't match our expected
@@ -164,7 +164,7 @@ read_xml_node(istream &in, char *&buffer, xml_uint32 &buffer_length,
     }
     }
     logfile << "\n";
     logfile << "\n";
     logfile << "End garbage.\n";
     logfile << "End garbage.\n";
-    return NULL;
+    return nullptr;
   }
   }
 
 
   if (value_length > buffer_length) {
   if (value_length > buffer_length) {
@@ -179,10 +179,10 @@ read_xml_node(istream &in, char *&buffer, xml_uint32 &buffer_length,
   // Read the node type.
   // Read the node type.
   NodeType type = (NodeType)in.get();
   NodeType type = (NodeType)in.get();
   if (type == NT_unknown) {
   if (type == NT_unknown) {
-    return NULL;
+    return nullptr;
   }
   }
 
 
-  TiXmlNode *xnode = NULL;
+  TiXmlNode *xnode = nullptr;
   if (type == NT_element) {
   if (type == NT_element) {
     xnode = new TiXmlElement(value);
     xnode = new TiXmlElement(value);
   } else if (type == NT_document) {
   } else if (type == NT_document) {
@@ -196,7 +196,7 @@ read_xml_node(istream &in, char *&buffer, xml_uint32 &buffer_length,
   if (type == NT_element) {
   if (type == NT_element) {
     // Read the element attributes.
     // Read the element attributes.
     TiXmlElement *xelement = xnode->ToElement();
     TiXmlElement *xelement = xnode->ToElement();
-    assert(xelement != NULL);
+    assert(xelement != nullptr);
     bool got_attrib = (bool)(in.get() != 0);
     bool got_attrib = (bool)(in.get() != 0);
 
 
     while (got_attrib && in && !in.eof()) {
     while (got_attrib && in && !in.eof()) {
@@ -205,7 +205,7 @@ read_xml_node(istream &in, char *&buffer, xml_uint32 &buffer_length,
       in.read((char *)&name_length, sizeof(name_length));
       in.read((char *)&name_length, sizeof(name_length));
       if (in.gcount() != sizeof(name_length)) {
       if (in.gcount() != sizeof(name_length)) {
         delete xnode;
         delete xnode;
-        return NULL;
+        return nullptr;
       }
       }
 
 
       if (name_length > buffer_length) {
       if (name_length > buffer_length) {
@@ -221,7 +221,7 @@ read_xml_node(istream &in, char *&buffer, xml_uint32 &buffer_length,
       in.read((char *)&value_length, sizeof(value_length));
       in.read((char *)&value_length, sizeof(value_length));
       if (in.gcount() != sizeof(value_length)) {
       if (in.gcount() != sizeof(value_length)) {
         delete xnode;
         delete xnode;
-        return NULL;
+        return nullptr;
       }
       }
 
 
       if (value_length > buffer_length) {
       if (value_length > buffer_length) {
@@ -245,7 +245,7 @@ read_xml_node(istream &in, char *&buffer, xml_uint32 &buffer_length,
   while (got_child && in && !in.eof()) {
   while (got_child && in && !in.eof()) {
     // We have a child.
     // We have a child.
     TiXmlNode *xchild = read_xml_node(in, buffer, buffer_length, logfile);
     TiXmlNode *xchild = read_xml_node(in, buffer, buffer_length, logfile);
-    if (xchild != NULL) {
+    if (xchild != nullptr) {
       xnode->LinkEndChild(xchild);
       xnode->LinkEndChild(xchild);
     }
     }
 
 
@@ -317,12 +317,12 @@ read_xml(istream &in, ostream &logfile) {
   char *buffer = new char[buffer_length];
   char *buffer = new char[buffer_length];
   TiXmlNode *xnode = read_xml_node(in, buffer, buffer_length, logfile);
   TiXmlNode *xnode = read_xml_node(in, buffer, buffer_length, logfile);
   delete[] buffer;
   delete[] buffer;
-  if (xnode == NULL) {
-    return NULL;
+  if (xnode == nullptr) {
+    return nullptr;
   }
   }
 
 
   TiXmlDocument *doc = xnode->ToDocument();
   TiXmlDocument *doc = xnode->ToDocument();
-  assert(doc != NULL);
+  assert(doc != nullptr);
 
 
 #else
 #else
   // standard ASCII read.
   // standard ASCII read.
@@ -330,7 +330,7 @@ read_xml(istream &in, ostream &logfile) {
   in >> *doc;
   in >> *doc;
   if (in.fail() || in.eof()) {
   if (in.fail() || in.eof()) {
     delete doc;
     delete doc;
-    return NULL;
+    return nullptr;
   }
   }
 #endif
 #endif
 
 

+ 13 - 13
direct/src/plugin/fileSpec.cxx

@@ -42,7 +42,7 @@ FileSpec() {
   _timestamp = 0;
   _timestamp = 0;
   memset(_hash, 0, hash_size);
   memset(_hash, 0, hash_size);
   _got_hash = false;
   _got_hash = false;
-  _actual_file = NULL;
+  _actual_file = nullptr;
 }
 }
 
 
 /**
 /**
@@ -56,7 +56,7 @@ FileSpec(const FileSpec &copy) :
   _got_hash(copy._got_hash)
   _got_hash(copy._got_hash)
 {
 {
   memcpy(_hash, copy._hash, hash_size);
   memcpy(_hash, copy._hash, hash_size);
-  _actual_file = NULL;
+  _actual_file = nullptr;
 }
 }
 
 
 /**
 /**
@@ -76,7 +76,7 @@ operator = (const FileSpec &copy) {
  */
  */
 FileSpec::
 FileSpec::
 ~FileSpec() {
 ~FileSpec() {
-  if (_actual_file != NULL) {
+  if (_actual_file != nullptr) {
     delete _actual_file;
     delete _actual_file;
   }
   }
 }
 }
@@ -87,25 +87,25 @@ FileSpec::
 void FileSpec::
 void FileSpec::
 load_xml(TiXmlElement *xelement) {
 load_xml(TiXmlElement *xelement) {
   const char *filename = xelement->Attribute("filename");
   const char *filename = xelement->Attribute("filename");
-  if (filename != NULL) {
+  if (filename != nullptr) {
     _filename = filename;
     _filename = filename;
   }
   }
 
 
   const char *size = xelement->Attribute("size");
   const char *size = xelement->Attribute("size");
-  if (size != NULL) {
+  if (size != nullptr) {
     char *endptr;
     char *endptr;
     _size = strtoul(size, &endptr, 10);
     _size = strtoul(size, &endptr, 10);
   }
   }
 
 
   const char *timestamp = xelement->Attribute("timestamp");
   const char *timestamp = xelement->Attribute("timestamp");
-  if (timestamp != NULL) {
+  if (timestamp != nullptr) {
     char *endptr;
     char *endptr;
     _timestamp = strtoul(timestamp, &endptr, 10);
     _timestamp = strtoul(timestamp, &endptr, 10);
   }
   }
 
 
   _got_hash = false;
   _got_hash = false;
   const char *hash = xelement->Attribute("hash");
   const char *hash = xelement->Attribute("hash");
-  if (hash != NULL && strlen(hash) == (hash_size * 2)) {
+  if (hash != nullptr && strlen(hash) == (hash_size * 2)) {
     // Decode the hex hash string.
     // Decode the hex hash string.
     _got_hash = decode_hex(_hash, hash, hash_size);
     _got_hash = decode_hex(_hash, hash, hash_size);
   }
   }
@@ -151,9 +151,9 @@ quick_verify(const string &package_dir) {
  */
  */
 bool FileSpec::
 bool FileSpec::
 quick_verify_pathname(const string &pathname) {
 quick_verify_pathname(const string &pathname) {
-  if (_actual_file != NULL) {
+  if (_actual_file != nullptr) {
     delete _actual_file;
     delete _actual_file;
-    _actual_file = NULL;
+    _actual_file = nullptr;
   }
   }
 
 
   int result = 1;
   int result = 1;
@@ -221,9 +221,9 @@ quick_verify_pathname(const string &pathname) {
  */
  */
 bool FileSpec::
 bool FileSpec::
 full_verify(const string &package_dir) {
 full_verify(const string &package_dir) {
-  if (_actual_file != NULL) {
+  if (_actual_file != nullptr) {
     delete _actual_file;
     delete _actual_file;
-    _actual_file = NULL;
+    _actual_file = nullptr;
   }
   }
 
 
   string pathname = get_pathname(package_dir);
   string pathname = get_pathname(package_dir);
@@ -281,7 +281,7 @@ full_verify(const string &package_dir) {
  */
  */
 const FileSpec *FileSpec::
 const FileSpec *FileSpec::
 force_get_actual_file(const string &pathname) {
 force_get_actual_file(const string &pathname) {
-  if (_actual_file == NULL) {
+  if (_actual_file == nullptr) {
 #ifdef _WIN32
 #ifdef _WIN32
     struct _stat st;
     struct _stat st;
     wstring pathname_w;
     wstring pathname_w;
@@ -418,7 +418,7 @@ output_hash(ostream &out) const {
 bool FileSpec::
 bool FileSpec::
 priv_check_hash(const string &pathname, void *stp) {
 priv_check_hash(const string &pathname, void *stp) {
   const struct stat &st = *(const struct stat *)stp;
   const struct stat &st = *(const struct stat *)stp;
-  assert(_actual_file == NULL);
+  assert(_actual_file == nullptr);
   _actual_file = new FileSpec;
   _actual_file = new FileSpec;
   _actual_file->_filename = pathname;
   _actual_file->_filename = pathname;
   _actual_file->_size = st.st_size;
   _actual_file->_size = st.st_size;

+ 14 - 14
direct/src/plugin/find_root_dir.cxx

@@ -46,7 +46,7 @@ static wstring
 get_csidl_dir_w(int csidl) {
 get_csidl_dir_w(int csidl) {
   static const int buffer_size = MAX_PATH;
   static const int buffer_size = MAX_PATH;
   wchar_t buffer[buffer_size];
   wchar_t buffer[buffer_size];
-  if (SHGetSpecialFolderPathW(NULL, buffer, csidl, true)) {
+  if (SHGetSpecialFolderPathW(nullptr, buffer, csidl, true)) {
     wstring root = buffer;
     wstring root = buffer;
     root += wstring(L"/Panda3D");
     root += wstring(L"/Panda3D");
 
 
@@ -73,10 +73,10 @@ find_root_dir_default_w() {
   wstring root;
   wstring root;
   bool is_protected = false;
   bool is_protected = false;
   HMODULE ieframe = LoadLibrary("ieframe.dll");
   HMODULE ieframe = LoadLibrary("ieframe.dll");
-  if (ieframe != NULL) {
+  if (ieframe != nullptr) {
     typedef HRESULT STDAPICALLTYPE IEIsProtectedModeProcess(BOOL *pbResult);
     typedef HRESULT STDAPICALLTYPE IEIsProtectedModeProcess(BOOL *pbResult);
     IEIsProtectedModeProcess *func = (IEIsProtectedModeProcess *)GetProcAddress(ieframe, "IEIsProtectedModeProcess");
     IEIsProtectedModeProcess *func = (IEIsProtectedModeProcess *)GetProcAddress(ieframe, "IEIsProtectedModeProcess");
-    if (func != NULL) {
+    if (func != nullptr) {
       BOOL result = false;
       BOOL result = false;
       HRESULT hr = (*func)(&result);
       HRESULT hr = (*func)(&result);
       if (hr == S_OK) {
       if (hr == S_OK) {
@@ -101,12 +101,12 @@ find_root_dir_default_w() {
       // instead of hard-linking it.
       // instead of hard-linking it.
 
 
       HMODULE shell32 = LoadLibrary("shell32.dll");
       HMODULE shell32 = LoadLibrary("shell32.dll");
-      if (shell32 != NULL) {
+      if (shell32 != nullptr) {
         typedef HRESULT STDAPICALLTYPE SHGetKnownFolderPath(REFGUID rfid, DWORD dwFlags, HANDLE hToken, PWSTR *ppszPath);
         typedef HRESULT STDAPICALLTYPE SHGetKnownFolderPath(REFGUID rfid, DWORD dwFlags, HANDLE hToken, PWSTR *ppszPath);
         SHGetKnownFolderPath *func = (SHGetKnownFolderPath *)GetProcAddress(shell32, "SHGetKnownFolderPath");
         SHGetKnownFolderPath *func = (SHGetKnownFolderPath *)GetProcAddress(shell32, "SHGetKnownFolderPath");
-        if (func != NULL) {
-          LPWSTR cache_path = NULL;
-          HRESULT hr = (*func)(FOLDERID_LocalAppDataLow, 0, NULL, &cache_path);
+        if (func != nullptr) {
+          LPWSTR cache_path = nullptr;
+          HRESULT hr = (*func)(FOLDERID_LocalAppDataLow, 0, nullptr, &cache_path);
 
 
           if (SUCCEEDED(hr)) {
           if (SUCCEEDED(hr)) {
             root = cache_path;
             root = cache_path;
@@ -128,8 +128,8 @@ find_root_dir_default_w() {
       // cache folder.
       // cache folder.
       typedef HRESULT STDAPICALLTYPE IEGetWriteableFolderPath(REFGUID clsidFolderID, LPWSTR* lppwstrPath);
       typedef HRESULT STDAPICALLTYPE IEGetWriteableFolderPath(REFGUID clsidFolderID, LPWSTR* lppwstrPath);
       IEGetWriteableFolderPath *func = (IEGetWriteableFolderPath *)GetProcAddress(ieframe, "IEGetWriteableFolderPath");
       IEGetWriteableFolderPath *func = (IEGetWriteableFolderPath *)GetProcAddress(ieframe, "IEGetWriteableFolderPath");
-      if (func != NULL) {
-        LPWSTR cache_path = NULL;
+      if (func != nullptr) {
+        LPWSTR cache_path = nullptr;
 
 
         // Since we're here, we'll start by asking for LocalAppDataLow, even
         // Since we're here, we'll start by asking for LocalAppDataLow, even
         // though I know it doesn't work.
         // though I know it doesn't work.
@@ -218,9 +218,9 @@ find_root_dir_default() {
 
 
   string root;
   string root;
   const passwd *pwdata = getpwuid(getuid());
   const passwd *pwdata = getpwuid(getuid());
-  if (pwdata == NULL) {
+  if (pwdata == nullptr) {
     char *home = getenv("HOME");
     char *home = getenv("HOME");
-    if (home == NULL) {
+    if (home == nullptr) {
       // Beh.  Let's hope it never gets to this point.
       // Beh.  Let's hope it never gets to this point.
       return ".";
       return ".";
     } else {
     } else {
@@ -260,13 +260,13 @@ find_root_dir_actual() {
   }
   }
 
 
   TiXmlElement *xconfig = doc.FirstChildElement("config");
   TiXmlElement *xconfig = doc.FirstChildElement("config");
-  if (xconfig == NULL) {
+  if (xconfig == nullptr) {
     // No <config> element within config.xml.
     // No <config> element within config.xml.
     return root;
     return root;
   }
   }
 
 
   const char *new_root = xconfig->Attribute("root_dir");
   const char *new_root = xconfig->Attribute("root_dir");
-  if (new_root == NULL || *new_root == '\0') {
+  if (new_root == nullptr || *new_root == '\0') {
     // No root_dir specified.
     // No root_dir specified.
     return root;
     return root;
   }
   }
@@ -295,7 +295,7 @@ find_root_dir() {
   wstring root_w;
   wstring root_w;
   string_to_wstring(root_w, root);
   string_to_wstring(root_w, root);
 
 
-  DWORD length = GetShortPathNameW(root_w.c_str(), NULL, 0);
+  DWORD length = GetShortPathNameW(root_w.c_str(), nullptr, 0);
   wchar_t *short_name = new wchar_t[length];
   wchar_t *short_name = new wchar_t[length];
   GetShortPathNameW(root_w.c_str(), short_name, length);
   GetShortPathNameW(root_w.c_str(), short_name, length);
 
 

+ 4 - 4
direct/src/plugin/handleStreamBuf.cxx

@@ -120,10 +120,10 @@ close() {
 void HandleStreamBuf::
 void HandleStreamBuf::
 close_handle() {
 close_handle() {
 #ifdef _WIN32
 #ifdef _WIN32
-  if (_handle != NULL) {
+  if (_handle != nullptr) {
     CloseHandle(_handle);
     CloseHandle(_handle);
   }
   }
-  _handle = NULL;
+  _handle = nullptr;
 #else
 #else
   if (_handle != -1) {
   if (_handle != -1) {
     ::close(_handle);
     ::close(_handle);
@@ -256,7 +256,7 @@ read_chars(char *start, size_t length) {
 #ifdef _WIN32
 #ifdef _WIN32
   // Windows case.
   // Windows case.
   DWORD bytes_read = 0;
   DWORD bytes_read = 0;
-  BOOL success = ReadFile(_handle, start, length, &bytes_read, NULL);
+  BOOL success = ReadFile(_handle, start, length, &bytes_read, nullptr);
   if (!success) {
   if (!success) {
     DWORD error = GetLastError();
     DWORD error = GetLastError();
     if (error != ERROR_HANDLE_EOF && error != ERROR_BROKEN_PIPE) {
     if (error != ERROR_HANDLE_EOF && error != ERROR_BROKEN_PIPE) {
@@ -304,7 +304,7 @@ write_chars(const char *start, size_t length) {
 #ifdef _WIN32
 #ifdef _WIN32
   // Windows case.
   // Windows case.
   DWORD bytes_written = 0;
   DWORD bytes_written = 0;
-  BOOL success = WriteFile(_handle, start, length, &bytes_written, NULL);
+  BOOL success = WriteFile(_handle, start, length, &bytes_written, nullptr);
   if (!success) {
   if (!success) {
     assert(bytes_written <= length);
     assert(bytes_written <= length);
     DWORD error = GetLastError();
     DWORD error = GetLastError();

+ 89 - 89
direct/src/plugin/load_plugin.cxx

@@ -75,9 +75,9 @@ P3D_instance_feed_url_stream_func *P3D_instance_feed_url_stream_ptr;
 P3D_instance_handle_event_func *P3D_instance_handle_event_ptr;
 P3D_instance_handle_event_func *P3D_instance_handle_event_ptr;
 
 
 #ifdef _WIN32
 #ifdef _WIN32
-static HMODULE module = NULL;
+static HMODULE module = nullptr;
 #else
 #else
-static void *module = NULL;
+static void *module = nullptr;
 #endif
 #endif
 
 
 static bool plugin_loaded = false;
 static bool plugin_loaded = false;
@@ -139,11 +139,11 @@ load_plugin(const string &p3d_plugin_filename,
   string filename = p3d_plugin_filename;
   string filename = p3d_plugin_filename;
 
 
 #ifdef _WIN32
 #ifdef _WIN32
-  assert(module == NULL);
+  assert(module == nullptr);
 
 
   if (filename.empty()) {
   if (filename.empty()) {
     // If no filename is supplied, look within our existing address space.
     // If no filename is supplied, look within our existing address space.
-    module = GetModuleHandle(NULL);
+    module = GetModuleHandle(nullptr);
     dso_needs_unload = false;
     dso_needs_unload = false;
 
 
   } else {
   } else {
@@ -168,7 +168,7 @@ load_plugin(const string &p3d_plugin_filename,
     dso_needs_unload = true;
     dso_needs_unload = true;
   }
   }
 
 
-  if (module == NULL) {
+  if (module == nullptr) {
     // Couldn't load the DLL.
     // Couldn't load the DLL.
     logfile
     logfile
       << "Couldn't load " << filename << ", error = "
       << "Couldn't load " << filename << ", error = "
@@ -180,16 +180,16 @@ load_plugin(const string &p3d_plugin_filename,
 
 
 #else  // _WIN32
 #else  // _WIN32
   // Posix case.
   // Posix case.
-  assert(module == NULL);
+  assert(module == nullptr);
   if (filename.empty()) {
   if (filename.empty()) {
-    module = dlopen(NULL, RTLD_LAZY | RTLD_LOCAL);
+    module = dlopen(nullptr, RTLD_LAZY | RTLD_LOCAL);
   } else {
   } else {
     module = dlopen(filename.c_str(), RTLD_LAZY | RTLD_LOCAL);
     module = dlopen(filename.c_str(), RTLD_LAZY | RTLD_LOCAL);
   }
   }
-  if (module == NULL) {
+  if (module == nullptr) {
     // Couldn't load the .so.
     // Couldn't load the .so.
     const char *message = dlerror();
     const char *message = dlerror();
-    if (message == (char *)NULL) {
+    if (message == nullptr) {
       message = "No error";
       message = "No error";
     }
     }
     logfile << "Couldn't load " << filename << ": " << message << "\n";
     logfile << "Couldn't load " << filename << ": " << message << "\n";
@@ -276,45 +276,45 @@ init_plugin(const string &contents_filename, const string &host_url,
             const string &start_dir, ostream &logfile) {
             const string &start_dir, ostream &logfile) {
 
 
   // Ensure that all of the function pointers have been found.
   // Ensure that all of the function pointers have been found.
-  if (P3D_initialize_ptr == NULL ||
-      P3D_finalize_ptr == NULL ||
-      P3D_set_plugin_version_ptr == NULL ||
-      P3D_set_super_mirror_ptr == NULL ||
-      P3D_new_instance_ptr == NULL ||
-      P3D_instance_start_ptr == NULL ||
-      P3D_instance_start_stream_ptr == NULL ||
-      P3D_instance_finish_ptr == NULL ||
-      P3D_instance_setup_window_ptr == NULL ||
-
-      P3D_object_get_type_ptr == NULL ||
-      P3D_object_get_bool_ptr == NULL ||
-      P3D_object_get_int_ptr == NULL ||
-      P3D_object_get_float_ptr == NULL ||
-      P3D_object_get_string_ptr == NULL ||
-      P3D_object_get_repr_ptr == NULL ||
-      P3D_object_get_property_ptr == NULL ||
-      P3D_object_set_property_ptr == NULL ||
-      P3D_object_has_method_ptr == NULL ||
-      P3D_object_call_ptr == NULL ||
-      P3D_object_eval_ptr == NULL ||
-      P3D_object_incref_ptr == NULL ||
-      P3D_object_decref_ptr == NULL ||
-
-      P3D_make_class_definition_ptr == NULL ||
-      P3D_new_undefined_object_ptr == NULL ||
-      P3D_new_none_object_ptr == NULL ||
-      P3D_new_bool_object_ptr == NULL ||
-      P3D_new_int_object_ptr == NULL ||
-      P3D_new_float_object_ptr == NULL ||
-      P3D_new_string_object_ptr == NULL ||
-      P3D_instance_get_panda_script_object_ptr == NULL ||
-      P3D_instance_set_browser_script_object_ptr == NULL ||
-
-      P3D_instance_get_request_ptr == NULL ||
-      P3D_check_request_ptr == NULL ||
-      P3D_request_finish_ptr == NULL ||
-      P3D_instance_feed_url_stream_ptr == NULL ||
-      P3D_instance_handle_event_ptr == NULL) {
+  if (P3D_initialize_ptr == nullptr ||
+      P3D_finalize_ptr == nullptr ||
+      P3D_set_plugin_version_ptr == nullptr ||
+      P3D_set_super_mirror_ptr == nullptr ||
+      P3D_new_instance_ptr == nullptr ||
+      P3D_instance_start_ptr == nullptr ||
+      P3D_instance_start_stream_ptr == nullptr ||
+      P3D_instance_finish_ptr == nullptr ||
+      P3D_instance_setup_window_ptr == nullptr ||
+
+      P3D_object_get_type_ptr == nullptr ||
+      P3D_object_get_bool_ptr == nullptr ||
+      P3D_object_get_int_ptr == nullptr ||
+      P3D_object_get_float_ptr == nullptr ||
+      P3D_object_get_string_ptr == nullptr ||
+      P3D_object_get_repr_ptr == nullptr ||
+      P3D_object_get_property_ptr == nullptr ||
+      P3D_object_set_property_ptr == nullptr ||
+      P3D_object_has_method_ptr == nullptr ||
+      P3D_object_call_ptr == nullptr ||
+      P3D_object_eval_ptr == nullptr ||
+      P3D_object_incref_ptr == nullptr ||
+      P3D_object_decref_ptr == nullptr ||
+
+      P3D_make_class_definition_ptr == nullptr ||
+      P3D_new_undefined_object_ptr == nullptr ||
+      P3D_new_none_object_ptr == nullptr ||
+      P3D_new_bool_object_ptr == nullptr ||
+      P3D_new_int_object_ptr == nullptr ||
+      P3D_new_float_object_ptr == nullptr ||
+      P3D_new_string_object_ptr == nullptr ||
+      P3D_instance_get_panda_script_object_ptr == nullptr ||
+      P3D_instance_set_browser_script_object_ptr == nullptr ||
+
+      P3D_instance_get_request_ptr == nullptr ||
+      P3D_check_request_ptr == nullptr ||
+      P3D_request_finish_ptr == nullptr ||
+      P3D_instance_feed_url_stream_ptr == nullptr ||
+      P3D_instance_handle_event_ptr == nullptr) {
 
 
     logfile
     logfile
       << "Some function pointers not found:"
       << "Some function pointers not found:"
@@ -411,55 +411,55 @@ unload_plugin(ostream &logfile) {
 static void
 static void
 unload_dso() {
 unload_dso() {
   if (dso_needs_unload) {
   if (dso_needs_unload) {
-    assert(module != NULL);
+    assert(module != nullptr);
 #ifdef _WIN32
 #ifdef _WIN32
     FreeLibrary(module);
     FreeLibrary(module);
 #else
 #else
     dlclose(module);
     dlclose(module);
 #endif
 #endif
-    module = NULL;
+    module = nullptr;
     dso_needs_unload = false;
     dso_needs_unload = false;
   }
   }
 
 
-  P3D_initialize_ptr = NULL;
-  P3D_finalize_ptr = NULL;
-  P3D_set_plugin_version_ptr = NULL;
-  P3D_set_super_mirror_ptr = NULL;
-  P3D_new_instance_ptr = NULL;
-  P3D_instance_start_ptr = NULL;
-  P3D_instance_start_stream_ptr = NULL;
-  P3D_instance_finish_ptr = NULL;
-  P3D_instance_setup_window_ptr = NULL;
-
-  P3D_object_get_type_ptr = NULL;
-  P3D_object_get_bool_ptr = NULL;
-  P3D_object_get_int_ptr = NULL;
-  P3D_object_get_float_ptr = NULL;
-  P3D_object_get_string_ptr = NULL;
-  P3D_object_get_repr_ptr = NULL;
-  P3D_object_get_property_ptr = NULL;
-  P3D_object_set_property_ptr = NULL;
-  P3D_object_has_method_ptr = NULL;
-  P3D_object_call_ptr = NULL;
-  P3D_object_eval_ptr = NULL;
-  P3D_object_incref_ptr = NULL;
-  P3D_object_decref_ptr = NULL;
-
-  P3D_make_class_definition_ptr = NULL;
-  P3D_new_undefined_object_ptr = NULL;
-  P3D_new_none_object_ptr = NULL;
-  P3D_new_bool_object_ptr = NULL;
-  P3D_new_int_object_ptr = NULL;
-  P3D_new_float_object_ptr = NULL;
-  P3D_new_string_object_ptr = NULL;
-  P3D_instance_get_panda_script_object_ptr = NULL;
-  P3D_instance_set_browser_script_object_ptr = NULL;
-
-  P3D_instance_get_request_ptr = NULL;
-  P3D_check_request_ptr = NULL;
-  P3D_request_finish_ptr = NULL;
-  P3D_instance_feed_url_stream_ptr = NULL;
-  P3D_instance_handle_event_ptr = NULL;
+  P3D_initialize_ptr = nullptr;
+  P3D_finalize_ptr = nullptr;
+  P3D_set_plugin_version_ptr = nullptr;
+  P3D_set_super_mirror_ptr = nullptr;
+  P3D_new_instance_ptr = nullptr;
+  P3D_instance_start_ptr = nullptr;
+  P3D_instance_start_stream_ptr = nullptr;
+  P3D_instance_finish_ptr = nullptr;
+  P3D_instance_setup_window_ptr = nullptr;
+
+  P3D_object_get_type_ptr = nullptr;
+  P3D_object_get_bool_ptr = nullptr;
+  P3D_object_get_int_ptr = nullptr;
+  P3D_object_get_float_ptr = nullptr;
+  P3D_object_get_string_ptr = nullptr;
+  P3D_object_get_repr_ptr = nullptr;
+  P3D_object_get_property_ptr = nullptr;
+  P3D_object_set_property_ptr = nullptr;
+  P3D_object_has_method_ptr = nullptr;
+  P3D_object_call_ptr = nullptr;
+  P3D_object_eval_ptr = nullptr;
+  P3D_object_incref_ptr = nullptr;
+  P3D_object_decref_ptr = nullptr;
+
+  P3D_make_class_definition_ptr = nullptr;
+  P3D_new_undefined_object_ptr = nullptr;
+  P3D_new_none_object_ptr = nullptr;
+  P3D_new_bool_object_ptr = nullptr;
+  P3D_new_int_object_ptr = nullptr;
+  P3D_new_float_object_ptr = nullptr;
+  P3D_new_string_object_ptr = nullptr;
+  P3D_instance_get_panda_script_object_ptr = nullptr;
+  P3D_instance_set_browser_script_object_ptr = nullptr;
+
+  P3D_instance_get_request_ptr = nullptr;
+  P3D_check_request_ptr = nullptr;
+  P3D_request_finish_ptr = nullptr;
+  P3D_instance_feed_url_stream_ptr = nullptr;
+  P3D_instance_handle_event_ptr = nullptr;
 
 
   plugin_loaded = false;
   plugin_loaded = false;
 }
 }

+ 4 - 4
direct/src/plugin/mkdir_complete.cxx

@@ -154,7 +154,7 @@ mkfile_complete(const string &filename, ostream &logfile) {
  */
  */
 bool
 bool
 mkdir_complete_w(const wstring &dirname, ostream &logfile) {
 mkdir_complete_w(const wstring &dirname, ostream &logfile) {
-  if (CreateDirectoryW(dirname.c_str(), NULL) != 0) {
+  if (CreateDirectoryW(dirname.c_str(), nullptr) != 0) {
     // Success!
     // Success!
     return true;
     return true;
   }
   }
@@ -171,7 +171,7 @@ mkdir_complete_w(const wstring &dirname, ostream &logfile) {
     wstring parent = get_dirname_w(dirname);
     wstring parent = get_dirname_w(dirname);
     if (!parent.empty() && mkdir_complete_w(parent, logfile)) {
     if (!parent.empty() && mkdir_complete_w(parent, logfile)) {
       // Parent successfully created.  Try again to make the child.
       // Parent successfully created.  Try again to make the child.
-      if (CreateDirectoryW(dirname.c_str(), NULL) != 0) {
+      if (CreateDirectoryW(dirname.c_str(), nullptr) != 0) {
         // Got it!
         // Got it!
         return true;
         return true;
       }
       }
@@ -198,7 +198,7 @@ mkfile_complete_w(const wstring &filename, ostream &logfile) {
 
 
   HANDLE file = CreateFileW(filename.c_str(), GENERIC_READ | GENERIC_WRITE,
   HANDLE file = CreateFileW(filename.c_str(), GENERIC_READ | GENERIC_WRITE,
                             FILE_SHARE_DELETE | FILE_SHARE_READ | FILE_SHARE_WRITE,
                             FILE_SHARE_DELETE | FILE_SHARE_READ | FILE_SHARE_WRITE,
-                            NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
+                            nullptr, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr);
   if (file == INVALID_HANDLE_VALUE) {
   if (file == INVALID_HANDLE_VALUE) {
     // Try to make the parent directory first.
     // Try to make the parent directory first.
     wstring parent = get_dirname_w(filename);
     wstring parent = get_dirname_w(filename);
@@ -206,7 +206,7 @@ mkfile_complete_w(const wstring &filename, ostream &logfile) {
       // Parent successfully created.  Try again to make the file.
       // Parent successfully created.  Try again to make the file.
       file = CreateFileW(filename.c_str(), GENERIC_READ | GENERIC_WRITE,
       file = CreateFileW(filename.c_str(), GENERIC_READ | GENERIC_WRITE,
                          FILE_SHARE_DELETE | FILE_SHARE_READ | FILE_SHARE_WRITE,
                          FILE_SHARE_DELETE | FILE_SHARE_READ | FILE_SHARE_WRITE,
-                         NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
+                         nullptr, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr);
     }
     }
     if (file == INVALID_HANDLE_VALUE) {
     if (file == INVALID_HANDLE_VALUE) {
       logfile
       logfile

+ 15 - 15
direct/src/plugin/p3dAuthSession.cxx

@@ -53,7 +53,7 @@ P3DAuthSession(P3DInstance *inst) :
   _cert_filename = new P3DTemporaryFile(".crt");
   _cert_filename = new P3DTemporaryFile(".crt");
   string filename = _cert_filename->get_filename();
   string filename = _cert_filename->get_filename();
   FILE *fp = fopen(filename.c_str(), "w");
   FILE *fp = fopen(filename.c_str(), "w");
-  if (fp == NULL) {
+  if (fp == nullptr) {
     nout << "Couldn't write temporary file\n";
     nout << "Couldn't write temporary file\n";
     return;
     return;
   }
   }
@@ -88,7 +88,7 @@ P3DAuthSession::
 ~P3DAuthSession() {
 ~P3DAuthSession() {
   shutdown(false);
   shutdown(false);
 
 
-  if (_cert_filename != NULL) {
+  if (_cert_filename != nullptr) {
     delete _cert_filename;
     delete _cert_filename;
   }
   }
 }
 }
@@ -101,7 +101,7 @@ shutdown(bool send_message) {
   if (!send_message) {
   if (!send_message) {
     // If we're not to send the instance the shutdown message as a result of
     // If we're not to send the instance the shutdown message as a result of
     // this, then clear the _inst pointer now.
     // this, then clear the _inst pointer now.
-    _inst = NULL;
+    _inst = nullptr;
   }
   }
 
 
   if (_p3dcert_running) {
   if (_p3dcert_running) {
@@ -119,7 +119,7 @@ shutdown(bool send_message) {
     struct timeval tv;
     struct timeval tv;
     tv.tv_sec = 0;
     tv.tv_sec = 0;
     tv.tv_usec = 100000;
     tv.tv_usec = 100000;
-    select(0, NULL, NULL, NULL, &tv);
+    select(0, nullptr, nullptr, nullptr, &tv);
     int status;
     int status;
     waitpid(_p3dcert_pid, &status, WNOHANG);
     waitpid(_p3dcert_pid, &status, WNOHANG);
 #endif  // _WIN32
 #endif  // _WIN32
@@ -133,7 +133,7 @@ shutdown(bool send_message) {
   join_wait_thread();
   join_wait_thread();
 
 
   // We're no longer bound to any particular instance.
   // We're no longer bound to any particular instance.
-  _inst = NULL;
+  _inst = nullptr;
 }
 }
 
 
 /**
 /**
@@ -146,7 +146,7 @@ start_p3dcert() {
     return;
     return;
   }
   }
 
 
-  if (_inst->_p3dcert_package == NULL) {
+  if (_inst->_p3dcert_package == nullptr) {
     nout << "Couldn't start Python: no p3dcert package.\n";
     nout << "Couldn't start Python: no p3dcert package.\n";
     return;
     return;
   }
   }
@@ -175,14 +175,14 @@ start_p3dcert() {
   const wchar_t *keep[] = {
   const wchar_t *keep[] = {
     L"TMP", L"TEMP", L"HOME", L"USER",
     L"TMP", L"TEMP", L"HOME", L"USER",
     L"SYSTEMROOT", L"USERPROFILE", L"COMSPEC",
     L"SYSTEMROOT", L"USERPROFILE", L"COMSPEC",
-    NULL
+    nullptr
   };
   };
 
 
   wstring env_w;
   wstring env_w;
 
 
-  for (int ki = 0; keep[ki] != NULL; ++ki) {
+  for (int ki = 0; keep[ki] != nullptr; ++ki) {
     wchar_t *value = _wgetenv(keep[ki]);
     wchar_t *value = _wgetenv(keep[ki]);
-    if (value != NULL) {
+    if (value != nullptr) {
       env_w += keep[ki];
       env_w += keep[ki];
       env_w += L"=";
       env_w += L"=";
       env_w += value;
       env_w += value;
@@ -204,11 +204,11 @@ start_p3dcert() {
 #ifdef HAVE_X11
 #ifdef HAVE_X11
     "DISPLAY", "XAUTHORITY",
     "DISPLAY", "XAUTHORITY",
 #endif
 #endif
-    NULL
+    nullptr
   };
   };
-  for (int ki = 0; keep[ki] != NULL; ++ki) {
+  for (int ki = 0; keep[ki] != nullptr; ++ki) {
     char *value = getenv(keep[ki]);
     char *value = getenv(keep[ki]);
-    if (value != NULL) {
+    if (value != nullptr) {
       _env += keep[ki];
       _env += keep[ki];
       _env += "=";
       _env += "=";
       _env += value;
       _env += value;
@@ -337,7 +337,7 @@ wt_thread_run() {
 
 
   // Notify the instance that we're done.
   // Notify the instance that we're done.
   P3DInstance *inst = _inst;
   P3DInstance *inst = _inst;
-  if (inst != NULL) {
+  if (inst != nullptr) {
     inst->auth_finished_sub_thread();
     inst->auth_finished_sub_thread();
   }
   }
 
 
@@ -388,7 +388,7 @@ win_create_process() {
   // anyway.
   // anyway.
   PROCESS_INFORMATION process_info;
   PROCESS_INFORMATION process_info;
   BOOL result = CreateProcess
   BOOL result = CreateProcess
-    (_p3dcert_exe.c_str(), command_line, NULL, NULL, TRUE,
+    (_p3dcert_exe.c_str(), command_line, nullptr, nullptr, TRUE,
      0, (void *)_env.c_str(),
      0, (void *)_env.c_str(),
      start_dir_cstr, &startup_info, &process_info);
      start_dir_cstr, &startup_info, &process_info);
   bool started_program = (result != 0);
   bool started_program = (result != 0);
@@ -440,7 +440,7 @@ posix_create_process() {
       p = zero + 1;
       p = zero + 1;
       zero = _env.find('\0', p);
       zero = _env.find('\0', p);
     }
     }
-    ptrs.push_back((char *)NULL);
+    ptrs.push_back(nullptr);
 
 
     execle(_p3dcert_exe.c_str(), _p3dcert_exe.c_str(),
     execle(_p3dcert_exe.c_str(), _p3dcert_exe.c_str(),
            _cert_filename->get_filename().c_str(), _cert_dir.c_str(),
            _cert_filename->get_filename().c_str(), _cert_dir.c_str(),

+ 1 - 1
direct/src/plugin/p3dCInstance.cxx

@@ -19,7 +19,7 @@
  */
  */
 P3DCInstance::
 P3DCInstance::
 P3DCInstance(TiXmlElement *xinstance) :
 P3DCInstance(TiXmlElement *xinstance) :
-  _func(NULL)
+  _func(nullptr)
 {
 {
   xinstance->Attribute("instance_id", &_instance_id);
   xinstance->Attribute("instance_id", &_instance_id);
 }
 }

+ 48 - 48
direct/src/plugin/p3dCert.cxx

@@ -55,10 +55,10 @@ static LanguageIndex detect_language() {
   typedef BOOL (*GUPL)(DWORD, PULONG, PZZWSTR, PULONG);
   typedef BOOL (*GUPL)(DWORD, PULONG, PZZWSTR, PULONG);
   GUPL pGetUserPreferredUILanguages = (GUPL)GetProcAddress(GetModuleHandle(TEXT("kernel32.dll")),
   GUPL pGetUserPreferredUILanguages = (GUPL)GetProcAddress(GetModuleHandle(TEXT("kernel32.dll")),
                                                            TEXT("GetUserPreferredUILanguages"));
                                                            TEXT("GetUserPreferredUILanguages"));
-  if (pGetUserPreferredUILanguages != NULL) {
+  if (pGetUserPreferredUILanguages != nullptr) {
     ULONG num_langs = 0;
     ULONG num_langs = 0;
     ULONG buffer_size = 0;
     ULONG buffer_size = 0;
-    pGetUserPreferredUILanguages(8, &num_langs, NULL, &buffer_size);
+    pGetUserPreferredUILanguages(8, &num_langs, nullptr, &buffer_size);
     PZZWSTR buffer = (PZZWSTR)_alloca(buffer_size);
     PZZWSTR buffer = (PZZWSTR)_alloca(buffer_size);
     if (pGetUserPreferredUILanguages(8, &num_langs, buffer, &buffer_size)) {
     if (pGetUserPreferredUILanguages(8, &num_langs, buffer, &buffer_size)) {
       for (ULONG i = 0; i < num_langs; ++i) {
       for (ULONG i = 0; i < num_langs; ++i) {
@@ -67,7 +67,7 @@ static LanguageIndex detect_language() {
           // It may be a two-letter code; match it in our list.
           // It may be a two-letter code; match it in our list.
           for (int j = 0; j < LI_COUNT; ++j) {
           for (int j = 0; j < LI_COUNT; ++j) {
             const char *lang_code = language_codes[j];
             const char *lang_code = language_codes[j];
-            if (lang_code != NULL && lang_code[0] == buffer[0] &&
+            if (lang_code != nullptr && lang_code[0] == buffer[0] &&
                                      lang_code[1] == buffer[1]) {
                                      lang_code[1] == buffer[1]) {
               return (LanguageIndex)j;
               return (LanguageIndex)j;
             }
             }
@@ -120,7 +120,7 @@ static LanguageIndex detect_language() {
     // See if we support this language.
     // See if we support this language.
     for (int j = 0; j < LI_COUNT; ++j) {
     for (int j = 0; j < LI_COUNT; ++j) {
       const char *lang_code = language_codes[j];
       const char *lang_code = language_codes[j];
-      if (lang_code != NULL && strncasecmp(buffer, lang_code, 2) == 0) {
+      if (lang_code != nullptr && strncasecmp(buffer, lang_code, 2) == 0) {
         CFRelease(langs);
         CFRelease(langs);
         return (LanguageIndex)j;
         return (LanguageIndex)j;
       }
       }
@@ -136,10 +136,10 @@ static LanguageIndex detect_language() {
   // First consult the LANGUAGE variable, which is a GNU extension that can
   // First consult the LANGUAGE variable, which is a GNU extension that can
   // contain multiple languages in order of preference.
   // contain multiple languages in order of preference.
   const char *lang = getenv("LANGUAGE");
   const char *lang = getenv("LANGUAGE");
-  while (lang != NULL && lang[0] != 0) {
+  while (lang != nullptr && lang[0] != 0) {
     size_t len;
     size_t len;
     const char *next = strchr(lang, ':');
     const char *next = strchr(lang, ':');
-    if (next == NULL) {
+    if (next == nullptr) {
       len = strlen(lang);
       len = strlen(lang);
     } else {
     } else {
       len = (next - lang);
       len = (next - lang);
@@ -150,7 +150,7 @@ static LanguageIndex detect_language() {
       // It may be a two-letter language code; match it in our list.
       // It may be a two-letter language code; match it in our list.
       for (int i = 0; i < LI_COUNT; ++i) {
       for (int i = 0; i < LI_COUNT; ++i) {
         const char *lang_code = language_codes[i];
         const char *lang_code = language_codes[i];
-        if (lang_code != NULL && strncasecmp(lang, lang_code, 2) == 0) {
+        if (lang_code != nullptr && strncasecmp(lang, lang_code, 2) == 0) {
           return (LanguageIndex)i;
           return (LanguageIndex)i;
         }
         }
       }
       }
@@ -161,14 +161,14 @@ static LanguageIndex detect_language() {
 
 
   // Fall back to the C locale functions.
   // Fall back to the C locale functions.
   setlocale(LC_ALL, "");
   setlocale(LC_ALL, "");
-  lang = setlocale(LC_MESSAGES, NULL);
+  lang = setlocale(LC_MESSAGES, nullptr);
 
 
-  if (lang == NULL || lang[0] == 0 || strcmp(lang, "C") == 0) {
+  if (lang == nullptr || lang[0] == 0 || strcmp(lang, "C") == 0) {
     // Try the LANG variable.
     // Try the LANG variable.
     lang = getenv("LANG");
     lang = getenv("LANG");
   }
   }
 
 
-  if (lang == NULL || strlen(lang) < 2 || isalnum(lang[2])) {
+  if (lang == nullptr || strlen(lang) < 2 || isalnum(lang[2])) {
     // Couldn't extract a meaningful two-letter code.
     // Couldn't extract a meaningful two-letter code.
     return LI_default;
     return LI_default;
   }
   }
@@ -176,7 +176,7 @@ static LanguageIndex detect_language() {
   // It may be a two-letter language code; match it in our list.
   // It may be a two-letter language code; match it in our list.
   for (int i = 0; i < LI_COUNT; ++i) {
   for (int i = 0; i < LI_COUNT; ++i) {
     const char *lang_code = language_codes[i];
     const char *lang_code = language_codes[i];
-    if (lang_code != NULL && strncasecmp(lang, lang_code, 2) == 0) {
+    if (lang_code != nullptr && strncasecmp(lang, lang_code, 2) == 0) {
       return (LanguageIndex)i;
       return (LanguageIndex)i;
     }
     }
   }
   }
@@ -192,7 +192,7 @@ wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PWSTR pCmdLine, int nCmdS
   LPWSTR *argv;
   LPWSTR *argv;
   int argc;
   int argc;
   argv = CommandLineToArgvW(pCmdLine, &argc);
   argv = CommandLineToArgvW(pCmdLine, &argc);
-  if (argv == NULL || argc != 2) {
+  if (argv == nullptr || argc != 2) {
     cerr << "usage: p3dcert cert_filename cert_dir\n";
     cerr << "usage: p3dcert cert_filename cert_dir\n";
     return 1;
     return 1;
   }
   }
@@ -243,10 +243,10 @@ AuthDialog(const string &cert_filename, const string &cert_dir) :
   Fl_Window(435, 242, new_application_title[li]),
   Fl_Window(435, 242, new_application_title[li]),
   _cert_dir(cert_dir)
   _cert_dir(cert_dir)
 {
 {
-  _view_cert_dialog = NULL;
+  _view_cert_dialog = nullptr;
 
 
-  _cert = NULL;
-  _stack = NULL;
+  _cert = nullptr;
+  _stack = nullptr;
   _verify_result = -1;
   _verify_result = -1;
 
 
   // Center the window on the screen.
   // Center the window on the screen.
@@ -264,17 +264,17 @@ AuthDialog(const string &cert_filename, const string &cert_dir) :
  */
  */
 AuthDialog::
 AuthDialog::
 ~AuthDialog() {
 ~AuthDialog() {
-  if (_view_cert_dialog != NULL) {
+  if (_view_cert_dialog != nullptr) {
     _view_cert_dialog->hide();
     _view_cert_dialog->hide();
   }
   }
 
 
-  if (_cert != NULL) {
+  if (_cert != nullptr) {
     X509_free(_cert);
     X509_free(_cert);
-    _cert = NULL;
+    _cert = nullptr;
   }
   }
-  if (_stack != NULL) {
+  if (_stack != nullptr) {
     sk_X509_free(_stack);
     sk_X509_free(_stack);
-    _stack = NULL;
+    _stack = nullptr;
   }
   }
 }
 }
 
 
@@ -294,7 +294,7 @@ void AuthDialog::
 view_cert_clicked(Fl_Widget *w, void *data) {
 view_cert_clicked(Fl_Widget *w, void *data) {
   AuthDialog *dlg = (AuthDialog *) data;
   AuthDialog *dlg = (AuthDialog *) data;
 
 
-  if (dlg->_view_cert_dialog != NULL) {
+  if (dlg->_view_cert_dialog != nullptr) {
     dlg->_view_cert_dialog->hide();
     dlg->_view_cert_dialog->hide();
   }
   }
   dlg->hide();
   dlg->hide();
@@ -317,7 +317,7 @@ cancel_clicked(Fl_Widget *w, void *data) {
  */
  */
 void AuthDialog::
 void AuthDialog::
 approve_cert() {
 approve_cert() {
-  assert(_cert != NULL);
+  assert(_cert != nullptr);
 
 
   // Make sure the directory exists.
   // Make sure the directory exists.
 #ifdef _WIN32
 #ifdef _WIN32
@@ -332,7 +332,7 @@ approve_cert() {
 
 
   // Sure, there's a slight race condition right now: another process might
   // Sure, there's a slight race condition right now: another process might
   // attempt to create the same filename.  So what.
   // attempt to create the same filename.  So what.
-  FILE *fp = NULL;
+  FILE *fp = nullptr;
 
 
 #ifdef _WIN32
 #ifdef _WIN32
   wchar_t *buf = new wchar_t[buf_length];
   wchar_t *buf = new wchar_t[buf_length];
@@ -366,7 +366,7 @@ approve_cert() {
   fp = fopen(buf, "w");
   fp = fopen(buf, "w");
 #endif // _WIN32
 #endif // _WIN32
 
 
-  if (fp != NULL) {
+  if (fp != nullptr) {
     PEM_write_X509(fp, _cert);
     PEM_write_X509(fp, _cert);
     fclose(fp);
     fclose(fp);
   }
   }
@@ -386,14 +386,14 @@ void AuthDialog::
 read_cert_file(const string &cert_filename) {
 read_cert_file(const string &cert_filename) {
 #endif
 #endif
 
 
-  FILE *fp = NULL;
+  FILE *fp = nullptr;
 #ifdef _WIN32
 #ifdef _WIN32
   fp = _wfopen(cert_filename.c_str(), L"r");
   fp = _wfopen(cert_filename.c_str(), L"r");
 #else // _WIN32
 #else // _WIN32
   fp = fopen(cert_filename.c_str(), "r");
   fp = fopen(cert_filename.c_str(), "r");
 #endif  // _WIN32
 #endif  // _WIN32
 
 
-  if (fp == NULL) {
+  if (fp == nullptr) {
 #ifdef _WIN32
 #ifdef _WIN32
     wcerr << L"Couldn't read " << cert_filename.c_str() << L"\n";
     wcerr << L"Couldn't read " << cert_filename.c_str() << L"\n";
 #else
 #else
@@ -401,8 +401,8 @@ read_cert_file(const string &cert_filename) {
 #endif
 #endif
     return;
     return;
   }
   }
-  _cert = PEM_read_X509(fp, NULL, NULL, (void *)"");
-  if (_cert == NULL) {
+  _cert = PEM_read_X509(fp, nullptr, nullptr, (void *)"");
+  if (_cert == nullptr) {
 #ifdef _WIN32
 #ifdef _WIN32
     wcerr << L"Could not read certificate in " << cert_filename.c_str() << L".\n";
     wcerr << L"Could not read certificate in " << cert_filename.c_str() << L".\n";
 #else
 #else
@@ -413,11 +413,11 @@ read_cert_file(const string &cert_filename) {
   }
   }
 
 
   // Build up a STACK of the remaining certificates in the file.
   // Build up a STACK of the remaining certificates in the file.
-  _stack = sk_X509_new(NULL);
-  X509 *c = PEM_read_X509(fp, NULL, NULL, (void *)"");
-  while (c != NULL) {
+  _stack = sk_X509_new(nullptr);
+  X509 *c = PEM_read_X509(fp, nullptr, nullptr, (void *)"");
+  while (c != nullptr) {
     sk_X509_push(_stack, c);
     sk_X509_push(_stack, c);
-    c = PEM_read_X509(fp, NULL, NULL, (void *)"");
+    c = PEM_read_X509(fp, nullptr, nullptr, (void *)"");
   }
   }
 
 
   fclose(fp);
   fclose(fp);
@@ -429,7 +429,7 @@ read_cert_file(const string &cert_filename) {
  */
  */
 void AuthDialog::
 void AuthDialog::
 get_friendly_name() {
 get_friendly_name() {
-  if (_cert == NULL) {
+  if (_cert == nullptr) {
     _friendly_name.clear();
     _friendly_name.clear();
     return;
     return;
   }
   }
@@ -447,15 +447,15 @@ get_friendly_name() {
 
 
     // A complex OpenSSL interface to extract out the name in utf-8.
     // A complex OpenSSL interface to extract out the name in utf-8.
     X509_NAME *xname = X509_get_subject_name(_cert);
     X509_NAME *xname = X509_get_subject_name(_cert);
-    if (xname != NULL) {
+    if (xname != nullptr) {
       int pos = X509_NAME_get_index_by_NID(xname, nid, -1);
       int pos = X509_NAME_get_index_by_NID(xname, nid, -1);
       if (pos != -1) {
       if (pos != -1) {
         // We just get the first common name.  I guess it's possible to have
         // We just get the first common name.  I guess it's possible to have
         // more than one; not sure what that means in this context.
         // more than one; not sure what that means in this context.
         X509_NAME_ENTRY *xentry = X509_NAME_get_entry(xname, pos);
         X509_NAME_ENTRY *xentry = X509_NAME_get_entry(xname, pos);
-        if (xentry != NULL) {
+        if (xentry != nullptr) {
           ASN1_STRING *data = X509_NAME_ENTRY_get_data(xentry);
           ASN1_STRING *data = X509_NAME_ENTRY_get_data(xentry);
-          if (data != NULL) {
+          if (data != nullptr) {
             // We use "print" to dump the output to a memory BIO.  Is there an
             // We use "print" to dump the output to a memory BIO.  Is there an
             // easier way to decode the ASN1_STRING?  Curse these incomplete
             // easier way to decode the ASN1_STRING?  Curse these incomplete
             // docs.
             // docs.
@@ -480,7 +480,7 @@ get_friendly_name() {
  */
  */
 void AuthDialog::
 void AuthDialog::
 verify_cert() {
 verify_cert() {
-  if (_cert == NULL) {
+  if (_cert == nullptr) {
     _verify_result = -1;
     _verify_result = -1;
     return;
     return;
   }
   }
@@ -535,11 +535,11 @@ load_certificates_from_der_ram(X509_STORE *store,
 
 
   bp = (unsigned char *)data;
   bp = (unsigned char *)data;
   bp_end = bp + data_size;
   bp_end = bp + data_size;
-  X509 *x509 = d2i_X509(NULL, &bp, bp_end - bp);
-  while (x509 != NULL) {
+  X509 *x509 = d2i_X509(nullptr, &bp, bp_end - bp);
+  while (x509 != nullptr) {
     X509_STORE_add_cert(store, x509);
     X509_STORE_add_cert(store, x509);
     ++count;
     ++count;
-    x509 = d2i_X509(NULL, &bp, bp_end - bp);
+    x509 = d2i_X509(nullptr, &bp, bp_end - bp);
   }
   }
 
 
   return count;
   return count;
@@ -578,7 +578,7 @@ layout() {
   next_y += 180;
   next_y += 180;
 
 
   short nbuttons = 1;
   short nbuttons = 1;
-  if (_cert != NULL) {
+  if (_cert != nullptr) {
     nbuttons++;
     nbuttons++;
     if (_verify_result == 0) {
     if (_verify_result == 0) {
       nbuttons++;
       nbuttons++;
@@ -586,13 +586,13 @@ layout() {
   }
   }
   short bx = (w() - nbuttons * BUTTON_WIDTH - (nbuttons - 1) * BUTTON_SPACE) / 2;
   short bx = (w() - nbuttons * BUTTON_WIDTH - (nbuttons - 1) * BUTTON_SPACE) / 2;
 
 
-  if (_verify_result == 0 && _cert != NULL) {
+  if (_verify_result == 0 && _cert != nullptr) {
     Fl_Return_Button *run_button = new Fl_Return_Button(bx, next_y, BUTTON_WIDTH, 25, run_title[li]);
     Fl_Return_Button *run_button = new Fl_Return_Button(bx, next_y, BUTTON_WIDTH, 25, run_title[li]);
     run_button->callback(this->run_clicked, this);
     run_button->callback(this->run_clicked, this);
     bx += BUTTON_WIDTH + BUTTON_SPACE;
     bx += BUTTON_WIDTH + BUTTON_SPACE;
   }
   }
 
 
-  if (_cert != NULL) {
+  if (_cert != nullptr) {
     Fl_Button *view_button = new Fl_Button(bx, next_y, BUTTON_WIDTH, 25, show_cert_title[li]);
     Fl_Button *view_button = new Fl_Button(bx, next_y, BUTTON_WIDTH, 25, show_cert_title[li]);
     view_button->callback(this->view_cert_clicked, this);
     view_button->callback(this->view_cert_clicked, this);
     bx += BUTTON_WIDTH + BUTTON_SPACE;
     bx += BUTTON_WIDTH + BUTTON_SPACE;
@@ -672,8 +672,8 @@ ViewCertDialog(AuthDialog *auth_dialog, X509 *cert) :
  */
  */
 ViewCertDialog::
 ViewCertDialog::
 ~ViewCertDialog() {
 ~ViewCertDialog() {
-  if (_auth_dialog != NULL) {
-    _auth_dialog->_view_cert_dialog = NULL;
+  if (_auth_dialog != nullptr) {
+    _auth_dialog->_view_cert_dialog = nullptr;
   }
   }
 }
 }
 
 
@@ -683,7 +683,7 @@ ViewCertDialog::
 void ViewCertDialog::
 void ViewCertDialog::
 run_clicked(Fl_Widget *w, void *data) {
 run_clicked(Fl_Widget *w, void *data) {
   ViewCertDialog *dlg = (ViewCertDialog *) data;
   ViewCertDialog *dlg = (ViewCertDialog *) data;
-  if (dlg->_auth_dialog != NULL){
+  if (dlg->_auth_dialog != nullptr){
     dlg->_auth_dialog->approve_cert();
     dlg->_auth_dialog->approve_cert();
   }
   }
   dlg->hide();
   dlg->hide();
@@ -695,7 +695,7 @@ run_clicked(Fl_Widget *w, void *data) {
 void ViewCertDialog::
 void ViewCertDialog::
 cancel_clicked(Fl_Widget *w, void *data) {
 cancel_clicked(Fl_Widget *w, void *data) {
   ViewCertDialog *dlg = (ViewCertDialog *) data;
   ViewCertDialog *dlg = (ViewCertDialog *) data;
-  if (dlg->_auth_dialog != NULL){
+  if (dlg->_auth_dialog != nullptr){
     dlg->_auth_dialog->hide();
     dlg->_auth_dialog->hide();
   }
   }
   dlg->hide();
   dlg->hide();
@@ -707,7 +707,7 @@ cancel_clicked(Fl_Widget *w, void *data) {
 void ViewCertDialog::
 void ViewCertDialog::
 layout() {
 layout() {
   // Format the certificate text for display in the dialog.
   // Format the certificate text for display in the dialog.
-  assert(_cert != NULL);
+  assert(_cert != nullptr);
 
 
   BIO *mbio = BIO_new(BIO_s_mem());
   BIO *mbio = BIO_new(BIO_s_mem());
   X509_print(mbio, _cert);
   X509_print(mbio, _cert);

+ 37 - 37
direct/src/plugin/p3dCert_wx.cxx

@@ -136,14 +136,14 @@ AuthDialog(const string &cert_filename, const string &cert_dir) :
   // I hate stay-on-top dialogs, but if we don't set this flag, it doesn't
   // I hate stay-on-top dialogs, but if we don't set this flag, it doesn't
   // come to the foreground on OSX, and might be lost behind the browser
   // come to the foreground on OSX, and might be lost behind the browser
   // window.
   // window.
-  wxDialog(NULL, wxID_ANY, _T("New Panda3D Application"), wxDefaultPosition,
+  wxDialog(nullptr, wxID_ANY, _T("New Panda3D Application"), wxDefaultPosition,
            wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxSTAY_ON_TOP),
            wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxSTAY_ON_TOP),
   _cert_dir(cert_dir)
   _cert_dir(cert_dir)
 {
 {
-  _view_cert_dialog = NULL;
+  _view_cert_dialog = nullptr;
 
 
-  _cert = NULL;
-  _stack = NULL;
+  _cert = nullptr;
+  _stack = nullptr;
   _verify_result = -1;
   _verify_result = -1;
 
 
   read_cert_file(cert_filename);
   read_cert_file(cert_filename);
@@ -157,17 +157,17 @@ AuthDialog(const string &cert_filename, const string &cert_dir) :
  */
  */
 AuthDialog::
 AuthDialog::
 ~AuthDialog() {
 ~AuthDialog() {
-  if (_view_cert_dialog != NULL) {
+  if (_view_cert_dialog != nullptr) {
     _view_cert_dialog->Destroy();
     _view_cert_dialog->Destroy();
   }
   }
 
 
-  if (_cert != NULL) {
+  if (_cert != nullptr) {
     X509_free(_cert);
     X509_free(_cert);
-    _cert = NULL;
+    _cert = nullptr;
   }
   }
-  if (_stack != NULL) {
+  if (_stack != nullptr) {
     sk_X509_free(_stack);
     sk_X509_free(_stack);
-    _stack = NULL;
+    _stack = nullptr;
   }
   }
 }
 }
 
 
@@ -184,7 +184,7 @@ run_clicked(wxCommandEvent &event) {
  */
  */
 void AuthDialog::
 void AuthDialog::
 view_cert_clicked(wxCommandEvent &event) {
 view_cert_clicked(wxCommandEvent &event) {
-  if (_view_cert_dialog != NULL) {
+  if (_view_cert_dialog != nullptr) {
     _view_cert_dialog->Destroy();
     _view_cert_dialog->Destroy();
   }
   }
   Hide();
   Hide();
@@ -206,7 +206,7 @@ cancel_clicked(wxCommandEvent &event) {
  */
  */
 void AuthDialog::
 void AuthDialog::
 approve_cert() {
 approve_cert() {
-  assert(_cert != NULL);
+  assert(_cert != nullptr);
 
 
   // Make sure the directory exists.
   // Make sure the directory exists.
   mkdir_complete(_cert_dir, cerr);
   mkdir_complete(_cert_dir, cerr);
@@ -243,13 +243,13 @@ approve_cert() {
 
 
   // Sure, there's a slight race condition right now: another process might
   // Sure, there's a slight race condition right now: another process might
   // attempt to create the same filename.  So what.
   // attempt to create the same filename.  So what.
-  FILE *fp = NULL;
+  FILE *fp = nullptr;
 #ifdef _WIN32
 #ifdef _WIN32
   fp = _wfopen(buf_w.c_str(), L"w");
   fp = _wfopen(buf_w.c_str(), L"w");
 #else // _WIN32
 #else // _WIN32
   fp = fopen(buf, "w");
   fp = fopen(buf, "w");
 #endif  // _WIN32
 #endif  // _WIN32
-  if (fp != NULL) {
+  if (fp != nullptr) {
     PEM_write_X509(fp, _cert);
     PEM_write_X509(fp, _cert);
     fclose(fp);
     fclose(fp);
   }
   }
@@ -263,7 +263,7 @@ approve_cert() {
  */
  */
 void AuthDialog::
 void AuthDialog::
 read_cert_file(const string &cert_filename) {
 read_cert_file(const string &cert_filename) {
-  FILE *fp = NULL;
+  FILE *fp = nullptr;
 #ifdef _WIN32
 #ifdef _WIN32
   wstring cert_filename_w;
   wstring cert_filename_w;
   if (string_to_wstring(cert_filename_w, cert_filename)) {
   if (string_to_wstring(cert_filename_w, cert_filename)) {
@@ -273,23 +273,23 @@ read_cert_file(const string &cert_filename) {
   fp = fopen(cert_filename.c_str(), "r");
   fp = fopen(cert_filename.c_str(), "r");
 #endif  // _WIN32
 #endif  // _WIN32
 
 
-  if (fp == NULL) {
+  if (fp == nullptr) {
     cerr << "Couldn't read " << cert_filename << "\n";
     cerr << "Couldn't read " << cert_filename << "\n";
     return;
     return;
   }
   }
-  _cert = PEM_read_X509(fp, NULL, NULL, (void *)"");
-  if (_cert == NULL) {
+  _cert = PEM_read_X509(fp, nullptr, nullptr, (void *)"");
+  if (_cert == nullptr) {
     cerr << "Could not read certificate in " << cert_filename << ".\n";
     cerr << "Could not read certificate in " << cert_filename << ".\n";
     fclose(fp);
     fclose(fp);
     return;
     return;
   }
   }
 
 
   // Build up a STACK of the remaining certificates in the file.
   // Build up a STACK of the remaining certificates in the file.
-  _stack = sk_X509_new(NULL);
-  X509 *c = PEM_read_X509(fp, NULL, NULL, (void *)"");
-  while (c != NULL) {
+  _stack = sk_X509_new(nullptr);
+  X509 *c = PEM_read_X509(fp, nullptr, nullptr, (void *)"");
+  while (c != nullptr) {
     sk_X509_push(_stack, c);
     sk_X509_push(_stack, c);
-    c = PEM_read_X509(fp, NULL, NULL, (void *)"");
+    c = PEM_read_X509(fp, nullptr, nullptr, (void *)"");
   }
   }
 
 
   fclose(fp);
   fclose(fp);
@@ -301,7 +301,7 @@ read_cert_file(const string &cert_filename) {
  */
  */
 void AuthDialog::
 void AuthDialog::
 get_friendly_name() {
 get_friendly_name() {
-  if (_cert == NULL) {
+  if (_cert == nullptr) {
     _friendly_name.clear();
     _friendly_name.clear();
     return;
     return;
   }
   }
@@ -319,15 +319,15 @@ get_friendly_name() {
 
 
     // A complex OpenSSL interface to extract out the name in utf-8.
     // A complex OpenSSL interface to extract out the name in utf-8.
     X509_NAME *xname = X509_get_subject_name(_cert);
     X509_NAME *xname = X509_get_subject_name(_cert);
-    if (xname != NULL) {
+    if (xname != nullptr) {
       int pos = X509_NAME_get_index_by_NID(xname, nid, -1);
       int pos = X509_NAME_get_index_by_NID(xname, nid, -1);
       if (pos != -1) {
       if (pos != -1) {
         // We just get the first common name.  I guess it's possible to have
         // We just get the first common name.  I guess it's possible to have
         // more than one; not sure what that means in this context.
         // more than one; not sure what that means in this context.
         X509_NAME_ENTRY *xentry = X509_NAME_get_entry(xname, pos);
         X509_NAME_ENTRY *xentry = X509_NAME_get_entry(xname, pos);
-        if (xentry != NULL) {
+        if (xentry != nullptr) {
           ASN1_STRING *data = X509_NAME_ENTRY_get_data(xentry);
           ASN1_STRING *data = X509_NAME_ENTRY_get_data(xentry);
-          if (data != NULL) {
+          if (data != nullptr) {
             // We use "print" to dump the output to a memory BIO.  Is there an
             // We use "print" to dump the output to a memory BIO.  Is there an
             // easier way to decode the ASN1_STRING?  Curse these incomplete
             // easier way to decode the ASN1_STRING?  Curse these incomplete
             // docs.
             // docs.
@@ -352,7 +352,7 @@ get_friendly_name() {
  */
  */
 void AuthDialog::
 void AuthDialog::
 verify_cert() {
 verify_cert() {
-  if (_cert == NULL) {
+  if (_cert == nullptr) {
     _verify_result = -1;
     _verify_result = -1;
     return;
     return;
   }
   }
@@ -407,11 +407,11 @@ load_certificates_from_der_ram(X509_STORE *store,
 
 
   bp = (unsigned char *)data;
   bp = (unsigned char *)data;
   bp_end = bp + data_size;
   bp_end = bp + data_size;
-  X509 *x509 = d2i_X509(NULL, &bp, bp_end - bp);
-  while (x509 != NULL) {
+  X509 *x509 = d2i_X509(nullptr, &bp, bp_end - bp);
+  while (x509 != nullptr) {
     X509_STORE_add_cert(store, x509);
     X509_STORE_add_cert(store, x509);
     ++count;
     ++count;
-    x509 = d2i_X509(NULL, &bp, bp_end - bp);
+    x509 = d2i_X509(nullptr, &bp, bp_end - bp);
   }
   }
 
 
   return count;
   return count;
@@ -449,12 +449,12 @@ layout() {
   // Create the run  cancel buttons.
   // Create the run  cancel buttons.
   wxBoxSizer *bsizer = new wxBoxSizer(wxHORIZONTAL);
   wxBoxSizer *bsizer = new wxBoxSizer(wxHORIZONTAL);
 
 
-  if (_verify_result == 0 && _cert != NULL) {
+  if (_verify_result == 0 && _cert != nullptr) {
     wxButton *run_button = new wxButton(panel, wxID_OK, _T("Run"));
     wxButton *run_button = new wxButton(panel, wxID_OK, _T("Run"));
     bsizer->Add(run_button, 0, wxALIGN_CENTER | wxALL, 5);
     bsizer->Add(run_button, 0, wxALIGN_CENTER | wxALL, 5);
   }
   }
 
 
-  if (_cert != NULL) {
+  if (_cert != nullptr) {
     wxButton *view_button = new wxButton(panel, VIEW_CERT_BUTTON, _T("View Certificate"));
     wxButton *view_button = new wxButton(panel, VIEW_CERT_BUTTON, _T("View Certificate"));
     bsizer->Add(view_button, 0, wxALIGN_CENTER | wxALL, 5);
     bsizer->Add(view_button, 0, wxALIGN_CENTER | wxALL, 5);
   }
   }
@@ -522,7 +522,7 @@ END_EVENT_TABLE()
  */
  */
 ViewCertDialog::
 ViewCertDialog::
 ViewCertDialog(AuthDialog *auth_dialog, X509 *cert) :
 ViewCertDialog(AuthDialog *auth_dialog, X509 *cert) :
-wxDialog(NULL, wxID_ANY, _T("View Certificate"), wxDefaultPosition,
+wxDialog(nullptr, wxID_ANY, _T("View Certificate"), wxDefaultPosition,
          wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER),
          wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER),
   _auth_dialog(auth_dialog),
   _auth_dialog(auth_dialog),
   _cert(cert)
   _cert(cert)
@@ -535,8 +535,8 @@ wxDialog(NULL, wxID_ANY, _T("View Certificate"), wxDefaultPosition,
  */
  */
 ViewCertDialog::
 ViewCertDialog::
 ~ViewCertDialog() {
 ~ViewCertDialog() {
-  if (_auth_dialog != NULL) {
-    _auth_dialog->_view_cert_dialog = NULL;
+  if (_auth_dialog != nullptr) {
+    _auth_dialog->_view_cert_dialog = nullptr;
   }
   }
 }
 }
 
 
@@ -545,7 +545,7 @@ ViewCertDialog::
  */
  */
 void ViewCertDialog::
 void ViewCertDialog::
 run_clicked(wxCommandEvent &event) {
 run_clicked(wxCommandEvent &event) {
-  if (_auth_dialog != NULL){
+  if (_auth_dialog != nullptr){
     _auth_dialog->approve_cert();
     _auth_dialog->approve_cert();
   }
   }
   Destroy();
   Destroy();
@@ -556,7 +556,7 @@ run_clicked(wxCommandEvent &event) {
  */
  */
 void ViewCertDialog::
 void ViewCertDialog::
 cancel_clicked(wxCommandEvent &event) {
 cancel_clicked(wxCommandEvent &event) {
-  if (_auth_dialog != NULL){
+  if (_auth_dialog != nullptr){
     _auth_dialog->Destroy();
     _auth_dialog->Destroy();
   }
   }
   Destroy();
   Destroy();
@@ -568,7 +568,7 @@ cancel_clicked(wxCommandEvent &event) {
 void ViewCertDialog::
 void ViewCertDialog::
 layout() {
 layout() {
   // Format the certificate text for display in the dialog.
   // Format the certificate text for display in the dialog.
-  assert(_cert != NULL);
+  assert(_cert != nullptr);
 
 
   BIO *mbio = BIO_new(BIO_s_mem());
   BIO *mbio = BIO_new(BIO_s_mem());
   X509_print(mbio, _cert);
   X509_print(mbio, _cert);

+ 4 - 4
direct/src/plugin/p3dConcreteSequence.cxx

@@ -86,7 +86,7 @@ get_property(const string &property) {
   char *endptr;
   char *endptr;
   int index = strtoul(property.c_str(), &endptr, 10);
   int index = strtoul(property.c_str(), &endptr, 10);
   if (*endptr != '\0') {
   if (*endptr != '\0') {
-    return NULL;
+    return nullptr;
   }
   }
 
 
   return get_element(index);
   return get_element(index);
@@ -133,7 +133,7 @@ fill_xml(TiXmlElement *xvalue, P3DSession *session) {
 P3D_object **P3DConcreteSequence::
 P3D_object **P3DConcreteSequence::
 get_object_array() {
 get_object_array() {
   if (_elements.empty()) {
   if (_elements.empty()) {
-    return NULL;
+    return nullptr;
   }
   }
   return &_elements[0];
   return &_elements[0];
 }
 }
@@ -165,7 +165,7 @@ get_element(int n) const {
     return _elements[n];
     return _elements[n];
   }
   }
 
 
-  return NULL;
+  return nullptr;
 }
 }
 
 
 /**
 /**
@@ -174,7 +174,7 @@ get_element(int n) const {
  */
  */
 bool P3DConcreteSequence::
 bool P3DConcreteSequence::
 set_element(int n, P3D_object *value) {
 set_element(int n, P3D_object *value) {
-  if (value == NULL) {
+  if (value == nullptr) {
     // Delete an element.
     // Delete an element.
     if (n < 0 || n >= (int)_elements.size()) {
     if (n < 0 || n >= (int)_elements.size()) {
       // Invalid index.
       // Invalid index.

+ 5 - 5
direct/src/plugin/p3dConcreteStruct.cxx

@@ -82,7 +82,7 @@ get_property(const string &property) {
     return (*ei).second;
     return (*ei).second;
   }
   }
 
 
-  return NULL;
+  return nullptr;
 }
 }
 
 
 /**
 /**
@@ -91,7 +91,7 @@ get_property(const string &property) {
  */
  */
 bool P3DConcreteStruct::
 bool P3DConcreteStruct::
 set_property(const string &property, P3D_object *value) {
 set_property(const string &property, P3D_object *value) {
-  if (value == NULL) {
+  if (value == nullptr) {
     // Delete an element.
     // Delete an element.
     Elements::iterator ei = _elements.find(property);
     Elements::iterator ei = _elements.find(property);
     if (ei == _elements.end()) {
     if (ei == _elements.end()) {
@@ -139,7 +139,7 @@ has_method(const string &method_name) {
 P3D_object *P3DConcreteStruct::
 P3D_object *P3DConcreteStruct::
 call(const string &method_name, bool needs_response,
 call(const string &method_name, bool needs_response,
      P3D_object *params[], int num_params) {
      P3D_object *params[], int num_params) {
-  P3D_object *result = NULL;
+  P3D_object *result = nullptr;
 
 
   if (method_name == "toString") {
   if (method_name == "toString") {
     string value;
     string value;
@@ -147,9 +147,9 @@ call(const string &method_name, bool needs_response,
     result = P3D_new_string_object(value.data(), value.length());
     result = P3D_new_string_object(value.data(), value.length());
   }
   }
 
 
-  if (result != NULL && !needs_response) {
+  if (result != nullptr && !needs_response) {
     P3D_OBJECT_DECREF(result);
     P3D_OBJECT_DECREF(result);
-    result = NULL;
+    result = nullptr;
   }
   }
 
 
   return result;
   return result;

+ 3 - 3
direct/src/plugin/p3dConditionVar.cxx

@@ -28,7 +28,7 @@ P3DConditionVar() {
   InitializeCriticalSection(&_lock);
   InitializeCriticalSection(&_lock);
 
 
   // Create an auto-reset event.
   // Create an auto-reset event.
-  _event_signal = CreateEvent(NULL, false, false, NULL);
+  _event_signal = CreateEvent(nullptr, false, false, nullptr);
 
 
 #else  // _WIN32
 #else  // _WIN32
   pthread_mutexattr_t attr;
   pthread_mutexattr_t attr;
@@ -38,7 +38,7 @@ P3DConditionVar() {
   pthread_mutexattr_destroy(&attr);
   pthread_mutexattr_destroy(&attr);
   assert(result == 0);
   assert(result == 0);
 
 
-  result = pthread_cond_init(&_cvar, NULL);
+  result = pthread_cond_init(&_cvar, nullptr);
   assert(result == 0);
   assert(result == 0);
 
 
 #endif  // _WIN32
 #endif  // _WIN32
@@ -115,7 +115,7 @@ wait(double timeout) {
 #else  // _WIN32
 #else  // _WIN32
 
 
   struct timeval now;
   struct timeval now;
-  gettimeofday(&now, NULL);
+  gettimeofday(&now, nullptr);
 
 
   // Convert from timeval to timespec
   // Convert from timeval to timespec
   struct timespec ts;
   struct timespec ts;

+ 3 - 3
direct/src/plugin/p3dDownload.cxx

@@ -27,7 +27,7 @@ P3DDownload() {
 
 
   _canceled = false;
   _canceled = false;
   _download_id = 0;
   _download_id = 0;
-  _instance = NULL;
+  _instance = nullptr;
 }
 }
 
 
 /**
 /**
@@ -46,7 +46,7 @@ P3DDownload(const P3DDownload &copy) :
 
 
   _canceled = false;
   _canceled = false;
   _download_id = 0;
   _download_id = 0;
-  _instance = NULL;
+  _instance = nullptr;
 }
 }
 
 
 /**
 /**
@@ -162,7 +162,7 @@ receive_data(const unsigned char *this_data, size_t this_data_size) {
  */
  */
 void P3DDownload::
 void P3DDownload::
 download_progress() {
 download_progress() {
-  time_t now = time(NULL);
+  time_t now = time(nullptr);
   if (now - _last_reported_time > 10) {
   if (now - _last_reported_time > 10) {
     _last_reported_time = now;
     _last_reported_time = now;
     nout << "Downloading " << get_url() << ": ";
     nout << "Downloading " << get_url() << ": ";

+ 3 - 3
direct/src/plugin/p3dFileParams.cxx

@@ -90,13 +90,13 @@ set_tokens(const P3D_token tokens[], size_t num_tokens) {
 void P3DFileParams::
 void P3DFileParams::
 set_token(const char *keyword, const char *value) {
 set_token(const char *keyword, const char *value) {
   Token token;
   Token token;
-  if (keyword != NULL) {
+  if (keyword != nullptr) {
     // Make the token lowercase, since HTML is case-insensitive but we're not.
     // Make the token lowercase, since HTML is case-insensitive but we're not.
     for (const char *p = keyword; *p; ++p) {
     for (const char *p = keyword; *p; ++p) {
       token._keyword += tolower(*p);
       token._keyword += tolower(*p);
     }
     }
   }
   }
-  if (value != NULL) {
+  if (value != nullptr) {
     token._value = value;
     token._value = value;
   }
   }
   _tokens.push_back(token);
   _tokens.push_back(token);
@@ -111,7 +111,7 @@ set_args(int argc, const char *argv[]) {
 
 
   for (int i = 0; i < argc; ++i) {
   for (int i = 0; i < argc; ++i) {
     const char *arg = argv[i];
     const char *arg = argv[i];
-    if (arg == NULL) {
+    if (arg == nullptr) {
       arg = "";
       arg = "";
     }
     }
     _args.push_back(arg);
     _args.push_back(arg);

+ 1 - 1
direct/src/plugin/p3dHost.I

@@ -79,7 +79,7 @@ get_descriptive_name() const {
  */
  */
 inline bool P3DHost::
 inline bool P3DHost::
 has_contents_file() const {
 has_contents_file() const {
-  return (_xcontents != NULL);
+  return (_xcontents != nullptr);
 }
 }
 
 
 /**
 /**

+ 47 - 47
direct/src/plugin/p3dHost.cxx

@@ -42,7 +42,7 @@ P3DHost(const string &host_url, const string &host_dir) :
 
 
   _descriptive_name = _host_url;
   _descriptive_name = _host_url;
 
 
-  _xcontents = NULL;
+  _xcontents = nullptr;
   _contents_expiration = 0;
   _contents_expiration = 0;
   _contents_iseq = 0;
   _contents_iseq = 0;
 }
 }
@@ -52,7 +52,7 @@ P3DHost(const string &host_url, const string &host_dir) :
  */
  */
 P3DHost::
 P3DHost::
 ~P3DHost() {
 ~P3DHost() {
-  if (_xcontents != NULL) {
+  if (_xcontents != nullptr) {
     delete _xcontents;
     delete _xcontents;
   }
   }
 
 
@@ -94,7 +94,7 @@ P3DHost::
  */
  */
 P3DHost *P3DHost::
 P3DHost *P3DHost::
 get_alt_host(const string &alt_host) {
 get_alt_host(const string &alt_host) {
-  assert(_xcontents != NULL);
+  assert(_xcontents != nullptr);
 
 
   AltHosts::iterator hi;
   AltHosts::iterator hi;
   hi = _alt_hosts.find(alt_host);
   hi = _alt_hosts.find(alt_host);
@@ -118,8 +118,8 @@ has_current_contents_file(P3DInstanceManager *inst_mgr) const {
     return has_contents_file();
     return has_contents_file();
   }
   }
 
 
-  time_t now = time(NULL);
-  return now < _contents_expiration && (_xcontents != NULL);
+  time_t now = time(nullptr);
+  return now < _contents_expiration && (_xcontents != nullptr);
 }
 }
 
 
 /**
 /**
@@ -153,11 +153,11 @@ read_contents_file(const string &contents_filename, bool fresh_download) {
   }
   }
 
 
   TiXmlElement *xcontents = doc.FirstChildElement("contents");
   TiXmlElement *xcontents = doc.FirstChildElement("contents");
-  if (xcontents == NULL) {
+  if (xcontents == nullptr) {
     return false;
     return false;
   }
   }
 
 
-  if (_xcontents != NULL) {
+  if (_xcontents != nullptr) {
     delete _xcontents;
     delete _xcontents;
   }
   }
   _xcontents = (TiXmlElement *)xcontents->Clone();
   _xcontents = (TiXmlElement *)xcontents->Clone();
@@ -169,7 +169,7 @@ read_contents_file(const string &contents_filename, bool fresh_download) {
 
 
   // Get the latest possible expiration time, based on the max_age indication.
   // Get the latest possible expiration time, based on the max_age indication.
   // Any expiration time later than this is in error.
   // Any expiration time later than this is in error.
-  time_t now = time(NULL);
+  time_t now = time(nullptr);
   _contents_expiration = now + (time_t)max_age;
   _contents_expiration = now + (time_t)max_age;
 
 
   if (fresh_download) {
   if (fresh_download) {
@@ -177,7 +177,7 @@ read_contents_file(const string &contents_filename, bool fresh_download) {
 
 
     // Update the XML with the new download information.
     // Update the XML with the new download information.
     TiXmlElement *xorig = xcontents->FirstChildElement("orig");
     TiXmlElement *xorig = xcontents->FirstChildElement("orig");
-    while (xorig != NULL) {
+    while (xorig != nullptr) {
       xcontents->RemoveChild(xorig);
       xcontents->RemoveChild(xorig);
       xorig = xcontents->FirstChildElement("orig");
       xorig = xcontents->FirstChildElement("orig");
     }
     }
@@ -192,7 +192,7 @@ read_contents_file(const string &contents_filename, bool fresh_download) {
     // Read the download hash and expiration time from the XML.
     // Read the download hash and expiration time from the XML.
     int expiration = 0;
     int expiration = 0;
     TiXmlElement *xorig = xcontents->FirstChildElement("orig");
     TiXmlElement *xorig = xcontents->FirstChildElement("orig");
-    if (xorig != NULL) {
+    if (xorig != nullptr) {
       _contents_spec.load_xml(xorig);
       _contents_spec.load_xml(xorig);
       xorig->Attribute("expiration", &expiration);
       xorig->Attribute("expiration", &expiration);
     }
     }
@@ -208,18 +208,18 @@ read_contents_file(const string &contents_filename, bool fresh_download) {
        << " s\n";
        << " s\n";
 
 
   TiXmlElement *xhost = _xcontents->FirstChildElement("host");
   TiXmlElement *xhost = _xcontents->FirstChildElement("host");
-  if (xhost != NULL) {
+  if (xhost != nullptr) {
     const char *url = xhost->Attribute("url");
     const char *url = xhost->Attribute("url");
-    if (url != NULL && _host_url == string(url)) {
+    if (url != nullptr && _host_url == string(url)) {
       // We're the primary host.  This is the normal case.
       // We're the primary host.  This is the normal case.
       read_xhost(xhost);
       read_xhost(xhost);
 
 
       // Build up the list of alternate hosts.
       // Build up the list of alternate hosts.
       TiXmlElement *xalthost = xhost->FirstChildElement("alt_host");
       TiXmlElement *xalthost = xhost->FirstChildElement("alt_host");
-      while (xalthost != NULL) {
+      while (xalthost != nullptr) {
         const char *keyword = xalthost->Attribute("keyword");
         const char *keyword = xalthost->Attribute("keyword");
         const char *url = xalthost->Attribute("url");
         const char *url = xalthost->Attribute("url");
-        if (keyword != NULL && url != NULL) {
+        if (keyword != nullptr && url != nullptr) {
           _alt_hosts[keyword] = url;
           _alt_hosts[keyword] = url;
         }
         }
         xalthost = xalthost->NextSiblingElement("alt_host");
         xalthost = xalthost->NextSiblingElement("alt_host");
@@ -228,9 +228,9 @@ read_contents_file(const string &contents_filename, bool fresh_download) {
     } else {
     } else {
       // We're not the primary host; perhaps we're an alternate host.
       // We're not the primary host; perhaps we're an alternate host.
       TiXmlElement *xalthost = xhost->FirstChildElement("alt_host");
       TiXmlElement *xalthost = xhost->FirstChildElement("alt_host");
-      while (xalthost != NULL) {
+      while (xalthost != nullptr) {
         const char *url = xalthost->Attribute("url");
         const char *url = xalthost->Attribute("url");
-        if (url != NULL && _host_url == string(url)) {
+        if (url != nullptr && _host_url == string(url)) {
           // Yep, we're this alternate host.
           // Yep, we're this alternate host.
           read_xhost(xalthost);
           read_xhost(xalthost);
           break;
           break;
@@ -288,12 +288,12 @@ read_contents_file(const string &contents_filename, bool fresh_download) {
 void P3DHost::
 void P3DHost::
 read_xhost(TiXmlElement *xhost) {
 read_xhost(TiXmlElement *xhost) {
   const char *descriptive_name = xhost->Attribute("descriptive_name");
   const char *descriptive_name = xhost->Attribute("descriptive_name");
-  if (descriptive_name != NULL && _descriptive_name.empty()) {
+  if (descriptive_name != nullptr && _descriptive_name.empty()) {
     _descriptive_name = descriptive_name;
     _descriptive_name = descriptive_name;
   }
   }
 
 
   const char *host_dir_basename = xhost->Attribute("host_dir");
   const char *host_dir_basename = xhost->Attribute("host_dir");
-  if (host_dir_basename == NULL) {
+  if (host_dir_basename == nullptr) {
     host_dir_basename = "";
     host_dir_basename = "";
   }
   }
   if (_host_dir.empty()) {
   if (_host_dir.empty()) {
@@ -303,7 +303,7 @@ read_xhost(TiXmlElement *xhost) {
   // Get the "download" URL, which is the source from which we download
   // Get the "download" URL, which is the source from which we download
   // everything other than the contents.xml file.
   // everything other than the contents.xml file.
   const char *download_url = xhost->Attribute("download_url");
   const char *download_url = xhost->Attribute("download_url");
-  if (download_url != NULL) {
+  if (download_url != nullptr) {
     _download_url_prefix = download_url;
     _download_url_prefix = download_url;
   }
   }
   if (!_download_url_prefix.empty()) {
   if (!_download_url_prefix.empty()) {
@@ -315,9 +315,9 @@ read_xhost(TiXmlElement *xhost) {
   }
   }
 
 
   TiXmlElement *xmirror = xhost->FirstChildElement("mirror");
   TiXmlElement *xmirror = xhost->FirstChildElement("mirror");
-  while (xmirror != NULL) {
+  while (xmirror != nullptr) {
     const char *url = xmirror->Attribute("url");
     const char *url = xmirror->Attribute("url");
-    if (url != NULL) {
+    if (url != nullptr) {
       add_mirror(url);
       add_mirror(url);
     }
     }
     xmirror = xmirror->NextSiblingElement("mirror");
     xmirror = xmirror->NextSiblingElement("mirror");
@@ -338,7 +338,7 @@ get_package(const string &package_name, const string &package_version,
             const string &package_platform, const string &package_seq,
             const string &package_platform, const string &package_seq,
             const string &alt_host) {
             const string &alt_host) {
   if (!alt_host.empty()) {
   if (!alt_host.empty()) {
-    if (_xcontents != NULL) {
+    if (_xcontents != nullptr) {
       // If we're asking for an alt host and we've already read our
       // If we're asking for an alt host and we've already read our
       // contents.xml file, then we already know all of our hosts, and we can
       // contents.xml file, then we already know all of our hosts, and we can
       // start the package off with the correct host immediately.
       // start the package off with the correct host immediately.
@@ -355,7 +355,7 @@ get_package(const string &package_name, const string &package_version,
   string key = package_name + "_" + package_version;
   string key = package_name + "_" + package_version;
   PlatformPackages &ppackages = _packages[alt_host][key];
   PlatformPackages &ppackages = _packages[alt_host][key];
   PlatformPackages::iterator ppi;
   PlatformPackages::iterator ppi;
-  P3DPackage *package = NULL;
+  P3DPackage *package = nullptr;
 
 
   // First, look for an exact match of the platform.
   // First, look for an exact match of the platform.
   for (ppi = ppackages.begin(); ppi != ppackages.end(); ++ppi) {
   for (ppi = ppackages.begin(); ppi != ppackages.end(); ++ppi) {
@@ -366,7 +366,7 @@ get_package(const string &package_name, const string &package_version,
   }
   }
 
 
   // If an exact match isn't found, look for a generic platform.
   // If an exact match isn't found, look for a generic platform.
-  if (package == NULL) {
+  if (package == nullptr) {
     for (ppi = ppackages.begin(); ppi != ppackages.end(); ++ppi) {
     for (ppi = ppackages.begin(); ppi != ppackages.end(); ++ppi) {
       if ((*ppi)->get_package_platform().empty()) {
       if ((*ppi)->get_package_platform().empty()) {
         package = *ppi;
         package = *ppi;
@@ -375,18 +375,18 @@ get_package(const string &package_name, const string &package_version,
     }
     }
   }
   }
 
 
-  if (package != NULL) {
+  if (package != nullptr) {
     if (package->get_failed()) {
     if (package->get_failed()) {
       // If the package has previously failed, move it aside and try again
       // If the package has previously failed, move it aside and try again
       // (maybe it just failed because the user interrupted it).
       // (maybe it just failed because the user interrupted it).
       nout << "Package " << key << " has previously failed; trying again.\n";
       nout << "Package " << key << " has previously failed; trying again.\n";
       _failed_packages.push_back(package);
       _failed_packages.push_back(package);
       ppackages.erase(ppi);
       ppackages.erase(ppi);
-      package = NULL;
+      package = nullptr;
     }
     }
   }
   }
 
 
-  if (package == NULL) {
+  if (package == nullptr) {
     package =
     package =
       new P3DPackage(this, package_name, package_version, package_platform, alt_host);
       new P3DPackage(this, package_name, package_version, package_platform, alt_host);
     ppackages.push_back(package);
     ppackages.push_back(package);
@@ -428,7 +428,7 @@ choose_suitable_platform(string &selected_platform,
                          const string &package_name,
                          const string &package_name,
                          const string &package_version,
                          const string &package_version,
                          const string &package_platform) {
                          const string &package_platform) {
-  if (_xcontents == NULL) {
+  if (_xcontents == nullptr) {
     return false;
     return false;
   }
   }
 
 
@@ -443,17 +443,17 @@ choose_suitable_platform(string &selected_platform,
     for (int pi = 0; pi < num_supported_platforms; ++pi) {
     for (int pi = 0; pi < num_supported_platforms; ++pi) {
       string supported_platform = inst_mgr->get_supported_platform(pi);
       string supported_platform = inst_mgr->get_supported_platform(pi);
       xpackage = _xcontents->FirstChildElement("package");
       xpackage = _xcontents->FirstChildElement("package");
-      while (xpackage != NULL) {
+      while (xpackage != nullptr) {
         const char *name = xpackage->Attribute("name");
         const char *name = xpackage->Attribute("name");
         const char *platform = xpackage->Attribute("platform");
         const char *platform = xpackage->Attribute("platform");
         const char *version = xpackage->Attribute("version");
         const char *version = xpackage->Attribute("version");
-        if (platform == NULL) {
+        if (platform == nullptr) {
           platform = "";
           platform = "";
         }
         }
-        if (version == NULL) {
+        if (version == nullptr) {
           version = "";
           version = "";
         }
         }
-        if (name != NULL &&
+        if (name != nullptr &&
             package_name == name &&
             package_name == name &&
             supported_platform == platform &&
             supported_platform == platform &&
             package_version == version) {
             package_version == version) {
@@ -470,17 +470,17 @@ choose_suitable_platform(string &selected_platform,
 
 
   // Now, we look for an exact match for the expected platform.
   // Now, we look for an exact match for the expected platform.
   xpackage = _xcontents->FirstChildElement("package");
   xpackage = _xcontents->FirstChildElement("package");
-  while (xpackage != NULL) {
+  while (xpackage != nullptr) {
     const char *name = xpackage->Attribute("name");
     const char *name = xpackage->Attribute("name");
     const char *platform = xpackage->Attribute("platform");
     const char *platform = xpackage->Attribute("platform");
     const char *version = xpackage->Attribute("version");
     const char *version = xpackage->Attribute("version");
-    if (platform == NULL) {
+    if (platform == nullptr) {
       platform = "";
       platform = "";
     }
     }
-    if (version == NULL) {
+    if (version == nullptr) {
       version = "";
       version = "";
     }
     }
-    if (name != NULL &&
+    if (name != nullptr &&
         package_name == name &&
         package_name == name &&
         package_platform == platform &&
         package_platform == platform &&
         package_version == version) {
         package_version == version) {
@@ -496,17 +496,17 @@ choose_suitable_platform(string &selected_platform,
   // Look one more time, this time looking for a non-platform-specific
   // Look one more time, this time looking for a non-platform-specific
   // version.
   // version.
   xpackage = _xcontents->FirstChildElement("package");
   xpackage = _xcontents->FirstChildElement("package");
-  while (xpackage != NULL) {
+  while (xpackage != nullptr) {
     const char *name = xpackage->Attribute("name");
     const char *name = xpackage->Attribute("name");
     const char *platform = xpackage->Attribute("platform");
     const char *platform = xpackage->Attribute("platform");
     const char *version = xpackage->Attribute("version");
     const char *version = xpackage->Attribute("version");
-    if (platform == NULL) {
+    if (platform == nullptr) {
       platform = "";
       platform = "";
     }
     }
-    if (version == NULL) {
+    if (version == nullptr) {
       version = "";
       version = "";
     }
     }
-    if (name != NULL &&
+    if (name != nullptr &&
         package_name == name &&
         package_name == name &&
         *platform == '\0' &&
         *platform == '\0' &&
         package_version == version) {
         package_version == version) {
@@ -535,7 +535,7 @@ get_package_desc_file(FileSpec &desc_file,              // out
                       const string &package_name,       // in
                       const string &package_name,       // in
                       const string &package_version,    // in
                       const string &package_version,    // in
                       const string &package_platform) { // in
                       const string &package_platform) { // in
-  if (_xcontents == NULL) {
+  if (_xcontents == nullptr) {
     return false;
     return false;
   }
   }
 
 
@@ -545,22 +545,22 @@ get_package_desc_file(FileSpec &desc_file,              // out
   // platform precisely, because we previously called
   // platform precisely, because we previously called
   // choose_suitable_platform().
   // choose_suitable_platform().
   TiXmlElement *xpackage = _xcontents->FirstChildElement("package");
   TiXmlElement *xpackage = _xcontents->FirstChildElement("package");
-  while (xpackage != NULL) {
+  while (xpackage != nullptr) {
     const char *name = xpackage->Attribute("name");
     const char *name = xpackage->Attribute("name");
     const char *platform = xpackage->Attribute("platform");
     const char *platform = xpackage->Attribute("platform");
     const char *version = xpackage->Attribute("version");
     const char *version = xpackage->Attribute("version");
     const char *seq = xpackage->Attribute("seq");
     const char *seq = xpackage->Attribute("seq");
     const char *solo = xpackage->Attribute("solo");
     const char *solo = xpackage->Attribute("solo");
-    if (platform == NULL) {
+    if (platform == nullptr) {
       platform = "";
       platform = "";
     }
     }
-    if (version == NULL) {
+    if (version == nullptr) {
       version = "";
       version = "";
     }
     }
-    if (seq == NULL) {
+    if (seq == nullptr) {
       seq = "";
       seq = "";
     }
     }
-    if (name != NULL && platform != NULL &&
+    if (name != nullptr && platform != nullptr &&
         package_name == name &&
         package_name == name &&
         package_platform == platform &&
         package_platform == platform &&
         package_version == version) {
         package_version == version) {
@@ -568,7 +568,7 @@ get_package_desc_file(FileSpec &desc_file,              // out
       desc_file.load_xml(xpackage);
       desc_file.load_xml(xpackage);
       package_seq = seq;
       package_seq = seq;
       package_solo = false;
       package_solo = false;
-      if (solo != NULL) {
+      if (solo != nullptr) {
         package_solo = (atoi(solo) != 0);
         package_solo = (atoi(solo) != 0);
       }
       }
       return true;
       return true;

+ 4 - 4
direct/src/plugin/p3dInstance.I

@@ -105,7 +105,7 @@ get_matches_script_origin() const {
  */
  */
 inline bool P3DInstance::
 inline bool P3DInstance::
 is_started() const {
 is_started() const {
-  return (_session != NULL);
+  return (_session != nullptr);
 }
 }
 
 
 /**
 /**
@@ -123,7 +123,7 @@ is_failed() const {
 inline P3DInstance::ImageFile::
 inline P3DInstance::ImageFile::
 ImageFile() {
 ImageFile() {
   _use_standard_image = true;
   _use_standard_image = true;
-  _temp_filename = NULL;
+  _temp_filename = nullptr;
   _image_placement = P3DSplashWindow::IP_none;
   _image_placement = P3DSplashWindow::IP_none;
 }
 }
 
 
@@ -140,8 +140,8 @@ inline P3DInstance::ImageFile::
  */
  */
 inline void P3DInstance::ImageFile::
 inline void P3DInstance::ImageFile::
 cleanup() {
 cleanup() {
-  if (_temp_filename != NULL) {
+  if (_temp_filename != nullptr) {
     delete _temp_filename;
     delete _temp_filename;
-    _temp_filename = NULL;
+    _temp_filename = nullptr;
   }
   }
 }
 }

A diferenza do arquivo foi suprimida porque é demasiado grande
+ 170 - 170
direct/src/plugin/p3dInstance.cxx


+ 41 - 41
direct/src/plugin/p3dInstanceManager.cxx

@@ -86,11 +86,11 @@ P3DInstanceManager() {
   _true_object = new P3DBoolObject(true);
   _true_object = new P3DBoolObject(true);
   _false_object = new P3DBoolObject(false);
   _false_object = new P3DBoolObject(false);
 
 
-  _auth_session = NULL;
+  _auth_session = nullptr;
 
 
   // Seed the lame random number generator in rand(); we use it to select a
   // Seed the lame random number generator in rand(); we use it to select a
   // mirror for downloading.
   // mirror for downloading.
-  srand((unsigned int)time(NULL));
+  srand((unsigned int)time(nullptr));
 
 
 #ifdef _WIN32
 #ifdef _WIN32
   // Ensure the appropriate Windows common controls are available to this
   // Ensure the appropriate Windows common controls are available to this
@@ -127,7 +127,7 @@ P3DInstanceManager::
 
 
 #ifndef _WIN32
 #ifndef _WIN32
   // Restore the original SIGPIPE handler.
   // Restore the original SIGPIPE handler.
-  sigaction(SIGPIPE, &_old_sigpipe, NULL);
+  sigaction(SIGPIPE, &_old_sigpipe, nullptr);
 #endif  // _WIN32
 #endif  // _WIN32
 
 
   // force-finish any remaining instances.
   // force-finish any remaining instances.
@@ -139,9 +139,9 @@ P3DInstanceManager::
   assert(_sessions.empty());
   assert(_sessions.empty());
   assert(_instances.empty());
   assert(_instances.empty());
 
 
-  if (_auth_session != NULL) {
+  if (_auth_session != nullptr) {
     p3d_unref_delete(_auth_session);
     p3d_unref_delete(_auth_session);
-    _auth_session = NULL;
+    _auth_session = nullptr;
   }
   }
 
 
   Hosts::iterator hi;
   Hosts::iterator hi;
@@ -239,7 +239,7 @@ initialize(int api_version, const string &contents_filename,
       int mib[2] = { CTL_HW, HW_MACHINE };
       int mib[2] = { CTL_HW, HW_MACHINE };
       char machine[512];
       char machine[512];
       size_t len = 511;
       size_t len = 511;
-      if (sysctl(mib, 2, (void *)machine, &len, NULL, 0) == 0) {
+      if (sysctl(mib, 2, (void *)machine, &len, nullptr, 0) == 0) {
         if (strcmp(machine, "x86_64") == 0) {
         if (strcmp(machine, "x86_64") == 0) {
           _supported_platforms.push_back("osx_amd64");
           _supported_platforms.push_back("osx_amd64");
         }
         }
@@ -400,7 +400,7 @@ set_plugin_version(int major, int minor, int sequence,
   nout << "Core API version: " << _coreapi_set_ver << "\n";
   nout << "Core API version: " << _coreapi_set_ver << "\n";
 
 
   const char *timestamp_string = ctime(&_coreapi_timestamp);
   const char *timestamp_string = ctime(&_coreapi_timestamp);
-  if (timestamp_string == NULL) {
+  if (timestamp_string == nullptr) {
     timestamp_string = "";
     timestamp_string = "";
   }
   }
   nout << "Core API date: " << timestamp_string << "\n";
   nout << "Core API date: " << timestamp_string << "\n";
@@ -541,12 +541,12 @@ finish_instance(P3DInstance *inst) {
  */
  */
 P3DAuthSession *P3DInstanceManager::
 P3DAuthSession *P3DInstanceManager::
 authorize_instance(P3DInstance *inst) {
 authorize_instance(P3DInstance *inst) {
-  if (_auth_session != NULL) {
+  if (_auth_session != nullptr) {
     // We only want one auth_session window open at a time, to minimize user
     // We only want one auth_session window open at a time, to minimize user
     // confusion, so close any previous window.
     // confusion, so close any previous window.
     _auth_session->shutdown(true);
     _auth_session->shutdown(true);
     p3d_unref_delete(_auth_session);
     p3d_unref_delete(_auth_session);
-    _auth_session = NULL;
+    _auth_session = nullptr;
   }
   }
 
 
   _auth_session = new P3DAuthSession(inst);
   _auth_session = new P3DAuthSession(inst);
@@ -566,7 +566,7 @@ validate_instance(P3D_instance *instance) {
     return (*ii);
     return (*ii);
   }
   }
 
 
-  return NULL;
+  return nullptr;
 }
 }
 
 
 /**
 /**
@@ -583,7 +583,7 @@ check_request() {
     }
     }
   }
   }
 
 
-  return NULL;
+  return nullptr;
 }
 }
 
 
 /**
 /**
@@ -600,7 +600,7 @@ wait_request(double timeout) {
   int stop_tick = int(GetTickCount() + timeout * 1000.0);
   int stop_tick = int(GetTickCount() + timeout * 1000.0);
 #else
 #else
   struct timeval stop_time;
   struct timeval stop_time;
-  gettimeofday(&stop_time, NULL);
+  gettimeofday(&stop_time, nullptr);
 
 
   int seconds = (int)floor(timeout);
   int seconds = (int)floor(timeout);
   stop_time.tv_sec += seconds;
   stop_time.tv_sec += seconds;
@@ -612,7 +612,7 @@ wait_request(double timeout) {
 #endif
 #endif
 
 
   _request_ready.acquire();
   _request_ready.acquire();
-  if (check_request() != (P3DInstance *)NULL) {
+  if (check_request() != nullptr) {
     _request_ready.release();
     _request_ready.release();
     return;
     return;
   }
   }
@@ -633,7 +633,7 @@ wait_request(double timeout) {
     timeout = remaining_ticks * 0.001;
     timeout = remaining_ticks * 0.001;
 #else
 #else
     struct timeval now;
     struct timeval now;
-    gettimeofday(&now, NULL);
+    gettimeofday(&now, nullptr);
 
 
     struct timeval remaining;
     struct timeval remaining;
     remaining.tv_sec = stop_time.tv_sec - now.tv_sec;
     remaining.tv_sec = stop_time.tv_sec - now.tv_sec;
@@ -649,7 +649,7 @@ wait_request(double timeout) {
     timeout = remaining.tv_sec + remaining.tv_usec * 0.001;
     timeout = remaining.tv_sec + remaining.tv_usec * 0.001;
 #endif
 #endif
 
 
-    if (check_request() != (P3DInstance *)NULL) {
+    if (check_request() != nullptr) {
       _request_ready.release();
       _request_ready.release();
       return;
       return;
     }
     }
@@ -713,7 +713,7 @@ get_unique_id() {
  */
  */
 void P3DInstanceManager::
 void P3DInstanceManager::
 signal_request_ready(P3DInstance *inst) {
 signal_request_ready(P3DInstance *inst) {
-  if (inst->get_request_ready_func() != NULL) {
+  if (inst->get_request_ready_func() != nullptr) {
     // This instance requires asynchronous notifications of requests.  Thus,
     // This instance requires asynchronous notifications of requests.  Thus,
     // we should tell the notify thread to wake up and make the callback.
     // we should tell the notify thread to wake up and make the callback.
     _notify_ready.acquire();
     _notify_ready.acquire();
@@ -765,7 +765,7 @@ make_temp_filename(const string &extension) {
     if (tid == 0) {
     if (tid == 0) {
       tid = 1;
       tid = 1;
     }
     }
-    int hash = ((clock() + _next_temp_filename_counter) * ((time(NULL) * tid) >> 8)) & 0xffffff;
+    int hash = ((clock() + _next_temp_filename_counter) * ((time(nullptr) * tid) >> 8)) & 0xffffff;
     ++_next_temp_filename_counter;
     ++_next_temp_filename_counter;
     char hex_code[10];
     char hex_code[10];
     sprintf(hex_code, "%06x", hash);
     sprintf(hex_code, "%06x", hash);
@@ -847,8 +847,8 @@ find_cert(X509 *cert) {
   vector<string>::iterator si;
   vector<string>::iterator si;
   for (si = contents.begin(); si != contents.end(); ++si) {
   for (si = contents.begin(); si != contents.end(); ++si) {
     string filename = this_cert_dir + "/" + (*si);
     string filename = this_cert_dir + "/" + (*si);
-    X509 *x509 = NULL;
-    FILE *fp = NULL;
+    X509 *x509 = nullptr;
+    FILE *fp = nullptr;
 #ifdef _WIN32
 #ifdef _WIN32
     wstring filename_w;
     wstring filename_w;
     if (string_to_wstring(filename_w, filename)) {
     if (string_to_wstring(filename_w, filename)) {
@@ -857,12 +857,12 @@ find_cert(X509 *cert) {
 #else // _WIN32
 #else // _WIN32
     fp = fopen(filename.c_str(), "r");
     fp = fopen(filename.c_str(), "r");
 #endif  // _WIN32
 #endif  // _WIN32
-    if (fp != NULL) {
-      x509 = PEM_read_X509(fp, NULL, NULL, (void *)"");
+    if (fp != nullptr) {
+      x509 = PEM_read_X509(fp, nullptr, nullptr, (void *)"");
       fclose(fp);
       fclose(fp);
     }
     }
 
 
-    if (x509 != NULL) {
+    if (x509 != nullptr) {
       string der2 = cert_to_der(x509);
       string der2 = cert_to_der(x509);
       // We might as well save this cert in the table for next time, even if
       // We might as well save this cert in the table for next time, even if
       // it's not the one we're looking for right now.
       // it's not the one we're looking for right now.
@@ -896,8 +896,8 @@ read_certlist(P3DPackage *package) {
       string suffix = basename.substr(basename.length() - 4);
       string suffix = basename.substr(basename.length() - 4);
       if (suffix == ".pem" || suffix == ".crt") {
       if (suffix == ".pem" || suffix == ".crt") {
         string filename = package->get_package_dir() + "/" + basename;
         string filename = package->get_package_dir() + "/" + basename;
-        X509 *x509 = NULL;
-        FILE *fp = NULL;
+        X509 *x509 = nullptr;
+        FILE *fp = nullptr;
 #ifdef _WIN32
 #ifdef _WIN32
         wstring filename_w;
         wstring filename_w;
         if (string_to_wstring(filename_w, filename)) {
         if (string_to_wstring(filename_w, filename)) {
@@ -906,12 +906,12 @@ read_certlist(P3DPackage *package) {
 #else // _WIN32
 #else // _WIN32
         fp = fopen(filename.c_str(), "r");
         fp = fopen(filename.c_str(), "r");
 #endif  // _WIN32
 #endif  // _WIN32
-        if (fp != NULL) {
-          x509 = PEM_read_X509(fp, NULL, NULL, (void *)"");
+        if (fp != nullptr) {
+          x509 = PEM_read_X509(fp, nullptr, nullptr, (void *)"");
           fclose(fp);
           fclose(fp);
         }
         }
 
 
-        if (x509 != NULL) {
+        if (x509 != nullptr) {
           string der2 = cert_to_der(x509);
           string der2 = cert_to_der(x509);
           _approved_certs.insert(der2);
           _approved_certs.insert(der2);
         }
         }
@@ -952,7 +952,7 @@ get_cert_dir(X509 *cert) {
  */
  */
 string P3DInstanceManager::
 string P3DInstanceManager::
 cert_to_der(X509 *cert) {
 cert_to_der(X509 *cert) {
-  int buffer_size = i2d_X509(cert, NULL);
+  int buffer_size = i2d_X509(cert, nullptr);
   unsigned char *buffer = new unsigned char[buffer_size];
   unsigned char *buffer = new unsigned char[buffer_size];
   unsigned char *p = buffer;
   unsigned char *p = buffer;
   i2d_X509(cert, &p);
   i2d_X509(cert, &p);
@@ -1001,7 +1001,7 @@ uninstall_all() {
  */
  */
 P3DInstanceManager *P3DInstanceManager::
 P3DInstanceManager *P3DInstanceManager::
 get_global_ptr() {
 get_global_ptr() {
-  if (_global_ptr == NULL) {
+  if (_global_ptr == nullptr) {
     _global_ptr = new P3DInstanceManager;
     _global_ptr = new P3DInstanceManager;
   }
   }
   return _global_ptr;
   return _global_ptr;
@@ -1013,9 +1013,9 @@ get_global_ptr() {
  */
  */
 void P3DInstanceManager::
 void P3DInstanceManager::
 delete_global_ptr() {
 delete_global_ptr() {
-  if (_global_ptr != NULL) {
+  if (_global_ptr != nullptr) {
     delete _global_ptr;
     delete _global_ptr;
-    _global_ptr = NULL;
+    _global_ptr = nullptr;
   }
   }
 }
 }
 
 
@@ -1072,13 +1072,13 @@ scan_directory(const string &dirname, vector<string> &contents) {
   size_t orig_size = contents.size();
   size_t orig_size = contents.size();
 
 
   DIR *root = opendir(dirname.c_str());
   DIR *root = opendir(dirname.c_str());
-  if (root == (DIR *)NULL) {
+  if (root == nullptr) {
     return false;
     return false;
   }
   }
 
 
   struct dirent *d;
   struct dirent *d;
   d = readdir(root);
   d = readdir(root);
-  while (d != (struct dirent *)NULL) {
+  while (d != nullptr) {
     if (d->d_name[0] != '.') {
     if (d->d_name[0] != '.') {
       contents.push_back(d->d_name);
       contents.push_back(d->d_name);
     }
     }
@@ -1347,13 +1347,13 @@ create_runtime_environment() {
   // $TEMP or $TMP being defined specifically, and if they are, we'll use
   // $TEMP or $TMP being defined specifically, and if they are, we'll use
   // GetTempPath(); otherwise, we'll fall back to SHGetSpecialFolderPath().
   // GetTempPath(); otherwise, we'll fall back to SHGetSpecialFolderPath().
 
 
-  if (getenv("TEMP") != NULL || getenv("TMP") != NULL) {
+  if (getenv("TEMP") != nullptr || getenv("TMP") != nullptr) {
     if (GetTempPathW(MAX_PATH, buffer_1) != 0) {
     if (GetTempPathW(MAX_PATH, buffer_1) != 0) {
       temp_directory_w = buffer_1;
       temp_directory_w = buffer_1;
     }
     }
   }
   }
   if (temp_directory_w.empty()) {
   if (temp_directory_w.empty()) {
-    if (SHGetSpecialFolderPathW(NULL, buffer_1, CSIDL_INTERNET_CACHE, true)) {
+    if (SHGetSpecialFolderPathW(nullptr, buffer_1, CSIDL_INTERNET_CACHE, true)) {
       temp_directory_w = buffer_1;
       temp_directory_w = buffer_1;
 
 
       // That just *might* return a non-writable folder, if we're in Protected
       // That just *might* return a non-writable folder, if we're in Protected
@@ -1379,9 +1379,9 @@ create_runtime_environment() {
   }
   }
 
 
   // Also insist that the temp directory is fully specified.
   // Also insist that the temp directory is fully specified.
-  size_t needs_size_2 = GetFullPathNameW(temp_directory_w.c_str(), 0, NULL, NULL);
+  size_t needs_size_2 = GetFullPathNameW(temp_directory_w.c_str(), 0, nullptr, nullptr);
   wchar_t *buffer_2 = new wchar_t[needs_size_2];
   wchar_t *buffer_2 = new wchar_t[needs_size_2];
-  if (GetFullPathNameW(temp_directory_w.c_str(), needs_size_2, buffer_2, NULL) != 0) {
+  if (GetFullPathNameW(temp_directory_w.c_str(), needs_size_2, buffer_2, nullptr) != 0) {
     temp_directory_w = buffer_2;
     temp_directory_w = buffer_2;
   }
   }
   delete[] buffer_2;
   delete[] buffer_2;
@@ -1428,7 +1428,7 @@ create_runtime_environment() {
     struct sigaction ignore;
     struct sigaction ignore;
     memset(&ignore, 0, sizeof(ignore));
     memset(&ignore, 0, sizeof(ignore));
     ignore.sa_handler = SIG_IGN;
     ignore.sa_handler = SIG_IGN;
-    sigaction(SIGINT, &ignore, NULL);
+    sigaction(SIGINT, &ignore, nullptr);
   }
   }
 #endif
 #endif
 
 
@@ -1482,9 +1482,9 @@ nt_thread_run() {
       for (ni = instances.begin(); ni != instances.end(); ++ni) {
       for (ni = instances.begin(); ni != instances.end(); ++ni) {
         // TODO: a race condition here when instances are deleted.
         // TODO: a race condition here when instances are deleted.
         P3DInstance *inst = (*ni);
         P3DInstance *inst = (*ni);
-        assert(inst != NULL);
+        assert(inst != nullptr);
         P3D_request_ready_func *func = inst->get_request_ready_func();
         P3D_request_ready_func *func = inst->get_request_ready_func();
-        if (func != NULL) {
+        if (func != nullptr) {
           (*func)(inst);
           (*func)(inst);
         }
         }
       }
       }
@@ -1505,7 +1505,7 @@ supports_win64() {
   LPFN_ISWOW64PROCESS _IsWow64Process;
   LPFN_ISWOW64PROCESS _IsWow64Process;
   _IsWow64Process = (LPFN_ISWOW64PROCESS)GetProcAddress(GetModuleHandle("kernel32"), "IsWow64Process");
   _IsWow64Process = (LPFN_ISWOW64PROCESS)GetProcAddress(GetModuleHandle("kernel32"), "IsWow64Process");
 
 
-  if (_IsWow64Process != NULL) {
+  if (_IsWow64Process != nullptr) {
     if (!_IsWow64Process(GetCurrentProcess(), &is_win64)) {
     if (!_IsWow64Process(GetCurrentProcess(), &is_win64)) {
       is_win64 = false;
       is_win64 = false;
     }
     }

+ 27 - 27
direct/src/plugin/p3dMainObject.cxx

@@ -23,8 +23,8 @@
  */
  */
 P3DMainObject::
 P3DMainObject::
 P3DMainObject() :
 P3DMainObject() :
-  _pyobj(NULL),
-  _inst(NULL),
+  _pyobj(nullptr),
+  _inst(nullptr),
   _unauth_play(false)
   _unauth_play(false)
 {
 {
 }
 }
@@ -34,7 +34,7 @@ P3DMainObject() :
  */
  */
 P3DMainObject::
 P3DMainObject::
 ~P3DMainObject() {
 ~P3DMainObject() {
-  set_pyobj(NULL);
+  set_pyobj(nullptr);
 
 
   // Clear the local properties.
   // Clear the local properties.
   Properties::const_iterator pi;
   Properties::const_iterator pi;
@@ -83,10 +83,10 @@ get_float() {
  */
  */
 void P3DMainObject::
 void P3DMainObject::
 make_string(string &value) {
 make_string(string &value) {
-  if (_pyobj == NULL) {
+  if (_pyobj == nullptr) {
     value = "P3DMainObject";
     value = "P3DMainObject";
   } else {
   } else {
-    int size = P3D_OBJECT_GET_STRING(_pyobj, NULL, 0);
+    int size = P3D_OBJECT_GET_STRING(_pyobj, nullptr, 0);
     char *buffer = new char[size];
     char *buffer = new char[size];
     P3D_OBJECT_GET_STRING(_pyobj, buffer, size);
     P3D_OBJECT_GET_STRING(_pyobj, buffer, size);
     value = string(buffer, size);
     value = string(buffer, size);
@@ -100,7 +100,7 @@ make_string(string &value) {
  */
  */
 P3D_object *P3DMainObject::
 P3D_object *P3DMainObject::
 get_property(const string &property) {
 get_property(const string &property) {
-  if (_pyobj == NULL) {
+  if (_pyobj == nullptr) {
     // Without a pyobj, we just report whatever's been stored locally.
     // Without a pyobj, we just report whatever's been stored locally.
     Properties::const_iterator pi;
     Properties::const_iterator pi;
     pi = _properties.find(property);
     pi = _properties.find(property);
@@ -109,7 +109,7 @@ get_property(const string &property) {
       P3D_OBJECT_INCREF(result);
       P3D_OBJECT_INCREF(result);
       return result;
       return result;
     }
     }
-    return NULL;
+    return nullptr;
   }
   }
 
 
   // With a pyobj, we pass the query down to it.
   // With a pyobj, we pass the query down to it.
@@ -123,9 +123,9 @@ get_property(const string &property) {
 bool P3DMainObject::
 bool P3DMainObject::
 set_property(const string &property, bool needs_response, P3D_object *value) {
 set_property(const string &property, bool needs_response, P3D_object *value) {
   // First, we set the property locally.
   // First, we set the property locally.
-  if (value != NULL) {
+  if (value != nullptr) {
     Properties::iterator pi;
     Properties::iterator pi;
-    pi = _properties.insert(Properties::value_type(property, (P3D_object *)NULL)).first;
+    pi = _properties.insert(Properties::value_type(property, nullptr)).first;
     assert(pi != _properties.end());
     assert(pi != _properties.end());
     P3D_object *orig_value = (*pi).second;
     P3D_object *orig_value = (*pi).second;
     if (orig_value != value) {
     if (orig_value != value) {
@@ -144,7 +144,7 @@ set_property(const string &property, bool needs_response, P3D_object *value) {
     }
     }
   }
   }
 
 
-  if (_pyobj == NULL) {
+  if (_pyobj == nullptr) {
     // Without a pyobj, that's all we do.
     // Without a pyobj, that's all we do.
     return true;
     return true;
   }
   }
@@ -171,7 +171,7 @@ has_method(const string &method_name) {
     return true;
     return true;
   }
   }
 
 
-  if (_pyobj == NULL) {
+  if (_pyobj == nullptr) {
     // No methods until we get our pyobj.
     // No methods until we get our pyobj.
     return false;
     return false;
   }
   }
@@ -197,7 +197,7 @@ call(const string &method_name, bool needs_response,
     if (i != 0) {
     if (i != 0) {
       nout << ", ";
       nout << ", ";
     }
     }
-    int buffer_size = P3D_OBJECT_GET_REPR(params[i], NULL, 0);
+    int buffer_size = P3D_OBJECT_GET_REPR(params[i], nullptr, 0);
     char *buffer = new char[buffer_size];
     char *buffer = new char[buffer_size];
     P3D_OBJECT_GET_REPR(params[i], buffer, buffer_size);
     P3D_OBJECT_GET_REPR(params[i], buffer, buffer_size);
     nout.write(buffer, buffer_size);
     nout.write(buffer, buffer_size);
@@ -217,9 +217,9 @@ call(const string &method_name, bool needs_response,
     return call_uninstall(params, num_params);
     return call_uninstall(params, num_params);
   }
   }
 
 
-  if (_pyobj == NULL) {
+  if (_pyobj == nullptr) {
     // No methods until we get our pyobj.
     // No methods until we get our pyobj.
-    return NULL;
+    return nullptr;
   }
   }
 
 
   return P3D_OBJECT_CALL(_pyobj, method_name.c_str(), needs_response,
   return P3D_OBJECT_CALL(_pyobj, method_name.c_str(), needs_response,
@@ -251,9 +251,9 @@ set_pyobj(P3D_object *pyobj) {
     // actually need to set the reference; instead, we clear anything we had
     // actually need to set the reference; instead, we clear anything we had
     // set.
     // set.
     nout << "application shares main object\n";
     nout << "application shares main object\n";
-    pyobj = NULL;
+    pyobj = nullptr;
 
 
-  } else if (pyobj != NULL) {
+  } else if (pyobj != nullptr) {
     // In the alternate case, the application has its own, separate
     // In the alternate case, the application has its own, separate
     // appRunner.main object.  Thus, we do need to set the pointer.
     // appRunner.main object.  Thus, we do need to set the pointer.
     nout << "application has its own main object\n";
     nout << "application has its own main object\n";
@@ -262,7 +262,7 @@ set_pyobj(P3D_object *pyobj) {
   if (_pyobj != pyobj) {
   if (_pyobj != pyobj) {
     P3D_OBJECT_XDECREF(_pyobj);
     P3D_OBJECT_XDECREF(_pyobj);
     _pyobj = pyobj;
     _pyobj = pyobj;
-    if (_pyobj != NULL) {
+    if (_pyobj != nullptr) {
       P3D_OBJECT_INCREF(_pyobj);
       P3D_OBJECT_INCREF(_pyobj);
 
 
       // Now that we have a pyobj, we have to transfer down all of the
       // Now that we have a pyobj, we have to transfer down all of the
@@ -288,7 +288,7 @@ get_pyobj() const {
  */
  */
 void P3DMainObject::
 void P3DMainObject::
 apply_properties(P3D_object *pyobj) {
 apply_properties(P3D_object *pyobj) {
-  P3DPythonObject *p3dpyobj = NULL;
+  P3DPythonObject *p3dpyobj = nullptr;
   if (pyobj->_class == &P3DObject::_object_class) {
   if (pyobj->_class == &P3DObject::_object_class) {
     p3dpyobj = ((P3DObject *)pyobj)->as_python_object();
     p3dpyobj = ((P3DObject *)pyobj)->as_python_object();
   }
   }
@@ -297,7 +297,7 @@ apply_properties(P3D_object *pyobj) {
   for (pi = _properties.begin(); pi != _properties.end(); ++pi) {
   for (pi = _properties.begin(); pi != _properties.end(); ++pi) {
     const string &property_name = (*pi).first;
     const string &property_name = (*pi).first;
     P3D_object *value = (*pi).second;
     P3D_object *value = (*pi).second;
-    if (p3dpyobj != NULL && P3D_OBJECT_GET_TYPE(value) != P3D_OT_object) {
+    if (p3dpyobj != nullptr && P3D_OBJECT_GET_TYPE(value) != P3D_OT_object) {
       // If we know we have an actual P3DPythonObject (we really expect this),
       // If we know we have an actual P3DPythonObject (we really expect this),
       // then we can call set_property_insecure() directly, because we want to
       // then we can call set_property_insecure() directly, because we want to
       // allow setting the initial properties even if Javascript has no
       // allow setting the initial properties even if Javascript has no
@@ -317,7 +317,7 @@ apply_properties(P3D_object *pyobj) {
  */
  */
 void P3DMainObject::
 void P3DMainObject::
 set_instance(P3DInstance *inst) {
 set_instance(P3DInstance *inst) {
-  if (_inst != NULL) {
+  if (_inst != nullptr) {
     // Save the game log filename of the instance just before it goes away, in
     // Save the game log filename of the instance just before it goes away, in
     // case JavaScript asks for it later.
     // case JavaScript asks for it later.
     _game_log_pathname = _inst->get_log_pathname();
     _game_log_pathname = _inst->get_log_pathname();
@@ -341,7 +341,7 @@ set_instance(P3DInstance *inst) {
 P3D_object *P3DMainObject::
 P3D_object *P3DMainObject::
 call_play(P3D_object *params[], int num_params) {
 call_play(P3D_object *params[], int num_params) {
   P3DInstanceManager *inst_mgr = P3DInstanceManager::get_global_ptr();
   P3DInstanceManager *inst_mgr = P3DInstanceManager::get_global_ptr();
-  if (_inst == NULL) {
+  if (_inst == nullptr) {
     return inst_mgr->new_bool_object(false);
     return inst_mgr->new_bool_object(false);
   }
   }
 
 
@@ -372,7 +372,7 @@ call_play(P3D_object *params[], int num_params) {
  */
  */
 P3D_object *P3DMainObject::
 P3D_object *P3DMainObject::
 call_read_game_log(P3D_object *params[], int num_params) {
 call_read_game_log(P3D_object *params[], int num_params) {
-  if (_inst != NULL) {
+  if (_inst != nullptr) {
     string log_pathname = _inst->get_log_pathname();
     string log_pathname = _inst->get_log_pathname();
     return read_log(log_pathname, params, num_params);
     return read_log(log_pathname, params, num_params);
   }
   }
@@ -413,7 +413,7 @@ call_read_log(P3D_object *params[], int num_params) {
     return inst_mgr->new_undefined_object();
     return inst_mgr->new_undefined_object();
   }
   }
 
 
-  int size = P3D_OBJECT_GET_STRING(params[0], NULL, 0);
+  int size = P3D_OBJECT_GET_STRING(params[0], nullptr, 0);
   char *buffer = new char[size];
   char *buffer = new char[size];
   P3D_OBJECT_GET_STRING(params[0], buffer, size);
   P3D_OBJECT_GET_STRING(params[0], buffer, size);
   string log_filename = string(buffer, size);
   string log_filename = string(buffer, size);
@@ -599,7 +599,7 @@ read_log_file(const string &log_pathname,
   size_t buffer_bytes = max(max(full_bytes, head_bytes), tail_bytes) + 1;
   size_t buffer_bytes = max(max(full_bytes, head_bytes), tail_bytes) + 1;
   nout << "allocating " << buffer_bytes << " bytes to read at a time from file of size " << file_size << ".\n";
   nout << "allocating " << buffer_bytes << " bytes to read at a time from file of size " << file_size << ".\n";
   char *buffer = new char[buffer_bytes];
   char *buffer = new char[buffer_bytes];
-  if (buffer == NULL) {
+  if (buffer == nullptr) {
     log_data << "== PandaLog-" << "Error allocating buffer";
     log_data << "== PandaLog-" << "Error allocating buffer";
     log_data << " " << "(" << log_leafname << ")" << "\n";
     log_data << " " << "(" << log_leafname << ")" << "\n";
     return;
     return;
@@ -659,7 +659,7 @@ read_log_file(const string &log_pathname,
 
 
   // cleanup
   // cleanup
   delete[] buffer;
   delete[] buffer;
-  buffer = NULL;
+  buffer = nullptr;
 }
 }
 
 
 /**
 /**
@@ -673,7 +673,7 @@ call_uninstall(P3D_object *params[], int num_params) {
   // Get the first parameter, the uninstall mode.
   // Get the first parameter, the uninstall mode.
   string mode;
   string mode;
   if (num_params > 0) {
   if (num_params > 0) {
-    int size = P3D_OBJECT_GET_STRING(params[0], NULL, 0);
+    int size = P3D_OBJECT_GET_STRING(params[0], nullptr, 0);
     char *buffer = new char[size];
     char *buffer = new char[size];
     P3D_OBJECT_GET_STRING(params[0], buffer, size);
     P3D_OBJECT_GET_STRING(params[0], buffer, size);
     mode = string(buffer, size);
     mode = string(buffer, size);
@@ -686,7 +686,7 @@ call_uninstall(P3D_object *params[], int num_params) {
     return inst_mgr->new_bool_object(true);
     return inst_mgr->new_bool_object(true);
   }
   }
 
 
-  if (_inst != NULL) {
+  if (_inst != nullptr) {
     nout << "uninstall " << mode << " for " << _inst << "\n";
     nout << "uninstall " << mode << " for " << _inst << "\n";
     bool success = false;
     bool success = false;
     if (mode == "host") {
     if (mode == "host") {

+ 8 - 8
direct/src/plugin/p3dMultifileReader.cxx

@@ -88,7 +88,7 @@ extract_all(const string &to_dir, P3DPackage *package,
   for (si = _subfiles.begin(); si != _subfiles.end(); ++si) {
   for (si = _subfiles.begin(); si != _subfiles.end(); ++si) {
     const Subfile &s = (*si);
     const Subfile &s = (*si);
     FileSpec file;
     FileSpec file;
-    if (package != NULL && !package->is_extractable(file, s._filename)) {
+    if (package != nullptr && !package->is_extractable(file, s._filename)) {
       continue;
       continue;
     }
     }
 
 
@@ -127,7 +127,7 @@ extract_all(const string &to_dir, P3DPackage *package,
     // or something.
     // or something.
     chmod(output_pathname.c_str(), 0555);
     chmod(output_pathname.c_str(), 0555);
 
 
-    if (step != NULL && package != NULL) {
+    if (step != nullptr && package != nullptr) {
       step->thread_add_bytes_done(s._data_length);
       step->thread_add_bytes_done(s._data_length);
     }
     }
   }
   }
@@ -409,7 +409,7 @@ check_signatures() {
     // Now convert each of the certificates to an X509 object, and store it in
     // Now convert each of the certificates to an X509 object, and store it in
     // our CertChain.
     // our CertChain.
     CertChain chain;
     CertChain chain;
-    EVP_PKEY *pkey = NULL;
+    EVP_PKEY *pkey = nullptr;
     if (buffer_size > 0) {
     if (buffer_size > 0) {
 #if OPENSSL_VERSION_NUMBER >= 0x00908000L
 #if OPENSSL_VERSION_NUMBER >= 0x00908000L
       // Beginning in 0.9.8, d2i_X509() accepted a const unsigned char **.
       // Beginning in 0.9.8, d2i_X509() accepted a const unsigned char **.
@@ -420,13 +420,13 @@ check_signatures() {
 #endif
 #endif
       bp = (unsigned char *)&buffer[0];
       bp = (unsigned char *)&buffer[0];
       bp_end = bp + buffer_size;
       bp_end = bp + buffer_size;
-      X509 *x509 = d2i_X509(NULL, &bp, bp_end - bp);
-      while (num_certs > 0 && x509 != NULL) {
+      X509 *x509 = d2i_X509(nullptr, &bp, bp_end - bp);
+      while (num_certs > 0 && x509 != nullptr) {
         chain.push_back(CertRecord(x509));
         chain.push_back(CertRecord(x509));
         --num_certs;
         --num_certs;
-        x509 = d2i_X509(NULL, &bp, bp_end - bp);
+        x509 = d2i_X509(nullptr, &bp, bp_end - bp);
       }
       }
-      if (num_certs != 0 || x509 != NULL) {
+      if (num_certs != 0 || x509 != nullptr) {
         nout << "Extra data in signature record.\n";
         nout << "Extra data in signature record.\n";
       }
       }
     }
     }
@@ -437,7 +437,7 @@ check_signatures() {
       pkey = X509_get_pubkey(chain[0]._cert);
       pkey = X509_get_pubkey(chain[0]._cert);
     }
     }
 
 
-    if (pkey != NULL) {
+    if (pkey != nullptr) {
       EVP_MD_CTX *md_ctx;
       EVP_MD_CTX *md_ctx;
 #if OPENSSL_VERSION_NUMBER >= 0x00907000L
 #if OPENSSL_VERSION_NUMBER >= 0x00907000L
       md_ctx = EVP_MD_CTX_create();
       md_ctx = EVP_MD_CTX_create();

+ 14 - 14
direct/src/plugin/p3dObject.cxx

@@ -77,7 +77,7 @@ static P3D_object *
 object_call(P3D_object *object, const char *method_name,
 object_call(P3D_object *object, const char *method_name,
             bool needs_response,
             bool needs_response,
             P3D_object *params[], int num_params) {
             P3D_object *params[], int num_params) {
-  if (method_name == NULL) {
+  if (method_name == nullptr) {
     method_name = "";
     method_name = "";
   }
   }
   return ((P3DObject *)object)->call(method_name, needs_response, params, num_params);
   return ((P3DObject *)object)->call(method_name, needs_response, params, num_params);
@@ -147,7 +147,7 @@ generic_get_repr(P3D_object *object, char *buffer, int buffer_length) {
 
 
 static P3D_object *
 static P3D_object *
 generic_get_property(P3D_object *object, const char *property) {
 generic_get_property(P3D_object *object, const char *property) {
-  return NULL;
+  return nullptr;
 }
 }
 
 
 static bool
 static bool
@@ -164,12 +164,12 @@ generic_has_method(P3D_object *object, const char *method_name) {
 static P3D_object *
 static P3D_object *
 generic_call(P3D_object *object, const char *method_name,
 generic_call(P3D_object *object, const char *method_name,
              bool needs_response, P3D_object *params[], int num_params) {
              bool needs_response, P3D_object *params[], int num_params) {
-  return NULL;
+  return nullptr;
 }
 }
 
 
 static P3D_object *
 static P3D_object *
 generic_eval(P3D_object *object, const char *expression) {
 generic_eval(P3D_object *object, const char *expression) {
-  return NULL;
+  return nullptr;
 }
 }
 
 
 P3D_class_definition P3DObject::_generic_class = {
 P3D_class_definition P3DObject::_generic_class = {
@@ -244,7 +244,7 @@ get_repr(char *buffer, int buffer_length) {
  */
  */
 P3D_object *P3DObject::
 P3D_object *P3DObject::
 get_property(const string &property) {
 get_property(const string &property) {
-  return NULL;
+  return nullptr;
 }
 }
 
 
 /**
 /**
@@ -275,7 +275,7 @@ has_method(const string &method_name) {
 P3D_object *P3DObject::
 P3D_object *P3DObject::
 call(const string &method_name, bool needs_response,
 call(const string &method_name, bool needs_response,
      P3D_object *params[], int num_params) {
      P3D_object *params[], int num_params) {
-  return NULL;
+  return nullptr;
 }
 }
 
 
 /**
 /**
@@ -284,7 +284,7 @@ call(const string &method_name, bool needs_response,
  */
  */
 P3D_object *P3DObject::
 P3D_object *P3DObject::
 eval(const string &expression) {
 eval(const string &expression) {
-  return NULL;
+  return nullptr;
 }
 }
 
 
 /**
 /**
@@ -317,7 +317,7 @@ fill_xml(TiXmlElement *xvalue, P3DSession *session) {
  */
  */
 P3D_object **P3DObject::
 P3D_object **P3DObject::
 get_object_array() {
 get_object_array() {
-  return NULL;
+  return nullptr;
 }
 }
 
 
 /**
 /**
@@ -335,7 +335,7 @@ get_object_array_size() {
  */
  */
 P3DPythonObject *P3DObject::
 P3DPythonObject *P3DObject::
 as_python_object() {
 as_python_object() {
-  return NULL;
+  return nullptr;
 }
 }
 
 
 /**
 /**
@@ -345,7 +345,7 @@ as_python_object() {
 bool P3DObject::
 bool P3DObject::
 get_bool_property(const string &property) {
 get_bool_property(const string &property) {
   P3D_object *result = get_property(property);
   P3D_object *result = get_property(property);
-  if (result == NULL) {
+  if (result == nullptr) {
     return 0;
     return 0;
   }
   }
   bool bresult = P3D_OBJECT_GET_BOOL(result);
   bool bresult = P3D_OBJECT_GET_BOOL(result);
@@ -370,7 +370,7 @@ set_bool_property(const string &property, bool value) {
 int P3DObject::
 int P3DObject::
 get_int_property(const string &property) {
 get_int_property(const string &property) {
   P3D_object *result = get_property(property);
   P3D_object *result = get_property(property);
-  if (result == NULL) {
+  if (result == nullptr) {
     return 0;
     return 0;
   }
   }
   int iresult = P3D_OBJECT_GET_INT(result);
   int iresult = P3D_OBJECT_GET_INT(result);
@@ -395,7 +395,7 @@ set_int_property(const string &property, int value) {
 double P3DObject::
 double P3DObject::
 get_float_property(const string &property) {
 get_float_property(const string &property) {
   P3D_object *result = get_property(property);
   P3D_object *result = get_property(property);
-  if (result == NULL) {
+  if (result == nullptr) {
     return 0.0;
     return 0.0;
   }
   }
   double fresult = P3D_OBJECT_GET_FLOAT(result);
   double fresult = P3D_OBJECT_GET_FLOAT(result);
@@ -421,11 +421,11 @@ set_float_property(const string &property, double value) {
 string P3DObject::
 string P3DObject::
 get_string_property(const string &property) {
 get_string_property(const string &property) {
   P3D_object *result = get_property(property);
   P3D_object *result = get_property(property);
-  if (result == NULL) {
+  if (result == nullptr) {
     return string();
     return string();
   }
   }
 
 
-  int size = P3D_OBJECT_GET_STRING(result, NULL, 0);
+  int size = P3D_OBJECT_GET_STRING(result, nullptr, 0);
   char *buffer = new char[size];
   char *buffer = new char[size];
   P3D_OBJECT_GET_STRING(result, buffer, size);
   P3D_OBJECT_GET_STRING(result, buffer, size);
   string sresult(buffer, size);
   string sresult(buffer, size);

+ 5 - 5
direct/src/plugin/p3dOsxSplashWindow.I

@@ -16,11 +16,11 @@
  */
  */
 inline P3DOsxSplashWindow::OsxImageData::
 inline P3DOsxSplashWindow::OsxImageData::
 OsxImageData() {
 OsxImageData() {
-  _raw_data = NULL;
-  _image = NULL;
-  _color_space = NULL;
-  _provider = NULL;
-  _data = NULL;
+  _raw_data = nullptr;
+  _image = nullptr;
+  _color_space = nullptr;
+  _provider = nullptr;
+  _data = nullptr;
 }
 }
 
 
 /**
 /**

+ 39 - 39
direct/src/plugin/p3dOsxSplashWindow.cxx

@@ -33,7 +33,7 @@ P3DOsxSplashWindow::
 P3DOsxSplashWindow(P3DInstance *inst, bool make_visible) :
 P3DOsxSplashWindow(P3DInstance *inst, bool make_visible) :
   P3DSplashWindow(inst, make_visible)
   P3DSplashWindow(inst, make_visible)
 {
 {
-  _font_attribs = NULL;
+  _font_attribs = nullptr;
   _install_progress = 0;
   _install_progress = 0;
   _progress_known = true;
   _progress_known = true;
   _received_data = 0;
   _received_data = 0;
@@ -41,7 +41,7 @@ P3DOsxSplashWindow(P3DInstance *inst, bool make_visible) :
   // We have to start with _mouse_active true; firefox doesn't send activate
   // We have to start with _mouse_active true; firefox doesn't send activate
   // events.
   // events.
   _mouse_active = true;
   _mouse_active = true;
-  _toplevel_window = NULL;
+  _toplevel_window = nullptr;
 }
 }
 
 
 /**
 /**
@@ -49,13 +49,13 @@ P3DOsxSplashWindow(P3DInstance *inst, bool make_visible) :
  */
  */
 P3DOsxSplashWindow::
 P3DOsxSplashWindow::
 ~P3DOsxSplashWindow() {
 ~P3DOsxSplashWindow() {
-  if (_toplevel_window != NULL) {
+  if (_toplevel_window != nullptr) {
     SetWRefCon(_toplevel_window, 0);
     SetWRefCon(_toplevel_window, 0);
     HideWindow(_toplevel_window);
     HideWindow(_toplevel_window);
     DisposeWindow(_toplevel_window);
     DisposeWindow(_toplevel_window);
-    _toplevel_window = NULL;
+    _toplevel_window = nullptr;
   }
   }
-  if (_font_attribs != NULL) {
+  if (_font_attribs != nullptr) {
     CFRelease(_font_attribs);
     CFRelease(_font_attribs);
   }
   }
 }
 }
@@ -72,7 +72,7 @@ set_wparams(const P3DWindowParams &wparams) {
   if (_wparams.get_window_type() == P3D_WT_toplevel ||
   if (_wparams.get_window_type() == P3D_WT_toplevel ||
       _wparams.get_window_type() == P3D_WT_fullscreen) {
       _wparams.get_window_type() == P3D_WT_fullscreen) {
     // Creating a toplevel splash window.
     // Creating a toplevel splash window.
-    if (_toplevel_window == NULL) {
+    if (_toplevel_window == nullptr) {
       Rect r;
       Rect r;
       r.top = _wparams.get_win_y();
       r.top = _wparams.get_win_y();
       r.left = _wparams.get_win_x();
       r.left = _wparams.get_win_x();
@@ -134,7 +134,7 @@ set_wparams(const P3DWindowParams &wparams) {
   CFTypeRef traits_values[1] = { symbolic_ref };
   CFTypeRef traits_values[1] = { symbolic_ref };
   CFDictionaryRef traits = CFDictionaryCreate(kCFAllocatorDefault, (const void **)&traits_keys, (const void **)&traits_values, 1, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);
   CFDictionaryRef traits = CFDictionaryCreate(kCFAllocatorDefault, (const void **)&traits_keys, (const void **)&traits_values, 1, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);
 
 
-  CFStringRef family = CFStringCreateWithCString(NULL, _font_family.c_str(), kCFStringEncodingUTF8);
+  CFStringRef family = CFStringCreateWithCString(nullptr, _font_family.c_str(), kCFStringEncodingUTF8);
 
 
   CFStringRef attribs_keys[2] = { kCTFontFamilyNameAttribute, kCTFontTraitsAttribute };
   CFStringRef attribs_keys[2] = { kCTFontFamilyNameAttribute, kCTFontTraitsAttribute };
   CFTypeRef attribs_values[2] = { family, traits };
   CFTypeRef attribs_values[2] = { family, traits };
@@ -142,7 +142,7 @@ set_wparams(const P3DWindowParams &wparams) {
 
 
   // Create the font object.
   // Create the font object.
   CTFontDescriptorRef font_desc = CTFontDescriptorCreateWithAttributes(attribs);
   CTFontDescriptorRef font_desc = CTFontDescriptorCreateWithAttributes(attribs);
-  CTFontRef font = CTFontCreateWithFontDescriptor(font_desc, _font_size, NULL);
+  CTFontRef font = CTFontCreateWithFontDescriptor(font_desc, _font_size, nullptr);
 
 
   CFStringRef keys[1] = { kCTFontAttributeName };
   CFStringRef keys[1] = { kCTFontAttributeName };
   CFTypeRef values[1] = { font };
   CFTypeRef values[1] = { font };
@@ -164,7 +164,7 @@ void P3DOsxSplashWindow::
 set_visible(bool visible) {
 set_visible(bool visible) {
   P3DSplashWindow::set_visible(visible);
   P3DSplashWindow::set_visible(visible);
 
 
-  if (_toplevel_window != NULL) {
+  if (_toplevel_window != nullptr) {
     if (_visible) {
     if (_visible) {
       ShowWindow(_toplevel_window);
       ShowWindow(_toplevel_window);
     } else {
     } else {
@@ -266,7 +266,7 @@ refresh() {
   if (!_visible) {
   if (!_visible) {
     return;
     return;
   }
   }
-  if (_toplevel_window != NULL) {
+  if (_toplevel_window != nullptr) {
     Rect r = { 0, 0, (short)_win_height, (short)_win_width };
     Rect r = { 0, 0, (short)_win_height, (short)_win_width };
     InvalWindowRect(_toplevel_window, &r);
     InvalWindowRect(_toplevel_window, &r);
 
 
@@ -284,13 +284,13 @@ paint_window() {
     return;
     return;
   }
   }
 
 
-  if (_toplevel_window != NULL ||
+  if (_toplevel_window != nullptr ||
       _wparams.get_parent_window()._window_handle_type == P3D_WHT_osx_port) {
       _wparams.get_parent_window()._window_handle_type == P3D_WHT_osx_port) {
 
 
     // The old QuickDraw-style window handle.  We use CreateCGContextForPort()
     // The old QuickDraw-style window handle.  We use CreateCGContextForPort()
     // to map this to the new CoreGraphics-style.
     // to map this to the new CoreGraphics-style.
-    GrafPtr out_port = NULL;
-    if (_toplevel_window != NULL) {
+    GrafPtr out_port = nullptr;
+    if (_toplevel_window != nullptr) {
       GetPort(&out_port);
       GetPort(&out_port);
 
 
     } else {
     } else {
@@ -394,13 +394,13 @@ handle_event_osx_event_record(const P3D_event_data &event) {
   const P3D_window_handle &handle = _wparams.get_parent_window();
   const P3D_window_handle &handle = _wparams.get_parent_window();
   if (handle._window_handle_type == P3D_WHT_osx_port) {
   if (handle._window_handle_type == P3D_WHT_osx_port) {
     GrafPtr out_port = handle._handle._osx_port._port;
     GrafPtr out_port = handle._handle._osx_port._port;
-    GrafPtr port_save = NULL;
+    GrafPtr port_save = nullptr;
     Boolean port_changed = QDSwapPort(out_port, &port_save);
     Boolean port_changed = QDSwapPort(out_port, &port_save);
 
 
     GlobalToLocal(&pt);
     GlobalToLocal(&pt);
 
 
     if (port_changed) {
     if (port_changed) {
-      QDSwapPort(port_save, NULL);
+      QDSwapPort(port_save, nullptr);
     }
     }
 
 
   } else if (handle._window_handle_type == P3D_WHT_osx_cgcontext) {
   } else if (handle._window_handle_type == P3D_WHT_osx_cgcontext) {
@@ -408,7 +408,7 @@ handle_event_osx_event_record(const P3D_event_data &event) {
     // window coordinates.
     // window coordinates.
     WindowRef window = handle._handle._osx_cgcontext._window;
     WindowRef window = handle._handle._osx_cgcontext._window;
     CGPoint cgpt = { (CGFloat)pt.h, (CGFloat)pt.v };
     CGPoint cgpt = { (CGFloat)pt.h, (CGFloat)pt.v };
-    HIPointConvert(&cgpt, kHICoordSpaceScreenPixel, NULL,
+    HIPointConvert(&cgpt, kHICoordSpaceScreenPixel, nullptr,
                    kHICoordSpaceWindow, window);
                    kHICoordSpaceWindow, window);
 
 
     // Then convert to plugin coordinates.
     // Then convert to plugin coordinates.
@@ -536,7 +536,7 @@ load_image(OsxImageData &image, const string &image_filename) {
   }
   }
 
 
   image._data =
   image._data =
-    CFDataCreateWithBytesNoCopy(NULL, (const UInt8 *)image._raw_data,
+    CFDataCreateWithBytesNoCopy(nullptr, (const UInt8 *)image._raw_data,
                                 image._height * new_row_stride, kCFAllocatorNull);
                                 image._height * new_row_stride, kCFAllocatorNull);
   image._provider = CGDataProviderCreateWithCFData(image._data);
   image._provider = CGDataProviderCreateWithCFData(image._data);
   image._color_space = CGColorSpaceCreateDeviceRGB();
   image._color_space = CGColorSpaceCreateDeviceRGB();
@@ -545,7 +545,7 @@ load_image(OsxImageData &image, const string &image_filename) {
     CGImageCreate(image._width, image._height, 8, 32,
     CGImageCreate(image._width, image._height, 8, 32,
                   new_row_stride, image._color_space,
                   new_row_stride, image._color_space,
                   kCGImageAlphaFirst | kCGBitmapByteOrder32Little,
                   kCGImageAlphaFirst | kCGBitmapByteOrder32Little,
-                  image._provider, NULL, false, kCGRenderingIntentDefault);
+                  image._provider, nullptr, false, kCGRenderingIntentDefault);
 }
 }
 
 
 /**
 /**
@@ -554,7 +554,7 @@ load_image(OsxImageData &image, const string &image_filename) {
  */
  */
 bool P3DOsxSplashWindow::
 bool P3DOsxSplashWindow::
 paint_image(CGContextRef context, const OsxImageData &image) {
 paint_image(CGContextRef context, const OsxImageData &image) {
-  if (image._image == NULL) {
+  if (image._image == nullptr) {
     return false;
     return false;
   }
   }
 
 
@@ -675,8 +675,8 @@ paint_progress_bar(CGContextRef context) {
     CGContextSetTextMatrix(context, text_xform);
     CGContextSetTextMatrix(context, text_xform);
 
 
     // Now draw the install_label right above it.
     // Now draw the install_label right above it.
-    CFStringRef string = CFStringCreateWithCString(NULL, _install_label.c_str(), kCFStringEncodingUTF8);
-    CFAttributedStringRef attr_string = CFAttributedStringCreate(NULL, string, _font_attribs);
+    CFStringRef string = CFStringCreateWithCString(nullptr, _install_label.c_str(), kCFStringEncodingUTF8);
+    CFAttributedStringRef attr_string = CFAttributedStringCreate(nullptr, string, _font_attribs);
     CTLineRef line = CTLineCreateWithAttributedString(attr_string);
     CTLineRef line = CTLineCreateWithAttributedString(attr_string);
 
 
     // Determine the placement based on the size of the text.
     // Determine the placement based on the size of the text.
@@ -716,11 +716,11 @@ OSStatus P3DOsxSplashWindow::
 event_callback(EventHandlerCallRef my_handler, EventRef event) {
 event_callback(EventHandlerCallRef my_handler, EventRef event) {
   OSStatus result = eventNotHandledErr;
   OSStatus result = eventNotHandledErr;
 
 
-  WindowRef window = NULL;
+  WindowRef window = nullptr;
   UInt32 the_class = GetEventClass(event);
   UInt32 the_class = GetEventClass(event);
   UInt32 kind = GetEventKind(event);
   UInt32 kind = GetEventKind(event);
-  GetEventParameter(event, kEventParamWindowRef, typeWindowRef, NULL,
-                    sizeof(WindowRef), NULL, (void*) &window);
+  GetEventParameter(event, kEventParamWindowRef, typeWindowRef, nullptr,
+                    sizeof(WindowRef), nullptr, (void*) &window);
   switch (the_class) {
   switch (the_class) {
   case kEventClassWindow:
   case kEventClassWindow:
     switch (kind) {
     switch (kind) {
@@ -773,17 +773,17 @@ event_callback(EventHandlerCallRef my_handler, EventRef event) {
     case kEventMouseDragged:
     case kEventMouseDragged:
       {
       {
         Point point;
         Point point;
-        GetEventParameter(event, kEventParamMouseLocation, typeQDPoint, NULL,
-                          sizeof(Point), NULL, (void *)&point);
+        GetEventParameter(event, kEventParamMouseLocation, typeQDPoint, nullptr,
+                          sizeof(Point), nullptr, (void *)&point);
 
 
         GrafPtr port;
         GrafPtr port;
-        assert(_toplevel_window != NULL);
+        assert(_toplevel_window != nullptr);
         port = GetWindowPort(_toplevel_window);
         port = GetWindowPort(_toplevel_window);
-        GrafPtr port_save = NULL;
+        GrafPtr port_save = nullptr;
         Boolean port_changed = QDSwapPort(port, &port_save);
         Boolean port_changed = QDSwapPort(port, &port_save);
         GlobalToLocal(&point);
         GlobalToLocal(&point);
         if (port_changed) {
         if (port_changed) {
-          QDSwapPort(port_save, NULL);
+          QDSwapPort(port_save, nullptr);
         }
         }
 
 
         set_mouse_data(point.h, point.v, _mouse_down);
         set_mouse_data(point.h, point.v, _mouse_down);
@@ -800,25 +800,25 @@ event_callback(EventHandlerCallRef my_handler, EventRef event) {
  */
  */
 void P3DOsxSplashWindow::OsxImageData::
 void P3DOsxSplashWindow::OsxImageData::
 dump_image() {
 dump_image() {
-  if (_image != NULL) {
+  if (_image != nullptr) {
     CGImageRelease(_image);
     CGImageRelease(_image);
-    _image = NULL;
+    _image = nullptr;
   }
   }
-  if (_color_space != NULL) {
+  if (_color_space != nullptr) {
     CGColorSpaceRelease(_color_space);
     CGColorSpaceRelease(_color_space);
-    _color_space = NULL;
+    _color_space = nullptr;
   }
   }
-  if (_provider != NULL) {
+  if (_provider != nullptr) {
     CGDataProviderRelease(_provider);
     CGDataProviderRelease(_provider);
-    _provider = NULL;
+    _provider = nullptr;
   }
   }
-  if (_data != NULL) {
+  if (_data != nullptr) {
     CFRelease(_data);
     CFRelease(_data);
-    _data = NULL;
+    _data = nullptr;
   }
   }
-  if (_raw_data != NULL) {
+  if (_raw_data != nullptr) {
     delete[] _raw_data;
     delete[] _raw_data;
-    _raw_data = NULL;
+    _raw_data = nullptr;
   }
   }
 }
 }
 
 

+ 58 - 58
direct/src/plugin/p3dPackage.cxx

@@ -59,16 +59,16 @@ P3DPackage(P3DHost *host, const string &package_name,
 
 
   _host_contents_iseq = 0;
   _host_contents_iseq = 0;
 
 
-  _xconfig = NULL;
-  _temp_contents_file = NULL;
+  _xconfig = nullptr;
+  _temp_contents_file = nullptr;
 
 
   _computed_plan_size = false;
   _computed_plan_size = false;
   _info_ready = false;
   _info_ready = false;
   _allow_data_download = false;
   _allow_data_download = false;
   _ready = false;
   _ready = false;
   _failed = false;
   _failed = false;
-  _active_download = NULL;
-  _saved_download = NULL;
+  _active_download = nullptr;
+  _saved_download = nullptr;
   _updated = false;
   _updated = false;
 }
 }
 
 
@@ -89,24 +89,24 @@ P3DPackage::
   }
   }
   _instances.clear();
   _instances.clear();
 
 
-  if (_xconfig != NULL) {
+  if (_xconfig != nullptr) {
     delete _xconfig;
     delete _xconfig;
-    _xconfig = NULL;
+    _xconfig = nullptr;
   }
   }
 
 
   // Cancel any pending download.
   // Cancel any pending download.
-  if (_active_download != NULL) {
+  if (_active_download != nullptr) {
     _active_download->cancel();
     _active_download->cancel();
-    set_active_download(NULL);
+    set_active_download(nullptr);
   }
   }
-  if (_saved_download != NULL) {
+  if (_saved_download != nullptr) {
     _saved_download->cancel();
     _saved_download->cancel();
-    set_saved_download(NULL);
+    set_saved_download(nullptr);
   }
   }
 
 
-  if (_temp_contents_file != NULL) {
+  if (_temp_contents_file != nullptr) {
     delete _temp_contents_file;
     delete _temp_contents_file;
-    _temp_contents_file = NULL;
+    _temp_contents_file = nullptr;
   }
   }
 }
 }
 
 
@@ -192,9 +192,9 @@ remove_instance(P3DInstance *inst) {
   if (inst == _instances[0]) {
   if (inst == _instances[0]) {
     // This was the primary instance.  Cancel any pending download and move to
     // This was the primary instance.  Cancel any pending download and move to
     // the next instance.
     // the next instance.
-    if (_active_download != NULL) {
+    if (_active_download != nullptr) {
       _active_download->cancel();
       _active_download->cancel();
-      set_active_download(NULL);
+      set_active_download(nullptr);
     }
     }
   }
   }
 
 
@@ -226,12 +226,12 @@ mark_used() {
   }
   }
 
 
   TiXmlElement *xusage = doc.FirstChildElement("usage");
   TiXmlElement *xusage = doc.FirstChildElement("usage");
-  if (xusage == NULL) {
+  if (xusage == nullptr) {
     xusage = new TiXmlElement("usage");
     xusage = new TiXmlElement("usage");
     doc.LinkEndChild(xusage);
     doc.LinkEndChild(xusage);
   }
   }
 
 
-  time_t now = time(NULL);
+  time_t now = time(nullptr);
   int count = 0;
   int count = 0;
   xusage->Attribute("count_runtime", &count);
   xusage->Attribute("count_runtime", &count);
   if (count == 0) {
   if (count == 0) {
@@ -292,7 +292,7 @@ uninstall() {
   for (ii = _instances.begin(); ii != _instances.end(); ++ii) {
   for (ii = _instances.begin(); ii != _instances.end(); ++ii) {
     P3DInstance *inst = (*ii);
     P3DInstance *inst = (*ii);
     P3DSession *session = inst->get_session();
     P3DSession *session = inst->get_session();
-    if (session != NULL) {
+    if (session != nullptr) {
       nout << "Stopping session " << session << "\n";
       nout << "Stopping session " << session << "\n";
       session->shutdown();
       session->shutdown();
     }
     }
@@ -350,7 +350,7 @@ begin_info_download() {
     return;
     return;
   }
   }
 
 
-  if (_active_download != NULL) {
+  if (_active_download != nullptr) {
     // In the middle of downloading.
     // In the middle of downloading.
     return;
     return;
   }
   }
@@ -387,9 +387,9 @@ download_contents_file() {
 
 
   // Download contents.xml to a temporary filename first, in case multiple
   // Download contents.xml to a temporary filename first, in case multiple
   // packages are downloading it simultaneously.
   // packages are downloading it simultaneously.
-  if (_temp_contents_file != NULL) {
+  if (_temp_contents_file != nullptr) {
     delete _temp_contents_file;
     delete _temp_contents_file;
-    _temp_contents_file = NULL;
+    _temp_contents_file = nullptr;
   }
   }
   _temp_contents_file = new P3DTemporaryFile(".xml");
   _temp_contents_file = new P3DTemporaryFile(".xml");
 
 
@@ -404,7 +404,7 @@ void P3DPackage::
 contents_file_download_finished(bool success) {
 contents_file_download_finished(bool success) {
   P3DInstanceManager *inst_mgr = P3DInstanceManager::get_global_ptr();
   P3DInstanceManager *inst_mgr = P3DInstanceManager::get_global_ptr();
   if (!_host->has_current_contents_file(inst_mgr)) {
   if (!_host->has_current_contents_file(inst_mgr)) {
-    if (!success || _temp_contents_file == NULL ||
+    if (!success || _temp_contents_file == nullptr ||
       !_host->read_contents_file(_temp_contents_file->get_filename(), true)) {
       !_host->read_contents_file(_temp_contents_file->get_filename(), true)) {
 
 
       if (_temp_contents_file) {
       if (_temp_contents_file) {
@@ -429,7 +429,7 @@ contents_file_download_finished(bool success) {
         report_done(false);
         report_done(false);
         if (_temp_contents_file) {
         if (_temp_contents_file) {
           delete _temp_contents_file;
           delete _temp_contents_file;
-          _temp_contents_file = NULL;
+          _temp_contents_file = nullptr;
         }
         }
         return;
         return;
       }
       }
@@ -439,7 +439,7 @@ contents_file_download_finished(bool success) {
   // The file is correctly installed by now; we can remove the temporary file.
   // The file is correctly installed by now; we can remove the temporary file.
   if (_temp_contents_file) {
   if (_temp_contents_file) {
     delete _temp_contents_file;
     delete _temp_contents_file;
-    _temp_contents_file = NULL;
+    _temp_contents_file = nullptr;
   }
   }
 
 
   host_got_contents_file();
   host_got_contents_file();
@@ -460,8 +460,8 @@ contents_file_download_finished(bool success) {
  */
  */
 void P3DPackage::
 void P3DPackage::
 redownload_contents_file(P3DPackage::Download *download) {
 redownload_contents_file(P3DPackage::Download *download) {
-  assert(_active_download == NULL);
-  assert(_saved_download == NULL);
+  assert(_active_download == nullptr);
+  assert(_saved_download == nullptr);
 
 
   if (_host->get_contents_iseq() != _host_contents_iseq) {
   if (_host->get_contents_iseq() != _host_contents_iseq) {
     // If the contents_iseq number has changed, we don't even need to download
     // If the contents_iseq number has changed, we don't even need to download
@@ -479,9 +479,9 @@ redownload_contents_file(P3DPackage::Download *download) {
   set_saved_download(download);
   set_saved_download(download);
 
 
   // Download contents.xml to a temporary filename first.
   // Download contents.xml to a temporary filename first.
-  if (_temp_contents_file != NULL) {
+  if (_temp_contents_file != nullptr) {
     delete _temp_contents_file;
     delete _temp_contents_file;
-    _temp_contents_file = NULL;
+    _temp_contents_file = nullptr;
   }
   }
   _temp_contents_file = new P3DTemporaryFile(".xml");
   _temp_contents_file = new P3DTemporaryFile(".xml");
 
 
@@ -521,14 +521,14 @@ contents_file_redownload_finished(bool success) {
   // We no longer need the temporary file.
   // We no longer need the temporary file.
   if (_temp_contents_file) {
   if (_temp_contents_file) {
     delete _temp_contents_file;
     delete _temp_contents_file;
-    _temp_contents_file = NULL;
+    _temp_contents_file = nullptr;
   }
   }
 
 
   if (contents_changed) {
   if (contents_changed) {
     // OK, the contents.xml has changed; this means we have to restart the
     // OK, the contents.xml has changed; this means we have to restart the
     // whole download process from the beginning.
     // whole download process from the beginning.
     nout << "Redownloading contents.xml made a difference.\n";
     nout << "Redownloading contents.xml made a difference.\n";
-    set_saved_download(NULL);
+    set_saved_download(nullptr);
     host_got_contents_file();
     host_got_contents_file();
 
 
   } else {
   } else {
@@ -536,8 +536,8 @@ contents_file_redownload_finished(bool success) {
     // you to our regularly scheduled download.
     // you to our regularly scheduled download.
     nout << "Redownloading contents.xml didn't help.\n";
     nout << "Redownloading contents.xml didn't help.\n";
     Download *download = _saved_download;
     Download *download = _saved_download;
-    _saved_download = NULL;
-    if (download == NULL) {
+    _saved_download = nullptr;
+    if (download == nullptr) {
       // But, if _saved_download was NULL (meaning NULL was passed to
       // But, if _saved_download was NULL (meaning NULL was passed to
       // redownload_contents_file(), above), it means that we were called from
       // redownload_contents_file(), above), it means that we were called from
       // download_desc_file(), and there's nothing more to do.  We're just
       // download_desc_file(), and there's nothing more to do.  We're just
@@ -639,7 +639,7 @@ download_desc_file() {
     nout << "Couldn't find package " << _package_fullname
     nout << "Couldn't find package " << _package_fullname
          << ", platform \"" << _package_platform
          << ", platform \"" << _package_platform
          << "\" in contents file.\n";
          << "\" in contents file.\n";
-    redownload_contents_file(NULL);
+    redownload_contents_file(nullptr);
     return;
     return;
   }
   }
 
 
@@ -730,7 +730,7 @@ desc_file_download_finished(bool success) {
 void P3DPackage::
 void P3DPackage::
 got_desc_file(TiXmlDocument *doc, bool freshly_downloaded) {
 got_desc_file(TiXmlDocument *doc, bool freshly_downloaded) {
   TiXmlElement *xpackage = doc->FirstChildElement("package");
   TiXmlElement *xpackage = doc->FirstChildElement("package");
-  if (xpackage == NULL) {
+  if (xpackage == nullptr) {
     nout << _package_name << " desc file contains no <package>\n";
     nout << _package_name << " desc file contains no <package>\n";
     if (!freshly_downloaded) {
     if (!freshly_downloaded) {
       download_desc_file();
       download_desc_file();
@@ -752,9 +752,9 @@ got_desc_file(TiXmlDocument *doc, bool freshly_downloaded) {
   xpackage->Attribute("patch_version", &_patch_version);
   xpackage->Attribute("patch_version", &_patch_version);
 
 
   TiXmlElement *xconfig = xpackage->FirstChildElement("config");
   TiXmlElement *xconfig = xpackage->FirstChildElement("config");
-  if (xconfig != NULL) {
+  if (xconfig != nullptr) {
     const char *display_name_cstr = xconfig->Attribute("display_name");
     const char *display_name_cstr = xconfig->Attribute("display_name");
-    if (display_name_cstr != NULL) {
+    if (display_name_cstr != nullptr) {
       _package_display_name = display_name_cstr;
       _package_display_name = display_name_cstr;
     }
     }
 
 
@@ -767,7 +767,7 @@ got_desc_file(TiXmlDocument *doc, bool freshly_downloaded) {
   TiXmlElement *xcompressed_archive =
   TiXmlElement *xcompressed_archive =
     xpackage->FirstChildElement("compressed_archive");
     xpackage->FirstChildElement("compressed_archive");
 
 
-  if (xuncompressed_archive == NULL || xcompressed_archive == NULL) {
+  if (xuncompressed_archive == nullptr || xcompressed_archive == nullptr) {
     // The desc file didn't include the archive file itself, weird.
     // The desc file didn't include the archive file itself, weird.
     if (!freshly_downloaded) {
     if (!freshly_downloaded) {
       download_desc_file();
       download_desc_file();
@@ -784,7 +784,7 @@ got_desc_file(TiXmlDocument *doc, bool freshly_downloaded) {
   _unpack_size = 0;
   _unpack_size = 0;
   _extracts.clear();
   _extracts.clear();
   TiXmlElement *xextract = xpackage->FirstChildElement("extract");
   TiXmlElement *xextract = xpackage->FirstChildElement("extract");
-  while (xextract != NULL) {
+  while (xextract != nullptr) {
     FileSpec file;
     FileSpec file;
     file.load_xml(xextract);
     file.load_xml(xextract);
     _extracts.push_back(file);
     _extracts.push_back(file);
@@ -797,16 +797,16 @@ got_desc_file(TiXmlDocument *doc, bool freshly_downloaded) {
   // Get the required packages.
   // Get the required packages.
   _requires.clear();
   _requires.clear();
   TiXmlElement *xrequires = xpackage->FirstChildElement("requires");
   TiXmlElement *xrequires = xpackage->FirstChildElement("requires");
-  while (xrequires != NULL) {
+  while (xrequires != nullptr) {
     const char *package_name = xrequires->Attribute("name");
     const char *package_name = xrequires->Attribute("name");
     const char *host_url = xrequires->Attribute("host");
     const char *host_url = xrequires->Attribute("host");
-    if (package_name != NULL && host_url != NULL) {
+    if (package_name != nullptr && host_url != nullptr) {
       const char *version = xrequires->Attribute("version");
       const char *version = xrequires->Attribute("version");
-      if (version == NULL) {
+      if (version == nullptr) {
         version = "";
         version = "";
       }
       }
       const char *seq = xrequires->Attribute("seq");
       const char *seq = xrequires->Attribute("seq");
-      if (seq == NULL) {
+      if (seq == nullptr) {
         seq = "";
         seq = "";
       }
       }
       P3DHost *host = inst_mgr->get_host(host_url);
       P3DHost *host = inst_mgr->get_host(host_url);
@@ -969,14 +969,14 @@ build_install_plans(TiXmlDocument *doc) {
     // Maybe we've already read the md5 hash and we have it stored here.
     // Maybe we've already read the md5 hash and we have it stored here.
     const FileSpec *on_disk_ptr = _uncompressed_archive.get_actual_file();
     const FileSpec *on_disk_ptr = _uncompressed_archive.get_actual_file();
     FileSpec on_disk;
     FileSpec on_disk;
-    if (on_disk_ptr == NULL) {
+    if (on_disk_ptr == nullptr) {
       // If not, we have to go read it now.
       // If not, we have to go read it now.
       if (on_disk.read_hash(_uncompressed_archive.get_pathname(_package_dir))) {
       if (on_disk.read_hash(_uncompressed_archive.get_pathname(_package_dir))) {
         on_disk_ptr = &on_disk;
         on_disk_ptr = &on_disk;
       }
       }
     }
     }
 
 
-    if (on_disk_ptr != NULL) {
+    if (on_disk_ptr != nullptr) {
       P3DPatchFinder patch_finder;
       P3DPatchFinder patch_finder;
       P3DPatchFinder::Patchfiles chain;
       P3DPatchFinder::Patchfiles chain;
       if (patch_finder.get_patch_chain_to_current(chain, doc, *on_disk_ptr)) {
       if (patch_finder.get_patch_chain_to_current(chain, doc, *on_disk_ptr)) {
@@ -1218,7 +1218,7 @@ P3DPackage::Download *P3DPackage::
 start_download(P3DPackage::DownloadType dtype, const string &urlbase,
 start_download(P3DPackage::DownloadType dtype, const string &urlbase,
                const string &pathname, const FileSpec &file_spec) {
                const string &pathname, const FileSpec &file_spec) {
   // Only one download should be active at a time
   // Only one download should be active at a time
-  assert(_active_download == NULL);
+  assert(_active_download == nullptr);
   // This can't happen!  If verify_contents is set to P3D_VC_never, we're not
   // This can't happen!  If verify_contents is set to P3D_VC_never, we're not
   // allowed to download anything, so we shouldn't get here
   // allowed to download anything, so we shouldn't get here
   P3DInstanceManager *inst_mgr = P3DInstanceManager::get_global_ptr();
   P3DInstanceManager *inst_mgr = P3DInstanceManager::get_global_ptr();
@@ -1249,7 +1249,7 @@ start_download(P3DPackage::DownloadType dtype, const string &urlbase,
   } else {
   } else {
     strm << _host->get_download_url_prefix();
     strm << _host->get_download_url_prefix();
   }
   }
-  strm << urlbase << "?" << time(NULL);
+  strm << urlbase << "?" << time(nullptr);
   string url = strm.str();
   string url = strm.str();
   download->_try_urls.push_back(url);
   download->_try_urls.push_back(url);
 
 
@@ -1315,11 +1315,11 @@ start_download(P3DPackage::DownloadType dtype, const string &urlbase,
 void P3DPackage::
 void P3DPackage::
 set_active_download(Download *download) {
 set_active_download(Download *download) {
   if (_active_download != download) {
   if (_active_download != download) {
-    if (_active_download != NULL) {
+    if (_active_download != nullptr) {
       p3d_unref_delete(_active_download);
       p3d_unref_delete(_active_download);
     }
     }
     _active_download = download;
     _active_download = download;
-    if (_active_download != NULL) {
+    if (_active_download != nullptr) {
       _active_download->ref();
       _active_download->ref();
     }
     }
   }
   }
@@ -1332,11 +1332,11 @@ set_active_download(Download *download) {
 void P3DPackage::
 void P3DPackage::
 set_saved_download(Download *download) {
 set_saved_download(Download *download) {
   if (_saved_download != download) {
   if (_saved_download != download) {
-    if (_saved_download != NULL) {
+    if (_saved_download != nullptr) {
       p3d_unref_delete(_saved_download);
       p3d_unref_delete(_saved_download);
     }
     }
     _saved_download = download;
     _saved_download = download;
-    if (_saved_download != NULL) {
+    if (_saved_download != nullptr) {
       _saved_download->ref();
       _saved_download->ref();
     }
     }
   }
   }
@@ -1456,11 +1456,11 @@ download_finished(bool success) {
   if (get_ref_count() == 1) {
   if (get_ref_count() == 1) {
     // No one cares anymore.
     // No one cares anymore.
     nout << "No one cares about " << get_url() << "\n";
     nout << "No one cares about " << get_url() << "\n";
-    _package->set_active_download(NULL);
+    _package->set_active_download(nullptr);
     return;
     return;
   }
   }
 
 
-  _package->set_active_download(NULL);
+  _package->set_active_download(nullptr);
   assert(get_ref_count() > 0);
   assert(get_ref_count() > 0);
 
 
   if (success && !_file_spec.get_filename().empty()) {
   if (success && !_file_spec.get_filename().empty()) {
@@ -1471,7 +1471,7 @@ download_finished(bool success) {
       nout << "expected: ";
       nout << "expected: ";
       _file_spec.output_hash(nout);
       _file_spec.output_hash(nout);
       nout << "\n";
       nout << "\n";
-      if (_file_spec.get_actual_file() != (FileSpec *)NULL) {
+      if (_file_spec.get_actual_file() != nullptr) {
         nout << "     got: ";
         nout << "     got: ";
         _file_spec.get_actual_file()->output_hash(nout);
         _file_spec.get_actual_file()->output_hash(nout);
         nout << "\n";
         nout << "\n";
@@ -1578,7 +1578,7 @@ InstallStepDownloadFile(P3DPackage *package, const FileSpec &file) :
 
 
   _pathname = _package->get_package_dir() + "/" + _file.get_filename();
   _pathname = _package->get_package_dir() + "/" + _file.get_filename();
 
 
-  _download = NULL;
+  _download = nullptr;
 }
 }
 
 
 /**
 /**
@@ -1586,7 +1586,7 @@ InstallStepDownloadFile(P3DPackage *package, const FileSpec &file) :
  */
  */
 P3DPackage::InstallStepDownloadFile::
 P3DPackage::InstallStepDownloadFile::
 ~InstallStepDownloadFile() {
 ~InstallStepDownloadFile() {
-  if (_download != NULL) {
+  if (_download != nullptr) {
     p3d_unref_delete(_download);
     p3d_unref_delete(_download);
   }
   }
 }
 }
@@ -1596,13 +1596,13 @@ P3DPackage::InstallStepDownloadFile::
  */
  */
 P3DPackage::InstallToken P3DPackage::InstallStepDownloadFile::
 P3DPackage::InstallToken P3DPackage::InstallStepDownloadFile::
 do_step(bool download_finished) {
 do_step(bool download_finished) {
-  if (_download == NULL) {
+  if (_download == nullptr) {
     // First, we have to start the download going.
     // First, we have to start the download going.
-    assert(_package->_active_download == NULL);
+    assert(_package->_active_download == nullptr);
 
 
     _download = _package->start_download(DT_install_step, _urlbase,
     _download = _package->start_download(DT_install_step, _urlbase,
                                          _pathname, _file);
                                          _pathname, _file);
-    assert(_download != NULL);
+    assert(_download != nullptr);
     _download->ref();
     _download->ref();
   }
   }
 
 
@@ -1632,7 +1632,7 @@ do_step(bool download_finished) {
     nout << "Restarting download of " << _urlbase << " on new instance\n";
     nout << "Restarting download of " << _urlbase << " on new instance\n";
 
 
     p3d_unref_delete(_download);
     p3d_unref_delete(_download);
-    _download = NULL;
+    _download = nullptr;
     return IT_continue;
     return IT_continue;
 
 
   } else {
   } else {

+ 24 - 24
direct/src/plugin/p3dPatchFinder.cxx

@@ -24,8 +24,8 @@ PackageVersion(const PackageVersionKey &key) :
   _host_url(key._host_url),
   _host_url(key._host_url),
   _file(key._file)
   _file(key._file)
 {
 {
-  _package_current = NULL;
-  _package_base = NULL;
+  _package_current = nullptr;
+  _package_base = nullptr;
 }
 }
 
 
 /**
 /**
@@ -58,7 +58,7 @@ get_patch_chain(Patchfiles &chain, PackageVersion *start_pv,
   for (pi = _from_patches.begin(); pi != _from_patches.end(); ++pi) {
   for (pi = _from_patches.begin(); pi != _from_patches.end(); ++pi) {
     Patchfile *patchfile = (*pi);
     Patchfile *patchfile = (*pi);
     PackageVersion *from_pv = patchfile->_from_pv;
     PackageVersion *from_pv = patchfile->_from_pv;
-    assert(from_pv != NULL);
+    assert(from_pv != nullptr);
     Patchfiles this_chain;
     Patchfiles this_chain;
     if (from_pv->get_patch_chain(this_chain, start_pv, already_visited)) {
     if (from_pv->get_patch_chain(this_chain, start_pv, already_visited)) {
       // There's a path through this patchfile.
       // There's a path through this patchfile.
@@ -129,8 +129,8 @@ output(ostream &out) const {
 P3DPatchFinder::Patchfile::
 P3DPatchFinder::Patchfile::
 Patchfile(Package *package) :
 Patchfile(Package *package) :
   _package(package),
   _package(package),
-  _from_pv(NULL),
-  _to_pv(NULL)
+  _from_pv(nullptr),
+  _to_pv(nullptr)
 {
 {
   _package_name = package->_package_name;
   _package_name = package->_package_name;
   _platform = package->_platform;
   _platform = package->_platform;
@@ -161,30 +161,30 @@ get_target_key() const {
 void P3DPatchFinder::Patchfile::
 void P3DPatchFinder::Patchfile::
 load_xml(TiXmlElement *xpatch) {
 load_xml(TiXmlElement *xpatch) {
   const char *package_name_cstr = xpatch->Attribute("name");
   const char *package_name_cstr = xpatch->Attribute("name");
-  if (package_name_cstr != NULL && *package_name_cstr) {
+  if (package_name_cstr != nullptr && *package_name_cstr) {
     _package_name = package_name_cstr;
     _package_name = package_name_cstr;
   }
   }
   const char *platform_cstr = xpatch->Attribute("platform");
   const char *platform_cstr = xpatch->Attribute("platform");
-  if (platform_cstr != NULL && *platform_cstr) {
+  if (platform_cstr != nullptr && *platform_cstr) {
     _platform = platform_cstr;
     _platform = platform_cstr;
   }
   }
   const char *version_cstr = xpatch->Attribute("version");
   const char *version_cstr = xpatch->Attribute("version");
-  if (version_cstr != NULL && *version_cstr) {
+  if (version_cstr != nullptr && *version_cstr) {
     _version = version_cstr;
     _version = version_cstr;
   }
   }
   const char *host_url_cstr = xpatch->Attribute("host");
   const char *host_url_cstr = xpatch->Attribute("host");
-  if (host_url_cstr != NULL && *host_url_cstr) {
+  if (host_url_cstr != nullptr && *host_url_cstr) {
     _host_url = host_url_cstr;
     _host_url = host_url_cstr;
   }
   }
 
 
   _file.load_xml(xpatch);
   _file.load_xml(xpatch);
 
 
   TiXmlElement *xsource = xpatch->FirstChildElement("source");
   TiXmlElement *xsource = xpatch->FirstChildElement("source");
-  if (xsource != NULL) {
+  if (xsource != nullptr) {
     _source_file.load_xml(xsource);
     _source_file.load_xml(xsource);
   }
   }
   TiXmlElement *xtarget = xpatch->FirstChildElement("target");
   TiXmlElement *xtarget = xpatch->FirstChildElement("target");
-  if (xtarget != NULL) {
+  if (xtarget != nullptr) {
     _target_file.load_xml(xtarget);
     _target_file.load_xml(xtarget);
   }
   }
 }
 }
@@ -194,8 +194,8 @@ load_xml(TiXmlElement *xpatch) {
  */
  */
 P3DPatchFinder::Package::
 P3DPatchFinder::Package::
 Package() {
 Package() {
-  _current_pv = NULL;
-  _base_pv = NULL;
+  _current_pv = nullptr;
+  _base_pv = nullptr;
   _got_base_file = false;
   _got_base_file = false;
 }
 }
 
 
@@ -230,43 +230,43 @@ get_generic_key(const FileSpec &file) const {
 bool P3DPatchFinder::Package::
 bool P3DPatchFinder::Package::
 read_desc_file(TiXmlDocument *doc) {
 read_desc_file(TiXmlDocument *doc) {
   TiXmlElement *xpackage = doc->FirstChildElement("package");
   TiXmlElement *xpackage = doc->FirstChildElement("package");
-  if (xpackage == NULL) {
+  if (xpackage == nullptr) {
     return false;
     return false;
   }
   }
 
 
   const char *package_name_cstr = xpackage->Attribute("name");
   const char *package_name_cstr = xpackage->Attribute("name");
-  if (package_name_cstr != NULL && *package_name_cstr) {
+  if (package_name_cstr != nullptr && *package_name_cstr) {
     _package_name = package_name_cstr;
     _package_name = package_name_cstr;
   }
   }
   const char *platform_cstr = xpackage->Attribute("platform");
   const char *platform_cstr = xpackage->Attribute("platform");
-  if (platform_cstr != NULL && *platform_cstr) {
+  if (platform_cstr != nullptr && *platform_cstr) {
     _platform = platform_cstr;
     _platform = platform_cstr;
   }
   }
   const char *version_cstr = xpackage->Attribute("version");
   const char *version_cstr = xpackage->Attribute("version");
-  if (version_cstr != NULL && *version_cstr) {
+  if (version_cstr != nullptr && *version_cstr) {
     _version = version_cstr;
     _version = version_cstr;
   }
   }
   const char *host_url_cstr = xpackage->Attribute("host");
   const char *host_url_cstr = xpackage->Attribute("host");
-  if (host_url_cstr != NULL && *host_url_cstr) {
+  if (host_url_cstr != nullptr && *host_url_cstr) {
     _host_url = host_url_cstr;
     _host_url = host_url_cstr;
   }
   }
 
 
   // Get the current version.
   // Get the current version.
   TiXmlElement *xarchive = xpackage->FirstChildElement("uncompressed_archive");
   TiXmlElement *xarchive = xpackage->FirstChildElement("uncompressed_archive");
-  if (xarchive != NULL) {
+  if (xarchive != nullptr) {
     _current_file.load_xml(xarchive);
     _current_file.load_xml(xarchive);
   }
   }
 
 
   // Get the base_version--the bottom (oldest) of the patch chain.
   // Get the base_version--the bottom (oldest) of the patch chain.
   xarchive = xpackage->FirstChildElement("base_version");
   xarchive = xpackage->FirstChildElement("base_version");
-  if (xarchive != NULL) {
+  if (xarchive != nullptr) {
     _base_file.load_xml(xarchive);
     _base_file.load_xml(xarchive);
     _got_base_file = true;
     _got_base_file = true;
   }
   }
 
 
   _patches.clear();
   _patches.clear();
   TiXmlElement *xpatch = xpackage->FirstChildElement("patch");
   TiXmlElement *xpatch = xpackage->FirstChildElement("patch");
-  while (xpatch != NULL) {
+  while (xpatch != nullptr) {
     Patchfile *patchfile = new Patchfile(this);
     Patchfile *patchfile = new Patchfile(this);
     patchfile->load_xml(xpatch);
     patchfile->load_xml(xpatch);
     _patches.push_back(patchfile);
     _patches.push_back(patchfile);
@@ -301,7 +301,7 @@ get_patch_chain_to_current(Patchfiles &chain, TiXmlDocument *doc,
                            const FileSpec &file) {
                            const FileSpec &file) {
   chain.clear();
   chain.clear();
   Package *package = read_package_desc_file(doc);
   Package *package = read_package_desc_file(doc);
-  if (package == NULL) {
+  if (package == nullptr) {
     return false;
     return false;
   }
   }
 
 
@@ -309,7 +309,7 @@ get_patch_chain_to_current(Patchfiles &chain, TiXmlDocument *doc,
   PackageVersion *from_pv = get_package_version(package->get_generic_key(file));
   PackageVersion *from_pv = get_package_version(package->get_generic_key(file));
   PackageVersion *to_pv = package->_current_pv;
   PackageVersion *to_pv = package->_current_pv;
 
 
-  if (to_pv != NULL && from_pv != NULL) {
+  if (to_pv != nullptr && from_pv != nullptr) {
     return to_pv->get_patch_chain(chain, from_pv, PackageVersionsList());
     return to_pv->get_patch_chain(chain, from_pv, PackageVersionsList());
   }
   }
 
 
@@ -326,7 +326,7 @@ read_package_desc_file(TiXmlDocument *doc) {
   Package *package = new Package;
   Package *package = new Package;
   if (!package->read_desc_file(doc)) {
   if (!package->read_desc_file(doc)) {
     delete package;
     delete package;
-    return NULL;
+    return nullptr;
   }
   }
 
 
   _packages.push_back(package);
   _packages.push_back(package);

+ 9 - 9
direct/src/plugin/p3dPythonMain.cxx

@@ -94,10 +94,10 @@ WinMain(HINSTANCE, HINSTANCE, LPSTR, int) {
 int
 int
 main(int argc, char *argv[]) {
 main(int argc, char *argv[]) {
   const char *program_name = argv[0];
   const char *program_name = argv[0];
-  const char *archive_file = NULL;
-  const char *input_handle_str = NULL;
-  const char *output_handle_str = NULL;
-  const char *interactive_console_str = NULL;
+  const char *archive_file = nullptr;
+  const char *input_handle_str = nullptr;
+  const char *output_handle_str = nullptr;
+  const char *interactive_console_str = nullptr;
 
 
   if (argc > 1) {
   if (argc > 1) {
     archive_file = argv[1];
     archive_file = argv[1];
@@ -112,13 +112,13 @@ main(int argc, char *argv[]) {
     interactive_console_str = argv[4];
     interactive_console_str = argv[4];
   }
   }
 
 
-  if (archive_file == NULL || *archive_file == '\0') {
+  if (archive_file == nullptr || *archive_file == '\0') {
     cerr << "No archive filename specified on command line.\n";
     cerr << "No archive filename specified on command line.\n";
     return 1;
     return 1;
   }
   }
 
 
   FHandle input_handle = invalid_fhandle;
   FHandle input_handle = invalid_fhandle;
-  if (input_handle_str != NULL && *input_handle_str) {
+  if (input_handle_str != nullptr && *input_handle_str) {
     stringstream stream(input_handle_str);
     stringstream stream(input_handle_str);
     stream >> input_handle;
     stream >> input_handle;
     if (!stream) {
     if (!stream) {
@@ -127,7 +127,7 @@ main(int argc, char *argv[]) {
   }
   }
 
 
   FHandle output_handle = invalid_fhandle;
   FHandle output_handle = invalid_fhandle;
-  if (output_handle_str != NULL && *output_handle_str) {
+  if (output_handle_str != nullptr && *output_handle_str) {
     stringstream stream(output_handle_str);
     stringstream stream(output_handle_str);
     stream >> output_handle;
     stream >> output_handle;
     if (!stream) {
     if (!stream) {
@@ -136,7 +136,7 @@ main(int argc, char *argv[]) {
   }
   }
 
 
   bool interactive_console = false;
   bool interactive_console = false;
-  if (interactive_console_str != NULL && *interactive_console_str) {
+  if (interactive_console_str != nullptr && *interactive_console_str) {
     stringstream stream(interactive_console_str);
     stringstream stream(interactive_console_str);
     int flag;
     int flag;
     stream >> flag;
     stream >> flag;
@@ -146,7 +146,7 @@ main(int argc, char *argv[]) {
   }
   }
 
 
   int status = run_p3dpython(program_name, archive_file, input_handle,
   int status = run_p3dpython(program_name, archive_file, input_handle,
-                             output_handle, NULL, interactive_console);
+                             output_handle, nullptr, interactive_console);
   if (status != 0) {
   if (status != 0) {
     cerr << "Failure on startup.\n";
     cerr << "Failure on startup.\n";
   }
   }

+ 21 - 21
direct/src/plugin/p3dPythonObject.cxx

@@ -51,8 +51,8 @@ bool P3DPythonObject::
 get_bool() {
 get_bool() {
   bool bresult = 0;
   bool bresult = 0;
 
 
-  P3D_object *result = call("__bool__", true, NULL, 0);
-  if (result != NULL) {
+  P3D_object *result = call("__bool__", true, nullptr, 0);
+  if (result != nullptr) {
     bresult = P3D_OBJECT_GET_BOOL(result);
     bresult = P3D_OBJECT_GET_BOOL(result);
     P3D_OBJECT_DECREF(result);
     P3D_OBJECT_DECREF(result);
   }
   }
@@ -67,8 +67,8 @@ int P3DPythonObject::
 get_int() {
 get_int() {
   int iresult = 0;
   int iresult = 0;
 
 
-  P3D_object *result = call("__int__", true, NULL, 0);
-  if (result != NULL) {
+  P3D_object *result = call("__int__", true, nullptr, 0);
+  if (result != nullptr) {
     iresult = P3D_OBJECT_GET_INT(result);
     iresult = P3D_OBJECT_GET_INT(result);
     P3D_OBJECT_DECREF(result);
     P3D_OBJECT_DECREF(result);
   }
   }
@@ -83,8 +83,8 @@ double P3DPythonObject::
 get_float() {
 get_float() {
   double fresult = 0.0;
   double fresult = 0.0;
 
 
-  P3D_object *result = call("__float__", true, NULL, 0);
-  if (result != NULL) {
+  P3D_object *result = call("__float__", true, nullptr, 0);
+  if (result != nullptr) {
     fresult = P3D_OBJECT_GET_FLOAT(result);
     fresult = P3D_OBJECT_GET_FLOAT(result);
     P3D_OBJECT_DECREF(result);
     P3D_OBJECT_DECREF(result);
   }
   }
@@ -98,9 +98,9 @@ get_float() {
  */
  */
 void P3DPythonObject::
 void P3DPythonObject::
 make_string(string &value) {
 make_string(string &value) {
-  P3D_object *result = call("__str__", true, NULL, 0);
-  if (result != NULL) {
-    int size = P3D_OBJECT_GET_STRING(result, NULL, 0);
+  P3D_object *result = call("__str__", true, nullptr, 0);
+  if (result != nullptr) {
+    int size = P3D_OBJECT_GET_STRING(result, nullptr, 0);
     char *buffer = new char[size];
     char *buffer = new char[size];
     P3D_OBJECT_GET_STRING(result, buffer, size);
     P3D_OBJECT_GET_STRING(result, buffer, size);
     value = string(buffer, size);
     value = string(buffer, size);
@@ -150,9 +150,9 @@ set_property_insecure(const string &property, bool needs_response,
   P3D_object *params[2];
   P3D_object *params[2];
   params[0] = new P3DStringObject(property);
   params[0] = new P3DStringObject(property);
 
 
-  P3D_object *result = NULL;
+  P3D_object *result = nullptr;
 
 
-  if (value == NULL) {
+  if (value == nullptr) {
     // Delete an attribute.
     // Delete an attribute.
     result = call_insecure("__del_property__", needs_response, params, 1);
     result = call_insecure("__del_property__", needs_response, params, 1);
 
 
@@ -164,7 +164,7 @@ set_property_insecure(const string &property, bool needs_response,
 
 
   P3D_OBJECT_DECREF(params[0]);
   P3D_OBJECT_DECREF(params[0]);
 
 
-  if (result != NULL) {
+  if (result != nullptr) {
     bresult = P3D_OBJECT_GET_BOOL(result);
     bresult = P3D_OBJECT_GET_BOOL(result);
     P3D_OBJECT_DECREF(result);
     P3D_OBJECT_DECREF(result);
   }
   }
@@ -193,7 +193,7 @@ has_method(const string &method_name) {
   P3D_object *result = call("__has_method__", true, params, 1);
   P3D_object *result = call("__has_method__", true, params, 1);
   P3D_OBJECT_DECREF(params[0]);
   P3D_OBJECT_DECREF(params[0]);
 
 
-  if (result != NULL) {
+  if (result != nullptr) {
     bresult = P3D_OBJECT_GET_BOOL(result);
     bresult = P3D_OBJECT_GET_BOOL(result);
     P3D_OBJECT_DECREF(result);
     P3D_OBJECT_DECREF(result);
   }
   }
@@ -219,7 +219,7 @@ call(const string &method_name, bool needs_response,
      P3D_object *params[], int num_params) {
      P3D_object *params[], int num_params) {
   if (!_session->get_matches_script_origin()) {
   if (!_session->get_matches_script_origin()) {
     // If you can't be scripting us, you can't be calling methods.
     // If you can't be scripting us, you can't be calling methods.
-    return NULL;
+    return nullptr;
   }
   }
 
 
   return call_insecure(method_name, needs_response, params, num_params);
   return call_insecure(method_name, needs_response, params, num_params);
@@ -255,18 +255,18 @@ call_insecure(const string &method_name, bool needs_response,
   // NULL.
   // NULL.
   if (!needs_response) {
   if (!needs_response) {
     _session->send_command(doc);
     _session->send_command(doc);
-    return NULL;
+    return nullptr;
   }
   }
 
 
   // If a response is requested, we have to send the command and wait for it.
   // If a response is requested, we have to send the command and wait for it.
   TiXmlDocument *response = _session->command_and_response(doc);
   TiXmlDocument *response = _session->command_and_response(doc);
 
 
-  P3D_object *result = NULL;
-  if (response != NULL) {
+  P3D_object *result = nullptr;
+  if (response != nullptr) {
     TiXmlElement *xresponse = response->FirstChildElement("response");
     TiXmlElement *xresponse = response->FirstChildElement("response");
-    if (xresponse != NULL) {
+    if (xresponse != nullptr) {
       TiXmlElement *xvalue = xresponse->FirstChildElement("value");
       TiXmlElement *xvalue = xresponse->FirstChildElement("value");
-      if (xvalue != NULL) {
+      if (xvalue != nullptr) {
         result = _session->xml_to_p3dobj(xvalue);
         result = _session->xml_to_p3dobj(xvalue);
       }
       }
     }
     }
@@ -282,9 +282,9 @@ call_insecure(const string &method_name, bool needs_response,
  */
  */
 void P3DPythonObject::
 void P3DPythonObject::
 output(ostream &out) {
 output(ostream &out) {
-  P3D_object *result = call("__repr__", true, NULL, 0);
+  P3D_object *result = call("__repr__", true, nullptr, 0);
   out << "Python " << _object_id;
   out << "Python " << _object_id;
-  if (result != NULL) {
+  if (result != nullptr) {
     out << ": " << *result;
     out << ": " << *result;
     P3D_OBJECT_DECREF(result);
     P3D_OBJECT_DECREF(result);
   }
   }

+ 123 - 123
direct/src/plugin/p3dPythonRun.cxx

@@ -28,7 +28,7 @@ extern "C" {
 // There is only one P3DPythonRun object in any given process space.  Makes
 // There is only one P3DPythonRun object in any given process space.  Makes
 // the statics easier to deal with, and we don't need multiple instances of
 // the statics easier to deal with, and we don't need multiple instances of
 // this thing.
 // this thing.
-P3DPythonRun *P3DPythonRun::_global_ptr = NULL;
+P3DPythonRun *P3DPythonRun::_global_ptr = nullptr;
 
 
 TypeHandle P3DPythonRun::P3DWindowHandle::_type_handle;
 TypeHandle P3DPythonRun::P3DWindowHandle::_type_handle;
 
 
@@ -45,7 +45,7 @@ P3DPythonRun(const char *program_name, const char *archive_file,
   _read_thread_continue = false;
   _read_thread_continue = false;
   _program_continue = true;
   _program_continue = true;
   _session_terminated = false;
   _session_terminated = false;
-  _taskMgr = NULL;
+  _taskMgr = nullptr;
 
 
   INIT_LOCK(_commands_lock);
   INIT_LOCK(_commands_lock);
   INIT_THREAD(_read_thread);
   INIT_THREAD(_read_thread);
@@ -55,7 +55,7 @@ P3DPythonRun(const char *program_name, const char *archive_file,
 
 
   _interactive_console = interactive_console;
   _interactive_console = interactive_console;
 
 
-  if (program_name != NULL) {
+  if (program_name != nullptr) {
 #if PY_MAJOR_VERSION >= 3
 #if PY_MAJOR_VERSION >= 3
     // Python 3 case: we have to convert it to a wstring.
     // Python 3 case: we have to convert it to a wstring.
     TextEncoder enc;
     TextEncoder enc;
@@ -66,7 +66,7 @@ P3DPythonRun(const char *program_name, const char *archive_file,
     _program_name = program_name;
     _program_name = program_name;
 #endif
 #endif
   }
   }
-  if (archive_file != NULL) {
+  if (archive_file != nullptr) {
     _archive_file = Filename::from_os_specific(archive_file);
     _archive_file = Filename::from_os_specific(archive_file);
   }
   }
 
 
@@ -76,7 +76,7 @@ P3DPythonRun(const char *program_name, const char *archive_file,
 #else
 #else
   _py_argv[0] = (char *)_program_name.c_str();
   _py_argv[0] = (char *)_program_name.c_str();
 #endif
 #endif
-  _py_argv[1] = NULL;
+  _py_argv[1] = nullptr;
 
 
 #ifdef NDEBUG
 #ifdef NDEBUG
   // In OPTIMIZE 4 compilation mode, run Python in optimized mode too.
   // In OPTIMIZE 4 compilation mode, run Python in optimized mode too.
@@ -113,7 +113,7 @@ P3DPythonRun(const char *program_name, const char *archive_file,
   PySys_SetArgvEx(_py_argc, _py_argv, 0);
   PySys_SetArgvEx(_py_argc, _py_argv, 0);
 
 
   // Open the error output before we do too much more.
   // Open the error output before we do too much more.
-  if (log_pathname != NULL && *log_pathname != '\0') {
+  if (log_pathname != nullptr && *log_pathname != '\0') {
     Filename f = Filename::from_os_specific(log_pathname);
     Filename f = Filename::from_os_specific(log_pathname);
     f.set_text();
     f.set_text();
     if (f.open_write(_error_log)) {
     if (f.open_write(_error_log)) {
@@ -178,7 +178,7 @@ run_python() {
   // We could simply freeze it, but Python has a bug setting __path__ of
   // We could simply freeze it, but Python has a bug setting __path__ of
   // frozen modules properly.
   // frozen modules properly.
   PyObject *panda3d_module = PyImport_AddModule("panda3d");
   PyObject *panda3d_module = PyImport_AddModule("panda3d");
-  if (panda3d_module == NULL) {
+  if (panda3d_module == nullptr) {
     nout << "Failed to add panda3d module:\n";
     nout << "Failed to add panda3d module:\n";
     PyErr_Print();
     PyErr_Print();
     return 1;
     return 1;
@@ -192,7 +192,7 @@ run_python() {
 
 
   // Import the VFSImporter module that was frozen in.
   // Import the VFSImporter module that was frozen in.
   PyObject *vfsimporter_module = PyImport_ImportModule("direct.showbase.VFSImporter");
   PyObject *vfsimporter_module = PyImport_ImportModule("direct.showbase.VFSImporter");
-  if (vfsimporter_module == NULL) {
+  if (vfsimporter_module == nullptr) {
     nout << "Failed to import VFSImporter:\n";
     nout << "Failed to import VFSImporter:\n";
     PyErr_Print();
     PyErr_Print();
     return 1;
     return 1;
@@ -203,14 +203,14 @@ run_python() {
   // such that we can still find the other direct modules.
   // such that we can still find the other direct modules.
   Filename direct_dir(dir, "direct");
   Filename direct_dir(dir, "direct");
   PyObject *direct_module = PyImport_AddModule("direct");
   PyObject *direct_module = PyImport_AddModule("direct");
-  if (direct_module != NULL) {
+  if (direct_module != nullptr) {
     dir_str = direct_dir.to_os_specific();
     dir_str = direct_dir.to_os_specific();
     PyModule_AddObject(direct_module, "__path__", Py_BuildValue("[s#]", dir_str.data(), dir_str.length()));
     PyModule_AddObject(direct_module, "__path__", Py_BuildValue("[s#]", dir_str.data(), dir_str.length()));
     PyModule_AddStringConstant(direct_module, "__package__", "direct");
     PyModule_AddStringConstant(direct_module, "__package__", "direct");
   }
   }
 
 
   PyObject *showbase_module = PyImport_AddModule("direct.showbase");
   PyObject *showbase_module = PyImport_AddModule("direct.showbase");
-  if (showbase_module != NULL) {
+  if (showbase_module != nullptr) {
     Filename showbase_dir(direct_dir, "showbase");
     Filename showbase_dir(direct_dir, "showbase");
     dir_str = showbase_dir.to_os_specific();
     dir_str = showbase_dir.to_os_specific();
     PyModule_AddObject(showbase_module, "__path__", Py_BuildValue("[s#]", dir_str.data(), dir_str.length()));
     PyModule_AddObject(showbase_module, "__path__", Py_BuildValue("[s#]", dir_str.data(), dir_str.length()));
@@ -218,7 +218,7 @@ run_python() {
   }
   }
 
 
   PyObject *stdpy_module = PyImport_AddModule("direct.stdpy");
   PyObject *stdpy_module = PyImport_AddModule("direct.stdpy");
-  if (stdpy_module != NULL) {
+  if (stdpy_module != nullptr) {
     Filename stdpy_dir(direct_dir, "stdpy");
     Filename stdpy_dir(direct_dir, "stdpy");
     dir_str = stdpy_dir.to_os_specific();
     dir_str = stdpy_dir.to_os_specific();
     PyModule_AddObject(stdpy_module, "__path__", Py_BuildValue("[s#]", dir_str.data(), dir_str.length()));
     PyModule_AddObject(stdpy_module, "__path__", Py_BuildValue("[s#]", dir_str.data(), dir_str.length()));
@@ -229,7 +229,7 @@ run_python() {
   // bunch of encodings modules as part of the frozen bundle.
   // bunch of encodings modules as part of the frozen bundle.
   Filename encodings_dir(dir, "encodings");
   Filename encodings_dir(dir, "encodings");
   PyObject *encodings_module = PyImport_AddModule("encodings");
   PyObject *encodings_module = PyImport_AddModule("encodings");
-  if (encodings_module != NULL) {
+  if (encodings_module != nullptr) {
     dir_str = encodings_dir.to_os_specific();
     dir_str = encodings_dir.to_os_specific();
     PyModule_AddObject(encodings_module, "__path__", Py_BuildValue("[s#]", dir_str.data(), dir_str.length()));
     PyModule_AddObject(encodings_module, "__path__", Py_BuildValue("[s#]", dir_str.data(), dir_str.length()));
     PyModule_AddStringConstant(encodings_module, "__package__", "encodings");
     PyModule_AddStringConstant(encodings_module, "__package__", "encodings");
@@ -237,7 +237,7 @@ run_python() {
 
 
   // And register the VFSImporter.
   // And register the VFSImporter.
   PyObject *result = PyObject_CallMethod(vfsimporter_module, (char *)"register", (char *)"");
   PyObject *result = PyObject_CallMethod(vfsimporter_module, (char *)"register", (char *)"");
-  if (result == NULL) {
+  if (result == nullptr) {
     nout << "Failed to call VFSImporter.register():\n";
     nout << "Failed to call VFSImporter.register():\n";
     PyErr_Print();
     PyErr_Print();
     return 1;
     return 1;
@@ -261,7 +261,7 @@ run_python() {
 
 
   // And finally, we can import the startup module.
   // And finally, we can import the startup module.
   PyObject *app_runner_module = PyImport_ImportModule("direct.p3d.AppRunner");
   PyObject *app_runner_module = PyImport_ImportModule("direct.p3d.AppRunner");
-  if (app_runner_module == NULL) {
+  if (app_runner_module == nullptr) {
     nout << "Failed to import direct.p3d.AppRunner\n";
     nout << "Failed to import direct.p3d.AppRunner\n";
     PyErr_Print();
     PyErr_Print();
     return 1;
     return 1;
@@ -269,7 +269,7 @@ run_python() {
 
 
   // Get the pointers to the objects needed within the module.
   // Get the pointers to the objects needed within the module.
   PyObject *app_runner_class = PyObject_GetAttrString(app_runner_module, "AppRunner");
   PyObject *app_runner_class = PyObject_GetAttrString(app_runner_module, "AppRunner");
-  if (app_runner_class == NULL) {
+  if (app_runner_class == nullptr) {
     nout << "Failed to get AppRunner class\n";
     nout << "Failed to get AppRunner class\n";
     PyErr_Print();
     PyErr_Print();
     return 1;
     return 1;
@@ -277,7 +277,7 @@ run_python() {
 
 
   // Construct an instance of AppRunner.
   // Construct an instance of AppRunner.
   _runner = PyObject_CallFunction(app_runner_class, (char *)"");
   _runner = PyObject_CallFunction(app_runner_class, (char *)"");
-  if (_runner == NULL) {
+  if (_runner == nullptr) {
     nout << "Failed to construct AppRunner instance\n";
     nout << "Failed to construct AppRunner instance\n";
     PyErr_Print();
     PyErr_Print();
     return 1;
     return 1;
@@ -286,7 +286,7 @@ run_python() {
 
 
   // Import the JavaScript module.
   // Import the JavaScript module.
   PyObject *javascript_module = PyImport_ImportModule("direct.p3d.JavaScript");
   PyObject *javascript_module = PyImport_ImportModule("direct.p3d.JavaScript");
-  if (javascript_module == NULL) {
+  if (javascript_module == nullptr) {
     nout << "Failed to import direct.p3d.JavaScript\n";
     nout << "Failed to import direct.p3d.JavaScript\n";
     PyErr_Print();
     PyErr_Print();
     return false;
     return false;
@@ -294,35 +294,35 @@ run_python() {
 
 
   // Get the UndefinedObject class.
   // Get the UndefinedObject class.
   _undefined_object_class = PyObject_GetAttrString(javascript_module, "UndefinedObject");
   _undefined_object_class = PyObject_GetAttrString(javascript_module, "UndefinedObject");
-  if (_undefined_object_class == NULL) {
+  if (_undefined_object_class == nullptr) {
     PyErr_Print();
     PyErr_Print();
     return 1;
     return 1;
   }
   }
 
 
   // And the "Undefined" instance.
   // And the "Undefined" instance.
   _undefined = PyObject_GetAttrString(javascript_module, "Undefined");
   _undefined = PyObject_GetAttrString(javascript_module, "Undefined");
-  if (_undefined == NULL) {
+  if (_undefined == nullptr) {
     PyErr_Print();
     PyErr_Print();
     return 1;
     return 1;
   }
   }
 
 
   // Get the ConcreteStruct class.
   // Get the ConcreteStruct class.
   _concrete_struct_class = PyObject_GetAttrString(javascript_module, "ConcreteStruct");
   _concrete_struct_class = PyObject_GetAttrString(javascript_module, "ConcreteStruct");
-  if (_concrete_struct_class == NULL) {
+  if (_concrete_struct_class == nullptr) {
     PyErr_Print();
     PyErr_Print();
     return 1;
     return 1;
   }
   }
 
 
   // Get the BrowserObject class.
   // Get the BrowserObject class.
   _browser_object_class = PyObject_GetAttrString(javascript_module, "BrowserObject");
   _browser_object_class = PyObject_GetAttrString(javascript_module, "BrowserObject");
-  if (_browser_object_class == NULL) {
+  if (_browser_object_class == nullptr) {
     PyErr_Print();
     PyErr_Print();
     return 1;
     return 1;
   }
   }
 
 
   // Get the global TaskManager.
   // Get the global TaskManager.
   _taskMgr = PyObject_GetAttrString(app_runner_module, "taskMgr");
   _taskMgr = PyObject_GetAttrString(app_runner_module, "taskMgr");
-  if (_taskMgr == NULL) {
+  if (_taskMgr == nullptr) {
     PyErr_Print();
     PyErr_Print();
     return 1;
     return 1;
   }
   }
@@ -337,28 +337,28 @@ run_python() {
       "Poll for communications from the parent process" },
       "Poll for communications from the parent process" },
     { "request_func", P3DPythonRun::st_request_func, METH_VARARGS,
     { "request_func", P3DPythonRun::st_request_func, METH_VARARGS,
       "Send an asynchronous request to the plugin host" },
       "Send an asynchronous request to the plugin host" },
-    { NULL, NULL, 0, NULL }        /* Sentinel */
+    { nullptr, nullptr, 0, nullptr }        /* Sentinel */
   };
   };
 
 
 #if PY_MAJOR_VERSION >= 3
 #if PY_MAJOR_VERSION >= 3
   static PyModuleDef p3dpython_module = {
   static PyModuleDef p3dpython_module = {
     PyModuleDef_HEAD_INIT,
     PyModuleDef_HEAD_INIT,
     "p3dpython",
     "p3dpython",
-    NULL,
+    nullptr,
     -1,
     -1,
     p3dpython_methods,
     p3dpython_methods,
-    NULL, NULL, NULL, NULL
+    nullptr, nullptr, nullptr, nullptr
   };
   };
   PyObject *p3dpython = PyModule_Create(&p3dpython_module);
   PyObject *p3dpython = PyModule_Create(&p3dpython_module);
 #else
 #else
   PyObject *p3dpython = Py_InitModule("p3dpython", p3dpython_methods);
   PyObject *p3dpython = Py_InitModule("p3dpython", p3dpython_methods);
 #endif
 #endif
-  if (p3dpython == NULL) {
+  if (p3dpython == nullptr) {
     PyErr_Print();
     PyErr_Print();
     return 1;
     return 1;
   }
   }
   PyObject *request_func = PyObject_GetAttrString(p3dpython, "request_func");
   PyObject *request_func = PyObject_GetAttrString(p3dpython, "request_func");
-  if (request_func == NULL) {
+  if (request_func == nullptr) {
     PyErr_Print();
     PyErr_Print();
     return 1;
     return 1;
   }
   }
@@ -366,7 +366,7 @@ run_python() {
   // Now pass that func pointer back to our AppRunner instance, so it can call
   // Now pass that func pointer back to our AppRunner instance, so it can call
   // up to us.
   // up to us.
   result = PyObject_CallMethod(_runner, (char *)"setRequestFunc", (char *)"N", request_func);
   result = PyObject_CallMethod(_runner, (char *)"setRequestFunc", (char *)"N", request_func);
-  if (result == NULL) {
+  if (result == nullptr) {
     PyErr_Print();
     PyErr_Print();
     return 1;
     return 1;
   }
   }
@@ -384,7 +384,7 @@ run_python() {
   chain->set_thread_priority(TP_low);
   chain->set_thread_priority(TP_low);
 
 
   PyObject *check_comm = PyObject_GetAttrString(p3dpython, "check_comm");
   PyObject *check_comm = PyObject_GetAttrString(p3dpython, "check_comm");
-  if (check_comm == NULL) {
+  if (check_comm == nullptr) {
     PyErr_Print();
     PyErr_Print();
     return 1;
     return 1;
   }
   }
@@ -392,7 +392,7 @@ run_python() {
   // Add it to the task manager.  We do this instead of constructing a
   // Add it to the task manager.  We do this instead of constructing a
   // PythonTask because linking p3dpython with core.pyd is problematic.
   // PythonTask because linking p3dpython with core.pyd is problematic.
   result = PyObject_CallMethod(_taskMgr, (char *)"add", (char *)"Ns", check_comm, "check_comm");
   result = PyObject_CallMethod(_taskMgr, (char *)"add", (char *)"Ns", check_comm, "check_comm");
-  if (result == NULL) {
+  if (result == nullptr) {
     PyErr_Print();
     PyErr_Print();
     return 1;
     return 1;
   }
   }
@@ -401,7 +401,7 @@ run_python() {
   // Finally, get lost in AppRunner.run() (which is really a call to
   // Finally, get lost in AppRunner.run() (which is really a call to
   // taskMgr.run()).
   // taskMgr.run()).
   PyObject *done = PyObject_CallMethod(_runner, (char *)"run", (char *)"");
   PyObject *done = PyObject_CallMethod(_runner, (char *)"run", (char *)"");
-  if (done == NULL) {
+  if (done == nullptr) {
     int status = 1;
     int status = 1;
 
 
     // An uncaught application exception, and not handled by
     // An uncaught application exception, and not handled by
@@ -409,10 +409,10 @@ run_python() {
     // status that we should return.
     // status that we should return.
     if (PyErr_ExceptionMatches(PyExc_SystemExit)) {
     if (PyErr_ExceptionMatches(PyExc_SystemExit)) {
       PyObject *ptype, *ptraceback;
       PyObject *ptype, *ptraceback;
-      PyObject *value = NULL;
+      PyObject *value = nullptr;
       PyErr_Fetch(&ptype, &value, &ptraceback);
       PyErr_Fetch(&ptype, &value, &ptraceback);
 
 
-      if (value != NULL && PyExceptionInstance_Check(value)) {
+      if (value != nullptr && PyExceptionInstance_Check(value)) {
         PyObject *code = PyObject_GetAttrString(value, "code");
         PyObject *code = PyObject_GetAttrString(value, "code");
         if (code) {
         if (code) {
           Py_DECREF(value);
           Py_DECREF(value);
@@ -420,7 +420,7 @@ run_python() {
         }
         }
       }
       }
 
 
-      if (value == NULL || value == Py_None) {
+      if (value == nullptr || value == Py_None) {
         status = 0;
         status = 0;
 #if PY_MAJOR_VERSION >= 3
 #if PY_MAJOR_VERSION >= 3
       } else if (PyLong_Check(value)) {
       } else if (PyLong_Check(value)) {
@@ -510,13 +510,13 @@ void P3DPythonRun::
 run_interactive_console() {
 run_interactive_console() {
 #ifdef _WIN32
 #ifdef _WIN32
   // Make sure that control-C support is enabled for the interpreter.
   // Make sure that control-C support is enabled for the interpreter.
-  SetConsoleCtrlHandler(NULL, false);
+  SetConsoleCtrlHandler(nullptr, false);
 #endif
 #endif
 
 
   // The "readline" module makes the Python prompt friendlier, with command
   // The "readline" module makes the Python prompt friendlier, with command
   // history and everything.  Simply importing it is sufficient.
   // history and everything.  Simply importing it is sufficient.
   PyObject *readline_module = PyImport_ImportModule("readline");
   PyObject *readline_module = PyImport_ImportModule("readline");
-  if (readline_module == NULL) {
+  if (readline_module == nullptr) {
     // But, the module might not exist on certain platforms.  If not, no
     // But, the module might not exist on certain platforms.  If not, no
     // sweat.
     // sweat.
     PyErr_Clear();
     PyErr_Clear();
@@ -536,7 +536,7 @@ run_interactive_console() {
 void P3DPythonRun::
 void P3DPythonRun::
 handle_command(TiXmlDocument *doc) {
 handle_command(TiXmlDocument *doc) {
   TiXmlElement *xcommand = doc->FirstChildElement("command");
   TiXmlElement *xcommand = doc->FirstChildElement("command");
-  if (xcommand != NULL) {
+  if (xcommand != nullptr) {
     bool needs_response = false;
     bool needs_response = false;
     int want_response_id;
     int want_response_id;
     if (xcommand->QueryIntAttribute("want_response_id", &want_response_id) == TIXML_SUCCESS) {
     if (xcommand->QueryIntAttribute("want_response_id", &want_response_id) == TIXML_SUCCESS) {
@@ -545,7 +545,7 @@ handle_command(TiXmlDocument *doc) {
     }
     }
 
 
     const char *cmd = xcommand->Attribute("cmd");
     const char *cmd = xcommand->Attribute("cmd");
-    if (cmd != NULL) {
+    if (cmd != nullptr) {
       if (strcmp(cmd, "init") == 0) {
       if (strcmp(cmd, "init") == 0) {
         assert(!needs_response);
         assert(!needs_response);
 
 
@@ -565,7 +565,7 @@ handle_command(TiXmlDocument *doc) {
       } else if (strcmp(cmd, "start_instance") == 0) {
       } else if (strcmp(cmd, "start_instance") == 0) {
         assert(!needs_response);
         assert(!needs_response);
         TiXmlElement *xinstance = xcommand->FirstChildElement("instance");
         TiXmlElement *xinstance = xcommand->FirstChildElement("instance");
-        if (xinstance != (TiXmlElement *)NULL) {
+        if (xinstance != nullptr) {
           P3DCInstance *inst = new P3DCInstance(xinstance);
           P3DCInstance *inst = new P3DCInstance(xinstance);
           start_instance(inst, xinstance);
           start_instance(inst, xinstance);
         }
         }
@@ -581,7 +581,7 @@ handle_command(TiXmlDocument *doc) {
         assert(!needs_response);
         assert(!needs_response);
         int instance_id;
         int instance_id;
         TiXmlElement *xwparams = xcommand->FirstChildElement("wparams");
         TiXmlElement *xwparams = xcommand->FirstChildElement("wparams");
-        if (xwparams != (TiXmlElement *)NULL &&
+        if (xwparams != nullptr &&
             xcommand->QueryIntAttribute("instance_id", &instance_id) == TIXML_SUCCESS) {
             xcommand->QueryIntAttribute("instance_id", &instance_id) == TIXML_SUCCESS) {
           setup_window(instance_id, xwparams);
           setup_window(instance_id, xwparams);
         }
         }
@@ -657,11 +657,11 @@ handle_pyobj_command(TiXmlElement *xcommand, bool needs_response,
   doc.LinkEndChild(xresponse);
   doc.LinkEndChild(xresponse);
 
 
   const char *op = xcommand->Attribute("op");
   const char *op = xcommand->Attribute("op");
-  if (op != NULL && !PyErr_Occurred()) {
+  if (op != nullptr && !PyErr_Occurred()) {
     if (strcmp(op, "get_panda_script_object") == 0) {
     if (strcmp(op, "get_panda_script_object") == 0) {
       // Get Panda's toplevel Python object.
       // Get Panda's toplevel Python object.
       PyObject *obj = PyObject_CallMethod(_runner, (char*)"getPandaScriptObject", (char *)"");
       PyObject *obj = PyObject_CallMethod(_runner, (char*)"getPandaScriptObject", (char *)"");
-      if (obj != NULL) {
+      if (obj != nullptr) {
         xresponse->LinkEndChild(pyobj_to_xml(obj));
         xresponse->LinkEndChild(pyobj_to_xml(obj));
         Py_DECREF(obj);
         Py_DECREF(obj);
       }
       }
@@ -670,7 +670,7 @@ handle_pyobj_command(TiXmlElement *xcommand, bool needs_response,
       // Set the Browser's toplevel window object.
       // Set the Browser's toplevel window object.
       PyObject *obj;
       PyObject *obj;
       TiXmlElement *xvalue = xcommand->FirstChildElement("value");
       TiXmlElement *xvalue = xcommand->FirstChildElement("value");
-      if (xvalue != NULL) {
+      if (xvalue != nullptr) {
         obj = xml_to_pyobj(xvalue);
         obj = xml_to_pyobj(xvalue);
       } else {
       } else {
         obj = Py_None;
         obj = Py_None;
@@ -684,7 +684,7 @@ handle_pyobj_command(TiXmlElement *xcommand, bool needs_response,
       // Call the named method on the indicated object, or the object itself
       // Call the named method on the indicated object, or the object itself
       // if method_name isn't given.
       // if method_name isn't given.
       TiXmlElement *xobject = xcommand->FirstChildElement("object");
       TiXmlElement *xobject = xcommand->FirstChildElement("object");
-      if (xobject != NULL) {
+      if (xobject != nullptr) {
         PyObject *obj = xml_to_pyobj(xobject);
         PyObject *obj = xml_to_pyobj(xobject);
 
 
         const char *method_name = xcommand->Attribute("method_name");
         const char *method_name = xcommand->Attribute("method_name");
@@ -693,7 +693,7 @@ handle_pyobj_command(TiXmlElement *xcommand, bool needs_response,
         PyObject *list = PyList_New(0);
         PyObject *list = PyList_New(0);
 
 
         TiXmlElement *xchild = xcommand->FirstChildElement("value");
         TiXmlElement *xchild = xcommand->FirstChildElement("value");
-        while (xchild != NULL) {
+        while (xchild != nullptr) {
           PyObject *child = xml_to_pyobj(xchild);
           PyObject *child = xml_to_pyobj(xchild);
           PyList_Append(list, child);
           PyList_Append(list, child);
           Py_DECREF(child);
           Py_DECREF(child);
@@ -705,8 +705,8 @@ handle_pyobj_command(TiXmlElement *xcommand, bool needs_response,
         Py_DECREF(list);
         Py_DECREF(list);
 
 
         // Now call the method.
         // Now call the method.
-        PyObject *result = NULL;
-        if (method_name == NULL) {
+        PyObject *result = nullptr;
+        if (method_name == nullptr) {
           // No method name; call the object directly.
           // No method name; call the object directly.
           result = PyObject_CallObject(obj, params);
           result = PyObject_CallObject(obj, params);
 
 
@@ -811,7 +811,7 @@ handle_pyobj_command(TiXmlElement *xcommand, bool needs_response,
 
 
             if (PyObject_HasAttrString(obj, property_name)) {
             if (PyObject_HasAttrString(obj, property_name)) {
               result = PyObject_GetAttrString(obj, property_name);
               result = PyObject_GetAttrString(obj, property_name);
-              if (result != NULL) {
+              if (result != nullptr) {
                 success = true;
                 success = true;
               } else {
               } else {
                 PyErr_Clear();
                 PyErr_Clear();
@@ -821,7 +821,7 @@ handle_pyobj_command(TiXmlElement *xcommand, bool needs_response,
             if (!success) {
             if (!success) {
               if (PyMapping_HasKeyString(obj, property_name)) {
               if (PyMapping_HasKeyString(obj, property_name)) {
                 result = PyMapping_GetItemString(obj, property_name);
                 result = PyMapping_GetItemString(obj, property_name);
-                if (result != NULL) {
+                if (result != nullptr) {
                   success = true;
                   success = true;
                 } else {
                 } else {
                   PyErr_Clear();
                   PyErr_Clear();
@@ -830,7 +830,7 @@ handle_pyobj_command(TiXmlElement *xcommand, bool needs_response,
             }
             }
 
 
             if (!success) {
             if (!success) {
-              result = NULL;
+              result = nullptr;
             }
             }
           }
           }
 
 
@@ -859,7 +859,7 @@ handle_pyobj_command(TiXmlElement *xcommand, bool needs_response,
         } else {
         } else {
           // Not a special-case name.  Call the named method.
           // Not a special-case name.  Call the named method.
           PyObject *method = PyObject_GetAttrString(obj, (char *)method_name);
           PyObject *method = PyObject_GetAttrString(obj, (char *)method_name);
-          if (method != NULL) {
+          if (method != nullptr) {
             result = PyObject_CallObject(method, params);
             result = PyObject_CallObject(method, params);
             Py_DECREF(method);
             Py_DECREF(method);
           }
           }
@@ -867,7 +867,7 @@ handle_pyobj_command(TiXmlElement *xcommand, bool needs_response,
         Py_DECREF(params);
         Py_DECREF(params);
 
 
         // Feed the return value back through the XML pipe to the caller.
         // Feed the return value back through the XML pipe to the caller.
-        if (result != NULL) {
+        if (result != nullptr) {
           xresponse->LinkEndChild(pyobj_to_xml(result));
           xresponse->LinkEndChild(pyobj_to_xml(result));
           Py_DECREF(result);
           Py_DECREF(result);
         } else {
         } else {
@@ -948,10 +948,10 @@ wait_script_response(int response_id) {
       TiXmlDocument *doc = (*ci);
       TiXmlDocument *doc = (*ci);
 
 
       TiXmlElement *xcommand = doc->FirstChildElement("command");
       TiXmlElement *xcommand = doc->FirstChildElement("command");
-      if (xcommand != NULL) {
+      if (xcommand != nullptr) {
         const char *cmd = xcommand->Attribute("cmd");
         const char *cmd = xcommand->Attribute("cmd");
-        if ((cmd != NULL && strcmp(cmd, "script_response") == 0) ||
-            xcommand->Attribute("want_response_id") != NULL) {
+        if ((cmd != nullptr && strcmp(cmd, "script_response") == 0) ||
+            xcommand->Attribute("want_response_id") != nullptr) {
 
 
           // This is either a response, or it's a command that will want a
           // This is either a response, or it's a command that will want a
           // response itself.  In either case we should handle it right away.
           // response itself.  In either case we should handle it right away.
@@ -960,7 +960,7 @@ wait_script_response(int response_id) {
           RELEASE_LOCK(_commands_lock);
           RELEASE_LOCK(_commands_lock);
           handle_command(doc);
           handle_command(doc);
           if (_session_terminated) {
           if (_session_terminated) {
-            return NULL;
+            return nullptr;
           }
           }
           ACQUIRE_LOCK(_commands_lock);
           ACQUIRE_LOCK(_commands_lock);
           break;
           break;
@@ -976,9 +976,9 @@ wait_script_response(int response_id) {
       TiXmlDocument *doc = (*ci);
       TiXmlDocument *doc = (*ci);
 
 
       TiXmlElement *xcommand = doc->FirstChildElement("command");
       TiXmlElement *xcommand = doc->FirstChildElement("command");
-      assert(xcommand != NULL);
+      assert(xcommand != nullptr);
       const char *cmd = xcommand->Attribute("cmd");
       const char *cmd = xcommand->Attribute("cmd");
-      assert(cmd != NULL && strcmp(cmd, "script_response") == 0);
+      assert(cmd != nullptr && strcmp(cmd, "script_response") == 0);
 
 
       int unique_id;
       int unique_id;
       if (xcommand->QueryIntAttribute("unique_id", &unique_id) == TIXML_SUCCESS) {
       if (xcommand->QueryIntAttribute("unique_id", &unique_id) == TIXML_SUCCESS) {
@@ -995,7 +995,7 @@ wait_script_response(int response_id) {
 
 
     if (!_program_continue) {
     if (!_program_continue) {
       terminate_session();
       terminate_session();
-      return NULL;
+      return nullptr;
     }
     }
 
 
 #ifdef _WIN32
 #ifdef _WIN32
@@ -1005,7 +1005,7 @@ wait_script_response(int response_id) {
     // We appear to be best off with just a single PeekMessage() call here;
     // We appear to be best off with just a single PeekMessage() call here;
     // the full message pump seems to cause problems.
     // the full message pump seems to cause problems.
     MSG msg;
     MSG msg;
-    PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE | PM_NOYIELD);
+    PeekMessage(&msg, nullptr, 0, 0, PM_NOREMOVE | PM_NOYIELD);
 #endif  // _WIN32
 #endif  // _WIN32
 
 
     // nout << ".";
     // nout << ".";
@@ -1027,7 +1027,7 @@ py_request_func(PyObject *args) {
   const char *request_type;
   const char *request_type;
   PyObject *extra_args;
   PyObject *extra_args;
   if (!PyArg_ParseTuple(args, "isO", &instance_id, &request_type, &extra_args)) {
   if (!PyArg_ParseTuple(args, "isO", &instance_id, &request_type, &extra_args)) {
-    return NULL;
+    return nullptr;
   }
   }
 
 
   if (strcmp(request_type, "wait_script_response") == 0) {
   if (strcmp(request_type, "wait_script_response") == 0) {
@@ -1035,20 +1035,20 @@ py_request_func(PyObject *args) {
     // means to wait for a particular script_response to come in on the wire.
     // means to wait for a particular script_response to come in on the wire.
     int response_id;
     int response_id;
     if (!PyArg_ParseTuple(extra_args, "i", &response_id)) {
     if (!PyArg_ParseTuple(extra_args, "i", &response_id)) {
-      return NULL;
+      return nullptr;
     }
     }
 
 
     TiXmlDocument *doc = wait_script_response(response_id);
     TiXmlDocument *doc = wait_script_response(response_id);
     if (_session_terminated) {
     if (_session_terminated) {
       return Py_BuildValue("");
       return Py_BuildValue("");
     }
     }
-    assert(doc != NULL);
+    assert(doc != nullptr);
     TiXmlElement *xcommand = doc->FirstChildElement("command");
     TiXmlElement *xcommand = doc->FirstChildElement("command");
-    assert(xcommand != NULL);
+    assert(xcommand != nullptr);
     TiXmlElement *xvalue = xcommand->FirstChildElement("value");
     TiXmlElement *xvalue = xcommand->FirstChildElement("value");
 
 
-    PyObject *value = NULL;
-    if (xvalue != NULL) {
+    PyObject *value = nullptr;
+    if (xvalue != nullptr) {
       value = xml_to_pyobj(xvalue);
       value = xml_to_pyobj(xvalue);
     } else {
     } else {
       // An absence of a <value> element is an exception.  We will return NULL
       // An absence of a <value> element is an exception.  We will return NULL
@@ -1070,7 +1070,7 @@ py_request_func(PyObject *args) {
     // A general notification to be sent directly to the instance.
     // A general notification to be sent directly to the instance.
     const char *message;
     const char *message;
     if (!PyArg_ParseTuple(extra_args, "s", &message)) {
     if (!PyArg_ParseTuple(extra_args, "s", &message)) {
-      return NULL;
+      return nullptr;
     }
     }
 
 
     xrequest->SetAttribute("message", message);
     xrequest->SetAttribute("message", message);
@@ -1087,7 +1087,7 @@ py_request_func(PyObject *args) {
     if (!PyArg_ParseTuple(extra_args, "sOsOii",
     if (!PyArg_ParseTuple(extra_args, "sOsOii",
                           &operation, &object, &property_name, &value,
                           &operation, &object, &property_name, &value,
                           &needs_response, &unique_id)) {
                           &needs_response, &unique_id)) {
-      return NULL;
+      return nullptr;
     }
     }
 
 
     xrequest->SetAttribute("operation", operation);
     xrequest->SetAttribute("operation", operation);
@@ -1106,7 +1106,7 @@ py_request_func(PyObject *args) {
     // Release a particular P3D_object that we were holding a reference to.
     // Release a particular P3D_object that we were holding a reference to.
     int object_id;
     int object_id;
     if (!PyArg_ParseTuple(extra_args, "i", &object_id)) {
     if (!PyArg_ParseTuple(extra_args, "i", &object_id)) {
-      return NULL;
+      return nullptr;
     }
     }
 
 
     xrequest->SetAttribute("object_id", object_id);
     xrequest->SetAttribute("object_id", object_id);
@@ -1119,7 +1119,7 @@ py_request_func(PyObject *args) {
     const char *package_name;
     const char *package_name;
     const char *package_version;
     const char *package_version;
     if (!PyArg_ParseTuple(extra_args, "sss", &host_url, &package_name, &package_version)) {
     if (!PyArg_ParseTuple(extra_args, "sss", &host_url, &package_name, &package_version)) {
-      return NULL;
+      return nullptr;
     }
     }
 
 
     xrequest->SetAttribute("host_url", host_url);
     xrequest->SetAttribute("host_url", host_url);
@@ -1134,7 +1134,7 @@ py_request_func(PyObject *args) {
   } else {
   } else {
     string message = string("Unsupported request type: ") + string(request_type);
     string message = string("Unsupported request type: ") + string(request_type);
     PyErr_SetString(PyExc_ValueError, message.c_str());
     PyErr_SetString(PyExc_ValueError, message.c_str());
-    return NULL;
+    return nullptr;
   }
   }
 
 
   return Py_BuildValue("");
   return Py_BuildValue("");
@@ -1185,18 +1185,18 @@ start_instance(P3DCInstance *inst, TiXmlElement *xinstance) {
   set_instance_info(inst, xinstance);
   set_instance_info(inst, xinstance);
 
 
   TiXmlElement *xpackage = xinstance->FirstChildElement("package");
   TiXmlElement *xpackage = xinstance->FirstChildElement("package");
-  while (xpackage != (TiXmlElement *)NULL) {
+  while (xpackage != nullptr) {
     add_package_info(inst, xpackage);
     add_package_info(inst, xpackage);
     xpackage = xpackage->NextSiblingElement("package");
     xpackage = xpackage->NextSiblingElement("package");
   }
   }
 
 
   TiXmlElement *xfparams = xinstance->FirstChildElement("fparams");
   TiXmlElement *xfparams = xinstance->FirstChildElement("fparams");
-  if (xfparams != (TiXmlElement *)NULL) {
+  if (xfparams != nullptr) {
     set_p3d_filename(inst, xfparams);
     set_p3d_filename(inst, xfparams);
   }
   }
 
 
   TiXmlElement *xwparams = xinstance->FirstChildElement("wparams");
   TiXmlElement *xwparams = xinstance->FirstChildElement("wparams");
-  if (xwparams != (TiXmlElement *)NULL) {
+  if (xwparams != nullptr) {
     setup_window(inst, xwparams);
     setup_window(inst, xwparams);
   }
   }
 }
 }
@@ -1228,12 +1228,12 @@ terminate_instance(int id) {
 void P3DPythonRun::
 void P3DPythonRun::
 set_instance_info(P3DCInstance *inst, TiXmlElement *xinstance) {
 set_instance_info(P3DCInstance *inst, TiXmlElement *xinstance) {
   const char *root_dir = xinstance->Attribute("root_dir");
   const char *root_dir = xinstance->Attribute("root_dir");
-  if (root_dir == NULL) {
+  if (root_dir == nullptr) {
     root_dir = "";
     root_dir = "";
   }
   }
 
 
   const char *log_directory = xinstance->Attribute("log_directory");
   const char *log_directory = xinstance->Attribute("log_directory");
-  if (log_directory == NULL) {
+  if (log_directory == nullptr) {
     log_directory = "";
     log_directory = "";
   }
   }
 
 
@@ -1241,14 +1241,14 @@ set_instance_info(P3DCInstance *inst, TiXmlElement *xinstance) {
   xinstance->Attribute("verify_contents", &verify_contents);
   xinstance->Attribute("verify_contents", &verify_contents);
 
 
   const char *super_mirror = xinstance->Attribute("super_mirror");
   const char *super_mirror = xinstance->Attribute("super_mirror");
-  if (super_mirror == NULL) {
+  if (super_mirror == nullptr) {
     super_mirror = "";
     super_mirror = "";
   }
   }
 
 
   // Get the initial "main" object, if specified.
   // Get the initial "main" object, if specified.
   PyObject *main;
   PyObject *main;
   TiXmlElement *xmain = xinstance->FirstChildElement("main");
   TiXmlElement *xmain = xinstance->FirstChildElement("main");
-  if (xmain != NULL) {
+  if (xmain != nullptr) {
     main = xml_to_pyobj(xmain);
     main = xml_to_pyobj(xmain);
   } else {
   } else {
     main = Py_None;
     main = Py_None;
@@ -1262,7 +1262,7 @@ set_instance_info(P3DCInstance *inst, TiXmlElement *xinstance) {
     (_runner, (char *)"setInstanceInfo", (char *)"sssiNi", root_dir,
     (_runner, (char *)"setInstanceInfo", (char *)"sssiNi", root_dir,
      log_directory, super_mirror, verify_contents, main, respect_per_platform);
      log_directory, super_mirror, verify_contents, main, respect_per_platform);
 
 
-  if (result == NULL) {
+  if (result == nullptr) {
     PyErr_Print();
     PyErr_Print();
     if (_interactive_console) {
     if (_interactive_console) {
       run_interactive_console();
       run_interactive_console();
@@ -1282,16 +1282,16 @@ add_package_info(P3DCInstance *inst, TiXmlElement *xpackage) {
   const char *version = xpackage->Attribute("version");
   const char *version = xpackage->Attribute("version");
   const char *host = xpackage->Attribute("host");
   const char *host = xpackage->Attribute("host");
   const char *host_dir = xpackage->Attribute("host_dir");
   const char *host_dir = xpackage->Attribute("host_dir");
-  if (name == NULL || host == NULL) {
+  if (name == nullptr || host == nullptr) {
     return;
     return;
   }
   }
-  if (version == NULL) {
+  if (version == nullptr) {
     version = "";
     version = "";
   }
   }
-  if (platform == NULL) {
+  if (platform == nullptr) {
     platform = "";
     platform = "";
   }
   }
-  if (host_dir == NULL) {
+  if (host_dir == nullptr) {
     host_dir = "";
     host_dir = "";
   }
   }
 
 
@@ -1299,7 +1299,7 @@ add_package_info(P3DCInstance *inst, TiXmlElement *xpackage) {
     (_runner, (char *)"addPackageInfo", (char *)"sssss",
     (_runner, (char *)"addPackageInfo", (char *)"sssss",
      name, platform, version, host, host_dir);
      name, platform, version, host, host_dir);
 
 
-  if (result == NULL) {
+  if (result == nullptr) {
     PyErr_Print();
     PyErr_Print();
     if (_interactive_console) {
     if (_interactive_console) {
       run_interactive_console();
       run_interactive_console();
@@ -1317,7 +1317,7 @@ void P3DPythonRun::
 set_p3d_filename(P3DCInstance *inst, TiXmlElement *xfparams) {
 set_p3d_filename(P3DCInstance *inst, TiXmlElement *xfparams) {
   string p3d_filename;
   string p3d_filename;
   const char *p3d_filename_c = xfparams->Attribute("p3d_filename");
   const char *p3d_filename_c = xfparams->Attribute("p3d_filename");
-  if (p3d_filename_c != NULL) {
+  if (p3d_filename_c != nullptr) {
     p3d_filename = p3d_filename_c;
     p3d_filename = p3d_filename_c;
   }
   }
 
 
@@ -1326,21 +1326,21 @@ set_p3d_filename(P3DCInstance *inst, TiXmlElement *xfparams) {
 
 
   string p3d_url;
   string p3d_url;
   const char *p3d_url_c = xfparams->Attribute("p3d_url");
   const char *p3d_url_c = xfparams->Attribute("p3d_url");
-  if (p3d_url_c != NULL) {
+  if (p3d_url_c != nullptr) {
     p3d_url = p3d_url_c;
     p3d_url = p3d_url_c;
   }
   }
 
 
   PyObject *token_list = PyList_New(0);
   PyObject *token_list = PyList_New(0);
   TiXmlElement *xtoken = xfparams->FirstChildElement("token");
   TiXmlElement *xtoken = xfparams->FirstChildElement("token");
-  while (xtoken != NULL) {
+  while (xtoken != nullptr) {
     string keyword, value;
     string keyword, value;
     const char *keyword_c = xtoken->Attribute("keyword");
     const char *keyword_c = xtoken->Attribute("keyword");
-    if (keyword_c != NULL) {
+    if (keyword_c != nullptr) {
       keyword = keyword_c;
       keyword = keyword_c;
     }
     }
 
 
     const char *value_c = xtoken->Attribute("value");
     const char *value_c = xtoken->Attribute("value");
-    if (value_c != NULL) {
+    if (value_c != nullptr) {
       value = value_c;
       value = value_c;
     }
     }
 
 
@@ -1354,10 +1354,10 @@ set_p3d_filename(P3DCInstance *inst, TiXmlElement *xfparams) {
 
 
   PyObject *arg_list = PyList_New(0);
   PyObject *arg_list = PyList_New(0);
   TiXmlElement *xarg = xfparams->FirstChildElement("arg");
   TiXmlElement *xarg = xfparams->FirstChildElement("arg");
-  while (xarg != NULL) {
+  while (xarg != nullptr) {
     string value;
     string value;
     const char *value_c = xarg->Attribute("value");
     const char *value_c = xarg->Attribute("value");
-    if (value_c != NULL) {
+    if (value_c != nullptr) {
       value = value_c;
       value = value_c;
     }
     }
 
 
@@ -1373,7 +1373,7 @@ set_p3d_filename(P3DCInstance *inst, TiXmlElement *xfparams) {
      token_list, arg_list, inst->get_instance_id(), _interactive_console, p3d_offset,
      token_list, arg_list, inst->get_instance_id(), _interactive_console, p3d_offset,
      p3d_url.c_str());
      p3d_url.c_str());
 
 
-  if (result == NULL) {
+  if (result == nullptr) {
     PyErr_Print();
     PyErr_Print();
     if (_interactive_console) {
     if (_interactive_console) {
       run_interactive_console();
       run_interactive_console();
@@ -1405,7 +1405,7 @@ void P3DPythonRun::
 setup_window(P3DCInstance *inst, TiXmlElement *xwparams) {
 setup_window(P3DCInstance *inst, TiXmlElement *xwparams) {
   string window_type;
   string window_type;
   const char *window_type_c = xwparams->Attribute("window_type");
   const char *window_type_c = xwparams->Attribute("window_type");
-  if (window_type_c != NULL) {
+  if (window_type_c != nullptr) {
     window_type = window_type_c;
     window_type = window_type_c;
   }
   }
 
 
@@ -1429,7 +1429,7 @@ setup_window(P3DCInstance *inst, TiXmlElement *xwparams) {
   // to go through this subprocess-window nonsense.
   // to go through this subprocess-window nonsense.
 
 
   const char *subprocess_window = xwparams->Attribute("subprocess_window");
   const char *subprocess_window = xwparams->Attribute("subprocess_window");
-  if (subprocess_window != NULL) {
+  if (subprocess_window != nullptr) {
     Filename filename = Filename::from_os_specific(subprocess_window);
     Filename filename = Filename::from_os_specific(subprocess_window);
     parent_window_handle = NativeWindowHandle::make_subprocess(filename);
     parent_window_handle = NativeWindowHandle::make_subprocess(filename);
   }
   }
@@ -1437,7 +1437,7 @@ setup_window(P3DCInstance *inst, TiXmlElement *xwparams) {
 #elif defined(HAVE_X11)
 #elif defined(HAVE_X11)
   // Use stringstream to decode the "long" attribute.
   // Use stringstream to decode the "long" attribute.
   const char *parent_cstr = xwparams->Attribute("parent_xwindow");
   const char *parent_cstr = xwparams->Attribute("parent_xwindow");
-  if (parent_cstr != NULL) {
+  if (parent_cstr != nullptr) {
     long window;
     long window;
     istringstream strm(parent_cstr);
     istringstream strm(parent_cstr);
     strm >> window;
     strm >> window;
@@ -1446,7 +1446,7 @@ setup_window(P3DCInstance *inst, TiXmlElement *xwparams) {
 #endif
 #endif
 
 
   PyObject *py_handle = Py_None;
   PyObject *py_handle = Py_None;
-  if (parent_window_handle != NULL) {
+  if (parent_window_handle != nullptr) {
 
 
     // We have a valid parent WindowHandle, but replace it with a
     // We have a valid parent WindowHandle, but replace it with a
     // P3DWindowHandle so we can get the callbacks.
     // P3DWindowHandle so we can get the callbacks.
@@ -1467,7 +1467,7 @@ setup_window(P3DCInstance *inst, TiXmlElement *xwparams) {
     (_runner, (char *)"setupWindow", (char *)"siiiiN", window_type.c_str(),
     (_runner, (char *)"setupWindow", (char *)"siiiiN", window_type.c_str(),
      win_x, win_y, win_width, win_height, py_handle);
      win_x, win_y, win_width, win_height, py_handle);
 
 
-  if (result == NULL) {
+  if (result == nullptr) {
     PyErr_Print();
     PyErr_Print();
     if (_interactive_console) {
     if (_interactive_console) {
       run_interactive_console();
       run_interactive_console();
@@ -1489,7 +1489,7 @@ send_windows_message(int id, unsigned int msg, int wparam, int lparam) {
   }
   }
 
 
   P3DCInstance *inst = (*ii).second;
   P3DCInstance *inst = (*ii).second;
-  if (inst->_parent_window_handle != (WindowHandle *)NULL) {
+  if (inst->_parent_window_handle != nullptr) {
     inst->_parent_window_handle->send_windows_message(msg, wparam, lparam);
     inst->_parent_window_handle->send_windows_message(msg, wparam, lparam);
   }
   }
 }
 }
@@ -1507,9 +1507,9 @@ terminate_session() {
   _instances.clear();
   _instances.clear();
 
 
   if (!_session_terminated) {
   if (!_session_terminated) {
-    if (_taskMgr != NULL) {
+    if (_taskMgr != nullptr) {
       PyObject *result = PyObject_CallMethod(_taskMgr, (char *)"stop", (char *)"");
       PyObject *result = PyObject_CallMethod(_taskMgr, (char *)"stop", (char *)"");
-      if (result == NULL) {
+      if (result == nullptr) {
         PyErr_Print();
         PyErr_Print();
       } else {
       } else {
         Py_DECREF(result);
         Py_DECREF(result);
@@ -1573,13 +1573,13 @@ pyobj_to_xml(PyObject *value) {
     // function for getting the UTF-8 encoded version.
     // function for getting the UTF-8 encoded version.
     Py_ssize_t length = 0;
     Py_ssize_t length = 0;
     char *buffer = PyUnicode_AsUTF8AndSize(value, &length);
     char *buffer = PyUnicode_AsUTF8AndSize(value, &length);
-    if (buffer != NULL) {
+    if (buffer != nullptr) {
       string str(buffer, length);
       string str(buffer, length);
       xvalue->SetAttribute("value", str);
       xvalue->SetAttribute("value", str);
     }
     }
 #else
 #else
     PyObject *as_str = PyUnicode_AsUTF8String(value);
     PyObject *as_str = PyUnicode_AsUTF8String(value);
-    if (as_str != NULL) {
+    if (as_str != nullptr) {
       char *buffer;
       char *buffer;
       Py_ssize_t length;
       Py_ssize_t length;
       if (PyString_AsStringAndSize(as_str, &buffer, &length) != -1) {
       if (PyString_AsStringAndSize(as_str, &buffer, &length) != -1) {
@@ -1594,13 +1594,13 @@ pyobj_to_xml(PyObject *value) {
     // using the standard encoding, then re-encoding it.
     // using the standard encoding, then re-encoding it.
     xvalue->SetAttribute("type", "string");
     xvalue->SetAttribute("type", "string");
 
 
-    PyObject *ustr = PyUnicode_FromEncodedObject(value, NULL, NULL);
-    if (ustr == NULL) {
+    PyObject *ustr = PyUnicode_FromEncodedObject(value, nullptr, nullptr);
+    if (ustr == nullptr) {
       PyErr_Print();
       PyErr_Print();
       return xvalue;
       return xvalue;
     } else {
     } else {
       PyObject *as_str = PyUnicode_AsUTF8String(ustr);
       PyObject *as_str = PyUnicode_AsUTF8String(ustr);
-      if (as_str != NULL) {
+      if (as_str != nullptr) {
         char *buffer;
         char *buffer;
         Py_ssize_t length;
         Py_ssize_t length;
         if (PyString_AsStringAndSize(as_str, &buffer, &length) != -1) {
         if (PyString_AsStringAndSize(as_str, &buffer, &length) != -1) {
@@ -1620,7 +1620,7 @@ pyobj_to_xml(PyObject *value) {
     Py_ssize_t length = PySequence_Length(value);
     Py_ssize_t length = PySequence_Length(value);
     for (Py_ssize_t i = 0; i < length; ++i) {
     for (Py_ssize_t i = 0; i < length; ++i) {
       PyObject *item = PySequence_GetItem(value, i);
       PyObject *item = PySequence_GetItem(value, i);
-      if (item != NULL) {
+      if (item != nullptr) {
         xvalue->LinkEndChild(pyobj_to_xml(item));
         xvalue->LinkEndChild(pyobj_to_xml(item));
         Py_DECREF(item);
         Py_DECREF(item);
       }
       }
@@ -1631,7 +1631,7 @@ pyobj_to_xml(PyObject *value) {
     xvalue->SetAttribute("type", "concrete_struct");
     xvalue->SetAttribute("type", "concrete_struct");
 
 
     PyObject *items = PyObject_CallMethod(value, (char *)"getConcreteProperties", (char *)"");
     PyObject *items = PyObject_CallMethod(value, (char *)"getConcreteProperties", (char *)"");
-    if (items == NULL) {
+    if (items == nullptr) {
       PyErr_Print();
       PyErr_Print();
       return xvalue;
       return xvalue;
     }
     }
@@ -1639,11 +1639,11 @@ pyobj_to_xml(PyObject *value) {
     Py_ssize_t length = PySequence_Length(items);
     Py_ssize_t length = PySequence_Length(items);
     for (Py_ssize_t i = 0; i < length; ++i) {
     for (Py_ssize_t i = 0; i < length; ++i) {
       PyObject *item = PySequence_GetItem(items, i);
       PyObject *item = PySequence_GetItem(items, i);
-      if (item != NULL) {
+      if (item != nullptr) {
         PyObject *a = PySequence_GetItem(item, 0);
         PyObject *a = PySequence_GetItem(item, 0);
-        if (a != NULL) {
+        if (a != nullptr) {
           PyObject *b = PySequence_GetItem(item, 1);
           PyObject *b = PySequence_GetItem(item, 1);
-          if (b != NULL) {
+          if (b != nullptr) {
             TiXmlElement *xitem = pyobj_to_xml(b);
             TiXmlElement *xitem = pyobj_to_xml(b);
             Py_DECREF(b);
             Py_DECREF(b);
 
 
@@ -1664,7 +1664,7 @@ pyobj_to_xml(PyObject *value) {
             Py_ssize_t length;
             Py_ssize_t length;
 #if PY_MAJOR_VERSION >= 3
 #if PY_MAJOR_VERSION >= 3
             buffer = PyUnicode_AsUTF8AndSize(as_str, &length);
             buffer = PyUnicode_AsUTF8AndSize(as_str, &length);
-            if (buffer != NULL) {
+            if (buffer != nullptr) {
 #else
 #else
             if (PyString_AsStringAndSize(as_str, &buffer, &length) != -1) {
             if (PyString_AsStringAndSize(as_str, &buffer, &length) != -1) {
 #endif
 #endif
@@ -1694,7 +1694,7 @@ pyobj_to_xml(PyObject *value) {
     // This is a BrowserObject, a reference to an object that actually exists
     // This is a BrowserObject, a reference to an object that actually exists
     // in the host namespace.  So, pass up the appropriate object ID.
     // in the host namespace.  So, pass up the appropriate object ID.
     PyObject *objectId = PyObject_GetAttrString(value, (char *)"_BrowserObject__objectId");
     PyObject *objectId = PyObject_GetAttrString(value, (char *)"_BrowserObject__objectId");
-    if (objectId != NULL) {
+    if (objectId != nullptr) {
       int object_id = PyInt_AsLong(objectId);
       int object_id = PyInt_AsLong(objectId);
       xvalue->SetAttribute("type", "browser");
       xvalue->SetAttribute("type", "browser");
       xvalue->SetAttribute("object_id", object_id);
       xvalue->SetAttribute("object_id", object_id);
@@ -1764,8 +1764,8 @@ xml_to_pyobj(TiXmlElement *xvalue) {
     // Using the string form here instead of the char * form, so we don't get
     // Using the string form here instead of the char * form, so we don't get
     // tripped up on embedded null characters.
     // tripped up on embedded null characters.
     const string *value = xvalue->Attribute(string("value"));
     const string *value = xvalue->Attribute(string("value"));
-    if (value != NULL) {
-      return PyUnicode_DecodeUTF8(value->data(), value->length(), NULL);
+    if (value != nullptr) {
+      return PyUnicode_DecodeUTF8(value->data(), value->length(), nullptr);
     }
     }
 
 
   } else if (strcmp(type, "undefined") == 0) {
   } else if (strcmp(type, "undefined") == 0) {
@@ -1785,9 +1785,9 @@ xml_to_pyobj(TiXmlElement *xvalue) {
     PyObject *list = PyList_New(0);
     PyObject *list = PyList_New(0);
 
 
     TiXmlElement *xitem = xvalue->FirstChildElement("value");
     TiXmlElement *xitem = xvalue->FirstChildElement("value");
-    while (xitem != NULL) {
+    while (xitem != nullptr) {
       PyObject *item = xml_to_pyobj(xitem);
       PyObject *item = xml_to_pyobj(xitem);
-      if (item != NULL) {
+      if (item != nullptr) {
         PyList_Append(list, item);
         PyList_Append(list, item);
         Py_DECREF(item);
         Py_DECREF(item);
       }
       }
@@ -1802,13 +1802,13 @@ xml_to_pyobj(TiXmlElement *xvalue) {
     // Receive a concrete struct as a new ConcreteStruct instance.
     // Receive a concrete struct as a new ConcreteStruct instance.
     PyObject *obj = PyObject_CallFunction(_concrete_struct_class, (char *)"");
     PyObject *obj = PyObject_CallFunction(_concrete_struct_class, (char *)"");
 
 
-    if (obj != NULL) {
+    if (obj != nullptr) {
       TiXmlElement *xitem = xvalue->FirstChildElement("value");
       TiXmlElement *xitem = xvalue->FirstChildElement("value");
-      while (xitem != NULL) {
+      while (xitem != nullptr) {
         const char *key = xitem->Attribute("key");
         const char *key = xitem->Attribute("key");
-        if (key != NULL) {
+        if (key != nullptr) {
           PyObject *item = xml_to_pyobj(xitem);
           PyObject *item = xml_to_pyobj(xitem);
-          if (item != NULL) {
+          if (item != nullptr) {
             PyObject_SetAttrString(obj, (char *)key, item);
             PyObject_SetAttrString(obj, (char *)key, item);
             Py_DECREF(item);
             Py_DECREF(item);
           }
           }
@@ -1847,7 +1847,7 @@ void P3DPythonRun::
 rt_thread_run() {
 rt_thread_run() {
   while (_read_thread_continue) {
   while (_read_thread_continue) {
     TiXmlDocument *doc = read_xml(_pipe_read, nout);
     TiXmlDocument *doc = read_xml(_pipe_read, nout);
-    if (doc == NULL) {
+    if (doc == nullptr) {
       // Some error on reading.  Abort.
       // Some error on reading.  Abort.
       _program_continue = false;
       _program_continue = false;
       return;
       return;
@@ -1858,9 +1858,9 @@ rt_thread_run() {
     // Check for one special case: the "exit" command means we shut down the
     // Check for one special case: the "exit" command means we shut down the
     // read thread along with everything else.
     // read thread along with everything else.
     TiXmlElement *xcommand = doc->FirstChildElement("command");
     TiXmlElement *xcommand = doc->FirstChildElement("command");
-    if (xcommand != NULL) {
+    if (xcommand != nullptr) {
       const char *cmd = xcommand->Attribute("cmd");
       const char *cmd = xcommand->Attribute("cmd");
-      if (cmd != NULL) {
+      if (cmd != nullptr) {
         if (strcmp(cmd, "exit") == 0) {
         if (strcmp(cmd, "exit") == 0) {
           _read_thread_continue = false;
           _read_thread_continue = false;
         }
         }

+ 51 - 51
direct/src/plugin/p3dSession.cxx

@@ -143,7 +143,7 @@ shutdown() {
 #else  // _WIN32
 #else  // _WIN32
       // Wait for a certain amount of time for the process to stop by itself.
       // Wait for a certain amount of time for the process to stop by itself.
       struct timeval start;
       struct timeval start;
-      gettimeofday(&start, NULL);
+      gettimeofday(&start, nullptr);
       int start_ms = start.tv_sec * 1000 + start.tv_usec / 1000;
       int start_ms = start.tv_sec * 1000 + start.tv_usec / 1000;
 
 
       int status;
       int status;
@@ -155,7 +155,7 @@ shutdown() {
         }
         }
 
 
         struct timeval now;
         struct timeval now;
-        gettimeofday(&now, NULL);
+        gettimeofday(&now, nullptr);
         int now_ms = now.tv_sec * 1000 + now.tv_usec / 1000;
         int now_ms = now.tv_sec * 1000 + now.tv_usec / 1000;
         int elapsed = now_ms - start_ms;
         int elapsed = now_ms - start_ms;
 
 
@@ -171,7 +171,7 @@ shutdown() {
         struct timeval tv;
         struct timeval tv;
         tv.tv_sec = 0;
         tv.tv_sec = 0;
         tv.tv_usec = 1;
         tv.tv_usec = 1;
-        select(0, NULL, NULL, NULL, &tv);
+        select(0, nullptr, nullptr, nullptr, &tv);
         result = waitpid(_p3dpython_pid, &status, WNOHANG);
         result = waitpid(_p3dpython_pid, &status, WNOHANG);
       }
       }
       _p3dpython_pid = -1;
       _p3dpython_pid = -1;
@@ -227,7 +227,7 @@ shutdown() {
  */
  */
 void P3DSession::
 void P3DSession::
 start_instance(P3DInstance *inst) {
 start_instance(P3DInstance *inst) {
-  assert(inst->_session == NULL);
+  assert(inst->_session == nullptr);
   assert(inst->get_session_key() == _session_key);
   assert(inst->get_session_key() == _session_key);
   if (_failed) {
   if (_failed) {
     inst->set_failed();
     inst->set_failed();
@@ -279,7 +279,7 @@ terminate_instance(P3DInstance *inst) {
   if (inst->_session == this) {
   if (inst->_session == this) {
     nout << "Assigning " << inst << "->log_pathname = " << _log_pathname << "\n";
     nout << "Assigning " << inst << "->log_pathname = " << _log_pathname << "\n";
     inst->_log_pathname = _log_pathname;
     inst->_log_pathname = _log_pathname;
-    inst->_session = NULL;
+    inst->_session = nullptr;
     _instances.erase(inst->get_instance_id());
     _instances.erase(inst->get_instance_id());
   }
   }
   RELEASE_LOCK(_instances_lock);
   RELEASE_LOCK(_instances_lock);
@@ -319,7 +319,7 @@ send_command(TiXmlDocument *command) {
 TiXmlDocument *P3DSession::
 TiXmlDocument *P3DSession::
 command_and_response(TiXmlDocument *command) {
 command_and_response(TiXmlDocument *command) {
   if (!_p3dpython_started) {
   if (!_p3dpython_started) {
-    return NULL;
+    return nullptr;
   }
   }
 
 
   P3DInstanceManager *inst_mgr = P3DInstanceManager::get_global_ptr();
   P3DInstanceManager *inst_mgr = P3DInstanceManager::get_global_ptr();
@@ -328,7 +328,7 @@ command_and_response(TiXmlDocument *command) {
   // Add the "want_response_id" attribute to the toplevel command, so the sub-
   // Add the "want_response_id" attribute to the toplevel command, so the sub-
   // process knows we'll be waiting for its response.
   // process knows we'll be waiting for its response.
   TiXmlElement *xcommand = command->FirstChildElement("command");
   TiXmlElement *xcommand = command->FirstChildElement("command");
-  assert(xcommand != NULL);
+  assert(xcommand != nullptr);
   xcommand->SetAttribute("want_response_id", response_id);
   xcommand->SetAttribute("want_response_id", response_id);
 
 
   write_xml(_pipe_write, command, nout);
   write_xml(_pipe_write, command, nout);
@@ -341,7 +341,7 @@ command_and_response(TiXmlDocument *command) {
     if (!_p3dpython_running) {
     if (!_p3dpython_running) {
       // Hmm, looks like Python has gone away.
       // Hmm, looks like Python has gone away.
       _response_ready.release();
       _response_ready.release();
-      return NULL;
+      return nullptr;
     }
     }
 
 
     // Make sure we bake requests while we are waiting, to process recursive
     // Make sure we bake requests while we are waiting, to process recursive
@@ -380,7 +380,7 @@ command_and_response(TiXmlDocument *command) {
     // coming and will block waiting for them.
     // coming and will block waiting for them.
 
 
     MSG msg;
     MSG msg;
-    PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE | PM_NOYIELD);
+    PeekMessage(&msg, nullptr, 0, 0, PM_NOREMOVE | PM_NOYIELD);
 
 
     // We wait with a timeout, so we can go back and spin the event loop some
     // We wait with a timeout, so we can go back and spin the event loop some
     // more.  On Windows, the timeout needs to be small, so we continue to
     // more.  On Windows, the timeout needs to be small, so we continue to
@@ -444,16 +444,16 @@ xml_to_p3dobj(const TiXmlElement *xvalue) {
     // Using the string form here instead of the char * form, so we don't get
     // Using the string form here instead of the char * form, so we don't get
     // tripped up on embedded null characters.
     // tripped up on embedded null characters.
     const string *value = xvalue->Attribute(string("value"));
     const string *value = xvalue->Attribute(string("value"));
-    if (value != NULL) {
+    if (value != nullptr) {
       return new P3DStringObject(*value);
       return new P3DStringObject(*value);
     }
     }
 
 
   } else if (strcmp(type, "concrete_sequence") == 0) {
   } else if (strcmp(type, "concrete_sequence") == 0) {
     P3DConcreteSequence *obj = new P3DConcreteSequence;
     P3DConcreteSequence *obj = new P3DConcreteSequence;
     const TiXmlElement *xitem = xvalue->FirstChildElement("value");
     const TiXmlElement *xitem = xvalue->FirstChildElement("value");
-    while (xitem != NULL) {
+    while (xitem != nullptr) {
       P3D_object *item = xml_to_p3dobj(xitem);
       P3D_object *item = xml_to_p3dobj(xitem);
-      if (item != NULL) {
+      if (item != nullptr) {
         obj->append(item);
         obj->append(item);
         P3D_OBJECT_DECREF(item);
         P3D_OBJECT_DECREF(item);
       }
       }
@@ -464,11 +464,11 @@ xml_to_p3dobj(const TiXmlElement *xvalue) {
   } else if (strcmp(type, "concrete_struct") == 0) {
   } else if (strcmp(type, "concrete_struct") == 0) {
     P3DConcreteStruct *obj = new P3DConcreteStruct;
     P3DConcreteStruct *obj = new P3DConcreteStruct;
     const TiXmlElement *xitem = xvalue->FirstChildElement("value");
     const TiXmlElement *xitem = xvalue->FirstChildElement("value");
-    while (xitem != NULL) {
+    while (xitem != nullptr) {
       const char *key = xitem->Attribute("key");
       const char *key = xitem->Attribute("key");
-      if (key != NULL) {
+      if (key != nullptr) {
         P3D_object *item = xml_to_p3dobj(xitem);
         P3D_object *item = xml_to_p3dobj(xitem);
-        if (item != NULL) {
+        if (item != nullptr) {
           obj->set_property(key, item);
           obj->set_property(key, item);
           P3D_OBJECT_DECREF(item);
           P3D_OBJECT_DECREF(item);
         }
         }
@@ -539,7 +539,7 @@ p3dobj_to_xml(P3D_object *obj) {
   case P3D_OT_string:
   case P3D_OT_string:
     {
     {
       xvalue->SetAttribute("type", "string");
       xvalue->SetAttribute("type", "string");
-      int size = P3D_OBJECT_GET_STRING(obj, NULL, 0);
+      int size = P3D_OBJECT_GET_STRING(obj, nullptr, 0);
       char *buffer = new char[size];
       char *buffer = new char[size];
       P3D_OBJECT_GET_STRING(obj, buffer, size);
       P3D_OBJECT_GET_STRING(obj, buffer, size);
       xvalue->SetAttribute("value", string(buffer, size));
       xvalue->SetAttribute("value", string(buffer, size));
@@ -548,12 +548,12 @@ p3dobj_to_xml(P3D_object *obj) {
     break;
     break;
 
 
   case P3D_OT_object:
   case P3D_OT_object:
-    P3DObject *p3dobj = NULL;
+    P3DObject *p3dobj = nullptr;
     if (obj->_class == &P3DObject::_object_class) {
     if (obj->_class == &P3DObject::_object_class) {
       p3dobj = (P3DObject *)obj;
       p3dobj = (P3DObject *)obj;
     }
     }
 
 
-    if (p3dobj != NULL && p3dobj->fill_xml(xvalue, this)) {
+    if (p3dobj != nullptr && p3dobj->fill_xml(xvalue, this)) {
       // This object has a specialized XML representation, valid for this
       // This object has a specialized XML representation, valid for this
       // particular session.  It has already been filled into xvalue.
       // particular session.  It has already been filled into xvalue.
 
 
@@ -666,7 +666,7 @@ start_p3dpython(P3DInstance *inst) {
     return;
     return;
   }
   }
 
 
-  if (inst->_panda3d_package == NULL) {
+  if (inst->_panda3d_package == nullptr) {
     nout << "Couldn't start Python: no panda3d dependency.\n";
     nout << "Couldn't start Python: no panda3d dependency.\n";
     set_failed();
     set_failed();
     return;
     return;
@@ -787,22 +787,22 @@ start_p3dpython(P3DInstance *inst) {
   string p3dpythonw_exe = _p3dpython_exe + "w";
   string p3dpythonw_exe = _p3dpython_exe + "w";
   if (_p3dpython_exe.empty()) {
   if (_p3dpython_exe.empty()) {
     // Allow package to override the name of the p3dpython executables.
     // Allow package to override the name of the p3dpython executables.
-    const char *p3dpython_name_xconfig = NULL;
-    const char *p3dpythonw_name_xconfig = NULL;
+    const char *p3dpython_name_xconfig = nullptr;
+    const char *p3dpythonw_name_xconfig = nullptr;
     const TiXmlElement *panda3d_xconfig = inst->_panda3d_package->get_xconfig();
     const TiXmlElement *panda3d_xconfig = inst->_panda3d_package->get_xconfig();
-    if (panda3d_xconfig != NULL) {
+    if (panda3d_xconfig != nullptr) {
       p3dpython_name_xconfig = panda3d_xconfig->Attribute("p3dpython_name");
       p3dpython_name_xconfig = panda3d_xconfig->Attribute("p3dpython_name");
       p3dpythonw_name_xconfig = panda3d_xconfig->Attribute("p3dpythonw_name");
       p3dpythonw_name_xconfig = panda3d_xconfig->Attribute("p3dpythonw_name");
     }
     }
 
 
     string p3dpython_name = "p3dpython";
     string p3dpython_name = "p3dpython";
-    if (p3dpython_name_xconfig != NULL) {
+    if (p3dpython_name_xconfig != nullptr) {
       nout << "p3dpython_name from panda3d xconfig: " << p3dpython_name_xconfig << "\n";
       nout << "p3dpython_name from panda3d xconfig: " << p3dpython_name_xconfig << "\n";
       p3dpython_name = p3dpython_name_xconfig;
       p3dpython_name = p3dpython_name_xconfig;
     }
     }
 
 
     string p3dpythonw_name = p3dpython_name + "w";
     string p3dpythonw_name = p3dpython_name + "w";
-    if (p3dpythonw_name_xconfig != NULL) {
+    if (p3dpythonw_name_xconfig != nullptr) {
       nout << "p3dpythonw_name from panda3d xconfig: " << p3dpythonw_name_xconfig << "\n";
       nout << "p3dpythonw_name from panda3d xconfig: " << p3dpythonw_name_xconfig << "\n";
       p3dpythonw_name = p3dpythonw_name_xconfig;
       p3dpythonw_name = p3dpythonw_name_xconfig;
     }
     }
@@ -848,9 +848,9 @@ start_p3dpython(P3DInstance *inst) {
 #ifdef HAVE_X11
 #ifdef HAVE_X11
       "DISPLAY", "XAUTHORITY",
       "DISPLAY", "XAUTHORITY",
 #endif
 #endif
-      NULL
+      nullptr
     };
     };
-    for (int ki = 0; keep[ki] != NULL; ++ki) {
+    for (int ki = 0; keep[ki] != nullptr; ++ki) {
       string value;
       string value;
       if (get_env(value, keep[ki])) {
       if (get_env(value, keep[ki])) {
         _env += keep[ki];
         _env += keep[ki];
@@ -867,7 +867,7 @@ start_p3dpython(P3DInstance *inst) {
       "PATH", "LD_LIBRARY_PATH", "DYLD_LIBRARY_PATH",
       "PATH", "LD_LIBRARY_PATH", "DYLD_LIBRARY_PATH",
       "PYTHONPATH", "PYTHONHOME", "PRC_PATH", "PANDA_PRC_PATH",
       "PYTHONPATH", "PYTHONHOME", "PRC_PATH", "PANDA_PRC_PATH",
       "TEMP", "CTPROJS",
       "TEMP", "CTPROJS",
-      NULL
+      nullptr
     };
     };
 
 
 #ifdef _WIN32
 #ifdef _WIN32
@@ -886,14 +886,14 @@ start_p3dpython(P3DInstance *inst) {
 #endif  // _WIN32
 #endif  // _WIN32
 
 
     char **ep;
     char **ep;
-    for (ep = global_environ; *ep != NULL; ++ep) {
+    for (ep = global_environ; *ep != nullptr; ++ep) {
       string env = *ep;
       string env = *ep;
       size_t equals = env.find('=');
       size_t equals = env.find('=');
       if (equals != string::npos) {
       if (equals != string::npos) {
         string var = env.substr(0, equals);
         string var = env.substr(0, equals);
         const char *varc = var.c_str();
         const char *varc = var.c_str();
         bool found = false;
         bool found = false;
-        for (int i = 0; dont_keep[i] != NULL && !found; ++i) {
+        for (int i = 0; dont_keep[i] != nullptr && !found; ++i) {
 #ifdef _WIN32
 #ifdef _WIN32
           found = (_stricmp(dont_keep[i], varc) == 0);
           found = (_stricmp(dont_keep[i], varc) == 0);
 #else
 #else
@@ -1088,9 +1088,9 @@ start_p3dpython(P3DInstance *inst) {
 #else
 #else
     tzset();
     tzset();
 #endif
 #endif
-    time_t log_time_seconds = time(NULL);
+    time_t log_time_seconds = time(nullptr);
     struct tm *log_time_local_p = localtime(&log_time_seconds);
     struct tm *log_time_local_p = localtime(&log_time_seconds);
-    if (log_time_local_p != NULL) {
+    if (log_time_local_p != nullptr) {
       struct tm log_time_local = *log_time_local_p;
       struct tm log_time_local = *log_time_local_p;
       static const size_t buffer_size = 16;
       static const size_t buffer_size = 16;
       char buffer[buffer_size];
       char buffer[buffer_size];
@@ -1121,7 +1121,7 @@ start_p3dpython(P3DInstance *inst) {
   HANDLE r_to, w_to, r_from, w_from;
   HANDLE r_to, w_to, r_from, w_from;
 
 
   // Create the pipe to the process.
   // Create the pipe to the process.
-  if (!CreatePipe(&r_to, &w_to, NULL, 0)) {
+  if (!CreatePipe(&r_to, &w_to, nullptr, 0)) {
     nout << "failed to create pipe\n";
     nout << "failed to create pipe\n";
     set_failed();
     set_failed();
   } else {
   } else {
@@ -1131,7 +1131,7 @@ start_p3dpython(P3DInstance *inst) {
   }
   }
 
 
   // Create the pipe from the process.
   // Create the pipe from the process.
-  if (!CreatePipe(&r_from, &w_from, NULL, 0)) {
+  if (!CreatePipe(&r_from, &w_from, nullptr, 0)) {
     nout << "failed to create pipe\n";
     nout << "failed to create pipe\n";
     set_failed();
     set_failed();
   } else {
   } else {
@@ -1311,7 +1311,7 @@ void P3DSession::
 rt_thread_run() {
 rt_thread_run() {
   while (_read_thread_continue) {
   while (_read_thread_continue) {
     TiXmlDocument *doc = read_xml(_pipe_read, nout);
     TiXmlDocument *doc = read_xml(_pipe_read, nout);
-    if (doc == NULL) {
+    if (doc == nullptr) {
       // Some error on reading.  Abort.
       // Some error on reading.  Abort.
       rt_terminate();
       rt_terminate();
       _p3dpython_running = false;
       _p3dpython_running = false;
@@ -1335,7 +1335,7 @@ rt_thread_run() {
 void P3DSession::
 void P3DSession::
 rt_handle_request(TiXmlDocument *doc) {
 rt_handle_request(TiXmlDocument *doc) {
   TiXmlElement *xresponse = doc->FirstChildElement("response");
   TiXmlElement *xresponse = doc->FirstChildElement("response");
-  if (xresponse != (TiXmlElement *)NULL) {
+  if (xresponse != nullptr) {
     int response_id;
     int response_id;
     if (xresponse->QueryIntAttribute("response_id", &response_id) == TIXML_SUCCESS) {
     if (xresponse->QueryIntAttribute("response_id", &response_id) == TIXML_SUCCESS) {
       // This is a response to a previous command-and-response.  Send it to
       // This is a response to a previous command-and-response.  Send it to
@@ -1350,7 +1350,7 @@ rt_handle_request(TiXmlDocument *doc) {
   }
   }
 
 
   TiXmlElement *xrequest = doc->FirstChildElement("request");
   TiXmlElement *xrequest = doc->FirstChildElement("request");
-  if (xrequest != (TiXmlElement *)NULL) {
+  if (xrequest != nullptr) {
     int instance_id;
     int instance_id;
     if (xrequest->QueryIntAttribute("instance_id", &instance_id) == TIXML_SUCCESS) {
     if (xrequest->QueryIntAttribute("instance_id", &instance_id) == TIXML_SUCCESS) {
       // Look up the particular instance this is related to.
       // Look up the particular instance this is related to.
@@ -1360,13 +1360,13 @@ rt_handle_request(TiXmlDocument *doc) {
       if (ii != _instances.end()) {
       if (ii != _instances.end()) {
         P3DInstance *inst = (*ii).second;
         P3DInstance *inst = (*ii).second;
         inst->add_raw_request(doc);
         inst->add_raw_request(doc);
-        doc = NULL;
+        doc = nullptr;
       }
       }
       RELEASE_LOCK(_instances_lock);
       RELEASE_LOCK(_instances_lock);
     }
     }
   }
   }
 
 
-  if (doc != NULL) {
+  if (doc != nullptr) {
     delete doc;
     delete doc;
   }
   }
 }
 }
@@ -1418,7 +1418,7 @@ win_create_process() {
     HANDLE handle = CreateFileW
     HANDLE handle = CreateFileW
       (log_pathname_w.c_str(), GENERIC_WRITE,
       (log_pathname_w.c_str(), GENERIC_WRITE,
        FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
        FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
-       NULL, CREATE_ALWAYS, 0, NULL);
+       nullptr, CREATE_ALWAYS, 0, nullptr);
     if (handle != INVALID_HANDLE_VALUE) {
     if (handle != INVALID_HANDLE_VALUE) {
       error_handle = handle;
       error_handle = handle;
       SetHandleInformation(error_handle, HANDLE_FLAG_INHERIT, HANDLE_FLAG_INHERIT);
       SetHandleInformation(error_handle, HANDLE_FLAG_INHERIT, HANDLE_FLAG_INHERIT);
@@ -1447,7 +1447,7 @@ win_create_process() {
   const wchar_t *start_dir_cstr;
   const wchar_t *start_dir_cstr;
   wstring start_dir_w;
   wstring start_dir_w;
   if (_keep_user_env) {
   if (_keep_user_env) {
-    start_dir_cstr = NULL;
+    start_dir_cstr = nullptr;
     nout << "Not changing working directory.\n";
     nout << "Not changing working directory.\n";
   } else {
   } else {
     string_to_wstring(start_dir_w, _start_dir);
     string_to_wstring(start_dir_w, _start_dir);
@@ -1479,7 +1479,7 @@ win_create_process() {
 
 
   PROCESS_INFORMATION process_info;
   PROCESS_INFORMATION process_info;
   BOOL result = CreateProcessW
   BOOL result = CreateProcessW
-    (p3dpython_exe_w.c_str(), command_line, NULL, NULL, TRUE,
+    (p3dpython_exe_w.c_str(), command_line, nullptr, nullptr, TRUE,
      CREATE_UNICODE_ENVIRONMENT, (void *)env_w.c_str(),
      CREATE_UNICODE_ENVIRONMENT, (void *)env_w.c_str(),
      start_dir_cstr, &startup_info, &process_info);
      start_dir_cstr, &startup_info, &process_info);
   bool started_program = (result != 0);
   bool started_program = (result != 0);
@@ -1577,7 +1577,7 @@ posix_create_process() {
       p = zero + 1;
       p = zero + 1;
       zero = _env.find('\0', p);
       zero = _env.find('\0', p);
     }
     }
-    ptrs.push_back((char *)NULL);
+    ptrs.push_back(nullptr);
 
 
     stringstream input_handle_stream;
     stringstream input_handle_stream;
     input_handle_stream << _input_handle;
     input_handle_stream << _input_handle;
@@ -1605,7 +1605,7 @@ posix_create_process() {
   // program" message.  Maybe I'll put in the more reliable test later.
   // program" message.  Maybe I'll put in the more reliable test later.
 
 
   struct timeval start;
   struct timeval start;
-  gettimeofday(&start, NULL);
+  gettimeofday(&start, nullptr);
   int start_ms = start.tv_sec * 1000 + start.tv_usec / 1000;
   int start_ms = start.tv_sec * 1000 + start.tv_usec / 1000;
 
 
   int status;
   int status;
@@ -1617,7 +1617,7 @@ posix_create_process() {
     }
     }
 
 
     struct timeval now;
     struct timeval now;
-    gettimeofday(&now, NULL);
+    gettimeofday(&now, nullptr);
     int now_ms = now.tv_sec * 1000 + now.tv_usec / 1000;
     int now_ms = now.tv_sec * 1000 + now.tv_usec / 1000;
     int elapsed = now_ms - start_ms;
     int elapsed = now_ms - start_ms;
     if (elapsed > 100) {
     if (elapsed > 100) {
@@ -1631,7 +1631,7 @@ posix_create_process() {
     struct timeval tv;
     struct timeval tv;
     tv.tv_sec = 0;
     tv.tv_sec = 0;
     tv.tv_usec = 1;
     tv.tv_usec = 1;
-    select(0, NULL, NULL, NULL, &tv);
+    select(0, nullptr, nullptr, nullptr, &tv);
     result = waitpid(child, &status, WNOHANG);
     result = waitpid(child, &status, WNOHANG);
   }
   }
 
 
@@ -1684,7 +1684,7 @@ p3dpython_thread_run() {
     _putenv(start);
     _putenv(start);
 #else
 #else
     const char *equals = strchr(start, '=');
     const char *equals = strchr(start, '=');
-    if (equals != NULL) {
+    if (equals != nullptr) {
       string variable(start, equals - start);
       string variable(start, equals - start);
       setenv(variable.c_str(), equals + 1, true);
       setenv(variable.c_str(), equals + 1, true);
     }
     }
@@ -1703,7 +1703,7 @@ p3dpython_thread_run() {
 #endif
 #endif
   SetErrorMode(0);
   SetErrorMode(0);
   HMODULE module = LoadLibrary(libp3dpython.c_str());
   HMODULE module = LoadLibrary(libp3dpython.c_str());
-  if (module == NULL) {
+  if (module == nullptr) {
     // Couldn't load the DLL.
     // Couldn't load the DLL.
     nout << "Couldn't load " << libp3dpython << "\n";
     nout << "Couldn't load " << libp3dpython << "\n";
     return;
     return;
@@ -1719,7 +1719,7 @@ p3dpython_thread_run() {
   libp3dpython += ".so";
   libp3dpython += ".so";
   #endif
   #endif
   void *module = dlopen(libp3dpython.c_str(), RTLD_LAZY | RTLD_LOCAL);
   void *module = dlopen(libp3dpython.c_str(), RTLD_LAZY | RTLD_LOCAL);
-  if (module == NULL) {
+  if (module == nullptr) {
     // Couldn't load the .so.
     // Couldn't load the .so.
     nout << "Couldn't load " << libp3dpython << "\n";
     nout << "Couldn't load " << libp3dpython << "\n";
     return;
     return;
@@ -1730,7 +1730,7 @@ p3dpython_thread_run() {
 #endif  // _WIN32
 #endif  // _WIN32
 
 
   run_p3dpython_func *run_p3dpython = (run_p3dpython_func *)get_func(module, "run_p3dpython");
   run_p3dpython_func *run_p3dpython = (run_p3dpython_func *)get_func(module, "run_p3dpython");
-  if (run_p3dpython == NULL) {
+  if (run_p3dpython == nullptr) {
     nout << "Couldn't find run_p3dpython\n";
     nout << "Couldn't find run_p3dpython\n";
     return;
     return;
   }
   }
@@ -1755,14 +1755,14 @@ get_env(string &value, const string &varname) {
   wstring varname_w;
   wstring varname_w;
   string_to_wstring(varname_w, varname);
   string_to_wstring(varname_w, varname);
   const wchar_t *vc = _wgetenv(varname_w.c_str());
   const wchar_t *vc = _wgetenv(varname_w.c_str());
-  if (vc == NULL) {
+  if (vc == nullptr) {
     return false;
     return false;
   }
   }
   wstring_to_string(value, vc);
   wstring_to_string(value, vc);
   return true;
   return true;
 #else  // _WIN32
 #else  // _WIN32
   const char *vc = getenv(varname.c_str());
   const char *vc = getenv(varname.c_str());
-  if (vc == NULL) {
+  if (vc == nullptr) {
     return false;
     return false;
   }
   }
   value = vc;
   value = vc;

+ 3 - 3
direct/src/plugin/p3dSplashWindow.cxx

@@ -348,10 +348,10 @@ read_image_data(ImageData &image, string &data,
   unsigned char *imgdata = stbi_load(image_filename.c_str(), &image._width,
   unsigned char *imgdata = stbi_load(image_filename.c_str(), &image._width,
                                      &image._height, &image._num_channels, 0);
                                      &image._height, &image._num_channels, 0);
 
 
-  if (imgdata == NULL) {
+  if (imgdata == nullptr) {
     nout << "Couldn't read splash file image: " << image_filename << "\n";
     nout << "Couldn't read splash file image: " << image_filename << "\n";
     const char *reason = stbi_failure_reason();
     const char *reason = stbi_failure_reason();
-    if (reason != NULL) {
+    if (reason != nullptr) {
       nout << "stbi_failure_reason: " << reason << "\n";
       nout << "stbi_failure_reason: " << reason << "\n";
     }
     }
     return false;
     return false;
@@ -492,7 +492,7 @@ set_mouse_data(int mouse_x, int mouse_y, bool mouse_down) {
  */
  */
 void P3DSplashWindow::
 void P3DSplashWindow::
 button_click_detected() {
 button_click_detected() {
-  assert(_inst != NULL);
+  assert(_inst != nullptr);
   nout << "Play button clicked by user\n";
   nout << "Play button clicked by user\n";
   _inst->splash_button_clicked_sub_thread();
   _inst->splash_button_clicked_sub_thread();
 }
 }

+ 1 - 1
direct/src/plugin/p3dWinSplashWindow.I

@@ -17,7 +17,7 @@
 inline P3DWinSplashWindow::WinImageData::
 inline P3DWinSplashWindow::WinImageData::
 WinImageData() {
 WinImageData() {
   _filename_changed = false;
   _filename_changed = false;
-  _bitmap = NULL;
+  _bitmap = nullptr;
 }
 }
 
 
 /**
 /**

+ 46 - 46
direct/src/plugin/p3dWinSplashWindow.cxx

@@ -28,14 +28,14 @@ P3DWinSplashWindow::
 P3DWinSplashWindow(P3DInstance *inst, bool make_visible) :
 P3DWinSplashWindow(P3DInstance *inst, bool make_visible) :
   P3DSplashWindow(inst, make_visible)
   P3DSplashWindow(inst, make_visible)
 {
 {
-  _thread = NULL;
+  _thread = nullptr;
   _thread_id = 0;
   _thread_id = 0;
-  _hwnd = NULL;
-  _font = NULL;
-  _fg_brush = NULL;
-  _bg_brush = NULL;
-  _bar_brush = NULL;
-  _bar_bg_brush = NULL;
+  _hwnd = nullptr;
+  _font = nullptr;
+  _fg_brush = nullptr;
+  _bg_brush = nullptr;
+  _bar_brush = nullptr;
+  _bar_bg_brush = nullptr;
   _thread_running = false;
   _thread_running = false;
   _install_progress = 0.0;
   _install_progress = 0.0;
   _progress_known = true;
   _progress_known = true;
@@ -97,7 +97,7 @@ set_visible(bool visible) {
 void P3DWinSplashWindow::
 void P3DWinSplashWindow::
 set_image_filename(const string &image_filename, ImagePlacement image_placement) {
 set_image_filename(const string &image_filename, ImagePlacement image_placement) {
   nout << "image_filename = " << image_filename << ", thread_id = " << _thread_id << "\n";
   nout << "image_filename = " << image_filename << ", thread_id = " << _thread_id << "\n";
-  WinImageData *image = NULL;
+  WinImageData *image = nullptr;
   switch (image_placement) {
   switch (image_placement) {
   case IP_background:
   case IP_background:
     image = &_background_image;
     image = &_background_image;
@@ -116,7 +116,7 @@ set_image_filename(const string &image_filename, ImagePlacement image_placement)
     image = &_button_click_image;
     image = &_button_click_image;
     break;
     break;
   }
   }
-  if (image != NULL) {
+  if (image != nullptr) {
     ACQUIRE_LOCK(_install_lock);
     ACQUIRE_LOCK(_install_lock);
     if (image->_filename != image_filename) {
     if (image->_filename != image_filename) {
       image->_filename = image_filename;
       image->_filename = image_filename;
@@ -211,13 +211,13 @@ request_keyboard_focus() {
 void P3DWinSplashWindow::
 void P3DWinSplashWindow::
 register_window_class() {
 register_window_class() {
   if (!_registered_window_class) {
   if (!_registered_window_class) {
-    HINSTANCE application = GetModuleHandle(NULL);
+    HINSTANCE application = GetModuleHandle(nullptr);
 
 
     WNDCLASS wc;
     WNDCLASS wc;
     ZeroMemory(&wc, sizeof(WNDCLASS));
     ZeroMemory(&wc, sizeof(WNDCLASS));
     wc.lpfnWndProc = (WNDPROC)st_window_proc;
     wc.lpfnWndProc = (WNDPROC)st_window_proc;
     wc.hInstance = application;
     wc.hInstance = application;
-    wc.hCursor = LoadCursor(NULL, IDC_ARROW);
+    wc.hCursor = LoadCursor(nullptr, IDC_ARROW);
     wc.lpszClassName = "panda3d_splash";
     wc.lpszClassName = "panda3d_splash";
 
 
     if (!RegisterClass(&wc)) {
     if (!RegisterClass(&wc)) {
@@ -234,7 +234,7 @@ register_window_class() {
 void P3DWinSplashWindow::
 void P3DWinSplashWindow::
 unregister_window_class() {
 unregister_window_class() {
   if (_registered_window_class) {
   if (_registered_window_class) {
-    HINSTANCE application = GetModuleHandle(NULL);
+    HINSTANCE application = GetModuleHandle(nullptr);
 
 
     if (!UnregisterClass("panda3d_splash", application)) {
     if (!UnregisterClass("panda3d_splash", application)) {
       nout << "Could not unregister window class panda3d_splash\n";
       nout << "Could not unregister window class panda3d_splash\n";
@@ -261,8 +261,8 @@ void P3DWinSplashWindow::
 start_thread() {
 start_thread() {
   _thread_continue = true;
   _thread_continue = true;
   _thread_running = true;
   _thread_running = true;
-  _thread = CreateThread(NULL, 0, &win_thread_run, this, 0, &_thread_id);
-  if (_thread == NULL) {
+  _thread = CreateThread(nullptr, 0, &win_thread_run, this, 0, &_thread_id);
+  if (_thread == nullptr) {
     // Thread never got started.
     // Thread never got started.
     _thread_running = false;
     _thread_running = false;
   }
   }
@@ -280,17 +280,17 @@ stop_thread() {
     PostThreadMessage(_thread_id, WM_USER, 0, 0);
     PostThreadMessage(_thread_id, WM_USER, 0, 0);
   }
   }
 
 
-  if (_thread != NULL){
+  if (_thread != nullptr){
     // If the thread doesn't close right away, call PeekMessage() to check for
     // If the thread doesn't close right away, call PeekMessage() to check for
     // Windows messages that the thread might be waiting for.
     // Windows messages that the thread might be waiting for.
     while (WaitForSingleObject(_thread, 200) == WAIT_TIMEOUT) {
     while (WaitForSingleObject(_thread, 200) == WAIT_TIMEOUT) {
       MSG msg;
       MSG msg;
-      PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE | PM_NOYIELD);
+      PeekMessage(&msg, nullptr, 0, 0, PM_NOREMOVE | PM_NOYIELD);
       nout << "Waiting for thread\n";
       nout << "Waiting for thread\n";
     }
     }
 
 
     CloseHandle(_thread);
     CloseHandle(_thread);
-    _thread = NULL;
+    _thread = nullptr;
 
 
     // Now that the thread has exited, we can safely close its window.  (We
     // Now that the thread has exited, we can safely close its window.  (We
     // couldn't close the window in the thread, because that would cause a
     // couldn't close the window in the thread, because that would cause a
@@ -310,7 +310,7 @@ thread_run() {
   int last_focus_seq = 0;
   int last_focus_seq = 0;
   MSG msg;
   MSG msg;
   int retval;
   int retval;
-  retval = GetMessage(&msg, NULL, 0, 0);
+  retval = GetMessage(&msg, nullptr, 0, 0);
   while (retval != 0 && _thread_continue) {
   while (retval != 0 && _thread_continue) {
     if (retval == -1) {
     if (retval == -1) {
       nout << "Error processing message queue.\n";
       nout << "Error processing message queue.\n";
@@ -329,7 +329,7 @@ thread_run() {
     if (_drawn_label != _install_label) {
     if (_drawn_label != _install_label) {
       // The label has changed.  Redraw.
       // The label has changed.  Redraw.
       _drawn_label = _install_label;
       _drawn_label = _install_label;
-      InvalidateRect(_hwnd, NULL, TRUE);
+      InvalidateRect(_hwnd, nullptr, TRUE);
     }
     }
 
 
     // Also redraw when the progress bar changes.
     // Also redraw when the progress bar changes.
@@ -349,25 +349,25 @@ thread_run() {
       _drawn_progress = _install_progress;
       _drawn_progress = _install_progress;
       _drawn_progress_known = _progress_known;
       _drawn_progress_known = _progress_known;
       _drawn_received_data = _received_data;
       _drawn_received_data = _received_data;
-      InvalidateRect(_hwnd, NULL, TRUE);
+      InvalidateRect(_hwnd, nullptr, TRUE);
     }
     }
 
 
     if (_drawn_bstate != _bstate) {
     if (_drawn_bstate != _bstate) {
       // The button has changed state.  Redraw it.
       // The button has changed state.  Redraw it.
       _drawn_bstate = _bstate;
       _drawn_bstate = _bstate;
-      InvalidateRect(_hwnd, NULL, TRUE);
+      InvalidateRect(_hwnd, nullptr, TRUE);
     }
     }
 
 
     if (_focus_seq != last_focus_seq) {
     if (_focus_seq != last_focus_seq) {
       last_focus_seq = _focus_seq;
       last_focus_seq = _focus_seq;
-      if (SetFocus(_hwnd) == NULL && GetLastError() != 0) {
+      if (SetFocus(_hwnd) == nullptr && GetLastError() != 0) {
         nout << "SetFocus(" << _hwnd << ") failed: " << GetLastError() << "\n";
         nout << "SetFocus(" << _hwnd << ") failed: " << GetLastError() << "\n";
       }
       }
     }
     }
 
 
     RELEASE_LOCK(_install_lock);
     RELEASE_LOCK(_install_lock);
 
 
-    retval = GetMessage(&msg, NULL, 0, 0);
+    retval = GetMessage(&msg, nullptr, 0, 0);
   }
   }
 
 
   // Tell our parent thread that we're done.
   // Tell our parent thread that we're done.
@@ -392,7 +392,7 @@ win_thread_run(LPVOID data) {
 void P3DWinSplashWindow::
 void P3DWinSplashWindow::
 make_window() {
 make_window() {
   register_window_class();
   register_window_class();
-  HINSTANCE application = GetModuleHandle(NULL);
+  HINSTANCE application = GetModuleHandle(nullptr);
 
 
   int width = 320;
   int width = 320;
   int height = 240;
   int height = 240;
@@ -420,7 +420,7 @@ make_window() {
     _hwnd =
     _hwnd =
       CreateWindow("panda3d_splash", "Panda3D", window_style,
       CreateWindow("panda3d_splash", "Panda3D", window_style,
                    x, y, width, height,
                    x, y, width, height,
-                   parent_hwnd, NULL, application, 0);
+                   parent_hwnd, nullptr, application, 0);
 
 
     if (!_hwnd) {
     if (!_hwnd) {
       nout << "Could not create embedded window!\n";
       nout << "Could not create embedded window!\n";
@@ -442,7 +442,7 @@ make_window() {
                    x, y,
                    x, y,
                    win_rect.right - win_rect.left,
                    win_rect.right - win_rect.left,
                    win_rect.bottom - win_rect.top,
                    win_rect.bottom - win_rect.top,
-                   NULL, NULL, application, 0);
+                   nullptr, nullptr, application, 0);
     if (!_hwnd) {
     if (!_hwnd) {
       nout << "Could not create toplevel window!\n";
       nout << "Could not create toplevel window!\n";
       return;
       return;
@@ -463,7 +463,7 @@ make_window() {
                       ANSI_CHARSET, OUT_OUTLINE_PRECIS, CLIP_DEFAULT_PRECIS,
                       ANSI_CHARSET, OUT_OUTLINE_PRECIS, CLIP_DEFAULT_PRECIS,
                       CLEARTYPE_QUALITY, VARIABLE_PITCH, _font_family.c_str());
                       CLEARTYPE_QUALITY, VARIABLE_PITCH, _font_family.c_str());
 
 
-  if (_font == NULL) {
+  if (_font == nullptr) {
     nout << "CreateFont failed: " << GetLastError() << "\n";
     nout << "CreateFont failed: " << GetLastError() << "\n";
     _font = (HFONT)GetStockObject(ANSI_VAR_FONT);
     _font = (HFONT)GetStockObject(ANSI_VAR_FONT);
   }
   }
@@ -490,7 +490,7 @@ update_image(WinImageData &image) {
   image.dump_image();
   image.dump_image();
 
 
   // Since we'll be displaying a new image, we need to refresh the window.
   // Since we'll be displaying a new image, we need to refresh the window.
-  InvalidateRect(_hwnd, NULL, TRUE);
+  InvalidateRect(_hwnd, nullptr, TRUE);
 
 
   // Go read the image.
   // Go read the image.
   string data;
   string data;
@@ -583,27 +583,27 @@ update_image(WinImageData &image) {
  */
  */
 void P3DWinSplashWindow::
 void P3DWinSplashWindow::
 close_window() {
 close_window() {
-  if (_hwnd != NULL) {
+  if (_hwnd != nullptr) {
     ShowWindow(_hwnd, SW_HIDE);
     ShowWindow(_hwnd, SW_HIDE);
     CloseWindow(_hwnd);
     CloseWindow(_hwnd);
-    _hwnd = NULL;
+    _hwnd = nullptr;
   }
   }
 
 
-  if (_fg_brush != NULL) {
+  if (_fg_brush != nullptr) {
     DeleteObject(_fg_brush);
     DeleteObject(_fg_brush);
-    _fg_brush = NULL;
+    _fg_brush = nullptr;
   }
   }
-  if (_bg_brush != NULL) {
+  if (_bg_brush != nullptr) {
     DeleteObject(_bg_brush);
     DeleteObject(_bg_brush);
-    _bg_brush = NULL;
+    _bg_brush = nullptr;
   }
   }
-  if (_bar_brush != NULL) {
+  if (_bar_brush != nullptr) {
     DeleteObject(_bar_brush);
     DeleteObject(_bar_brush);
-    _bar_brush = NULL;
+    _bar_brush = nullptr;
   }
   }
-  if (_bar_bg_brush != NULL) {
+  if (_bar_bg_brush != nullptr) {
     DeleteObject(_bar_bg_brush);
     DeleteObject(_bar_bg_brush);
-    _bar_bg_brush = NULL;
+    _bar_bg_brush = nullptr;
   }
   }
 
 
   _background_image.dump_image();
   _background_image.dump_image();
@@ -677,7 +677,7 @@ paint_window(HDC dc) {
  */
  */
 bool P3DWinSplashWindow::
 bool P3DWinSplashWindow::
 paint_image(HDC dc, const WinImageData &image, bool use_alpha) {
 paint_image(HDC dc, const WinImageData &image, bool use_alpha) {
-  if (image._bitmap == NULL) {
+  if (image._bitmap == nullptr) {
     return false;
     return false;
   }
   }
 
 
@@ -738,7 +738,7 @@ paint_image(HDC dc, const WinImageData &image, bool use_alpha) {
     }
     }
   }
   }
 
 
-  SelectObject(mem_dc, NULL);
+  SelectObject(mem_dc, nullptr);
   DeleteDC(mem_dc);
   DeleteDC(mem_dc);
 
 
   return true;
   return true;
@@ -831,7 +831,7 @@ window_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) {
     break;
     break;
 
 
   case WM_SIZE:
   case WM_SIZE:
-    InvalidateRect(hwnd, NULL, FALSE);
+    InvalidateRect(hwnd, nullptr, FALSE);
     break;
     break;
 
 
   case WM_ERASEBKGND:
   case WM_ERASEBKGND:
@@ -869,7 +869,7 @@ window_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) {
     {
     {
       int elapsed = GetTickCount() - _request_focus_tick;
       int elapsed = GetTickCount() - _request_focus_tick;
       if (elapsed < 200) {
       if (elapsed < 200) {
-        if (SetFocus(_hwnd) == NULL && GetLastError() != 0) {
+        if (SetFocus(_hwnd) == nullptr && GetLastError() != 0) {
           nout << "Secondary SetFocus failed: " << GetLastError() << "\n";
           nout << "Secondary SetFocus failed: " << GetLastError() << "\n";
         }
         }
       }
       }
@@ -889,7 +889,7 @@ window_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) {
   case WM_KEYDOWN:
   case WM_KEYDOWN:
   case WM_SYSKEYUP:
   case WM_SYSKEYUP:
   case WM_KEYUP:
   case WM_KEYUP:
-    if (_inst->get_session() != NULL) {
+    if (_inst->get_session() != nullptr) {
       _inst->get_session()->send_windows_message(_inst, msg, wparam, lparam);
       _inst->get_session()->send_windows_message(_inst, msg, wparam, lparam);
     }
     }
     break;
     break;
@@ -904,7 +904,7 @@ window_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) {
 LRESULT P3DWinSplashWindow::
 LRESULT P3DWinSplashWindow::
 st_window_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) {
 st_window_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) {
   LONG_PTR self = GetWindowLongPtr(hwnd, GWLP_USERDATA);
   LONG_PTR self = GetWindowLongPtr(hwnd, GWLP_USERDATA);
-  if (self == NULL) {
+  if (self == nullptr) {
     // We haven't assigned the pointer yet.
     // We haven't assigned the pointer yet.
     return DefWindowProc(hwnd, msg, wparam, lparam);
     return DefWindowProc(hwnd, msg, wparam, lparam);
   }
   }
@@ -917,9 +917,9 @@ st_window_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) {
  */
  */
 void P3DWinSplashWindow::WinImageData::
 void P3DWinSplashWindow::WinImageData::
 dump_image() {
 dump_image() {
-  if (_bitmap != NULL) {
+  if (_bitmap != nullptr) {
     DeleteObject(_bitmap);
     DeleteObject(_bitmap);
-    _bitmap = NULL;
+    _bitmap = nullptr;
   }
   }
 }
 }
 
 

+ 26 - 26
direct/src/plugin/p3dX11SplashWindow.cxx

@@ -39,12 +39,12 @@ P3DX11SplashWindow(P3DInstance *inst, bool make_visible) :
   INIT_THREAD(_read_thread);
   INIT_THREAD(_read_thread);
 
 
   // Init for subprocess
   // Init for subprocess
-  _composite_image = NULL;
+  _composite_image = nullptr;
   _needs_new_composite = false;
   _needs_new_composite = false;
   _display = None;
   _display = None;
   _window = None;
   _window = None;
   _screen = 0;
   _screen = 0;
-  _font = NULL;
+  _font = nullptr;
   _graphics_context = None;
   _graphics_context = None;
   _bar_context = None;
   _bar_context = None;
   _bar_bg_context = None;
   _bar_bg_context = None;
@@ -285,7 +285,7 @@ stop_subprocess() {
 
 
   // Wait for a certain amount of time for the process to stop by itself.
   // Wait for a certain amount of time for the process to stop by itself.
   struct timeval start;
   struct timeval start;
-  gettimeofday(&start, NULL);
+  gettimeofday(&start, nullptr);
   int start_ms = start.tv_sec * 1000 + start.tv_usec / 1000;
   int start_ms = start.tv_sec * 1000 + start.tv_usec / 1000;
 
 
   int status;
   int status;
@@ -297,7 +297,7 @@ stop_subprocess() {
     }
     }
 
 
     struct timeval now;
     struct timeval now;
-    gettimeofday(&now, NULL);
+    gettimeofday(&now, nullptr);
     int now_ms = now.tv_sec * 1000 + now.tv_usec / 1000;
     int now_ms = now.tv_sec * 1000 + now.tv_usec / 1000;
     int elapsed = now_ms - start_ms;
     int elapsed = now_ms - start_ms;
 
 
@@ -313,7 +313,7 @@ stop_subprocess() {
     struct timeval tv;
     struct timeval tv;
     tv.tv_sec = 0;
     tv.tv_sec = 0;
     tv.tv_usec = 1;
     tv.tv_usec = 1;
-    select(0, NULL, NULL, NULL, &tv);
+    select(0, nullptr, nullptr, nullptr, &tv);
     result = waitpid(_subprocess_pid, &status, WNOHANG);
     result = waitpid(_subprocess_pid, &status, WNOHANG);
   }
   }
 
 
@@ -406,7 +406,7 @@ void P3DX11SplashWindow::
 rt_thread_run() {
 rt_thread_run() {
   while (true) {
   while (true) {
     TiXmlDocument *doc = read_xml(_pipe_read, nout);
     TiXmlDocument *doc = read_xml(_pipe_read, nout);
-    if (doc == NULL) {
+    if (doc == nullptr) {
       // Some error on reading.  The splash window must have gone away, e.g.
       // Some error on reading.  The splash window must have gone away, e.g.
       // because the user explicitly closed it; tell the instance to exit.
       // because the user explicitly closed it; tell the instance to exit.
       _inst->request_stop_sub_thread();
       _inst->request_stop_sub_thread();
@@ -648,7 +648,7 @@ subprocess_run() {
       tv.tv_sec = 0;
       tv.tv_sec = 0;
       tv.tv_usec = 1000;   // 1 usec is not enough.
       tv.tv_usec = 1000;   // 1 usec is not enough.
 
 
-      int result = select(read_fd + 1, &fds, NULL, NULL, &tv);
+      int result = select(read_fd + 1, &fds, nullptr, nullptr, &tv);
       if (result > 0) {
       if (result > 0) {
         // There is some noise on the pipe, so read it.
         // There is some noise on the pipe, so read it.
         input_ready = true;
         input_ready = true;
@@ -668,7 +668,7 @@ subprocess_run() {
     struct timespec req;
     struct timespec req;
     req.tv_sec = 0;
     req.tv_sec = 0;
     req.tv_nsec = 50000000;  // 50 ms
     req.tv_nsec = 50000000;  // 50 ms
-    nanosleep(&req, NULL);
+    nanosleep(&req, nullptr);
   }
   }
 
 
   close_window();
   close_window();
@@ -680,22 +680,22 @@ subprocess_run() {
 void P3DX11SplashWindow::
 void P3DX11SplashWindow::
 receive_command() {
 receive_command() {
   TiXmlDocument *doc = read_xml(_pipe_read, nout);
   TiXmlDocument *doc = read_xml(_pipe_read, nout);
-  if (doc == NULL) {
+  if (doc == nullptr) {
     // Pipe closed or something.
     // Pipe closed or something.
     _subprocess_continue = false;
     _subprocess_continue = false;
     return;
     return;
   }
   }
 
 
   TiXmlElement *xcommand = doc->FirstChildElement("command");
   TiXmlElement *xcommand = doc->FirstChildElement("command");
-  if (xcommand != NULL) {
+  if (xcommand != nullptr) {
     const char *cmd = xcommand->Attribute("cmd");
     const char *cmd = xcommand->Attribute("cmd");
-    if (cmd != NULL) {
+    if (cmd != nullptr) {
       if (strcmp(cmd, "exit") == 0) {
       if (strcmp(cmd, "exit") == 0) {
         _subprocess_continue = false;
         _subprocess_continue = false;
 
 
       } else if (strcmp(cmd, "set_visible") == 0) {
       } else if (strcmp(cmd, "set_visible") == 0) {
         int visible = 0;
         int visible = 0;
-        if (xcommand->Attribute("visible", &visible) != NULL) {
+        if (xcommand->Attribute("visible", &visible) != nullptr) {
           _visible = visible;
           _visible = visible;
           if (_visible) {
           if (_visible) {
             XMapWindow(_display, _window);
             XMapWindow(_display, _window);
@@ -707,10 +707,10 @@ receive_command() {
       } else if (strcmp(cmd, "set_image_filename") == 0) {
       } else if (strcmp(cmd, "set_image_filename") == 0) {
         const string *image_filename = xcommand->Attribute(string("image_filename"));
         const string *image_filename = xcommand->Attribute(string("image_filename"));
         int image_placement;
         int image_placement;
-        if (image_filename != NULL &&
+        if (image_filename != nullptr &&
             xcommand->QueryIntAttribute("image_placement", &image_placement) == TIXML_SUCCESS) {
             xcommand->QueryIntAttribute("image_placement", &image_placement) == TIXML_SUCCESS) {
 
 
-          X11ImageData *image = NULL;
+          X11ImageData *image = nullptr;
           switch ((ImagePlacement)image_placement) {
           switch ((ImagePlacement)image_placement) {
           case IP_background:
           case IP_background:
             image = &_background_image;
             image = &_background_image;
@@ -732,7 +732,7 @@ receive_command() {
           case IP_none:
           case IP_none:
             break;
             break;
           }
           }
-          if (image != NULL) {
+          if (image != nullptr) {
             if (image->_filename != *image_filename) {
             if (image->_filename != *image_filename) {
               image->_filename = *image_filename;
               image->_filename = *image_filename;
               image->_filename_changed = true;
               image->_filename_changed = true;
@@ -742,7 +742,7 @@ receive_command() {
 
 
       } else if (strcmp(cmd, "set_install_label") == 0) {
       } else if (strcmp(cmd, "set_install_label") == 0) {
         const char *str = xcommand->Attribute("install_label");
         const char *str = xcommand->Attribute("install_label");
-        if (str != NULL) {
+        if (str != nullptr) {
           if (_install_label != string(str)) {
           if (_install_label != string(str)) {
             _install_label = str;
             _install_label = str;
           }
           }
@@ -775,7 +775,7 @@ receive_command() {
  */
  */
 void P3DX11SplashWindow::
 void P3DX11SplashWindow::
 redraw() {
 redraw() {
-  if (_composite_image == NULL) {
+  if (_composite_image == nullptr) {
     // Clear the whole window, if there's no image.
     // Clear the whole window, if there's no image.
     XClearWindow(_display, _window);
     XClearWindow(_display, _window);
 
 
@@ -823,10 +823,10 @@ make_window() {
 
 
   // _display = (X11_Display*) _wparams.get_parent_window()._xdisplay;
   // _display = (X11_Display*) _wparams.get_parent_window()._xdisplay;
   // _own_display = false; if (_display == 0) {
   // _own_display = false; if (_display == 0) {
-    _display = XOpenDisplay(NULL);
+    _display = XOpenDisplay(nullptr);
     _own_display = true;
     _own_display = true;
   // }
   // }
-  assert(_display != NULL);
+  assert(_display != nullptr);
   _screen = DefaultScreen(_display);
   _screen = DefaultScreen(_display);
 
 
   int x = _wparams.get_win_x();
   int x = _wparams.get_win_x();
@@ -972,7 +972,7 @@ setup_gc() {
              _font_family.c_str(), weight_name, style, _font_size);
              _font_family.c_str(), weight_name, style, _font_size);
 
 
     _font = XLoadQueryFont(_display, font_name);
     _font = XLoadQueryFont(_display, font_name);
-    if (_font != NULL) {
+    if (_font != nullptr) {
       break;
       break;
     }
     }
     nout << "Font " << font_name << " unavailable.\n";
     nout << "Font " << font_name << " unavailable.\n";
@@ -984,14 +984,14 @@ setup_gc() {
                _font_family.c_str(), weight_name, style2, _font_size);
                _font_family.c_str(), weight_name, style2, _font_size);
 
 
       _font = XLoadQueryFont(_display, font_name);
       _font = XLoadQueryFont(_display, font_name);
-      if (_font != NULL) {
+      if (_font != nullptr) {
         break;
         break;
       }
       }
       nout << "Font " << font_name << " unavailable.\n";
       nout << "Font " << font_name << " unavailable.\n";
     }
     }
   }
   }
 
 
-  if (_font != NULL) {
+  if (_font != nullptr) {
     nout << "Loaded font " << font_name << "\n";
     nout << "Loaded font " << font_name << "\n";
   } else {
   } else {
     nout << "Using fallback font 6x13.\n";
     nout << "Using fallback font 6x13.\n";
@@ -1054,9 +1054,9 @@ setup_gc() {
  */
  */
 void P3DX11SplashWindow::
 void P3DX11SplashWindow::
 close_window() {
 close_window() {
-  if (_composite_image != NULL) {
+  if (_composite_image != nullptr) {
     XDestroyImage(_composite_image);
     XDestroyImage(_composite_image);
-    _composite_image = NULL;
+    _composite_image = nullptr;
   }
   }
 
 
   if (_bar_context != None) {
   if (_bar_context != None) {
@@ -1136,9 +1136,9 @@ update_image(X11ImageData &image) {
  */
  */
 void P3DX11SplashWindow::
 void P3DX11SplashWindow::
 compose_image() {
 compose_image() {
-  if (_composite_image != NULL) {
+  if (_composite_image != nullptr) {
     XDestroyImage(_composite_image);
     XDestroyImage(_composite_image);
-    _composite_image = NULL;
+    _composite_image = nullptr;
   }
   }
   _needs_new_composite = false;
   _needs_new_composite = false;
 
 

+ 5 - 5
direct/src/plugin/p3d_lock.h

@@ -44,15 +44,15 @@ public:
 
 
 // Threads.
 // Threads.
 #define THREAD HANDLE
 #define THREAD HANDLE
-#define INIT_THREAD(thread) (thread) = NULL;
+#define INIT_THREAD(thread) (thread) = nullptr;
 #define SPAWN_THREAD(thread, callback_function, this)                   \
 #define SPAWN_THREAD(thread, callback_function, this)                   \
-  (thread) = CreateThread(NULL, 0, &win_ ## callback_function, (this), 0, NULL)
+  (thread) = CreateThread(nullptr, 0, &win_ ## callback_function, (this), 0, nullptr)
 #define JOIN_THREAD(thread)                     \
 #define JOIN_THREAD(thread)                     \
   {                                             \
   {                                             \
-    assert((thread) != NULL);                   \
+    assert((thread) != nullptr);                   \
     WaitForSingleObject((thread), INFINITE);    \
     WaitForSingleObject((thread), INFINITE);    \
     CloseHandle((thread));                      \
     CloseHandle((thread));                      \
-    (thread) = NULL;                            \
+    (thread) = nullptr;                            \
   }
   }
 
 
 // Declare this macro within your class declaration.  This implements the
 // Declare this macro within your class declaration.  This implements the
@@ -115,7 +115,7 @@ public:
   static void *                                               \
   static void *                                               \
   posix_ ## callback_function(void *data) {                   \
   posix_ ## callback_function(void *data) {                   \
     ((class *)data)->callback_function();                     \
     ((class *)data)->callback_function();                     \
-    return NULL;                                              \
+    return nullptr;                                              \
   }
   }
 
 
 #endif  // _WIN32
 #endif  // _WIN32

+ 33 - 33
direct/src/plugin/p3d_plugin.cxx

@@ -61,35 +61,35 @@ P3D_initialize(int api_version, const char *contents_filename,
   }
   }
   ACQUIRE_LOCK(_api_lock);
   ACQUIRE_LOCK(_api_lock);
 
 
-  if (contents_filename == NULL){
+  if (contents_filename == nullptr){
     contents_filename = "";
     contents_filename = "";
   }
   }
 
 
-  if (host_url == NULL){
+  if (host_url == nullptr){
     host_url = "";
     host_url = "";
   }
   }
 
 
-  if (platform == NULL) {
+  if (platform == nullptr) {
     platform = "";
     platform = "";
   }
   }
 
 
-  if (log_directory == NULL) {
+  if (log_directory == nullptr) {
     log_directory = "";
     log_directory = "";
   }
   }
 
 
-  if (log_basename == NULL) {
+  if (log_basename == nullptr) {
     log_basename = "";
     log_basename = "";
   }
   }
 
 
-  if (api_version < 12 || root_dir == NULL) {
+  if (api_version < 12 || root_dir == nullptr) {
     root_dir = "";
     root_dir = "";
   }
   }
 
 
-  if (api_version < 16 || host_dir == NULL) {
+  if (api_version < 16 || host_dir == nullptr) {
     host_dir = "";
     host_dir = "";
   }
   }
 
 
-  if (api_version < 17 || start_dir == NULL) {
+  if (api_version < 17 || start_dir == nullptr) {
     start_dir = "";
     start_dir = "";
   }
   }
 
 
@@ -116,10 +116,10 @@ P3D_set_plugin_version(int major, int minor, int sequence,
                        const char *coreapi_timestamp_str,
                        const char *coreapi_timestamp_str,
                        const char *coreapi_set_ver) {
                        const char *coreapi_set_ver) {
   assert(P3DInstanceManager::get_global_ptr()->is_initialized());
   assert(P3DInstanceManager::get_global_ptr()->is_initialized());
-  if (distributor == NULL) {
+  if (distributor == nullptr) {
     distributor = "";
     distributor = "";
   }
   }
-  if (coreapi_host_url == NULL) {
+  if (coreapi_host_url == nullptr) {
     coreapi_host_url = "";
     coreapi_host_url = "";
   }
   }
 
 
@@ -133,10 +133,10 @@ P3D_set_plugin_version(int major, int minor, int sequence,
   } else {
   } else {
     // Passing a time_t causes problems with disagreements about word size, so
     // Passing a time_t causes problems with disagreements about word size, so
     // since version 15 we pass it as a string.
     // since version 15 we pass it as a string.
-    coreapi_timestamp = strtoul(coreapi_timestamp_str, NULL, 10);
+    coreapi_timestamp = strtoul(coreapi_timestamp_str, nullptr, 10);
   }
   }
 
 
-  if (inst_mgr->get_api_version() < 14 || coreapi_set_ver == NULL) {
+  if (inst_mgr->get_api_version() < 14 || coreapi_set_ver == nullptr) {
     // Prior to version 14 this parameter was absent.
     // Prior to version 14 this parameter was absent.
     coreapi_set_ver = "";
     coreapi_set_ver = "";
   }
   }
@@ -150,7 +150,7 @@ P3D_set_plugin_version(int major, int minor, int sequence,
 void
 void
 P3D_set_super_mirror(const char *super_mirror_url) {
 P3D_set_super_mirror(const char *super_mirror_url) {
   assert(P3DInstanceManager::get_global_ptr()->is_initialized());
   assert(P3DInstanceManager::get_global_ptr()->is_initialized());
-  if (super_mirror_url == NULL) {
+  if (super_mirror_url == nullptr) {
     super_mirror_url = "";
     super_mirror_url = "";
   }
   }
 
 
@@ -177,7 +177,7 @@ bool
 P3D_instance_start(P3D_instance *instance, bool is_local,
 P3D_instance_start(P3D_instance *instance, bool is_local,
                    const char *p3d_filename, int p3d_offset) {
                    const char *p3d_filename, int p3d_offset) {
   assert(P3DInstanceManager::get_global_ptr()->is_initialized());
   assert(P3DInstanceManager::get_global_ptr()->is_initialized());
-  if (p3d_filename == NULL) {
+  if (p3d_filename == nullptr) {
     p3d_filename = "";
     p3d_filename = "";
   }
   }
   ACQUIRE_LOCK(_api_lock);
   ACQUIRE_LOCK(_api_lock);
@@ -190,7 +190,7 @@ P3D_instance_start(P3D_instance *instance, bool is_local,
 
 
   P3DInstance *inst = inst_mgr->validate_instance(instance);
   P3DInstance *inst = inst_mgr->validate_instance(instance);
   bool result = false;
   bool result = false;
-  if (inst != NULL) {
+  if (inst != nullptr) {
     // We don't actually start it immediately; the instance will have to
     // We don't actually start it immediately; the instance will have to
     // download the p3d url and read it, reading the python version, before it
     // download the p3d url and read it, reading the python version, before it
     // can start.
     // can start.
@@ -204,14 +204,14 @@ P3D_instance_start(P3D_instance *instance, bool is_local,
 int
 int
 P3D_instance_start_stream(P3D_instance *instance, const char *p3d_url) {
 P3D_instance_start_stream(P3D_instance *instance, const char *p3d_url) {
   assert(P3DInstanceManager::get_global_ptr()->is_initialized());
   assert(P3DInstanceManager::get_global_ptr()->is_initialized());
-  if (p3d_url == NULL) {
+  if (p3d_url == nullptr) {
     p3d_url = "";
     p3d_url = "";
   }
   }
   ACQUIRE_LOCK(_api_lock);
   ACQUIRE_LOCK(_api_lock);
   P3DInstanceManager *inst_mgr = P3DInstanceManager::get_global_ptr();
   P3DInstanceManager *inst_mgr = P3DInstanceManager::get_global_ptr();
   P3DInstance *inst = inst_mgr->validate_instance(instance);
   P3DInstance *inst = inst_mgr->validate_instance(instance);
   int result = -1;
   int result = -1;
-  if (inst != NULL) {
+  if (inst != nullptr) {
     result = inst_mgr->make_p3d_stream(inst, p3d_url);
     result = inst_mgr->make_p3d_stream(inst, p3d_url);
   }
   }
   RELEASE_LOCK(_api_lock);
   RELEASE_LOCK(_api_lock);
@@ -224,7 +224,7 @@ P3D_instance_finish(P3D_instance *instance) {
   ACQUIRE_LOCK(_api_lock);
   ACQUIRE_LOCK(_api_lock);
   P3DInstanceManager *inst_mgr = P3DInstanceManager::get_global_ptr();
   P3DInstanceManager *inst_mgr = P3DInstanceManager::get_global_ptr();
   P3DInstance *inst = inst_mgr->validate_instance(instance);
   P3DInstance *inst = inst_mgr->validate_instance(instance);
-  if (inst != NULL) {
+  if (inst != nullptr) {
     inst_mgr->finish_instance(inst);
     inst_mgr->finish_instance(inst);
   }
   }
   RELEASE_LOCK(_api_lock);
   RELEASE_LOCK(_api_lock);
@@ -243,7 +243,7 @@ P3D_instance_setup_window(P3D_instance *instance,
   ACQUIRE_LOCK(_api_lock);
   ACQUIRE_LOCK(_api_lock);
   P3DInstanceManager *inst_mgr = P3DInstanceManager::get_global_ptr();
   P3DInstanceManager *inst_mgr = P3DInstanceManager::get_global_ptr();
   P3DInstance *inst = inst_mgr->validate_instance(instance);
   P3DInstance *inst = inst_mgr->validate_instance(instance);
-  if (inst != NULL) {
+  if (inst != nullptr) {
     inst->set_wparams(wparams);
     inst->set_wparams(wparams);
   }
   }
   RELEASE_LOCK(_api_lock);
   RELEASE_LOCK(_api_lock);
@@ -356,7 +356,7 @@ P3D_object_eval(P3D_object *object, const char *expression) {
 void
 void
 P3D_object_incref(P3D_object *object) {
 P3D_object_incref(P3D_object *object) {
   assert(P3DInstanceManager::get_global_ptr()->is_initialized());
   assert(P3DInstanceManager::get_global_ptr()->is_initialized());
-  if (object != NULL) {
+  if (object != nullptr) {
     ACQUIRE_LOCK(_api_lock);
     ACQUIRE_LOCK(_api_lock);
     P3D_OBJECT_INCREF(object);
     P3D_OBJECT_INCREF(object);
     RELEASE_LOCK(_api_lock);
     RELEASE_LOCK(_api_lock);
@@ -366,7 +366,7 @@ P3D_object_incref(P3D_object *object) {
 void
 void
 P3D_object_decref(P3D_object *object) {
 P3D_object_decref(P3D_object *object) {
   assert(P3DInstanceManager::get_global_ptr()->is_initialized());
   assert(P3DInstanceManager::get_global_ptr()->is_initialized());
-  if (object != NULL) {
+  if (object != nullptr) {
     ACQUIRE_LOCK(_api_lock);
     ACQUIRE_LOCK(_api_lock);
     P3D_OBJECT_DECREF(object);
     P3D_OBJECT_DECREF(object);
     RELEASE_LOCK(_api_lock);
     RELEASE_LOCK(_api_lock);
@@ -461,8 +461,8 @@ P3D_instance_get_panda_script_object(P3D_instance *instance) {
 
 
   P3DInstanceManager *inst_mgr = P3DInstanceManager::get_global_ptr();
   P3DInstanceManager *inst_mgr = P3DInstanceManager::get_global_ptr();
   P3DInstance *inst = inst_mgr->validate_instance(instance);
   P3DInstance *inst = inst_mgr->validate_instance(instance);
-  P3D_object *result = NULL;
-  if (inst != NULL) {
+  P3D_object *result = nullptr;
+  if (inst != nullptr) {
     result = inst->get_panda_script_object();
     result = inst->get_panda_script_object();
   }
   }
 
 
@@ -478,7 +478,7 @@ P3D_instance_set_browser_script_object(P3D_instance *instance,
 
 
   P3DInstanceManager *inst_mgr = P3DInstanceManager::get_global_ptr();
   P3DInstanceManager *inst_mgr = P3DInstanceManager::get_global_ptr();
   P3DInstance *inst = inst_mgr->validate_instance(instance);
   P3DInstance *inst = inst_mgr->validate_instance(instance);
-  if (inst != NULL) {
+  if (inst != nullptr) {
     inst->set_browser_script_object(object);
     inst->set_browser_script_object(object);
   }
   }
 
 
@@ -493,8 +493,8 @@ P3D_instance_get_request(P3D_instance *instance) {
 
 
   P3DInstanceManager *inst_mgr = P3DInstanceManager::get_global_ptr();
   P3DInstanceManager *inst_mgr = P3DInstanceManager::get_global_ptr();
   P3DInstance *inst = inst_mgr->validate_instance(instance);
   P3DInstance *inst = inst_mgr->validate_instance(instance);
-  P3D_request *result = NULL;
-  if (inst != NULL) {
+  P3D_request *result = nullptr;
+  if (inst != nullptr) {
     result = inst->get_request();
     result = inst->get_request();
   }
   }
 
 
@@ -509,7 +509,7 @@ P3D_check_request(double timeout) {
   P3DInstanceManager *inst_mgr = P3DInstanceManager::get_global_ptr();
   P3DInstanceManager *inst_mgr = P3DInstanceManager::get_global_ptr();
   P3D_instance *inst = inst_mgr->check_request();
   P3D_instance *inst = inst_mgr->check_request();
 
 
-  if (inst != NULL || timeout <= 0.0) {
+  if (inst != nullptr || timeout <= 0.0) {
     RELEASE_LOCK(_api_lock);
     RELEASE_LOCK(_api_lock);
     return inst;
     return inst;
   }
   }
@@ -518,7 +518,7 @@ P3D_check_request(double timeout) {
   int stop_tick = int(GetTickCount() + timeout * 1000.0);
   int stop_tick = int(GetTickCount() + timeout * 1000.0);
 #else
 #else
   struct timeval stop_time;
   struct timeval stop_time;
-  gettimeofday(&stop_time, NULL);
+  gettimeofday(&stop_time, nullptr);
 
 
   int seconds = (int)floor(timeout);
   int seconds = (int)floor(timeout);
   stop_time.tv_sec += seconds;
   stop_time.tv_sec += seconds;
@@ -535,7 +535,7 @@ P3D_check_request(double timeout) {
   ACQUIRE_LOCK(_api_lock);
   ACQUIRE_LOCK(_api_lock);
   inst = inst_mgr->check_request();
   inst = inst_mgr->check_request();
 
 
-  while (inst == NULL && inst_mgr->get_num_instances() != 0) {
+  while (inst == nullptr && inst_mgr->get_num_instances() != 0) {
 #ifdef _WIN32
 #ifdef _WIN32
     int remaining_ticks = stop_tick - GetTickCount();
     int remaining_ticks = stop_tick - GetTickCount();
     if (remaining_ticks <= 0) {
     if (remaining_ticks <= 0) {
@@ -544,7 +544,7 @@ P3D_check_request(double timeout) {
     timeout = remaining_ticks * 0.001;
     timeout = remaining_ticks * 0.001;
 #else
 #else
     struct timeval now;
     struct timeval now;
-    gettimeofday(&now, NULL);
+    gettimeofday(&now, nullptr);
 
 
     struct timeval remaining;
     struct timeval remaining;
     remaining.tv_sec = stop_time.tv_sec - now.tv_sec;
     remaining.tv_sec = stop_time.tv_sec - now.tv_sec;
@@ -574,7 +574,7 @@ void
 P3D_request_finish(P3D_request *request, bool handled) {
 P3D_request_finish(P3D_request *request, bool handled) {
   assert(P3DInstanceManager::get_global_ptr()->is_initialized());
   assert(P3DInstanceManager::get_global_ptr()->is_initialized());
   ACQUIRE_LOCK(_api_lock);
   ACQUIRE_LOCK(_api_lock);
-  if (request != (P3D_request *)NULL) {
+  if (request != nullptr) {
     P3DInstance::finish_request(request, handled);
     P3DInstance::finish_request(request, handled);
   }
   }
   RELEASE_LOCK(_api_lock);
   RELEASE_LOCK(_api_lock);
@@ -593,7 +593,7 @@ P3D_instance_feed_url_stream(P3D_instance *instance, int unique_id,
   P3DInstanceManager *inst_mgr = P3DInstanceManager::get_global_ptr();
   P3DInstanceManager *inst_mgr = P3DInstanceManager::get_global_ptr();
   P3DInstance *inst = inst_mgr->validate_instance(instance);
   P3DInstance *inst = inst_mgr->validate_instance(instance);
   bool result = false;
   bool result = false;
-  if (inst != NULL) {
+  if (inst != nullptr) {
     result = inst->
     result = inst->
       feed_url_stream(unique_id, result_code, http_status_code,
       feed_url_stream(unique_id, result_code, http_status_code,
                       total_expected_data,
                       total_expected_data,
@@ -613,7 +613,7 @@ P3D_instance_handle_event(P3D_instance *instance,
   P3DInstanceManager *inst_mgr = P3DInstanceManager::get_global_ptr();
   P3DInstanceManager *inst_mgr = P3DInstanceManager::get_global_ptr();
   P3DInstance *inst = inst_mgr->validate_instance(instance);
   P3DInstance *inst = inst_mgr->validate_instance(instance);
   bool result = false;
   bool result = false;
-  if (inst != NULL) {
+  if (inst != nullptr) {
     result = inst->handle_event(*event);
     result = inst->handle_event(*event);
   }
   }
 
 

+ 1 - 1
direct/src/plugin/p3d_plugin.h

@@ -633,7 +633,7 @@ struct _P3D_object {
 
 
 #define P3D_OBJECT_INCREF(object) (++(object)->_ref_count)
 #define P3D_OBJECT_INCREF(object) (++(object)->_ref_count)
 #define P3D_OBJECT_DECREF(object) { if (--(object)->_ref_count <= 0) { (object)->_class->_finish((object)); } }
 #define P3D_OBJECT_DECREF(object) { if (--(object)->_ref_count <= 0) { (object)->_class->_finish((object)); } }
-#define P3D_OBJECT_XDECREF(object) { if ((object) != (P3D_object *)NULL) { P3D_OBJECT_DECREF(object); } }
+#define P3D_OBJECT_XDECREF(object) { if ((object) != nullptr) { P3D_OBJECT_DECREF(object); } }
 
 
 /* End of method pointer definitions.  The following function types
 /* End of method pointer definitions.  The following function types
    are once again meant to define actual function pointers to be found
    are once again meant to define actual function pointers to be found

+ 1 - 1
direct/src/plugin/p3d_plugin_common.h

@@ -46,7 +46,7 @@ extern LOCK _api_lock;
 // A convenience function for formatting a generic P3D_object to an ostream.
 // A convenience function for formatting a generic P3D_object to an ostream.
 inline ostream &
 inline ostream &
 operator << (ostream &out, P3D_object &value) {
 operator << (ostream &out, P3D_object &value) {
-  int size = P3D_OBJECT_GET_REPR(&value, NULL, 0);
+  int size = P3D_OBJECT_GET_REPR(&value, nullptr, 0);
   char *buffer = new char[size];
   char *buffer = new char[size];
   P3D_OBJECT_GET_REPR(&value, buffer, size);
   P3D_OBJECT_GET_REPR(&value, buffer, size);
   out.write(buffer, size);
   out.write(buffer, size);

+ 1 - 1
direct/src/plugin/run_p3dpython.cxx

@@ -28,6 +28,6 @@ run_p3dpython(const char *program_name, const char *archive_file,
                      log_pathname, interactive_console);
                      log_pathname, interactive_console);
   int result = P3DPythonRun::_global_ptr->run_python();
   int result = P3DPythonRun::_global_ptr->run_python();
   delete P3DPythonRun::_global_ptr;
   delete P3DPythonRun::_global_ptr;
-  P3DPythonRun::_global_ptr = NULL;
+  P3DPythonRun::_global_ptr = nullptr;
   return result;
   return result;
 }
 }

+ 3 - 3
direct/src/plugin/wstring_encode.cxx

@@ -30,11 +30,11 @@ bool
 wstring_to_string(string &result, const wstring &source) {
 wstring_to_string(string &result, const wstring &source) {
   bool success = false;
   bool success = false;
   int size = WideCharToMultiByte(CP_UTF8, 0, source.data(), source.length(),
   int size = WideCharToMultiByte(CP_UTF8, 0, source.data(), source.length(),
-                                 NULL, 0, NULL, NULL);
+                                 nullptr, 0, nullptr, nullptr);
   if (size > 0) {
   if (size > 0) {
     char *buffer = new char[size];
     char *buffer = new char[size];
     int rc = WideCharToMultiByte(CP_UTF8, 0, source.data(), source.length(),
     int rc = WideCharToMultiByte(CP_UTF8, 0, source.data(), source.length(),
-                                 buffer, size, NULL, NULL);
+                                 buffer, size, nullptr, nullptr);
     if (rc != 0) {
     if (rc != 0) {
       result.assign(buffer, size);
       result.assign(buffer, size);
       success = true;
       success = true;
@@ -54,7 +54,7 @@ bool
 string_to_wstring(wstring &result, const string &source) {
 string_to_wstring(wstring &result, const string &source) {
   bool success = false;
   bool success = false;
   int size = MultiByteToWideChar(CP_UTF8, 0, source.data(), source.length(),
   int size = MultiByteToWideChar(CP_UTF8, 0, source.data(), source.length(),
-                                 NULL, 0);
+                                 nullptr, 0);
   if (size > 0) {
   if (size > 0) {
     wchar_t *buffer = new wchar_t[size];
     wchar_t *buffer = new wchar_t[size];
     int rc = MultiByteToWideChar(CP_UTF8, 0, source.data(), source.length(),
     int rc = MultiByteToWideChar(CP_UTF8, 0, source.data(), source.length(),

+ 1 - 1
direct/src/plugin/xml_helpers.cxx

@@ -24,7 +24,7 @@ bool
 parse_bool_attrib(TiXmlElement *xelem, const string &attrib,
 parse_bool_attrib(TiXmlElement *xelem, const string &attrib,
                   bool default_value) {
                   bool default_value) {
   const char *value = xelem->Attribute(attrib.c_str());
   const char *value = xelem->Attribute(attrib.c_str());
-  if (value == NULL || *value == '\0') {
+  if (value == nullptr || *value == '\0') {
     return default_value;
     return default_value;
   }
   }
 
 

+ 4 - 4
direct/src/plugin_activex/PPDownloadRequest.h

@@ -30,19 +30,19 @@ public:
     };
     };
 
 
     PPDownloadRequest( PPInstance& instance, P3D_request* p3dRequest ) :
     PPDownloadRequest( PPInstance& instance, P3D_request* p3dRequest ) :
-        m_instance( instance ), m_p3dRequest( p3dRequest ), m_data( NULL ),
+        m_instance( instance ), m_p3dRequest( p3dRequest ), m_data( nullptr ),
         m_requestType( RequestType::P3DObject ), m_hFile( INVALID_HANDLE_VALUE )
         m_requestType( RequestType::P3DObject ), m_hFile( INVALID_HANDLE_VALUE )
     {
     {
     }
     }
 
 
     PPDownloadRequest( PPInstance& instance, const std::string& fileName ) :
     PPDownloadRequest( PPInstance& instance, const std::string& fileName ) :
-        m_instance( instance ), m_p3dRequest( NULL ), m_fileName( fileName ),
-        m_data( NULL ), m_requestType( RequestType::File ), m_hFile( INVALID_HANDLE_VALUE )
+        m_instance( instance ), m_p3dRequest( nullptr ), m_fileName( fileName ),
+        m_data( nullptr ), m_requestType( RequestType::File ), m_hFile( INVALID_HANDLE_VALUE )
     {
     {
     }
     }
 
 
     PPDownloadRequest( PPInstance& instance, std::strstream* data ) :
     PPDownloadRequest( PPInstance& instance, std::strstream* data ) :
-        m_instance( instance ), m_p3dRequest ( NULL ), m_data( data ),
+        m_instance( instance ), m_p3dRequest ( nullptr ), m_data( data ),
         m_requestType( RequestType::Data ), m_hFile( INVALID_HANDLE_VALUE )
         m_requestType( RequestType::Data ), m_hFile( INVALID_HANDLE_VALUE )
     {
     {
     }
     }

+ 2 - 2
direct/src/plugin_npapi/npruntime.h

@@ -137,13 +137,13 @@ void NPN_ReleaseVariantValue(NPVariant *variant);
 #define VOID_TO_NPVARIANT(_v)                                                 \
 #define VOID_TO_NPVARIANT(_v)                                                 \
 NP_BEGIN_MACRO                                                                \
 NP_BEGIN_MACRO                                                                \
     (_v).type = NPVariantType_Void;                                           \
     (_v).type = NPVariantType_Void;                                           \
-    (_v).value.objectValue = NULL;                                            \
+    (_v).value.objectValue = nullptr;                                            \
 NP_END_MACRO
 NP_END_MACRO
 
 
 #define NULL_TO_NPVARIANT(_v)                                                 \
 #define NULL_TO_NPVARIANT(_v)                                                 \
 NP_BEGIN_MACRO                                                                \
 NP_BEGIN_MACRO                                                                \
     (_v).type = NPVariantType_Null;                                           \
     (_v).type = NPVariantType_Null;                                           \
-    (_v).value.objectValue = NULL;                                            \
+    (_v).value.objectValue = nullptr;                                            \
 NP_END_MACRO
 NP_END_MACRO
 
 
 #define BOOLEAN_TO_NPVARIANT(_val, _v)                                        \
 #define BOOLEAN_TO_NPVARIANT(_val, _v)                                        \

+ 10 - 10
direct/src/plugin_npapi/ppBrowserObject.cxx

@@ -44,7 +44,7 @@ static P3D_object *
 object_call(P3D_object *object, const char *method_name,
 object_call(P3D_object *object, const char *method_name,
             bool needs_response,
             bool needs_response,
             P3D_object *params[], int num_params) {
             P3D_object *params[], int num_params) {
-  if (method_name == NULL) {
+  if (method_name == nullptr) {
     method_name = "";
     method_name = "";
   }
   }
   P3D_object *response = ((const PPBrowserObject *)object)->call(method_name, params, num_params);
   P3D_object *response = ((const PPBrowserObject *)object)->call(method_name, params, num_params);
@@ -52,7 +52,7 @@ object_call(P3D_object *object, const char *method_name,
     // No response was expected.  Throw away the response we received, so we
     // No response was expected.  Throw away the response we received, so we
     // can be consistent with defined semantics.
     // can be consistent with defined semantics.
     P3D_OBJECT_XDECREF(response);
     P3D_OBJECT_XDECREF(response);
-    response = NULL;
+    response = nullptr;
   }
   }
   return response;
   return response;
 }
 }
@@ -123,14 +123,14 @@ get_property(const string &property) const {
   if (!browser->hasproperty(_instance->get_npp_instance(), _npobj,
   if (!browser->hasproperty(_instance->get_npp_instance(), _npobj,
                             property_name)) {
                             property_name)) {
     // No such property.
     // No such property.
-    return NULL;
+    return nullptr;
   }
   }
 
 
   NPVariant result;
   NPVariant result;
   if (!browser->getproperty(_instance->get_npp_instance(), _npobj,
   if (!browser->getproperty(_instance->get_npp_instance(), _npobj,
                             property_name, &result)) {
                             property_name, &result)) {
     // Failed to retrieve property.
     // Failed to retrieve property.
-    return NULL;
+    return nullptr;
   }
   }
 
 
   P3D_object *object = _instance->variant_to_p3dobj(&result);
   P3D_object *object = _instance->variant_to_p3dobj(&result);
@@ -146,7 +146,7 @@ bool PPBrowserObject::
 set_property(const string &property, bool needs_response, P3D_object *value) {
 set_property(const string &property, bool needs_response, P3D_object *value) {
   NPIdentifier property_name = browser->getstringidentifier(property.c_str());
   NPIdentifier property_name = browser->getstringidentifier(property.c_str());
   bool result;
   bool result;
-  if (value != NULL) {
+  if (value != nullptr) {
     // Set the property.
     // Set the property.
     NPVariant npvalue;
     NPVariant npvalue;
     _instance->p3dobj_to_variant(&npvalue, value);
     _instance->p3dobj_to_variant(&npvalue, value);
@@ -183,7 +183,7 @@ call(const string &method_name, P3D_object *params[], int num_params) const {
                                 npparams, num_params, &result)) {
                                 npparams, num_params, &result)) {
       // Failed to invoke.
       // Failed to invoke.
       delete[] npparams;
       delete[] npparams;
-      return NULL;
+      return nullptr;
     }
     }
   } else {
   } else {
     // Call the named method.
     // Call the named method.
@@ -193,7 +193,7 @@ call(const string &method_name, P3D_object *params[], int num_params) const {
                          npparams, num_params, &result)) {
                          npparams, num_params, &result)) {
       // Failed to invoke.
       // Failed to invoke.
       delete[] npparams;
       delete[] npparams;
-      return NULL;
+      return nullptr;
     }
     }
   }
   }
 
 
@@ -215,7 +215,7 @@ eval(const string &expression) const {
   if (!browser->evaluate(_instance->get_npp_instance(), _npobj,
   if (!browser->evaluate(_instance->get_npp_instance(), _npobj,
                          &npexpr, &result)) {
                          &npexpr, &result)) {
     // Failed to eval.
     // Failed to eval.
-    return NULL;
+    return nullptr;
   }
   }
 
 
   P3D_object *object = _instance->variant_to_p3dobj(&result);
   P3D_object *object = _instance->variant_to_p3dobj(&result);
@@ -229,7 +229,7 @@ eval(const string &expression) const {
  */
  */
 void PPBrowserObject::
 void PPBrowserObject::
 clear_class_definition() {
 clear_class_definition() {
-  _browser_object_class = NULL;
+  _browser_object_class = nullptr;
 }
 }
 
 
 /**
 /**
@@ -238,7 +238,7 @@ clear_class_definition() {
  */
  */
 P3D_class_definition *PPBrowserObject::
 P3D_class_definition *PPBrowserObject::
 get_class_definition() {
 get_class_definition() {
-  if (_browser_object_class == NULL) {
+  if (_browser_object_class == nullptr) {
     // Create a default class_definition object, and fill in the appropriate
     // Create a default class_definition object, and fill in the appropriate
     // pointers.
     // pointers.
     _browser_object_class = P3D_make_class_definition_ptr();
     _browser_object_class = P3D_make_class_definition_ptr();

+ 1 - 1
direct/src/plugin_npapi/ppInstance.I

@@ -27,5 +27,5 @@ get_window() const {
   if (_got_window) {
   if (_got_window) {
     return &_window;
     return &_window;
   }
   }
-  return NULL;
+  return nullptr;
 }
 }

+ 125 - 125
direct/src/plugin_npapi/ppInstance.cxx

@@ -54,13 +54,13 @@ PPInstance(NPMIMEType pluginType, NPP instance, uint16_t mode,
            int16_t argc, char *argn[], char *argv[], NPSavedData *saved,
            int16_t argc, char *argn[], char *argv[], NPSavedData *saved,
            P3D_window_handle_type window_handle_type,
            P3D_window_handle_type window_handle_type,
            P3D_event_type event_type) {
            P3D_event_type event_type) {
-  _p3d_inst = NULL;
+  _p3d_inst = nullptr;
 
 
   _npp_instance = instance;
   _npp_instance = instance;
   _npp_mode = mode;
   _npp_mode = mode;
   _window_handle_type = window_handle_type;
   _window_handle_type = window_handle_type;
   _event_type = event_type;
   _event_type = event_type;
-  _script_object = NULL;
+  _script_object = nullptr;
   _contents_expiration = 0;
   _contents_expiration = 0;
   _failed = false;
   _failed = false;
   _started = false;
   _started = false;
@@ -68,9 +68,9 @@ PPInstance(NPMIMEType pluginType, NPP instance, uint16_t mode,
   // Copy the tokens and save them within this object.
   // Copy the tokens and save them within this object.
   _tokens.reserve(argc);
   _tokens.reserve(argc);
   for (int i = 0; i < argc; ++i) {
   for (int i = 0; i < argc; ++i) {
-    if (argn[i] != NULL) {
+    if (argn[i] != nullptr) {
       const char *v = argv[i];
       const char *v = argv[i];
-      if (v == NULL) {
+      if (v == nullptr) {
         // Firefox might give us a NULL argv[i] in some cases.
         // Firefox might give us a NULL argv[i] in some cases.
         v = "";
         v = "";
       }
       }
@@ -130,13 +130,13 @@ PPInstance(NPMIMEType pluginType, NPP instance, uint16_t mode,
 #ifdef HAVE_X11
 #ifdef HAVE_X11
   _twirl_subprocess_pid = -1;
   _twirl_subprocess_pid = -1;
 #ifdef HAVE_GTK
 #ifdef HAVE_GTK
-  _plug = NULL;
+  _plug = nullptr;
 #endif  // HAVE_GTK
 #endif  // HAVE_GTK
 #endif  // HAVE_X11
 #endif  // HAVE_X11
 
 
 #ifdef _WIN32
 #ifdef _WIN32
-  _hwnd = NULL;
-  _bg_brush = NULL;
+  _hwnd = nullptr;
+  _bg_brush = nullptr;
 #endif // _WIN32
 #endif // _WIN32
 
 
 #ifndef _WIN32
 #ifndef _WIN32
@@ -144,7 +144,7 @@ PPInstance(NPMIMEType pluginType, NPP instance, uint16_t mode,
   // use this to measure elapsed time from the window parameters having been
   // use this to measure elapsed time from the window parameters having been
   // received.
   // received.
   struct timeval tv;
   struct timeval tv;
-  gettimeofday(&tv, (struct timezone *)NULL);
+  gettimeofday(&tv, nullptr);
   _init_sec = tv.tv_sec;
   _init_sec = tv.tv_sec;
   _init_usec = tv.tv_usec;
   _init_usec = tv.tv_usec;
 #endif  // !_WIN32
 #endif  // !_WIN32
@@ -155,16 +155,16 @@ PPInstance(NPMIMEType pluginType, NPP instance, uint16_t mode,
   // thread.)
   // thread.)
   _run_loop_main = CFRunLoopGetCurrent();
   _run_loop_main = CFRunLoopGetCurrent();
   CFRetain(_run_loop_main);
   CFRetain(_run_loop_main);
-  _request_timer = NULL;
+  _request_timer = nullptr;
   INIT_LOCK(_timer_lock);
   INIT_LOCK(_timer_lock);
 
 
   // Also set up a timer to twirl the icon until the instance loads.
   // Also set up a timer to twirl the icon until the instance loads.
-  _twirl_timer = NULL;
+  _twirl_timer = nullptr;
   CFRunLoopTimerContext timer_context;
   CFRunLoopTimerContext timer_context;
   memset(&timer_context, 0, sizeof(timer_context));
   memset(&timer_context, 0, sizeof(timer_context));
   timer_context.info = this;
   timer_context.info = this;
   _twirl_timer = CFRunLoopTimerCreate
   _twirl_timer = CFRunLoopTimerCreate
-    (NULL, 0, 0.1, 0, 0, st_twirl_timer_callback, &timer_context);
+    (nullptr, 0, 0.1, 0, 0, st_twirl_timer_callback, &timer_context);
   CFRunLoopAddTimer(_run_loop_main, _twirl_timer, kCFRunLoopCommonModes);
   CFRunLoopAddTimer(_run_loop_main, _twirl_timer, kCFRunLoopCommonModes);
 #endif  // __APPLE__
 #endif  // __APPLE__
 
 
@@ -181,15 +181,15 @@ PPInstance::
   cleanup_window();
   cleanup_window();
 
 
 #ifdef __APPLE__
 #ifdef __APPLE__
-  if (_twirl_timer != NULL) {
+  if (_twirl_timer != nullptr) {
     CFRunLoopTimerInvalidate(_twirl_timer);
     CFRunLoopTimerInvalidate(_twirl_timer);
     CFRelease(_twirl_timer);
     CFRelease(_twirl_timer);
-    _twirl_timer = NULL;
+    _twirl_timer = nullptr;
   }
   }
-  if (_request_timer != NULL) {
+  if (_request_timer != nullptr) {
     CFRunLoopTimerInvalidate(_request_timer);
     CFRunLoopTimerInvalidate(_request_timer);
     CFRelease(_request_timer);
     CFRelease(_request_timer);
-    _request_timer = NULL;
+    _request_timer = nullptr;
   }
   }
   _run_loop_main = CFRunLoopGetCurrent();
   _run_loop_main = CFRunLoopGetCurrent();
   CFRelease(_run_loop_main);
   CFRelease(_run_loop_main);
@@ -200,15 +200,15 @@ PPInstance::
   osx_release_twirl_images();
   osx_release_twirl_images();
 #endif  // MACOSX_HAS_EVENT_MODELS
 #endif  // MACOSX_HAS_EVENT_MODELS
 
 
-  if (_p3d_inst != NULL) {
+  if (_p3d_inst != nullptr) {
     P3D_instance_finish_ptr(_p3d_inst);
     P3D_instance_finish_ptr(_p3d_inst);
-    _p3d_inst = NULL;
+    _p3d_inst = nullptr;
   }
   }
 
 
   assert(_streams.empty());
   assert(_streams.empty());
   assert(_file_datas.empty());
   assert(_file_datas.empty());
 
 
-  if (_script_object != NULL) {
+  if (_script_object != nullptr) {
     browser->releaseobject(_script_object);
     browser->releaseobject(_script_object);
   }
   }
 
 
@@ -259,7 +259,7 @@ begin() {
 
 
     string contents_filename = _root_dir + "/contents.xml";
     string contents_filename = _root_dir + "/contents.xml";
     if (read_contents_file(contents_filename, false)) {
     if (read_contents_file(contents_filename, false)) {
-      if (time(NULL) < _contents_expiration) {
+      if (time(nullptr) < _contents_expiration) {
         // Got the file, and it's good.
         // Got the file, and it's good.
         get_core_api();
         get_core_api();
         success = true;
         success = true;
@@ -276,7 +276,7 @@ begin() {
       // Append a uniquifying query string to the URL to force the download to
       // Append a uniquifying query string to the URL to force the download to
       // go all the way through any caches.  We use the time in seconds;
       // go all the way through any caches.  We use the time in seconds;
       // that's unique enough.
       // that's unique enough.
-      strm << "?" << time(NULL);
+      strm << "?" << time(nullptr);
       url = strm.str();
       url = strm.str();
 
 
       PPDownloadRequest *req = new PPDownloadRequest(PPDownloadRequest::RT_contents_file);
       PPDownloadRequest *req = new PPDownloadRequest(PPDownloadRequest::RT_contents_file);
@@ -308,7 +308,7 @@ set_window(NPWindow *window) {
 
 
   if (!_got_window) {
   if (!_got_window) {
 #ifdef _WIN32
 #ifdef _WIN32
-    _orig_window_proc = NULL;
+    _orig_window_proc = nullptr;
     if (window->type == NPWindowTypeWindow) {
     if (window->type == NPWindowTypeWindow) {
       // Save the window handle.
       // Save the window handle.
       _hwnd = (HWND)window->window;
       _hwnd = (HWND)window->window;
@@ -330,7 +330,7 @@ set_window(NPWindow *window) {
       // twirling icon, and also to catch events in case something slips
       // twirling icon, and also to catch events in case something slips
       // through.
       // through.
       _init_time = GetTickCount();
       _init_time = GetTickCount();
-      SetTimer(_hwnd, 1, 100, NULL);
+      SetTimer(_hwnd, 1, 100, nullptr);
     }
     }
 #endif  // _WIN32
 #endif  // _WIN32
 #ifdef MACOSX_HAS_EVENT_MODELS
 #ifdef MACOSX_HAS_EVENT_MODELS
@@ -342,9 +342,9 @@ set_window(NPWindow *window) {
   if (_use_xembed) {
   if (_use_xembed) {
     if (!_got_window || _window.window != window->window) {
     if (!_got_window || _window.window != window->window) {
       // The window has changed.  Destroy the old GtkPlug.
       // The window has changed.  Destroy the old GtkPlug.
-      if (_plug != NULL) {
+      if (_plug != nullptr) {
         gtk_widget_destroy(_plug);
         gtk_widget_destroy(_plug);
-        _plug = NULL;
+        _plug = nullptr;
       }
       }
 
 
       // Create a new GtkPlug to bind to the XEmbed socket.
       // Create a new GtkPlug to bind to the XEmbed socket.
@@ -367,7 +367,7 @@ set_window(NPWindow *window) {
 #endif  // HAVE_X11
 #endif  // HAVE_X11
 
 
   if (!_failed) {
   if (!_failed) {
-    if (_p3d_inst == NULL) {
+    if (_p3d_inst == nullptr) {
       create_instance();
       create_instance();
     } else {
     } else {
       send_window();
       send_window();
@@ -385,16 +385,16 @@ new_stream(NPMIMEType type, NPStream *stream, bool seekable, uint16_t *stype) {
     return NPERR_GENERIC_ERROR;
     return NPERR_GENERIC_ERROR;
   }
   }
 
 
-  if (stream->notifyData == NULL) {
+  if (stream->notifyData == nullptr) {
     // This is an unsolicited stream.  Assume the first unsolicited stream we
     // This is an unsolicited stream.  Assume the first unsolicited stream we
     // receive is the instance data; any other unsolicited stream is an error.
     // receive is the instance data; any other unsolicited stream is an error.
 
 
-    if (!_got_instance_url && stream->url != NULL) {
+    if (!_got_instance_url && stream->url != nullptr) {
       _got_instance_url = true;
       _got_instance_url = true;
       _instance_url = stream->url;
       _instance_url = stream->url;
       stream->notifyData = new PPDownloadRequest(PPDownloadRequest::RT_instance_data);
       stream->notifyData = new PPDownloadRequest(PPDownloadRequest::RT_instance_data);
 
 
-      if (_p3d_inst != NULL) {
+      if (_p3d_inst != nullptr) {
         // If we already have an instance by the time we get this stream,
         // If we already have an instance by the time we get this stream,
         // start sending the data to the instance (instead of having to mess
         // start sending the data to the instance (instead of having to mess
         // around with a temporary file).
         // around with a temporary file).
@@ -488,7 +488,7 @@ write_ready(NPStream *stream) {
  */
  */
 int PPInstance::
 int PPInstance::
 write_stream(NPStream *stream, int offset, int len, void *buffer) {
 write_stream(NPStream *stream, int offset, int len, void *buffer) {
-  if (stream->notifyData == NULL) {
+  if (stream->notifyData == nullptr) {
     nout << "Unexpected write_stream on " << stream->url << "\n";
     nout << "Unexpected write_stream on " << stream->url << "\n";
     browser->destroystream(_npp_instance, stream, NPRES_USER_BREAK);
     browser->destroystream(_npp_instance, stream, NPRES_USER_BREAK);
     return 0;
     return 0;
@@ -523,7 +523,7 @@ write_stream(NPStream *stream, int offset, int len, void *buffer) {
 
 
     // Nowadays we solve this problem by writing the data to a temporary file
     // Nowadays we solve this problem by writing the data to a temporary file
     // until the instance is ready for it.
     // until the instance is ready for it.
-    if (_p3d_inst == NULL) {
+    if (_p3d_inst == nullptr) {
       // The instance isn't ready, so stuff it in a temporary file.
       // The instance isn't ready, so stuff it in a temporary file.
       if (!_p3d_temp_file.feed(stream->end, buffer, len)) {
       if (!_p3d_temp_file.feed(stream->end, buffer, len)) {
         set_failed();
         set_failed();
@@ -575,7 +575,7 @@ destroy_stream(NPStream *stream, NPReason reason) {
     _streams.erase(si);
     _streams.erase(si);
   }
   }
 
 
-  if (stream->notifyData == NULL) {
+  if (stream->notifyData == nullptr) {
     nout << "Unexpected destroy_stream on " << stream->url << "\n";
     nout << "Unexpected destroy_stream on " << stream->url << "\n";
     return NPERR_NO_ERROR;
     return NPERR_NO_ERROR;
   }
   }
@@ -595,14 +595,14 @@ destroy_stream(NPStream *stream, NPReason reason) {
   case PPDownloadRequest::RT_user:
   case PPDownloadRequest::RT_user:
     if (!req->_notified_done) {
     if (!req->_notified_done) {
       P3D_instance_feed_url_stream_ptr(_p3d_inst, req->_user_id,
       P3D_instance_feed_url_stream_ptr(_p3d_inst, req->_user_id,
-                                       result_code, 0, stream->end, NULL, 0);
+                                       result_code, 0, stream->end, nullptr, 0);
       req->_notified_done = true;
       req->_notified_done = true;
     }
     }
     break;
     break;
 
 
   case PPDownloadRequest::RT_instance_data:
   case PPDownloadRequest::RT_instance_data:
     if (!req->_notified_done) {
     if (!req->_notified_done) {
-      if (_p3d_inst == NULL) {
+      if (_p3d_inst == nullptr) {
         // The instance still isn't ready; just mark the data done.  We'll
         // The instance still isn't ready; just mark the data done.  We'll
         // send the entire file to the instance when it is ready.
         // send the entire file to the instance when it is ready.
         _p3d_temp_file.finish();
         _p3d_temp_file.finish();
@@ -614,7 +614,7 @@ destroy_stream(NPStream *stream, NPReason reason) {
         // The instance has (only just) been created.  Tell it we've sent it
         // The instance has (only just) been created.  Tell it we've sent it
         // all the data it will get.
         // all the data it will get.
         P3D_instance_feed_url_stream_ptr(_p3d_inst, _p3d_instance_id,
         P3D_instance_feed_url_stream_ptr(_p3d_inst, _p3d_instance_id,
-                                         result_code, 0, stream->end, NULL, 0);
+                                         result_code, 0, stream->end, nullptr, 0);
       }
       }
       req->_notified_done = true;
       req->_notified_done = true;
     }
     }
@@ -655,7 +655,7 @@ destroy_stream(NPStream *stream, NPReason reason) {
  */
  */
 void PPInstance::
 void PPInstance::
 url_notify(const char *url, NPReason reason, void *notifyData) {
 url_notify(const char *url, NPReason reason, void *notifyData) {
-  if (notifyData == NULL) {
+  if (notifyData == nullptr) {
     return;
     return;
   }
   }
 
 
@@ -675,7 +675,7 @@ url_notify(const char *url, NPReason reason, void *notifyData) {
       assert(reason != NPRES_DONE);
       assert(reason != NPRES_DONE);
 
 
       P3D_instance_feed_url_stream_ptr(_p3d_inst, req->_user_id,
       P3D_instance_feed_url_stream_ptr(_p3d_inst, req->_user_id,
-                                       P3D_RC_generic_error, 0, 0, NULL, 0);
+                                       P3D_RC_generic_error, 0, 0, nullptr, 0);
       req->_notified_done = true;
       req->_notified_done = true;
     }
     }
     break;
     break;
@@ -739,7 +739,7 @@ url_notify(const char *url, NPReason reason, void *notifyData) {
  */
  */
 void PPInstance::
 void PPInstance::
 stream_as_file(NPStream *stream, const char *fname) {
 stream_as_file(NPStream *stream, const char *fname) {
-  if (stream->notifyData == NULL) {
+  if (stream->notifyData == nullptr) {
     nout << "Unexpected stream_as_file on " << stream->url << "\n";
     nout << "Unexpected stream_as_file on " << stream->url << "\n";
     return;
     return;
   }
   }
@@ -772,7 +772,7 @@ stream_as_file(NPStream *stream, const char *fname) {
       // the file that Safari tells us about appears to be a temporary file
       // the file that Safari tells us about appears to be a temporary file
       // that Safari's about to delete.  In order to protect ourselves from
       // that Safari's about to delete.  In order to protect ourselves from
       // this, we need to temporarily copy the file somewhere else.
       // this, we need to temporarily copy the file somewhere else.
-      char *name = tempnam(NULL, "p3d_");
+      char *name = tempnam(nullptr, "p3d_");
 
 
       // We prefer just making a hard link; it's quick and easy.
       // We prefer just making a hard link; it's quick and easy.
       if (link(filename.c_str(), name) != 0) {
       if (link(filename.c_str(), name) != 0) {
@@ -802,7 +802,7 @@ stream_as_file(NPStream *stream, const char *fname) {
  */
  */
 bool PPInstance::
 bool PPInstance::
 handle_request(P3D_request *request) {
 handle_request(P3D_request *request) {
-  if (_p3d_inst == NULL || _failed) {
+  if (_p3d_inst == nullptr || _failed) {
     return false;
     return false;
   }
   }
   assert(request->_instance == _p3d_inst);
   assert(request->_instance == _p3d_inst);
@@ -811,9 +811,9 @@ handle_request(P3D_request *request) {
 
 
   switch (request->_request_type) {
   switch (request->_request_type) {
   case P3D_RT_stop:
   case P3D_RT_stop:
-    if (_p3d_inst != NULL) {
+    if (_p3d_inst != nullptr) {
       P3D_instance_finish_ptr(_p3d_inst);
       P3D_instance_finish_ptr(_p3d_inst);
-      _p3d_inst = NULL;
+      _p3d_inst = nullptr;
     }
     }
     cleanup_window();
     cleanup_window();
     // Guess the browser doesn't really care.
     // Guess the browser doesn't really care.
@@ -911,7 +911,7 @@ handle_event(void *event) {
 #endif  // MACOSX_HAS_EVENT_MODELS
 #endif  // MACOSX_HAS_EVENT_MODELS
   }
   }
 
 
-  if (_p3d_inst != NULL) {
+  if (_p3d_inst != nullptr) {
     if (P3D_instance_handle_event_ptr(_p3d_inst, &edata)) {
     if (P3D_instance_handle_event_ptr(_p3d_inst, &edata)) {
       retval = true;
       retval = true;
     }
     }
@@ -926,15 +926,15 @@ handle_event(void *event) {
  */
  */
 NPObject *PPInstance::
 NPObject *PPInstance::
 get_panda_script_object() {
 get_panda_script_object() {
-  if (_script_object != NULL) {
+  if (_script_object != nullptr) {
     // NPRuntime "steals" a reference to this object.
     // NPRuntime "steals" a reference to this object.
     browser->retainobject(_script_object);
     browser->retainobject(_script_object);
     return _script_object;
     return _script_object;
   }
   }
 
 
-  P3D_object *main = NULL;
+  P3D_object *main = nullptr;
 
 
-  if (_p3d_inst != NULL) {
+  if (_p3d_inst != nullptr) {
     main = P3D_instance_get_panda_script_object_ptr(_p3d_inst);
     main = P3D_instance_get_panda_script_object_ptr(_p3d_inst);
   }
   }
   nout << "get_panda_script_object, main = " << main << "\n";
   nout << "get_panda_script_object, main = " << main << "\n";
@@ -985,7 +985,7 @@ p3dobj_to_variant(NPVariant *result, P3D_object *object) {
 
 
   case P3D_OT_string:
   case P3D_OT_string:
     {
     {
-      int size = P3D_OBJECT_GET_STRING(object, NULL, 0);
+      int size = P3D_OBJECT_GET_STRING(object, nullptr, 0);
       char *buffer = (char *)browser->memalloc(size);
       char *buffer = (char *)browser->memalloc(size);
       P3D_OBJECT_GET_STRING(object, buffer, size);
       P3D_OBJECT_GET_STRING(object, buffer, size);
       STRINGN_TO_NPVARIANT(buffer, size, *result);
       STRINGN_TO_NPVARIANT(buffer, size, *result);
@@ -1071,9 +1071,9 @@ void PPInstance::
 find_host(TiXmlElement *xcontents) {
 find_host(TiXmlElement *xcontents) {
   string host_url = PANDA_PACKAGE_HOST_URL;
   string host_url = PANDA_PACKAGE_HOST_URL;
   TiXmlElement *xhost = xcontents->FirstChildElement("host");
   TiXmlElement *xhost = xcontents->FirstChildElement("host");
-  if (xhost != NULL) {
+  if (xhost != nullptr) {
     const char *url = xhost->Attribute("url");
     const char *url = xhost->Attribute("url");
-    if (url != NULL && host_url == string(url)) {
+    if (url != nullptr && host_url == string(url)) {
       // We're the primary host.  This is the normal case.
       // We're the primary host.  This is the normal case.
       read_xhost(xhost);
       read_xhost(xhost);
       return;
       return;
@@ -1081,9 +1081,9 @@ find_host(TiXmlElement *xcontents) {
     } else {
     } else {
       // We're not the primary host; perhaps we're an alternate host.
       // We're not the primary host; perhaps we're an alternate host.
       TiXmlElement *xalthost = xhost->FirstChildElement("alt_host");
       TiXmlElement *xalthost = xhost->FirstChildElement("alt_host");
-      while (xalthost != NULL) {
+      while (xalthost != nullptr) {
         const char *url = xalthost->Attribute("url");
         const char *url = xalthost->Attribute("url");
-        if (url != NULL && host_url == string(url)) {
+        if (url != nullptr && host_url == string(url)) {
           // Yep, we're this alternate host.
           // Yep, we're this alternate host.
           read_xhost(xhost);
           read_xhost(xhost);
           return;
           return;
@@ -1107,7 +1107,7 @@ read_xhost(TiXmlElement *xhost) {
   // Get the "download" URL, which is the source from which we download
   // Get the "download" URL, which is the source from which we download
   // everything other than the contents.xml file.
   // everything other than the contents.xml file.
   const char *download_url = xhost->Attribute("download_url");
   const char *download_url = xhost->Attribute("download_url");
-  if (download_url != NULL) {
+  if (download_url != nullptr) {
     _download_url_prefix = download_url;
     _download_url_prefix = download_url;
   } else {
   } else {
     _download_url_prefix = PANDA_PACKAGE_HOST_URL;
     _download_url_prefix = PANDA_PACKAGE_HOST_URL;
@@ -1119,9 +1119,9 @@ read_xhost(TiXmlElement *xhost) {
   }
   }
 
 
   TiXmlElement *xmirror = xhost->FirstChildElement("mirror");
   TiXmlElement *xmirror = xhost->FirstChildElement("mirror");
-  while (xmirror != NULL) {
+  while (xmirror != nullptr) {
     const char *url = xmirror->Attribute("url");
     const char *url = xmirror->Attribute("url");
-    if (url != NULL) {
+    if (url != nullptr) {
       add_mirror(url);
       add_mirror(url);
     }
     }
     xmirror = xmirror->NextSiblingElement("mirror");
     xmirror = xmirror->NextSiblingElement("mirror");
@@ -1175,15 +1175,15 @@ choose_random_mirrors(vector<string> &result, int num_mirrors) {
 void PPInstance::
 void PPInstance::
 request_ready(P3D_instance *instance) {
 request_ready(P3D_instance *instance) {
   PPInstance *inst = (PPInstance *)(instance->_user_data);
   PPInstance *inst = (PPInstance *)(instance->_user_data);
-  assert(inst != NULL);
+  assert(inst != nullptr);
 
 
   if (has_plugin_thread_async_call) {
   if (has_plugin_thread_async_call) {
 #ifdef HAS_PLUGIN_THREAD_ASYNC_CALL
 #ifdef HAS_PLUGIN_THREAD_ASYNC_CALL
     // Since we are running at least Gecko 1.9, and we have this very useful
     // Since we are running at least Gecko 1.9, and we have this very useful
     // function, let's use it to ask the browser to call us back in the main
     // function, let's use it to ask the browser to call us back in the main
     // thread.
     // thread.
-    assert((void *)browser->pluginthreadasynccall != (void *)NULL);
-    browser->pluginthreadasynccall(inst->_npp_instance, browser_sync_callback, NULL);
+    assert((void *)browser->pluginthreadasynccall != nullptr);
+    browser->pluginthreadasynccall(inst->_npp_instance, browser_sync_callback, nullptr);
 #endif  // HAS_PLUGIN_THREAD_ASYNC_CALL
 #endif  // HAS_PLUGIN_THREAD_ASYNC_CALL
 
 
   } else {
   } else {
@@ -1195,7 +1195,7 @@ request_ready(P3D_instance *instance) {
 
 
     // Get the window handle for the window associated with this instance.
     // Get the window handle for the window associated with this instance.
     const NPWindow *win = inst->get_window();
     const NPWindow *win = inst->get_window();
-    if (win != NULL && win->type == NPWindowTypeWindow) {
+    if (win != nullptr && win->type == NPWindowTypeWindow) {
       PostMessage((HWND)(win->window), WM_USER, 0, 0);
       PostMessage((HWND)(win->window), WM_USER, 0, 0);
     }
     }
 #endif  // _WIN32
 #endif  // _WIN32
@@ -1205,12 +1205,12 @@ request_ready(P3D_instance *instance) {
 
 
     // Only set a new timer if we don't have one already started.
     // Only set a new timer if we don't have one already started.
     ACQUIRE_LOCK(inst->_timer_lock);
     ACQUIRE_LOCK(inst->_timer_lock);
-    if (inst->_request_timer == NULL) {
+    if (inst->_request_timer == nullptr) {
       CFRunLoopTimerContext timer_context;
       CFRunLoopTimerContext timer_context;
       memset(&timer_context, 0, sizeof(timer_context));
       memset(&timer_context, 0, sizeof(timer_context));
       timer_context.info = inst;
       timer_context.info = inst;
       inst->_request_timer = CFRunLoopTimerCreate
       inst->_request_timer = CFRunLoopTimerCreate
-        (NULL, 0, 0, 0, 0, timer_callback, &timer_context);
+        (nullptr, 0, 0, 0, 0, timer_callback, &timer_context);
       CFRunLoopAddTimer(inst->_run_loop_main, inst->_request_timer, kCFRunLoopCommonModes);
       CFRunLoopAddTimer(inst->_run_loop_main, inst->_request_timer, kCFRunLoopCommonModes);
     }
     }
     RELEASE_LOCK(inst->_timer_lock);
     RELEASE_LOCK(inst->_timer_lock);
@@ -1232,7 +1232,7 @@ start_download(const string &url, PPDownloadRequest *req) {
     delete req;
     delete req;
   } else {
   } else {
     // Otherwise, ask the browser to download it.
     // Otherwise, ask the browser to download it.
-    browser->geturlnotify(_npp_instance, url.c_str(), NULL, req);
+    browser->geturlnotify(_npp_instance, url.c_str(), nullptr, req);
   }
   }
 }
 }
 
 
@@ -1283,19 +1283,19 @@ read_contents_file(const string &contents_filename, bool fresh_download) {
   bool found_core_package = false;
   bool found_core_package = false;
 
 
   TiXmlElement *xcontents = doc.FirstChildElement("contents");
   TiXmlElement *xcontents = doc.FirstChildElement("contents");
-  if (xcontents != NULL) {
+  if (xcontents != nullptr) {
     int max_age = P3D_CONTENTS_DEFAULT_MAX_AGE;
     int max_age = P3D_CONTENTS_DEFAULT_MAX_AGE;
     xcontents->Attribute("max_age", &max_age);
     xcontents->Attribute("max_age", &max_age);
 
 
     // Get the latest possible expiration time, based on the max_age
     // Get the latest possible expiration time, based on the max_age
     // indication.  Any expiration time later than this is in error.
     // indication.  Any expiration time later than this is in error.
-    time_t now = time(NULL);
+    time_t now = time(nullptr);
     _contents_expiration = now + (time_t)max_age;
     _contents_expiration = now + (time_t)max_age;
 
 
     if (fresh_download) {
     if (fresh_download) {
       // Update the XML with the new download information.
       // Update the XML with the new download information.
       TiXmlElement *xorig = xcontents->FirstChildElement("orig");
       TiXmlElement *xorig = xcontents->FirstChildElement("orig");
-      while (xorig != NULL) {
+      while (xorig != nullptr) {
         xcontents->RemoveChild(xorig);
         xcontents->RemoveChild(xorig);
         xorig = xcontents->FirstChildElement("orig");
         xorig = xcontents->FirstChildElement("orig");
       }
       }
@@ -1309,7 +1309,7 @@ read_contents_file(const string &contents_filename, bool fresh_download) {
       // Read the expiration time from the XML.
       // Read the expiration time from the XML.
       int expiration = 0;
       int expiration = 0;
       TiXmlElement *xorig = xcontents->FirstChildElement("orig");
       TiXmlElement *xorig = xcontents->FirstChildElement("orig");
-      if (xorig != NULL) {
+      if (xorig != nullptr) {
         xorig->Attribute("expiration", &expiration);
         xorig->Attribute("expiration", &expiration);
       }
       }
 
 
@@ -1327,14 +1327,14 @@ read_contents_file(const string &contents_filename, bool fresh_download) {
     // Now look for the core API package.
     // Now look for the core API package.
     _coreapi_set_ver = "";
     _coreapi_set_ver = "";
     TiXmlElement *xpackage = xcontents->FirstChildElement("package");
     TiXmlElement *xpackage = xcontents->FirstChildElement("package");
-    while (xpackage != NULL) {
+    while (xpackage != nullptr) {
       const char *name = xpackage->Attribute("name");
       const char *name = xpackage->Attribute("name");
-      if (name != NULL && strcmp(name, "coreapi") == 0) {
+      if (name != nullptr && strcmp(name, "coreapi") == 0) {
         const char *platform = xpackage->Attribute("platform");
         const char *platform = xpackage->Attribute("platform");
-        if (platform != NULL && strcmp(platform, DTOOL_PLATFORM) == 0) {
+        if (platform != nullptr && strcmp(platform, DTOOL_PLATFORM) == 0) {
           _coreapi_dll.load_xml(xpackage);
           _coreapi_dll.load_xml(xpackage);
           const char *set_ver = xpackage->Attribute("set_ver");
           const char *set_ver = xpackage->Attribute("set_ver");
-          if (set_ver != NULL) {
+          if (set_ver != nullptr) {
             _coreapi_set_ver = set_ver;
             _coreapi_set_ver = set_ver;
           }
           }
           found_core_package = true;
           found_core_package = true;
@@ -1491,7 +1491,7 @@ send_p3d_temp_file_data() {
     // If we'd already finished the stream earlier, tell the plugin.
     // If we'd already finished the stream earlier, tell the plugin.
     P3D_instance_feed_url_stream_ptr(_p3d_inst, _p3d_instance_id,
     P3D_instance_feed_url_stream_ptr(_p3d_inst, _p3d_instance_id,
                                      P3D_RC_done, 0, _p3d_temp_file._total_size,
                                      P3D_RC_done, 0, _p3d_temp_file._total_size,
-                                     NULL, 0);
+                                     nullptr, 0);
   }
   }
   _p3d_temp_file.cleanup();
   _p3d_temp_file.cleanup();
 }
 }
@@ -1515,7 +1515,7 @@ get_core_api() {
     // uniquifier, to break through any caches.
     // uniquifier, to break through any caches.
     ostringstream strm;
     ostringstream strm;
     strm << _download_url_prefix << _coreapi_dll.get_filename()
     strm << _download_url_prefix << _coreapi_dll.get_filename()
-         << "?" << time(NULL);
+         << "?" << time(nullptr);
     url = strm.str();
     url = strm.str();
     _core_urls.push_back(url);
     _core_urls.push_back(url);
 
 
@@ -1566,7 +1566,7 @@ downloaded_plugin(const string &filename) {
     nout << "Expected:\n";
     nout << "Expected:\n";
     _coreapi_dll.write(nout);
     _coreapi_dll.write(nout);
     const FileSpec *actual = _coreapi_dll.force_get_actual_file(filename);
     const FileSpec *actual = _coreapi_dll.force_get_actual_file(filename);
-    if (actual != NULL) {
+    if (actual != nullptr) {
       nout << "Found:\n";
       nout << "Found:\n";
       actual->write(nout);
       actual->write(nout);
     }
     }
@@ -1671,10 +1671,10 @@ create_instance() {
 
 
 #ifdef __APPLE__
 #ifdef __APPLE__
   // We no longer need to twirl the icon.  Stop the timer.
   // We no longer need to twirl the icon.  Stop the timer.
-  if (_twirl_timer != NULL) {
+  if (_twirl_timer != nullptr) {
     CFRunLoopTimerInvalidate(_twirl_timer);
     CFRunLoopTimerInvalidate(_twirl_timer);
     CFRelease(_twirl_timer);
     CFRelease(_twirl_timer);
-    _twirl_timer = NULL;
+    _twirl_timer = nullptr;
   }
   }
 #endif  // __APPLE__
 #endif  // __APPLE__
 
 
@@ -1685,21 +1685,21 @@ create_instance() {
   // In the Windows case, we let the timer keep running, because it also
   // In the Windows case, we let the timer keep running, because it also
   // checks for wayward messages.
   // checks for wayward messages.
 
 
-  P3D_token *tokens = NULL;
+  P3D_token *tokens = nullptr;
   if (!_tokens.empty()) {
   if (!_tokens.empty()) {
     tokens = &_tokens[0];
     tokens = &_tokens[0];
   }
   }
   _started = true;
   _started = true;
   _p3d_inst = P3D_new_instance_ptr(request_ready, tokens, _tokens.size(),
   _p3d_inst = P3D_new_instance_ptr(request_ready, tokens, _tokens.size(),
-                               0, NULL, this);
-  if (_p3d_inst == NULL) {
+                               0, nullptr, this);
+  if (_p3d_inst == nullptr) {
     set_failed();
     set_failed();
     return;
     return;
   }
   }
 
 
   // Now get the browser's toplevel DOM object (called the "window" object in
   // Now get the browser's toplevel DOM object (called the "window" object in
   // JavaScript), to pass to the plugin.
   // JavaScript), to pass to the plugin.
-  NPObject *window_object = NULL;
+  NPObject *window_object = nullptr;
   if (browser->getvalue(_npp_instance, NPNVWindowNPObject,
   if (browser->getvalue(_npp_instance, NPNVWindowNPObject,
                         &window_object) == NPERR_NO_ERROR) {
                         &window_object) == NPERR_NO_ERROR) {
     PPBrowserObject *pobj = new PPBrowserObject(this, window_object);
     PPBrowserObject *pobj = new PPBrowserObject(this, window_object);
@@ -1709,7 +1709,7 @@ create_instance() {
     nout << "Couldn't get window_object\n";
     nout << "Couldn't get window_object\n";
   }
   }
 
 
-  if (_script_object != NULL) {
+  if (_script_object != nullptr) {
     // Now that we have a true instance, initialize our script_object with the
     // Now that we have a true instance, initialize our script_object with the
     // proper P3D_object pointer.
     // proper P3D_object pointer.
     P3D_object *main = P3D_instance_get_panda_script_object_ptr(_p3d_inst);
     P3D_object *main = P3D_instance_get_panda_script_object_ptr(_p3d_inst);
@@ -1740,7 +1740,7 @@ create_instance() {
  */
  */
 void PPInstance::
 void PPInstance::
 send_window() {
 send_window() {
-  assert(_p3d_inst != NULL);
+  assert(_p3d_inst != nullptr);
 
 
   int x = _window.x;
   int x = _window.x;
   int y = _window.y;
   int y = _window.y;
@@ -1770,7 +1770,7 @@ send_window() {
 #endif
 #endif
     } else if (_window_handle_type == P3D_WHT_osx_cgcontext) {
     } else if (_window_handle_type == P3D_WHT_osx_cgcontext) {
       NP_CGContext *context = (NP_CGContext *)_window.window;
       NP_CGContext *context = (NP_CGContext *)_window.window;
-      if (context != NULL) {
+      if (context != nullptr) {
         parent_window._handle._osx_cgcontext._context = context->context;
         parent_window._handle._osx_cgcontext._context = context->context;
         parent_window._handle._osx_cgcontext._window = (WindowRef)context->window;
         parent_window._handle._osx_cgcontext._window = (WindowRef)context->window;
       }
       }
@@ -1784,7 +1784,7 @@ send_window() {
       // If we're using XEmbed, pass the X11 Window pointer of our plug down
       // If we're using XEmbed, pass the X11 Window pointer of our plug down
       // to Panda.  (Hmm, it would be nice to pass the XID object and use this
       // to Panda.  (Hmm, it would be nice to pass the XID object and use this
       // system in general within Panda, but that's for the future, I think.)
       // system in general within Panda, but that's for the future, I think.)
-      assert(_plug != NULL);
+      assert(_plug != nullptr);
       parent_window._window_handle_type = P3D_WHT_x11_window;
       parent_window._window_handle_type = P3D_WHT_x11_window;
       parent_window._handle._x11_window._xwindow = GDK_DRAWABLE_XID(_plug->window);
       parent_window._handle._x11_window._xwindow = GDK_DRAWABLE_XID(_plug->window);
 #endif  // HAVE_GTK
 #endif  // HAVE_GTK
@@ -1818,7 +1818,7 @@ send_window() {
 #endif
 #endif
     } else if (_window_handle_type == P3D_WHT_osx_cgcontext) {
     } else if (_window_handle_type == P3D_WHT_osx_cgcontext) {
       NP_CGContext *context = (NP_CGContext *)_window.window;
       NP_CGContext *context = (NP_CGContext *)_window.window;
-      if (context != NULL) {
+      if (context != nullptr) {
         parent_window._handle._osx_cgcontext._context = context->context;
         parent_window._handle._osx_cgcontext._context = context->context;
         parent_window._handle._osx_cgcontext._window = (WindowRef)context->window;
         parent_window._handle._osx_cgcontext._window = (WindowRef)context->window;
       }
       }
@@ -1845,7 +1845,7 @@ send_window() {
 #endif
 #endif
 
 
   P3D_window_type window_type = P3D_WT_embedded;
   P3D_window_type window_type = P3D_WT_embedded;
-  if (_window.window == NULL && _event_type != P3D_ET_osx_cocoa) {
+  if (_window.window == nullptr && _event_type != P3D_ET_osx_cocoa) {
     // No parent window: it must be a hidden window.
     // No parent window: it must be a hidden window.
     window_type = P3D_WT_hidden;
     window_type = P3D_WT_hidden;
   } else if (_window.width == 0 || _window.height == 0) {
   } else if (_window.width == 0 || _window.height == 0) {
@@ -1870,16 +1870,16 @@ cleanup_window() {
     // Restore the parent window to its own window handler.
     // Restore the parent window to its own window handler.
     HWND hwnd = (HWND)_window.window;
     HWND hwnd = (HWND)_window.window;
     SetWindowLongPtr(hwnd, GWLP_WNDPROC, _orig_window_proc);
     SetWindowLongPtr(hwnd, GWLP_WNDPROC, _orig_window_proc);
-    InvalidateRect(hwnd, NULL, true);
+    InvalidateRect(hwnd, nullptr, true);
 
 
-    if (_bg_brush != NULL) {
+    if (_bg_brush != nullptr) {
       DeleteObject(_bg_brush);
       DeleteObject(_bg_brush);
-      _bg_brush = NULL;
+      _bg_brush = nullptr;
     }
     }
     for (int step = 0; step < twirl_num_steps + 1; ++step) {
     for (int step = 0; step < twirl_num_steps + 1; ++step) {
-      if (_twirl_bitmaps[step] != NULL) {
+      if (_twirl_bitmaps[step] != nullptr) {
         DeleteObject(_twirl_bitmaps[step]);
         DeleteObject(_twirl_bitmaps[step]);
-        _twirl_bitmaps[step] = NULL;
+        _twirl_bitmaps[step] = nullptr;
       }
       }
     }
     }
 #endif  // _WIN32
 #endif  // _WIN32
@@ -1888,9 +1888,9 @@ cleanup_window() {
     x11_stop_twirl_subprocess();
     x11_stop_twirl_subprocess();
 
 
 #ifdef HAVE_GTK
 #ifdef HAVE_GTK
-    if (_plug != NULL) {
+    if (_plug != nullptr) {
       gtk_widget_destroy(_plug);
       gtk_widget_destroy(_plug);
-      _plug = NULL;
+      _plug = nullptr;
     }
     }
 #endif  // HAVE_GTK
 #endif  // HAVE_GTK
 #endif  // HAVE_X11
 #endif  // HAVE_X11
@@ -2037,7 +2037,7 @@ set_failed() {
 
 
     if (!expression.empty()) {
     if (!expression.empty()) {
       // Now attempt to evaluate the expression.
       // Now attempt to evaluate the expression.
-      NPObject *window_object = NULL;
+      NPObject *window_object = nullptr;
       if (browser->getvalue(_npp_instance, NPNVWindowNPObject,
       if (browser->getvalue(_npp_instance, NPNVWindowNPObject,
                             &window_object) == NPERR_NO_ERROR) {
                             &window_object) == NPERR_NO_ERROR) {
         NPString npexpr = { expression.c_str(), (uint32_t)expression.length() };
         NPString npexpr = { expression.c_str(), (uint32_t)expression.length() };
@@ -2054,9 +2054,9 @@ set_failed() {
       }
       }
     }
     }
 
 
-    if (_p3d_inst != NULL) {
+    if (_p3d_inst != nullptr) {
       P3D_instance_finish_ptr(_p3d_inst);
       P3D_instance_finish_ptr(_p3d_inst);
-      _p3d_inst = NULL;
+      _p3d_inst = nullptr;
     }
     }
     cleanup_window();
     cleanup_window();
   }
   }
@@ -2073,11 +2073,11 @@ handle_request_loop() {
   }
   }
 
 
   P3D_instance *p3d_inst = P3D_check_request_ptr(0.0);
   P3D_instance *p3d_inst = P3D_check_request_ptr(0.0);
-  while (p3d_inst != (P3D_instance *)NULL) {
+  while (p3d_inst != nullptr) {
     P3D_request *request = P3D_instance_get_request_ptr(p3d_inst);
     P3D_request *request = P3D_instance_get_request_ptr(p3d_inst);
-    if (request != (P3D_request *)NULL) {
+    if (request != nullptr) {
       PPInstance *inst = (PPInstance *)(p3d_inst->_user_data);
       PPInstance *inst = (PPInstance *)(p3d_inst->_user_data);
-      assert(inst != NULL);
+      assert(inst != nullptr);
       if (!inst->handle_request(request)) {
       if (!inst->handle_request(request)) {
         // If handling the request is meant to yield control temporarily to
         // If handling the request is meant to yield control temporarily to
         // JavaScript (e.g.  P3D_RT_callback), then do so now.
         // JavaScript (e.g.  P3D_RT_callback), then do so now.
@@ -2130,7 +2130,7 @@ browser_sync_callback(void *) {
 LONG PPInstance::
 LONG PPInstance::
 st_window_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) {
 st_window_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) {
   LONG_PTR self = GetWindowLongPtr(hwnd, GWLP_USERDATA);
   LONG_PTR self = GetWindowLongPtr(hwnd, GWLP_USERDATA);
-  if (self == NULL) {
+  if (self == nullptr) {
     // We haven't assigned the pointer yet (!?)
     // We haven't assigned the pointer yet (!?)
     return DefWindowProc(hwnd, msg, wparam, lparam);
     return DefWindowProc(hwnd, msg, wparam, lparam);
   }
   }
@@ -2174,7 +2174,7 @@ window_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) {
 
 
   case WM_TIMER:
   case WM_TIMER:
     if (!_started) {
     if (!_started) {
-      InvalidateRect(_hwnd, NULL, FALSE);
+      InvalidateRect(_hwnd, nullptr, FALSE);
     }
     }
     break;
     break;
 
 
@@ -2286,7 +2286,7 @@ win_paint_twirl(HWND hwnd, HDC dc) {
       BitBlt(bdc, left, top, twirl_width, twirl_height,
       BitBlt(bdc, left, top, twirl_width, twirl_height,
              mem_dc, 0, 0, SRCCOPY);
              mem_dc, 0, 0, SRCCOPY);
 
 
-      SelectObject(mem_dc, NULL);
+      SelectObject(mem_dc, nullptr);
       DeleteDC(mem_dc);
       DeleteDC(mem_dc);
     }
     }
   }
   }
@@ -2414,7 +2414,7 @@ const wchar_t *PPInstance::
 make_ansi_string(wstring &result, NPNSString *ns_string) {
 make_ansi_string(wstring &result, NPNSString *ns_string) {
   result.clear();
   result.clear();
 
 
-  if (ns_string != NULL) {
+  if (ns_string != nullptr) {
     // An NPNSString is really just an NSString, which is itself just a
     // An NPNSString is really just an NSString, which is itself just a
     // CFString.
     // CFString.
     CFStringRef cfstr = (CFStringRef)ns_string;
     CFStringRef cfstr = (CFStringRef)ns_string;
@@ -2492,7 +2492,7 @@ osx_get_twirl_images() {
     image._raw_data = new_data;
     image._raw_data = new_data;
 
 
     image._data =
     image._data =
-      CFDataCreateWithBytesNoCopy(NULL, (const UInt8 *)image._raw_data,
+      CFDataCreateWithBytesNoCopy(nullptr, (const UInt8 *)image._raw_data,
                                   twirl_size * 4, kCFAllocatorNull);
                                   twirl_size * 4, kCFAllocatorNull);
     image._provider = CGDataProviderCreateWithCFData(image._data);
     image._provider = CGDataProviderCreateWithCFData(image._data);
     image._color_space = CGColorSpaceCreateDeviceRGB();
     image._color_space = CGColorSpaceCreateDeviceRGB();
@@ -2501,7 +2501,7 @@ osx_get_twirl_images() {
       CGImageCreate(twirl_width, twirl_height, 8, 32,
       CGImageCreate(twirl_width, twirl_height, 8, 32,
                     twirl_width * 4, image._color_space,
                     twirl_width * 4, image._color_space,
                     kCGImageAlphaFirst | kCGBitmapByteOrder32Little,
                     kCGImageAlphaFirst | kCGBitmapByteOrder32Little,
-                    image._provider, NULL, false, kCGRenderingIntentDefault);
+                    image._provider, nullptr, false, kCGRenderingIntentDefault);
   }
   }
 }
 }
 #endif  // MACOSX_HAS_EVENT_MODELS
 #endif  // MACOSX_HAS_EVENT_MODELS
@@ -2520,25 +2520,25 @@ osx_release_twirl_images() {
   for (int step = 0; step < twirl_num_steps + 1; ++step) {
   for (int step = 0; step < twirl_num_steps + 1; ++step) {
     OsxImageData &image = _twirl_images[step];
     OsxImageData &image = _twirl_images[step];
 
 
-    if (image._image != NULL) {
+    if (image._image != nullptr) {
       CGImageRelease(image._image);
       CGImageRelease(image._image);
-      image._image = NULL;
+      image._image = nullptr;
     }
     }
-    if (image._color_space != NULL) {
+    if (image._color_space != nullptr) {
       CGColorSpaceRelease(image._color_space);
       CGColorSpaceRelease(image._color_space);
-      image._color_space = NULL;
+      image._color_space = nullptr;
     }
     }
-    if (image._provider != NULL) {
+    if (image._provider != nullptr) {
       CGDataProviderRelease(image._provider);
       CGDataProviderRelease(image._provider);
-      image._provider = NULL;
+      image._provider = nullptr;
     }
     }
-    if (image._data != NULL) {
+    if (image._data != nullptr) {
       CFRelease(image._data);
       CFRelease(image._data);
-      image._data = NULL;
+      image._data = nullptr;
     }
     }
-    if (image._raw_data != NULL) {
+    if (image._raw_data != nullptr) {
       delete[] image._raw_data;
       delete[] image._raw_data;
-      image._raw_data = NULL;
+      image._raw_data = nullptr;
     }
     }
   }
   }
 }
 }
@@ -2571,7 +2571,7 @@ paint_twirl_osx_cgcontext(CGContextRef context) {
 
 
   } else {
   } else {
     struct timeval tv;
     struct timeval tv;
-    gettimeofday(&tv, (struct timezone *)NULL);
+    gettimeofday(&tv, nullptr);
     double now = (double)(tv.tv_sec - _init_sec) + (double)(tv.tv_usec - _init_usec) / 1000000.0;
     double now = (double)(tv.tv_sec - _init_sec) + (double)(tv.tv_usec - _init_usec) / 1000000.0;
 
 
     // Don't draw the twirling icon until at least half a second has passed,
     // Don't draw the twirling icon until at least half a second has passed,
@@ -2591,7 +2591,7 @@ paint_twirl_osx_cgcontext(CGContextRef context) {
  */
  */
 bool PPInstance::
 bool PPInstance::
 osx_paint_image(CGContextRef context, const OsxImageData &image) {
 osx_paint_image(CGContextRef context, const OsxImageData &image) {
-  if (image._image == NULL) {
+  if (image._image == nullptr) {
     return false;
     return false;
   }
   }
 
 
@@ -2627,10 +2627,10 @@ void PPInstance::
 timer_callback(CFRunLoopTimerRef timer, void *info) {
 timer_callback(CFRunLoopTimerRef timer, void *info) {
   PPInstance *self = (PPInstance *)info;
   PPInstance *self = (PPInstance *)info;
   ACQUIRE_LOCK(self->_timer_lock);
   ACQUIRE_LOCK(self->_timer_lock);
-  if (self->_request_timer != NULL) {
+  if (self->_request_timer != nullptr) {
     CFRunLoopTimerInvalidate(self->_request_timer);
     CFRunLoopTimerInvalidate(self->_request_timer);
     CFRelease(self->_request_timer);
     CFRelease(self->_request_timer);
-    self->_request_timer = NULL;
+    self->_request_timer = nullptr;
   }
   }
   RELEASE_LOCK(self->_timer_lock);
   RELEASE_LOCK(self->_timer_lock);
 
 
@@ -2744,14 +2744,14 @@ x11_twirl_subprocess_run() {
   struct timespec req;
   struct timespec req;
   req.tv_sec = 0;
   req.tv_sec = 0;
   req.tv_nsec = 500000000;  // 500 ms
   req.tv_nsec = 500000000;  // 500 ms
-  nanosleep(&req, NULL);
+  nanosleep(&req, nullptr);
 
 
   // We haven't been killed yet, so the plugin is still loading.  Start
   // We haven't been killed yet, so the plugin is still loading.  Start
   // twirling.
   // twirling.
 
 
   // First, embed a window.
   // First, embed a window.
-  X11_Display *display = XOpenDisplay(NULL);
-  assert(display != NULL);
+  X11_Display *display = XOpenDisplay(nullptr);
+  assert(display != nullptr);
   int screen = DefaultScreen(display);
   int screen = DefaultScreen(display);
 
 
   int depth = DefaultDepth(display, screen);
   int depth = DefaultDepth(display, screen);
@@ -2796,7 +2796,7 @@ x11_twirl_subprocess_run() {
   X11_Window parent = 0;
   X11_Window parent = 0;
   if (_use_xembed) {
   if (_use_xembed) {
 #ifdef HAVE_GTK
 #ifdef HAVE_GTK
-    assert(_plug != NULL);
+    assert(_plug != nullptr);
     parent = GDK_DRAWABLE_XID(_plug->window);
     parent = GDK_DRAWABLE_XID(_plug->window);
 #endif  // HAVE_GTK
 #endif  // HAVE_GTK
   } else {
   } else {
@@ -2874,7 +2874,7 @@ x11_twirl_subprocess_run() {
 
 
     // What step are we on now?
     // What step are we on now?
     struct timeval tv;
     struct timeval tv;
-    gettimeofday(&tv, (struct timezone *)NULL);
+    gettimeofday(&tv, nullptr);
     double now = (double)(tv.tv_sec - _init_sec) + (double)(tv.tv_usec - _init_usec) / 1000000.0;
     double now = (double)(tv.tv_sec - _init_sec) + (double)(tv.tv_usec - _init_usec) / 1000000.0;
     int step = ((int)(now * 10.0)) % twirl_num_steps;
     int step = ((int)(now * 10.0)) % twirl_num_steps;
     if (step != last_step) {
     if (step != last_step) {
@@ -2896,7 +2896,7 @@ x11_twirl_subprocess_run() {
     struct timespec req;
     struct timespec req;
     req.tv_sec = 0;
     req.tv_sec = 0;
     req.tv_nsec = 100000000;  // 100 ms
     req.tv_nsec = 100000000;  // 100 ms
-    nanosleep(&req, NULL);
+    nanosleep(&req, nullptr);
   }
   }
 }
 }
 #endif  // HAVE_X11
 #endif  // HAVE_X11
@@ -2990,7 +2990,7 @@ thread_run() {
     struct timeval tv;
     struct timeval tv;
     tv.tv_sec = 0;
     tv.tv_sec = 0;
     tv.tv_usec = 10000;
     tv.tv_usec = 10000;
-    select(0, NULL, NULL, NULL, &tv);
+    select(0, nullptr, nullptr, nullptr, &tv);
 #endif
 #endif
   }
   }
 
 
@@ -3002,7 +3002,7 @@ thread_run() {
   }
   }
 
 
   P3D_instance_feed_url_stream_ptr
   P3D_instance_feed_url_stream_ptr
-    (_p3d_inst, _user_id, result, 0, _total_count, NULL, 0);
+    (_p3d_inst, _user_id, result, 0, _total_count, nullptr, 0);
 
 
   // All done.
   // All done.
   _thread_done = true;
   _thread_done = true;
@@ -3041,7 +3041,7 @@ open() {
   _current_size = 0;
   _current_size = 0;
   _total_size = 0;
   _total_size = 0;
 
 
-  char *name = tempnam(NULL, "p3d_");
+  char *name = tempnam(nullptr, "p3d_");
   _filename = name;
   _filename = name;
   free(name);
   free(name);
 
 

+ 1 - 1
direct/src/plugin_npapi/ppPandaObject.I

@@ -18,7 +18,7 @@
  */
  */
 inline P3D_object *PPPandaObject::
 inline P3D_object *PPPandaObject::
 get_p3d_object() const {
 get_p3d_object() const {
-  if (_p3d_object != NULL) {
+  if (_p3d_object != nullptr) {
     P3D_OBJECT_INCREF(_p3d_object);
     P3D_OBJECT_INCREF(_p3d_object);
   }
   }
   return _p3d_object;
   return _p3d_object;

+ 17 - 17
direct/src/plugin_npapi/ppPandaObject.cxx

@@ -52,7 +52,7 @@ make_new(PPInstance *inst, P3D_object *p3d_object) {
  */
  */
 void PPPandaObject::
 void PPPandaObject::
 set_p3d_object(P3D_object *p3d_object) {
 set_p3d_object(P3D_object *p3d_object) {
-  if (p3d_object != NULL) {
+  if (p3d_object != nullptr) {
     P3D_OBJECT_INCREF(p3d_object);
     P3D_OBJECT_INCREF(p3d_object);
   }
   }
   P3D_OBJECT_XDECREF(_p3d_object);
   P3D_OBJECT_XDECREF(_p3d_object);
@@ -67,7 +67,7 @@ set_p3d_object(P3D_object *p3d_object) {
 void PPPandaObject::
 void PPPandaObject::
 construct(PPInstance *inst, P3D_object *p3d_object) {
 construct(PPInstance *inst, P3D_object *p3d_object) {
   _instance = inst;
   _instance = inst;
-  _p3d_object = NULL;
+  _p3d_object = nullptr;
   set_p3d_object(p3d_object);
   set_p3d_object(p3d_object);
 }
 }
 
 
@@ -76,8 +76,8 @@ construct(PPInstance *inst, P3D_object *p3d_object) {
  */
  */
 void PPPandaObject::
 void PPPandaObject::
 invalidate() {
 invalidate() {
-  _instance = NULL;
-  set_p3d_object(NULL);
+  _instance = nullptr;
+  set_p3d_object(nullptr);
 }
 }
 
 
 /**
 /**
@@ -87,7 +87,7 @@ bool PPPandaObject::
 has_method(NPIdentifier name) {
 has_method(NPIdentifier name) {
   string method_name = identifier_to_string(name);
   string method_name = identifier_to_string(name);
   // nout << this << ".has_method(" << method_name << ")\n";
   // nout << this << ".has_method(" << method_name << ")\n";
-  if (_p3d_object == NULL) {
+  if (_p3d_object == nullptr) {
     // Not powered up yet.
     // Not powered up yet.
     return false;
     return false;
   }
   }
@@ -114,7 +114,7 @@ invoke(NPIdentifier name, const NPVariant *args, uint32_t argCount,
        NPVariant *result) {
        NPVariant *result) {
   string method_name = identifier_to_string(name);
   string method_name = identifier_to_string(name);
   // nout << this << ".invoke(" << method_name << ")\n";
   // nout << this << ".invoke(" << method_name << ")\n";
-  if (_p3d_object == NULL) {
+  if (_p3d_object == nullptr) {
     // Not powered up yet.
     // Not powered up yet.
     return false;
     return false;
   }
   }
@@ -132,7 +132,7 @@ invoke(NPIdentifier name, const NPVariant *args, uint32_t argCount,
   }
   }
   delete[] p3dargs;
   delete[] p3dargs;
 
 
-  if (value == NULL) {
+  if (value == nullptr) {
     // No such method, or some problem with the parameters.
     // No such method, or some problem with the parameters.
     return false;
     return false;
   }
   }
@@ -151,7 +151,7 @@ bool PPPandaObject::
 invoke_default(const NPVariant *args, uint32_t argCount,
 invoke_default(const NPVariant *args, uint32_t argCount,
                NPVariant *result) {
                NPVariant *result) {
   // nout << this << ".invoke_default()\n";
   // nout << this << ".invoke_default()\n";
-  if (_p3d_object == NULL) {
+  if (_p3d_object == nullptr) {
     // Not powered up yet.
     // Not powered up yet.
     return false;
     return false;
   }
   }
@@ -169,7 +169,7 @@ invoke_default(const NPVariant *args, uint32_t argCount,
   }
   }
   delete[] p3dargs;
   delete[] p3dargs;
 
 
-  if (value == NULL) {
+  if (value == nullptr) {
     // No such method, or some problem with the parameters.
     // No such method, or some problem with the parameters.
     return false;
     return false;
   }
   }
@@ -187,7 +187,7 @@ bool PPPandaObject::
 has_property(NPIdentifier name) {
 has_property(NPIdentifier name) {
   string property_name = identifier_to_string(name);
   string property_name = identifier_to_string(name);
   // nout << this << ".has_property(" << property_name << ")\n";
   // nout << this << ".has_property(" << property_name << ")\n";
-  if (_p3d_object == NULL) {
+  if (_p3d_object == nullptr) {
     // Not powered up yet.
     // Not powered up yet.
     return false;
     return false;
   }
   }
@@ -215,14 +215,14 @@ get_property(NPIdentifier name, NPVariant *result) {
 
 
   string property_name = identifier_to_string(name);
   string property_name = identifier_to_string(name);
   // nout << this << ".get_property(" << property_name << ")\n";
   // nout << this << ".get_property(" << property_name << ")\n";
-  if (_p3d_object == NULL) {
+  if (_p3d_object == nullptr) {
     // Not powered up yet.
     // Not powered up yet.
     VOID_TO_NPVARIANT(*result);
     VOID_TO_NPVARIANT(*result);
     return true;
     return true;
   }
   }
 
 
   P3D_object *value = P3D_OBJECT_GET_PROPERTY(_p3d_object, property_name.c_str());
   P3D_object *value = P3D_OBJECT_GET_PROPERTY(_p3d_object, property_name.c_str());
-  if (value == NULL) {
+  if (value == nullptr) {
     // No such property.
     // No such property.
     VOID_TO_NPVARIANT(*result);
     VOID_TO_NPVARIANT(*result);
     return true;
     return true;
@@ -242,7 +242,7 @@ bool PPPandaObject::
 set_property(NPIdentifier name, const NPVariant *value) {
 set_property(NPIdentifier name, const NPVariant *value) {
   string property_name = identifier_to_string(name);
   string property_name = identifier_to_string(name);
   // nout << this << ".set_property(" << property_name << ")\n";
   // nout << this << ".set_property(" << property_name << ")\n";
-  if (_p3d_object == NULL) {
+  if (_p3d_object == nullptr) {
     // Not powered up yet.
     // Not powered up yet.
     return false;
     return false;
   }
   }
@@ -262,13 +262,13 @@ bool PPPandaObject::
 remove_property(NPIdentifier name) {
 remove_property(NPIdentifier name) {
   string property_name = identifier_to_string(name);
   string property_name = identifier_to_string(name);
   // nout << this << ".remove_property(" << property_name << ")\n";
   // nout << this << ".remove_property(" << property_name << ")\n";
-  if (_p3d_object == NULL) {
+  if (_p3d_object == nullptr) {
     // Not powered up yet.
     // Not powered up yet.
     return false;
     return false;
   }
   }
 
 
   bool result = P3D_OBJECT_SET_PROPERTY(_p3d_object, property_name.c_str(),
   bool result = P3D_OBJECT_SET_PROPERTY(_p3d_object, property_name.c_str(),
-                                        true, NULL);
+                                        true, nullptr);
   return result;
   return result;
 }
 }
 
 
@@ -281,7 +281,7 @@ enumerate(NPIdentifier **value, uint32_t *count) {
   // nout << this << ".enumerate()\n"; TODO: Not implemented yet.
   // nout << this << ".enumerate()\n"; TODO: Not implemented yet.
 
 
   // Note that the array of values must be allocated here with NPN_MemAlloc().
   // Note that the array of values must be allocated here with NPN_MemAlloc().
-  *value = NULL;
+  *value = nullptr;
   *count = 0;
   *count = 0;
   return false;
   return false;
 }
 }
@@ -294,7 +294,7 @@ string PPPandaObject::
 identifier_to_string(NPIdentifier ident) {
 identifier_to_string(NPIdentifier ident) {
   if (browser->identifierisstring(ident)) {
   if (browser->identifierisstring(ident)) {
     NPUTF8 *result = browser->utf8fromidentifier(ident);
     NPUTF8 *result = browser->utf8fromidentifier(ident);
-    if (result != NULL) {
+    if (result != nullptr) {
       string strval(result);
       string strval(result);
       browser->memfree(result);
       browser->memfree(result);
       return strval;
       return strval;

+ 6 - 6
direct/src/plugin_npapi/ppToplevelObject.cxx

@@ -52,7 +52,7 @@ make_new(PPInstance *inst) {
  */
  */
 void PPToplevelObject::
 void PPToplevelObject::
 set_main(P3D_object *p3d_object) {
 set_main(P3D_object *p3d_object) {
-  if (p3d_object != NULL) {
+  if (p3d_object != nullptr) {
     P3D_OBJECT_INCREF(p3d_object);
     P3D_OBJECT_INCREF(p3d_object);
   }
   }
   P3D_OBJECT_XDECREF(_main);
   P3D_OBJECT_XDECREF(_main);
@@ -67,7 +67,7 @@ set_main(P3D_object *p3d_object) {
 void PPToplevelObject::
 void PPToplevelObject::
 construct(PPInstance *inst) {
 construct(PPInstance *inst) {
   _instance = inst;
   _instance = inst;
-  _main = NULL;
+  _main = nullptr;
 
 
   // Get our one property name as an identifier, so we can look for it.
   // Get our one property name as an identifier, so we can look for it.
   _main_id = browser->getstringidentifier("main");
   _main_id = browser->getstringidentifier("main");
@@ -78,8 +78,8 @@ construct(PPInstance *inst) {
  */
  */
 void PPToplevelObject::
 void PPToplevelObject::
 invalidate() {
 invalidate() {
-  _instance = NULL;
-  set_main(NULL);
+  _instance = nullptr;
+  set_main(nullptr);
 }
 }
 
 
 /**
 /**
@@ -87,7 +87,7 @@ invalidate() {
  */
  */
 bool PPToplevelObject::
 bool PPToplevelObject::
 has_property(NPIdentifier name) {
 has_property(NPIdentifier name) {
-  if (_main == NULL) {
+  if (_main == nullptr) {
     // Not powered up yet.
     // Not powered up yet.
     return false;
     return false;
   }
   }
@@ -105,7 +105,7 @@ has_property(NPIdentifier name) {
  */
  */
 bool PPToplevelObject::
 bool PPToplevelObject::
 get_property(NPIdentifier name, NPVariant *result) {
 get_property(NPIdentifier name, NPVariant *result) {
-  if (_main == NULL) {
+  if (_main == nullptr) {
     // Not powered up yet.
     // Not powered up yet.
     return false;
     return false;
   }
   }

+ 17 - 17
direct/src/plugin_npapi/startup.cxx

@@ -127,7 +127,7 @@ NP_GetMIMEDescription(void) {
  */
  */
 NPError
 NPError
 NP_GetValue(void*, NPPVariable variable, void* value) {
 NP_GetValue(void*, NPPVariable variable, void* value) {
-  if (value == NULL) {
+  if (value == nullptr) {
     return NPERR_INVALID_PARAM;
     return NPERR_INVALID_PARAM;
   }
   }
 
 
@@ -175,7 +175,7 @@ NP_Initialize(NPNetscapeFuncs *browserFuncs,
   // On Unix, we have to use the pluginFuncs argument to pass our entry
   // On Unix, we have to use the pluginFuncs argument to pass our entry
   // points.
   // points.
 #if !defined(_WIN32) && !defined(__APPLE__)
 #if !defined(_WIN32) && !defined(__APPLE__)
-  if (pluginFuncs != NULL) {
+  if (pluginFuncs != nullptr) {
     NP_GetEntryPoints(pluginFuncs);
     NP_GetEntryPoints(pluginFuncs);
   }
   }
 #endif
 #endif
@@ -194,7 +194,7 @@ NP_Initialize(NPNetscapeFuncs *browserFuncs,
 #ifdef HAS_PLUGIN_THREAD_ASYNC_CALL
 #ifdef HAS_PLUGIN_THREAD_ASYNC_CALL
   // Check if the browser offers this very useful call.
   // Check if the browser offers this very useful call.
   if (browser_major > 0 || browser_minor >= NPVERS_HAS_PLUGIN_THREAD_ASYNC_CALL) {
   if (browser_major > 0 || browser_minor >= NPVERS_HAS_PLUGIN_THREAD_ASYNC_CALL) {
-    if ((void *)browser->pluginthreadasynccall == (void *)NULL) {
+    if ((void *)browser->pluginthreadasynccall == nullptr) {
       nout << "Browser should have PLUGIN_THREAD_ASYNC_CALL, but the pointer is NULL.\n";
       nout << "Browser should have PLUGIN_THREAD_ASYNC_CALL, but the pointer is NULL.\n";
       has_plugin_thread_async_call = false;
       has_plugin_thread_async_call = false;
     } else {
     } else {
@@ -205,7 +205,7 @@ NP_Initialize(NPNetscapeFuncs *browserFuncs,
 
 
   // Seed the lame random number generator in rand(); we use it to select a
   // Seed the lame random number generator in rand(); we use it to select a
   // mirror for downloading.
   // mirror for downloading.
-  srand((unsigned int)time(NULL));
+  srand((unsigned int)time(nullptr));
 
 
   return NPERR_NO_ERROR;
   return NPERR_NO_ERROR;
 }
 }
@@ -370,11 +370,11 @@ NPP_Destroy(NPP instance, NPSavedData **save) {
   nout << "save = " << (void *)save << "\n";
   nout << "save = " << (void *)save << "\n";
   // (*save) = NULL;
   // (*save) = NULL;
   PPInstance *inst = (PPInstance *)(instance->pdata);
   PPInstance *inst = (PPInstance *)(instance->pdata);
-  assert(inst != NULL);
+  assert(inst != nullptr);
   inst->stop_outstanding_streams();
   inst->stop_outstanding_streams();
 
 
   delete inst;
   delete inst;
-  instance->pdata = NULL;
+  instance->pdata = nullptr;
 
 
   return NPERR_NO_ERROR;
   return NPERR_NO_ERROR;
 }
 }
@@ -392,7 +392,7 @@ NPP_SetWindow(NPP instance, NPWindow *window) {
           << "\n";
           << "\n";
 
 
   PPInstance *inst = (PPInstance *)(instance->pdata);
   PPInstance *inst = (PPInstance *)(instance->pdata);
-  assert(inst != NULL);
+  assert(inst != nullptr);
   inst->set_window(window);
   inst->set_window(window);
 
 
   return NPERR_NO_ERROR;
   return NPERR_NO_ERROR;
@@ -414,7 +414,7 @@ NPP_NewStream(NPP instance, NPMIMEType type, NPStream *stream,
        << ", " << (PPInstance *)(instance->pdata) << "\n";
        << ", " << (PPInstance *)(instance->pdata) << "\n";
   PPInstance::generic_browser_call();
   PPInstance::generic_browser_call();
   PPInstance *inst = (PPInstance *)(instance->pdata);
   PPInstance *inst = (PPInstance *)(instance->pdata);
-  assert(inst != NULL);
+  assert(inst != nullptr);
 
 
   return inst->new_stream(type, stream, seekable != 0, stype);
   return inst->new_stream(type, stream, seekable != 0, stype);
 }
 }
@@ -432,7 +432,7 @@ NPP_DestroyStream(NPP instance, NPStream *stream, NPReason reason) {
 
 
   PPInstance::generic_browser_call();
   PPInstance::generic_browser_call();
   PPInstance *inst = (PPInstance *)(instance->pdata);
   PPInstance *inst = (PPInstance *)(instance->pdata);
-  assert(inst != NULL);
+  assert(inst != nullptr);
 
 
   return inst->destroy_stream(stream, reason);
   return inst->destroy_stream(stream, reason);
 }
 }
@@ -446,7 +446,7 @@ NPP_WriteReady_x(NPP instance, NPStream *stream) {
   // (PPInstance *)(instance->pdata) << "\n";
   // (PPInstance *)(instance->pdata) << "\n";
   PPInstance::generic_browser_call();
   PPInstance::generic_browser_call();
   PPInstance *inst = (PPInstance *)(instance->pdata);
   PPInstance *inst = (PPInstance *)(instance->pdata);
-  assert(inst != NULL);
+  assert(inst != nullptr);
 
 
   return inst->write_ready(stream);
   return inst->write_ready(stream);
 }
 }
@@ -462,7 +462,7 @@ NPP_Write_x(NPP instance, NPStream *stream, int32_t offset,
   // " << instance << ", " << (PPInstance *)(instance->pdata) << "\n";
   // " << instance << ", " << (PPInstance *)(instance->pdata) << "\n";
   PPInstance::generic_browser_call();
   PPInstance::generic_browser_call();
   PPInstance *inst = (PPInstance *)(instance->pdata);
   PPInstance *inst = (PPInstance *)(instance->pdata);
-  assert(inst != NULL);
+  assert(inst != nullptr);
 
 
   return inst->write_stream(stream, offset, len, buffer);
   return inst->write_stream(stream, offset, len, buffer);
 }
 }
@@ -481,7 +481,7 @@ NPP_StreamAsFile(NPP instance, NPStream *stream, const char *fname) {
 
 
   PPInstance::generic_browser_call();
   PPInstance::generic_browser_call();
   PPInstance *inst = (PPInstance *)(instance->pdata);
   PPInstance *inst = (PPInstance *)(instance->pdata);
-  assert(inst != NULL);
+  assert(inst != nullptr);
 
 
   inst->stream_as_file(stream, fname);
   inst->stream_as_file(stream, fname);
 }
 }
@@ -504,7 +504,7 @@ NPP_HandleEvent(NPP instance, void *event) {
   PPInstance::generic_browser_call();
   PPInstance::generic_browser_call();
 
 
   PPInstance *inst = (PPInstance *)(instance->pdata);
   PPInstance *inst = (PPInstance *)(instance->pdata);
-  assert(inst != NULL);
+  assert(inst != nullptr);
 
 
   return inst->handle_event(event);
   return inst->handle_event(event);
 }
 }
@@ -522,7 +522,7 @@ NPP_URLNotify(NPP instance, const char *url,
 
 
   PPInstance::generic_browser_call();
   PPInstance::generic_browser_call();
   PPInstance *inst = (PPInstance *)(instance->pdata);
   PPInstance *inst = (PPInstance *)(instance->pdata);
-  assert(inst != NULL);
+  assert(inst != nullptr);
 
 
   inst->url_notify(url, reason, notifyData);
   inst->url_notify(url, reason, notifyData);
 }
 }
@@ -535,11 +535,11 @@ NPP_GetValue(NPP instance, NPPVariable variable, void *value) {
   nout << "GetValue " << variable << "\n";
   nout << "GetValue " << variable << "\n";
   PPInstance::generic_browser_call();
   PPInstance::generic_browser_call();
   PPInstance *inst = (PPInstance *)(instance->pdata);
   PPInstance *inst = (PPInstance *)(instance->pdata);
-  assert(inst != NULL);
+  assert(inst != nullptr);
 
 
   if (variable == NPPVpluginScriptableNPObject) {
   if (variable == NPPVpluginScriptableNPObject) {
     NPObject *obj = inst->get_panda_script_object();
     NPObject *obj = inst->get_panda_script_object();
-    if (obj != NULL) {
+    if (obj != nullptr) {
       *(NPObject **)value = obj;
       *(NPObject **)value = obj;
       return NPERR_NO_ERROR;
       return NPERR_NO_ERROR;
     }
     }
@@ -571,7 +571,7 @@ NPP_GetValue(NPP instance, NPPVariable variable, void *value) {
     return NPERR_NO_ERROR;
     return NPERR_NO_ERROR;
 
 
   } else {
   } else {
-    return NP_GetValue(NULL, variable, value);
+    return NP_GetValue(nullptr, variable, value);
   }
   }
 
 
   return NPERR_GENERIC_ERROR;
   return NPERR_GENERIC_ERROR;

+ 2 - 2
direct/src/plugin_standalone/p3dEmbed.cxx

@@ -76,8 +76,8 @@ run_embedded(streampos read_offset, int argc, char *argv[]) {
   string curstr;
   string curstr;
   bool havenull = false;
   bool havenull = false;
   P3D_token token;
   P3D_token token;
-  token._keyword = NULL;
-  token._value = NULL;
+  token._keyword = nullptr;
+  token._value = nullptr;
   string keyword;
   string keyword;
   string value;
   string value;
   string root_dir;
   string root_dir;

+ 21 - 21
direct/src/plugin_standalone/panda3d.cxx

@@ -144,12 +144,12 @@ run_command_line(int argc, char *argv[]) {
         // will be delivered to the subordinate Python process and return to a
         // will be delivered to the subordinate Python process and return to a
         // command shell, and won't just kill the panda3d process.
         // command shell, and won't just kill the panda3d process.
 #ifdef _WIN32
 #ifdef _WIN32
-        SetConsoleCtrlHandler(NULL, true);
+        SetConsoleCtrlHandler(nullptr, true);
 #else
 #else
         struct sigaction ignore;
         struct sigaction ignore;
         memset(&ignore, 0, sizeof(ignore));
         memset(&ignore, 0, sizeof(ignore));
         ignore.sa_handler = SIG_IGN;
         ignore.sa_handler = SIG_IGN;
-        sigaction(SIGINT, &ignore, NULL);
+        sigaction(SIGINT, &ignore, nullptr);
 #endif  // _WIN32
 #endif  // _WIN32
       }
       }
       break;
       break;
@@ -348,7 +348,7 @@ get_plugin() {
   Filename contents_filename = Filename(Filename::from_os_specific(_root_dir), "contents.xml");
   Filename contents_filename = Filename(Filename::from_os_specific(_root_dir), "contents.xml");
   if (_verify_contents != P3D_VC_force) {
   if (_verify_contents != P3D_VC_force) {
     if (read_contents_file(contents_filename, false)) {
     if (read_contents_file(contents_filename, false)) {
-      if (_verify_contents == P3D_VC_none || time(NULL) < _contents_expiration) {
+      if (_verify_contents == P3D_VC_none || time(nullptr) < _contents_expiration) {
         // Got the file, and it's good.
         // Got the file, and it's good.
         success = true;
         success = true;
       }
       }
@@ -415,7 +415,7 @@ download_contents_file(const Filename &contents_filename) {
     // Append a uniquifying query string to the URL to force the download to
     // Append a uniquifying query string to the URL to force the download to
     // go all the way through any caches.  We use the time in seconds; that's
     // go all the way through any caches.  We use the time in seconds; that's
     // unique enough.
     // unique enough.
-    strm << "?" << time(NULL);
+    strm << "?" << time(nullptr);
     string url = strm.str();
     string url = strm.str();
 
 
     // We might as well explicitly request the cache to be disabled too, since
     // We might as well explicitly request the cache to be disabled too, since
@@ -468,19 +468,19 @@ read_contents_file(const Filename &contents_filename, bool fresh_download) {
   bool found_core_package = false;
   bool found_core_package = false;
 
 
   TiXmlElement *xcontents = doc.FirstChildElement("contents");
   TiXmlElement *xcontents = doc.FirstChildElement("contents");
-  if (xcontents != NULL) {
+  if (xcontents != nullptr) {
     int max_age = P3D_CONTENTS_DEFAULT_MAX_AGE;
     int max_age = P3D_CONTENTS_DEFAULT_MAX_AGE;
     xcontents->Attribute("max_age", &max_age);
     xcontents->Attribute("max_age", &max_age);
 
 
     // Get the latest possible expiration time, based on the max_age
     // Get the latest possible expiration time, based on the max_age
     // indication.  Any expiration time later than this is in error.
     // indication.  Any expiration time later than this is in error.
-    time_t now = time(NULL);
+    time_t now = time(nullptr);
     _contents_expiration = now + (time_t)max_age;
     _contents_expiration = now + (time_t)max_age;
 
 
     if (fresh_download) {
     if (fresh_download) {
       // Update the XML with the new download information.
       // Update the XML with the new download information.
       TiXmlElement *xorig = xcontents->FirstChildElement("orig");
       TiXmlElement *xorig = xcontents->FirstChildElement("orig");
-      while (xorig != NULL) {
+      while (xorig != nullptr) {
         xcontents->RemoveChild(xorig);
         xcontents->RemoveChild(xorig);
         xorig = xcontents->FirstChildElement("orig");
         xorig = xcontents->FirstChildElement("orig");
       }
       }
@@ -494,7 +494,7 @@ read_contents_file(const Filename &contents_filename, bool fresh_download) {
       // Read the expiration time from the XML.
       // Read the expiration time from the XML.
       int expiration = 0;
       int expiration = 0;
       TiXmlElement *xorig = xcontents->FirstChildElement("orig");
       TiXmlElement *xorig = xcontents->FirstChildElement("orig");
-      if (xorig != NULL) {
+      if (xorig != nullptr) {
         xorig->Attribute("expiration", &expiration);
         xorig->Attribute("expiration", &expiration);
       }
       }
 
 
@@ -508,14 +508,14 @@ read_contents_file(const Filename &contents_filename, bool fresh_download) {
     // Now look for the core API package.
     // Now look for the core API package.
     _coreapi_set_ver = "";
     _coreapi_set_ver = "";
     TiXmlElement *xpackage = xcontents->FirstChildElement("package");
     TiXmlElement *xpackage = xcontents->FirstChildElement("package");
-    while (xpackage != NULL) {
+    while (xpackage != nullptr) {
       const char *name = xpackage->Attribute("name");
       const char *name = xpackage->Attribute("name");
-      if (name != NULL && strcmp(name, "coreapi") == 0) {
+      if (name != nullptr && strcmp(name, "coreapi") == 0) {
         const char *platform = xpackage->Attribute("platform");
         const char *platform = xpackage->Attribute("platform");
-        if (platform != NULL && _coreapi_platform == string(platform)) {
+        if (platform != nullptr && _coreapi_platform == string(platform)) {
           _coreapi_dll.load_xml(xpackage);
           _coreapi_dll.load_xml(xpackage);
           const char *set_ver = xpackage->Attribute("set_ver");
           const char *set_ver = xpackage->Attribute("set_ver");
-          if (set_ver != NULL) {
+          if (set_ver != nullptr) {
             _coreapi_set_ver = set_ver;
             _coreapi_set_ver = set_ver;
           }
           }
           found_core_package = true;
           found_core_package = true;
@@ -583,9 +583,9 @@ read_contents_file(const Filename &contents_filename, bool fresh_download) {
 void Panda3D::
 void Panda3D::
 find_host(TiXmlElement *xcontents) {
 find_host(TiXmlElement *xcontents) {
   TiXmlElement *xhost = xcontents->FirstChildElement("host");
   TiXmlElement *xhost = xcontents->FirstChildElement("host");
-  if (xhost != NULL) {
+  if (xhost != nullptr) {
     const char *url = xhost->Attribute("url");
     const char *url = xhost->Attribute("url");
-    if (url != NULL && _host_url == string(url)) {
+    if (url != nullptr && _host_url == string(url)) {
       // We're the primary host.  This is the normal case.
       // We're the primary host.  This is the normal case.
       read_xhost(xhost);
       read_xhost(xhost);
       return;
       return;
@@ -593,9 +593,9 @@ find_host(TiXmlElement *xcontents) {
     } else {
     } else {
       // We're not the primary host; perhaps we're an alternate host.
       // We're not the primary host; perhaps we're an alternate host.
       TiXmlElement *xalthost = xhost->FirstChildElement("alt_host");
       TiXmlElement *xalthost = xhost->FirstChildElement("alt_host");
-      while (xalthost != NULL) {
+      while (xalthost != nullptr) {
         const char *url = xalthost->Attribute("url");
         const char *url = xalthost->Attribute("url");
-        if (url != NULL && _host_url == string(url)) {
+        if (url != nullptr && _host_url == string(url)) {
           // Yep, we're this alternate host.
           // Yep, we're this alternate host.
           read_xhost(xhost);
           read_xhost(xhost);
           return;
           return;
@@ -619,11 +619,11 @@ read_xhost(TiXmlElement *xhost) {
   // Get the "download" URL, which is the source from which we download
   // Get the "download" URL, which is the source from which we download
   // everything other than the contents.xml file.
   // everything other than the contents.xml file.
   const char *download_url = xhost->Attribute("download_url");
   const char *download_url = xhost->Attribute("download_url");
-  if (download_url == NULL) {
+  if (download_url == nullptr) {
     download_url = xhost->Attribute("url");
     download_url = xhost->Attribute("url");
   }
   }
 
 
-  if (download_url != NULL) {
+  if (download_url != nullptr) {
     _download_url_prefix = download_url;
     _download_url_prefix = download_url;
   } else {
   } else {
     _download_url_prefix = _host_url_prefix;
     _download_url_prefix = _host_url_prefix;
@@ -635,9 +635,9 @@ read_xhost(TiXmlElement *xhost) {
   }
   }
 
 
   TiXmlElement *xmirror = xhost->FirstChildElement("mirror");
   TiXmlElement *xmirror = xhost->FirstChildElement("mirror");
-  while (xmirror != NULL) {
+  while (xmirror != nullptr) {
     const char *url = xmirror->Attribute("url");
     const char *url = xmirror->Attribute("url");
-    if (url != NULL) {
+    if (url != nullptr) {
       add_mirror(url);
       add_mirror(url);
     }
     }
     xmirror = xmirror->NextSiblingElement("mirror");
     xmirror = xmirror->NextSiblingElement("mirror");
@@ -767,7 +767,7 @@ download_core_api() {
   // uniquifier, to break through any caches.
   // uniquifier, to break through any caches.
   ostringstream strm;
   ostringstream strm;
   strm << _download_url_prefix << _coreapi_dll.get_filename()
   strm << _download_url_prefix << _coreapi_dll.get_filename()
-       << "?" << time(NULL);
+       << "?" << time(nullptr);
   url = strm.str();
   url = strm.str();
   core_urls.push_back(url);
   core_urls.push_back(url);
 
 

+ 25 - 25
direct/src/plugin_standalone/panda3dBase.cxx

@@ -74,7 +74,7 @@ Panda3DBase(bool console_environment) {
 
 
   // Seed the lame random number generator in rand(); we use it to select a
   // Seed the lame random number generator in rand(); we use it to select a
   // mirror for downloading.
   // mirror for downloading.
-  srand((unsigned int)time(NULL));
+  srand((unsigned int)time(nullptr));
 
 
   _prepend_filename_to_args = true;
   _prepend_filename_to_args = true;
 }
 }
@@ -90,7 +90,7 @@ run_main_loop() {
     // Wait for new messages from Windows, and new requests from the plugin.
     // Wait for new messages from Windows, and new requests from the plugin.
     MSG msg;
     MSG msg;
     int retval;
     int retval;
-    retval = GetMessage(&msg, NULL, 0, 0);
+    retval = GetMessage(&msg, nullptr, 0, 0);
     while (retval != 0 && !time_to_exit()) {
     while (retval != 0 && !time_to_exit()) {
       if (retval == -1) {
       if (retval == -1) {
         cerr << "Error processing message queue.\n";
         cerr << "Error processing message queue.\n";
@@ -101,20 +101,20 @@ run_main_loop() {
 
 
       // Check for new requests from the Panda3D plugin.
       // Check for new requests from the Panda3D plugin.
       P3D_instance *inst = P3D_check_request_ptr(wait_cycle);
       P3D_instance *inst = P3D_check_request_ptr(wait_cycle);
-      while (inst != (P3D_instance *)NULL) {
+      while (inst != nullptr) {
         P3D_request *request = P3D_instance_get_request_ptr(inst);
         P3D_request *request = P3D_instance_get_request_ptr(inst);
-        if (request != (P3D_request *)NULL) {
+        if (request != nullptr) {
           handle_request(request);
           handle_request(request);
         }
         }
         inst = P3D_check_request_ptr(wait_cycle);
         inst = P3D_check_request_ptr(wait_cycle);
       }
       }
 
 
       while (!_url_getters.empty() &&
       while (!_url_getters.empty() &&
-             !PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE)) {
+             !PeekMessage(&msg, nullptr, 0, 0, PM_NOREMOVE)) {
         // If there are no Windows messages, check the download tasks.
         // If there are no Windows messages, check the download tasks.
         run_getters();
         run_getters();
       }
       }
-      retval = GetMessage(&msg, NULL, 0, 0);
+      retval = GetMessage(&msg, nullptr, 0, 0);
     }
     }
 
 
     // WM_QUIT has been received.  Terminate all instances, and fall through.
     // WM_QUIT has been received.  Terminate all instances, and fall through.
@@ -128,9 +128,9 @@ run_main_loop() {
     // Windows events.  Instead, just wait for requests.
     // Windows events.  Instead, just wait for requests.
     while (!time_to_exit()) {
     while (!time_to_exit()) {
       P3D_instance *inst = P3D_check_request_ptr(wait_cycle);
       P3D_instance *inst = P3D_check_request_ptr(wait_cycle);
-      if (inst != (P3D_instance *)NULL) {
+      if (inst != nullptr) {
         P3D_request *request = P3D_instance_get_request_ptr(inst);
         P3D_request *request = P3D_instance_get_request_ptr(inst);
-        if (request != (P3D_request *)NULL) {
+        if (request != nullptr) {
           handle_request(request);
           handle_request(request);
         }
         }
       }
       }
@@ -162,9 +162,9 @@ run_main_loop() {
   // Now wait while we process pending requests.
   // Now wait while we process pending requests.
   while (!time_to_exit()) {
   while (!time_to_exit()) {
     P3D_instance *inst = P3D_check_request_ptr(wait_cycle);
     P3D_instance *inst = P3D_check_request_ptr(wait_cycle);
-    if (inst != (P3D_instance *)NULL) {
+    if (inst != nullptr) {
       P3D_request *request = P3D_instance_get_request_ptr(inst);
       P3D_request *request = P3D_instance_get_request_ptr(inst);
-      if (request != (P3D_request *)NULL) {
+      if (request != nullptr) {
         handle_request(request);
         handle_request(request);
       }
       }
     }
     }
@@ -207,7 +207,7 @@ handle_request(P3D_request *request) {
     delete_instance(request->_instance);
     delete_instance(request->_instance);
 #ifdef _WIN32
 #ifdef _WIN32
     // Post a silly message to spin the event loop.
     // Post a silly message to spin the event loop.
-    PostMessage(NULL, WM_USER, 0, 0);
+    PostMessage(nullptr, WM_USER, 0, 0);
 #endif
 #endif
     handled = true;
     handled = true;
     break;
     break;
@@ -267,7 +267,7 @@ void Panda3DBase::
 make_parent_window() {
 make_parent_window() {
   WNDCLASS wc;
   WNDCLASS wc;
 
 
-  HINSTANCE application = GetModuleHandle(NULL);
+  HINSTANCE application = GetModuleHandle(nullptr);
   ZeroMemory(&wc, sizeof(WNDCLASS));
   ZeroMemory(&wc, sizeof(WNDCLASS));
   wc.lpfnWndProc = (WNDPROC)window_proc;
   wc.lpfnWndProc = (WNDPROC)window_proc;
   wc.hInstance = application;
   wc.hInstance = application;
@@ -287,7 +287,7 @@ make_parent_window() {
   HWND toplevel_window =
   HWND toplevel_window =
     CreateWindow("panda3d", "Panda3D", window_style,
     CreateWindow("panda3d", "Panda3D", window_style,
                  CW_USEDEFAULT, CW_USEDEFAULT, _win_width, _win_height,
                  CW_USEDEFAULT, CW_USEDEFAULT, _win_width, _win_height,
-                 NULL, NULL, application, 0);
+                 nullptr, nullptr, application, 0);
   if (!toplevel_window) {
   if (!toplevel_window) {
     cerr << "Could not create toplevel window!\n";
     cerr << "Could not create toplevel window!\n";
     exit(1);
     exit(1);
@@ -364,7 +364,7 @@ create_instance(const string &p3d, bool start_instance,
   token._value = "1";
   token._value = "1";
   tokens.push_back(token);
   tokens.push_back(token);
 
 
-  P3D_token *tokens_p = NULL;
+  P3D_token *tokens_p = nullptr;
   size_t num_tokens = tokens.size();
   size_t num_tokens = tokens.size();
   if (!tokens.empty()) {
   if (!tokens.empty()) {
     tokens_p = &tokens[0];
     tokens_p = &tokens[0];
@@ -379,10 +379,10 @@ create_instance(const string &p3d, bool start_instance,
     argv.push_back(args[i]);
     argv.push_back(args[i]);
   }
   }
 
 
-  P3D_instance *inst = P3D_new_instance_ptr(NULL, tokens_p, num_tokens,
-                                            argv.size(), &argv[0], NULL);
+  P3D_instance *inst = P3D_new_instance_ptr(nullptr, tokens_p, num_tokens,
+                                            argv.size(), &argv[0], nullptr);
 
 
-  if (inst != NULL) {
+  if (inst != nullptr) {
     if (start_instance) {
     if (start_instance) {
       // We call start() first, to give the core API a chance to notice the
       // We call start() first, to give the core API a chance to notice the
       // "hidden" attrib before we set the window parameters.
       // "hidden" attrib before we set the window parameters.
@@ -443,11 +443,11 @@ read_p3d_info(const Filename &p3d_filename, int p3d_offset) {
     return false;
     return false;
   }
   }
   TiXmlElement *xpackage = doc.FirstChildElement("package");
   TiXmlElement *xpackage = doc.FirstChildElement("package");
-  if (xpackage == NULL) {
+  if (xpackage == nullptr) {
     return false;
     return false;
   }
   }
   TiXmlElement *xconfig = xpackage->FirstChildElement("config");
   TiXmlElement *xconfig = xpackage->FirstChildElement("config");
-  if (xconfig == NULL) {
+  if (xconfig == nullptr) {
     return false;
     return false;
   }
   }
 
 
@@ -473,7 +473,7 @@ read_p3d_info(const Filename &p3d_filename, int p3d_offset) {
 bool Panda3DBase::
 bool Panda3DBase::
 parse_token(const char *arg) {
 parse_token(const char *arg) {
   const char *equals = strchr(arg, '=');
   const char *equals = strchr(arg, '=');
-  if (equals == NULL) {
+  if (equals == nullptr) {
     return false;
     return false;
   }
   }
 
 
@@ -624,12 +624,12 @@ report_downloading_package(P3D_instance *instance) {
   P3D_object *obj = P3D_instance_get_panda_script_object_ptr(instance);
   P3D_object *obj = P3D_instance_get_panda_script_object_ptr(instance);
 
 
   P3D_object *display_name = P3D_object_get_property_ptr(obj, "downloadPackageDisplayName");
   P3D_object *display_name = P3D_object_get_property_ptr(obj, "downloadPackageDisplayName");
-  if (display_name == NULL) {
+  if (display_name == nullptr) {
     cerr << "Installing package.\n";
     cerr << "Installing package.\n";
     return;
     return;
   }
   }
 
 
-  int name_length = P3D_object_get_string_ptr(display_name, NULL, 0);
+  int name_length = P3D_object_get_string_ptr(display_name, nullptr, 0);
   char *name = new char[name_length + 1];
   char *name = new char[name_length + 1];
   P3D_object_get_string_ptr(display_name, name, name_length + 1);
   P3D_object_get_string_ptr(display_name, name, name_length + 1);
 
 
@@ -670,9 +670,9 @@ void Panda3DBase::
 timer_callback(EventLoopTimerRef timer) {
 timer_callback(EventLoopTimerRef timer) {
   // Check for new requests from the Panda3D plugin.
   // Check for new requests from the Panda3D plugin.
   P3D_instance *inst = P3D_check_request_ptr(0.0);
   P3D_instance *inst = P3D_check_request_ptr(0.0);
-  while (inst != (P3D_instance *)NULL) {
+  while (inst != nullptr) {
     P3D_request *request = P3D_instance_get_request_ptr(inst);
     P3D_request *request = P3D_instance_get_request_ptr(inst);
-    if (request != (P3D_request *)NULL) {
+    if (request != nullptr) {
       handle_request(request);
       handle_request(request);
     }
     }
     inst = P3D_check_request_ptr(0.0);
     inst = P3D_check_request_ptr(0.0);
@@ -758,6 +758,6 @@ run() {
   P3D_instance_feed_url_stream_ptr
   P3D_instance_feed_url_stream_ptr
     (_instance, _unique_id, status,
     (_instance, _unique_id, status,
      _channel->get_status_code(),
      _channel->get_status_code(),
-     _bytes_sent, NULL, 0);
+     _bytes_sent, nullptr, 0);
   return false;
   return false;
 }
 }

+ 2 - 2
direct/src/plugin_standalone/panda3dMac.cxx

@@ -53,7 +53,7 @@ open_p3d_file(FSRef *ref) {
   }
   }
 
 
   // Create an instance.
   // Create an instance.
-  create_instance((char *)filename, true, NULL, 0);
+  create_instance((char *)filename, true, nullptr, 0);
 }
 }
 
 
 static pascal OSErr
 static pascal OSErr
@@ -74,7 +74,7 @@ open_documents_handler(const AppleEvent *theAppleEvent, AppleEvent *reply,
 
 
   for (index = 1; index <= count; index++) {
   for (index = 1; index <= count; index++) {
     err = AEGetNthPtr(&docList, index, typeFSRef,
     err = AEGetNthPtr(&docList, index, typeFSRef,
-                      NULL, NULL, &theFSRef, sizeof(FSRef), NULL);// 5
+                      nullptr, nullptr, &theFSRef, sizeof(FSRef), nullptr);// 5
     require_noerr(err, CantGetDocDescPtr);
     require_noerr(err, CantGetDocDescPtr);
 
 
     // Here's the file, do something with it.
     // Here's the file, do something with it.

+ 10 - 10
dtool/src/cppparser/cppArrayType.cxx

@@ -85,7 +85,7 @@ is_trivial() const {
  */
  */
 bool CPPArrayType::
 bool CPPArrayType::
 is_default_constructible() const {
 is_default_constructible() const {
-  return _bounds != NULL && _element_type->is_default_constructible();
+  return _bounds != nullptr && _element_type->is_default_constructible();
 }
 }
 
 
 /**
 /**
@@ -105,7 +105,7 @@ is_copy_constructible() const {
 bool CPPArrayType::
 bool CPPArrayType::
 is_equivalent(const CPPType &other) const {
 is_equivalent(const CPPType &other) const {
   const CPPArrayType *ot = ((CPPType *)&other)->as_array_type();
   const CPPArrayType *ot = ((CPPType *)&other)->as_array_type();
-  if (ot == (CPPArrayType *)NULL) {
+  if (ot == nullptr) {
     return CPPType::is_equivalent(other);
     return CPPType::is_equivalent(other);
   }
   }
 
 
@@ -128,7 +128,7 @@ substitute_decl(CPPDeclaration::SubstDecl &subst,
     _element_type->substitute_decl(subst, current_scope, global_scope)
     _element_type->substitute_decl(subst, current_scope, global_scope)
     ->as_type();
     ->as_type();
 
 
-  if (_bounds != NULL) {
+  if (_bounds != nullptr) {
     rep->_bounds =
     rep->_bounds =
       _bounds->substitute_decl(subst, current_scope, global_scope)
       _bounds->substitute_decl(subst, current_scope, global_scope)
       ->as_expression();
       ->as_expression();
@@ -171,7 +171,7 @@ output_instance(ostream &out, int indent_level, CPPScope *scope,
                 const string &name) const {
                 const string &name) const {
   ostringstream brackets;
   ostringstream brackets;
   brackets << "[";
   brackets << "[";
-  if (_bounds != NULL) {
+  if (_bounds != nullptr) {
     brackets << *_bounds;
     brackets << *_bounds;
   }
   }
   brackets << "]";
   brackets << "]";
@@ -204,13 +204,13 @@ as_array_type() {
 bool CPPArrayType::
 bool CPPArrayType::
 is_equal(const CPPDeclaration *other) const {
 is_equal(const CPPDeclaration *other) const {
   const CPPArrayType *ot = ((CPPDeclaration *)other)->as_array_type();
   const CPPArrayType *ot = ((CPPDeclaration *)other)->as_array_type();
-  assert(ot != NULL);
+  assert(ot != nullptr);
 
 
-  if (_bounds != NULL && ot->_bounds != NULL) {
+  if (_bounds != nullptr && ot->_bounds != nullptr) {
     if (*_bounds != *ot->_bounds) {
     if (*_bounds != *ot->_bounds) {
       return false;
       return false;
     }
     }
-  } else if ((_bounds == NULL) != (ot->_bounds == NULL)) {
+  } else if ((_bounds == nullptr) != (ot->_bounds == nullptr)) {
     return false;
     return false;
   }
   }
 
 
@@ -225,13 +225,13 @@ is_equal(const CPPDeclaration *other) const {
 bool CPPArrayType::
 bool CPPArrayType::
 is_less(const CPPDeclaration *other) const {
 is_less(const CPPDeclaration *other) const {
   const CPPArrayType *ot = ((CPPDeclaration *)other)->as_array_type();
   const CPPArrayType *ot = ((CPPDeclaration *)other)->as_array_type();
-  assert(ot != NULL);
+  assert(ot != nullptr);
 
 
-  if (_bounds != NULL && ot->_bounds != NULL) {
+  if (_bounds != nullptr && ot->_bounds != nullptr) {
     if (*_bounds != *ot->_bounds) {
     if (*_bounds != *ot->_bounds) {
       return *_bounds < *ot->_bounds;
       return *_bounds < *ot->_bounds;
     }
     }
-  } else if ((_bounds == NULL) != (ot->_bounds == NULL)) {
+  } else if ((_bounds == nullptr) != (ot->_bounds == nullptr)) {
     return _bounds < ot->_bounds;
     return _bounds < ot->_bounds;
   }
   }
 
 

+ 116 - 116
dtool/src/cppparser/cppBison.yxx

@@ -36,15 +36,15 @@
 // Defining the interface to the parser.
 // Defining the interface to the parser.
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 
 
-CPPScope *current_scope = NULL;
-CPPScope *global_scope = NULL;
-CPPPreprocessor *current_lexer = NULL;
+CPPScope *current_scope = nullptr;
+CPPScope *global_scope = nullptr;
+CPPPreprocessor *current_lexer = nullptr;
 
 
-static CPPStructType *current_struct = NULL;
-static CPPEnumType *current_enum = NULL;
+static CPPStructType *current_struct = nullptr;
+static CPPEnumType *current_enum = nullptr;
 static int current_storage_class = 0;
 static int current_storage_class = 0;
-static CPPType *current_type = NULL;
-static CPPExpression *current_expr = NULL;
+static CPPType *current_type = nullptr;
+static CPPExpression *current_expr = nullptr;
 static int publish_nest_level = 0;
 static int publish_nest_level = 0;
 static CPPVisibility publish_previous;
 static CPPVisibility publish_previous;
 static YYLTYPE publish_loc;
 static YYLTYPE publish_loc;
@@ -118,7 +118,7 @@ parse_const_expr(CPPPreprocessor *pp, CPPScope *new_current_scope,
 
 
   current_scope = new_current_scope;
   current_scope = new_current_scope;
   global_scope = new_global_scope;
   global_scope = new_global_scope;
-  current_expr = (CPPExpression *)NULL;
+  current_expr = nullptr;
   current_lexer = pp;
   current_lexer = pp;
   yyparse();
   yyparse();
 
 
@@ -142,7 +142,7 @@ parse_type(CPPPreprocessor *pp, CPPScope *new_current_scope,
 
 
   current_scope = new_current_scope;
   current_scope = new_current_scope;
   global_scope = new_global_scope;
   global_scope = new_global_scope;
-  current_type = (CPPType *)NULL;
+  current_type = nullptr;
   current_lexer = pp;
   current_lexer = pp;
   yyparse();
   yyparse();
 
 
@@ -159,7 +159,7 @@ parse_type(CPPPreprocessor *pp, CPPScope *new_current_scope,
 static void
 static void
 push_scope(CPPScope *new_scope) {
 push_scope(CPPScope *new_scope) {
   last_scopes.push_back(current_scope);
   last_scopes.push_back(current_scope);
-  if (new_scope != NULL) {
+  if (new_scope != nullptr) {
     current_scope = new_scope;
     current_scope = new_scope;
   }
   }
 }
 }
@@ -652,7 +652,7 @@ declaration:
   CPPDeclaration *length_getter = $5->find_symbol(current_scope, global_scope, current_lexer);
   CPPDeclaration *length_getter = $5->find_symbol(current_scope, global_scope, current_lexer);
   if (length_getter == nullptr || length_getter->get_subtype() != CPPDeclaration::ST_function_group) {
   if (length_getter == nullptr || length_getter->get_subtype() != CPPDeclaration::ST_function_group) {
     yyerror("reference to non-existent or invalid length method: " + $5->get_fully_scoped_name(), @5);
     yyerror("reference to non-existent or invalid length method: " + $5->get_fully_scoped_name(), @5);
-    length_getter = NULL;
+    length_getter = nullptr;
   }
   }
 
 
   CPPDeclaration *getter = $7->find_symbol(current_scope, global_scope, current_lexer);
   CPPDeclaration *getter = $7->find_symbol(current_scope, global_scope, current_lexer);
@@ -688,7 +688,7 @@ declaration:
   CPPDeclaration *length_getter = $5->find_symbol(current_scope, global_scope, current_lexer);
   CPPDeclaration *length_getter = $5->find_symbol(current_scope, global_scope, current_lexer);
   if (length_getter == nullptr || length_getter->get_subtype() != CPPDeclaration::ST_function_group) {
   if (length_getter == nullptr || length_getter->get_subtype() != CPPDeclaration::ST_function_group) {
     yyerror("reference to non-existent or invalid length method: " + $5->get_fully_scoped_name(), @5);
     yyerror("reference to non-existent or invalid length method: " + $5->get_fully_scoped_name(), @5);
-    length_getter = NULL;
+    length_getter = nullptr;
   }
   }
 
 
   CPPDeclaration *getter = $7->find_symbol(current_scope, global_scope, current_lexer);
   CPPDeclaration *getter = $7->find_symbol(current_scope, global_scope, current_lexer);
@@ -890,18 +890,18 @@ declaration:
         | KW_MAKE_SEQ '(' name ',' IDENTIFIER ',' IDENTIFIER ')' ';'
         | KW_MAKE_SEQ '(' name ',' IDENTIFIER ',' IDENTIFIER ')' ';'
 {
 {
   CPPDeclaration *length_getter = $5->find_symbol(current_scope, global_scope, current_lexer);
   CPPDeclaration *length_getter = $5->find_symbol(current_scope, global_scope, current_lexer);
-  if (length_getter == (CPPDeclaration *)NULL || length_getter->get_subtype() != CPPDeclaration::ST_function_group) {
+  if (length_getter == nullptr || length_getter->get_subtype() != CPPDeclaration::ST_function_group) {
     yyerror("reference to non-existent or invalid length method: " + $5->get_fully_scoped_name(), @5);
     yyerror("reference to non-existent or invalid length method: " + $5->get_fully_scoped_name(), @5);
-    length_getter = NULL;
+    length_getter = nullptr;
   }
   }
 
 
   CPPDeclaration *element_getter = $7->find_symbol(current_scope, global_scope, current_lexer);
   CPPDeclaration *element_getter = $7->find_symbol(current_scope, global_scope, current_lexer);
-  if (element_getter == (CPPDeclaration *)NULL || element_getter->get_subtype() != CPPDeclaration::ST_function_group) {
+  if (element_getter == nullptr || element_getter->get_subtype() != CPPDeclaration::ST_function_group) {
     yyerror("reference to non-existent or invalid element method: " + $7->get_fully_scoped_name(), @5);
     yyerror("reference to non-existent or invalid element method: " + $7->get_fully_scoped_name(), @5);
-    element_getter = NULL;
+    element_getter = nullptr;
   }
   }
 
 
-  if (length_getter != (CPPDeclaration *)NULL && element_getter != (CPPDeclaration *)NULL) {
+  if (length_getter != nullptr && element_getter != nullptr) {
     CPPMakeSeq *make_seq = new CPPMakeSeq($3,
     CPPMakeSeq *make_seq = new CPPMakeSeq($3,
                                           length_getter->as_function_group(),
                                           length_getter->as_function_group(),
                                           element_getter->as_function_group(),
                                           element_getter->as_function_group(),
@@ -1070,7 +1070,7 @@ type_like_declaration:
 }
 }
         | storage_class constructor_prototype
         | storage_class constructor_prototype
 {
 {
-  if ($2 != (CPPInstance *)NULL) {
+  if ($2 != nullptr) {
     // Push the scope so that the initializers can make use of things defined
     // Push the scope so that the initializers can make use of things defined
     // in the class body.
     // in the class body.
     push_scope($2->get_scope(current_scope, global_scope));
     push_scope($2->get_scope(current_scope, global_scope));
@@ -1079,7 +1079,7 @@ type_like_declaration:
 }
 }
         maybe_initialize_or_constructor_body
         maybe_initialize_or_constructor_body
 {
 {
-  if ($2 != (CPPInstance *)NULL) {
+  if ($2 != nullptr) {
     pop_scope();
     pop_scope();
     current_scope->add_declaration($2, global_scope, current_lexer, @2);
     current_scope->add_declaration($2, global_scope, current_lexer, @2);
     $2->set_initializer($4);
     $2->set_initializer($4);
@@ -1087,7 +1087,7 @@ type_like_declaration:
 }
 }
         | storage_class function_prototype maybe_initialize_or_function_body
         | storage_class function_prototype maybe_initialize_or_function_body
 {
 {
-  if ($2 != (CPPInstance *)NULL) {
+  if ($2 != nullptr) {
     $2->_storage_class |= (current_storage_class | $1);
     $2->_storage_class |= (current_storage_class | $1);
     current_scope->add_declaration($2, global_scope, current_lexer, @2);
     current_scope->add_declaration($2, global_scope, current_lexer, @2);
     $2->set_initializer($3);
     $2->set_initializer($3);
@@ -1144,9 +1144,9 @@ typedef_declaration:
 }
 }
         | storage_class function_prototype maybe_initialize_or_function_body
         | storage_class function_prototype maybe_initialize_or_function_body
 {
 {
-  if ($2 != (CPPDeclaration *)NULL) {
+  if ($2 != nullptr) {
     CPPInstance *inst = $2->as_instance();
     CPPInstance *inst = $2->as_instance();
-    if (inst != (CPPInstance *)NULL) {
+    if (inst != nullptr) {
       inst->_storage_class |= (current_storage_class | $1);
       inst->_storage_class |= (current_storage_class | $1);
       current_scope->add_declaration(inst, global_scope, current_lexer, @2);
       current_scope->add_declaration(inst, global_scope, current_lexer, @2);
       CPPTypedefType *typedef_type = new CPPTypedefType(inst->_type, inst->_ident, current_scope);
       CPPTypedefType *typedef_type = new CPPTypedefType(inst->_type, inst->_ident, current_scope);
@@ -1269,10 +1269,10 @@ function_prototype:
 {
 {
   pop_scope();
   pop_scope();
   CPPType *type = $1->find_type(current_scope, global_scope, false, current_lexer);
   CPPType *type = $1->find_type(current_scope, global_scope, false, current_lexer);
-  if (type == NULL) {
+  if (type == nullptr) {
     yyerror(string("internal error resolving type ") + $1->get_fully_scoped_name(), @1);
     yyerror(string("internal error resolving type ") + $1->get_fully_scoped_name(), @1);
   }
   }
-  assert(type != NULL);
+  assert(type != nullptr);
 
 
   CPPInstanceIdentifier *ii = $4;
   CPPInstanceIdentifier *ii = $4;
   ii->add_modifier(IIT_pointer);
   ii->add_modifier(IIT_pointer);
@@ -1287,10 +1287,10 @@ function_prototype:
 {
 {
   pop_scope();
   pop_scope();
   CPPType *type = $1->find_type(current_scope, global_scope, false, current_lexer);
   CPPType *type = $1->find_type(current_scope, global_scope, false, current_lexer);
-  if (type == NULL) {
+  if (type == nullptr) {
     yyerror(string("internal error resolving type ") + $1->get_fully_scoped_name(), @1);
     yyerror(string("internal error resolving type ") + $1->get_fully_scoped_name(), @1);
   }
   }
-  assert(type != NULL);
+  assert(type != nullptr);
 
 
   CPPInstanceIdentifier *ii = $5;
   CPPInstanceIdentifier *ii = $5;
   ii->add_scoped_pointer_modifier($3);
   ii->add_scoped_pointer_modifier($3);
@@ -1301,13 +1301,13 @@ function_prototype:
 /* Typecast operators */
 /* Typecast operators */
         | KW_OPERATOR type not_paren_formal_parameter_identifier '('
         | KW_OPERATOR type not_paren_formal_parameter_identifier '('
 {
 {
-  if ($1 != NULL) {
+  if ($1 != nullptr) {
     push_scope($1->get_scope(current_scope, global_scope));
     push_scope($1->get_scope(current_scope, global_scope));
   }
   }
 }
 }
         function_parameter_list ')' function_post
         function_parameter_list ')' function_post
 {
 {
-  if ($1 != NULL) {
+  if ($1 != nullptr) {
     pop_scope();
     pop_scope();
   }
   }
 
 
@@ -1322,7 +1322,7 @@ function_prototype:
   // the method's return type to determine the full type description.
   // the method's return type to determine the full type description.
   string name = "operator typecast " + $2->get_simple_name();
   string name = "operator typecast " + $2->get_simple_name();
   CPPIdentifier *ident = $1;
   CPPIdentifier *ident = $1;
-  if (ident == NULL) {
+  if (ident == nullptr) {
     ident = new CPPIdentifier(name, @2);
     ident = new CPPIdentifier(name, @2);
   } else {
   } else {
     ident->add_name(name);
     ident->add_name(name);
@@ -1332,18 +1332,18 @@ function_prototype:
 }
 }
         | KW_OPERATOR KW_CONST type not_paren_formal_parameter_identifier '('
         | KW_OPERATOR KW_CONST type not_paren_formal_parameter_identifier '('
 {
 {
-  if ($1 != NULL) {
+  if ($1 != nullptr) {
     push_scope($1->get_scope(current_scope, global_scope));
     push_scope($1->get_scope(current_scope, global_scope));
   }
   }
 }
 }
         function_parameter_list ')' function_post
         function_parameter_list ')' function_post
 {
 {
-  if ($1 != NULL) {
+  if ($1 != nullptr) {
     pop_scope();
     pop_scope();
   }
   }
 
 
   CPPIdentifier *ident = $1;
   CPPIdentifier *ident = $1;
-  if (ident == NULL) {
+  if (ident == nullptr) {
     ident = new CPPIdentifier("operator typecast", @4);
     ident = new CPPIdentifier("operator typecast", @4);
   } else {
   } else {
     ident->add_name("operator typecast");
     ident->add_name("operator typecast");
@@ -1360,10 +1360,10 @@ function_prototype:
 {
 {
   CPPDeclaration *decl =
   CPPDeclaration *decl =
     $1->find_symbol(current_scope, global_scope, current_lexer);
     $1->find_symbol(current_scope, global_scope, current_lexer);
-  if (decl != (CPPDeclaration *)NULL) {
+  if (decl != nullptr) {
     $$ = decl->as_instance();
     $$ = decl->as_instance();
   } else {
   } else {
-    $$ = (CPPInstance *)NULL;
+    $$ = nullptr;
   }
   }
 }
 }
         ;
         ;
@@ -1626,13 +1626,13 @@ template_nonempty_formal_parameters:
         template_formal_parameter
         template_formal_parameter
 {
 {
   CPPTemplateScope *ts = current_scope->as_template_scope();
   CPPTemplateScope *ts = current_scope->as_template_scope();
-  assert(ts != NULL);
+  assert(ts != nullptr);
   ts->add_template_parameter($1);
   ts->add_template_parameter($1);
 }
 }
         | template_nonempty_formal_parameters ',' template_formal_parameter
         | template_nonempty_formal_parameters ',' template_formal_parameter
 {
 {
   CPPTemplateScope *ts = current_scope->as_template_scope();
   CPPTemplateScope *ts = current_scope->as_template_scope();
-  assert(ts != NULL);
+  assert(ts != nullptr);
   ts->add_template_parameter($3);
   ts->add_template_parameter($3);
 }
 }
         ;
         ;
@@ -1645,7 +1645,7 @@ typename_keyword:
 template_formal_parameter:
 template_formal_parameter:
         typename_keyword
         typename_keyword
 {
 {
-  $$ = CPPType::new_type(new CPPClassTemplateParameter((CPPIdentifier *)NULL));
+  $$ = CPPType::new_type(new CPPClassTemplateParameter(nullptr));
 }
 }
         | typename_keyword name
         | typename_keyword name
 {
 {
@@ -1657,7 +1657,7 @@ template_formal_parameter:
 }
 }
         | typename_keyword ELLIPSIS
         | typename_keyword ELLIPSIS
 {
 {
-  CPPClassTemplateParameter *ctp = new CPPClassTemplateParameter((CPPIdentifier *)NULL);
+  CPPClassTemplateParameter *ctp = new CPPClassTemplateParameter(nullptr);
   ctp->_packed = true;
   ctp->_packed = true;
   $$ = CPPType::new_type(ctp);
   $$ = CPPType::new_type(ctp);
 }
 }
@@ -1706,18 +1706,18 @@ template_formal_parameter_type:
         | TYPENAME_IDENTIFIER
         | TYPENAME_IDENTIFIER
 {
 {
   $$ = $1->find_type(current_scope, global_scope, false, current_lexer);
   $$ = $1->find_type(current_scope, global_scope, false, current_lexer);
-  if ($$ == NULL) {
+  if ($$ == nullptr) {
     yyerror(string("internal error resolving type ") + $1->get_fully_scoped_name(), @1);
     yyerror(string("internal error resolving type ") + $1->get_fully_scoped_name(), @1);
   }
   }
-  assert($$ != NULL);
+  assert($$ != nullptr);
 }
 }
         | TYPEPACK_IDENTIFIER
         | TYPEPACK_IDENTIFIER
 {
 {
   $$ = $1->find_type(current_scope, global_scope, false, current_lexer);
   $$ = $1->find_type(current_scope, global_scope, false, current_lexer);
-  if ($$ == NULL) {
+  if ($$ == nullptr) {
     yyerror(string("internal error resolving type ") + $1->get_fully_scoped_name(), @1);
     yyerror(string("internal error resolving type ") + $1->get_fully_scoped_name(), @1);
   }
   }
-  assert($$ != NULL);
+  assert($$ != nullptr);
 }
 }
         ;
         ;
 
 
@@ -1733,7 +1733,7 @@ instance_identifier:
   // ficticious name for the function; in other respects it's just
   // ficticious name for the function; in other respects it's just
   // like a regular function.
   // like a regular function.
   CPPIdentifier *ident = $1;
   CPPIdentifier *ident = $1;
-  if (ident == NULL) {
+  if (ident == nullptr) {
     ident = new CPPIdentifier("operator "+$2, @2);
     ident = new CPPIdentifier("operator "+$2, @2);
   } else {
   } else {
     ident->_names.push_back("operator "+$2);
     ident->_names.push_back("operator "+$2);
@@ -1748,7 +1748,7 @@ instance_identifier:
     yyerror("expected empty string", @2);
     yyerror("expected empty string", @2);
   }
   }
   CPPIdentifier *ident = $1;
   CPPIdentifier *ident = $1;
-  if (ident == NULL) {
+  if (ident == nullptr) {
     ident = new CPPIdentifier("operator \"\" "+$3->get_simple_name(), @3);
     ident = new CPPIdentifier("operator \"\" "+$3->get_simple_name(), @3);
   } else {
   } else {
     ident->_names.push_back("operator \"\" "+$3->get_simple_name());
     ident->_names.push_back("operator \"\" "+$3->get_simple_name());
@@ -1832,7 +1832,7 @@ instance_identifier_and_maybe_trailing_return_type:
   // This is handled a bit awkwardly right now.  Ideally it'd be wrapped
   // This is handled a bit awkwardly right now.  Ideally it'd be wrapped
   // up in the instance_identifier rule, but then more needs to happen in
   // up in the instance_identifier rule, but then more needs to happen in
   // order to avoid shift/reduce conflicts.
   // order to avoid shift/reduce conflicts.
-  if ($2 != NULL) {
+  if ($2 != nullptr) {
     $1->add_trailing_return_type($2);
     $1->add_trailing_return_type($2);
   }
   }
   $$ = $1;
   $$ = $1;
@@ -1849,7 +1849,7 @@ instance_identifier_and_maybe_trailing_return_type:
 maybe_trailing_return_type:
 maybe_trailing_return_type:
         empty
         empty
 {
 {
-  $$ = NULL;
+  $$ = nullptr;
 }
 }
         | POINTSAT predefined_type empty_instance_identifier
         | POINTSAT predefined_type empty_instance_identifier
 {
 {
@@ -1866,7 +1866,7 @@ maybe_trailing_return_type:
 maybe_comma_identifier:
 maybe_comma_identifier:
         empty
         empty
 {
 {
-  $$ = NULL;
+  $$ = nullptr;
 }
 }
         | ',' IDENTIFIER
         | ',' IDENTIFIER
 {
 {
@@ -1956,7 +1956,7 @@ formal_parameters:
 template_parameter_maybe_initialize:
 template_parameter_maybe_initialize:
         empty
         empty
 {
 {
-  $$ = (CPPExpression *)NULL;
+  $$ = nullptr;
 }
 }
         | '=' no_angle_bracket_const_expr
         | '=' no_angle_bracket_const_expr
 {
 {
@@ -1967,7 +1967,7 @@ template_parameter_maybe_initialize:
 maybe_initialize:
 maybe_initialize:
         empty
         empty
 {
 {
-  $$ = (CPPExpression *)NULL;
+  $$ = nullptr;
 }
 }
         | '=' const_expr
         | '=' const_expr
 {
 {
@@ -1978,15 +1978,15 @@ maybe_initialize:
 maybe_initialize_or_constructor_body:
 maybe_initialize_or_constructor_body:
         ';'
         ';'
 {
 {
-  $$ = (CPPExpression *)NULL;
+  $$ = nullptr;
 }
 }
         | '{' code '}'
         | '{' code '}'
 {
 {
-  $$ = (CPPExpression *)NULL;
+  $$ = nullptr;
 }
 }
         | ':' constructor_inits '{' code '}'
         | ':' constructor_inits '{' code '}'
 {
 {
-  $$ = (CPPExpression *)NULL;
+  $$ = nullptr;
 }
 }
         | '=' KW_DEFAULT ';'
         | '=' KW_DEFAULT ';'
 {
 {
@@ -2001,11 +2001,11 @@ maybe_initialize_or_constructor_body:
 maybe_initialize_or_function_body:
 maybe_initialize_or_function_body:
         ';'
         ';'
 {
 {
-  $$ = (CPPExpression *)NULL;
+  $$ = nullptr;
 }
 }
         | '{' code '}'
         | '{' code '}'
 {
 {
-  $$ = (CPPExpression *)NULL;
+  $$ = nullptr;
 }
 }
         | '=' const_expr ';'
         | '=' const_expr ';'
 {
 {
@@ -2021,7 +2021,7 @@ maybe_initialize_or_function_body:
 }
 }
         | '=' '{' structure_init '}'
         | '=' '{' structure_init '}'
 {
 {
-  $$ = (CPPExpression *)NULL;
+  $$ = nullptr;
 }
 }
         ;
         ;
 
 
@@ -2106,7 +2106,7 @@ formal_parameter:
 not_paren_formal_parameter_identifier:
 not_paren_formal_parameter_identifier:
         empty
         empty
 {
 {
-  $$ = new CPPInstanceIdentifier((CPPIdentifier *)NULL);
+  $$ = new CPPInstanceIdentifier(nullptr);
 }
 }
         | name_no_final
         | name_no_final
 {
 {
@@ -2152,7 +2152,7 @@ not_paren_formal_parameter_identifier:
 formal_parameter_identifier:
 formal_parameter_identifier:
         empty
         empty
 {
 {
-  $$ = new CPPInstanceIdentifier((CPPIdentifier *)NULL);
+  $$ = new CPPInstanceIdentifier(nullptr);
 }
 }
         | name_no_final
         | name_no_final
 {
 {
@@ -2209,7 +2209,7 @@ formal_parameter_identifier:
 parameter_pack_identifier:
 parameter_pack_identifier:
         ELLIPSIS
         ELLIPSIS
 {
 {
-  $$ = new CPPInstanceIdentifier((CPPIdentifier *)NULL);
+  $$ = new CPPInstanceIdentifier(nullptr);
   $$->_packed = true;
   $$->_packed = true;
 }
 }
         | ELLIPSIS name
         | ELLIPSIS name
@@ -2268,11 +2268,11 @@ parameter_pack_identifier:
 not_paren_empty_instance_identifier:
 not_paren_empty_instance_identifier:
         empty
         empty
 {
 {
-  $$ = new CPPInstanceIdentifier((CPPIdentifier *)NULL);
+  $$ = new CPPInstanceIdentifier(nullptr);
 }
 }
         | ELLIPSIS
         | ELLIPSIS
 {
 {
-  $$ = new CPPInstanceIdentifier((CPPIdentifier *)NULL);
+  $$ = new CPPInstanceIdentifier(nullptr);
   $$->_packed = true;
   $$->_packed = true;
 }
 }
         | ELLIPSIS name
         | ELLIPSIS name
@@ -2320,11 +2320,11 @@ not_paren_empty_instance_identifier:
 empty_instance_identifier:
 empty_instance_identifier:
         empty
         empty
 {
 {
-  $$ = new CPPInstanceIdentifier((CPPIdentifier *)NULL);
+  $$ = new CPPInstanceIdentifier(nullptr);
 }
 }
         | ELLIPSIS
         | ELLIPSIS
 {
 {
-  $$ = new CPPInstanceIdentifier((CPPIdentifier *)NULL);
+  $$ = new CPPInstanceIdentifier(nullptr);
   $$->_packed = true;
   $$->_packed = true;
 }
 }
         | ELLIPSIS name
         | ELLIPSIS name
@@ -2369,7 +2369,7 @@ empty_instance_identifier:
 }
 }
         | '(' function_parameter_list ')' function_post maybe_trailing_return_type
         | '(' function_parameter_list ')' function_post maybe_trailing_return_type
 {
 {
-  $$ = new CPPInstanceIdentifier((CPPIdentifier *)NULL);
+  $$ = new CPPInstanceIdentifier(nullptr);
   $$->add_modifier(IIT_paren);
   $$->add_modifier(IIT_paren);
   $$->add_func_modifier($2, $4, $5);
   $$->add_func_modifier($2, $4, $5);
 }
 }
@@ -2404,10 +2404,10 @@ type:
         | TYPENAME_IDENTIFIER
         | TYPENAME_IDENTIFIER
 {
 {
   $$ = $1->find_type(current_scope, global_scope, false, current_lexer);
   $$ = $1->find_type(current_scope, global_scope, false, current_lexer);
-  if ($$ == NULL) {
+  if ($$ == nullptr) {
     yyerror(string("internal error resolving type ") + $1->get_fully_scoped_name(), @1);
     yyerror(string("internal error resolving type ") + $1->get_fully_scoped_name(), @1);
   }
   }
-  assert($$ != NULL);
+  assert($$ != nullptr);
 }
 }
         | KW_TYPENAME name
         | KW_TYPENAME name
 {
 {
@@ -2428,14 +2428,14 @@ type:
         | struct_keyword struct_attributes name
         | struct_keyword struct_attributes name
 {
 {
   CPPType *type = $3->find_type(current_scope, global_scope, false, current_lexer);
   CPPType *type = $3->find_type(current_scope, global_scope, false, current_lexer);
-  if (type != NULL) {
+  if (type != nullptr) {
     $$ = type;
     $$ = type;
   } else {
   } else {
     CPPExtensionType *et =
     CPPExtensionType *et =
       CPPType::new_type(new CPPExtensionType($1, $3, current_scope, @1.file))
       CPPType::new_type(new CPPExtensionType($1, $3, current_scope, @1.file))
       ->as_extension_type();
       ->as_extension_type();
     CPPScope *scope = $3->get_scope(current_scope, global_scope);
     CPPScope *scope = $3->get_scope(current_scope, global_scope);
-    if (scope != NULL) {
+    if (scope != nullptr) {
       scope->define_extension_type(et);
       scope->define_extension_type(et);
     }
     }
     $$ = et;
     $$ = et;
@@ -2444,14 +2444,14 @@ type:
         | enum_keyword name_no_final ':' enum_element_type
         | enum_keyword name_no_final ':' enum_element_type
 {
 {
   CPPType *type = $2->find_type(current_scope, global_scope, false, current_lexer);
   CPPType *type = $2->find_type(current_scope, global_scope, false, current_lexer);
-  if (type != NULL) {
+  if (type != nullptr) {
     $$ = type;
     $$ = type;
   } else {
   } else {
     CPPExtensionType *et =
     CPPExtensionType *et =
       CPPType::new_type(new CPPExtensionType($1, $2, current_scope, @1.file))
       CPPType::new_type(new CPPExtensionType($1, $2, current_scope, @1.file))
       ->as_extension_type();
       ->as_extension_type();
     CPPScope *scope = $2->get_scope(current_scope, global_scope);
     CPPScope *scope = $2->get_scope(current_scope, global_scope);
-    if (scope != NULL) {
+    if (scope != nullptr) {
       scope->define_extension_type(et);
       scope->define_extension_type(et);
     }
     }
     $$ = et;
     $$ = et;
@@ -2460,7 +2460,7 @@ type:
         | KW_DECLTYPE '(' const_expr ')'
         | KW_DECLTYPE '(' const_expr ')'
 {
 {
   $$ = $3->determine_type();
   $$ = $3->determine_type();
-  if ($$ == (CPPType *)NULL) {
+  if ($$ == nullptr) {
     stringstream str;
     stringstream str;
     str << *$3;
     str << *$3;
     yyerror("could not determine type of " + str.str(), @3);
     yyerror("could not determine type of " + str.str(), @3);
@@ -2473,7 +2473,7 @@ type:
         | KW_UNDERLYING_TYPE '(' full_type ')'
         | KW_UNDERLYING_TYPE '(' full_type ')'
 {
 {
   CPPEnumType *enum_type = $3->as_enum_type();
   CPPEnumType *enum_type = $3->as_enum_type();
-  if (enum_type == NULL) {
+  if (enum_type == nullptr) {
     yyerror("an enumeration type is required", @3);
     yyerror("an enumeration type is required", @3);
     $$ = $3;
     $$ = $3;
   } else {
   } else {
@@ -2490,10 +2490,10 @@ type_pack:
         TYPEPACK_IDENTIFIER
         TYPEPACK_IDENTIFIER
 {
 {
   $$ = $1->find_type(current_scope, global_scope, false, current_lexer);
   $$ = $1->find_type(current_scope, global_scope, false, current_lexer);
-  if ($$ == NULL) {
+  if ($$ == nullptr) {
     yyerror(string("internal error resolving type ") + $1->get_fully_scoped_name(), @1);
     yyerror(string("internal error resolving type ") + $1->get_fully_scoped_name(), @1);
   }
   }
-  assert($$ != NULL);
+  assert($$ != nullptr);
 }
 }
         ;
         ;
 
 
@@ -2505,10 +2505,10 @@ type_decl:
         | TYPENAME_IDENTIFIER
         | TYPENAME_IDENTIFIER
 {
 {
   $$ = $1->find_type(current_scope, global_scope, false, current_lexer);
   $$ = $1->find_type(current_scope, global_scope, false, current_lexer);
-  if ($$ == NULL) {
+  if ($$ == nullptr) {
     yyerror(string("internal error resolving type ") + $1->get_fully_scoped_name(), @1);
     yyerror(string("internal error resolving type ") + $1->get_fully_scoped_name(), @1);
   }
   }
-  assert($$ != NULL);
+  assert($$ != nullptr);
 }
 }
         | KW_TYPENAME name
         | KW_TYPENAME name
 {
 {
@@ -2529,14 +2529,14 @@ type_decl:
         | struct_keyword struct_attributes name
         | struct_keyword struct_attributes name
 {
 {
   CPPType *type = $3->find_type(current_scope, global_scope, false, current_lexer);
   CPPType *type = $3->find_type(current_scope, global_scope, false, current_lexer);
-  if (type != NULL) {
+  if (type != nullptr) {
     $$ = type;
     $$ = type;
   } else {
   } else {
     CPPExtensionType *et =
     CPPExtensionType *et =
       CPPType::new_type(new CPPExtensionType($1, $3, current_scope, @1.file))
       CPPType::new_type(new CPPExtensionType($1, $3, current_scope, @1.file))
       ->as_extension_type();
       ->as_extension_type();
     CPPScope *scope = $3->get_scope(current_scope, global_scope);
     CPPScope *scope = $3->get_scope(current_scope, global_scope);
-    if (scope != NULL) {
+    if (scope != nullptr) {
       scope->define_extension_type(et);
       scope->define_extension_type(et);
     }
     }
     $$ = et;
     $$ = et;
@@ -2545,14 +2545,14 @@ type_decl:
         | enum_keyword name_no_final ':' enum_element_type
         | enum_keyword name_no_final ':' enum_element_type
 {
 {
   CPPType *type = $2->find_type(current_scope, global_scope, false, current_lexer);
   CPPType *type = $2->find_type(current_scope, global_scope, false, current_lexer);
-  if (type != NULL) {
+  if (type != nullptr) {
     $$ = type;
     $$ = type;
   } else {
   } else {
     CPPExtensionType *et =
     CPPExtensionType *et =
       CPPType::new_type(new CPPExtensionType($1, $2, current_scope, @1.file))
       CPPType::new_type(new CPPExtensionType($1, $2, current_scope, @1.file))
       ->as_extension_type();
       ->as_extension_type();
     CPPScope *scope = $2->get_scope(current_scope, global_scope);
     CPPScope *scope = $2->get_scope(current_scope, global_scope);
-    if (scope != NULL) {
+    if (scope != nullptr) {
       scope->define_extension_type(et);
       scope->define_extension_type(et);
     }
     }
     $$ = et;
     $$ = et;
@@ -2563,14 +2563,14 @@ type_decl:
   yywarning(string("C++ does not permit forward declaration of untyped enum ") + $2->get_fully_scoped_name(), @1);
   yywarning(string("C++ does not permit forward declaration of untyped enum ") + $2->get_fully_scoped_name(), @1);
 
 
   CPPType *type = $2->find_type(current_scope, global_scope, false, current_lexer);
   CPPType *type = $2->find_type(current_scope, global_scope, false, current_lexer);
-  if (type != NULL) {
+  if (type != nullptr) {
     $$ = type;
     $$ = type;
   } else {
   } else {
     CPPExtensionType *et =
     CPPExtensionType *et =
       CPPType::new_type(new CPPExtensionType($1, $2, current_scope, @1.file))
       CPPType::new_type(new CPPExtensionType($1, $2, current_scope, @1.file))
       ->as_extension_type();
       ->as_extension_type();
     CPPScope *scope = $2->get_scope(current_scope, global_scope);
     CPPScope *scope = $2->get_scope(current_scope, global_scope);
-    if (scope != NULL) {
+    if (scope != nullptr) {
       scope->define_extension_type(et);
       scope->define_extension_type(et);
     }
     }
     $$ = et;
     $$ = et;
@@ -2579,7 +2579,7 @@ type_decl:
         | KW_DECLTYPE '(' const_expr ')'
         | KW_DECLTYPE '(' const_expr ')'
 {
 {
   $$ = $3->determine_type();
   $$ = $3->determine_type();
-  if ($$ == (CPPType *)NULL) {
+  if ($$ == nullptr) {
     stringstream str;
     stringstream str;
     str << *$3;
     str << *$3;
     yyerror("could not determine type of " + str.str(), @3);
     yyerror("could not determine type of " + str.str(), @3);
@@ -2592,7 +2592,7 @@ type_decl:
         | KW_UNDERLYING_TYPE '(' full_type ')'
         | KW_UNDERLYING_TYPE '(' full_type ')'
 {
 {
   CPPEnumType *enum_type = $3->as_enum_type();
   CPPEnumType *enum_type = $3->as_enum_type();
-  if (enum_type == NULL) {
+  if (enum_type == nullptr) {
     yyerror("an enumeration type is required", @3);
     yyerror("an enumeration type is required", @3);
     $$ = $3;
     $$ = $3;
   } else {
   } else {
@@ -2613,10 +2613,10 @@ predefined_type:
         | TYPENAME_IDENTIFIER
         | TYPENAME_IDENTIFIER
 {
 {
   $$ = $1->find_type(current_scope, global_scope, false, current_lexer);
   $$ = $1->find_type(current_scope, global_scope, false, current_lexer);
-  if ($$ == NULL) {
+  if ($$ == nullptr) {
     yyerror(string("internal error resolving type ") + $1->get_fully_scoped_name(), @1);
     yyerror(string("internal error resolving type ") + $1->get_fully_scoped_name(), @1);
   }
   }
-  assert($$ != NULL);
+  assert($$ != nullptr);
 }
 }
         | KW_TYPENAME name
         | KW_TYPENAME name
 {
 {
@@ -2625,14 +2625,14 @@ predefined_type:
         | struct_keyword struct_attributes name
         | struct_keyword struct_attributes name
 {
 {
   CPPType *type = $3->find_type(current_scope, global_scope, false, current_lexer);
   CPPType *type = $3->find_type(current_scope, global_scope, false, current_lexer);
-  if (type != NULL) {
+  if (type != nullptr) {
     $$ = type;
     $$ = type;
   } else {
   } else {
     CPPExtensionType *et =
     CPPExtensionType *et =
       CPPType::new_type(new CPPExtensionType($1, $3, current_scope, @1.file))
       CPPType::new_type(new CPPExtensionType($1, $3, current_scope, @1.file))
       ->as_extension_type();
       ->as_extension_type();
     CPPScope *scope = $3->get_scope(current_scope, global_scope);
     CPPScope *scope = $3->get_scope(current_scope, global_scope);
-    if (scope != NULL) {
+    if (scope != nullptr) {
       scope->define_extension_type(et);
       scope->define_extension_type(et);
     }
     }
     $$ = et;
     $$ = et;
@@ -2641,14 +2641,14 @@ predefined_type:
         | enum_keyword name
         | enum_keyword name
 {
 {
   CPPType *type = $2->find_type(current_scope, global_scope, false, current_lexer);
   CPPType *type = $2->find_type(current_scope, global_scope, false, current_lexer);
-  if (type != NULL) {
+  if (type != nullptr) {
     $$ = type;
     $$ = type;
   } else {
   } else {
     CPPExtensionType *et =
     CPPExtensionType *et =
       CPPType::new_type(new CPPExtensionType($1, $2, current_scope, @1.file))
       CPPType::new_type(new CPPExtensionType($1, $2, current_scope, @1.file))
       ->as_extension_type();
       ->as_extension_type();
     CPPScope *scope = $2->get_scope(current_scope, global_scope);
     CPPScope *scope = $2->get_scope(current_scope, global_scope);
-    if (scope != NULL) {
+    if (scope != nullptr) {
       scope->define_extension_type(et);
       scope->define_extension_type(et);
     }
     }
     $$ = et;
     $$ = et;
@@ -2657,7 +2657,7 @@ predefined_type:
         | KW_DECLTYPE '(' const_expr ')'
         | KW_DECLTYPE '(' const_expr ')'
 {
 {
   $$ = $3->determine_type();
   $$ = $3->determine_type();
-  if ($$ == (CPPType *)NULL) {
+  if ($$ == nullptr) {
     stringstream str;
     stringstream str;
     str << *$3;
     str << *$3;
     yyerror("could not determine type of " + str.str(), @3);
     yyerror("could not determine type of " + str.str(), @3);
@@ -2666,7 +2666,7 @@ predefined_type:
         | KW_UNDERLYING_TYPE '(' full_type ')'
         | KW_UNDERLYING_TYPE '(' full_type ')'
 {
 {
   CPPEnumType *enum_type = $3->as_enum_type();
   CPPEnumType *enum_type = $3->as_enum_type();
-  if (enum_type == NULL) {
+  if (enum_type == nullptr) {
     yyerror("an enumeration type is required", @3);
     yyerror("an enumeration type is required", @3);
     $$ = $3;
     $$ = $3;
   } else {
   } else {
@@ -2727,7 +2727,7 @@ anonymous_struct:
 
 
   CPPScope *new_scope = new CPPScope(current_scope, CPPNameComponent("anon"),
   CPPScope *new_scope = new CPPScope(current_scope, CPPNameComponent("anon"),
                                      starting_vis);
                                      starting_vis);
-  CPPStructType *st = new CPPStructType($1, NULL, current_scope,
+  CPPStructType *st = new CPPStructType($1, nullptr, current_scope,
                                         new_scope, @1.file);
                                         new_scope, @1.file);
   new_scope->set_struct_type(st);
   new_scope->set_struct_type(st);
 
 
@@ -2750,7 +2750,7 @@ named_struct:
   ($1 == CPPExtensionType::T_class) ? V_private : V_public;
   ($1 == CPPExtensionType::T_class) ? V_private : V_public;
 
 
   CPPScope *scope = $3->get_scope(current_scope, global_scope, current_lexer);
   CPPScope *scope = $3->get_scope(current_scope, global_scope, current_lexer);
-  if (scope == NULL) {
+  if (scope == nullptr) {
     scope = current_scope;
     scope = current_scope;
   }
   }
   CPPScope *new_scope = new CPPScope(scope, $3->_names.back(),
   CPPScope *new_scope = new CPPScope(scope, $3->_names.back(),
@@ -2838,18 +2838,18 @@ enum:
         enum_decl '{' enum_body '}'
         enum_decl '{' enum_body '}'
 {
 {
   $$ = current_enum;
   $$ = current_enum;
-  current_enum = NULL;
+  current_enum = nullptr;
 }
 }
         ;
         ;
 
 
 enum_decl:
 enum_decl:
         enum_keyword ':' enum_element_type
         enum_keyword ':' enum_element_type
 {
 {
-  current_enum = new CPPEnumType($1, NULL, $3, current_scope, NULL, @1.file);
+  current_enum = new CPPEnumType($1, nullptr, $3, current_scope, nullptr, @1.file);
 }
 }
         | enum_keyword
         | enum_keyword
 {
 {
-  current_enum = new CPPEnumType($1, NULL, current_scope, NULL, @1.file);
+  current_enum = new CPPEnumType($1, nullptr, current_scope, nullptr, @1.file);
 }
 }
         | enum_keyword name_no_final ':' enum_element_type
         | enum_keyword name_no_final ':' enum_element_type
 {
 {
@@ -2878,12 +2878,12 @@ enum_body_trailing_comma:
         empty
         empty
         | enum_body_trailing_comma name ','
         | enum_body_trailing_comma name ','
 {
 {
-  assert(current_enum != NULL);
-  current_enum->add_element($2->get_simple_name(), NULL, current_lexer, @2);
+  assert(current_enum != nullptr);
+  current_enum->add_element($2->get_simple_name(), nullptr, current_lexer, @2);
 }
 }
         | enum_body_trailing_comma name '=' const_expr ','
         | enum_body_trailing_comma name '=' const_expr ','
 {
 {
-  assert(current_enum != NULL);
+  assert(current_enum != nullptr);
   current_enum->add_element($2->get_simple_name(), $4, current_lexer, @2);
   current_enum->add_element($2->get_simple_name(), $4, current_lexer, @2);
 };
 };
 
 
@@ -2891,12 +2891,12 @@ enum_body:
         enum_body_trailing_comma
         enum_body_trailing_comma
         | enum_body_trailing_comma name
         | enum_body_trailing_comma name
 {
 {
-  assert(current_enum != NULL);
-  current_enum->add_element($2->get_simple_name(), NULL, current_lexer, @2);
+  assert(current_enum != nullptr);
+  current_enum->add_element($2->get_simple_name(), nullptr, current_lexer, @2);
 }
 }
         | enum_body_trailing_comma name '=' const_expr
         | enum_body_trailing_comma name '=' const_expr
 {
 {
-  assert(current_enum != NULL);
+  assert(current_enum != nullptr);
   current_enum->add_element($2->get_simple_name(), $4, current_lexer, @2);
   current_enum->add_element($2->get_simple_name(), $4, current_lexer, @2);
 }
 }
         ;
         ;
@@ -2935,11 +2935,11 @@ namespace_declaration:
         KW_NAMESPACE name '{'
         KW_NAMESPACE name '{'
 {
 {
   CPPScope *scope = $2->find_scope(current_scope, global_scope, current_lexer);
   CPPScope *scope = $2->find_scope(current_scope, global_scope, current_lexer);
-  if (scope == NULL) {
+  if (scope == nullptr) {
     // This must be a new namespace declaration.
     // This must be a new namespace declaration.
     CPPScope *parent_scope =
     CPPScope *parent_scope =
       $2->get_scope(current_scope, global_scope, current_lexer);
       $2->get_scope(current_scope, global_scope, current_lexer);
-    if (parent_scope == NULL) {
+    if (parent_scope == nullptr) {
       parent_scope = current_scope;
       parent_scope = current_scope;
     }
     }
     scope = new CPPScope(parent_scope, $2->_names.back(), V_public);
     scope = new CPPScope(parent_scope, $2->_names.back(), V_public);
@@ -2957,11 +2957,11 @@ namespace_declaration:
         | KW_INLINE KW_NAMESPACE name '{'
         | KW_INLINE KW_NAMESPACE name '{'
 {
 {
   CPPScope *scope = $3->find_scope(current_scope, global_scope, current_lexer);
   CPPScope *scope = $3->find_scope(current_scope, global_scope, current_lexer);
-  if (scope == NULL) {
+  if (scope == nullptr) {
     // This must be a new namespace declaration.
     // This must be a new namespace declaration.
     CPPScope *parent_scope =
     CPPScope *parent_scope =
       $3->get_scope(current_scope, global_scope, current_lexer);
       $3->get_scope(current_scope, global_scope, current_lexer);
-    if (parent_scope == NULL) {
+    if (parent_scope == nullptr) {
       parent_scope = current_scope;
       parent_scope = current_scope;
     }
     }
     scope = new CPPScope(parent_scope, $3->_names.back(), V_public);
     scope = new CPPScope(parent_scope, $3->_names.back(), V_public);
@@ -3165,7 +3165,7 @@ element:
 optional_const_expr:
 optional_const_expr:
         empty
         empty
 {
 {
-  $$ = (CPPExpression *)NULL;
+  $$ = nullptr;
 }
 }
         | const_expr
         | const_expr
 {
 {
@@ -3176,7 +3176,7 @@ optional_const_expr:
 optional_const_expr_comma:
 optional_const_expr_comma:
         empty
         empty
 {
 {
-  $$ = (CPPExpression *)NULL;
+  $$ = nullptr;
 }
 }
         | const_expr_comma
         | const_expr_comma
 {
 {
@@ -3227,7 +3227,7 @@ no_angle_bracket_const_expr:
         | KW_SIZEOF '(' IDENTIFIER ')' %prec UNARY
         | KW_SIZEOF '(' IDENTIFIER ')' %prec UNARY
 {
 {
   CPPDeclaration *arg = $3->find_symbol(current_scope, global_scope, current_lexer);
   CPPDeclaration *arg = $3->find_symbol(current_scope, global_scope, current_lexer);
-  if (arg == (CPPDeclaration *)NULL) {
+  if (arg == nullptr) {
     yyerror("undefined sizeof argument: " + $3->get_fully_scoped_name(), @3);
     yyerror("undefined sizeof argument: " + $3->get_fully_scoped_name(), @3);
   } else if (arg->get_subtype() == CPPDeclaration::ST_instance) {
   } else if (arg->get_subtype() == CPPDeclaration::ST_instance) {
     CPPInstance *inst = arg->as_instance();
     CPPInstance *inst = arg->as_instance();
@@ -3392,20 +3392,20 @@ const_expr:
 {
 {
   // A constructor call.
   // A constructor call.
   CPPType *type = $1->find_type(current_scope, global_scope, false, current_lexer);
   CPPType *type = $1->find_type(current_scope, global_scope, false, current_lexer);
-  if (type == NULL) {
+  if (type == nullptr) {
     yyerror(string("internal error resolving type ") + $1->get_fully_scoped_name(), @1);
     yyerror(string("internal error resolving type ") + $1->get_fully_scoped_name(), @1);
   }
   }
-  assert(type != NULL);
+  assert(type != nullptr);
   $$ = new CPPExpression(CPPExpression::construct_op(type, $3));
   $$ = new CPPExpression(CPPExpression::construct_op(type, $3));
 }
 }
         | TYPENAME_IDENTIFIER '{' optional_const_expr_comma '}'
         | TYPENAME_IDENTIFIER '{' optional_const_expr_comma '}'
 {
 {
   // Aggregate initialization.
   // Aggregate initialization.
   CPPType *type = $1->find_type(current_scope, global_scope, false, current_lexer);
   CPPType *type = $1->find_type(current_scope, global_scope, false, current_lexer);
-  if (type == NULL) {
+  if (type == nullptr) {
     yyerror(string("internal error resolving type ") + $1->get_fully_scoped_name(), @1);
     yyerror(string("internal error resolving type ") + $1->get_fully_scoped_name(), @1);
   }
   }
-  assert(type != NULL);
+  assert(type != nullptr);
   $$ = new CPPExpression(CPPExpression::aggregate_init_op(type, $3));
   $$ = new CPPExpression(CPPExpression::aggregate_init_op(type, $3));
 }
 }
         | KW_INT '(' optional_const_expr_comma ')'
         | KW_INT '(' optional_const_expr_comma ')'
@@ -3491,7 +3491,7 @@ const_expr:
         | KW_SIZEOF '(' IDENTIFIER ')' %prec UNARY
         | KW_SIZEOF '(' IDENTIFIER ')' %prec UNARY
 {
 {
   CPPDeclaration *arg = $3->find_symbol(current_scope, global_scope, current_lexer);
   CPPDeclaration *arg = $3->find_symbol(current_scope, global_scope, current_lexer);
-  if (arg == (CPPDeclaration *)NULL) {
+  if (arg == nullptr) {
     yyerror("undefined sizeof argument: " + $3->get_fully_scoped_name(), @3);
     yyerror("undefined sizeof argument: " + $3->get_fully_scoped_name(), @3);
   } else if (arg->get_subtype() == CPPDeclaration::ST_instance) {
   } else if (arg->get_subtype() == CPPDeclaration::ST_instance) {
     CPPInstance *inst = arg->as_instance();
     CPPInstance *inst = arg->as_instance();
@@ -3835,7 +3835,7 @@ formal_const_expr:
         | KW_SIZEOF '(' IDENTIFIER ')' %prec UNARY
         | KW_SIZEOF '(' IDENTIFIER ')' %prec UNARY
 {
 {
   CPPDeclaration *arg = $3->find_symbol(current_scope, global_scope, current_lexer);
   CPPDeclaration *arg = $3->find_symbol(current_scope, global_scope, current_lexer);
-  if (arg == (CPPDeclaration *)NULL) {
+  if (arg == nullptr) {
     yyerror("undefined sizeof argument: " + $3->get_fully_scoped_name(), @3);
     yyerror("undefined sizeof argument: " + $3->get_fully_scoped_name(), @3);
   } else if (arg->get_subtype() == CPPDeclaration::ST_instance) {
   } else if (arg->get_subtype() == CPPDeclaration::ST_instance) {
     CPPInstance *inst = arg->as_instance();
     CPPInstance *inst = arg->as_instance();
@@ -4123,7 +4123,7 @@ class_derivation_name:
         name
         name
 {
 {
   CPPType *type = $1->find_type(current_scope, global_scope, true);
   CPPType *type = $1->find_type(current_scope, global_scope, true);
-  if (type == NULL) {
+  if (type == nullptr) {
     type = CPPType::new_type(new CPPTBDType($1));
     type = CPPType::new_type(new CPPTBDType($1));
   }
   }
   $$ = type;
   $$ = type;

+ 5 - 5
dtool/src/cppparser/cppClassTemplateParameter.cxx

@@ -46,7 +46,7 @@ output(ostream &out, int indent_level, CPPScope *scope, bool complete) const {
     if (_packed) {
     if (_packed) {
       out << "...";
       out << "...";
     }
     }
-    if (_ident != NULL) {
+    if (_ident != nullptr) {
       out << " ";
       out << " ";
       _ident->output(out, scope);
       _ident->output(out, scope);
     }
     }
@@ -83,7 +83,7 @@ as_class_template_parameter() {
 bool CPPClassTemplateParameter::
 bool CPPClassTemplateParameter::
 is_equal(const CPPDeclaration *other) const {
 is_equal(const CPPDeclaration *other) const {
   const CPPClassTemplateParameter *ot = ((CPPDeclaration *)other)->as_class_template_parameter();
   const CPPClassTemplateParameter *ot = ((CPPDeclaration *)other)->as_class_template_parameter();
-  assert(ot != NULL);
+  assert(ot != nullptr);
 
 
   if (_default_type != ot->_default_type) {
   if (_default_type != ot->_default_type) {
     return false;
     return false;
@@ -93,7 +93,7 @@ is_equal(const CPPDeclaration *other) const {
     return false;
     return false;
   }
   }
 
 
-  if (_ident == NULL || ot->_ident == NULL) {
+  if (_ident == nullptr || ot->_ident == nullptr) {
     return _ident == ot->_ident;
     return _ident == ot->_ident;
   }
   }
 
 
@@ -108,7 +108,7 @@ is_equal(const CPPDeclaration *other) const {
 bool CPPClassTemplateParameter::
 bool CPPClassTemplateParameter::
 is_less(const CPPDeclaration *other) const {
 is_less(const CPPDeclaration *other) const {
   const CPPClassTemplateParameter *ot = ((CPPDeclaration *)other)->as_class_template_parameter();
   const CPPClassTemplateParameter *ot = ((CPPDeclaration *)other)->as_class_template_parameter();
-  assert(ot != NULL);
+  assert(ot != nullptr);
 
 
   if (_default_type != ot->_default_type) {
   if (_default_type != ot->_default_type) {
     return _default_type < ot->_default_type;
     return _default_type < ot->_default_type;
@@ -118,7 +118,7 @@ is_less(const CPPDeclaration *other) const {
     return _packed < ot->_packed;
     return _packed < ot->_packed;
   }
   }
 
 
-  if (_ident == NULL || ot->_ident == NULL) {
+  if (_ident == nullptr || ot->_ident == nullptr) {
     return _ident < ot->_ident;
     return _ident < ot->_ident;
   }
   }
 
 

+ 1 - 1
dtool/src/cppparser/cppClassTemplateParameter.h

@@ -26,7 +26,7 @@ class CPPIdentifier;
 class CPPClassTemplateParameter : public CPPType {
 class CPPClassTemplateParameter : public CPPType {
 public:
 public:
   CPPClassTemplateParameter(CPPIdentifier *ident,
   CPPClassTemplateParameter(CPPIdentifier *ident,
-                            CPPType *default_type = NULL);
+                            CPPType *default_type = nullptr);
 
 
   virtual bool is_fully_specified() const;
   virtual bool is_fully_specified() const;
   virtual void output(ostream &out, int indent_level, CPPScope *scope,
   virtual void output(ostream &out, int indent_level, CPPScope *scope,

+ 4 - 4
dtool/src/cppparser/cppClosureType.cxx

@@ -20,7 +20,7 @@
  */
  */
 CPPClosureType::
 CPPClosureType::
 CPPClosureType(CaptureType default_capture) :
 CPPClosureType(CaptureType default_capture) :
-  CPPFunctionType(NULL, NULL, 0),
+  CPPFunctionType(nullptr, nullptr, 0),
   _default_capture(default_capture) {
   _default_capture(default_capture) {
 }
 }
 
 
@@ -134,7 +134,7 @@ output(ostream &out, int indent_level, CPPScope *scope, bool complete) const {
     }
     }
     out << capture._name;
     out << capture._name;
 
 
-    if (capture._initializer != NULL) {
+    if (capture._initializer != nullptr) {
       out << " = " << *capture._initializer;
       out << " = " << *capture._initializer;
     }
     }
 
 
@@ -142,7 +142,7 @@ output(ostream &out, int indent_level, CPPScope *scope, bool complete) const {
   }
   }
   out.put(']');
   out.put(']');
 
 
-  if (_parameters != NULL) {
+  if (_parameters != nullptr) {
     out.put('(');
     out.put('(');
     _parameters->output(out, scope, true, -1);
     _parameters->output(out, scope, true, -1);
     out.put(')');
     out.put(')');
@@ -152,7 +152,7 @@ output(ostream &out, int indent_level, CPPScope *scope, bool complete) const {
     out << " noexcept";
     out << " noexcept";
   }
   }
 
 
-  if (_return_type != NULL) {
+  if (_return_type != nullptr) {
     out << " -> ";
     out << " -> ";
     _return_type->output(out, indent_level, scope, false);
     _return_type->output(out, indent_level, scope, false);
   }
   }

+ 1 - 1
dtool/src/cppparser/cppClosureType.h

@@ -44,7 +44,7 @@ public:
 
 
   CaptureType _default_capture;
   CaptureType _default_capture;
 
 
-  void add_capture(string name, CaptureType type, CPPExpression *initializer = NULL);
+  void add_capture(string name, CaptureType type, CPPExpression *initializer = nullptr);
 
 
   virtual bool is_fully_specified() const;
   virtual bool is_fully_specified() const;
 
 

+ 3 - 3
dtool/src/cppparser/cppConstType.cxx

@@ -160,7 +160,7 @@ is_convertible_to(const CPPType *other) const {
 bool CPPConstType::
 bool CPPConstType::
 is_equivalent(const CPPType &other) const {
 is_equivalent(const CPPType &other) const {
   const CPPConstType *ot = ((CPPType *)&other)->as_const_type();
   const CPPConstType *ot = ((CPPType *)&other)->as_const_type();
-  if (ot == (CPPConstType *)NULL) {
+  if (ot == nullptr) {
     return CPPType::is_equivalent(other);
     return CPPType::is_equivalent(other);
   }
   }
 
 
@@ -213,7 +213,7 @@ as_const_type() {
 bool CPPConstType::
 bool CPPConstType::
 is_equal(const CPPDeclaration *other) const {
 is_equal(const CPPDeclaration *other) const {
   const CPPConstType *ot = ((CPPDeclaration *)other)->as_const_type();
   const CPPConstType *ot = ((CPPDeclaration *)other)->as_const_type();
-  assert(ot != NULL);
+  assert(ot != nullptr);
 
 
   return _wrapped_around == ot->_wrapped_around;
   return _wrapped_around == ot->_wrapped_around;
 }
 }
@@ -226,7 +226,7 @@ is_equal(const CPPDeclaration *other) const {
 bool CPPConstType::
 bool CPPConstType::
 is_less(const CPPDeclaration *other) const {
 is_less(const CPPDeclaration *other) const {
   const CPPConstType *ot = ((CPPDeclaration *)other)->as_const_type();
   const CPPConstType *ot = ((CPPDeclaration *)other)->as_const_type();
-  assert(ot != NULL);
+  assert(ot != nullptr);
 
 
   return _wrapped_around < ot->_wrapped_around;
   return _wrapped_around < ot->_wrapped_around;
 }
 }

Algúns arquivos non se mostraron porque demasiados arquivos cambiaron neste cambio