GEODE-5744: Use fixed width int types. (#359)

diff --git a/.clang-tidy b/.clang-tidy
index d60c8ca..3c40447 100644
--- a/.clang-tidy
+++ b/.clang-tidy
@@ -1,6 +1,6 @@
 ---
 Checks:          '-*,clang-diagnostic-*,clang-analyzer-*,-clang-analyzer-alpha*,google-*,-google-readability-todo,-google-runtime-references'
-WarningsAsErrors: 'google-build-using-namespace,google-readability-redundant-smartptr-get,google-explicit-constructor,google-global-names-in-headers'
+WarningsAsErrors: 'google-build-using-namespace,google-readability-redundant-smartptr-get,google-explicit-constructor,google-global-names-in-headers,google-runtime-int'
 HeaderFilterRegex: '.*'
 AnalyzeTemporaryDtors: false
 FormatStyle:     file
diff --git a/cppcache/include/geode/DataInput.hpp b/cppcache/include/geode/DataInput.hpp
index 25fa3ec..a3f5353 100644
--- a/cppcache/include/geode/DataInput.hpp
+++ b/cppcache/include/geode/DataInput.hpp
@@ -195,28 +195,14 @@
   inline int64_t readInt64() {
     _GEODE_CHECK_BUFFER_SIZE(8);
     int64_t tmp;
-    if (sizeof(long) == 8) {
-      tmp = *(m_buf++);
-      tmp = (tmp << 8) | *(m_buf++);
-      tmp = (tmp << 8) | *(m_buf++);
-      tmp = (tmp << 8) | *(m_buf++);
-      tmp = (tmp << 8) | *(m_buf++);
-      tmp = (tmp << 8) | *(m_buf++);
-      tmp = (tmp << 8) | *(m_buf++);
-      tmp = (tmp << 8) | *(m_buf++);
-    } else {
-      uint32_t hword = *(m_buf++);
-      hword = (hword << 8) | *(m_buf++);
-      hword = (hword << 8) | *(m_buf++);
-      hword = (hword << 8) | *(m_buf++);
-
-      tmp = hword;
-      hword = *(m_buf++);
-      hword = (hword << 8) | *(m_buf++);
-      hword = (hword << 8) | *(m_buf++);
-      hword = (hword << 8) | *(m_buf++);
-      tmp = (tmp << 32) | hword;
-    }
+    tmp = *(m_buf++);
+    tmp = (tmp << 8) | *(m_buf++);
+    tmp = (tmp << 8) | *(m_buf++);
+    tmp = (tmp << 8) | *(m_buf++);
+    tmp = (tmp << 8) | *(m_buf++);
+    tmp = (tmp << 8) | *(m_buf++);
+    tmp = (tmp << 8) | *(m_buf++);
+    tmp = (tmp << 8) | *(m_buf++);
     return tmp;
   }
 
diff --git a/cppcache/include/geode/DataOutput.hpp b/cppcache/include/geode/DataOutput.hpp
index 0c072e2..e7bba27 100644
--- a/cppcache/include/geode/DataOutput.hpp
+++ b/cppcache/include/geode/DataOutput.hpp
@@ -174,32 +174,14 @@
    */
   inline void writeInt(uint64_t value) {
     ensureCapacity(8);
-    // the defines are not reliable and can be changed by compiler options.
-    // Hence using sizeof() test instead.
-    //#if defined(_LP64) || ( defined(__WORDSIZE) && __WORDSIZE == 64 ) ||
-    //( defined(_INTEGRAL_MAX_BITS) && _INTEGRAL_MAX_BITS >= 64 )
-    if (sizeof(long) == 8) {
-      *(m_buf++) = static_cast<uint8_t>(value >> 56);
-      *(m_buf++) = static_cast<uint8_t>(value >> 48);
-      *(m_buf++) = static_cast<uint8_t>(value >> 40);
-      *(m_buf++) = static_cast<uint8_t>(value >> 32);
-      *(m_buf++) = static_cast<uint8_t>(value >> 24);
-      *(m_buf++) = static_cast<uint8_t>(value >> 16);
-      *(m_buf++) = static_cast<uint8_t>(value >> 8);
-      *(m_buf++) = static_cast<uint8_t>(value);
-    } else {
-      uint32_t hword = static_cast<uint32_t>(value >> 32);
-      *(m_buf++) = static_cast<uint8_t>(hword >> 24);
-      *(m_buf++) = static_cast<uint8_t>(hword >> 16);
-      *(m_buf++) = static_cast<uint8_t>(hword >> 8);
-      *(m_buf++) = static_cast<uint8_t>(hword);
-
-      hword = static_cast<uint32_t>(value);
-      *(m_buf++) = static_cast<uint8_t>(hword >> 24);
-      *(m_buf++) = static_cast<uint8_t>(hword >> 16);
-      *(m_buf++) = static_cast<uint8_t>(hword >> 8);
-      *(m_buf++) = static_cast<uint8_t>(hword);
-    }
+    *(m_buf++) = static_cast<uint8_t>(value >> 56);
+    *(m_buf++) = static_cast<uint8_t>(value >> 48);
+    *(m_buf++) = static_cast<uint8_t>(value >> 40);
+    *(m_buf++) = static_cast<uint8_t>(value >> 32);
+    *(m_buf++) = static_cast<uint8_t>(value >> 24);
+    *(m_buf++) = static_cast<uint8_t>(value >> 16);
+    *(m_buf++) = static_cast<uint8_t>(value >> 8);
+    *(m_buf++) = static_cast<uint8_t>(value);
   }
 
   /**
@@ -415,8 +397,7 @@
 
   inline uint8_t* getBufferCopy() {
     size_t size = m_buf - m_bytes.get();
-    uint8_t* result;
-    result = (uint8_t*)std::malloc(size * sizeof(uint8_t));
+    auto result = static_cast<uint8_t*>(std::malloc(size * sizeof(uint8_t)));
     if (result == nullptr) {
       throw OutOfMemoryException("Out of Memory while resizing buffer");
     }
diff --git a/cppcache/integration-test-2/DataSerializableTest.cpp b/cppcache/integration-test-2/DataSerializableTest.cpp
index a2deae4..5593018 100644
--- a/cppcache/integration-test-2/DataSerializableTest.cpp
+++ b/cppcache/integration-test-2/DataSerializableTest.cpp
@@ -30,7 +30,12 @@
 
 namespace {
 
-using namespace apache::geode::client;
+using apache::geode::client::CacheableString;
+using apache::geode::client::CacheableStringArray;
+using apache::geode::client::DataInput;
+using apache::geode::client::DataOutput;
+using apache::geode::client::DataSerializable;
+using apache::geode::client::RegionShortcut;
 
 class Simple : public DataSerializable {
  public:
@@ -143,14 +148,15 @@
 
   ASSERT_NE(nullptr, returnedObject);
   EXPECT_EQ(dsObject->getName(), returnedObject->getName());
-  EXPECT_EQ(dsObject->getSimple()->getName(), returnedObject->getSimple()->getName());
-  EXPECT_EQ(dsObject->getSimple()->getAge(), returnedObject->getSimple()->getAge());
+  EXPECT_EQ(dsObject->getSimple()->getName(),
+            returnedObject->getSimple()->getName());
+  EXPECT_EQ(dsObject->getSimple()->getAge(),
+            returnedObject->getSimple()->getAge());
   auto originalArray = dsObject->getCSArray();
   auto returnedArray = returnedObject->getCSArray();
-  for(uint32_t index = 0; index < 4; ++index)
-  {
-      EXPECT_EQ(originalArray->operator[](index)->toString(), returnedArray->operator[](index)->toString());
+  for (uint32_t index = 0; index < 4; ++index) {
+    EXPECT_EQ(originalArray->operator[](index)->toString(),
+              returnedArray->operator[](index)->toString());
   }
-   
 }
 }  // namespace
diff --git a/cppcache/integration-test-2/RegisterKeysTest.cpp b/cppcache/integration-test-2/RegisterKeysTest.cpp
index 1dc3333..cd49f4f 100644
--- a/cppcache/integration-test-2/RegisterKeysTest.cpp
+++ b/cppcache/integration-test-2/RegisterKeysTest.cpp
@@ -30,9 +30,16 @@
 
 namespace {
 
-using namespace apache::geode::client;
+using apache::geode::client::Cache;
+using apache::geode::client::CacheableInt16;
+using apache::geode::client::CacheableKey;
+using apache::geode::client::CacheableString;
+using apache::geode::client::CacheFactory;
+using apache::geode::client::IllegalStateException;
+using apache::geode::client::Region;
+using apache::geode::client::RegionShortcut;
 
-apache::geode::client::Cache createTestCache() {
+Cache createTestCache() {
   CacheFactory cacheFactory;
   return cacheFactory.set("log-level", "none")
       .set("statistic-sampling-enabled", "false")
diff --git a/cppcache/integration-test/CacheHelper.cpp b/cppcache/integration-test/CacheHelper.cpp
index c52787d..fa71c78 100644
--- a/cppcache/integration-test/CacheHelper.cpp
+++ b/cppcache/integration-test/CacheHelper.cpp
@@ -688,8 +688,7 @@
     sqLiteProps->insert("PageSize", "65536");
     sqLiteProps->insert("MaxPageCount", "1073741823");
     std::string sqlite_dir =
-        "SqLiteRegionData" +
-        std::to_string(static_cast<long long int>(ACE_OS::getpid()));
+        "SqLiteRegionData" + std::to_string(ACE_OS::getpid());
     sqLiteProps->insert("PersistenceDirectory", sqlite_dir.c_str());
     regionAttributeFactory.setPersistenceManager(
         "SqLiteImpl", "createSqLiteInstance", sqLiteProps);
@@ -746,8 +745,7 @@
     sqLiteProps->insert("PageSize", "65536");
     sqLiteProps->insert("MaxPageCount", "1073741823");
     std::string sqlite_dir =
-        "SqLiteRegionData" +
-        std::to_string(static_cast<long long int>(ACE_OS::getpid()));
+        "SqLiteRegionData" + std::to_string(ACE_OS::getpid());
     sqLiteProps->insert("PersistenceDirectory", sqlite_dir.c_str());
     regionFactory.setPersistenceManager("SqLiteImpl", "createSqLiteInstance",
                                         sqLiteProps);
@@ -1286,10 +1284,10 @@
   if (!enableDelta) {
     deltaProperty = "delta-propagation=false";
   }
-  long defaultTombstone_timeout = 600000;
-  long defaultTombstone_gc_threshold = 100000;
-  long userTombstone_timeout = 1000;
-  long userTombstone_gc_threshold = 10;
+  int64_t defaultTombstone_timeout = 600000;
+  int64_t defaultTombstone_gc_threshold = 100000;
+  int64_t userTombstone_timeout = 1000;
+  int64_t userTombstone_gc_threshold = 10;
   if (testServerGC) {
     ACE_OS::mkdir("backupDirectory1");
     ACE_OS::mkdir("backupDirectory2");
@@ -1306,8 +1304,10 @@
         "%s/bin/%s start server --classpath=%s --name=%s "
         "--cache-xml-file=%s %s --dir=%s --server-port=%d --log-level=%s "
         "--properties-file=%s %s %s "
-        "--J=-Dgemfire.tombstone-timeout=%ld "
-        "--J=-Dgemfire.tombstone-gc-hreshold=%ld "
+        "--J=-Dgemfire.tombstone-timeout=%" PRId64
+        " "
+        "--J=-Dgemfire.tombstone-gc-hreshold=%" PRId64
+        " "
         "--J=-Dgemfire.security-log-level=%s --J=-Xmx1024m --J=-Xms128m 2>&1",
         gfjavaenv, GFSH, classpath, sname.c_str(), xmlFile.c_str(),
         useSecurityManager ? "--user=root --password=root-password" : "",
@@ -1322,8 +1322,10 @@
         cmd,
         "%s/bin/%s start server --classpath=%s --name=%s "
         "--cache-xml-file=%s %s --dir=%s --server-port=%d --log-level=%s %s %s "
-        "--J=-Dgemfire.tombstone-timeout=%ld "
-        "--J=-Dgemfire.tombstone-gc-hreshold=%ld "
+        "--J=-Dgemfire.tombstone-timeout=%" PRId64
+        " "
+        "--J=-Dgemfire.tombstone-gc-hreshold=%" PRId64
+        " "
         "--J=-Dgemfire.security-log-level=%s --J=-Xmx1024m --J=-Xms128m 2>&1",
         gfjavaenv, GFSH, classpath, sname.c_str(), xmlFile.c_str(),
         useSecurityManager ? "--user=root --password=root-password" : "",
@@ -1736,7 +1738,7 @@
   tmpSecProp->remove("security-password");
 }
 
-void CacheHelper::setJavaConnectionPoolSize(long size) {
+void CacheHelper::setJavaConnectionPoolSize(uint32_t size) {
   CacheHelper::getHelper()
       .getCache()
       ->getSystemProperties()
diff --git a/cppcache/integration-test/CacheHelper.hpp b/cppcache/integration-test/CacheHelper.hpp
index c91212e..8bbaac4 100644
--- a/cppcache/integration-test/CacheHelper.hpp
+++ b/cppcache/integration-test/CacheHelper.hpp
@@ -353,7 +353,7 @@
 
   static void clearSecProp();
 
-  static void setJavaConnectionPoolSize(long size);
+  static void setJavaConnectionPoolSize(uint32_t size);
 
   static bool isSeedSet;
   static bool setSeed();
diff --git a/cppcache/integration-test/LibraryCallbacks.cpp b/cppcache/integration-test/LibraryCallbacks.cpp
index baa595b..705ff91 100644
--- a/cppcache/integration-test/LibraryCallbacks.cpp
+++ b/cppcache/integration-test/LibraryCallbacks.cpp
@@ -15,22 +15,20 @@
  * limitations under the License.
  */
 
+#include <thread>
+
 #include <geode/internal/geode_globals.hpp>
 
 #include <ace/Time_Value.h>
 #include <ace/OS.h>
 
 namespace test {
+
 void dummyFunc() {}
 
-void millisleep(uint32_t x) {
-  ACE_Time_Value timeV(0);
-  timeV.msec(static_cast<long>(x));
-  ACE_OS::sleep(timeV);
-}
 }  // namespace test
 
-#define SLEEP(x) test::millisleep(x);
+#define SLEEP(x) std::this_thread::sleep_for(std::chrono::milliseconds(x))
 #define LOG LOGDEBUG
 
 #include "TallyListener.hpp"
diff --git a/cppcache/integration-test/ThinClientHelper.hpp b/cppcache/integration-test/ThinClientHelper.hpp
index c8e4484..39ac430 100644
--- a/cppcache/integration-test/ThinClientHelper.hpp
+++ b/cppcache/integration-test/ThinClientHelper.hpp
@@ -403,8 +403,7 @@
   sqLiteProps->insert("PageSize", "65536");
   sqLiteProps->insert("MaxPageCount", "1073741823");
   std::string sqlite_dir =
-      "SqLiteRegionData" +
-      std::to_string(static_cast<long long int>(ACE_OS::getpid()));
+      "SqLiteRegionData" + std::to_string(ACE_OS::getpid());
   sqLiteProps->insert("PersistenceDirectory", sqlite_dir.c_str());
   regionAttributesFactory.setPersistenceManager(
       "SqLiteImpl", "createSqLiteInstance", sqLiteProps);
diff --git a/cppcache/integration-test/ThinClientSecurityHelper.hpp b/cppcache/integration-test/ThinClientSecurityHelper.hpp
index f82e95f..d6fe51f 100644
--- a/cppcache/integration-test/ThinClientSecurityHelper.hpp
+++ b/cppcache/integration-test/ThinClientSecurityHelper.hpp
@@ -213,8 +213,8 @@
 
   int svc(void) {
     int ops = 0;
-    int32_t pid = ACE_OS::getpid();
-    ACE_thread_t thr_id = ACE_OS::thr_self();
+    auto pid = ACE_OS::getpid();
+    auto thr_id = ACE_OS::thr_self();
     std::shared_ptr<CacheableKey> key;
     std::shared_ptr<CacheableString> value;
     std::vector<std::shared_ptr<CacheableKey>> keys0;
@@ -262,8 +262,8 @@
             m_reg->destroy(key);
           }
         } catch (Exception& ex) {
-          printf("%d: %ld exception got and exception message = %s\n", pid,
-                 (long)thr_id, ex.what());
+          printf("%d: %" PRIuPTR " exception got and exception message = %s\n",
+                 pid, (uintptr_t)thr_id, ex.what());
         }
       }
     }
diff --git a/cppcache/integration-test/fw_dunit.cpp b/cppcache/integration-test/fw_dunit.cpp
index d662fbc..ab6fa53 100644
--- a/cppcache/integration-test/fw_dunit.cpp
+++ b/cppcache/integration-test/fw_dunit.cpp
@@ -953,7 +953,7 @@
 
 void TimeStamp::msec(int64_t t) { m_msec = t; }
 
-Record::Record(std::string testName, const long ops, const TimeStamp& start,
+Record::Record(std::string testName, int64_t ops, const TimeStamp& start,
                const TimeStamp& stop)
     : m_testName(testName),
       m_operations(ops),
@@ -1017,7 +1017,7 @@
 
 PerfSuite::PerfSuite(const char* suiteName) : m_suiteName(suiteName) {}
 
-void PerfSuite::addRecord(std::string testName, const long ops,
+void PerfSuite::addRecord(std::string testName, int64_t ops,
                           const TimeStamp& start, const TimeStamp& stop) {
   Record tmp(testName, ops, start, stop);
   m_records[testName] = tmp;
diff --git a/cppcache/integration-test/fw_perf.hpp b/cppcache/integration-test/fw_perf.hpp
index 558457f..af019e6 100644
--- a/cppcache/integration-test/fw_perf.hpp
+++ b/cppcache/integration-test/fw_perf.hpp
@@ -105,7 +105,7 @@
   TimeStamp m_stopTime;
 
  public:
-  Record(std::string testName, const long ops, const TimeStamp& start,
+  Record(std::string testName, int64_t ops, const TimeStamp& start,
          const TimeStamp& stop);
 
   Record();
@@ -135,7 +135,7 @@
  public:
   explicit PerfSuite(const char* suiteName);
 
-  void addRecord(std::string testName, const long ops, const TimeStamp& start,
+  void addRecord(std::string testName, int64_t ops, const TimeStamp& start,
                  const TimeStamp& stop);
 
   /** create a file in cwd, named "<suite>_results.<host>" */
diff --git a/cppcache/src/CachePerfStats.hpp b/cppcache/src/CachePerfStats.hpp
index 31fd92e..b0b6959 100644
--- a/cppcache/src/CachePerfStats.hpp
+++ b/cppcache/src/CachePerfStats.hpp
@@ -249,7 +249,7 @@
     m_cachePerfStats->incInt(m_deltaFailedOnReceive, 1);
   }
 
-  inline void incTimeSpentOnDeltaApplication(long time) {
+  inline void incTimeSpentOnDeltaApplication(int32_t time) {
     m_cachePerfStats->incInt(m_processedDeltaMessagesTime, time);
   }
 
diff --git a/cppcache/src/CacheTransactionManagerImpl.cpp b/cppcache/src/CacheTransactionManagerImpl.cpp
index c50d05f..e2f53c0 100644
--- a/cppcache/src/CacheTransactionManagerImpl.cpp
+++ b/cppcache/src/CacheTransactionManagerImpl.cpp
@@ -357,7 +357,7 @@
                                 .suspendedTxTimeout();
   auto handler =
       new SuspendedTxExpiryHandler(this, txState->getTransactionId());
-  long id = m_cache->getExpiryTaskManager().scheduleExpiryTask(
+  auto id = m_cache->getExpiryTaskManager().scheduleExpiryTask(
       handler, suspendedTxTimeout, std::chrono::seconds::zero(), false);
   txState->setSuspendedExpiryTaskId(id);
 
diff --git a/cppcache/src/ClientProxyMembershipID.cpp b/cppcache/src/ClientProxyMembershipID.cpp
index 3703c9e..f5a10dd 100644
--- a/cppcache/src/ClientProxyMembershipID.cpp
+++ b/cppcache/src/ClientProxyMembershipID.cpp
@@ -45,8 +45,7 @@
   RandomInitializer() {
     // using current time and
     // processor time would be good enough for our purpose
-    unsigned long seed =
-        ACE_OS::getpid() + ACE_OS::gettimeofday().msec() + clock();
+    auto seed = ACE_OS::getpid() + ACE_OS::gettimeofday().msec() + clock();
     seed += ACE_OS::gettimeofday().usec();
     // LOGINFO("PID %ld seed %ld ACE_OS::gettimeofday().usec() = %ld clock =
     // %ld ACE_OS::gettimeofday().msec() = %ld", pid, seed ,
diff --git a/cppcache/src/ExpiryTaskManager.cpp b/cppcache/src/ExpiryTaskManager.cpp
index 7a1485b..336abd9 100644
--- a/cppcache/src/ExpiryTaskManager.cpp
+++ b/cppcache/src/ExpiryTaskManager.cpp
@@ -50,9 +50,9 @@
 #endif
 }
 
-long ExpiryTaskManager::scheduleExpiryTask(ACE_Event_Handler* handler,
-                                           uint32_t expTime, uint32_t interval,
-                                           bool cancelExistingTask) {
+ExpiryTaskManager::id_type ExpiryTaskManager::scheduleExpiryTask(
+    ACE_Event_Handler* handler, uint32_t expTime, uint32_t interval,
+    bool cancelExistingTask) {
   LOGFINER("ExpiryTaskManager: expTime %d, interval %d, cancelExistingTask %d",
            expTime, interval, cancelExistingTask);
   if (cancelExistingTask) {
@@ -65,10 +65,9 @@
                                    intervalValue);
 }
 
-long ExpiryTaskManager::scheduleExpiryTask(ACE_Event_Handler* handler,
-                                           ACE_Time_Value expTimeValue,
-                                           ACE_Time_Value intervalVal,
-                                           bool cancelExistingTask) {
+ExpiryTaskManager::id_type ExpiryTaskManager::scheduleExpiryTask(
+    ACE_Event_Handler* handler, ACE_Time_Value expTimeValue,
+    ACE_Time_Value intervalVal, bool cancelExistingTask) {
   if (cancelExistingTask) {
     m_reactor->cancel_timer(handler, 1);
   }
diff --git a/cppcache/src/ExpiryTaskManager.hpp b/cppcache/src/ExpiryTaskManager.hpp
index 468f878..3f92867 100644
--- a/cppcache/src/ExpiryTaskManager.hpp
+++ b/cppcache/src/ExpiryTaskManager.hpp
@@ -21,6 +21,7 @@
 #define GEODE_EXPIRYTASKMANAGER_H_
 
 #include <chrono>
+#include <type_traits>
 
 #include <ace/Reactor.h>
 #include <ace/Task.h>
@@ -50,7 +51,9 @@
  */
 class APACHE_GEODE_EXPORT ExpiryTaskManager : public ACE_Task_Base {
  public:
-  typedef long id_type;
+  typedef decltype(std::declval<ACE_Reactor>().schedule_timer(
+      nullptr, nullptr, std::declval<ACE_Time_Value>())) id_type;
+
   /**
    * This class allows resetting of the timer to take immediate effect when
    * done from inside ACE_Event_Handler::handle_timeout(). With the default
@@ -233,20 +236,20 @@
   /**
    * For scheduling a task for expiration.
    */
-  long scheduleExpiryTask(ACE_Event_Handler* handler, uint32_t expTime,
-                          uint32_t interval = 0,
-                          bool cancelExistingTask = false);
+  ExpiryTaskManager::id_type scheduleExpiryTask(
+      ACE_Event_Handler* handler, uint32_t expTime, uint32_t interval = 0,
+      bool cancelExistingTask = false);
 
-  long scheduleExpiryTask(ACE_Event_Handler* handler,
-                          ACE_Time_Value expTimeValue,
-                          ACE_Time_Value intervalVal,
-                          bool cancelExistingTask = false);
+  ExpiryTaskManager::id_type scheduleExpiryTask(
+      ACE_Event_Handler* handler, ACE_Time_Value expTimeValue,
+      ACE_Time_Value intervalVal, bool cancelExistingTask = false);
 
   template <class ExpRep, class ExpPeriod, class IntRep, class IntPeriod>
-  long scheduleExpiryTask(ACE_Event_Handler* handler,
-                          std::chrono::duration<ExpRep, ExpPeriod> expTime,
-                          std::chrono::duration<IntRep, IntPeriod> interval,
-                          bool cancelExistingTask = false) {
+  ExpiryTaskManager::id_type scheduleExpiryTask(
+      ACE_Event_Handler* handler,
+      std::chrono::duration<ExpRep, ExpPeriod> expTime,
+      std::chrono::duration<IntRep, IntPeriod> interval,
+      bool cancelExistingTask = false) {
     LOGFINER(
         "ExpiryTaskManager: expTime %s, interval %s, cancelExistingTask %d",
         to_string(expTime).c_str(), to_string(interval).c_str(),
@@ -258,7 +261,8 @@
     ACE_Time_Value expTimeValue(expTime);
     ACE_Time_Value intervalValue(interval);
     LOGFINER("Scheduled expiration ... in %d seconds.", expTime.count());
-    return m_reactor->schedule_timer(handler, nullptr, expTimeValue, intervalValue);
+    return m_reactor->schedule_timer(handler, nullptr, expTimeValue,
+                                     intervalValue);
   }
 
   /**
diff --git a/cppcache/src/IntQueue.hpp b/cppcache/src/IntQueue.hpp
index 58ffe88..d9b68a2 100644
--- a/cppcache/src/IntQueue.hpp
+++ b/cppcache/src/IntQueue.hpp
@@ -46,7 +46,7 @@
   }
 
   /** wait usec time until notified */
-  T get(long usec) {
+  T get(int64_t usec) {
     ACE_Time_Value interval(usec / 1000000, usec % 1000000);
     return getUntil(interval);
   }
diff --git a/cppcache/src/Log.cpp b/cppcache/src/Log.cpp
index 4f10e5a..1e000ac 100644
--- a/cppcache/src/Log.cpp
+++ b/cppcache/src/Log.cpp
@@ -560,12 +560,12 @@
   char* pbuf = buf;
   pbuf += ACE_OS::snprintf(pbuf, 15, "[%s ", Log::levelToChars(level));
   pbuf += ACE_OS::strftime(pbuf, MINBUFSIZE, "%Y/%m/%d %H:%M:%S", tm_val);
-  pbuf +=
-      ACE_OS::snprintf(pbuf, 15, ".%06ld ", static_cast<long>(clock.usec()));
+  pbuf += ACE_OS::snprintf(pbuf, 15, ".%06" PRIu64 " ",
+                           static_cast<int64_t>(clock.usec()));
   pbuf += ACE_OS::strftime(pbuf, MINBUFSIZE, "%Z ", tm_val);
 
-  ACE_OS::snprintf(pbuf, 300, "%s:%d %lu] ", g_uname.nodename, g_pid,
-                   (unsigned long)ACE_OS::thr_self());
+  ACE_OS::snprintf(pbuf, 300, "%s:%d %" PRIu64 "] ", g_uname.nodename, g_pid,
+                   (uint64_t)ACE_OS::thr_self());
 
   return buf;
 }
diff --git a/cppcache/src/MapEntry.hpp b/cppcache/src/MapEntry.hpp
index c37fb12..758d8e1 100644
--- a/cppcache/src/MapEntry.hpp
+++ b/cppcache/src/MapEntry.hpp
@@ -86,9 +86,13 @@
     m_lastModifiedTime = currTime.time_since_epoch().count();
   }
 
-  inline void setExpiryTaskId(long id) { m_expiryTaskId = id; }
+  inline void setExpiryTaskId(ExpiryTaskManager::id_type id) {
+    m_expiryTaskId = id;
+  }
 
-  inline long getExpiryTaskId() const { return m_expiryTaskId; }
+  inline ExpiryTaskManager::id_type getExpiryTaskId() const {
+    return m_expiryTaskId;
+  }
 
   inline void cancelExpiryTaskId(
       const std::shared_ptr<CacheableKey>& key) const {
@@ -108,7 +112,7 @@
   /** last modified time in secs, 32bit.. */
   std::atomic<time_point::duration::rep> m_lastModifiedTime;
   /** The expiry task id for this particular entry.. **/
-  long m_expiryTaskId;
+  ExpiryTaskManager::id_type m_expiryTaskId;
   ExpiryTaskManager* m_expiryTaskManager;
 };
 
diff --git a/cppcache/src/PdxRemotePreservedData.hpp b/cppcache/src/PdxRemotePreservedData.hpp
index e0f0153..10d29cf 100644
--- a/cppcache/src/PdxRemotePreservedData.hpp
+++ b/cppcache/src/PdxRemotePreservedData.hpp
@@ -20,9 +20,13 @@
  * limitations under the License.
  */
 
-#include <geode/PdxUnreadFields.hpp>
 #include <vector>
 
+#include <geode/Serializable.hpp>
+#include <geode/PdxUnreadFields.hpp>
+
+#include "ExpiryTaskManager.hpp"
+
 namespace apache {
 namespace geode {
 namespace client {
@@ -35,7 +39,7 @@
   int32_t m_mergedTypeId;
   int32_t m_currentIndex;
   std::shared_ptr<Serializable> /*Object^*/ m_owner;
-  long m_expiryTakId;
+  ExpiryTaskManager::id_type m_expiryTakId;
 
  public:
   PdxRemotePreservedData()
@@ -73,11 +77,13 @@
 
   inline int32_t getMergedTypeId() { return m_mergedTypeId; }
 
-  inline void setPreservedDataExpiryTaskId(long expId) {
+  inline void setPreservedDataExpiryTaskId(ExpiryTaskManager::id_type expId) {
     m_expiryTakId = expId;
   }
 
-  inline long getPreservedDataExpiryTaskId() { return m_expiryTakId; }
+  inline ExpiryTaskManager::id_type getPreservedDataExpiryTaskId() {
+    return m_expiryTakId;
+  }
 
   std::shared_ptr<Serializable> getOwner() { return m_owner; }
 
diff --git a/cppcache/src/PdxTypeRegistry.cpp b/cppcache/src/PdxTypeRegistry.cpp
index e71f525..40c5e91 100644
--- a/cppcache/src/PdxTypeRegistry.cpp
+++ b/cppcache/src/PdxTypeRegistry.cpp
@@ -181,7 +181,7 @@
   } else {
     // schedule new expiry task
     auto handler = new PreservedDataExpiryHandler(shared_from_this(), obj);
-    long id = expiryTaskManager.scheduleExpiryTask(handler, 20, 0, false);
+    auto id = expiryTaskManager.scheduleExpiryTask(handler, 20, 0, false);
     pData->setPreservedDataExpiryTaskId(id);
     LOGDEBUG(
         "PdxTypeRegistry::setPreserveData Schedule new expirt task with id=%ld",
diff --git a/cppcache/src/RegionConfig.cpp b/cppcache/src/RegionConfig.cpp
index 482b9e1..6c32abf 100644
--- a/cppcache/src/RegionConfig.cpp
+++ b/cppcache/src/RegionConfig.cpp
@@ -44,26 +44,25 @@
 }
 
 void RegionConfig::setCaching(const std::string& str) { m_caching = str; }
-unsigned long RegionConfig::entries() { return atol(m_capacity.c_str()); }
-unsigned long RegionConfig::getLruEntriesLimit() {
-  return atol(m_lruEntriesLimit.c_str());
+uint64_t RegionConfig::entries() { return std::stoull(m_capacity); }
+uint64_t RegionConfig::getLruEntriesLimit() {
+  return std::stoull(m_lruEntriesLimit);
 }
 
 uint8_t RegionConfig::getConcurrency() {
-  uint8_t cl = static_cast<uint8_t>(atoi(m_concurrency.c_str()));
+  uint8_t cl = static_cast<uint8_t>(std::stoi(m_concurrency));
   if (cl == 0) return 16;
   return cl;
 }
 
 bool RegionConfig::getCaching() {
-  if (strcmp("true", m_caching.c_str()) == 0) {
-    return true;
-  } else if (strcmp("false", m_caching.c_str()) == 0) {
+  if ("false" == m_caching) {
     return false;
   } else {
     return true;
   }
 }
+
 }  // namespace client
 }  // namespace geode
 }  // namespace apache
diff --git a/cppcache/src/RegionConfig.hpp b/cppcache/src/RegionConfig.hpp
index ce568d6..26511ca 100644
--- a/cppcache/src/RegionConfig.hpp
+++ b/cppcache/src/RegionConfig.hpp
@@ -43,12 +43,12 @@
  public:
   explicit RegionConfig(const std::string& capacity);
 
-  unsigned long entries();
+  uint64_t entries();
   void setConcurrency(const std::string& str);
   void setLru(const std::string& str);
   void setCaching(const std::string& str);
   uint8_t getConcurrency();
-  unsigned long getLruEntriesLimit();
+  uint64_t getLruEntriesLimit();
   bool getCaching();
 
  private:
diff --git a/cppcache/src/RegionExpiryHandler.hpp b/cppcache/src/RegionExpiryHandler.hpp
index b9182b7..56bc418 100644
--- a/cppcache/src/RegionExpiryHandler.hpp
+++ b/cppcache/src/RegionExpiryHandler.hpp
@@ -21,11 +21,14 @@
 #define GEODE_REGIONEXPIRYHANDLER_H_
 
 #include <ace/Time_Value_T.h>
+#include <ace/Event_Handler.h>
 
 #include <geode/internal/geode_globals.hpp>
 #include <geode/Region.hpp>
 #include <geode/ExpirationAction.hpp>
+
 #include "RegionInternal.hpp"
+#include "ExpiryTaskManager.hpp"
 
 namespace apache {
 namespace geode {
@@ -51,13 +54,15 @@
 
   int handle_close(ACE_HANDLE handle, ACE_Reactor_Mask close_mask) override;
 
-  void setExpiryTaskId(long expiryTaskId) { m_expiryTaskId = expiryTaskId; }
+  void setExpiryTaskId(ExpiryTaskManager::id_type expiryTaskId) {
+    m_expiryTaskId = expiryTaskId;
+  }
 
  private:
   std::shared_ptr<RegionInternal> m_regionPtr;
   ExpirationAction m_action;
   std::chrono::seconds m_duration;
-  long m_expiryTaskId;
+  ExpiryTaskManager::id_type m_expiryTaskId;
   // perform the actual expiration action
   void DoTheExpirationAction();
 };
diff --git a/cppcache/src/SerializationRegistry.hpp b/cppcache/src/SerializationRegistry.hpp
index 0a68bef..8dbb8d2 100644
--- a/cppcache/src/SerializationRegistry.hpp
+++ b/cppcache/src/SerializationRegistry.hpp
@@ -47,22 +47,20 @@
 #include "MemberListForVersionStamp.hpp"
 #include "config.h"
 
-#if defined(_MACOSX)
 namespace ACE_VERSIONED_NAMESPACE_NAME {
+
+#if defined(_MACOSX)
 // TODO CMake check type int64_t
 template <>
 class ACE_Export ACE_Hash<int64_t> {
  public:
-  inline unsigned long operator()(int64_t t) const {
-    return static_cast<long>(t);
+  inline unsigned long operator()(int64_t t) const {  // NOLINT
+    return static_cast<unsigned long>(t);             // NOLINT
   }
 };
 
-}  // namespace ACE_VERSIONED_NAMESPACE_NAME
 #endif
 
-ACE_BEGIN_VERSIONED_NAMESPACE_DECL
-
 using apache::geode::client::DSCode;
 template <>
 class ACE_Hash<DSCode> {
@@ -72,7 +70,7 @@
   }
 };
 
-ACE_END_VERSIONED_NAMESPACE_DECL
+}  // namespace ACE_VERSIONED_NAMESPACE_NAME
 
 namespace apache {
 namespace geode {
diff --git a/cppcache/src/TXState.hpp b/cppcache/src/TXState.hpp
index d9b7ce7..7916f57 100644
--- a/cppcache/src/TXState.hpp
+++ b/cppcache/src/TXState.hpp
@@ -1,8 +1,3 @@
-#pragma once
-
-#ifndef GEODE_TXSTATE_H_
-#define GEODE_TXSTATE_H_
-
 /*
  * Licensed to the Apache Software Foundation (ASF) under one or more
  * contributor license agreements.  See the NOTICE file distributed with
@@ -19,21 +14,23 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-/*
- * TXState.hpp
- *
- *  Created on: 09-Feb-2011
- *      Author: ankurs
- */
+
+#pragma once
+
+#ifndef GEODE_TXSTATE_H_
+#define GEODE_TXSTATE_H_
+
+#include <string>
+#include <vector>
 
 #include "TXId.hpp"
 #include "TransactionalOperation.hpp"
-#include <string>
-#include <vector>
+#include "ExpiryTaskManager.hpp"
 
 namespace apache {
 namespace geode {
 namespace client {
+
 class ThinClientPoolDM;
 class TXState {
  public:
@@ -56,10 +53,13 @@
 
   ThinClientPoolDM* getPoolDM() { return m_pooldm; }
   void setPoolDM(ThinClientPoolDM* dm) { m_pooldm = dm; }
-  void setSuspendedExpiryTaskId(long suspendedExpiryTaskId) {
+  void setSuspendedExpiryTaskId(
+      ExpiryTaskManager::id_type suspendedExpiryTaskId) {
     m_suspendedExpiryTaskId = suspendedExpiryTaskId;
   }
-  long getSuspendedExpiryTaskId() { return m_suspendedExpiryTaskId; }
+  ExpiryTaskManager::id_type getSuspendedExpiryTaskId() {
+    return m_suspendedExpiryTaskId;
+  }
 
  private:
   void startReplay() { m_replay = true; };
@@ -84,7 +84,7 @@
   std::vector<std::shared_ptr<TransactionalOperation>> m_operations;
   CacheImpl* m_cache;
   ThinClientPoolDM* m_pooldm;
-  long m_suspendedExpiryTaskId;
+  ExpiryTaskManager::id_type m_suspendedExpiryTaskId;
   class ReplayControl {
    public:
     explicit ReplayControl(TXState* txState) : m_txState(txState) {
diff --git a/cppcache/src/TcrConnectionManager.cpp b/cppcache/src/TcrConnectionManager.cpp
index ce8ac91..2bd552e 100644
--- a/cppcache/src/TcrConnectionManager.cpp
+++ b/cppcache/src/TcrConnectionManager.cpp
@@ -69,7 +69,9 @@
   m_redundancyManager = new ThinClientRedundancyManager(this);
 }
 
-long TcrConnectionManager::getPingTaskId() { return m_pingTaskId; }
+ExpiryTaskManager::id_type TcrConnectionManager::getPingTaskId() {
+  return m_pingTaskId;
+}
 void TcrConnectionManager::init(bool isPool) {
   if (!m_initGuard) {
     m_initGuard = true;
diff --git a/cppcache/src/TcrConnectionManager.hpp b/cppcache/src/TcrConnectionManager.hpp
index 7bd9b76..7b97c30 100644
--- a/cppcache/src/TcrConnectionManager.hpp
+++ b/cppcache/src/TcrConnectionManager.hpp
@@ -20,19 +20,23 @@
  * limitations under the License.
  */
 
-#include <geode/internal/geode_globals.hpp>
-#include "Task.hpp"
 #include <string>
-#include <ace/Recursive_Thread_Mutex.h>
+#include <vector>
+#include <list>
+#include <unordered_map>
+
 #include <ace/Map_Manager.h>
 #include <ace/Semaphore.h>
-#include <vector>
-#include <unordered_map>
-#include <list>
-#include "ace/config-lite.h"
-#include "ace/Versioned_Namespace.h"
+#include <ace/config-lite.h>
+#include <ace/Versioned_Namespace.h>
+#include <ace/Recursive_Thread_Mutex.h>
+
+#include <geode/internal/geode_globals.hpp>
+
+#include "Task.hpp"
 #include "Queue.hpp"
 #include "ThinClientRedundancyManager.hpp"
+#include "ExpiryTaskManager.hpp"
 
 namespace ACE_VERSIONED_NAMESPACE_NAME {
 class ACE_Task_Base;
@@ -65,7 +69,7 @@
   int checkConnection(const ACE_Time_Value&, const void*);
   int checkRedundancy(const ACE_Time_Value&, const void*);
   int processEventIdMap(const ACE_Time_Value&, const void*);
-  long getPingTaskId();
+  ExpiryTaskManager::id_type getPingTaskId();
   void close();
 
   void readyForEvents();
@@ -164,8 +168,8 @@
   ACE_Semaphore m_cleanupSema;
   Task<TcrConnectionManager>* m_cleanupTask;
 
-  long m_pingTaskId;
-  long m_servermonitorTaskId;
+  ExpiryTaskManager::id_type m_pingTaskId;
+  ExpiryTaskManager::id_type m_servermonitorTaskId;
   Queue<Task<TcrEndpoint> > m_receiverReleaseList;
   Queue<TcrConnection> m_connectionReleaseList;
   Queue<ACE_Semaphore> m_notifyCleanupSemaList;
diff --git a/cppcache/src/ThinClientPoolDM.cpp b/cppcache/src/ThinClientPoolDM.cpp
index a316ee4..3bd298b 100644
--- a/cppcache/src/ThinClientPoolDM.cpp
+++ b/cppcache/src/ThinClientPoolDM.cpp
@@ -1358,7 +1358,7 @@
   if (m_attrs->getRetryAttempts() == -1) {
     retryAllEPsOnce = true;
   }
-  long retry = m_attrs->getRetryAttempts() + 1;
+  auto retry = m_attrs->getRetryAttempts() + 1;
   TcrConnection* conn = nullptr;
   std::set<ServerLocation> excludeServers;
   type = request.getMessageType();
@@ -2331,7 +2331,7 @@
   m_destroyPending = true;
 }
 void ThinClientPoolDM::updateNotificationStats(bool isDeltaSuccess,
-                                               long timeInNanoSecond) {
+                                               int64_t timeInNanoSecond) {
   if (isDeltaSuccess) {
     getStats().incProcessedDeltaMessages();
     getStats().incProcessedDeltaMessagesTime(timeInNanoSecond);
diff --git a/cppcache/src/ThinClientPoolDM.hpp b/cppcache/src/ThinClientPoolDM.hpp
index 40115ce..6cd9f20 100644
--- a/cppcache/src/ThinClientPoolDM.hpp
+++ b/cppcache/src/ThinClientPoolDM.hpp
@@ -158,7 +158,7 @@
 
   virtual bool canItBeDeletedNoImpl(TcrConnection* conn);
 
-  void updateNotificationStats(bool isDeltaSuccess, long timeInNanoSecond);
+  void updateNotificationStats(bool isDeltaSuccess, int64_t timeInNanoSecond);
 
   virtual bool isSecurityOn() { return m_isSecurityOn || m_isMultiUserMode; }
 
@@ -319,9 +319,9 @@
   Task<ThinClientPoolDM>* m_pingTask;
   Task<ThinClientPoolDM>* m_updateLocatorListTask;
   Task<ThinClientPoolDM>* m_cliCallbackTask;
-  long m_pingTaskId;
+  ExpiryTaskManager::id_type m_pingTaskId;
   ExpiryTaskManager::id_type m_updateLocatorListTaskId;
-  long m_connManageTaskId;
+  ExpiryTaskManager::id_type m_connManageTaskId;
   int manageConnections(volatile bool& isRunning);
   int doPing(const ACE_Time_Value&, const void*);
   int doUpdateLocatorList(const ACE_Time_Value&, const void*);
diff --git a/cppcache/src/ThinClientPoolHADM.hpp b/cppcache/src/ThinClientPoolHADM.hpp
index 4a369aa..a4a239a 100644
--- a/cppcache/src/ThinClientPoolHADM.hpp
+++ b/cppcache/src/ThinClientPoolHADM.hpp
@@ -120,7 +120,7 @@
   /*
   void stopNotificationThreads();
   */
-  long m_servermonitorTaskId;
+  ExpiryTaskManager::id_type m_servermonitorTaskId;
   int checkRedundancy(const ACE_Time_Value&, const void*);
 
   virtual TcrEndpoint* createEP(const char* endpointName) {
diff --git a/cppcache/src/ThinClientRedundancyManager.hpp b/cppcache/src/ThinClientRedundancyManager.hpp
index 43c5b03..09723df 100644
--- a/cppcache/src/ThinClientRedundancyManager.hpp
+++ b/cppcache/src/ThinClientRedundancyManager.hpp
@@ -28,6 +28,7 @@
 #include "TcrEndpoint.hpp"
 #include "ServerLocation.hpp"
 #include "EventIdMap.hpp"
+#include "ExpiryTaskManager.hpp"
 
 namespace apache {
 namespace geode {
@@ -123,8 +124,9 @@
   int processEventIdMap(const ACE_Time_Value&, const void*);
   Task<ThinClientRedundancyManager>* m_periodicAckTask;
   ACE_Semaphore m_periodicAckSema;
-  long m_processEventIdMapTaskId;  // periodic check eventid map for notify ack
-                                   // and/or expiry
+  ExpiryTaskManager::id_type
+      m_processEventIdMapTaskId;  // periodic check eventid map for notify ack
+                                  // and/or expiry
   int periodicAck(volatile bool& isRunning);
   void doPeriodicAck();
   ACE_Time_Value m_nextAck;     // next ack time
diff --git a/cppcache/src/TombstoneExpiryHandler.cpp b/cppcache/src/TombstoneExpiryHandler.cpp
index 00ea967..12af8b6 100644
--- a/cppcache/src/TombstoneExpiryHandler.cpp
+++ b/cppcache/src/TombstoneExpiryHandler.cpp
@@ -43,10 +43,10 @@
                                            const void*) {
   std::shared_ptr<CacheableKey> key;
   m_entryPtr->getEntry()->getKeyI(key);
-  int64_t creationTime = m_entryPtr->getTombstoneCreationTime();
-  int64_t curr_time = static_cast<int64_t>(current_time.get_msec());
-  int64_t expiryTaskId = m_entryPtr->getExpiryTaskId();
-  int64_t sec = curr_time - creationTime - m_duration.count();
+  auto creationTime = m_entryPtr->getTombstoneCreationTime();
+  auto curr_time = static_cast<int64_t>(current_time.get_msec());
+  auto expiryTaskId = m_entryPtr->getExpiryTaskId();
+  auto sec = curr_time - creationTime - m_duration.count();
   try {
     LOGDEBUG(
         "Entered entry expiry task handler for tombstone of key [%s]: "
@@ -63,8 +63,7 @@
           "[%s]",
           -sec / 1000 + 1, Utils::nullSafeToString(key).c_str());
       m_cacheImpl->getExpiryTaskManager().resetTask(
-          static_cast<long>(m_entryPtr->getExpiryTaskId()),
-          uint32_t(-sec / 1000 + 1));
+          m_entryPtr->getExpiryTaskId(), uint32_t(-sec / 1000 + 1));
       return 0;
     }
   } catch (...) {
@@ -74,8 +73,7 @@
            Utils::nullSafeToString(key).c_str());
   // we now delete the handler in GF_Timer_Heap_ImmediateReset_T
   // and always return success.
-  m_cacheImpl->getExpiryTaskManager().resetTask(static_cast<long>(expiryTaskId),
-                                                0);
+  m_cacheImpl->getExpiryTaskManager().resetTask(expiryTaskId, 0);
   return 0;
 }
 
diff --git a/cppcache/src/TombstoneList.cpp b/cppcache/src/TombstoneList.cpp
index aa1d1bc..3dd77f0 100644
--- a/cppcache/src/TombstoneList.cpp
+++ b/cppcache/src/TombstoneList.cpp
@@ -37,7 +37,8 @@
 #define SIZEOF_TOMBSTONEOVERHEAD \
   (SIZEOF_EXPIRYHANDLER + SIZEOF_TOMBSTONELISTENTRY)
 
-long TombstoneList::getExpiryTask(TombstoneExpiryHandler** handler) {
+ExpiryTaskManager::id_type TombstoneList::getExpiryTask(
+    TombstoneExpiryHandler** handler) {
   // This function is not guarded as all functions of this class are called from
   // MapSegment
   auto duration = m_cacheImpl->getDistributedSystem()
@@ -49,7 +50,7 @@
   *handler = new TombstoneExpiryHandler(tombstoneEntryPtr, this, duration,
                                         m_cacheImpl);
   tombstoneEntryPtr->setHandler(*handler);
-  long id = m_cacheImpl->getExpiryTaskManager().scheduleExpiryTask(
+  auto id = m_cacheImpl->getExpiryTaskManager().scheduleExpiryTask(
       *handler, duration, std::chrono::seconds::zero());
   return id;
 }
@@ -141,7 +142,7 @@
   if (exists(key)) {
     if (cancelTask) {
       m_cacheImpl->getExpiryTaskManager().cancelTask(
-          static_cast<long>(m_tombstoneMap[key]->getExpiryTaskId()));
+          m_tombstoneMap[key]->getExpiryTaskId());
       delete m_tombstoneMap[key]->getHandler();
     }
 
@@ -152,14 +153,15 @@
   }
 }
 
-long TombstoneList::eraseEntryFromTombstoneListWithoutCancelTask(
+ExpiryTaskManager::id_type
+TombstoneList::eraseEntryFromTombstoneListWithoutCancelTask(
     const std::shared_ptr<CacheableKey>& key,
     TombstoneExpiryHandler*& handler) {
   // This function is not guarded as all functions of this class are called from
   // MapSegment
-  long taskid = -1;
+  ExpiryTaskManager::id_type taskid = -1;
   if (exists(key)) {
-    taskid = static_cast<long>(m_tombstoneMap[key]->getExpiryTaskId());
+    taskid = m_tombstoneMap[key]->getExpiryTaskId();
     handler = m_tombstoneMap[key]->getHandler();
     m_cacheImpl->getCachePerfStats().decTombstoneCount();
     auto tombstonesize = key->objectSize() + SIZEOF_TOMBSTONEOVERHEAD;
diff --git a/cppcache/src/TombstoneList.hpp b/cppcache/src/TombstoneList.hpp
index 79bbe64..ef2cecc 100644
--- a/cppcache/src/TombstoneList.hpp
+++ b/cppcache/src/TombstoneList.hpp
@@ -68,7 +68,7 @@
       : m_mapSegment(mapSegment), m_cacheImpl(cacheImpl) {}
   virtual ~TombstoneList() { cleanUp(); }
   void add(const std::shared_ptr<MapEntryImpl>& entry,
-           TombstoneExpiryHandler* handler, long taskID);
+           TombstoneExpiryHandler* handler, ExpiryTaskManager::id_type taskID);
 
   // Reaps the tombstones which have been gc'ed on server.
   // A map that has identifier for ClientProxyMembershipID as key
@@ -78,11 +78,11 @@
   void reapTombstones(std::shared_ptr<CacheableHashSet> removedKeys);
   void eraseEntryFromTombstoneList(const std::shared_ptr<CacheableKey>& key,
                                    bool cancelTask = true);
-  long eraseEntryFromTombstoneListWithoutCancelTask(
+  ExpiryTaskManager::id_type eraseEntryFromTombstoneListWithoutCancelTask(
       const std::shared_ptr<CacheableKey>& key,
       TombstoneExpiryHandler*& handler);
   void cleanUp();
-  long getExpiryTask(TombstoneExpiryHandler** handler);
+  ExpiryTaskManager::id_type getExpiryTask(TombstoneExpiryHandler** handler);
   bool exists(const std::shared_ptr<CacheableKey>& key) const;
 
  private:
diff --git a/cryptoimpl/DHImpl.cpp b/cryptoimpl/DHImpl.cpp
index 25d7884..81425b7 100644
--- a/cryptoimpl/DHImpl.cpp
+++ b/cryptoimpl/DHImpl.cpp
@@ -637,7 +637,7 @@
 
 EVP_PKEY *DH_PUBKEY_get(DH_PUBKEY *key) {
   EVP_PKEY *ret = nullptr;
-  long j;
+  decltype(asn1_string_st::length) j;
   const unsigned char *p;
   const unsigned char *cp;
   X509_ALGOR *a;
diff --git a/dependencies/openssl/CMakeLists.txt b/dependencies/openssl/CMakeLists.txt
index 26414b0..d4dfb3c 100644
--- a/dependencies/openssl/CMakeLists.txt
+++ b/dependencies/openssl/CMakeLists.txt
@@ -102,7 +102,7 @@
 endif()
 
 add_library(ssl INTERFACE)
-target_include_directories(ssl INTERFACE
+target_include_directories(ssl SYSTEM INTERFACE
   $<BUILD_INTERFACE:${${PROJECT_NAME}_INSTALL_DIR}/include>
 )
 target_link_libraries(ssl INTERFACE
@@ -111,7 +111,7 @@
 add_dependencies(ssl ${${PROJECT_NAME}_EXTERN})
 
 add_library(crypto INTERFACE)
-target_include_directories(crypto INTERFACE
+target_include_directories(crypto SYSTEM INTERFACE
   $<BUILD_INTERFACE:${${PROJECT_NAME}_INSTALL_DIR}/include>
 )
 target_link_libraries(crypto INTERFACE
diff --git a/dependencies/sqlite/CMakeLists.txt b/dependencies/sqlite/CMakeLists.txt
index 9348732..71dc4da 100644
--- a/dependencies/sqlite/CMakeLists.txt
+++ b/dependencies/sqlite/CMakeLists.txt
@@ -50,7 +50,7 @@
 endif()
 
 add_library(${PROJECT_NAME} INTERFACE)
-target_include_directories(${PROJECT_NAME} INTERFACE
+target_include_directories(${PROJECT_NAME} SYSTEM INTERFACE
   $<BUILD_INTERFACE:${${PROJECT_NAME}_INSTALL_DIR}/include>
 )
 target_link_libraries(${PROJECT_NAME} INTERFACE
diff --git a/dependencies/xerces-c/CMakeLists.txt b/dependencies/xerces-c/CMakeLists.txt
index a0081e6..a5b2dce 100644
--- a/dependencies/xerces-c/CMakeLists.txt
+++ b/dependencies/xerces-c/CMakeLists.txt
@@ -79,7 +79,7 @@
   $<BUILD_INTERFACE:${${PROJECT_NAME}_INSTALL_DIR}/include>
 )
 target_link_libraries(${PROJECT_NAME} INTERFACE
-    ${${PROJECT_NAME}_INSTALL_DIR}/lib/${CMAKE_SHARED_LIBRARY_PREFIX}xerces-c${CMAKE_SHARED_LIBRARY_SUFFIX}
+  ${${PROJECT_NAME}_INSTALL_DIR}/lib/${CMAKE_SHARED_LIBRARY_PREFIX}xerces-c${CMAKE_SHARED_LIBRARY_SUFFIX}
 )
 add_dependencies(${PROJECT_NAME} ${${PROJECT_NAME}_EXTERN})
 
diff --git a/dhimpl/DHImpl.cpp b/dhimpl/DHImpl.cpp
index 2296659..25b7ba9 100644
--- a/dhimpl/DHImpl.cpp
+++ b/dhimpl/DHImpl.cpp
@@ -539,7 +539,7 @@
 
 EVP_PKEY *DH_PUBKEY_get(DH_PUBKEY *key) {
   EVP_PKEY *ret = nullptr;
-  long j;
+  decltype(asn1_string_st::length) j;
   const unsigned char *p;
   const unsigned char *cp;
   X509_ALGOR *a;
diff --git a/sqliteimpl/CMakeLists.txt b/sqliteimpl/CMakeLists.txt
index c3e6c2d..ea81bf2 100644
--- a/sqliteimpl/CMakeLists.txt
+++ b/sqliteimpl/CMakeLists.txt
@@ -32,7 +32,7 @@
 
 target_include_directories(SqLiteImpl
   PUBLIC
-	$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>)
+	  $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>)
 
 target_link_libraries(SqLiteImpl
   PUBLIC
diff --git a/tests/cpp/fwklib/FwkBB.hpp b/tests/cpp/fwklib/FwkBB.hpp
index 17f869b..d3b84a8 100644
--- a/tests/cpp/fwklib/FwkBB.hpp
+++ b/tests/cpp/fwklib/FwkBB.hpp
@@ -21,11 +21,11 @@
  */
 
 /**
-  * @file    FwkBB.hpp
-  * @since   1.0
-  * @version 1.0
-  * @see
-  */
+ * @file    FwkBB.hpp
+ * @since   1.0
+ * @version 1.0
+ * @see
+ */
 
 #include <geode/internal/geode_base.hpp>
 #include "fwklib/FwkLog.hpp"
@@ -87,7 +87,7 @@
   virtual ~FwkBBMessage() {}
 
   /** @brief clear message data
-    */
+   */
   void clear() {
     m_parameterVector.clear();
     m_id.clear();
@@ -96,10 +96,10 @@
   }
 
   /** @brief pass to data to parse onReceive message
-    * @param psData data pointer, not null terminated
-    * @param dataSize data size of message
-    * @retval true = Success, false = Failed
-    */
+   * @param psData data pointer, not null terminated
+   * @param dataSize data size of message
+   * @retval true = Success, false = Failed
+   */
   void fromMessageStream(std::string data) {
     //        FWKINFO( "FwkBBMessage::fromMessageStream: " << data );
     char* str = const_cast<char*>(data.c_str());
@@ -140,9 +140,9 @@
   }
 
   /** @brief get data stream to send
-    * @param sStream data stream
-    * @retval true = Success, false = Failed
-    */
+   * @param sStream data stream
+   * @retval true = Success, false = Failed
+   */
   std::string& toMessageStream() {
     m_stream.clear();
     std::ostringstream osMessage;
@@ -168,47 +168,47 @@
   }
 
   /** @brief set Id of message
-    * @param sId id of message
-    */
+   * @param sId id of message
+   */
   void setId(std::string id) { m_id = id; };
 
   /** @brief set command of message
-    * @param sCommand command of message
-    */
+   * @param sCommand command of message
+   */
   void setCommand(std::string cmd) { m_cmd = cmd; };
 
   /** @brief set result of message
-    * @param sResult result of message
-    */
+   * @param sResult result of message
+   */
   void setResult(std::string result) { m_result = result; };
 
   /** @brief add parameter value to message
-    * @param sParameter parameter of message
-    */
+   * @param sParameter parameter of message
+   */
   void addParameter(std::string parameter) {
     m_parameterVector.push_back(parameter);
   };
 
   /** @brief get id of message
-    * @retval id of message
-    */
+   * @retval id of message
+   */
   std::string getId() { return m_id; };
 
   /** @brief get command of message
-    * @retval command of message
-    */
+   * @retval command of message
+   */
   std::string getCommand() { return m_cmd; };
   char getCmdChar() { return m_cmd.at(0); }
 
   /** @brief get result of message
-    * @retval result of message
-    */
+   * @retval result of message
+   */
   std::string getResult() { return m_result; };
 
   /** @brief get parameter of message
-    * @retval parameter of message
-    */
-  std::string getParameter(unsigned short index) {
+   * @retval parameter of message
+   */
+  std::string getParameter(size_t index) {
     std::string value;
     if (index < m_parameterVector.size()) value = m_parameterVector[index];
 
diff --git a/tests/cpp/fwklib/FwkLog.cpp b/tests/cpp/fwklib/FwkLog.cpp
index 6618b63..694e60c 100644
--- a/tests/cpp/fwklib/FwkLog.cpp
+++ b/tests/cpp/fwklib/FwkLog.cpp
@@ -15,6 +15,8 @@
  * limitations under the License.
  */
 
+#include <cinttypes>
+
 #include "fwklib/FwkLog.hpp"
 #include "fwklib/PerfFwk.hpp"
 #include <geode/Exception.hpp>
@@ -62,8 +64,8 @@
   struct tm* tm_val = ACE_OS::localtime(&secs);
   char* pbuf = buf;
   pbuf += ACE_OS::strftime(pbuf, MINBUFSIZE, "%Y/%m/%d %H:%M:%S", tm_val);
-  pbuf +=
-      ACE_OS::snprintf(pbuf, 15, ".%06ld ", static_cast<long>(clock.usec()));
+  pbuf += ACE_OS::snprintf(pbuf, 15, ".%06" PRId64 " ",
+                           static_cast<int64_t>(clock.usec()));
   pbuf += ACE_OS::strftime(pbuf, MINBUFSIZE, "%Z ", tm_val);
   static bool needInit = true;
   if (needInit) {
@@ -73,9 +75,9 @@
 
   const char* fil = dirAndFile(filename);
 
-  fprintf(stdout, "[%s %s %s:P%d:T%lu]::%s::%d  %s  %s\n", buf, u.sysname,
-          u.nodename, ACE_OS::getpid(), (unsigned long)(ACE_Thread::self()),
-          fil, lineno, l, s);
+  fprintf(stdout, "[%s %s %s:P%d:T%" PRIXPTR "]::%s::%d  %s  %s\n", buf,
+          u.sysname, u.nodename, ACE_OS::getpid(),
+          (uintptr_t)(ACE_Thread::self()), fil, lineno, l, s);
   fflush(stdout);
 }
 
diff --git a/tests/cpp/fwklib/FwkStrCvt.cpp b/tests/cpp/fwklib/FwkStrCvt.cpp
index 12294e1..cb17e87 100644
--- a/tests/cpp/fwklib/FwkStrCvt.cpp
+++ b/tests/cpp/fwklib/FwkStrCvt.cpp
@@ -23,45 +23,7 @@
 namespace client {
 namespace testframework {
 
-static const short int wrd = 0x0001;
-static const char* byt = reinterpret_cast<const char*>(&wrd);
 
-#define isNetworkOrder() (byt[1] == 1)
-
-#define NSWAP_8(x) ((x)&0xff)
-#define NSWAP_16(x) ((NSWAP_8(x) << 8) | NSWAP_8((x) >> 8))
-#define NSWAP_32(x) ((NSWAP_16(x) << 16) | NSWAP_16((x) >> 16))
-#define NSWAP_64(x) ((NSWAP_32(x) << 32) | NSWAP_32((x) >> 32))
-
-int64_t FwkStrCvt::hton64(int64_t value) {
-  if (isNetworkOrder()) return value;
-  return NSWAP_64(value);
-}
-
-int64_t FwkStrCvt::ntoh64(int64_t value) {
-  if (isNetworkOrder()) return value;
-  return NSWAP_64(value);
-}
-
-int32_t FwkStrCvt::hton32(int32_t value) {
-  if (isNetworkOrder()) return value;
-  return NSWAP_32(value);
-}
-
-int32_t FwkStrCvt::ntoh32(int32_t value) {
-  if (isNetworkOrder()) return value;
-  return NSWAP_32(value);
-}
-
-int16_t FwkStrCvt::hton16(int16_t value) {
-  if (isNetworkOrder()) return value;
-  return NSWAP_16(value);
-}
-
-int16_t FwkStrCvt::ntoh16(int16_t value) {
-  if (isNetworkOrder()) return value;
-  return NSWAP_16(value);
-}
 
 // ----------------------------------------------------------------------------
 
diff --git a/tests/cpp/fwklib/TimeSync.cpp b/tests/cpp/fwklib/TimeSync.cpp
index 96bef88..bc2a084 100644
--- a/tests/cpp/fwklib/TimeSync.cpp
+++ b/tests/cpp/fwklib/TimeSync.cpp
@@ -51,25 +51,19 @@
 
 // ----------------------------------------------------------------------------
 
-static const short int wrd = 0x0001;
-static const char* byt = reinterpret_cast<const char*>(&wrd);
+#ifndef htonll
+#define htonll(x)  \
+  ((1 == htonl(1)) \
+       ? (x)       \
+       : ((uint64_t)htonl((x)&0xFFFFFFFF) << 32) | htonl((x) >> 32))
+#endif
 
-#define isNetworkOrder() (byt[1] == 1)
-
-#define NSWAP_8(x) ((x)&0xff)
-#define NSWAP_16(x) ((NSWAP_8(x) << 8) | NSWAP_8((x) >> 8))
-#define NSWAP_32(x) ((NSWAP_16(x) << 16) | NSWAP_16((x) >> 16))
-#define NSWAP_64(x) ((NSWAP_32(x) << 32) | NSWAP_32((x) >> 32))
-
-long long htonl64(long long value) {
-  if (isNetworkOrder()) return value;
-  return NSWAP_64(value);
-}
-
-long long ntohl64(long long value) {
-  if (isNetworkOrder()) return value;
-  return NSWAP_64(value);
-}
+#ifndef ntohll
+#define ntohll(x)  \
+  ((1 == ntohl(1)) \
+       ? (x)       \
+       : ((uint64_t)ntohl((x)&0xFFFFFFFF) << 32) | ntohl((x) >> 32))
+#endif
 
 // ----------------------------------------------------------------------------
 
@@ -120,7 +114,7 @@
   int32_t tvLen = sizeof(int64_t);
   do {
     ACE_Time_Value tval = ACE_OS::gettimeofday();
-    int64_t now = htonl64(timevalMicros(tval));
+    int64_t now = htonll(timevalMicros(tval));
 #ifdef WIN32
     retVal = sendto(sock, (const char*)&now, tvLen, 0,
                     (const struct sockaddr*)&addr, addrLen);
@@ -227,7 +221,7 @@
       {
         ACE_Time_Value now = ACE_OS::gettimeofday();
         int64_t curr = timevalMicros(now);
-        tval = ntohl64(tval);
+        tval = ntohll(tval);
         int64_t diff = (tval - curr);
         total += diff;
         cnt++;