geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbarr...@apache.org
Subject [10/23] geode-native git commit: GEODE-2741: Code cleanup to move to std::shared_ptr
Date Tue, 06 Jun 2017 17:56:36 GMT
http://git-wip-us.apache.org/repos/asf/geode-native/blob/11467dd9/src/cppcache/src/LocalRegion.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/LocalRegion.cpp b/src/cppcache/src/LocalRegion.cpp
index 6de7774..246e9db 100644
--- a/src/cppcache/src/LocalRegion.cpp
+++ b/src/cppcache/src/LocalRegion.cpp
@@ -49,7 +49,7 @@ LocalRegion::LocalRegion(const std::string& name, CacheImpl* cache,
       m_writer(nullptr),
       m_loader(nullptr),
       m_released(false),
-      m_entries(NULL),
+      m_entries(nullptr),
       m_cacheStatistics(stats),
       m_transactionEnabled(false),
       m_isPRSingleHopEnabled(false),
@@ -111,7 +111,7 @@ void LocalRegion::updateAccessAndModifiedTime(bool modified) {
     }
     // TODO:  should we really touch the parent region??
     RegionInternal* ri = dynamic_cast<RegionInternal*>(m_parentRegion.get());
-    if (ri != NULL) {
+    if (ri != nullptr) {
       ri->updateAccessAndModifiedTime(modified);
     }
   }
@@ -164,20 +164,17 @@ void LocalRegion::tombstoneOperationNoThrow(
 
   if (!cachingEnabled) return;
 
-  if (tombstoneVersions.get() != NULL) {
+  if (tombstoneVersions) {
     std::map<uint16_t, int64_t> gcVersions;
-    for (HashMapT<CacheableKeyPtr, CacheablePtr>::Iterator itr =
-             tombstoneVersions->begin();
-         itr != tombstoneVersions->end(); ++itr) {
-      try {
-        auto member =
-            std::dynamic_pointer_cast<DSMemberForVersionStamp>(itr.first());
+    for (const auto& itr : *tombstoneVersions) {
+      if (auto member =
+              std::dynamic_pointer_cast<DSMemberForVersionStamp>(itr.first)) {
         uint16_t memberId =
             getCacheImpl()->getMemberListForVersionStamp()->add(member);
         int64_t version =
-            (std::dynamic_pointer_cast<CacheableInt64>(itr.second()))->value();
+            (std::dynamic_pointer_cast<CacheableInt64>(itr.second))->value();
         gcVersions[memberId] = version;
-      } catch (const ClassCastException&) {
+      } else {
         LOGERROR(
             "tombstone_operation contains incorrect gc versions in the "
             "message. Region %s",
@@ -191,7 +188,7 @@ void LocalRegion::tombstoneOperationNoThrow(
   }
 }
 RegionPtr LocalRegion::getSubregion(const char* path) {
-  if (path == NULL) {
+  if (path == nullptr) {
     throw IllegalArgumentException("LocalRegion::getSubregion: path is null");
   }
 
@@ -281,7 +278,7 @@ void LocalRegion::subregions(const bool recursive, VectorOfRegion& sr) {
 }
 
 RegionEntryPtr LocalRegion::getEntry(const CacheableKeyPtr& key) {
-  if (getTXState() != NULL) {
+  if (getTXState() != nullptr) {
     GfErrTypeThrowException("GetEntry is not supported in transaction",
                             GF_NOTSUP);
   }
@@ -563,7 +560,7 @@ uint32_t LocalRegion::size_remote() {
 
 uint32_t LocalRegion::size() {
   TXState* txState = getTXState();
-  if (txState != NULL) {
+  if (txState != nullptr) {
     if (isLocalOp()) {
       return GF_NOTSUP;
     }
@@ -606,7 +603,7 @@ bool LocalRegion::containsValueForKey(const CacheableKeyPtr& keyPtr) const {
   }
 
   TXState* txState = getTXState();
-  if (txState == NULL) {
+  if (txState == nullptr) {
     return LocalRegion::containsValueForKey_remote(keyPtr);
   }
 
@@ -640,7 +637,7 @@ void LocalRegion::setPersistenceManager(PersistenceManagerPtr& pmPtr) {
   m_persistenceManager = pmPtr;
   // set the memberVariable of LRUEntriesMap too.
   LRUEntriesMap* lruMap = dynamic_cast<LRUEntriesMap*>(m_entries);
-  if (lruMap != NULL) {
+  if (lruMap != nullptr) {
     lruMap->setPersistenceManager(pmPtr);
   }
 }
@@ -709,7 +706,7 @@ void LocalRegion::release(bool invokeCallbacks) {
   LOGFINE("LocalRegion::release entered for region %s", m_fullPath.c_str());
   m_released = true;
 
-  if (m_regionStats != NULL) {
+  if (m_regionStats != nullptr) {
     m_regionStats->close();
   }
   if (invokeCallbacks) {
@@ -733,22 +730,22 @@ void LocalRegion::release(bool invokeCallbacks) {
     m_persistenceManager->close();
     m_persistenceManager = nullptr;
   }
-  if (m_entries != NULL && m_regionAttributes->getCachingEnabled()) {
+  if (m_entries != nullptr && m_regionAttributes->getCachingEnabled()) {
     m_entries->close();
   }
   LOGFINE("LocalRegion::release done for region %s", m_fullPath.c_str());
 }
 
 /** Returns whether the specified key currently exists in this region.
-* This method is equivalent to <code>getEntry(key) != null</code>.
-*
-* @param keyPtr the key to check for an existing entry, type is CacheableString
-*&
-* @return true if there is an entry in this region for the specified key
-*@throw RegionDestroyedException,  if region is destroyed.
-*@throw IllegalArgumentException, if the key is 'null'.
-*@throw NotConnectedException, if not connected to geode system.
-*/
+ * This method is equivalent to <code>getEntry(key) != null</code>.
+ *
+ * @param keyPtr the key to check for an existing entry, type is CacheableString
+ *&
+ * @return true if there is an entry in this region for the specified key
+ *@throw RegionDestroyedException,  if region is destroyed.
+ *@throw IllegalArgumentException, if the key is 'null'.
+ *@throw NotConnectedException, if not connected to geode system.
+ */
 bool LocalRegion::containsKey_internal(const CacheableKeyPtr& keyPtr) const {
   if (keyPtr == nullptr) {
     throw IllegalArgumentException("Region::containsKey: key is null");
@@ -794,7 +791,7 @@ GfErrType LocalRegion::getNoThrow(const CacheableKeyPtr& keyPtr,
     return GF_CACHE_ILLEGAL_ARGUMENT_EXCEPTION;
   }
   TXState* txState = getTXState();
-  if (txState != NULL) {
+  if (txState != nullptr) {
     if (isLocalOp()) {
       return GF_NOTSUP;
     }
@@ -949,7 +946,7 @@ GfErrType LocalRegion::getNoThrow(const CacheableKeyPtr& keyPtr,
   }
 
   // invokeCacheListenerForEntryEvent method has the check that if oldValue
-  // is a CacheableToken then it sets it to NULL; also determines if it
+  // is a CacheableToken then it sets it to nullptr; also determines if it
   // should be AFTER_UPDATE or AFTER_CREATE depending on oldValue, so don't
   // check here.
   if (isLoaderInvoked == false && err == GF_NOERR && value != nullptr) {
@@ -971,7 +968,7 @@ GfErrType LocalRegion::getAllNoThrow(const VectorOfCacheableKey& keys,
   CacheablePtr value;
 
   TXState* txState = getTXState();
-  if (txState != NULL) {
+  if (txState != nullptr) {
     if (isLocalOp()) {
       return GF_NOTSUP;
     }
@@ -1007,14 +1004,14 @@ GfErrType LocalRegion::getAllNoThrow(const VectorOfCacheableKey& keys,
     value = nullptr;
     m_regionStats->incGets();
     m_cacheImpl->m_cacheStats->incGets();
-    if (values != nullptr && cachingEnabled) {
-      if (m_entries->get(key, value, me) && value != nullptr &&
+    if (values && cachingEnabled) {
+      if (m_entries->get(key, value, me) && value &&
           !CacheableToken::isInvalid(value)) {
         m_regionStats->incHits();
         m_cacheImpl->m_cacheStats->incHits();
         updateAccessAndModifiedTimeForEntry(me, false);
         regionAccessed = true;
-        values->insert(key, value);
+        values->emplace(key, value);
       } else {
         value = nullptr;
       }
@@ -1059,8 +1056,8 @@ class PutActions {
 
   inline static GfErrType checkArgs(const CacheableKeyPtr& key,
                                     const CacheablePtr& value,
-                                    DataInput* delta = NULL) {
-    if (key == nullptr || (value == nullptr && delta == NULL)) {
+                                    DataInput* delta = nullptr) {
+    if (key == nullptr || (value == nullptr && delta == nullptr)) {
       return GF_CACHE_ILLEGAL_ARGUMENT_EXCEPTION;
     }
     return GF_NOERR;
@@ -1087,7 +1084,7 @@ class PutActions {
                                 const CacheablePtr& value,
                                 const UserDataPtr& aCallbackArgument,
                                 VersionTagPtr& versionTag) {
-    //    	if(m_txState != NULL && !m_txState->isReplay())
+    //    	if(m_txState != nullptr && !m_txState->isReplay())
     //    	{
     //    		auto args = std::make_shared<VectorOfCacheable>();
     //    		args->push_back(value);
@@ -1105,7 +1102,7 @@ class PutActions {
                                CacheablePtr& oldValue, bool cachingEnabled,
                                const CacheEventFlags eventFlags,
                                int updateCount, VersionTagPtr versionTag,
-                               DataInput* delta = NULL,
+                               DataInput* delta = nullptr,
                                EventIdPtr eventId = nullptr,
                                bool afterRemote = false) {
     return m_region.putLocal(name(), false, key, value, oldValue,
@@ -1125,7 +1122,7 @@ class PutActionsTx : public PutActions {
   inline explicit PutActionsTx(LocalRegion& region) : PutActions(region) {}
   inline static GfErrType checkArgs(const CacheableKeyPtr& key,
                                     const CacheablePtr& value,
-                                    DataInput* delta = NULL) {
+                                    DataInput* delta = nullptr) {
     if (key == nullptr) {
       return GF_CACHE_ILLEGAL_ARGUMENT_EXCEPTION;
     }
@@ -1173,7 +1170,7 @@ class CreateActions {
                                 const UserDataPtr& aCallbackArgument,
                                 VersionTagPtr& versionTag) {
     // propagate the create to remote server, if any
-    //  	  if(m_txState != NULL && !m_txState->isReplay())
+    //  	  if(m_txState != nullptr && !m_txState->isReplay())
     //  	  {
     //  		  auto args = std::make_shared<VectorOfCacheable>();
     //  		  args->push_back(value);
@@ -1190,7 +1187,7 @@ class CreateActions {
                                CacheablePtr& oldValue, bool cachingEnabled,
                                const CacheEventFlags eventFlags,
                                int updateCount, VersionTagPtr versionTag,
-                               DataInput* delta = NULL,
+                               DataInput* delta = nullptr,
                                EventIdPtr eventId = nullptr,
                                bool afterRemote = false) {
     return m_region.putLocal(name(), true, key, value, oldValue, cachingEnabled,
@@ -1245,7 +1242,7 @@ class DestroyActions {
                                 const UserDataPtr& aCallbackArgument,
                                 VersionTagPtr& versionTag) {
     // propagate the destroy to remote server, if any
-    //    	if(m_txState != NULL && !m_txState->isReplay())
+    //    	if(m_txState != nullptr && !m_txState->isReplay())
     //    	{
     //    		auto args = std::make_shared<VectorOfCacheable>();
     //    		args->push_back(aCallbackArgument);
@@ -1261,7 +1258,7 @@ class DestroyActions {
                                CacheablePtr& oldValue, bool cachingEnabled,
                                const CacheEventFlags eventFlags,
                                int updateCount, VersionTagPtr versionTag,
-                               DataInput* delta = NULL,
+                               DataInput* delta = nullptr,
                                EventIdPtr eventId = nullptr,
                                bool afterRemote = false) {
     if (cachingEnabled) {
@@ -1387,7 +1384,7 @@ class RemoveActions {
           return err;
         }
       } else if ((valuePtr == nullptr || CacheableToken::isInvalid(valuePtr))) {
-        //        	if(m_txState != NULL && !m_txState->isReplay())
+        //        	if(m_txState != nullptr && !m_txState->isReplay())
         //        	{
         //        		VectorOfCacheablePtr args(new
         //        VectorOfCacheable());
@@ -1406,7 +1403,7 @@ class RemoveActions {
         return err;
       }
     }
-    //  	if(m_txState != NULL && !m_txState->isReplay())
+    //  	if(m_txState != nullptr && !m_txState->isReplay())
     //  	{
     //  		auto args = std::make_shared<VectorOfCacheable>();
     //  		args->push_back(value);
@@ -1430,7 +1427,7 @@ class RemoveActions {
                                CacheablePtr& oldValue, bool cachingEnabled,
                                const CacheEventFlags eventFlags,
                                int updateCount, VersionTagPtr versionTag,
-                               DataInput* delta = NULL,
+                               DataInput* delta = nullptr,
                                EventIdPtr eventId = nullptr,
                                bool afterRemote = false) {
     CacheablePtr valuePtr;
@@ -1554,7 +1551,7 @@ class InvalidateActions {
 
   inline static GfErrType checkArgs(const CacheableKeyPtr& key,
                                     const CacheablePtr& value,
-                                    DataInput* delta = NULL) {
+                                    DataInput* delta = nullptr) {
     if (key == nullptr) {
       return GF_CACHE_ILLEGAL_ARGUMENT_EXCEPTION;
     }
@@ -1582,7 +1579,7 @@ class InvalidateActions {
                                 const CacheablePtr& value,
                                 const UserDataPtr& aCallbackArgument,
                                 VersionTagPtr& versionTag) {
-    //    	if(m_txState != NULL && !m_txState->isReplay())
+    //    	if(m_txState != nullptr && !m_txState->isReplay())
     //    	{
     //    		auto args = std::make_shared<VectorOfCacheable>();
     //    		args->push_back(aCallbackArgument);
@@ -1599,7 +1596,7 @@ class InvalidateActions {
                                CacheablePtr& oldValue, bool cachingEnabled,
                                const CacheEventFlags eventFlags,
                                int updateCount, VersionTagPtr versionTag,
-                               DataInput* delta = NULL,
+                               DataInput* delta = nullptr,
                                EventIdPtr eventId = nullptr,
                                bool afterRemote = false) {
     return m_region.invalidateLocal(name(), key, value, eventFlags, versionTag);
@@ -1629,7 +1626,7 @@ GfErrType LocalRegion::updateNoThrow(const CacheableKeyPtr& key,
 
   TAction action(*this);
   TXState* txState = action.m_txState;
-  if (txState != NULL) {
+  if (txState != nullptr) {
     if (isLocalOp(&eventFlags)) {
       return GF_NOTSUP;
     }
@@ -1653,7 +1650,7 @@ GfErrType LocalRegion::updateNoThrow(const CacheableKeyPtr& key,
   if (m_writer != nullptr && eventFlags.invokeCacheWriter()) {
     action.getCallbackOldValue(cachingEnabled, key, entry, oldValue);
     // invokeCacheWriterForEntryEvent method has the check that if oldValue
-    // is a CacheableToken then it sets it to NULL; also determines if it
+    // is a CacheableToken then it sets it to nullptr; also determines if it
     // should be BEFORE_UPDATE or BEFORE_CREATE depending on oldValue
     if (!invokeCacheWriterForEntryEvent(key, oldValue, value, aCallbackArgument,
                                         eventFlags,
@@ -1745,7 +1742,7 @@ GfErrType LocalRegion::updateNoThrow(const CacheableKeyPtr& key,
     }
   }
   // invokeCacheListenerForEntryEvent method has the check that if oldValue
-  // is a CacheableToken then it sets it to NULL; also determines if it
+  // is a CacheableToken then it sets it to nullptr; also determines if it
   // should be AFTER_UPDATE or AFTER_CREATE depending on oldValue
   err =
       invokeCacheListenerForEntryEvent(key, oldValue, value, aCallbackArgument,
@@ -1802,7 +1799,7 @@ GfErrType LocalRegion::updateNoThrowTX(const CacheableKeyPtr& key,
     }
   }
   // invokeCacheListenerForEntryEvent method has the check that if oldValue
-  // is a CacheableToken then it sets it to NULL; also determines if it
+  // is a CacheableToken then it sets it to nullptr; also determines if it
   // should be AFTER_UPDATE or AFTER_CREATE depending on oldValue
   err =
       invokeCacheListenerForEntryEvent(key, oldValue, value, aCallbackArgument,
@@ -1920,17 +1917,11 @@ GfErrType LocalRegion::putAllNoThrow(const HashMapOfCacheable& map,
   VersionedCacheableObjectPartListPtr
       versionedObjPartListPtr;  //= new VersionedCacheableObjectPartList();
   TXState* txState = getTXState();
-  if (txState != NULL) {
+  if (txState != nullptr) {
     if (isLocalOp()) {
       return GF_NOTSUP;
     }
-    // if(!txState->isReplay())
-    //{
-    //	auto args = std::make_shared<VectorOfCacheable>();
-    //	args->push_back(HashMapOfCacheablePtr(new HashMapOfCacheable(map)));
-    //	args->push_back(CacheableInt32::create(timeout));
-    //	txState->recordTXOperation(GF_PUT_ALL, getFullPath(), nullptr, args);
-    //}
+
     err = putAllNoThrow_remote(map, /*versionTag*/ versionedObjPartListPtr,
                                timeout, aCallbackArgument);
     if (err == GF_NOERR) {
@@ -1967,9 +1958,8 @@ GfErrType LocalRegion::putAllNoThrow(const HashMapOfCacheable& map,
 
   if (cachingEnabled || m_writer != nullptr) {
     CacheablePtr oldValue;
-    for (HashMapOfCacheable::Iterator iter = map.begin(); iter != map.end();
-         ++iter) {
-      const CacheableKeyPtr& key = iter.first();
+    for (const auto& iter : map) {
+      const auto& key = iter.first;
       if (cachingEnabled &&
           !m_regionAttributes->getConcurrencyChecksEnabled()) {
         int updateCount =
@@ -1979,10 +1969,10 @@ GfErrType LocalRegion::putAllNoThrow(const HashMapOfCacheable& map,
       }
       if (m_writer != nullptr) {
         // invokeCacheWriterForEntryEvent method has the check that if oldValue
-        // is a CacheableToken then it sets it to NULL; also determines if it
+        // is a CacheableToken then it sets it to nullptr; also determines if it
         // should be BEFORE_UPDATE or BEFORE_CREATE depending on oldValue
         if (!invokeCacheWriterForEntryEvent(
-                key, oldValue, iter.second(), aCallbackArgument,
+                key, oldValue, iter.second, aCallbackArgument,
                 CacheEventFlags::LOCAL, BEFORE_UPDATE)) {
           PutActions::logCacheWriterFailure(key, oldValue);
           return GF_CACHEWRITER_ERROR;
@@ -2007,13 +1997,13 @@ GfErrType LocalRegion::putAllNoThrow(const HashMapOfCacheable& map,
            keyIndex++) {
         const CacheableKeyPtr valPtr =
             versionedObjPartListPtr->getSucceededKeys()->at(keyIndex);
-        HashMapOfCacheable::Iterator mapIter = map.find(valPtr);
+        const auto& mapIter = map.find(valPtr);
         CacheableKeyPtr key = nullptr;
         CacheablePtr value = nullptr;
 
         if (mapIter != map.end()) {
-          key = mapIter.first();
-          value = mapIter.second();
+          key = mapIter->first;
+          value = mapIter->second;
         } else {
           // ThrowERROR
           LOGERROR(
@@ -2022,7 +2012,7 @@ GfErrType LocalRegion::putAllNoThrow(const HashMapOfCacheable& map,
         }
 
         if (versionedObjPartListPtr != nullptr &&
-            versionedObjPartListPtr.get() != NULL) {
+            versionedObjPartListPtr.get() != nullptr) {
           LOGDEBUG("versionedObjPartListPtr->getVersionedTagptr().size() = %d ",
                    versionedObjPartListPtr->getVersionedTagptr().size());
           if (versionedObjPartListPtr->getVersionedTagptr().size() > 0) {
@@ -2054,14 +2044,13 @@ GfErrType LocalRegion::putAllNoThrow(const HashMapOfCacheable& map,
           "expected false",
           m_isPRSingleHopEnabled);
       int index = 0;
-      for (HashMapOfCacheable::Iterator iter = map.begin(); iter != map.end();
-           ++iter) {
-        const CacheableKeyPtr& key = iter.first();
-        const CacheablePtr& value = iter.second();
-        std::pair<CacheablePtr, int>& p = oldValueMap[key];
+      for (const auto& iter : map) {
+        const auto& key = iter.first;
+        const auto& value = iter.second;
+        auto& p = oldValueMap[key];
 
         if (versionedObjPartListPtr != nullptr &&
-            versionedObjPartListPtr.get() != NULL) {
+            versionedObjPartListPtr.get() != nullptr) {
           LOGDEBUG("versionedObjPartListPtr->getVersionedTagptr().size() = %d ",
                    versionedObjPartListPtr->getVersionedTagptr().size());
           if (versionedObjPartListPtr->getVersionedTagptr().size() > 0) {
@@ -2101,7 +2090,7 @@ GfErrType LocalRegion::removeAllNoThrow(const VectorOfCacheableKey& keys,
 
   // 2.check transaction state and do remote op
   TXState* txState = getTXState();
-  if (txState != NULL) {
+  if (txState != nullptr) {
     if (isLocalOp()) return GF_NOTSUP;
     err = removeAllNoThrow_remote(keys, versionedObjPartListPtr,
                                   aCallbackArgument);
@@ -2133,7 +2122,7 @@ GfErrType LocalRegion::removeAllNoThrow(const VectorOfCacheableKey& keys,
     for (int keyIndex = 0; keyIndex < keysPtr->size(); keyIndex++) {
       CacheableKeyPtr key = keysPtr->at(keyIndex);
       if (versionedObjPartListPtr != nullptr &&
-          versionedObjPartListPtr.get() != NULL) {
+          versionedObjPartListPtr.get() != nullptr) {
         LOGDEBUG("versionedObjPartListPtr->getVersionedTagptr().size() = %d ",
                  versionedObjPartListPtr->getVersionedTagptr().size());
         if (versionedObjPartListPtr->getVersionedTagptr().size() > 0) {
@@ -2282,12 +2271,12 @@ GfErrType LocalRegion::invalidateRegionNoThrow(
   if (m_regionAttributes->getCachingEnabled()) {
     VectorOfCacheableKey v;
     keys_internal(v);
-    uint32_t size = v.size();
+    const auto size = v.size();
     MapEntryImplPtr me;
-    for (uint32_t i = 0; i < size; i++) {
+    for (size_t i = 0; i < size; i++) {
       {
         CacheablePtr oldValue;
-        // invalidate all the entries with a NULL versionTag
+        // invalidate all the entries with a nullptr versionTag
         VersionTagPtr versionTag;
         m_entries->invalidate(v.at(i), me, oldValue, versionTag);
         if (!eventFlags.isEvictOrExpire()) {
@@ -2312,7 +2301,7 @@ GfErrType LocalRegion::invalidateRegionNoThrow(
          p != m_subRegions.end(); ++p) {
       RegionInternal* subRegion =
           dynamic_cast<RegionInternal*>((*p).int_id_.get());
-      if (subRegion != NULL) {
+      if (subRegion != nullptr) {
         err = subRegion->invalidateRegionNoThrow(aCallbackArgument, eventFlags);
         if (err != GF_NOERR) {
           return err;
@@ -2391,7 +2380,7 @@ GfErrType LocalRegion::destroyRegionNoThrow(
       // RegionInternal and invoke the destroy method in that
       RegionInternal* subRegion =
           dynamic_cast<RegionInternal*>((*p).int_id_.get());
-      if (subRegion != NULL) {
+      if (subRegion != nullptr) {
         //  for subregions never remove from parent since that will cause
         // the region to be destroyed and SEGV; unbind_all takes care of that
         // Also don't send remote destroy message for sub-regions
@@ -2432,7 +2421,7 @@ GfErrType LocalRegion::destroyRegionNoThrow(
       m_cacheImpl->removeRegion(m_name.c_str());
     } else {
       LocalRegion* parent = dynamic_cast<LocalRegion*>(m_parentRegion.get());
-      if (parent != NULL) {
+      if (parent != nullptr) {
         parent->removeRegion(m_name);
         if (!eventFlags.isEvictOrExpire()) {
           parent->updateAccessAndModifiedTime(true);
@@ -2475,7 +2464,7 @@ GfErrType LocalRegion::putLocal(const char* name, bool isCreate,
               versionTag1 != nullptr ? versionTag1 : versionTag, isUpdate);
         }
       }
-      if (delta != NULL &&
+      if (delta != nullptr &&
           err == GF_NOERR) {  // Means that delta is on and there is no failure.
         m_cacheImpl->m_cacheStats->incDeltaReceived();
       }
@@ -2569,7 +2558,7 @@ bool LocalRegion::invokeCacheWriterForEntryEvent(
             bCacheWriterReturn = m_writer->beforeUpdate(event);
             break;
           }
-          // if oldValue is NULL then fall to BEFORE_CREATE case
+          // if oldValue is nullptr then fall to BEFORE_CREATE case
         }
         case BEFORE_CREATE: {
           eventStr = "beforeCreate";
@@ -2683,7 +2672,7 @@ GfErrType LocalRegion::invokeCacheListenerForEntryEvent(
             m_listener->afterUpdate(event);
             break;
           }
-          // if oldValue is NULL then fall to AFTER_CREATE case
+          // if oldValue is nullptr then fall to AFTER_CREATE case
         }
         case AFTER_CREATE: {
           eventStr = "afterCreate";
@@ -2912,10 +2901,10 @@ int32_t LocalRegion::adjustEntryExpiryDuration(int32_t duration) {
 /** they used to public methods in hpp file */
 bool LocalRegion::isStatisticsEnabled() {
   bool status = true;
-  if (m_cacheImpl == NULL) {
+  if (m_cacheImpl == nullptr) {
     return false;
   }
-  if (m_cacheImpl->getCache() != NULL) {
+  if (m_cacheImpl->getCache() != nullptr) {
     SystemProperties* props =
         m_cacheImpl->getCache()->getDistributedSystem()->getSystemProperties();
     if (props) {
@@ -3110,7 +3099,7 @@ void LocalRegion::adjustCacheWriter(const char* lib, const char* func) {
 void LocalRegion::evict(int32_t percentage) {
   TryReadGuard guard(m_rwLock, m_destroyPending);
   if (m_released || m_destroyPending) return;
-  if (m_entries != NULL) {
+  if (m_entries != nullptr) {
     int32_t size = m_entries->size();
     int32_t entriesToEvict = (int32_t)(percentage * size) / 100;
     // only invoked from EvictionController so static_cast is always safe
@@ -3151,8 +3140,8 @@ CacheablePtr LocalRegion::handleReplay(GfErrType& err,
       err == GF_TRANSACTION_DATA_NODE_HAS_DEPARTED_EXCEPTION) {
     bool isRollBack = (err == GF_TRANSACTION_DATA_REBALANCED_EXCEPTION);
     TXState* txState = getTXState();
-    if (txState == NULL) {
-      GfErrTypeThrowException("TXState is NULL",
+    if (txState == nullptr) {
+      GfErrTypeThrowException("TXState is nullptr",
                               GF_CACHE_ILLEGAL_STATE_EXCEPTION);
     }
 

http://git-wip-us.apache.org/repos/asf/geode-native/blob/11467dd9/src/cppcache/src/LocalRegion.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/LocalRegion.hpp b/src/cppcache/src/LocalRegion.hpp
index c3c6b05..7be2233 100644
--- a/src/cppcache/src/LocalRegion.hpp
+++ b/src/cppcache/src/LocalRegion.hpp
@@ -21,8 +21,8 @@
  */
 
 /**
-* @file
-*/
+ * @file
+ */
 
 #include <geode/geode_globals.hpp>
 #include <geode/CacheStatistics.hpp>
@@ -92,33 +92,33 @@ typedef std::unordered_map<CacheableKeyPtr, std::pair<CacheablePtr, int> >
     MapOfOldValue;
 
 /**
-* @class LocalRegion LocalRegion.hpp
-*
-* This class manages subregions and cached data. Each region
-* can contain multiple subregions and entries for data.
-* Regions provide a hierachical name space
-* within the cache. Also, a region can be used to group cached
-* objects for management purposes.
-*
-* The Region interface basically contains two set of APIs: Region management
-* APIs; and (potentially) distributed operations on entries. Non-distributed
-* operations on entries  are provided by <code>RegionEntry</code>.
-*
-* Each <code>Cache</code>  defines regions called the root regions.
-* User applications can use the root regions to create subregions
-* for isolated name space and object grouping.
-*
-* A region's name can be any String except that it should not contain
-* the region name separator, a forward slash (/).
-*
-* <code>Regions</code>  can be referenced by a relative path name from any
-* region
-* higher in the hierarchy in {@link Region::getSubregion}. You can get the
-* relative
-* path from the root region with {@link Region::getFullPath}. The name separator
-* is used to concatenate all the region names together from the root, starting
-* with the root's subregions.
-*/
+ * @class LocalRegion LocalRegion.hpp
+ *
+ * This class manages subregions and cached data. Each region
+ * can contain multiple subregions and entries for data.
+ * Regions provide a hierachical name space
+ * within the cache. Also, a region can be used to group cached
+ * objects for management purposes.
+ *
+ * The Region interface basically contains two set of APIs: Region management
+ * APIs; and (potentially) distributed operations on entries. Non-distributed
+ * operations on entries  are provided by <code>RegionEntry</code>.
+ *
+ * Each <code>Cache</code>  defines regions called the root regions.
+ * User applications can use the root regions to create subregions
+ * for isolated name space and object grouping.
+ *
+ * A region's name can be any String except that it should not contain
+ * the region name separator, a forward slash (/).
+ *
+ * <code>Regions</code>  can be referenced by a relative path name from any
+ * region
+ * higher in the hierarchy in {@link Region::getSubregion}. You can get the
+ * relative
+ * path from the root region with {@link Region::getFullPath}. The name
+ * separator is used to concatenate all the region names together from the root,
+ * starting with the root's subregions.
+ */
 typedef SharedPtr<LocalRegion> LocalRegionPtr;
 
 class CPPCACHE_EXPORT LocalRegion : public RegionInternal {
@@ -127,8 +127,8 @@ class CPPCACHE_EXPORT LocalRegion : public RegionInternal {
    */
  public:
   /**
-  * @brief constructor/destructor
-  */
+   * @brief constructor/destructor
+   */
   LocalRegion(const std::string& name, CacheImpl* cache,
               const RegionInternalPtr& rPtr,
               const RegionAttributesPtr& attributes,
@@ -227,7 +227,7 @@ class CPPCACHE_EXPORT LocalRegion : public RegionInternal {
                                CacheablePtr& oldValue, int updateCount,
                                const CacheEventFlags eventFlags,
                                VersionTagPtr versionTag,
-                               DataInput* delta = NULL,
+                               DataInput* delta = nullptr,
                                EventIdPtr eventId = nullptr);
   virtual GfErrType putNoThrowTX(const CacheableKeyPtr& key,
                                  const CacheablePtr& value,
@@ -235,7 +235,7 @@ class CPPCACHE_EXPORT LocalRegion : public RegionInternal {
                                  CacheablePtr& oldValue, int updateCount,
                                  const CacheEventFlags eventFlags,
                                  VersionTagPtr versionTag,
-                                 DataInput* delta = NULL,
+                                 DataInput* delta = nullptr,
                                  EventIdPtr eventId = nullptr);
   virtual GfErrType createNoThrow(const CacheableKeyPtr& key,
                                   const CacheablePtr& value,
@@ -296,7 +296,7 @@ class CPPCACHE_EXPORT LocalRegion : public RegionInternal {
                      const CacheableKeyPtr& keyPtr,
                      const CacheablePtr& valuePtr, CacheablePtr& oldValue,
                      bool cachingEnabled, int updateCount, int destroyTracker,
-                     VersionTagPtr versionTag, DataInput* delta = NULL,
+                     VersionTagPtr versionTag, DataInput* delta = nullptr,
                      EventIdPtr eventId = nullptr);
   GfErrType invalidateLocal(const char* name, const CacheableKeyPtr& keyPtr,
                             const CacheablePtr& value,
@@ -401,7 +401,7 @@ class CPPCACHE_EXPORT LocalRegion : public RegionInternal {
 
   CacheablePtr handleReplay(GfErrType& err, CacheablePtr value) const;
 
-  bool isLocalOp(const CacheEventFlags* eventFlags = NULL) {
+  bool isLocalOp(const CacheEventFlags* eventFlags = nullptr) {
     return typeid(*this) == typeid(LocalRegion) ||
            (eventFlags && eventFlags->isLocal());
   }
@@ -412,7 +412,7 @@ class CPPCACHE_EXPORT LocalRegion : public RegionInternal {
                           const UserDataPtr& aCallbackArgument,
                           CacheablePtr& oldValue, int updateCount,
                           const CacheEventFlags eventFlags,
-                          VersionTagPtr versionTag, DataInput* delta = NULL,
+                          VersionTagPtr versionTag, DataInput* delta = nullptr,
                           EventIdPtr eventId = nullptr);
 
   template <typename TAction>
@@ -421,7 +421,8 @@ class CPPCACHE_EXPORT LocalRegion : public RegionInternal {
                             const UserDataPtr& aCallbackArgument,
                             CacheablePtr& oldValue, int updateCount,
                             const CacheEventFlags eventFlags,
-                            VersionTagPtr versionTag, DataInput* delta = NULL,
+                            VersionTagPtr versionTag,
+                            DataInput* delta = nullptr,
                             EventIdPtr eventId = nullptr);
 
   /* protected attributes */

http://git-wip-us.apache.org/repos/asf/geode-native/blob/11467dd9/src/cppcache/src/LocatorListRequest.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/LocatorListRequest.cpp b/src/cppcache/src/LocatorListRequest.cpp
index 75e470f..f745b71 100644
--- a/src/cppcache/src/LocatorListRequest.cpp
+++ b/src/cppcache/src/LocatorListRequest.cpp
@@ -28,7 +28,7 @@ void LocatorListRequest::toData(DataOutput& output) const {
   // output.writeObject(pxr);// changed
   output.writeNativeString(m_servergroup.c_str());
 }
-Serializable* LocatorListRequest::fromData(DataInput& input) { return NULL; }
+Serializable* LocatorListRequest::fromData(DataInput& input) { return nullptr; }
 int8_t LocatorListRequest::typeId() const {
   return static_cast<int8_t>(GeodeTypeIdsImpl::LocatorListRequest);
 }

http://git-wip-us.apache.org/repos/asf/geode-native/blob/11467dd9/src/cppcache/src/Log.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/Log.cpp b/src/cppcache/src/Log.cpp
index 894f041..5a456a4 100644
--- a/src/cppcache/src/Log.cpp
+++ b/src/cppcache/src/Log.cpp
@@ -65,8 +65,8 @@ namespace geode {
 namespace log {
 namespace globals {
 
-std::string* g_logFile = NULL;
-std::string* g_logFileWithExt = NULL;
+std::string* g_logFile = nullptr;
+std::string* g_logFileWithExt = nullptr;
 
 size_t g_bytesWritten = 0;
 bool g_isLogFileOpened = false;
@@ -76,7 +76,7 @@ size_t g_diskSpaceLimit = GEODE_MAX_LOG_DISK_LIMIT;
 
 char g_logFileNameBuffer[2048] = {0};
 
-ACE_Thread_Mutex* g_logMutex = NULL;
+ACE_Thread_Mutex* g_logMutex = nullptr;
 
 int g_rollIndex = 0;
 size_t g_spaceUsed = 0;
@@ -85,7 +85,7 @@ std::pair<std::string, int64_t> g_fileInfoPair;
 // Vector to hold the fileInformation
 typedef std::vector<std::pair<std::string, int64_t> > g_fileInfo;
 
-FILE* g_log = NULL;
+FILE* g_log = nullptr;
 ACE_utsname g_uname;
 pid_t g_pid = 0;
 
@@ -157,8 +157,8 @@ namespace client {
 // this method is not thread-safe and expected to be invoked once
 // during initialization
 void gf_log_libinit() {
-  if (g_logMutex == NULL) {
-    g_logFile = NULL;
+  if (g_logMutex == nullptr) {
+    g_logFile = nullptr;
     g_bytesWritten = 0;
     g_fileSizeLimit = 0;
     g_diskSpaceLimit = 0;
@@ -166,7 +166,7 @@ void gf_log_libinit() {
     g_spaceUsed = 0;
     g_logMutex = new ACE_Thread_Mutex("Log::logMutex");
   }
-  if (g_logMutex == NULL) {
+  if (g_logMutex == nullptr) {
     throw IllegalStateException("Log not initialized successfully");
   }
 }
@@ -195,13 +195,13 @@ const char* Log::logFileName() {
 
 void Log::init(LogLevel level, const char* logFileName, int32_t logFileLimit,
                int64_t logDiskSpaceLimit) {
-  if (g_log != NULL) {
+  if (g_log != nullptr) {
     throw IllegalStateException(
         "The Log has already been initialized. "
         "Call Log::close() before calling Log::init again.");
   }
   s_logLevel = level;
-  if (g_logMutex == NULL) g_logMutex = new ACE_Thread_Mutex("Log::logMutex");
+  if (g_logMutex == nullptr) g_logMutex = new ACE_Thread_Mutex("Log::logMutex");
 
   if (logDiskSpaceLimit <
       0 /*|| logDiskSpaceLimit > GEODE_MAX_LOG_DISK_LIMIT*/) {
@@ -238,7 +238,7 @@ void Log::init(LogLevel level, const char* logFileName, int32_t logFileLimit,
     }
     *g_logFile = slashtmp;
     delete[] slashtmp;
-    slashtmp = NULL;
+    slashtmp = nullptr;
 #endif
 
     // Appending a ".log" at the end if it does not exist or file has some other
@@ -303,7 +303,7 @@ void Log::init(LogLevel level, const char* logFileName, int32_t logFileLimit,
     sds.close();
 
     FILE* existingFile = fopen(g_logFileWithExt->c_str(), "r");
-    if (existingFile != NULL && logFileLimit > 0) {
+    if (existingFile != nullptr && logFileLimit > 0) {
       /* adongre
        * Coverity - II
        * CID 29205: Calling risky function (SECURE_CODING)[VERY RISKY]. Using
@@ -347,9 +347,9 @@ void Log::init(LogLevel level, const char* logFileName, int32_t logFileLimit,
       bool rollFileNameGot = false;
       while (!rollFileNameGot) {
         FILE* checkFile = fopen(rollFile, "r");
-        if (checkFile != NULL) {
+        if (checkFile != nullptr) {
           fclose(checkFile);
-          checkFile = NULL;
+          checkFile = nullptr;
           ACE_OS::snprintf(rollFile, 1024, "%s%c%s-%d.%s", logsdirname.c_str(),
                            ACE_DIRECTORY_SEPARATOR_CHAR, fnameBeforeExt.c_str(),
                            g_rollIndex++, extName.c_str());
@@ -359,7 +359,7 @@ void Log::init(LogLevel level, const char* logFileName, int32_t logFileLimit,
         /* adongre
          * CID 28999: Use after free (USE_AFTER_FREE)
          */
-        if (checkFile != NULL) fclose(existingFile);
+        if (checkFile != nullptr) fclose(existingFile);
       }
       // retry some number of times before giving up when file is busy etc.
       int renameResult = -1;
@@ -380,14 +380,14 @@ void Log::init(LogLevel level, const char* logFileName, int32_t logFileLimit,
       }
       */
     }
-    if (existingFile != NULL) {
+    if (existingFile != nullptr) {
       fclose(existingFile);
-      existingFile = NULL;
+      existingFile = nullptr;
     }
   } else if (g_logFile) {
     delete g_logFile;
-    g_logFile = NULL;
-    g_logFileWithExt = NULL;
+    g_logFile = nullptr;
+    g_logFileWithExt = nullptr;
   }
   writeBanner();
 }
@@ -400,21 +400,21 @@ void Log::close() {
   if (g_logFile) {
     oldfile = *g_logFile;
     delete g_logFile;
-    g_logFile = NULL;
+    g_logFile = nullptr;
   }
   if (g_logFileWithExt) {
     delete g_logFileWithExt;
-    g_logFileWithExt = NULL;
+    g_logFileWithExt = nullptr;
   }
 
   if (g_log) {
     fclose(g_log);
-    g_log = NULL;
+    g_log = nullptr;
   }
 }
 
 void Log::writeBanner() {
-  if (g_logFileWithExt == NULL) {
+  if (g_logFileWithExt == nullptr) {
     return;
   }
   const char* dirname = ACE::dirname(g_logFileWithExt->c_str());
@@ -427,7 +427,7 @@ void Log::writeBanner() {
   int maxTries = 10;
   while (maxTries-- > 0) {
     g_log = fopen(g_logFileWithExt->c_str(), "a");
-    if (g_log != NULL) {
+    if (g_log != nullptr) {
       break;
     }
     int lastError = ACE_OS::last_error();
@@ -449,7 +449,7 @@ void Log::writeBanner() {
   }
   std::string bannertext = geodeBanner::getBanner();
 
-  if (g_logFile == NULL) {
+  if (g_logFile == nullptr) {
     fprintf(stdout, "%s", bannertext.c_str());
     fflush(stdout);
     return;
@@ -462,9 +462,9 @@ void Log::writeBanner() {
   }
 
   int numchars = 0;
-  const char* pch = NULL;
+  const char* pch = nullptr;
   pch = strchr(bannertext.c_str(), '\n');
-  while (pch != NULL) {
+  while (pch != nullptr) {
     pch = strchr(pch + 1, '\n');
     numchars += 2;
   }
@@ -643,7 +643,7 @@ void Log::put(LogLevel level, const char* msg) {
       bool rollFileNameGot = false;
       while (!rollFileNameGot) {
         FILE* fp1 = fopen(rollFile, "r");
-        if (fp1 != NULL) {
+        if (fp1 != nullptr) {
           fclose(fp1);
           ACE_OS::snprintf(rollFile, 1024, "%s%c%s-%d.%s", logsdirname.c_str(),
                            ACE_DIRECTORY_SEPARATOR_CHAR, fnameBeforeExt.c_str(),
@@ -654,7 +654,7 @@ void Log::put(LogLevel level, const char* msg) {
       }
 
       fclose(g_log);
-      g_log = NULL;
+      g_log = nullptr;
 
       if (ACE_OS::rename(g_logFileWithExt->c_str(), rollFile) < 0) {
         return;  // no need to throw exception try next time
@@ -716,7 +716,7 @@ void Log::put(LogLevel level, const char* msg) {
       // lets continue wothout throwing the exception; it should not cause
       // process to terminate
       fclose(g_log);
-      g_log = NULL;
+      g_log = nullptr;
     } else {
       fflush(g_log);
     }

http://git-wip-us.apache.org/repos/asf/geode-native/blob/11467dd9/src/cppcache/src/MapEntry.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/MapEntry.cpp b/src/cppcache/src/MapEntry.cpp
index 4222c80..b8f1854 100644
--- a/src/cppcache/src/MapEntry.cpp
+++ b/src/cppcache/src/MapEntry.cpp
@@ -19,7 +19,7 @@
 
 using namespace apache::geode::client;
 
-EntryFactory* EntryFactory::singleton = NULL;
+EntryFactory* EntryFactory::singleton = nullptr;
 MapEntryPtr MapEntry::MapEntry_NullPointer(nullptr);
 
 /**

http://git-wip-us.apache.org/repos/asf/geode-native/blob/11467dd9/src/cppcache/src/MapSegment.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/MapSegment.cpp b/src/cppcache/src/MapSegment.cpp
index cd4731c..6492dc1 100644
--- a/src/cppcache/src/MapSegment.cpp
+++ b/src/cppcache/src/MapSegment.cpp
@@ -30,7 +30,7 @@ using namespace apache::geode::client;
 
 #define _GF_GUARD_SEGMENT SpinLockGuard mapGuard(m_spinlock)
 #define _VERSION_TAG_NULL_CHK \
-  (versionTag != nullptr && versionTag.get() != NULL)
+  (versionTag != nullptr && versionTag.get() != nullptr)
 bool MapSegment::boolVal = false;
 MapSegment::~MapSegment() {
   delete m_map;
@@ -67,7 +67,7 @@ GfErrType MapSegment::create(const CacheableKeyPtr& key,
                              CacheablePtr& oldValue, int updateCount,
                              int destroyTracker, VersionTagPtr versionTag) {
   long taskid = -1;
-  TombstoneExpiryHandler* handler = NULL;
+  TombstoneExpiryHandler* handler = nullptr;
   GfErrType err = GF_NOERR;
   {
     _GF_GUARD_SEGMENT;
@@ -120,7 +120,7 @@ GfErrType MapSegment::create(const CacheableKeyPtr& key,
   }
   if (taskid != -1) {
     CacheImpl::expiryTaskManager->cancelTask(taskid);
-    if (handler != NULL) delete handler;
+    if (handler != nullptr) delete handler;
   }
   return err;
 }
@@ -134,7 +134,7 @@ GfErrType MapSegment::put(const CacheableKeyPtr& key,
                           int destroyTracker, bool& isUpdate,
                           VersionTagPtr versionTag, DataInput* delta) {
   long taskid = -1;
-  TombstoneExpiryHandler* handler = NULL;
+  TombstoneExpiryHandler* handler = nullptr;
   GfErrType err = GF_NOERR;
   {
     _GF_GUARD_SEGMENT;
@@ -146,7 +146,7 @@ GfErrType MapSegment::put(const CacheableKeyPtr& key,
     MapEntryPtr entry;
     int status;
     if ((status = m_map->find(key, entry)) == -1) {
-      if (delta != NULL) {
+      if (delta != nullptr) {
         return GF_INVALID_DELTA;  // You can not apply delta when there is no
       }
       // entry hence ask for full object
@@ -162,7 +162,7 @@ GfErrType MapSegment::put(const CacheableKeyPtr& key,
       if (m_concurrencyChecksEnabled) {
         versionStamp = entry->getVersionStamp();
         if (_VERSION_TAG_NULL_CHK) {
-          if (delta == NULL) {
+          if (delta == nullptr) {
             err = versionStamp.processVersionTag(m_region, key, versionTag,
                                                  false);
           } else {
@@ -191,7 +191,7 @@ GfErrType MapSegment::put(const CacheableKeyPtr& key,
   }
   if (taskid != -1) {
     CacheImpl::expiryTaskManager->cancelTask(taskid);
-    if (handler != NULL) delete handler;
+    if (handler != nullptr) delete handler;
   }
   return err;
 }
@@ -640,11 +640,11 @@ GfErrType MapSegment::putForTrackedEntry(
     // for a non-tracked put (e.g. from notification) go ahead with the
     // create/update and increment the update counter
     ThinClientRegion* tcRegion = dynamic_cast<ThinClientRegion*>(m_region);
-    ThinClientPoolDM* m_poolDM = NULL;
+    ThinClientPoolDM* m_poolDM = nullptr;
     if (tcRegion) {
       m_poolDM = dynamic_cast<ThinClientPoolDM*>(tcRegion->getDistMgr());
     }
-    if (delta != NULL) {
+    if (delta != nullptr) {
       CacheablePtr oldValue;
       entryImpl->getValueI(oldValue);
       if (oldValue == nullptr || CacheableToken::isDestroyed(oldValue) ||
@@ -749,7 +749,7 @@ GfErrType MapSegment::isTombstone(CacheableKeyPtr key, MapEntryImplPtr& me,
   }
 
   if (CacheableToken::isTombstone(value)) {
-    if (m_tombstoneList->getEntryFromTombstoneList(key)) {
+    if (m_tombstoneList->exists(key)) {
       MapEntryPtr entry;
       if (m_map->find(key, entry) != -1) {
         auto mePtr = entry->getImplPtr();
@@ -764,7 +764,7 @@ GfErrType MapSegment::isTombstone(CacheableKeyPtr key, MapEntryImplPtr& me,
     }
 
   } else {
-    if (m_tombstoneList->getEntryFromTombstoneList(key)) {
+    if (m_tombstoneList->exists(key)) {
       LOGFINER(" 2 result= false return GF_CACHE_ILLEGAL_STATE_EXCEPTION");
       result = false;
       return GF_CACHE_ILLEGAL_STATE_EXCEPTION;

http://git-wip-us.apache.org/repos/asf/geode-native/blob/11467dd9/src/cppcache/src/MapSegment.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/MapSegment.hpp b/src/cppcache/src/MapSegment.hpp
index 2ed6f66..75d2c03 100644
--- a/src/cppcache/src/MapSegment.hpp
+++ b/src/cppcache/src/MapSegment.hpp
@@ -126,7 +126,7 @@ class CPPCACHE_EXPORT MapSegment {
     std::pair<bool, int> trackerPair = entry->removeTracker();
     if (trackerPair.second <= 0) {
       CacheablePtr value;
-      if (entryImpl == NULL) {
+      if (entryImpl == nullptr) {
         entryImpl = entry->getImplPtr();
       }
       entryImpl->getValueI(value);
@@ -146,7 +146,7 @@ class CPPCACHE_EXPORT MapSegment {
                               const CacheablePtr& newValue,
                               MapEntryImplPtr& newEntry, int updateCount,
                               int destroyTracker, VersionTagPtr versionTag,
-                              VersionStamp* versionStamp = NULL) {
+                              VersionStamp* versionStamp = nullptr) {
     if (!m_concurrencyChecksEnabled) {
       if (updateCount >= 0) {
         // entry was removed while being tracked
@@ -164,9 +164,9 @@ class CPPCACHE_EXPORT MapSegment {
     m_entryFactory->newMapEntry(key, newEntry);
     newEntry->setValueI(newValue);
     if (m_concurrencyChecksEnabled) {
-      if (versionTag != nullptr && versionTag.get() != NULL) {
+      if (versionTag != nullptr && versionTag.get() != nullptr) {
         newEntry->getVersionStamp().setVersions(versionTag);
-      } else if (versionStamp != NULL) {
+      } else if (versionStamp != nullptr) {
         newEntry->getVersionStamp().setVersions(*versionStamp);
       }
     }
@@ -178,7 +178,7 @@ class CPPCACHE_EXPORT MapSegment {
                                const CacheablePtr& newValue, MapEntryPtr& entry,
                                MapEntryImplPtr& entryImpl, int updateCount,
                                VersionStamp& versionStamp,
-                               DataInput* delta = NULL);
+                               DataInput* delta = nullptr);
 
   CacheablePtr getFromDisc(CacheableKeyPtr key, MapEntryImplPtr& entryImpl);
 
@@ -190,14 +190,14 @@ class CPPCACHE_EXPORT MapSegment {
 
  public:
   MapSegment()
-      : m_map(NULL),
-        m_entryFactory(NULL),
+      : m_map(nullptr),
+        m_entryFactory(nullptr),
         m_region(nullptr),
         m_primeIndex(0),
         m_spinlock(),
         m_segmentMutex(),
         m_concurrencyChecksEnabled(false),
-        m_numDestroyTrackers(NULL),
+        m_numDestroyTrackers(nullptr),
         m_rehashCount(0)  // COVERITY  --> 30303 Uninitialized scalar field
   {
     m_tombstoneList = std::make_shared<TombstoneList>(this);
@@ -236,7 +236,7 @@ class CPPCACHE_EXPORT MapSegment {
   GfErrType put(const CacheableKeyPtr& key, const CacheablePtr& newValue,
                 MapEntryImplPtr& me, CacheablePtr& oldValue, int updateCount,
                 int destroyTracker, bool& isUpdate, VersionTagPtr versionTag,
-                DataInput* delta = NULL);
+                DataInput* delta = nullptr);
 
   GfErrType invalidate(const CacheableKeyPtr& key, MapEntryImplPtr& me,
                        CacheablePtr& oldValue, VersionTagPtr versionTag,

http://git-wip-us.apache.org/repos/asf/geode-native/blob/11467dd9/src/cppcache/src/MapWithLock.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/MapWithLock.hpp b/src/cppcache/src/MapWithLock.hpp
index d8e4500..ad31f44 100644
--- a/src/cppcache/src/MapWithLock.hpp
+++ b/src/cppcache/src/MapWithLock.hpp
@@ -31,36 +31,12 @@
 #include <unordered_map>
 #include <string>
 
-namespace std {
-/** @brief Template specialization of hash<T> for CacheableKeyPtr
- * to enable using CacheableKeyPtr's in std::unordered_map/hash_map.
- */
-template <>
-struct hash<apache::geode::client::CacheableKeyPtr> {
-  size_t operator()(const apache::geode::client::CacheableKeyPtr& key) const {
-    return key->hashcode();
-  }
-};
-
-/** @brief Template specialization of equal_to<T> for CacheableKeyPtr
- * to enable using CacheableKeyPtr's in std::unordered_map/hash_map.
- */
-template <>
-struct equal_to<apache::geode::client::CacheableKeyPtr> {
-  size_t operator()(const apache::geode::client::CacheableKeyPtr& key1,
-                    const apache::geode::client::CacheableKeyPtr& key2) const {
-    return (*key1.get() == *key2.get());
-  }
-};
-}  // namespace std
-
-typedef std::unordered_map<apache::geode::client::CacheableKeyPtr, int>
-    MapOfUpdateCounters;
-
 namespace apache {
 namespace geode {
 namespace client {
 
+typedef std::unordered_map<CacheableKeyPtr, int, CacheableKey::hash, CacheableKey::equal_to> MapOfUpdateCounters;
+
 class Region;
 typedef SharedPtr<Region> RegionPtr;
 

http://git-wip-us.apache.org/repos/asf/geode-native/blob/11467dd9/src/cppcache/src/PdxFieldType.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/PdxFieldType.cpp b/src/cppcache/src/PdxFieldType.cpp
index 5652d64..09225d4 100644
--- a/src/cppcache/src/PdxFieldType.cpp
+++ b/src/cppcache/src/PdxFieldType.cpp
@@ -34,8 +34,8 @@ namespace geode {
 namespace client {
 
 PdxFieldType::PdxFieldType() : Serializable() {
-  // m_fieldName = NULL;
-  // m_className = NULL;
+  // m_fieldName = nullptr;
+  // m_className = nullptr;
   m_typeId = 0;
   m_sequenceId = 0;
   m_isVariableLengthType = false;
@@ -81,7 +81,7 @@ void PdxFieldType::toData(DataOutput& output) const {
 Serializable* PdxFieldType::fromData(DataInput& input) {
   int8_t typeId;
   input.read(&typeId);
-  char* fname = NULL;
+  char* fname = nullptr;
   input.readUTF(&fname);
   m_fieldName = fname;
   input.freeUTFMemory(fname);  // freeing fname
@@ -106,7 +106,7 @@ bool PdxFieldType::equals(PdxFieldTypePtr otherObj) {
 
   PdxFieldType* otherFieldType = dynamic_cast<PdxFieldType*>(otherObj.get());
 
-  if (otherFieldType == NULL) return false;
+  if (otherFieldType == nullptr) return false;
 
   if (otherFieldType == this) return true;
 

http://git-wip-us.apache.org/repos/asf/geode-native/blob/11467dd9/src/cppcache/src/PdxHelper.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/PdxHelper.cpp b/src/cppcache/src/PdxHelper.cpp
index 1055e5b..52fa6d9 100644
--- a/src/cppcache/src/PdxHelper.cpp
+++ b/src/cppcache/src/PdxHelper.cpp
@@ -66,11 +66,11 @@ void PdxHelper::serializePdx(DataOutput& output,
 
 void PdxHelper::serializePdx(DataOutput& output,
                              const PdxSerializablePtr& pdxObject) {
-  const char* pdxClassname = NULL;
+  const char* pdxClassname = nullptr;
 
   auto pdxII = std::dynamic_pointer_cast<PdxInstanceImpl>(pdxObject);
 
-  if (pdxII != NULL) {
+  if (pdxII != nullptr) {
     PdxTypePtr piPt = pdxII->getPdxType();
     if (piPt != nullptr &&
         piPt->getTypeId() ==
@@ -116,7 +116,7 @@ void PdxHelper::serializePdx(DataOutput& output,
 
     //[ToDo] need to write bytes for stats
     CacheImpl* cacheImpl = PdxHelper::getCacheImpl();
-    if (cacheImpl != NULL) {
+    if (cacheImpl != nullptr) {
       uint8_t* stPos = const_cast<uint8_t*>(output.getBuffer()) +
                        ptc->getStartPositionOffset();
       int pdxLen = PdxHelper::readInt32(stPos);
@@ -148,7 +148,7 @@ void PdxHelper::serializePdx(DataOutput& output,
 
     //[ToDo] need to write bytes for stats
     CacheImpl* cacheImpl = PdxHelper::getCacheImpl();
-    if (cacheImpl != NULL) {
+    if (cacheImpl != nullptr) {
       uint8_t* stPos = const_cast<uint8_t*>(output.getBuffer()) +
                        prw->getStartPositionOffset();
       int pdxLen = PdxHelper::readInt32(stPos);
@@ -161,7 +161,7 @@ void PdxHelper::serializePdx(DataOutput& output,
 PdxSerializablePtr PdxHelper::deserializePdx(DataInput& dataInput,
                                              bool forceDeserialize,
                                              int32_t typeId, int32_t length) {
-  char* pdxClassname = NULL;
+  char* pdxClassname = nullptr;
   PdxSerializablePtr pdxObjectptr = nullptr;
   PdxTypePtr pdxLocalType = nullptr;
 
@@ -297,7 +297,7 @@ PdxSerializablePtr PdxHelper::deserializePdx(DataInput& dataInput,
     dataInput.readInt(&typeId);
 
     CacheImpl* cacheImpl = PdxHelper::getCacheImpl();
-    if (cacheImpl != NULL) {
+    if (cacheImpl != nullptr) {
       cacheImpl->m_cacheStats->incPdxDeSerialization(len +
                                                      9);  // pdxLen + 1 + 2*4
     }
@@ -331,7 +331,7 @@ PdxSerializablePtr PdxHelper::deserializePdx(DataInput& dataInput,
     dataInput.advanceCursor(len);
 
     CacheImpl* cacheImpl = PdxHelper::getCacheImpl();
-    if (cacheImpl != NULL) {
+    if (cacheImpl != nullptr) {
       cacheImpl->m_cacheStats->incPdxInstanceCreations();
     }
     return pdxObject;

http://git-wip-us.apache.org/repos/asf/geode-native/blob/11467dd9/src/cppcache/src/PdxInstanceFactoryImpl.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/PdxInstanceFactoryImpl.cpp b/src/cppcache/src/PdxInstanceFactoryImpl.cpp
index 171b889..166f742 100644
--- a/src/cppcache/src/PdxInstanceFactoryImpl.cpp
+++ b/src/cppcache/src/PdxInstanceFactoryImpl.cpp
@@ -27,7 +27,7 @@ namespace client {
 PdxInstanceFactoryImpl::~PdxInstanceFactoryImpl() {}
 
 PdxInstanceFactoryImpl::PdxInstanceFactoryImpl(const char* className) {
-  if (className == NULL ||
+  if (className == nullptr ||
       *className == '\0') {  // COVERITY ---> 30289 Same on both sides
     throw IllegalStateException("className should not be null.");
   }
@@ -297,7 +297,7 @@ PdxInstanceFactoryPtr PdxInstanceFactoryImpl::writeStringArray(
   isFieldAdded(fieldName);
   m_pdxType->addVariableLengthTypeField(fieldName, "string[]",
                                         PdxFieldTypes::STRING_ARRAY);
-  CacheableStringPtr* ptrArr = NULL;
+  CacheableStringPtr* ptrArr = nullptr;
   if (length > 0) {
     ptrArr = new CacheableStringPtr[length];
     for (int32_t i = 0; i < length; i++) {
@@ -323,7 +323,7 @@ PdxInstanceFactoryPtr PdxInstanceFactoryImpl::writeWideStringArray(
   isFieldAdded(fieldName);
   m_pdxType->addVariableLengthTypeField(fieldName, "string[]",
                                         PdxFieldTypes::STRING_ARRAY);
-  CacheableStringPtr* ptrArr = NULL;
+  CacheableStringPtr* ptrArr = nullptr;
   if (length > 0) {
     ptrArr = new CacheableStringPtr[length];
     for (int32_t i = 0; i < length; i++) {
@@ -383,7 +383,7 @@ PdxInstanceFactoryPtr PdxInstanceFactoryImpl::markIdentityField(
 }
 
 void PdxInstanceFactoryImpl::isFieldAdded(const char* fieldName) {
-  if (fieldName == NULL ||
+  if (fieldName == nullptr ||
       /**fieldName == '\0' ||*/ m_FieldVsValues.find(fieldName) !=
           m_FieldVsValues.end()) {
     char excpStr[256] = {0};


Mime
View raw message