diff --git a/lib/c_glib/test/testthrifttestclient.cpp b/lib/c_glib/test/testthrifttestclient.cpp
old mode 100755
new mode 100644
index 1910c8a..20fbcdb
--- a/lib/c_glib/test/testthrifttestclient.cpp
+++ b/lib/c_glib/test/testthrifttestclient.cpp
@@ -67,58 +67,58 @@
 
 class TestHandler : public ThriftTestIf {
   public:
-  TestHandler() {}
+  TestHandler() = default;
 
-  void testVoid() {
+  void testVoid() override {
     cout << "[C -> C++] testVoid()" << endl;
   }
 
-  void testString(string& out, const string &thing) {
+  void testString(string& out, const string &thing) override {
     cout << "[C -> C++] testString(\"" << thing << "\")" << endl;
     out = thing;
   }
 
-  bool testBool(const bool thing) {
+  bool testBool(const bool thing) override {
     cout << "[C -> C++] testBool(" << (thing ? "true" : "false") << ")" << endl;
     return thing;
   }
-  int8_t testByte(const int8_t thing) {
+  int8_t testByte(const int8_t thing) override {
     cout << "[C -> C++] testByte(" << (int)thing << ")" << endl;
     return thing;
   }
-  int32_t testI32(const int32_t thing) {
+  int32_t testI32(const int32_t thing) override {
     cout << "[C -> C++] testI32(" << thing << ")" << endl;
     return thing;
   }
 
-  int64_t testI64(const int64_t thing) {
+  int64_t testI64(const int64_t thing) override {
     cout << "[C -> C++] testI64(" << thing << ")" << endl;
     return thing;
   }
 
-  double testDouble(const double thing) {
+  double testDouble(const double thing) override {
     cout.precision(6);
     cout << "[C -> C++] testDouble(" << fixed << thing << ")" << endl;
     return thing;
   }
 
-  void testBinary(string& out, const string &thing) {
+  void testBinary(string& out, const string &thing) override {
     cout << "[C -> C++] testBinary(\"" << thing << "\")" << endl;
     out = thing;
   }
 
-  void testStruct(Xtruct& out, const Xtruct &thing) {
+  void testStruct(Xtruct& out, const Xtruct &thing) override {
     cout << "[C -> C++] testStruct({\"" << thing.string_thing << "\", " << (int)thing.byte_thing << ", " << thing.i32_thing << ", " << thing.i64_thing << "})" << endl;
     out = thing;
   }
 
-  void testNest(Xtruct2& out, const Xtruct2& nest) {
+  void testNest(Xtruct2& out, const Xtruct2& nest) override {
     const Xtruct &thing = nest.struct_thing;
     cout << "[C -> C++] testNest({" << (int)nest.byte_thing << ", {\"" << thing.string_thing << "\", " << (int)thing.byte_thing << ", " << thing.i32_thing << ", " << thing.i64_thing << "}, " << nest.i32_thing << "})" << endl;
     out = nest;
   }
 
-  void testMap(map<int32_t, int32_t> &out, const map<int32_t, int32_t> &thing) {
+  void testMap(map<int32_t, int32_t> &out, const map<int32_t, int32_t> &thing) override {
     cout << "[C -> C++] testMap({";
     map<int32_t, int32_t>::const_iterator m_iter;
     bool first = true;
@@ -134,7 +134,7 @@
     out = thing;
   }
 
-  void testStringMap(map<std::string, std::string> &out, const map<std::string, std::string> &thing) {
+  void testStringMap(map<std::string, std::string> &out, const map<std::string, std::string> &thing) override {
     cout << "[C -> C++] testStringMap({";
     map<std::string, std::string>::const_iterator m_iter;
     bool first = true;
@@ -151,7 +151,7 @@
   }
 
 
-  void testSet(set<int32_t> &out, const set<int32_t> &thing) {
+  void testSet(set<int32_t> &out, const set<int32_t> &thing) override {
     cout << "[C -> C++] testSet({";
     set<int32_t>::const_iterator s_iter;
     bool first = true;
@@ -167,7 +167,7 @@
     out = thing;
   }
 
-  void testList(vector<int32_t> &out, const vector<int32_t> &thing) {
+  void testList(vector<int32_t> &out, const vector<int32_t> &thing) override {
     cout << "[C -> C++] testList({";
     vector<int32_t>::const_iterator l_iter;
     bool first = true;
@@ -183,16 +183,16 @@
     out = thing;
   }
 
-  Numberz::type testEnum(const Numberz::type thing) {
+  Numberz::type testEnum(const Numberz::type thing) override {
     cout << "[C -> C++] testEnum(" << thing << ")" << endl;
     return thing;
   }
 
-  UserId testTypedef(const UserId thing) {
+  UserId testTypedef(const UserId thing) override {
     cout << "[C -> C++] testTypedef(" << thing << ")" << endl;
     return thing;  }
 
-  void testMapMap(map<int32_t, map<int32_t,int32_t> > &mapmap, const int32_t hello) {
+  void testMapMap(map<int32_t, map<int32_t,int32_t> > &mapmap, const int32_t hello) override {
     cout << "[C -> C++] testMapMap(" << hello << ")" << endl;
 
     map<int32_t,int32_t> pos;
@@ -207,7 +207,7 @@
 
   }
 
-  void testInsanity(map<UserId, map<Numberz::type,Insanity> > &insane, const Insanity &argument) {
+  void testInsanity(map<UserId, map<Numberz::type,Insanity> > &insane, const Insanity &argument) override {
     THRIFT_UNUSED_VARIABLE (argument);
 
     cout << "[C -> C++] testInsanity()" << endl;
@@ -277,7 +277,7 @@
 
   }
 
-  void testMulti(Xtruct &hello, const int8_t arg0, const int32_t arg1, const int64_t arg2, const std::map<int16_t, std::string>  &arg3, const Numberz::type arg4, const UserId arg5) {
+  void testMulti(Xtruct &hello, const int8_t arg0, const int32_t arg1, const int64_t arg2, const std::map<int16_t, std::string>  &arg3, const Numberz::type arg4, const UserId arg5) override {
     THRIFT_UNUSED_VARIABLE (arg3);
     THRIFT_UNUSED_VARIABLE (arg4);
     THRIFT_UNUSED_VARIABLE (arg5);
@@ -291,7 +291,7 @@
   }
 
   void testException(const std::string &arg)
-    throw(Xception, apache::thrift::TException)
+    throw(Xception, apache::thrift::TException) override
   {
     cout << "[C -> C++] testException(" << arg << ")" << endl;
     if (arg.compare("Xception") == 0) {
@@ -309,7 +309,7 @@
     }
   }
 
-  void testMultiException(Xtruct &result, const std::string &arg0, const std::string &arg1) throw(Xception, Xception2) {
+  void testMultiException(Xtruct &result, const std::string &arg0, const std::string &arg1) throw(Xception, Xception2) override {
 
     cout << "[C -> C++] testMultiException(" << arg0 << ", " << arg1 << ")" << endl;
 
@@ -329,7 +329,7 @@
     }
   }
 
-  void testOneway(int sleepFor) {
+  void testOneway(int sleepFor) override {
     cout << "testOneway(" << sleepFor << "): Sleeping..." << endl;
     sleep(sleepFor);
     cout << "testOneway(" << sleepFor << "): done sleeping!" << endl;
@@ -350,12 +350,12 @@
 static void
 test_thrift_client (void)
 {
-  ThriftSocket *tsocket = NULL;
-  ThriftBinaryProtocol *protocol = NULL;
-  TTestThriftTestClient *client = NULL;
-  TTestThriftTestIf *iface = NULL;
-  GError *error = NULL;
-  gchar *string = NULL;
+  ThriftSocket *tsocket = nullptr;
+  ThriftBinaryProtocol *protocol = nullptr;
+  TTestThriftTestClient *client = nullptr;
+  TTestThriftTestIf *iface = nullptr;
+  GError *error = nullptr;
+  gchar *string = nullptr;
   gint8 byte = 0;
   gint16 i16 = 0;
   gint32 i32 = 0, another_i32 = 56789;
@@ -363,18 +363,18 @@
   double dbl = 0.0;
   TTestXtruct *xtruct_in, *xtruct_out;
   TTestXtruct2 *xtruct2_in, *xtruct2_out;
-  GHashTable *map_in = NULL, *map_out = NULL;
-  GHashTable *set_in = NULL, *set_out = NULL;
-  GArray *list_in = NULL, *list_out = NULL;
+  GHashTable *map_in = nullptr, *map_out = nullptr;
+  GHashTable *set_in = nullptr, *set_out = nullptr;
+  GArray *list_in = nullptr, *list_out = nullptr;
   TTestNumberz enum_in, enum_out;
   TTestUserId user_id_in, user_id_out;
-  GHashTable *insanity_in = NULL;
+  GHashTable *insanity_in = nullptr;
   TTestXtruct *xtruct1, *xtruct2;
-  TTestInsanity *insanity_out = NULL;
-  TTestXtruct *multi_in = NULL;
-  GHashTable *multi_map_out = NULL;
-  TTestXception *xception = NULL;
-  TTestXception2 *xception2 = NULL;
+  TTestInsanity *insanity_out = nullptr;
+  TTestXtruct *multi_in = nullptr;
+  GHashTable *multi_map_out = nullptr;
+  TTestXception *xception = nullptr;
+  TTestXception2 *xception2 = nullptr;
 
 #if (!GLIB_CHECK_VERSION (2, 36, 0))
   // initialize gobject
@@ -392,33 +392,33 @@
   iface = T_TEST_THRIFT_TEST_IF (client);
 
   // open and send
-  thrift_transport_open (THRIFT_TRANSPORT(tsocket), NULL);
+  thrift_transport_open (THRIFT_TRANSPORT(tsocket), nullptr);
 
   assert (t_test_thrift_test_client_test_void (iface, &error) == TRUE);
-  assert (error == NULL);
+  assert (error == nullptr);
 
   assert (t_test_thrift_test_client_test_string (iface, &string, "test123", &error) == TRUE);
   assert (strcmp (string, "test123") == 0);
   g_free (string);
-  assert (error == NULL);
+  assert (error == nullptr);
 
   assert (t_test_thrift_test_client_test_byte (iface, &byte, (gint8) 5, &error) == TRUE);
   assert (byte == 5);
-  assert (error == NULL);
+  assert (error == nullptr);
 
   assert (t_test_thrift_test_client_test_i32 (iface, &i32, 123, &error) == TRUE);
   assert (i32 == 123);
-  assert (error == NULL);
+  assert (error == nullptr);
 
   assert (t_test_thrift_test_client_test_i64 (iface, &i64, 12345, &error) == TRUE);
   assert (i64 == 12345);
-  assert (error == NULL);
+  assert (error == nullptr);
 
   assert (t_test_thrift_test_client_test_double (iface, &dbl, 5.6, &error) == TRUE);
   assert (dbl == 5.6);
-  assert (error == NULL);
+  assert (error == nullptr);
 
-  xtruct_out = (TTestXtruct *) g_object_new (T_TEST_TYPE_XTRUCT, NULL);
+  xtruct_out = (TTestXtruct *) g_object_new (T_TEST_TYPE_XTRUCT, nullptr);
   xtruct_out->byte_thing = 1;
   xtruct_out->__isset_byte_thing = TRUE;
   xtruct_out->i32_thing = 15;
@@ -427,50 +427,50 @@
   xtruct_out->__isset_i64_thing = TRUE;
   xtruct_out->string_thing = g_strdup ("abc123");
   xtruct_out->__isset_string_thing = TRUE;
-  xtruct_in = (TTestXtruct *) g_object_new(T_TEST_TYPE_XTRUCT, NULL);
+  xtruct_in = (TTestXtruct *) g_object_new(T_TEST_TYPE_XTRUCT, nullptr);
   assert (t_test_thrift_test_client_test_struct (iface, &xtruct_in, xtruct_out, &error) == TRUE);
-  assert (error == NULL);
+  assert (error == nullptr);
 
-  xtruct2_out = (TTestXtruct2 *) g_object_new (T_TEST_TYPE_XTRUCT2, NULL);
+  xtruct2_out = (TTestXtruct2 *) g_object_new (T_TEST_TYPE_XTRUCT2, nullptr);
   xtruct2_out->byte_thing = 1;
   xtruct2_out->__isset_byte_thing = TRUE;
-  if (xtruct2_out->struct_thing != NULL)
+  if (xtruct2_out->struct_thing != nullptr)
     g_object_unref(xtruct2_out->struct_thing);
   xtruct2_out->struct_thing = xtruct_out;
   xtruct2_out->__isset_struct_thing = TRUE;
   xtruct2_out->i32_thing = 123;
   xtruct2_out->__isset_i32_thing = TRUE;
-  xtruct2_in = (TTestXtruct2 *) g_object_new (T_TEST_TYPE_XTRUCT2, NULL);
+  xtruct2_in = (TTestXtruct2 *) g_object_new (T_TEST_TYPE_XTRUCT2, nullptr);
   assert (t_test_thrift_test_client_test_nest (iface, &xtruct2_in, xtruct2_out, &error) == TRUE);
-  assert (error == NULL);
+  assert (error == nullptr);
 
   g_object_unref (xtruct2_out);
   g_object_unref (xtruct2_in);
   g_object_unref (xtruct_in);
 
-  map_out = g_hash_table_new (NULL, NULL);
-  map_in = g_hash_table_new (NULL, NULL);  g_hash_table_insert (map_out, &i32, &i32);
+  map_out = g_hash_table_new (nullptr, nullptr);
+  map_in = g_hash_table_new (nullptr, nullptr);  g_hash_table_insert (map_out, &i32, &i32);
   assert (t_test_thrift_test_client_test_map (iface, &map_in, map_out, &error) == TRUE);
-  assert (error == NULL);
+  assert (error == nullptr);
   g_hash_table_destroy (map_out);
   g_hash_table_destroy (map_in);
 
-  map_out = g_hash_table_new (NULL, NULL);
-  map_in = g_hash_table_new (NULL, NULL);
+  map_out = g_hash_table_new (nullptr, nullptr);
+  map_in = g_hash_table_new (nullptr, nullptr);
   g_hash_table_insert (map_out, g_strdup ("a"), g_strdup ("123"));
   g_hash_table_insert (map_out, g_strdup ("a b"), g_strdup ("with spaces "));
   g_hash_table_insert (map_out, g_strdup ("same"), g_strdup ("same"));
   g_hash_table_insert (map_out, g_strdup ("0"), g_strdup ("numeric key"));
   assert (t_test_thrift_test_client_test_string_map (iface, &map_in, map_out, &error) == TRUE);
-  assert (error == NULL);
+  assert (error == nullptr);
   g_hash_table_destroy (map_out);
   g_hash_table_destroy (map_in);
 
-  set_out = g_hash_table_new (NULL, NULL);
-  set_in = g_hash_table_new (NULL, NULL);
+  set_out = g_hash_table_new (nullptr, nullptr);
+  set_in = g_hash_table_new (nullptr, nullptr);
   g_hash_table_insert (set_out, &i32, &i32);
   assert (t_test_thrift_test_client_test_set (iface, &set_in, set_out, &error) == TRUE);
-  assert (error == NULL);
+  assert (error == nullptr);
   g_hash_table_destroy (set_out);
   g_hash_table_destroy (set_in);
 
@@ -480,31 +480,31 @@
   g_array_append_val (list_out, i32);
   g_array_append_val (list_out, another_i32);
   assert (t_test_thrift_test_client_test_list (iface, &list_in, list_out, &error) == TRUE);
-  assert (error == NULL);
+  assert (error == nullptr);
   g_array_free (list_out, TRUE);
   g_array_free (list_in, TRUE);
 
   enum_out = T_TEST_NUMBERZ_ONE;
   assert (t_test_thrift_test_client_test_enum (iface, &enum_in, enum_out, &error) == TRUE);
   assert (enum_in == enum_out);
-  assert (error == NULL);
+  assert (error == nullptr);
 
   user_id_out = 12345;
   assert (t_test_thrift_test_client_test_typedef (iface, &user_id_in, user_id_out, &error) == TRUE);
   assert (user_id_in == user_id_out);
-  assert (error == NULL);
+  assert (error == nullptr);
 
-  map_in = g_hash_table_new (NULL, NULL);
+  map_in = g_hash_table_new (nullptr, nullptr);
   assert (t_test_thrift_test_client_test_map_map (iface, &map_in, i32, &error) == TRUE);
-  assert (error == NULL);
+  assert (error == nullptr);
   g_hash_table_destroy (map_in);
 
   // insanity
-  insanity_out = (TTestInsanity *) g_object_new (T_TEST_TYPE_INSANITY, NULL);
-  insanity_out->userMap = g_hash_table_new (NULL, NULL);
+  insanity_out = (TTestInsanity *) g_object_new (T_TEST_TYPE_INSANITY, nullptr);
+  insanity_out->userMap = g_hash_table_new (nullptr, nullptr);
   g_hash_table_insert (insanity_out->userMap, GINT_TO_POINTER (enum_out), &user_id_out);
 
-  xtruct1 = (TTestXtruct *) g_object_new (T_TEST_TYPE_XTRUCT, NULL);
+  xtruct1 = (TTestXtruct *) g_object_new (T_TEST_TYPE_XTRUCT, nullptr);
   xtruct1->byte_thing = 1;
   xtruct1->__isset_byte_thing = TRUE;
   xtruct1->i32_thing = 15;
@@ -513,7 +513,7 @@
   xtruct1->__isset_i64_thing = TRUE;
   xtruct1->string_thing = g_strdup ("abc123");
   xtruct1->__isset_string_thing = TRUE;
-  xtruct2 = (TTestXtruct *) g_object_new (T_TEST_TYPE_XTRUCT, NULL);
+  xtruct2 = (TTestXtruct *) g_object_new (T_TEST_TYPE_XTRUCT, nullptr);
   xtruct2->byte_thing = 1;
   xtruct2->__isset_byte_thing = TRUE;
   xtruct2->i32_thing = 15;
@@ -523,7 +523,7 @@
   xtruct2->string_thing = g_strdup ("abc123");
   xtruct2->__isset_string_thing = TRUE;
 
-  insanity_in = g_hash_table_new (NULL, NULL);
+  insanity_in = g_hash_table_new (nullptr, nullptr);
   g_ptr_array_add (insanity_out->xtructs, xtruct1);
   g_ptr_array_add (insanity_out->xtructs, xtruct2);
   assert (t_test_thrift_test_client_test_insanity (iface, &insanity_in, insanity_out, &error) == TRUE);
@@ -531,10 +531,10 @@
   g_hash_table_unref (insanity_in);
   g_ptr_array_free (insanity_out->xtructs, TRUE);
 
-  multi_map_out = g_hash_table_new (NULL, NULL);
+  multi_map_out = g_hash_table_new (nullptr, nullptr);
   string = g_strdup ("abc123");
   g_hash_table_insert (multi_map_out, &i16, string);
-  multi_in = (TTestXtruct *) g_object_new (T_TEST_TYPE_XTRUCT, NULL);
+  multi_in = (TTestXtruct *) g_object_new (T_TEST_TYPE_XTRUCT, nullptr);
   assert (t_test_thrift_test_client_test_multi (iface, &multi_in, byte, i32, i64, multi_map_out, enum_out, user_id_out, &error) == TRUE);
   assert (multi_in->i32_thing == i32);
   assert (multi_in->i64_thing == i64);
@@ -545,53 +545,53 @@
   assert (t_test_thrift_test_client_test_exception (iface, "Xception", &xception, &error) == FALSE);
   assert (xception->errorCode == 1001);
   g_error_free (error);
-  error = NULL;
+  error = nullptr;
   g_object_unref (xception);
-  xception = NULL;
+  xception = nullptr;
 
   assert (t_test_thrift_test_client_test_exception (iface, "ApplicationException", &xception, &error) == FALSE);
   g_error_free (error);
-  error = NULL;
-  assert (xception == NULL);
+  error = nullptr;
+  assert (xception == nullptr);
 
   assert (t_test_thrift_test_client_test_exception (iface, "Test", &xception, &error) == TRUE);
-  assert (error == NULL);
+  assert (error == nullptr);
 
-  multi_in = (TTestXtruct*) g_object_new (T_TEST_TYPE_XTRUCT, NULL);
-  assert (t_test_thrift_test_client_test_multi_exception (iface, &multi_in, "Xception", NULL, &xception, &xception2, &error) == FALSE);
+  multi_in = (TTestXtruct*) g_object_new (T_TEST_TYPE_XTRUCT, nullptr);
+  assert (t_test_thrift_test_client_test_multi_exception (iface, &multi_in, "Xception", nullptr, &xception, &xception2, &error) == FALSE);
   assert (xception->errorCode == 1001);
-  assert (xception2 == NULL);
+  assert (xception2 == nullptr);
   g_error_free (error);
-  error = NULL;
+  error = nullptr;
   g_object_unref (xception);
   g_object_unref (multi_in);
-  xception = NULL;
-  multi_in = NULL;
+  xception = nullptr;
+  multi_in = nullptr;
 
-  multi_in = (TTestXtruct*) g_object_new (T_TEST_TYPE_XTRUCT, NULL);
-  assert (t_test_thrift_test_client_test_multi_exception (iface, &multi_in, "Xception2", NULL, &xception, &xception2, &error) == FALSE);
+  multi_in = (TTestXtruct*) g_object_new (T_TEST_TYPE_XTRUCT, nullptr);
+  assert (t_test_thrift_test_client_test_multi_exception (iface, &multi_in, "Xception2", nullptr, &xception, &xception2, &error) == FALSE);
   assert (xception2->errorCode == 2002);
-  assert (xception == NULL);
+  assert (xception == nullptr);
   g_error_free (error);
-  error = NULL;
+  error = nullptr;
   g_object_unref (xception2);
   g_object_unref (multi_in);
-  xception2 = NULL;
-  multi_in = NULL;
+  xception2 = nullptr;
+  multi_in = nullptr;
 
-  multi_in = (TTestXtruct*) g_object_new (T_TEST_TYPE_XTRUCT, NULL);
-  assert (t_test_thrift_test_client_test_multi_exception (iface, &multi_in, NULL , NULL, &xception, &xception2, &error) == TRUE);
-  assert (error == NULL);
+  multi_in = (TTestXtruct*) g_object_new (T_TEST_TYPE_XTRUCT, nullptr);
+  assert (t_test_thrift_test_client_test_multi_exception (iface, &multi_in, nullptr , nullptr, &xception, &xception2, &error) == TRUE);
+  assert (error == nullptr);
   g_object_unref(multi_in);
-  multi_in = NULL;
+  multi_in = nullptr;
 
   assert (t_test_thrift_test_client_test_oneway (iface, 1, &error) == TRUE);
-  assert (error == NULL);
+  assert (error == nullptr);
 
   /* sleep to let the oneway call go through */
   sleep (5);
 
-  thrift_transport_close (THRIFT_TRANSPORT(tsocket), NULL);
+  thrift_transport_close (THRIFT_TRANSPORT(tsocket), nullptr);
   g_object_unref (client);
   g_object_unref (protocol);
   g_object_unref (tsocket);
diff --git a/lib/cpp/README.md b/lib/cpp/README.md
index af37627..8a897d1 100755
--- a/lib/cpp/README.md
+++ b/lib/cpp/README.md
@@ -252,6 +252,10 @@
 THRIFT-4735:
 Qt4 support was removed.
 
+THRIFT-4762:
+Added `const` specifier to `TTransport::getOrigin()`. This changes its function signature.
+It's recommended to add the `override` specifier in implementations derived from `TTransport`.
+
 ## 0.11.0
 
 Older versions of thrift depended on the <boost/smart_ptr.hpp> classes which
diff --git a/lib/cpp/src/thrift/TApplicationException.h b/lib/cpp/src/thrift/TApplicationException.h
index 60618fb..cd1b3e7 100644
--- a/lib/cpp/src/thrift/TApplicationException.h
+++ b/lib/cpp/src/thrift/TApplicationException.h
@@ -57,7 +57,7 @@
   TApplicationException(TApplicationExceptionType type, const std::string& message)
     : TException(message), type_(type) {}
 
-  virtual ~TApplicationException() noexcept {}
+  ~TApplicationException() noexcept override = default;
 
   /**
    * Returns an error code that provides information about the type of error
@@ -67,7 +67,7 @@
    */
   TApplicationExceptionType getType() const { return type_; }
 
-  virtual const char* what() const noexcept {
+  const char* what() const noexcept override {
     if (message_.empty()) {
       switch (type_) {
       case UNKNOWN:
diff --git a/lib/cpp/src/thrift/TBase.h b/lib/cpp/src/thrift/TBase.h
index a274bcd..cc31c34 100644
--- a/lib/cpp/src/thrift/TBase.h
+++ b/lib/cpp/src/thrift/TBase.h
@@ -28,7 +28,7 @@
 
 class TBase {
 public:
-  virtual ~TBase(){};
+  virtual ~TBase()= default;;
   virtual uint32_t read(protocol::TProtocol* iprot) = 0;
   virtual uint32_t write(protocol::TProtocol* oprot) const = 0;
 };
diff --git a/lib/cpp/src/thrift/TDispatchProcessor.h b/lib/cpp/src/thrift/TDispatchProcessor.h
index 28d347d..ae522b2 100644
--- a/lib/cpp/src/thrift/TDispatchProcessor.h
+++ b/lib/cpp/src/thrift/TDispatchProcessor.h
@@ -33,15 +33,15 @@
 template <class Protocol_>
 class TDispatchProcessorT : public TProcessor {
 public:
-  virtual bool process(std::shared_ptr<protocol::TProtocol> in,
+  bool process(std::shared_ptr<protocol::TProtocol> in,
                        std::shared_ptr<protocol::TProtocol> out,
-                       void* connectionContext) {
+                       void* connectionContext) override {
     protocol::TProtocol* inRaw = in.get();
     protocol::TProtocol* outRaw = out.get();
 
     // Try to dynamic cast to the template protocol type
-    Protocol_* specificIn = dynamic_cast<Protocol_*>(inRaw);
-    Protocol_* specificOut = dynamic_cast<Protocol_*>(outRaw);
+    auto* specificIn = dynamic_cast<Protocol_*>(inRaw);
+    auto* specificOut = dynamic_cast<Protocol_*>(outRaw);
     if (specificIn && specificOut) {
       return processFast(specificIn, specificOut, connectionContext);
     }
@@ -105,9 +105,9 @@
  */
 class TDispatchProcessor : public TProcessor {
 public:
-  virtual bool process(std::shared_ptr<protocol::TProtocol> in,
+  bool process(std::shared_ptr<protocol::TProtocol> in,
                        std::shared_ptr<protocol::TProtocol> out,
-                       void* connectionContext) {
+                       void* connectionContext) override {
     std::string fname;
     protocol::TMessageType mtype;
     int32_t seqid;
diff --git a/lib/cpp/src/thrift/TOutput.cpp b/lib/cpp/src/thrift/TOutput.cpp
index af36137..f25b566 100644
--- a/lib/cpp/src/thrift/TOutput.cpp
+++ b/lib/cpp/src/thrift/TOutput.cpp
@@ -62,7 +62,7 @@
 #endif
 
   char* heap_buf = (char*)malloc((need + 1) * sizeof(char));
-  if (heap_buf == NULL) {
+  if (heap_buf == nullptr) {
 #ifdef _MSC_VER
     va_start(ap, message);
     vsnprintf_s(stack_buf, STACK_BUF_SIZE, _TRUNCATE, message, ap);
diff --git a/lib/cpp/src/thrift/TProcessor.h b/lib/cpp/src/thrift/TProcessor.h
index 6a46466..65bf3d4 100644
--- a/lib/cpp/src/thrift/TProcessor.h
+++ b/lib/cpp/src/thrift/TProcessor.h
@@ -35,7 +35,7 @@
  */
 class TProcessorEventHandler {
 public:
-  virtual ~TProcessorEventHandler() {}
+  virtual ~TProcessorEventHandler() = default;
 
   /**
    * Called before calling other callback methods.
@@ -46,7 +46,7 @@
   virtual void* getContext(const char* fn_name, void* serverContext) {
     (void)fn_name;
     (void)serverContext;
-    return NULL;
+    return nullptr;
   }
 
   /**
@@ -108,7 +108,7 @@
   }
 
 protected:
-  TProcessorEventHandler() {}
+  TProcessorEventHandler() = default;
 };
 
 /**
@@ -119,10 +119,10 @@
   TProcessorContextFreer(TProcessorEventHandler* handler, void* context, const char* method)
     : handler_(handler), context_(context), method_(method) {}
   ~TProcessorContextFreer() {
-    if (handler_ != NULL)
+    if (handler_ != nullptr)
       handler_->freeContext(context_, method_);
   }
-  void unregister() { handler_ = NULL; }
+  void unregister() { handler_ = nullptr; }
 
 private:
   apache::thrift::TProcessorEventHandler* handler_;
@@ -139,7 +139,7 @@
  */
 class TProcessor {
 public:
-  virtual ~TProcessor() {}
+  virtual ~TProcessor() = default;
 
   virtual bool process(std::shared_ptr<protocol::TProtocol> in,
                        std::shared_ptr<protocol::TProtocol> out,
@@ -156,7 +156,7 @@
   }
 
 protected:
-  TProcessor() {}
+  TProcessor() = default;
 
   std::shared_ptr<TProcessorEventHandler> eventHandler_;
 };
@@ -202,7 +202,7 @@
 
 class TProcessorFactory {
 public:
-  virtual ~TProcessorFactory() {}
+  virtual ~TProcessorFactory() = default;
 
   /**
    * Get the TProcessor to use for a particular connection.
@@ -218,7 +218,7 @@
 public:
   TSingletonProcessorFactory(std::shared_ptr<TProcessor> processor) : processor_(processor) {}
 
-  std::shared_ptr<TProcessor> getProcessor(const TConnectionInfo&) { return processor_; }
+  std::shared_ptr<TProcessor> getProcessor(const TConnectionInfo&) override { return processor_; }
 
 private:
   std::shared_ptr<TProcessor> processor_;
diff --git a/lib/cpp/src/thrift/Thrift.h b/lib/cpp/src/thrift/Thrift.h
index 6322742..951cc28 100644
--- a/lib/cpp/src/thrift/Thrift.h
+++ b/lib/cpp/src/thrift/Thrift.h
@@ -79,9 +79,9 @@
 
   TException(const std::string& message) : message_(message) {}
 
-  virtual ~TException() noexcept {}
+  ~TException() noexcept override = default;
 
-  virtual const char* what() const noexcept {
+  const char* what() const noexcept override {
     if (message_.empty()) {
       return "Default TException.";
     } else {
@@ -98,14 +98,14 @@
   template <class E>
   static TDelayedException* delayException(const E& e);
   virtual void throw_it() = 0;
-  virtual ~TDelayedException(){};
+  virtual ~TDelayedException()= default;;
 };
 
 template <class E>
 class TExceptionWrapper : public TDelayedException {
 public:
   TExceptionWrapper(const E& e) : e_(e) {}
-  virtual void throw_it() {
+  void throw_it() override {
     E temp(e_);
     delete this;
     throw temp;
diff --git a/lib/cpp/src/thrift/async/TAsyncBufferProcessor.h b/lib/cpp/src/thrift/async/TAsyncBufferProcessor.h
index 9c96b14..e3c3597 100644
--- a/lib/cpp/src/thrift/async/TAsyncBufferProcessor.h
+++ b/lib/cpp/src/thrift/async/TAsyncBufferProcessor.h
@@ -37,7 +37,7 @@
   virtual void process(std::function<void(bool healthy)> _return,
                        std::shared_ptr<transport::TBufferBase> ibuf,
                        std::shared_ptr<transport::TBufferBase> obuf) = 0;
-  virtual ~TAsyncBufferProcessor() {}
+  virtual ~TAsyncBufferProcessor() = default;
 };
 }
 }
diff --git a/lib/cpp/src/thrift/async/TAsyncChannel.h b/lib/cpp/src/thrift/async/TAsyncChannel.h
index d7ace96..22cf383 100644
--- a/lib/cpp/src/thrift/async/TAsyncChannel.h
+++ b/lib/cpp/src/thrift/async/TAsyncChannel.h
@@ -41,7 +41,7 @@
 public:
   typedef std::function<void()> VoidCallback;
 
-  virtual ~TAsyncChannel() {}
+  virtual ~TAsyncChannel() = default;
 
   // is the channel in a good state?
   virtual bool good() const = 0;
diff --git a/lib/cpp/src/thrift/async/TAsyncDispatchProcessor.h b/lib/cpp/src/thrift/async/TAsyncDispatchProcessor.h
index 59db597..2a694ac 100644
--- a/lib/cpp/src/thrift/async/TAsyncDispatchProcessor.h
+++ b/lib/cpp/src/thrift/async/TAsyncDispatchProcessor.h
@@ -34,15 +34,15 @@
 template <class Protocol_>
 class TAsyncDispatchProcessorT : public TAsyncProcessor {
 public:
-  virtual void process(std::function<void(bool success)> _return,
+  void process(std::function<void(bool success)> _return,
                        std::shared_ptr<protocol::TProtocol> in,
-                       std::shared_ptr<protocol::TProtocol> out) {
+                       std::shared_ptr<protocol::TProtocol> out) override {
     protocol::TProtocol* inRaw = in.get();
     protocol::TProtocol* outRaw = out.get();
 
     // Try to dynamic cast to the template protocol type
-    Protocol_* specificIn = dynamic_cast<Protocol_*>(inRaw);
-    Protocol_* specificOut = dynamic_cast<Protocol_*>(outRaw);
+    auto* specificIn = dynamic_cast<Protocol_*>(inRaw);
+    auto* specificOut = dynamic_cast<Protocol_*>(outRaw);
     if (specificIn && specificOut) {
       return processFast(_return, specificIn, specificOut);
     }
@@ -106,9 +106,9 @@
  */
 class TAsyncDispatchProcessor : public TAsyncProcessor {
 public:
-  virtual void process(std::function<void(bool success)> _return,
+  void process(std::function<void(bool success)> _return,
                        std::shared_ptr<protocol::TProtocol> in,
-                       std::shared_ptr<protocol::TProtocol> out) {
+                       std::shared_ptr<protocol::TProtocol> out) override {
     protocol::TProtocol* inRaw = in.get();
     protocol::TProtocol* outRaw = out.get();
 
diff --git a/lib/cpp/src/thrift/async/TAsyncProcessor.h b/lib/cpp/src/thrift/async/TAsyncProcessor.h
index fdb976d..0192339 100644
--- a/lib/cpp/src/thrift/async/TAsyncProcessor.h
+++ b/lib/cpp/src/thrift/async/TAsyncProcessor.h
@@ -35,7 +35,7 @@
 
 class TAsyncProcessor {
 public:
-  virtual ~TAsyncProcessor() {}
+  virtual ~TAsyncProcessor() = default;
 
   virtual void process(std::function<void(bool success)> _return,
                        std::shared_ptr<protocol::TProtocol> in,
@@ -53,14 +53,14 @@
   }
 
 protected:
-  TAsyncProcessor() {}
+  TAsyncProcessor() = default;
 
   std::shared_ptr<TProcessorEventHandler> eventHandler_;
 };
 
 class TAsyncProcessorFactory {
 public:
-  virtual ~TAsyncProcessorFactory() {}
+  virtual ~TAsyncProcessorFactory() = default;
 
   /**
    * Get the TAsyncProcessor to use for a particular connection.
diff --git a/lib/cpp/src/thrift/async/TAsyncProtocolProcessor.h b/lib/cpp/src/thrift/async/TAsyncProtocolProcessor.h
index 8052cf3..ace72b6 100644
--- a/lib/cpp/src/thrift/async/TAsyncProtocolProcessor.h
+++ b/lib/cpp/src/thrift/async/TAsyncProtocolProcessor.h
@@ -34,11 +34,11 @@
                           std::shared_ptr<apache::thrift::protocol::TProtocolFactory> pfact)
     : underlying_(underlying), pfact_(pfact) {}
 
-  virtual void process(std::function<void(bool healthy)> _return,
+  void process(std::function<void(bool healthy)> _return,
                        std::shared_ptr<apache::thrift::transport::TBufferBase> ibuf,
-                       std::shared_ptr<apache::thrift::transport::TBufferBase> obuf);
+                       std::shared_ptr<apache::thrift::transport::TBufferBase> obuf) override;
 
-  virtual ~TAsyncProtocolProcessor() {}
+  ~TAsyncProtocolProcessor() override = default;
 
 private:
   static void finish(std::function<void(bool healthy)> _return,
diff --git a/lib/cpp/src/thrift/async/TConcurrentClientSyncInfo.cpp b/lib/cpp/src/thrift/async/TConcurrentClientSyncInfo.cpp
index c7e27c0..952394b 100644
--- a/lib/cpp/src/thrift/async/TConcurrentClientSyncInfo.cpp
+++ b/lib/cpp/src/thrift/async/TConcurrentClientSyncInfo.cpp
@@ -75,7 +75,7 @@
   MonitorPtr monitor;
   {
     Guard seqidGuard(seqidMutex_);
-    MonitorMap::iterator i = seqidToMonitorMap_.find(rseqid);
+    auto i = seqidToMonitorMap_.find(rseqid);
     if(i == seqidToMonitorMap_.end())
       throwBadSeqId_();
     monitor = i->second;
@@ -140,7 +140,7 @@
 {
   wakeupSomeone_ = true;
   stop_ = true;
-  for(MonitorMap::iterator i = seqidToMonitorMap_.begin(); i != seqidToMonitorMap_.end(); ++i)
+  for(auto i = seqidToMonitorMap_.begin(); i != seqidToMonitorMap_.end(); ++i)
     i->second->notify();
 }
 
diff --git a/lib/cpp/src/thrift/async/TEvhttpClientChannel.cpp b/lib/cpp/src/thrift/async/TEvhttpClientChannel.cpp
index 6af8104..7656596 100644
--- a/lib/cpp/src/thrift/async/TEvhttpClientChannel.cpp
+++ b/lib/cpp/src/thrift/async/TEvhttpClientChannel.cpp
@@ -41,15 +41,15 @@
                                            struct event_base* eb,
                                            struct evdns_base* dnsbase)
 
-  : host_(host), path_(path), conn_(NULL) {
+  : host_(host), path_(path), conn_(nullptr) {
   conn_ = evhttp_connection_base_new(eb, dnsbase, address, port);
-  if (conn_ == NULL) {
+  if (conn_ == nullptr) {
     throw TException("evhttp_connection_new failed");
   }
 }
 
 TEvhttpClientChannel::~TEvhttpClientChannel() {
-  if (conn_ != NULL) {
+  if (conn_ != nullptr) {
     evhttp_connection_free(conn_);
   }
 }
@@ -58,7 +58,7 @@
                                               apache::thrift::transport::TMemoryBuffer* sendBuf,
                                               apache::thrift::transport::TMemoryBuffer* recvBuf) {
   struct evhttp_request* req = evhttp_request_new(response, this);
-  if (req == NULL) {
+  if (req == nullptr) {
     throw TException("evhttp_request_new failed");
   }
 
@@ -110,7 +110,7 @@
   assert(!completionQueue_.empty());
   Completion completion = completionQueue_.front();
   completionQueue_.pop();
-  if (req == NULL) {
+  if (req == nullptr) {
     try {
       completion.first();
     } catch (const TTransportException& e) {
@@ -142,7 +142,7 @@
 }
 
 /* static */ void TEvhttpClientChannel::response(struct evhttp_request* req, void* arg) {
-  TEvhttpClientChannel* self = (TEvhttpClientChannel*)arg;
+  auto* self = (TEvhttpClientChannel*)arg;
   try {
     self->finish(req);
   } catch (std::exception& e) {
diff --git a/lib/cpp/src/thrift/async/TEvhttpClientChannel.h b/lib/cpp/src/thrift/async/TEvhttpClientChannel.h
index a321f41..f742726 100644
--- a/lib/cpp/src/thrift/async/TEvhttpClientChannel.h
+++ b/lib/cpp/src/thrift/async/TEvhttpClientChannel.h
@@ -52,24 +52,24 @@
                        const char* address,
                        int port,
                        struct event_base* eb,
-                       struct evdns_base *dnsbase = 0);
-  ~TEvhttpClientChannel();
+                       struct evdns_base *dnsbase = nullptr);
+  ~TEvhttpClientChannel() override;
 
-  virtual void sendAndRecvMessage(const VoidCallback& cob,
+  void sendAndRecvMessage(const VoidCallback& cob,
                                   apache::thrift::transport::TMemoryBuffer* sendBuf,
-                                  apache::thrift::transport::TMemoryBuffer* recvBuf);
+                                  apache::thrift::transport::TMemoryBuffer* recvBuf) override;
 
-  virtual void sendMessage(const VoidCallback& cob,
-                           apache::thrift::transport::TMemoryBuffer* message);
-  virtual void recvMessage(const VoidCallback& cob,
-                           apache::thrift::transport::TMemoryBuffer* message);
+  void sendMessage(const VoidCallback& cob,
+                           apache::thrift::transport::TMemoryBuffer* message) override;
+  void recvMessage(const VoidCallback& cob,
+                           apache::thrift::transport::TMemoryBuffer* message) override;
 
   void finish(struct evhttp_request* req);
 
   // XXX
-  virtual bool good() const { return true; }
-  virtual bool error() const { return false; }
-  virtual bool timedOut() const { return false; }
+  bool good() const override { return true; }
+  bool error() const override { return false; }
+  bool timedOut() const override { return false; }
 
 private:
   static void response(struct evhttp_request* req, void* arg);
diff --git a/lib/cpp/src/thrift/async/TEvhttpServer.cpp b/lib/cpp/src/thrift/async/TEvhttpServer.cpp
index bdc3266..7d2cf21 100644
--- a/lib/cpp/src/thrift/async/TEvhttpServer.cpp
+++ b/lib/cpp/src/thrift/async/TEvhttpServer.cpp
@@ -46,24 +46,24 @@
 };
 
 TEvhttpServer::TEvhttpServer(std::shared_ptr<TAsyncBufferProcessor> processor)
-  : processor_(processor), eb_(NULL), eh_(NULL) {
+  : processor_(processor), eb_(nullptr), eh_(nullptr) {
 }
 
 TEvhttpServer::TEvhttpServer(std::shared_ptr<TAsyncBufferProcessor> processor, int port)
-  : processor_(processor), eb_(NULL), eh_(NULL) {
+  : processor_(processor), eb_(nullptr), eh_(nullptr) {
   // Create event_base and evhttp.
   eb_ = event_base_new();
-  if (eb_ == NULL) {
+  if (eb_ == nullptr) {
     throw TException("event_base_new failed");
   }
   eh_ = evhttp_new(eb_);
-  if (eh_ == NULL) {
+  if (eh_ == nullptr) {
     event_base_free(eb_);
     throw TException("evhttp_new failed");
   }
 
   // Bind to port.
-  int ret = evhttp_bind_socket(eh_, NULL, port);
+  int ret = evhttp_bind_socket(eh_, nullptr, port);
   if (ret < 0) {
     evhttp_free(eh_);
     event_base_free(eb_);
@@ -77,16 +77,16 @@
 }
 
 TEvhttpServer::~TEvhttpServer() {
-  if (eh_ != NULL) {
+  if (eh_ != nullptr) {
     evhttp_free(eh_);
   }
-  if (eb_ != NULL) {
+  if (eb_ != nullptr) {
     event_base_free(eb_);
   }
 }
 
 int TEvhttpServer::serve() {
-  if (eb_ == NULL) {
+  if (eb_ == nullptr) {
     throw TException("Unexpected call to TEvhttpServer::serve");
   }
   return event_base_dispatch(eb_);
@@ -103,12 +103,12 @@
   try {
     static_cast<TEvhttpServer*>(self)->process(req);
   } catch (std::exception& e) {
-    evhttp_send_reply(req, HTTP_INTERNAL, e.what(), 0);
+    evhttp_send_reply(req, HTTP_INTERNAL, e.what(), nullptr);
   }
 }
 
 void TEvhttpServer::process(struct evhttp_request* req) {
-  RequestContext* ctx = new RequestContext(req);
+  auto* ctx = new RequestContext(req);
   return processor_->process(std::bind(&TEvhttpServer::complete,
                                                           this,
                                                           ctx,
@@ -131,7 +131,7 @@
   }
 
   struct evbuffer* buf = evbuffer_new();
-  if (buf == NULL) {
+  if (buf == nullptr) {
     // TODO: Log an error.
     std::cerr << "evbuffer_new failed " << __FILE__ << ":" << __LINE__ << std::endl;
   } else {
@@ -147,7 +147,7 @@
   }
 
   evhttp_send_reply(ctx->req, code, reason, buf);
-  if (buf != NULL) {
+  if (buf != nullptr) {
     evbuffer_free(buf);
   }
 }
diff --git a/lib/cpp/src/thrift/concurrency/Exception.h b/lib/cpp/src/thrift/concurrency/Exception.h
index 6438fda..947fc9f 100644
--- a/lib/cpp/src/thrift/concurrency/Exception.h
+++ b/lib/cpp/src/thrift/concurrency/Exception.h
@@ -35,7 +35,7 @@
 
 class IllegalStateException : public apache::thrift::TException {
 public:
-  IllegalStateException() {}
+  IllegalStateException() = default;
   IllegalStateException(const std::string& message) : TException(message) {}
 };
 
@@ -53,7 +53,7 @@
 
 class SystemResourceException : public apache::thrift::TException {
 public:
-  SystemResourceException() {}
+  SystemResourceException() = default;
 
   SystemResourceException(const std::string& message) : TException(message) {}
 };
diff --git a/lib/cpp/src/thrift/concurrency/FunctionRunner.h b/lib/cpp/src/thrift/concurrency/FunctionRunner.h
index 8ad176e..4688344 100644
--- a/lib/cpp/src/thrift/concurrency/FunctionRunner.h
+++ b/lib/cpp/src/thrift/concurrency/FunctionRunner.h
@@ -96,7 +96,7 @@
    */
   FunctionRunner(const BoolFunc& cob, int intervalMs) : repFunc_(cob), intervalMs_(intervalMs) {}
 
-  void run() {
+  void run() override {
     if (repFunc_) {
       while (repFunc_()) {
         THRIFT_SLEEP_USEC(intervalMs_ * 1000);
diff --git a/lib/cpp/src/thrift/concurrency/Monitor.cpp b/lib/cpp/src/thrift/concurrency/Monitor.cpp
index 99d52b3..dc92efd 100644
--- a/lib/cpp/src/thrift/concurrency/Monitor.cpp
+++ b/lib/cpp/src/thrift/concurrency/Monitor.cpp
@@ -41,11 +41,11 @@
 class Monitor::Impl {
 
 public:
-  Impl() : ownedMutex_(new Mutex()), conditionVariable_(), mutex_(NULL) { init(ownedMutex_.get()); }
+  Impl() : ownedMutex_(new Mutex()), conditionVariable_(), mutex_(nullptr) { init(ownedMutex_.get()); }
 
-  Impl(Mutex* mutex) : ownedMutex_(), conditionVariable_(), mutex_(NULL) { init(mutex); }
+  Impl(Mutex* mutex) : ownedMutex_(), conditionVariable_(), mutex_(nullptr) { init(mutex); }
 
-  Impl(Monitor* monitor) : ownedMutex_(), conditionVariable_(), mutex_(NULL) {
+  Impl(Monitor* monitor) : ownedMutex_(), conditionVariable_(), mutex_(nullptr) {
     init(&(monitor->mutex()));
   }
 
@@ -81,7 +81,7 @@
     }
 
     assert(mutex_);
-    std::timed_mutex* mutexImpl = static_cast<std::timed_mutex*>(mutex_->getUnderlyingImpl());
+    auto* mutexImpl = static_cast<std::timed_mutex*>(mutex_->getUnderlyingImpl());
     assert(mutexImpl);
 
     std::unique_lock<std::timed_mutex> lock(*mutexImpl, std::adopt_lock);
@@ -97,7 +97,7 @@
    */
   int waitForTime(const std::chrono::time_point<std::chrono::steady_clock>& abstime) {
     assert(mutex_);
-    std::timed_mutex* mutexImpl = static_cast<std::timed_mutex*>(mutex_->getUnderlyingImpl());
+    auto* mutexImpl = static_cast<std::timed_mutex*>(mutex_->getUnderlyingImpl());
     assert(mutexImpl);
 
     std::unique_lock<std::timed_mutex> lock(*mutexImpl, std::adopt_lock);
@@ -113,7 +113,7 @@
    */
   int waitForever() {
     assert(mutex_);
-    std::timed_mutex* mutexImpl = static_cast<std::timed_mutex*>(mutex_->getUnderlyingImpl());
+    auto* mutexImpl = static_cast<std::timed_mutex*>(mutex_->getUnderlyingImpl());
     assert(mutexImpl);
 
     std::unique_lock<std::timed_mutex> lock(*mutexImpl, std::adopt_lock);
diff --git a/lib/cpp/src/thrift/concurrency/Mutex.h b/lib/cpp/src/thrift/concurrency/Mutex.h
index 5e0f85b..27e386e 100644
--- a/lib/cpp/src/thrift/concurrency/Mutex.h
+++ b/lib/cpp/src/thrift/concurrency/Mutex.h
@@ -40,7 +40,7 @@
 class Mutex {
 public:
   Mutex();
-  virtual ~Mutex() {}
+  virtual ~Mutex() = default;
 
   virtual void lock() const;
   virtual bool trylock() const;
@@ -62,11 +62,11 @@
       value.lock();
     } else if (timeout < 0) {
       if (!value.trylock()) {
-        mutex_ = NULL;
+        mutex_ = nullptr;
       }
     } else {
       if (!value.timedlock(timeout)) {
-        mutex_ = NULL;
+        mutex_ = nullptr;
       }
     }
   }
@@ -76,7 +76,7 @@
     }
   }
 
-  operator bool() const { return (mutex_ != NULL); }
+  operator bool() const { return (mutex_ != nullptr); }
 
 private:
   const Mutex* mutex_;
diff --git a/lib/cpp/src/thrift/concurrency/Thread.h b/lib/cpp/src/thrift/concurrency/Thread.h
index f8a3f51..bced240 100644
--- a/lib/cpp/src/thrift/concurrency/Thread.h
+++ b/lib/cpp/src/thrift/concurrency/Thread.h
@@ -39,7 +39,7 @@
 class Runnable {
 
 public:
-  virtual ~Runnable(){};
+  virtual ~Runnable()= default;;
   virtual void run() = 0;
 
   /**
diff --git a/lib/cpp/src/thrift/concurrency/ThreadManager.cpp b/lib/cpp/src/thrift/concurrency/ThreadManager.cpp
index 4c7c372..c889660 100644
--- a/lib/cpp/src/thrift/concurrency/ThreadManager.cpp
+++ b/lib/cpp/src/thrift/concurrency/ThreadManager.cpp
@@ -64,19 +64,19 @@
       maxMonitor_(&mutex_),
       workerMonitor_(&mutex_) {}
 
-  ~Impl() { stop(); }
+  ~Impl() override { stop(); }
 
-  void start();
-  void stop();
+  void start() override;
+  void stop() override;
 
-  ThreadManager::STATE state() const { return state_; }
+  ThreadManager::STATE state() const override { return state_; }
 
-  shared_ptr<ThreadFactory> threadFactory() const {
+  shared_ptr<ThreadFactory> threadFactory() const override {
     Guard g(mutex_);
     return threadFactory_;
   }
 
-  void threadFactory(shared_ptr<ThreadFactory> value) {
+  void threadFactory(shared_ptr<ThreadFactory> value) override {
     Guard g(mutex_);
     if (threadFactory_ && threadFactory_->isDetached() != value->isDetached()) {
       throw InvalidArgumentException();
@@ -84,33 +84,33 @@
     threadFactory_ = value;
   }
 
-  void addWorker(size_t value);
+  void addWorker(size_t value) override;
 
-  void removeWorker(size_t value);
+  void removeWorker(size_t value) override;
 
-  size_t idleWorkerCount() const { return idleCount_; }
+  size_t idleWorkerCount() const override { return idleCount_; }
 
-  size_t workerCount() const {
+  size_t workerCount() const override {
     Guard g(mutex_);
     return workerCount_;
   }
 
-  size_t pendingTaskCount() const {
+  size_t pendingTaskCount() const override {
     Guard g(mutex_);
     return tasks_.size();
   }
 
-  size_t totalTaskCount() const {
+  size_t totalTaskCount() const override {
     Guard g(mutex_);
     return tasks_.size() + workerCount_ - idleCount_;
   }
 
-  size_t pendingTaskCountMax() const {
+  size_t pendingTaskCountMax() const override {
     Guard g(mutex_);
     return pendingTaskCountMax_;
   }
 
-  size_t expiredTaskCount() const {
+  size_t expiredTaskCount() const override {
     Guard g(mutex_);
     return expiredCount_;
   }
@@ -120,17 +120,17 @@
     pendingTaskCountMax_ = value;
   }
 
-  void add(shared_ptr<Runnable> value, int64_t timeout, int64_t expiration);
+  void add(shared_ptr<Runnable> value, int64_t timeout, int64_t expiration) override;
 
-  void remove(shared_ptr<Runnable> task);
+  void remove(shared_ptr<Runnable> task) override;
 
-  shared_ptr<Runnable> removeNextPending();
+  shared_ptr<Runnable> removeNextPending() override;
 
-  void removeExpiredTasks() {
+  void removeExpiredTasks() override {
     removeExpired(false);
   }
 
-  void setExpireCallback(ExpireCallback expireCallback);
+  void setExpireCallback(ExpireCallback expireCallback) override;
 
 private:
   /**
@@ -188,9 +188,9 @@
         }
     }
 
-  ~Task() {}
+  ~Task() override = default;
 
-  void run() {
+  void run() override {
     if (state_ == EXECUTING) {
       runnable_->run();
       state_ = COMPLETE;
@@ -214,7 +214,7 @@
 public:
   Worker(ThreadManager::Impl* manager) : manager_(manager), state_(UNINITIALIZED) {}
 
-  ~Worker() {}
+  ~Worker() override = default;
 
 private:
   bool isActive() const {
@@ -229,7 +229,7 @@
    * As long as worker thread is running, pull tasks off the task queue and
    * execute.
    */
-  void run() {
+  void run() override {
     Guard g(manager_->mutex_);
 
     /**
@@ -352,7 +352,7 @@
   workerMaxCount_ += value;
   workers_.insert(newThreads.begin(), newThreads.end());
 
-  for (std::set<shared_ptr<Thread> >::iterator ix = newThreads.begin(); ix != newThreads.end();
+  for (auto ix = newThreads.begin(); ix != newThreads.end();
        ++ix) {
     shared_ptr<ThreadManager::Worker> worker
         = dynamic_pointer_cast<ThreadManager::Worker, Runnable>((*ix)->runnable());
@@ -430,7 +430,7 @@
     workerMonitor_.wait();
   }
 
-  for (std::set<shared_ptr<Thread> >::iterator ix = deadWorkers_.begin();
+  for (auto ix = deadWorkers_.begin();
        ix != deadWorkers_.end();
        ++ix) {
 
@@ -497,7 +497,7 @@
         "started");
   }
 
-  for (TaskQueue::iterator it = tasks_.begin(); it != tasks_.end(); ++it)
+  for (auto it = tasks_.begin(); it != tasks_.end(); ++it)
   {
     if ((*it)->getRunnable() == task)
     {
@@ -532,7 +532,7 @@
   }
   auto now = std::chrono::steady_clock::now();
 
-  for (TaskQueue::iterator it = tasks_.begin(); it != tasks_.end(); )
+  for (auto it = tasks_.begin(); it != tasks_.end(); )
   {
     if ((*it)->getExpireTime() && *((*it)->getExpireTime()) < now) {
       if (expireCallback_) {
@@ -562,7 +562,7 @@
   SimpleThreadManager(size_t workerCount = 4, size_t pendingTaskCountMax = 0)
     : workerCount_(workerCount), pendingTaskCountMax_(pendingTaskCountMax) {}
 
-  void start() {
+  void start() override {
     ThreadManager::Impl::pendingTaskCountMax(pendingTaskCountMax_);
     ThreadManager::Impl::start();
     addWorker(workerCount_);
diff --git a/lib/cpp/src/thrift/concurrency/ThreadManager.h b/lib/cpp/src/thrift/concurrency/ThreadManager.h
index 605e363..7b202ca 100644
--- a/lib/cpp/src/thrift/concurrency/ThreadManager.h
+++ b/lib/cpp/src/thrift/concurrency/ThreadManager.h
@@ -55,12 +55,12 @@
 class ThreadManager {
 
 protected:
-  ThreadManager() {}
+  ThreadManager() = default;
 
 public:
   typedef std::function<void(std::shared_ptr<Runnable>)> ExpireCallback;
 
-  virtual ~ThreadManager() {}
+  virtual ~ThreadManager() = default;
 
   /**
    * Starts the thread manager. Verifies all attributes have been properly
diff --git a/lib/cpp/src/thrift/concurrency/TimerManager.cpp b/lib/cpp/src/thrift/concurrency/TimerManager.cpp
index edd336b..df59900 100644
--- a/lib/cpp/src/thrift/concurrency/TimerManager.cpp
+++ b/lib/cpp/src/thrift/concurrency/TimerManager.cpp
@@ -43,9 +43,9 @@
 
   Task(shared_ptr<Runnable> runnable) : runnable_(runnable), state_(WAITING) {}
 
-  ~Task() {}
+  ~Task() override = default;
 
-  void run() {
+  void run() override {
     if (state_ == EXECUTING) {
       runnable_->run();
       state_ = COMPLETE;
@@ -67,7 +67,7 @@
 public:
   Dispatcher(TimerManager* manager) : manager_(manager) {}
 
-  ~Dispatcher() {}
+  ~Dispatcher() override = default;
 
   /**
    * Dispatcher entry point
@@ -75,7 +75,7 @@
    * As long as dispatcher thread is running, pull tasks off the task taskMap_
    * and execute.
    */
-  void run() {
+  void run() override {
     {
       Synchronized s(manager_->monitor_);
       if (manager_->state_ == TimerManager::STARTING) {
@@ -108,7 +108,7 @@
         }
 
         if (manager_->state_ == TimerManager::STARTED) {
-          for (task_iterator ix = manager_->taskMap_.begin(); ix != expiredTaskEnd; ix++) {
+          for (auto ix = manager_->taskMap_.begin(); ix != expiredTaskEnd; ix++) {
             shared_ptr<TimerManager::Task> task = ix->second;
             expiredTasks.insert(task);
             task->it_ = manager_->taskMap_.end();
@@ -121,7 +121,7 @@
         }
       }
 
-      for (std::set<shared_ptr<Task> >::iterator ix = expiredTasks.begin();
+      for (auto ix = expiredTasks.begin();
            ix != expiredTasks.end();
            ++ix) {
         (*ix)->run();
@@ -221,7 +221,7 @@
     taskMap_.clear();
 
     // Remove dispatcher's reference to us.
-    dispatcher_->manager_ = NULL;
+    dispatcher_->manager_ = nullptr;
   }
 }
 
@@ -280,7 +280,7 @@
     throw IllegalStateException();
   }
   bool found = false;
-  for (task_iterator ix = taskMap_.begin(); ix != taskMap_.end();) {
+  for (auto ix = taskMap_.begin(); ix != taskMap_.end();) {
     if (*ix->second == task) {
       found = true;
       taskCount_--;
diff --git a/lib/cpp/src/thrift/processor/PeekProcessor.cpp b/lib/cpp/src/thrift/processor/PeekProcessor.cpp
index 07f6ba5..4cd58b8 100644
--- a/lib/cpp/src/thrift/processor/PeekProcessor.cpp
+++ b/lib/cpp/src/thrift/processor/PeekProcessor.cpp
@@ -31,8 +31,7 @@
   memoryBuffer_.reset(new TMemoryBuffer());
   targetTransport_ = memoryBuffer_;
 }
-PeekProcessor::~PeekProcessor() {
-}
+PeekProcessor::~PeekProcessor() = default;
 
 void PeekProcessor::initialize(std::shared_ptr<TProcessor> actualProcessor,
                                std::shared_ptr<TProtocolFactory> protocolFactory,
diff --git a/lib/cpp/src/thrift/processor/PeekProcessor.h b/lib/cpp/src/thrift/processor/PeekProcessor.h
index efac2b9..ae565fc 100644
--- a/lib/cpp/src/thrift/processor/PeekProcessor.h
+++ b/lib/cpp/src/thrift/processor/PeekProcessor.h
@@ -40,7 +40,7 @@
 
 public:
   PeekProcessor();
-  virtual ~PeekProcessor();
+  ~PeekProcessor() override;
 
   // Input here: actualProcessor  - the underlying processor
   //             protocolFactory  - the protocol factory used to wrap the memory buffer
@@ -56,9 +56,9 @@
 
   void setTargetTransport(std::shared_ptr<apache::thrift::transport::TTransport> targetTransport);
 
-  virtual bool process(std::shared_ptr<apache::thrift::protocol::TProtocol> in,
+  bool process(std::shared_ptr<apache::thrift::protocol::TProtocol> in,
                        std::shared_ptr<apache::thrift::protocol::TProtocol> out,
-                       void* connectionContext);
+                       void* connectionContext) override;
 
   // The following three functions can be overloaded by child classes to
   // achieve desired peeking behavior
diff --git a/lib/cpp/src/thrift/processor/TMultiplexedProcessor.h b/lib/cpp/src/thrift/processor/TMultiplexedProcessor.h
index 2aa7f75..85c0aff 100644
--- a/lib/cpp/src/thrift/processor/TMultiplexedProcessor.h
+++ b/lib/cpp/src/thrift/processor/TMultiplexedProcessor.h
@@ -42,7 +42,7 @@
                         const int32_t _seqid)
     : TProtocolDecorator(_protocol), name(_name), type(_type), seqid(_seqid) {}
 
-  uint32_t readMessageBegin_virt(std::string& _name, TMessageType& _type, int32_t& _seqid) {
+  uint32_t readMessageBegin_virt(std::string& _name, TMessageType& _type, int32_t& _seqid) override {
 
     _name = name;
     _type = type;
@@ -149,7 +149,7 @@
    */
   bool process(std::shared_ptr<protocol::TProtocol> in,
                std::shared_ptr<protocol::TProtocol> out,
-               void* connectionContext) {
+               void* connectionContext) override {
     std::string name;
     protocol::TMessageType type;
     int32_t seqid;
@@ -174,7 +174,7 @@
     // name and the name of the method to call.
     if (tokens.size() == 2) {
       // Search for a processor associated with this service name.
-      services_t::iterator it = services.find(tokens[0]);
+      auto it = services.find(tokens[0]);
 
       if (it != services.end()) {
         std::shared_ptr<TProcessor> processor = it->second;
diff --git a/lib/cpp/src/thrift/protocol/TBinaryProtocol.h b/lib/cpp/src/thrift/protocol/TBinaryProtocol.h
index 9067758..6bd5fb8 100644
--- a/lib/cpp/src/thrift/protocol/TBinaryProtocol.h
+++ b/lib/cpp/src/thrift/protocol/TBinaryProtocol.h
@@ -201,7 +201,7 @@
       strict_read_(strict_read),
       strict_write_(strict_write) {}
 
-  virtual ~TBinaryProtocolFactoryT() {}
+  ~TBinaryProtocolFactoryT() override = default;
 
   void setStringSizeLimit(int32_t string_limit) { string_limit_ = string_limit; }
 
@@ -212,7 +212,7 @@
     strict_write_ = strict_write;
   }
 
-  std::shared_ptr<TProtocol> getProtocol(std::shared_ptr<TTransport> trans) {
+  std::shared_ptr<TProtocol> getProtocol(std::shared_ptr<TTransport> trans) override {
     std::shared_ptr<Transport_> specific_trans = std::dynamic_pointer_cast<Transport_>(trans);
     TProtocol* prot;
     if (specific_trans) {
diff --git a/lib/cpp/src/thrift/protocol/TBinaryProtocol.tcc b/lib/cpp/src/thrift/protocol/TBinaryProtocol.tcc
index fe73992..2964f25 100644
--- a/lib/cpp/src/thrift/protocol/TBinaryProtocol.tcc
+++ b/lib/cpp/src/thrift/protocol/TBinaryProtocol.tcc
@@ -144,21 +144,21 @@
 
 template <class Transport_, class ByteOrder_>
 uint32_t TBinaryProtocolT<Transport_, ByteOrder_>::writeI16(const int16_t i16) {
-  int16_t net = (int16_t)ByteOrder_::toWire16(i16);
+  auto net = (int16_t)ByteOrder_::toWire16(i16);
   this->trans_->write((uint8_t*)&net, 2);
   return 2;
 }
 
 template <class Transport_, class ByteOrder_>
 uint32_t TBinaryProtocolT<Transport_, ByteOrder_>::writeI32(const int32_t i32) {
-  int32_t net = (int32_t)ByteOrder_::toWire32(i32);
+  auto net = (int32_t)ByteOrder_::toWire32(i32);
   this->trans_->write((uint8_t*)&net, 4);
   return 4;
 }
 
 template <class Transport_, class ByteOrder_>
 uint32_t TBinaryProtocolT<Transport_, ByteOrder_>::writeI64(const int64_t i64) {
-  int64_t net = (int64_t)ByteOrder_::toWire64(i64);
+  auto net = (int64_t)ByteOrder_::toWire64(i64);
   this->trans_->write((uint8_t*)&net, 8);
   return 8;
 }
@@ -168,7 +168,7 @@
   static_assert(sizeof(double) == sizeof(uint64_t), "sizeof(double) == sizeof(uint64_t)");
   static_assert(std::numeric_limits<double>::is_iec559, "std::numeric_limits<double>::is_iec559");
 
-  uint64_t bits = bitwise_cast<uint64_t>(dub);
+  auto bits = bitwise_cast<uint64_t>(dub);
   bits = ByteOrder_::toWire64(bits);
   this->trans_->write((uint8_t*)&bits, 8);
   return 8;
@@ -179,7 +179,7 @@
 uint32_t TBinaryProtocolT<Transport_, ByteOrder_>::writeString(const StrType& str) {
   if (str.size() > static_cast<size_t>((std::numeric_limits<int32_t>::max)()))
     throw TProtocolException(TProtocolException::SIZE_LIMIT);
-  uint32_t size = static_cast<uint32_t>(str.size());
+  auto size = static_cast<uint32_t>(str.size());
   uint32_t result = writeI32((int32_t)size);
   if (size > 0) {
     this->trans_->write((uint8_t*)str.data(), size);
@@ -437,7 +437,7 @@
   // Try to borrow first
   const uint8_t* borrow_buf;
   uint32_t got = size;
-  if ((borrow_buf = this->trans_->borrow(NULL, &got))) {
+  if ((borrow_buf = this->trans_->borrow(nullptr, &got))) {
     str.assign((const char*)borrow_buf, size);
     this->trans_->consume(size);
     return size;
diff --git a/lib/cpp/src/thrift/protocol/TCompactProtocol.h b/lib/cpp/src/thrift/protocol/TCompactProtocol.h
index 5cfb47d..2930aba 100644
--- a/lib/cpp/src/thrift/protocol/TCompactProtocol.h
+++ b/lib/cpp/src/thrift/protocol/TCompactProtocol.h
@@ -79,10 +79,10 @@
       trans_(trans.get()),
       lastFieldId_(0),
       string_limit_(0),
-      string_buf_(NULL),
+      string_buf_(nullptr),
       string_buf_size_(0),
       container_limit_(0) {
-    booleanField_.name = NULL;
+    booleanField_.name = nullptr;
     boolValue_.hasBoolValue = false;
   }
 
@@ -93,14 +93,14 @@
       trans_(trans.get()),
       lastFieldId_(0),
       string_limit_(string_limit),
-      string_buf_(NULL),
+      string_buf_(nullptr),
       string_buf_size_(0),
       container_limit_(container_limit) {
-    booleanField_.name = NULL;
+    booleanField_.name = nullptr;
     boolValue_.hasBoolValue = false;
   }
 
-  ~TCompactProtocolT() { free(string_buf_); }
+  ~TCompactProtocolT() override { free(string_buf_); }
 
   /**
    * Writing functions
@@ -233,13 +233,13 @@
   TCompactProtocolFactoryT(int32_t string_limit, int32_t container_limit)
     : string_limit_(string_limit), container_limit_(container_limit) {}
 
-  virtual ~TCompactProtocolFactoryT() {}
+  ~TCompactProtocolFactoryT() override = default;
 
   void setStringSizeLimit(int32_t string_limit) { string_limit_ = string_limit; }
 
   void setContainerSizeLimit(int32_t container_limit) { container_limit_ = container_limit; }
 
-  std::shared_ptr<TProtocol> getProtocol(std::shared_ptr<TTransport> trans) {
+  std::shared_ptr<TProtocol> getProtocol(std::shared_ptr<TTransport> trans) override {
     std::shared_ptr<Transport_> specific_trans = std::dynamic_pointer_cast<Transport_>(trans);
     TProtocol* prot;
     if (specific_trans) {
diff --git a/lib/cpp/src/thrift/protocol/TCompactProtocol.tcc b/lib/cpp/src/thrift/protocol/TCompactProtocol.tcc
index 8efec6e..d1e342e 100644
--- a/lib/cpp/src/thrift/protocol/TCompactProtocol.tcc
+++ b/lib/cpp/src/thrift/protocol/TCompactProtocol.tcc
@@ -198,7 +198,7 @@
 uint32_t TCompactProtocolT<Transport_>::writeBool(const bool value) {
   uint32_t wsize = 0;
 
-  if (booleanField_.name != NULL) {
+  if (booleanField_.name != nullptr) {
     // we haven't written the field header yet
     wsize
       += writeFieldBeginInternal(booleanField_.name,
@@ -207,7 +207,7 @@
                                  static_cast<int8_t>(value
                                                      ? detail::compact::CT_BOOLEAN_TRUE
                                                      : detail::compact::CT_BOOLEAN_FALSE));
-    booleanField_.name = NULL;
+    booleanField_.name = nullptr;
   } else {
     // we're not part of a field, so just write the value
     wsize
@@ -256,7 +256,7 @@
   static_assert(sizeof(double) == sizeof(uint64_t), "sizeof(double) == sizeof(uint64_t)");
   static_assert(std::numeric_limits<double>::is_iec559, "std::numeric_limits<double>::is_iec559");
 
-  uint64_t bits = bitwise_cast<uint64_t>(dub);
+  auto bits = bitwise_cast<uint64_t>(dub);
   bits = THRIFT_htolell(bits);
   trans_->write((uint8_t*)&bits, 8);
   return 8;
@@ -274,7 +274,7 @@
 uint32_t TCompactProtocolT<Transport_>::writeBinary(const std::string& str) {
   if(str.size() > (std::numeric_limits<uint32_t>::max)())
     throw TProtocolException(TProtocolException::SIZE_LIMIT);
-  uint32_t ssize = static_cast<uint32_t>(str.size());
+  auto ssize = static_cast<uint32_t>(str.size());
   uint32_t wsize = writeVarint32(ssize) ;
   // checking ssize + wsize > uint_max, but we don't want to overflow while checking for overflows.
   // transforming the check to ssize > uint_max - wsize
@@ -488,7 +488,7 @@
   }
 
   // mask off the 4 MSB of the type header. it could contain a field id delta.
-  int16_t modifier = (int16_t)(((uint8_t)byte & 0xf0) >> 4);
+  auto modifier = (int16_t)(((uint8_t)byte & 0xf0) >> 4);
   if (modifier == 0) {
     // not a delta, look ahead for the zigzag varint field id.
     rsize += readI16(fieldId);
@@ -695,9 +695,9 @@
   }
 
   // Use the heap here to prevent stack overflow for v. large strings
-  if (size > string_buf_size_ || string_buf_ == NULL) {
+  if (size > string_buf_size_ || string_buf_ == nullptr) {
     void* new_string_buf = std::realloc(string_buf_, (uint32_t)size);
-    if (new_string_buf == NULL) {
+    if (new_string_buf == nullptr) {
       throw std::bad_alloc();
     }
     string_buf_ = (uint8_t*)new_string_buf;
@@ -735,7 +735,7 @@
   const uint8_t* borrowed = trans_->borrow(buf, &buf_size);
 
   // Fast path.
-  if (borrowed != NULL) {
+  if (borrowed != nullptr) {
     while (true) {
       uint8_t byte = borrowed[rsize];
       rsize++;
diff --git a/lib/cpp/src/thrift/protocol/TDebugProtocol.h b/lib/cpp/src/thrift/protocol/TDebugProtocol.h
index c079624..41bb0d4 100644
--- a/lib/cpp/src/thrift/protocol/TDebugProtocol.h
+++ b/lib/cpp/src/thrift/protocol/TDebugProtocol.h
@@ -138,10 +138,10 @@
  */
 class TDebugProtocolFactory : public TProtocolFactory {
 public:
-  TDebugProtocolFactory() {}
-  virtual ~TDebugProtocolFactory() {}
+  TDebugProtocolFactory() = default;
+  ~TDebugProtocolFactory() override = default;
 
-  std::shared_ptr<TProtocol> getProtocol(std::shared_ptr<TTransport> trans) {
+  std::shared_ptr<TProtocol> getProtocol(std::shared_ptr<TTransport> trans) override {
     return std::shared_ptr<TProtocol>(new TDebugProtocol(trans));
   }
 };
@@ -159,7 +159,7 @@
 std::string ThriftDebugString(const ThriftStruct& ts) {
   using namespace apache::thrift::transport;
   using namespace apache::thrift::protocol;
-  TMemoryBuffer* buffer = new TMemoryBuffer;
+  auto* buffer = new TMemoryBuffer;
   std::shared_ptr<TTransport> trans(buffer);
   TDebugProtocol protocol(trans);
 
diff --git a/lib/cpp/src/thrift/protocol/THeaderProtocol.h b/lib/cpp/src/thrift/protocol/THeaderProtocol.h
index e5e2b65..0d50185 100644
--- a/lib/cpp/src/thrift/protocol/THeaderProtocol.h
+++ b/lib/cpp/src/thrift/protocol/THeaderProtocol.h
@@ -63,7 +63,7 @@
     resetProtocol();
   }
 
-  ~THeaderProtocol() {}
+  ~THeaderProtocol() override = default;
 
   /**
    * Functions to work with headers by calling into THeaderTransport
@@ -190,16 +190,16 @@
 
 class THeaderProtocolFactory : public TProtocolFactory {
 public:
-  virtual std::shared_ptr<TProtocol> getProtocol(std::shared_ptr<transport::TTransport> trans) {
-    THeaderProtocol* headerProtocol
+  std::shared_ptr<TProtocol> getProtocol(std::shared_ptr<transport::TTransport> trans) override {
+    auto* headerProtocol
         = new THeaderProtocol(trans, trans, T_BINARY_PROTOCOL);
     return std::shared_ptr<TProtocol>(headerProtocol);
   }
 
-  virtual std::shared_ptr<TProtocol> getProtocol(
+  std::shared_ptr<TProtocol> getProtocol(
       std::shared_ptr<transport::TTransport> inTrans,
-      std::shared_ptr<transport::TTransport> outTrans) {
-    THeaderProtocol* headerProtocol = new THeaderProtocol(inTrans, outTrans, T_BINARY_PROTOCOL);
+      std::shared_ptr<transport::TTransport> outTrans) override {
+    auto* headerProtocol = new THeaderProtocol(inTrans, outTrans, T_BINARY_PROTOCOL);
     return std::shared_ptr<TProtocol>(headerProtocol);
   }
 };
diff --git a/lib/cpp/src/thrift/protocol/TJSONProtocol.cpp b/lib/cpp/src/thrift/protocol/TJSONProtocol.cpp
index db407f2..dcd498f 100644
--- a/lib/cpp/src/thrift/protocol/TJSONProtocol.cpp
+++ b/lib/cpp/src/thrift/protocol/TJSONProtocol.cpp
@@ -303,9 +303,9 @@
 class TJSONContext {
 
 public:
-  TJSONContext(){};
+  TJSONContext()= default;;
 
-  virtual ~TJSONContext(){};
+  virtual ~TJSONContext()= default;;
 
   /**
    * Write context data to the transport. Default is to do nothing.
@@ -336,7 +336,7 @@
 public:
   JSONPairContext() : first_(true), colon_(true) {}
 
-  uint32_t write(TTransport& trans) {
+  uint32_t write(TTransport& trans) override {
     if (first_) {
       first_ = false;
       colon_ = true;
@@ -348,7 +348,7 @@
     }
   }
 
-  uint32_t read(TJSONProtocol::LookaheadReader& reader) {
+  uint32_t read(TJSONProtocol::LookaheadReader& reader) override {
     if (first_) {
       first_ = false;
       colon_ = true;
@@ -361,7 +361,7 @@
   }
 
   // Numbers must be turned into strings if they are the key part of a pair
-  virtual bool escapeNum() { return colon_; }
+  bool escapeNum() override { return colon_; }
 
 private:
   bool first_;
@@ -374,7 +374,7 @@
 public:
   JSONListContext() : first_(true) {}
 
-  uint32_t write(TTransport& trans) {
+  uint32_t write(TTransport& trans) override {
     if (first_) {
       first_ = false;
       return 0;
@@ -384,7 +384,7 @@
     }
   }
 
-  uint32_t read(TJSONProtocol::LookaheadReader& reader) {
+  uint32_t read(TJSONProtocol::LookaheadReader& reader) override {
     if (first_) {
       first_ = false;
       return 0;
@@ -404,8 +404,7 @@
     reader_(*ptrans) {
 }
 
-TJSONProtocol::~TJSONProtocol() {
-}
+TJSONProtocol::~TJSONProtocol() = default;
 
 void TJSONProtocol::pushContext(std::shared_ptr<TJSONContext> c) {
   contexts_.push(context_);
@@ -477,10 +476,10 @@
   result += 2; // For quotes
   trans_->write(&kJSONStringDelimiter, 1);
   uint8_t b[4];
-  const uint8_t* bytes = (const uint8_t*)str.c_str();
+  const auto* bytes = (const uint8_t*)str.c_str();
   if (str.length() > (std::numeric_limits<uint32_t>::max)())
     throw TProtocolException(TProtocolException::SIZE_LIMIT);
-  uint32_t len = static_cast<uint32_t>(str.length());
+  auto len = static_cast<uint32_t>(str.length());
   while (len >= 3) {
     // Encode 3 bytes at a time
     base64_encode(bytes, 3, b);
@@ -798,10 +797,10 @@
 uint32_t TJSONProtocol::readJSONBase64(std::string& str) {
   std::string tmp;
   uint32_t result = readJSONString(tmp);
-  uint8_t* b = (uint8_t*)tmp.c_str();
+  auto* b = (uint8_t*)tmp.c_str();
   if (tmp.length() > (std::numeric_limits<uint32_t>::max)())
     throw TProtocolException(TProtocolException::SIZE_LIMIT);
-  uint32_t len = static_cast<uint32_t>(tmp.length());
+  auto len = static_cast<uint32_t>(tmp.length());
   str.clear();
   // Ignore padding
   if (len >= 2)  {
@@ -1065,7 +1064,7 @@
 // readByte() must be handled properly because boost::lexical cast sees int8_t
 // as a text type instead of an integer type
 uint32_t TJSONProtocol::readByte(int8_t& byte) {
-  int16_t tmp = (int16_t)byte;
+  auto tmp = (int16_t)byte;
   uint32_t result = readJSONInteger(tmp);
   assert(tmp < 256);
   byte = (int8_t)tmp;
diff --git a/lib/cpp/src/thrift/protocol/TJSONProtocol.h b/lib/cpp/src/thrift/protocol/TJSONProtocol.h
index 9c2f872..020e61c 100644
--- a/lib/cpp/src/thrift/protocol/TJSONProtocol.h
+++ b/lib/cpp/src/thrift/protocol/TJSONProtocol.h
@@ -98,7 +98,7 @@
 public:
   TJSONProtocol(std::shared_ptr<TTransport> ptrans);
 
-  ~TJSONProtocol();
+  ~TJSONProtocol() override;
 
 private:
   void pushContext(std::shared_ptr<TJSONContext> c);
@@ -286,11 +286,11 @@
  */
 class TJSONProtocolFactory : public TProtocolFactory {
 public:
-  TJSONProtocolFactory() {}
+  TJSONProtocolFactory() = default;
 
-  virtual ~TJSONProtocolFactory() {}
+  ~TJSONProtocolFactory() override = default;
 
-  std::shared_ptr<TProtocol> getProtocol(std::shared_ptr<TTransport> trans) {
+  std::shared_ptr<TProtocol> getProtocol(std::shared_ptr<TTransport> trans) override {
     return std::shared_ptr<TProtocol>(new TJSONProtocol(trans));
   }
 };
@@ -308,7 +308,7 @@
 std::string ThriftJSONString(const ThriftStruct& ts) {
   using namespace apache::thrift::transport;
   using namespace apache::thrift::protocol;
-  TMemoryBuffer* buffer = new TMemoryBuffer;
+  auto* buffer = new TMemoryBuffer;
   std::shared_ptr<TTransport> trans(buffer);
   TJSONProtocol protocol(trans);
 
diff --git a/lib/cpp/src/thrift/protocol/TMultiplexedProtocol.h b/lib/cpp/src/thrift/protocol/TMultiplexedProtocol.h
index 94bd82e..0dc9605 100644
--- a/lib/cpp/src/thrift/protocol/TMultiplexedProtocol.h
+++ b/lib/cpp/src/thrift/protocol/TMultiplexedProtocol.h
@@ -69,7 +69,7 @@
    */
   TMultiplexedProtocol(shared_ptr<TProtocol> _protocol, const std::string& _serviceName)
     : TProtocolDecorator(_protocol), serviceName(_serviceName), separator(":") {}
-  virtual ~TMultiplexedProtocol() {}
+  ~TMultiplexedProtocol() override = default;
 
   /**
    * Prepends the service name to the function name, separated by TMultiplexedProtocol::SEPARATOR.
@@ -82,7 +82,7 @@
    */
   uint32_t writeMessageBegin_virt(const std::string& _name,
                                   const TMessageType _type,
-                                  const int32_t _seqid);
+                                  const int32_t _seqid) override;
 
 private:
   const std::string serviceName;
diff --git a/lib/cpp/src/thrift/protocol/TProtocol.cpp b/lib/cpp/src/thrift/protocol/TProtocol.cpp
index c378aca..b460455 100644
--- a/lib/cpp/src/thrift/protocol/TProtocol.cpp
+++ b/lib/cpp/src/thrift/protocol/TProtocol.cpp
@@ -23,11 +23,11 @@
 namespace thrift {
 namespace protocol {
 
-TProtocol::~TProtocol() {}
+TProtocol::~TProtocol() = default;
 uint32_t TProtocol::skip_virt(TType type) {
   return ::apache::thrift::protocol::skip(*this, type);
 }
 
-TProtocolFactory::~TProtocolFactory() {}
+TProtocolFactory::~TProtocolFactory() = default;
 
 }}} // apache::thrift::protocol
diff --git a/lib/cpp/src/thrift/protocol/TProtocol.h b/lib/cpp/src/thrift/protocol/TProtocol.h
index bbc6816..a38660f 100644
--- a/lib/cpp/src/thrift/protocol/TProtocol.h
+++ b/lib/cpp/src/thrift/protocol/TProtocol.h
@@ -583,7 +583,7 @@
   std::shared_ptr<TTransport> ptrans_;
 
 private:
-  TProtocol() {}
+  TProtocol() = default;
   uint32_t input_recursion_depth_;
   uint32_t output_recursion_depth_;
   uint32_t recursion_limit_;
@@ -594,7 +594,7 @@
  */
 class TProtocolFactory {
 public:
-  TProtocolFactory() {}
+  TProtocolFactory() = default;
 
   virtual ~TProtocolFactory();
 
diff --git a/lib/cpp/src/thrift/protocol/TProtocolDecorator.h b/lib/cpp/src/thrift/protocol/TProtocolDecorator.h
index 743a0f4..5258159 100644
--- a/lib/cpp/src/thrift/protocol/TProtocolDecorator.h
+++ b/lib/cpp/src/thrift/protocol/TProtocolDecorator.h
@@ -39,107 +39,107 @@
  */
 class TProtocolDecorator : public TProtocol {
 public:
-  virtual ~TProtocolDecorator() {}
+  ~TProtocolDecorator() override = default;
 
   // Desc: Initializes the protocol decorator object.
   TProtocolDecorator(shared_ptr<TProtocol> proto)
     : TProtocol(proto->getTransport()), protocol(proto) {}
 
-  virtual uint32_t writeMessageBegin_virt(const std::string& name,
+  uint32_t writeMessageBegin_virt(const std::string& name,
                                           const TMessageType messageType,
-                                          const int32_t seqid) {
+                                          const int32_t seqid) override {
     return protocol->writeMessageBegin(name, messageType, seqid);
   }
-  virtual uint32_t writeMessageEnd_virt() { return protocol->writeMessageEnd(); }
-  virtual uint32_t writeStructBegin_virt(const char* name) {
+  uint32_t writeMessageEnd_virt() override { return protocol->writeMessageEnd(); }
+  uint32_t writeStructBegin_virt(const char* name) override {
     return protocol->writeStructBegin(name);
   }
-  virtual uint32_t writeStructEnd_virt() { return protocol->writeStructEnd(); }
+  uint32_t writeStructEnd_virt() override { return protocol->writeStructEnd(); }
 
-  virtual uint32_t writeFieldBegin_virt(const char* name,
+  uint32_t writeFieldBegin_virt(const char* name,
                                         const TType fieldType,
-                                        const int16_t fieldId) {
+                                        const int16_t fieldId) override {
     return protocol->writeFieldBegin(name, fieldType, fieldId);
   }
 
-  virtual uint32_t writeFieldEnd_virt() { return protocol->writeFieldEnd(); }
-  virtual uint32_t writeFieldStop_virt() { return protocol->writeFieldStop(); }
+  uint32_t writeFieldEnd_virt() override { return protocol->writeFieldEnd(); }
+  uint32_t writeFieldStop_virt() override { return protocol->writeFieldStop(); }
 
-  virtual uint32_t writeMapBegin_virt(const TType keyType,
+  uint32_t writeMapBegin_virt(const TType keyType,
                                       const TType valType,
-                                      const uint32_t size) {
+                                      const uint32_t size) override {
     return protocol->writeMapBegin(keyType, valType, size);
   }
 
-  virtual uint32_t writeMapEnd_virt() { return protocol->writeMapEnd(); }
+  uint32_t writeMapEnd_virt() override { return protocol->writeMapEnd(); }
 
-  virtual uint32_t writeListBegin_virt(const TType elemType, const uint32_t size) {
+  uint32_t writeListBegin_virt(const TType elemType, const uint32_t size) override {
     return protocol->writeListBegin(elemType, size);
   }
-  virtual uint32_t writeListEnd_virt() { return protocol->writeListEnd(); }
+  uint32_t writeListEnd_virt() override { return protocol->writeListEnd(); }
 
-  virtual uint32_t writeSetBegin_virt(const TType elemType, const uint32_t size) {
+  uint32_t writeSetBegin_virt(const TType elemType, const uint32_t size) override {
     return protocol->writeSetBegin(elemType, size);
   }
-  virtual uint32_t writeSetEnd_virt() { return protocol->writeSetEnd(); }
+  uint32_t writeSetEnd_virt() override { return protocol->writeSetEnd(); }
 
-  virtual uint32_t writeBool_virt(const bool value) { return protocol->writeBool(value); }
-  virtual uint32_t writeByte_virt(const int8_t byte) { return protocol->writeByte(byte); }
-  virtual uint32_t writeI16_virt(const int16_t i16) { return protocol->writeI16(i16); }
-  virtual uint32_t writeI32_virt(const int32_t i32) { return protocol->writeI32(i32); }
-  virtual uint32_t writeI64_virt(const int64_t i64) { return protocol->writeI64(i64); }
+  uint32_t writeBool_virt(const bool value) override { return protocol->writeBool(value); }
+  uint32_t writeByte_virt(const int8_t byte) override { return protocol->writeByte(byte); }
+  uint32_t writeI16_virt(const int16_t i16) override { return protocol->writeI16(i16); }
+  uint32_t writeI32_virt(const int32_t i32) override { return protocol->writeI32(i32); }
+  uint32_t writeI64_virt(const int64_t i64) override { return protocol->writeI64(i64); }
 
-  virtual uint32_t writeDouble_virt(const double dub) { return protocol->writeDouble(dub); }
-  virtual uint32_t writeString_virt(const std::string& str) { return protocol->writeString(str); }
-  virtual uint32_t writeBinary_virt(const std::string& str) { return protocol->writeBinary(str); }
+  uint32_t writeDouble_virt(const double dub) override { return protocol->writeDouble(dub); }
+  uint32_t writeString_virt(const std::string& str) override { return protocol->writeString(str); }
+  uint32_t writeBinary_virt(const std::string& str) override { return protocol->writeBinary(str); }
 
-  virtual uint32_t readMessageBegin_virt(std::string& name,
+  uint32_t readMessageBegin_virt(std::string& name,
                                          TMessageType& messageType,
-                                         int32_t& seqid) {
+                                         int32_t& seqid) override {
     return protocol->readMessageBegin(name, messageType, seqid);
   }
-  virtual uint32_t readMessageEnd_virt() { return protocol->readMessageEnd(); }
+  uint32_t readMessageEnd_virt() override { return protocol->readMessageEnd(); }
 
-  virtual uint32_t readStructBegin_virt(std::string& name) {
+  uint32_t readStructBegin_virt(std::string& name) override {
     return protocol->readStructBegin(name);
   }
-  virtual uint32_t readStructEnd_virt() { return protocol->readStructEnd(); }
+  uint32_t readStructEnd_virt() override { return protocol->readStructEnd(); }
 
-  virtual uint32_t readFieldBegin_virt(std::string& name, TType& fieldType, int16_t& fieldId) {
+  uint32_t readFieldBegin_virt(std::string& name, TType& fieldType, int16_t& fieldId) override {
     return protocol->readFieldBegin(name, fieldType, fieldId);
   }
-  virtual uint32_t readFieldEnd_virt() { return protocol->readFieldEnd(); }
+  uint32_t readFieldEnd_virt() override { return protocol->readFieldEnd(); }
 
-  virtual uint32_t readMapBegin_virt(TType& keyType, TType& valType, uint32_t& size) {
+  uint32_t readMapBegin_virt(TType& keyType, TType& valType, uint32_t& size) override {
     return protocol->readMapBegin(keyType, valType, size);
   }
-  virtual uint32_t readMapEnd_virt() { return protocol->readMapEnd(); }
+  uint32_t readMapEnd_virt() override { return protocol->readMapEnd(); }
 
-  virtual uint32_t readListBegin_virt(TType& elemType, uint32_t& size) {
+  uint32_t readListBegin_virt(TType& elemType, uint32_t& size) override {
     return protocol->readListBegin(elemType, size);
   }
-  virtual uint32_t readListEnd_virt() { return protocol->readListEnd(); }
+  uint32_t readListEnd_virt() override { return protocol->readListEnd(); }
 
-  virtual uint32_t readSetBegin_virt(TType& elemType, uint32_t& size) {
+  uint32_t readSetBegin_virt(TType& elemType, uint32_t& size) override {
     return protocol->readSetBegin(elemType, size);
   }
-  virtual uint32_t readSetEnd_virt() { return protocol->readSetEnd(); }
+  uint32_t readSetEnd_virt() override { return protocol->readSetEnd(); }
 
-  virtual uint32_t readBool_virt(bool& value) { return protocol->readBool(value); }
-  virtual uint32_t readBool_virt(std::vector<bool>::reference value) {
+  uint32_t readBool_virt(bool& value) override { return protocol->readBool(value); }
+  uint32_t readBool_virt(std::vector<bool>::reference value) override {
     return protocol->readBool(value);
   }
 
-  virtual uint32_t readByte_virt(int8_t& byte) { return protocol->readByte(byte); }
+  uint32_t readByte_virt(int8_t& byte) override { return protocol->readByte(byte); }
 
-  virtual uint32_t readI16_virt(int16_t& i16) { return protocol->readI16(i16); }
-  virtual uint32_t readI32_virt(int32_t& i32) { return protocol->readI32(i32); }
-  virtual uint32_t readI64_virt(int64_t& i64) { return protocol->readI64(i64); }
+  uint32_t readI16_virt(int16_t& i16) override { return protocol->readI16(i16); }
+  uint32_t readI32_virt(int32_t& i32) override { return protocol->readI32(i32); }
+  uint32_t readI64_virt(int64_t& i64) override { return protocol->readI64(i64); }
 
-  virtual uint32_t readDouble_virt(double& dub) { return protocol->readDouble(dub); }
+  uint32_t readDouble_virt(double& dub) override { return protocol->readDouble(dub); }
 
-  virtual uint32_t readString_virt(std::string& str) { return protocol->readString(str); }
-  virtual uint32_t readBinary_virt(std::string& str) { return protocol->readBinary(str); }
+  uint32_t readString_virt(std::string& str) override { return protocol->readString(str); }
+  uint32_t readBinary_virt(std::string& str) override { return protocol->readBinary(str); }
 
 private:
   shared_ptr<TProtocol> protocol;
diff --git a/lib/cpp/src/thrift/protocol/TProtocolException.h b/lib/cpp/src/thrift/protocol/TProtocolException.h
index 10178e1..3d44365 100644
--- a/lib/cpp/src/thrift/protocol/TProtocolException.h
+++ b/lib/cpp/src/thrift/protocol/TProtocolException.h
@@ -59,7 +59,7 @@
   TProtocolException(TProtocolExceptionType type, const std::string& message)
     : apache::thrift::TException(message), type_(type) {}
 
-  virtual ~TProtocolException() noexcept {}
+  ~TProtocolException() noexcept override = default;
 
   /**
    * Returns an error code that provides information about the type of error
@@ -69,7 +69,7 @@
    */
   TProtocolExceptionType getType() const { return type_; }
 
-  virtual const char* what() const noexcept {
+  const char* what() const noexcept override {
     if (message_.empty()) {
       switch (type_) {
       case UNKNOWN:
diff --git a/lib/cpp/src/thrift/protocol/TVirtualProtocol.h b/lib/cpp/src/thrift/protocol/TVirtualProtocol.h
index 4eea579..b7fe929 100644
--- a/lib/cpp/src/thrift/protocol/TVirtualProtocol.h
+++ b/lib/cpp/src/thrift/protocol/TVirtualProtocol.h
@@ -315,81 +315,81 @@
    * Writing functions.
    */
 
-  virtual uint32_t writeMessageBegin_virt(const std::string& name,
+  uint32_t writeMessageBegin_virt(const std::string& name,
                                           const TMessageType messageType,
-                                          const int32_t seqid) {
+                                          const int32_t seqid) override {
     return static_cast<Protocol_*>(this)->writeMessageBegin(name, messageType, seqid);
   }
 
-  virtual uint32_t writeMessageEnd_virt() {
+  uint32_t writeMessageEnd_virt() override {
     return static_cast<Protocol_*>(this)->writeMessageEnd();
   }
 
-  virtual uint32_t writeStructBegin_virt(const char* name) {
+  uint32_t writeStructBegin_virt(const char* name) override {
     return static_cast<Protocol_*>(this)->writeStructBegin(name);
   }
 
-  virtual uint32_t writeStructEnd_virt() { return static_cast<Protocol_*>(this)->writeStructEnd(); }
+  uint32_t writeStructEnd_virt() override { return static_cast<Protocol_*>(this)->writeStructEnd(); }
 
-  virtual uint32_t writeFieldBegin_virt(const char* name,
+  uint32_t writeFieldBegin_virt(const char* name,
                                         const TType fieldType,
-                                        const int16_t fieldId) {
+                                        const int16_t fieldId) override {
     return static_cast<Protocol_*>(this)->writeFieldBegin(name, fieldType, fieldId);
   }
 
-  virtual uint32_t writeFieldEnd_virt() { return static_cast<Protocol_*>(this)->writeFieldEnd(); }
+  uint32_t writeFieldEnd_virt() override { return static_cast<Protocol_*>(this)->writeFieldEnd(); }
 
-  virtual uint32_t writeFieldStop_virt() { return static_cast<Protocol_*>(this)->writeFieldStop(); }
+  uint32_t writeFieldStop_virt() override { return static_cast<Protocol_*>(this)->writeFieldStop(); }
 
-  virtual uint32_t writeMapBegin_virt(const TType keyType,
+  uint32_t writeMapBegin_virt(const TType keyType,
                                       const TType valType,
-                                      const uint32_t size) {
+                                      const uint32_t size) override {
     return static_cast<Protocol_*>(this)->writeMapBegin(keyType, valType, size);
   }
 
-  virtual uint32_t writeMapEnd_virt() { return static_cast<Protocol_*>(this)->writeMapEnd(); }
+  uint32_t writeMapEnd_virt() override { return static_cast<Protocol_*>(this)->writeMapEnd(); }
 
-  virtual uint32_t writeListBegin_virt(const TType elemType, const uint32_t size) {
+  uint32_t writeListBegin_virt(const TType elemType, const uint32_t size) override {
     return static_cast<Protocol_*>(this)->writeListBegin(elemType, size);
   }
 
-  virtual uint32_t writeListEnd_virt() { return static_cast<Protocol_*>(this)->writeListEnd(); }
+  uint32_t writeListEnd_virt() override { return static_cast<Protocol_*>(this)->writeListEnd(); }
 
-  virtual uint32_t writeSetBegin_virt(const TType elemType, const uint32_t size) {
+  uint32_t writeSetBegin_virt(const TType elemType, const uint32_t size) override {
     return static_cast<Protocol_*>(this)->writeSetBegin(elemType, size);
   }
 
-  virtual uint32_t writeSetEnd_virt() { return static_cast<Protocol_*>(this)->writeSetEnd(); }
+  uint32_t writeSetEnd_virt() override { return static_cast<Protocol_*>(this)->writeSetEnd(); }
 
-  virtual uint32_t writeBool_virt(const bool value) {
+  uint32_t writeBool_virt(const bool value) override {
     return static_cast<Protocol_*>(this)->writeBool(value);
   }
 
-  virtual uint32_t writeByte_virt(const int8_t byte) {
+  uint32_t writeByte_virt(const int8_t byte) override {
     return static_cast<Protocol_*>(this)->writeByte(byte);
   }
 
-  virtual uint32_t writeI16_virt(const int16_t i16) {
+  uint32_t writeI16_virt(const int16_t i16) override {
     return static_cast<Protocol_*>(this)->writeI16(i16);
   }
 
-  virtual uint32_t writeI32_virt(const int32_t i32) {
+  uint32_t writeI32_virt(const int32_t i32) override {
     return static_cast<Protocol_*>(this)->writeI32(i32);
   }
 
-  virtual uint32_t writeI64_virt(const int64_t i64) {
+  uint32_t writeI64_virt(const int64_t i64) override {
     return static_cast<Protocol_*>(this)->writeI64(i64);
   }
 
-  virtual uint32_t writeDouble_virt(const double dub) {
+  uint32_t writeDouble_virt(const double dub) override {
     return static_cast<Protocol_*>(this)->writeDouble(dub);
   }
 
-  virtual uint32_t writeString_virt(const std::string& str) {
+  uint32_t writeString_virt(const std::string& str) override {
     return static_cast<Protocol_*>(this)->writeString(str);
   }
 
-  virtual uint32_t writeBinary_virt(const std::string& str) {
+  uint32_t writeBinary_virt(const std::string& str) override {
     return static_cast<Protocol_*>(this)->writeBinary(str);
   }
 
@@ -397,81 +397,81 @@
    * Reading functions
    */
 
-  virtual uint32_t readMessageBegin_virt(std::string& name,
+  uint32_t readMessageBegin_virt(std::string& name,
                                          TMessageType& messageType,
-                                         int32_t& seqid) {
+                                         int32_t& seqid) override {
     return static_cast<Protocol_*>(this)->readMessageBegin(name, messageType, seqid);
   }
 
-  virtual uint32_t readMessageEnd_virt() { return static_cast<Protocol_*>(this)->readMessageEnd(); }
+  uint32_t readMessageEnd_virt() override { return static_cast<Protocol_*>(this)->readMessageEnd(); }
 
-  virtual uint32_t readStructBegin_virt(std::string& name) {
+  uint32_t readStructBegin_virt(std::string& name) override {
     return static_cast<Protocol_*>(this)->readStructBegin(name);
   }
 
-  virtual uint32_t readStructEnd_virt() { return static_cast<Protocol_*>(this)->readStructEnd(); }
+  uint32_t readStructEnd_virt() override { return static_cast<Protocol_*>(this)->readStructEnd(); }
 
-  virtual uint32_t readFieldBegin_virt(std::string& name, TType& fieldType, int16_t& fieldId) {
+  uint32_t readFieldBegin_virt(std::string& name, TType& fieldType, int16_t& fieldId) override {
     return static_cast<Protocol_*>(this)->readFieldBegin(name, fieldType, fieldId);
   }
 
-  virtual uint32_t readFieldEnd_virt() { return static_cast<Protocol_*>(this)->readFieldEnd(); }
+  uint32_t readFieldEnd_virt() override { return static_cast<Protocol_*>(this)->readFieldEnd(); }
 
-  virtual uint32_t readMapBegin_virt(TType& keyType, TType& valType, uint32_t& size) {
+  uint32_t readMapBegin_virt(TType& keyType, TType& valType, uint32_t& size) override {
     return static_cast<Protocol_*>(this)->readMapBegin(keyType, valType, size);
   }
 
-  virtual uint32_t readMapEnd_virt() { return static_cast<Protocol_*>(this)->readMapEnd(); }
+  uint32_t readMapEnd_virt() override { return static_cast<Protocol_*>(this)->readMapEnd(); }
 
-  virtual uint32_t readListBegin_virt(TType& elemType, uint32_t& size) {
+  uint32_t readListBegin_virt(TType& elemType, uint32_t& size) override {
     return static_cast<Protocol_*>(this)->readListBegin(elemType, size);
   }
 
-  virtual uint32_t readListEnd_virt() { return static_cast<Protocol_*>(this)->readListEnd(); }
+  uint32_t readListEnd_virt() override { return static_cast<Protocol_*>(this)->readListEnd(); }
 
-  virtual uint32_t readSetBegin_virt(TType& elemType, uint32_t& size) {
+  uint32_t readSetBegin_virt(TType& elemType, uint32_t& size) override {
     return static_cast<Protocol_*>(this)->readSetBegin(elemType, size);
   }
 
-  virtual uint32_t readSetEnd_virt() { return static_cast<Protocol_*>(this)->readSetEnd(); }
+  uint32_t readSetEnd_virt() override { return static_cast<Protocol_*>(this)->readSetEnd(); }
 
-  virtual uint32_t readBool_virt(bool& value) {
+  uint32_t readBool_virt(bool& value) override {
     return static_cast<Protocol_*>(this)->readBool(value);
   }
 
-  virtual uint32_t readBool_virt(std::vector<bool>::reference value) {
+  uint32_t readBool_virt(std::vector<bool>::reference value) override {
     return static_cast<Protocol_*>(this)->readBool(value);
   }
 
-  virtual uint32_t readByte_virt(int8_t& byte) {
+  uint32_t readByte_virt(int8_t& byte) override {
     return static_cast<Protocol_*>(this)->readByte(byte);
   }
 
-  virtual uint32_t readI16_virt(int16_t& i16) {
+  uint32_t readI16_virt(int16_t& i16) override {
     return static_cast<Protocol_*>(this)->readI16(i16);
   }
 
-  virtual uint32_t readI32_virt(int32_t& i32) {
+  uint32_t readI32_virt(int32_t& i32) override {
     return static_cast<Protocol_*>(this)->readI32(i32);
   }
 
-  virtual uint32_t readI64_virt(int64_t& i64) {
+  uint32_t readI64_virt(int64_t& i64) override {
     return static_cast<Protocol_*>(this)->readI64(i64);
   }
 
-  virtual uint32_t readDouble_virt(double& dub) {
+  uint32_t readDouble_virt(double& dub) override {
     return static_cast<Protocol_*>(this)->readDouble(dub);
   }
 
-  virtual uint32_t readString_virt(std::string& str) {
+  uint32_t readString_virt(std::string& str) override {
     return static_cast<Protocol_*>(this)->readString(str);
   }
 
-  virtual uint32_t readBinary_virt(std::string& str) {
+  uint32_t readBinary_virt(std::string& str) override {
     return static_cast<Protocol_*>(this)->readBinary(str);
   }
 
-  virtual uint32_t skip_virt(TType type) { return static_cast<Protocol_*>(this)->skip(type); }
+  uint32_t skip_virt(TType type) override { return static_cast<Protocol_*>(this)->skip(type); }
 
   /*
    * Provide a default skip() implementation that uses non-virtual read
@@ -484,7 +484,7 @@
    * correct parent implementation, if desired.
    */
   uint32_t skip(TType type) {
-    Protocol_* const prot = static_cast<Protocol_*>(this);
+    auto* const prot = static_cast<Protocol_*>(this);
     return ::apache::thrift::protocol::skip(*prot, type);
   }
 
diff --git a/lib/cpp/src/thrift/qt/TQIODeviceTransport.cpp b/lib/cpp/src/thrift/qt/TQIODeviceTransport.cpp
index f77c993..78c3b39 100644
--- a/lib/cpp/src/thrift/qt/TQIODeviceTransport.cpp
+++ b/lib/cpp/src/thrift/qt/TQIODeviceTransport.cpp
@@ -157,7 +157,7 @@
 uint8_t* TQIODeviceTransport::borrow(uint8_t* buf, uint32_t* len) {
   (void)buf;
   (void)len;
-  return NULL;
+  return nullptr;
 }
 
 void TQIODeviceTransport::consume(uint32_t len) {
diff --git a/lib/cpp/src/thrift/qt/TQIODeviceTransport.h b/lib/cpp/src/thrift/qt/TQIODeviceTransport.h
index 91ce8d5..e0cdd18 100644
--- a/lib/cpp/src/thrift/qt/TQIODeviceTransport.h
+++ b/lib/cpp/src/thrift/qt/TQIODeviceTransport.h
@@ -37,12 +37,12 @@
     : public apache::thrift::transport::TVirtualTransport<TQIODeviceTransport> {
 public:
   explicit TQIODeviceTransport(std::shared_ptr<QIODevice> dev);
-  virtual ~TQIODeviceTransport();
+  ~TQIODeviceTransport() override;
 
-  void open();
+  void open() override;
   bool isOpen();
-  bool peek();
-  void close();
+  bool peek() override;
+  void close() override;
 
   uint32_t readAll(uint8_t* buf, uint32_t len);
   uint32_t read(uint8_t* buf, uint32_t len);
@@ -50,7 +50,7 @@
   void write(const uint8_t* buf, uint32_t len);
   uint32_t write_partial(const uint8_t* buf, uint32_t len);
 
-  void flush();
+  void flush() override;
 
   uint8_t* borrow(uint8_t* buf, uint32_t* len);
   void consume(uint32_t len);
diff --git a/lib/cpp/src/thrift/qt/TQTcpServer.cpp b/lib/cpp/src/thrift/qt/TQTcpServer.cpp
index 99aad07..bd39893 100644
--- a/lib/cpp/src/thrift/qt/TQTcpServer.cpp
+++ b/lib/cpp/src/thrift/qt/TQTcpServer.cpp
@@ -67,8 +67,7 @@
   connect(server.get(), SIGNAL(newConnection()), SLOT(processIncoming()));
 }
 
-TQTcpServer::~TQTcpServer() {
-}
+TQTcpServer::~TQTcpServer() = default;
 
 void TQTcpServer::processIncoming() {
   while (server_->hasPendingConnections()) {
@@ -100,7 +99,7 @@
 }
 
 void TQTcpServer::beginDecode() {
-  QTcpSocket* connection(qobject_cast<QTcpSocket*>(sender()));
+  auto* connection(qobject_cast<QTcpSocket*>(sender()));
   Q_ASSERT(connection);
 
   if (ctxMap_.find(connection) == ctxMap_.end()) {
@@ -125,7 +124,7 @@
 }
 
 void TQTcpServer::socketClosed() {
-  QTcpSocket* connection(qobject_cast<QTcpSocket*>(sender()));
+  auto* connection(qobject_cast<QTcpSocket*>(sender()));
   Q_ASSERT(connection);
   scheduleDeleteConnectionContext(connection);
 }
diff --git a/lib/cpp/src/thrift/qt/TQTcpServer.h b/lib/cpp/src/thrift/qt/TQTcpServer.h
index 8e3fe3a..25994ab 100644
--- a/lib/cpp/src/thrift/qt/TQTcpServer.h
+++ b/lib/cpp/src/thrift/qt/TQTcpServer.h
@@ -50,8 +50,8 @@
   TQTcpServer(std::shared_ptr<QTcpServer> server,
               std::shared_ptr<TAsyncProcessor> processor,
               std::shared_ptr<apache::thrift::protocol::TProtocolFactory> protocolFactory,
-              QObject* parent = NULL);
-  virtual ~TQTcpServer();
+              QObject* parent = nullptr);
+  ~TQTcpServer() override;
 
 private Q_SLOTS:
   void processIncoming();
diff --git a/lib/cpp/src/thrift/server/TConnectedClient.cpp b/lib/cpp/src/thrift/server/TConnectedClient.cpp
index acdaa77..9a78e3e 100644
--- a/lib/cpp/src/thrift/server/TConnectedClient.cpp
+++ b/lib/cpp/src/thrift/server/TConnectedClient.cpp
@@ -42,11 +42,10 @@
     outputProtocol_(outputProtocol),
     eventHandler_(eventHandler),
     client_(client),
-    opaqueContext_(0) {
+    opaqueContext_(nullptr) {
 }
 
-TConnectedClient::~TConnectedClient() {
-}
+TConnectedClient::~TConnectedClient() = default;
 
 void TConnectedClient::run() {
   if (eventHandler_) {
diff --git a/lib/cpp/src/thrift/server/TConnectedClient.h b/lib/cpp/src/thrift/server/TConnectedClient.h
index 19e70c1..071571a 100644
--- a/lib/cpp/src/thrift/server/TConnectedClient.h
+++ b/lib/cpp/src/thrift/server/TConnectedClient.h
@@ -58,7 +58,7 @@
   /**
    * Destructor.
    */
-  virtual ~TConnectedClient();
+  ~TConnectedClient() override;
 
   /**
    * Drive the client until it is done.
@@ -76,7 +76,7 @@
    *              handle unexpected exceptions by logging
    *            cleanup()
    */
-  virtual void run() /* override */;
+  void run() override /* override */;
 
 protected:
   /**
diff --git a/lib/cpp/src/thrift/server/TNonblockingServer.cpp b/lib/cpp/src/thrift/server/TNonblockingServer.cpp
index bee3e3b..4e62324 100644
--- a/lib/cpp/src/thrift/server/TNonblockingServer.cpp
+++ b/lib/cpp/src/thrift/server/TNonblockingServer.cpp
@@ -215,7 +215,7 @@
   /// Constructor
   TConnection(std::shared_ptr<TSocket> socket,
               TNonblockingIOThread* ioThread) {
-    readBuffer_ = NULL;
+    readBuffer_ = nullptr;
     readBufferSize_ = 0;
 
     ioThread_ = ioThread;
@@ -327,7 +327,7 @@
       serverEventHandler_(connection_->getServerEventHandler()),
       connectionContext_(connection_->getConnectionContext()) {}
 
-  void run() {
+  void run() override {
     try {
       for (;;) {
         if (serverEventHandler_) {
@@ -380,7 +380,7 @@
   readBufferPos_ = 0;
   readWant_ = 0;
 
-  writeBuffer_ = NULL;
+  writeBuffer_ = nullptr;
   writeBufferSize_ = 0;
   writeBufferPos_ = 0;
   largestWriteBufferSize_ = 0;
@@ -407,7 +407,7 @@
   if (serverEventHandler_) {
     connectionContext_ = serverEventHandler_->createContext(inputProtocol_, outputProtocol_);
   } else {
-    connectionContext_ = NULL;
+    connectionContext_ = nullptr;
   }
 
   // Get the processor
@@ -570,7 +570,7 @@
   // Currently if there is no output protocol factory,
   // we assume header transport (without having to create
   // a new transport and check)
-  return getOutputProtocolFactory() == NULL;
+  return getOutputProtocolFactory() == nullptr;
 }
 
 /**
@@ -687,7 +687,7 @@
       socketState_ = SOCKET_SEND;
 
       // Put the frame size into the write buffer
-      int32_t frameSize = (int32_t)htonl(writeBufferSize_ - 4);
+      auto frameSize = (int32_t)htonl(writeBufferSize_ - 4);
       memcpy(writeBuffer_, &frameSize, 4);
 
       // Socket into write mode
@@ -720,7 +720,7 @@
   case APP_INIT:
 
     // Clear write buffer variables
-    writeBuffer_ = NULL;
+    writeBuffer_ = nullptr;
     writeBufferPos_ = 0;
     writeBufferSize_ = 0;
 
@@ -749,8 +749,8 @@
         newSize *= 2;
       }
 
-      uint8_t* newBuffer = (uint8_t*)std::realloc(readBuffer_, newSize);
-      if (newBuffer == NULL) {
+      auto* newBuffer = (uint8_t*)std::realloc(readBuffer_, newSize);
+      if (newBuffer == nullptr) {
         // nothing else to be done...
         throw std::bad_alloc();
       }
@@ -829,7 +829,7 @@
   event_base_set(ioThread_->getEventBase(), &event_);
 
   // Add the event
-  if (event_add(&event_, 0) == -1) {
+  if (event_add(&event_, nullptr) == -1) {
     GlobalOutput.perror("TConnection::setFlags(): could not event_add", THRIFT_GET_SOCKET_ERROR);
   }
 }
@@ -843,7 +843,7 @@
   if (serverEventHandler_) {
     serverEventHandler_->deleteContext(connectionContext_, inputProtocol_, outputProtocol_);
   }
-  ioThread_ = NULL;
+  ioThread_ = nullptr;
 
   // Close the socket
   tSocket_->close();
@@ -862,7 +862,7 @@
 void TNonblockingServer::TConnection::checkIdleBufferMemLimit(size_t readLimit, size_t writeLimit) {
   if (readLimit > 0 && readBufferSize_ > readLimit) {
     free(readBuffer_);
-    readBuffer_ = NULL;
+    readBuffer_ = nullptr;
     readBufferSize_ = 0;
   }
 
@@ -910,7 +910,7 @@
   TNonblockingIOThread* ioThread = ioThreads_[selectedThreadIdx].get();
 
   // Check the connection stack to see if we can re-use
-  TConnection* result = NULL;
+  TConnection* result = nullptr;
   if (connectionStack_.empty()) {
     result = new TConnection(socket, ioThread);
     ++numTConnections_;
@@ -979,7 +979,7 @@
     TConnection* clientConnection = createConnection(clientSocket);
 
     // Fail fast if we could not create a TConnection object
-    if (clientConnection == NULL) {
+    if (clientConnection == nullptr) {
       GlobalOutput.printf("thriftServerEventHandler: failed TConnection factory");
       clientSocket->close();
       return;
@@ -1143,7 +1143,7 @@
 void TNonblockingServer::serve() {
 
   if (ioThreads_.empty())
-    registerEvents(NULL);
+    registerEvents(nullptr);
 
   // Run the primary (listener) IO thread loop in our main thread; this will
   // only return when the server is shutting down.
@@ -1164,7 +1164,7 @@
     number_(number),
     listenSocket_(listenSocket),
     useHighPriority_(useHighPriority),
-    eventBase_(NULL),
+    eventBase_(nullptr),
     ownEventBase_(false) {
   notificationPipeFDs_[0] = -1;
   notificationPipeFDs_[1] = -1;
@@ -1231,9 +1231,9 @@
 void TNonblockingIOThread::registerEvents() {
   threadId_ = Thread::get_current();
 
-  assert(eventBase_ == 0);
+  assert(eventBase_ == nullptr);
   eventBase_ = getServer()->getUserEventBase();
-  if (eventBase_ == NULL) {
+  if (eventBase_ == nullptr) {
     eventBase_ = event_base_new();
     ownEventBase_ = true;
   }
@@ -1255,7 +1255,7 @@
     event_base_set(eventBase_, &serverEvent_);
 
     // Add the event and start up the server
-    if (-1 == event_add(&serverEvent_, 0)) {
+    if (-1 == event_add(&serverEvent_, nullptr)) {
       throw TException(
           "TNonblockingServer::serve(): "
           "event_add() failed on server listen event");
@@ -1276,7 +1276,7 @@
   event_base_set(eventBase_, &notificationEvent_);
 
   // Add the event and start up the server
-  if (-1 == event_add(&notificationEvent_, 0)) {
+  if (-1 == event_add(&notificationEvent_, nullptr)) {
     throw TException(
         "TNonblockingServer::serve(): "
         "event_add() failed on task-done notification event");
@@ -1368,16 +1368,16 @@
 
 /* static */
 void TNonblockingIOThread::notifyHandler(evutil_socket_t fd, short which, void* v) {
-  TNonblockingIOThread* ioThread = (TNonblockingIOThread*)v;
+  auto* ioThread = (TNonblockingIOThread*)v;
   assert(ioThread);
   (void)which;
 
   while (true) {
-    TNonblockingServer::TConnection* connection = 0;
+    TNonblockingServer::TConnection* connection = nullptr;
     const int kSize = sizeof(connection);
     long nBytes = recv(fd, cast_sockopt(&connection), kSize, 0);
     if (nBytes == kSize) {
-      if (connection == NULL) {
+      if (connection == nullptr) {
         // this is the command to stop our thread, exit the handler!
         ioThread->breakLoop(false);
         return;
@@ -1420,7 +1420,7 @@
   // same thread, this means the thread can't be blocking in the event
   // loop either.
   if (!Thread::is_current(threadId_)) {
-    notify(NULL);
+    notify(nullptr);
   } else {
     // cause the loop to stop ASAP - even if it has things to do in it
     event_base_loopbreak(eventBase_);
@@ -1457,14 +1457,14 @@
 }
 
 void TNonblockingIOThread::run() {
-  if (eventBase_ == NULL) {
+  if (eventBase_ == nullptr) {
     registerEvents();
   }
   if (useHighPriority_) {
     setCurrentThreadHighPriority(true);
   }
 
-  if (eventBase_ != NULL)
+  if (eventBase_ != nullptr)
   {
     GlobalOutput.printf("TNonblockingServer: IO thread #%d entering loop...", number_);
     // Run libevent engine, never returns, invokes calls to eventHandler
diff --git a/lib/cpp/src/thrift/server/TNonblockingServer.h b/lib/cpp/src/thrift/server/TNonblockingServer.h
index 2c2389c..82bc375 100644
--- a/lib/cpp/src/thrift/server/TNonblockingServer.h
+++ b/lib/cpp/src/thrift/server/TNonblockingServer.h
@@ -280,7 +280,7 @@
     numIOThreads_ = DEFAULT_IO_THREADS;
     nextIOThread_ = 0;
     useHighPriorityIOThreads_ = false;
-    userEventBase_ = NULL;
+    userEventBase_ = nullptr;
     threadPoolProcessing_ = false;
     numTConnections_ = 0;
     numActiveProcessors_ = 0;
@@ -376,7 +376,7 @@
     setThreadManager(threadManager);
   }
 
-  ~TNonblockingServer();
+  ~TNonblockingServer() override;
 
   void setThreadManager(std::shared_ptr<ThreadManager> threadManager);
 
@@ -669,12 +669,12 @@
    * Main workhorse function, starts up the server listening on a port and
    * loops over the libevent handler.
    */
-  void serve();
+  void serve() override;
 
   /**
    * Causes the server to terminate gracefully (can be called from any thread).
    */
-  void stop();
+  void stop() override;
 
   /// Creates a socket to listen on and binds it to the local port.
   void createAndListenOnSocket();
@@ -741,7 +741,7 @@
                        THRIFT_SOCKET listenSocket,
                        bool useHighPriority);
 
-  ~TNonblockingIOThread();
+  ~TNonblockingIOThread() override;
 
   // Returns the event-base for this thread.
   event_base* getEventBase() const { return eventBase_; }
@@ -772,7 +772,7 @@
   bool notify(TNonblockingServer::TConnection* conn);
 
   // Enters the event loop and does not return until a call to stop().
-  virtual void run();
+  void run() override;
 
   // Exits the event loop as soon as possible.
   void stop();
diff --git a/lib/cpp/src/thrift/server/TServer.h b/lib/cpp/src/thrift/server/TServer.h
index 3c6d818..d2eabde 100644
--- a/lib/cpp/src/thrift/server/TServer.h
+++ b/lib/cpp/src/thrift/server/TServer.h
@@ -48,7 +48,7 @@
  */
 class TServerEventHandler {
 public:
-  virtual ~TServerEventHandler() {}
+  virtual ~TServerEventHandler() = default;
 
   /**
    * Called before the server begins.
@@ -62,7 +62,7 @@
                               std::shared_ptr<TProtocol> output) {
     (void)input;
     (void)output;
-    return NULL;
+    return nullptr;
   }
 
   /**
@@ -89,7 +89,7 @@
   /**
    * Prevent direct instantiation.
    */
-  TServerEventHandler() {}
+  TServerEventHandler() = default;
 };
 
 /**
@@ -98,14 +98,14 @@
  */
 class TServer : public concurrency::Runnable {
 public:
-  virtual ~TServer() {}
+  ~TServer() override = default;
 
   virtual void serve() = 0;
 
   virtual void stop() {}
 
   // Allows running the server as a Runnable thread
-  virtual void run() { serve(); }
+  void run() override { serve(); }
 
   std::shared_ptr<TProcessorFactory> getProcessorFactory() { return processorFactory_; }
 
diff --git a/lib/cpp/src/thrift/server/TServerFramework.cpp b/lib/cpp/src/thrift/server/TServerFramework.cpp
index cbeaa24..35f3b25 100644
--- a/lib/cpp/src/thrift/server/TServerFramework.cpp
+++ b/lib/cpp/src/thrift/server/TServerFramework.cpp
@@ -91,8 +91,7 @@
     limit_(INT64_MAX) {
 }
 
-TServerFramework::~TServerFramework() {
-}
+TServerFramework::~TServerFramework() = default;
 
 template <typename T>
 static void releaseOneDescriptor(const string& name, T& pTransport) {
diff --git a/lib/cpp/src/thrift/server/TServerFramework.h b/lib/cpp/src/thrift/server/TServerFramework.h
index eaacce5..dac79ef 100644
--- a/lib/cpp/src/thrift/server/TServerFramework.h
+++ b/lib/cpp/src/thrift/server/TServerFramework.h
@@ -75,7 +75,7 @@
       const std::shared_ptr<apache::thrift::protocol::TProtocolFactory>& inputProtocolFactory,
       const std::shared_ptr<apache::thrift::protocol::TProtocolFactory>& outputProtocolFactory);
 
-  virtual ~TServerFramework();
+  ~TServerFramework() override;
 
   /**
    * Accept clients from the TServerTransport and add them for processing.
@@ -84,12 +84,12 @@
    * Post-conditions (return guarantees):
    *   The serverTransport will be closed.
    */
-  virtual void serve();
+  void serve() override;
 
   /**
    * Interrupt serve() so that it meets post-conditions and returns.
    */
-  virtual void stop();
+  void stop() override;
 
   /**
    * Get the concurrent client limit.
diff --git a/lib/cpp/src/thrift/server/TSimpleServer.cpp b/lib/cpp/src/thrift/server/TSimpleServer.cpp
index 716234d..ba7a183 100644
--- a/lib/cpp/src/thrift/server/TSimpleServer.cpp
+++ b/lib/cpp/src/thrift/server/TSimpleServer.cpp
@@ -78,8 +78,7 @@
   TServerFramework::setConcurrentClientLimit(1);
 }
 
-TSimpleServer::~TSimpleServer() {
-}
+TSimpleServer::~TSimpleServer() = default;
 
 /**
  * The main body of customized implementation for TSimpleServer is quite simple:
diff --git a/lib/cpp/src/thrift/server/TSimpleServer.h b/lib/cpp/src/thrift/server/TSimpleServer.h
index 4549225..3afeb79 100644
--- a/lib/cpp/src/thrift/server/TSimpleServer.h
+++ b/lib/cpp/src/thrift/server/TSimpleServer.h
@@ -61,14 +61,14 @@
       const std::shared_ptr<apache::thrift::protocol::TProtocolFactory>& inputProtocolFactory,
       const std::shared_ptr<apache::thrift::protocol::TProtocolFactory>& outputProtocolFactory);
 
-  virtual ~TSimpleServer();
+  ~TSimpleServer() override;
 
 protected:
-  virtual void onClientConnected(const std::shared_ptr<TConnectedClient>& pClient) /* override */;
-  virtual void onClientDisconnected(TConnectedClient* pClient) /* override */;
+  void onClientConnected(const std::shared_ptr<TConnectedClient>& pClient) override /* override */;
+  void onClientDisconnected(TConnectedClient* pClient) override /* override */;
 
 private:
-  void setConcurrentClientLimit(int64_t newLimit); // hide
+  void setConcurrentClientLimit(int64_t newLimit) override; // hide
 };
 }
 }
diff --git a/lib/cpp/src/thrift/server/TThreadPoolServer.cpp b/lib/cpp/src/thrift/server/TThreadPoolServer.cpp
index ee345a9..121dde3 100644
--- a/lib/cpp/src/thrift/server/TThreadPoolServer.cpp
+++ b/lib/cpp/src/thrift/server/TThreadPoolServer.cpp
@@ -91,8 +91,7 @@
     taskExpiration_(0) {
 }
 
-TThreadPoolServer::~TThreadPoolServer() {
-}
+TThreadPoolServer::~TThreadPoolServer() = default;
 
 void TThreadPoolServer::serve() {
   TServerFramework::serve();
diff --git a/lib/cpp/src/thrift/server/TThreadPoolServer.h b/lib/cpp/src/thrift/server/TThreadPoolServer.h
index 121998c..a9411b8 100644
--- a/lib/cpp/src/thrift/server/TThreadPoolServer.h
+++ b/lib/cpp/src/thrift/server/TThreadPoolServer.h
@@ -69,13 +69,13 @@
       const std::shared_ptr<apache::thrift::concurrency::ThreadManager>& threadManager
       = apache::thrift::concurrency::ThreadManager::newSimpleThreadManager());
 
-  virtual ~TThreadPoolServer();
+  ~TThreadPoolServer() override;
 
   /**
    * Post-conditions (return guarantees):
    *   There will be no clients connected.
    */
-  virtual void serve();
+  void serve() override;
 
   virtual int64_t getTimeout() const;
   virtual void setTimeout(int64_t value);
@@ -86,8 +86,8 @@
   virtual std::shared_ptr<apache::thrift::concurrency::ThreadManager> getThreadManager() const;
 
 protected:
-  virtual void onClientConnected(const std::shared_ptr<TConnectedClient>& pClient) /* override */;
-  virtual void onClientDisconnected(TConnectedClient* pClient) /* override */;
+  void onClientConnected(const std::shared_ptr<TConnectedClient>& pClient) override /* override */;
+  void onClientDisconnected(TConnectedClient* pClient) override /* override */;
 
   std::shared_ptr<apache::thrift::concurrency::ThreadManager> threadManager_;
   std::atomic<int64_t> timeout_;
diff --git a/lib/cpp/src/thrift/server/TThreadedServer.cpp b/lib/cpp/src/thrift/server/TThreadedServer.cpp
index ed2d80d..79dcc70 100644
--- a/lib/cpp/src/thrift/server/TThreadedServer.cpp
+++ b/lib/cpp/src/thrift/server/TThreadedServer.cpp
@@ -89,8 +89,7 @@
     threadFactory_(threadFactory) {
 }
 
-TThreadedServer::~TThreadedServer() {
-}
+TThreadedServer::~TThreadedServer() = default;
 
 void TThreadedServer::serve() {
   TServerFramework::serve();
@@ -107,7 +106,7 @@
 void TThreadedServer::drainDeadClients() {
   // we're in a monitor here
   while (!deadClientMap_.empty()) {
-    ClientMap::iterator it = deadClientMap_.begin();
+    auto it = deadClientMap_.begin();
     it->second->join();
     deadClientMap_.erase(it);
   }
@@ -125,9 +124,9 @@
 void TThreadedServer::onClientDisconnected(TConnectedClient* pClient) {
   Synchronized sync(clientMonitor_);
   drainDeadClients(); // use the outgoing thread to do some maintenance on our dead client backlog
-  ClientMap::iterator it = activeClientMap_.find(pClient);
+  auto it = activeClientMap_.find(pClient);
   if (it != activeClientMap_.end()) {
-    ClientMap::iterator end = it;
+    auto end = it;
     deadClientMap_.insert(it, ++end);
     activeClientMap_.erase(it);
   }
@@ -140,8 +139,7 @@
   : pClient_(pClient) {
 }
 
-TThreadedServer::TConnectedClientRunner::~TConnectedClientRunner() {
-}
+TThreadedServer::TConnectedClientRunner::~TConnectedClientRunner() = default;
 
 void TThreadedServer::TConnectedClientRunner::run() /* override */ {
   pClient_->run();  // Run the client
diff --git a/lib/cpp/src/thrift/server/TThreadedServer.h b/lib/cpp/src/thrift/server/TThreadedServer.h
index 9fc9d11..756e5a0 100644
--- a/lib/cpp/src/thrift/server/TThreadedServer.h
+++ b/lib/cpp/src/thrift/server/TThreadedServer.h
@@ -77,13 +77,13 @@
       = std::shared_ptr<apache::thrift::concurrency::ThreadFactory>(
           new apache::thrift::concurrency::ThreadFactory(false)));
 
-  virtual ~TThreadedServer();
+  ~TThreadedServer() override;
 
   /**
    * Post-conditions (return guarantees):
    *   There will be no clients connected.
    */
-  virtual void serve();
+  void serve() override;
 
 protected:
   /**
@@ -95,12 +95,12 @@
   /**
    * Implementation of TServerFramework::onClientConnected
    */
-  virtual void onClientConnected(const std::shared_ptr<TConnectedClient>& pClient) /* override */;
+  void onClientConnected(const std::shared_ptr<TConnectedClient>& pClient) override /* override */;
 
   /**
    * Implementation of TServerFramework::onClientDisconnected
    */
-  virtual void onClientDisconnected(TConnectedClient *pClient) /* override */;
+  void onClientDisconnected(TConnectedClient *pClient) override /* override */;
 
   std::shared_ptr<apache::thrift::concurrency::ThreadFactory> threadFactory_;
 
@@ -115,8 +115,8 @@
   {
   public:
     TConnectedClientRunner(const std::shared_ptr<TConnectedClient>& pClient);
-    virtual ~TConnectedClientRunner();
-    void run() /* override */;
+    ~TConnectedClientRunner() override;
+    void run() override /* override */;
   private:
     std::shared_ptr<TConnectedClient> pClient_;
   };
diff --git a/lib/cpp/src/thrift/transport/TBufferTransports.cpp b/lib/cpp/src/thrift/transport/TBufferTransports.cpp
index 9ac2f84..4bb8713 100644
--- a/lib/cpp/src/thrift/transport/TBufferTransports.cpp
+++ b/lib/cpp/src/thrift/transport/TBufferTransports.cpp
@@ -29,7 +29,7 @@
 namespace transport {
 
 uint32_t TBufferedTransport::readSlow(uint8_t* buf, uint32_t len) {
-  uint32_t have = static_cast<uint32_t>(rBound_ - rBase_);
+  auto have = static_cast<uint32_t>(rBound_ - rBase_);
 
   // We should only take the slow path if we can't satisfy the read
   // with the data already in the buffer.
@@ -61,8 +61,8 @@
 }
 
 void TBufferedTransport::writeSlow(const uint8_t* buf, uint32_t len) {
-  uint32_t have_bytes = static_cast<uint32_t>(wBase_ - wBuf_.get());
-  uint32_t space = static_cast<uint32_t>(wBound_ - wBase_);
+  auto have_bytes = static_cast<uint32_t>(wBase_ - wBuf_.get());
+  auto space = static_cast<uint32_t>(wBound_ - wBase_);
   // We should only take the slow path if we can't accommodate the write
   // with the free space already in the buffer.
   assert(wBound_ - wBase_ < static_cast<ptrdiff_t>(len));
@@ -114,12 +114,12 @@
   (void)len;
   // Simply return NULL.  We don't know if there is actually data available on
   // the underlying transport, so calling read() might block.
-  return NULL;
+  return nullptr;
 }
 
 void TBufferedTransport::flush() {
   // Write out any data waiting in the write buffer.
-  uint32_t have_bytes = static_cast<uint32_t>(wBase_ - wBuf_.get());
+  auto have_bytes = static_cast<uint32_t>(wBase_ - wBuf_.get());
   if (have_bytes > 0) {
     // Note that we reset wBase_ prior to the underlying write
     // to ensure we're in a sane state (i.e. internal buffer cleaned)
@@ -134,7 +134,7 @@
 
 uint32_t TFramedTransport::readSlow(uint8_t* buf, uint32_t len) {
   uint32_t want = len;
-  uint32_t have = static_cast<uint32_t>(rBound_ - rBase_);
+  auto have = static_cast<uint32_t>(rBound_ - rBase_);
 
   // We should only take the slow path if we can't satisfy the read
   // with the data already in the buffer.
@@ -217,7 +217,7 @@
 
 void TFramedTransport::writeSlow(const uint8_t* buf, uint32_t len) {
   // Double buffer size until sufficient.
-  uint32_t have = static_cast<uint32_t>(wBase_ - wBuf_.get());
+  auto have = static_cast<uint32_t>(wBase_ - wBuf_.get());
   uint32_t new_size = wBufSize_;
   if (len + have < have /* overflow */ || len + have > 0x7fffffff) {
     throw TTransportException(TTransportException::BAD_ARGS,
@@ -231,7 +231,7 @@
   // so we can use realloc here.
 
   // Allocate new buffer.
-  uint8_t* new_buf = new uint8_t[new_size];
+  auto* new_buf = new uint8_t[new_size];
 
   // Copy the old buffer to the new one.
   memcpy(new_buf, wBuf_.get(), have);
@@ -292,12 +292,12 @@
   // Don't try to be clever with shifting buffers.
   // If the fast path failed let the protocol use its slow path.
   // Besides, who is going to try to borrow across messages?
-  return NULL;
+  return nullptr;
 }
 
 uint32_t TFramedTransport::readEnd() {
   // include framing bytes
-  uint32_t bytes_read = static_cast<uint32_t>(rBound_ - rBuf_.get() + sizeof(uint32_t));
+  auto bytes_read = static_cast<uint32_t>(rBound_ - rBuf_.get() + sizeof(uint32_t));
 
   if (rBufSize_ > bufReclaimThresh_) {
     rBufSize_ = 0;
@@ -335,7 +335,7 @@
 
 uint32_t TMemoryBuffer::readAppendToString(std::string& str, uint32_t len) {
   // Don't get some stupid assertion failure.
-  if (buffer_ == NULL) {
+  if (buffer_ == nullptr) {
     return 0;
   }
 
@@ -372,8 +372,8 @@
   }
 
   // Allocate into a new pointer so we don't bork ours if it fails.
-  uint8_t* new_buffer = static_cast<uint8_t*>(std::realloc(buffer_, new_size));
-  if (new_buffer == NULL) {
+  auto* new_buffer = static_cast<uint8_t*>(std::realloc(buffer_, new_size));
+  if (new_buffer == nullptr) {
     throw std::bad_alloc();
   }
 
@@ -408,7 +408,7 @@
     *len = available_read();
     return rBase_;
   }
-  return NULL;
+  return nullptr;
 }
 }
 }
diff --git a/lib/cpp/src/thrift/transport/TBufferTransports.h b/lib/cpp/src/thrift/transport/TBufferTransports.h
index 7012275..a008fa1 100644
--- a/lib/cpp/src/thrift/transport/TBufferTransports.h
+++ b/lib/cpp/src/thrift/transport/TBufferTransports.h
@@ -148,7 +148,7 @@
    * performance-sensitive operation, so it is okay to just leave it to
    * the concrete class to set up pointers correctly.
    */
-  TBufferBase() : rBase_(NULL), rBound_(NULL), wBase_(NULL), wBound_(NULL) {}
+  TBufferBase() : rBase_(nullptr), rBound_(nullptr), wBase_(nullptr), wBound_(nullptr) {}
 
   /// Convenience mutator for setting the read buffer.
   void setReadBuffer(uint8_t* buf, uint32_t len) {
@@ -162,7 +162,7 @@
     wBound_ = buf + len;
   }
 
-  virtual ~TBufferBase() {}
+  ~TBufferBase() override = default;
 
   /// Reads begin here.
   uint8_t* rBase_;
@@ -215,32 +215,32 @@
     initPointers();
   }
 
-  void open() { transport_->open(); }
+  void open() override { transport_->open(); }
 
   bool isOpen() { return transport_->isOpen(); }
 
-  bool peek() {
+  bool peek() override {
     if (rBase_ == rBound_) {
       setReadBuffer(rBuf_.get(), transport_->read(rBuf_.get(), rBufSize_));
     }
     return (rBound_ > rBase_);
   }
 
-  void close() {
+  void close() override {
     flush();
     transport_->close();
   }
 
-  virtual uint32_t readSlow(uint8_t* buf, uint32_t len);
+  uint32_t readSlow(uint8_t* buf, uint32_t len) override;
 
-  virtual void writeSlow(const uint8_t* buf, uint32_t len);
+  void writeSlow(const uint8_t* buf, uint32_t len) override;
 
   void flush() override;
 
   /**
    * Returns the origin of the underlying transport
    */
-  virtual const std::string getOrigin() { return transport_->getOrigin(); }
+  const std::string getOrigin() const override { return transport_->getOrigin(); }
 
   /**
    * The following behavior is currently implemented by TBufferedTransport,
@@ -253,7 +253,7 @@
    *    will ever have to be copied again.  For optimial performance,
    *    stay under this limit.
    */
-  virtual const uint8_t* borrowSlow(uint8_t* buf, uint32_t* len);
+  const uint8_t* borrowSlow(uint8_t* buf, uint32_t* len) override;
 
   std::shared_ptr<TTransport> getUnderlyingTransport() { return transport_; }
 
@@ -284,9 +284,9 @@
  */
 class TBufferedTransportFactory : public TTransportFactory {
 public:
-  TBufferedTransportFactory() {}
+  TBufferedTransportFactory() = default;
 
-  virtual ~TBufferedTransportFactory() {}
+  ~TBufferedTransportFactory() override = default;
 
   /**
    * Wraps the transport into a buffered one.
@@ -343,13 +343,13 @@
     initPointers();
   }
 
-  void open() { transport_->open(); }
+  void open() override { transport_->open(); }
 
   bool isOpen() { return transport_->isOpen(); }
 
-  bool peek() { return (rBase_ < rBound_) || transport_->peek(); }
+  bool peek() override { return (rBase_ < rBound_) || transport_->peek(); }
 
-  void close() {
+  void close() override {
     flush();
     transport_->close();
   }
@@ -360,11 +360,11 @@
 
   void flush() override;
 
-  uint32_t readEnd();
+  uint32_t readEnd() override;
 
-  uint32_t writeEnd();
+  uint32_t writeEnd() override;
 
-  const uint8_t* borrowSlow(uint8_t* buf, uint32_t* len);
+  const uint8_t* borrowSlow(uint8_t* buf, uint32_t* len) override;
 
   std::shared_ptr<TTransport> getUnderlyingTransport() { return transport_; }
 
@@ -377,7 +377,7 @@
   /**
    * Returns the origin of the underlying transport
    */
-  virtual const std::string getOrigin() { return transport_->getOrigin(); }
+  const std::string getOrigin() const override { return transport_->getOrigin(); }
 
   /**
    * Set the maximum size of the frame at read
@@ -399,7 +399,7 @@
   virtual bool readFrame();
 
   void initPointers() {
-    setReadBuffer(NULL, 0);
+    setReadBuffer(nullptr, 0);
     setWriteBuffer(wBuf_.get(), wBufSize_);
 
     // Pad the buffer so we can insert the size later.
@@ -423,9 +423,9 @@
  */
 class TFramedTransportFactory : public TTransportFactory {
 public:
-  TFramedTransportFactory() {}
+  TFramedTransportFactory() = default;
 
-  virtual ~TFramedTransportFactory() {}
+  ~TFramedTransportFactory() override = default;
 
   /**
    * Wraps the transport into a framed one.
@@ -451,10 +451,10 @@
 
     maxBufferSize_ = (std::numeric_limits<uint32_t>::max)();
 
-    if (buf == NULL && size != 0) {
+    if (buf == nullptr && size != 0) {
       assert(owner);
       buf = (uint8_t*)std::malloc(size);
-      if (buf == NULL) {
+      if (buf == nullptr) {
 	throw std::bad_alloc();
       }
     }
@@ -503,7 +503,7 @@
    * Construct a TMemoryBuffer with a default-sized buffer,
    * owned by the TMemoryBuffer object.
    */
-  TMemoryBuffer() { initCommon(NULL, defaultSize, true, 0); }
+  TMemoryBuffer() { initCommon(nullptr, defaultSize, true, 0); }
 
   /**
    * Construct a TMemoryBuffer with a buffer of a specified size,
@@ -511,7 +511,7 @@
    *
    * @param sz  The initial size of the buffer.
    */
-  TMemoryBuffer(uint32_t sz) { initCommon(NULL, sz, true, 0); }
+  TMemoryBuffer(uint32_t sz) { initCommon(nullptr, sz, true, 0); }
 
   /**
    * Construct a TMemoryBuffer with buf as its initial contents.
@@ -524,7 +524,7 @@
    * @param policy See @link MemoryPolicy @endlink .
    */
   TMemoryBuffer(uint8_t* buf, uint32_t sz, MemoryPolicy policy = OBSERVE) {
-    if (buf == NULL && sz != 0) {
+    if (buf == nullptr && sz != 0) {
       throw TTransportException(TTransportException::BAD_ARGS,
                                 "TMemoryBuffer given null buffer with non-zero size.");
     }
@@ -535,7 +535,7 @@
       initCommon(buf, sz, policy == TAKE_OWNERSHIP, sz);
       break;
     case COPY:
-      initCommon(NULL, sz, true, 0);
+      initCommon(nullptr, sz, true, 0);
       this->write(buf, sz);
       break;
     default:
@@ -544,7 +544,7 @@
     }
   }
 
-  ~TMemoryBuffer() {
+  ~TMemoryBuffer() override {
     if (owner_) {
       std::free(buffer_);
     }
@@ -552,11 +552,11 @@
 
   bool isOpen() { return true; }
 
-  bool peek() { return (rBase_ < wBase_); }
+  bool peek() override { return (rBase_ < wBase_); }
 
-  void open() {}
+  void open() override {}
 
-  void close() {}
+  void close() override {}
 
   // TODO(dreiss): Make bufPtr const.
   void getBuffer(uint8_t** bufPtr, uint32_t* sz) {
@@ -565,7 +565,7 @@
   }
 
   std::string getBufferAsString() {
-    if (buffer_ == NULL) {
+    if (buffer_ == nullptr) {
       return "";
     }
     uint8_t* buf;
@@ -575,7 +575,7 @@
   }
 
   void appendBufferToString(std::string& str) {
-    if (buffer_ == NULL) {
+    if (buffer_ == nullptr) {
       return;
     }
     uint8_t* buf;
@@ -634,9 +634,9 @@
   uint32_t readAppendToString(std::string& str, uint32_t len);
 
   // return number of bytes read
-  uint32_t readEnd() {
+  uint32_t readEnd() override {
     // This cast should be safe, because buffer_'s size is a uint32_t
-    uint32_t bytes = static_cast<uint32_t>(rBase_ - buffer_);
+    auto bytes = static_cast<uint32_t>(rBase_ - buffer_);
     if (rBase_ == wBase_) {
       resetBuffer();
     }
@@ -644,7 +644,7 @@
   }
 
   // Return number of bytes written
-  uint32_t writeEnd() {
+  uint32_t writeEnd() override {
     // This cast should be safe, because buffer_'s size is a uint32_t
     return static_cast<uint32_t>(wBase_ - buffer_);
   }
@@ -719,11 +719,11 @@
   // Compute the position and available data for reading.
   void computeRead(uint32_t len, uint8_t** out_start, uint32_t* out_give);
 
-  uint32_t readSlow(uint8_t* buf, uint32_t len);
+  uint32_t readSlow(uint8_t* buf, uint32_t len) override;
 
-  void writeSlow(const uint8_t* buf, uint32_t len);
+  void writeSlow(const uint8_t* buf, uint32_t len) override;
 
-  const uint8_t* borrowSlow(uint8_t* buf, uint32_t* len);
+  const uint8_t* borrowSlow(uint8_t* buf, uint32_t* len) override;
 
   // Data buffer
   uint8_t* buffer_;
diff --git a/lib/cpp/src/thrift/transport/TFDTransport.h b/lib/cpp/src/thrift/transport/TFDTransport.h
index 5593d43..ede5ccb 100644
--- a/lib/cpp/src/thrift/transport/TFDTransport.h
+++ b/lib/cpp/src/thrift/transport/TFDTransport.h
@@ -43,7 +43,7 @@
   TFDTransport(int fd, ClosePolicy close_policy = NO_CLOSE_ON_DESTROY)
     : fd_(fd), close_policy_(close_policy) {}
 
-  ~TFDTransport() {
+  ~TFDTransport() override {
     if (close_policy_ == CLOSE_ON_DESTROY) {
       try {
         close();
@@ -55,9 +55,9 @@
 
   bool isOpen() { return fd_ >= 0; }
 
-  void open() {}
+  void open() override {}
 
-  void close();
+  void close() override;
 
   uint32_t read(uint8_t* buf, uint32_t len);
 
diff --git a/lib/cpp/src/thrift/transport/TFileTransport.cpp b/lib/cpp/src/thrift/transport/TFileTransport.cpp
index 5df2778..1eefb89 100644
--- a/lib/cpp/src/thrift/transport/TFileTransport.cpp
+++ b/lib/cpp/src/thrift/transport/TFileTransport.cpp
@@ -65,8 +65,8 @@
 
 TFileTransport::TFileTransport(string path, bool readOnly)
   : readState_(),
-    readBuff_(NULL),
-    currentEvent_(NULL),
+    readBuff_(nullptr),
+    currentEvent_(nullptr),
     readBuffSize_(DEFAULT_READ_BUFF_SIZE),
     readTimeout_(NO_TAIL_READ_TIMEOUT),
     chunkSize_(DEFAULT_CHUNK_SIZE),
@@ -78,8 +78,8 @@
     eofSleepTime_(DEFAULT_EOF_SLEEP_TIME_US),
     corruptedEventSleepTime_(DEFAULT_CORRUPTED_SLEEP_TIME_US),
     writerThreadIOErrorSleepTime_(DEFAULT_WRITER_THREAD_SLEEP_TIME_US),
-    dequeueBuffer_(NULL),
-    enqueueBuffer_(NULL),
+    dequeueBuffer_(nullptr),
+    enqueueBuffer_(nullptr),
     notFull_(&mutex_),
     notEmpty_(&mutex_),
     closing_(false),
@@ -141,22 +141,22 @@
 
   if (dequeueBuffer_) {
     delete dequeueBuffer_;
-    dequeueBuffer_ = NULL;
+    dequeueBuffer_ = nullptr;
   }
 
   if (enqueueBuffer_) {
     delete enqueueBuffer_;
-    enqueueBuffer_ = NULL;
+    enqueueBuffer_ = nullptr;
   }
 
   if (readBuff_) {
     delete[] readBuff_;
-    readBuff_ = NULL;
+    readBuff_ = nullptr;
   }
 
   if (currentEvent_) {
     delete currentEvent_;
-    currentEvent_ = NULL;
+    currentEvent_ = nullptr;
   }
 
   // close logfile
@@ -275,7 +275,7 @@
     // return immediately if the transport is closing
     swap = false;
   } else {
-    if (deadline != NULL) {
+    if (deadline != nullptr) {
       // if we were handed a deadline time struct, do a timed wait
       notEmpty_.waitForTime(*deadline);
     } else {
@@ -362,7 +362,7 @@
 
     if (swapEventBuffers(&ts_next_flush)) {
       eventInfo* outEvent;
-      while (NULL != (outEvent = dequeueBuffer_->getNext())) {
+      while (nullptr != (outEvent = dequeueBuffer_->getNext())) {
         // Remove an event from the buffer and write it out to disk. If there is any IO error, for
         // instance,
         // the output file is unmounted or deleted, then this event is dropped. However, the writer
@@ -422,9 +422,9 @@
           if (chunk1 != chunk2) {
             // refetch the offset to keep in sync
             offset_ = THRIFT_LSEEK(fd_, 0, SEEK_CUR);
-            int32_t padding = (int32_t)((offset_ / chunkSize_ + 1) * chunkSize_ - offset_);
+            auto padding = (int32_t)((offset_ / chunkSize_ + 1) * chunkSize_ - offset_);
 
-            uint8_t* zeros = new uint8_t[padding];
+            auto* zeros = new uint8_t[padding];
             memset(zeros, '\0', padding);
             boost::scoped_array<uint8_t> array(zeros);
             if (-1 == ::write(fd_, zeros, padding)) {
@@ -587,7 +587,7 @@
       memcpy(buf, currentEvent_->eventBuff_ + currentEvent_->eventBuffPos_, remaining);
     }
     delete (currentEvent_);
-    currentEvent_ = NULL;
+    currentEvent_ = nullptr;
     return remaining;
   }
 
@@ -630,12 +630,12 @@
         } else if (readTimeout_ == NO_TAIL_READ_TIMEOUT) {
           // reset state
           readState_.resetState(0);
-          return NULL;
+          return nullptr;
         } else if (readTimeout_ > 0) {
           // timeout already expired once
           if (readTries > 0) {
             readState_.resetState(0);
-            return NULL;
+            return nullptr;
           } else {
             THRIFT_SLEEP_USEC(readTimeout_ * 1000);
             readTries++;
@@ -709,7 +709,7 @@
           eventInfo* completeEvent = readState_.event_;
           completeEvent->eventBuffPos_ = 0;
 
-          readState_.event_ = NULL;
+          readState_.event_ = nullptr;
           readState_.resetState(readState_.bufferPtr_);
 
           // exit criteria
@@ -778,7 +778,7 @@
       // pretty hosed at this stage, rewind the file back to the last successful
       // point and punt on the error
       readState_.resetState(readState_.lastDispatchPtr_);
-      currentEvent_ = NULL;
+      currentEvent_ = nullptr;
       char errorMsg[1024];
       sprintf(errorMsg,
               "TFileTransport: log file corrupted at offset: %lu",
@@ -827,7 +827,7 @@
   off_t newOffset = off_t(chunk) * chunkSize_;
   offset_ = ::THRIFT_LSEEK(fd_, newOffset, SEEK_SET);
   readState_.resetAllValues();
-  currentEvent_ = NULL;
+  currentEvent_ = nullptr;
   if (offset_ == -1) {
     GlobalOutput("TFileTransport: lseek error in seekToChunk");
     throw TTransportException("TFileTransport: lseek error in seekToChunk");
@@ -841,7 +841,7 @@
     shared_ptr<eventInfo> event;
     while ((offset_ + readState_.bufferPtr_) < minEndOffset) {
       event.reset(readEvent());
-      if (event.get() == NULL) {
+      if (event.get() == nullptr) {
         break;
       }
     }
@@ -918,7 +918,7 @@
       delete buffer_[i];
     }
     delete[] buffer_;
-    buffer_ = NULL;
+    buffer_ = nullptr;
   }
 }
 
@@ -943,7 +943,7 @@
     return buffer_[readPoint_++];
   } else {
     // no more entries
-    return NULL;
+    return nullptr;
   }
 }
 
@@ -1020,7 +1020,7 @@
     // bad form to use exceptions for flow control but there is really
     // no other way around it
     try {
-      processor_->process(inputProtocol, outputProtocol, NULL);
+      processor_->process(inputProtocol, outputProtocol, nullptr);
       numProcessed++;
       if ((numEvents > 0) && (numProcessed == numEvents)) {
         return;
@@ -1051,7 +1051,7 @@
     // bad form to use exceptions for flow control but there is really
     // no other way around it
     try {
-      processor_->process(inputProtocol, outputProtocol, NULL);
+      processor_->process(inputProtocol, outputProtocol, nullptr);
       if (curChunk != inputTransport_->getCurChunk()) {
         break;
       }
diff --git a/lib/cpp/src/thrift/transport/TFileTransport.h b/lib/cpp/src/thrift/transport/TFileTransport.h
index e7c1ca6..0df5cf9 100644
--- a/lib/cpp/src/thrift/transport/TFileTransport.h
+++ b/lib/cpp/src/thrift/transport/TFileTransport.h
@@ -48,7 +48,7 @@
   uint32_t eventSize_;
   uint32_t eventBuffPos_;
 
-  eventInfo() : eventBuff_(NULL), eventSize_(0), eventBuffPos_(0){};
+  eventInfo() : eventBuff_(nullptr), eventSize_(0), eventBuffPos_(0){};
   ~eventInfo() {
     if (eventBuff_) {
       delete[] eventBuff_;
@@ -85,7 +85,7 @@
     if (event_) {
       delete (event_);
     }
-    event_ = 0;
+    event_ = nullptr;
   }
 
   inline uint32_t getEventSize() {
@@ -94,7 +94,7 @@
   }
 
   readState() {
-    event_ = 0;
+    event_ = nullptr;
     resetAllValues();
   }
 
@@ -174,24 +174,24 @@
 class TFileTransport : public TFileReaderTransport, public TFileWriterTransport {
 public:
   TFileTransport(std::string path, bool readOnly = false);
-  ~TFileTransport();
+  ~TFileTransport() override;
 
   // TODO: what is the correct behaviour for this?
   // the log file is generally always open
   bool isOpen() const override { return true; }
 
   void write(const uint8_t* buf, uint32_t len);
-  void flush();
+  void flush() override;
 
   uint32_t readAll(uint8_t* buf, uint32_t len);
   uint32_t read(uint8_t* buf, uint32_t len);
   bool peek() override;
 
   // log-file specific functions
-  void seekToChunk(int32_t chunk);
-  void seekToEnd();
-  uint32_t getNumChunks();
-  uint32_t getCurChunk();
+  void seekToChunk(int32_t chunk) override;
+  void seekToEnd() override;
+  uint32_t getNumChunks() override;
+  uint32_t getCurChunk() override;
 
   // for changing the output file
   void resetOutputFile(int fd, std::string filename, off_t offset);
@@ -206,15 +206,15 @@
 
   static const int32_t TAIL_READ_TIMEOUT = -1;
   static const int32_t NO_TAIL_READ_TIMEOUT = 0;
-  void setReadTimeout(int32_t readTimeout) { readTimeout_ = readTimeout; }
-  int32_t getReadTimeout() { return readTimeout_; }
+  void setReadTimeout(int32_t readTimeout) override { readTimeout_ = readTimeout; }
+  int32_t getReadTimeout() override { return readTimeout_; }
 
-  void setChunkSize(uint32_t chunkSize) {
+  void setChunkSize(uint32_t chunkSize) override {
     if (chunkSize) {
       chunkSize_ = chunkSize;
     }
   }
-  uint32_t getChunkSize() { return chunkSize_; }
+  uint32_t getChunkSize() override { return chunkSize_; }
 
   void setEventBufferSize(uint32_t bufferSize) {
     if (bufferAndThreadInitialized_) {
@@ -273,7 +273,7 @@
   // control for writer thread
   static void* startWriterThread(void* ptr) {
     static_cast<TFileTransport*>(ptr)->writerThread();
-    return NULL;
+    return nullptr;
   }
   void writerThread();
 
diff --git a/lib/cpp/src/thrift/transport/THeaderTransport.cpp b/lib/cpp/src/thrift/transport/THeaderTransport.cpp
index 25084ec..b582d8d 100644
--- a/lib/cpp/src/thrift/transport/THeaderTransport.cpp
+++ b/lib/cpp/src/thrift/transport/THeaderTransport.cpp
@@ -197,7 +197,7 @@
   readHeaders_.clear(); // Clear out any previous headers.
 
   // skip over already processed magic(4), seqId(4), headerSize(2)
-  uint8_t* ptr = reinterpret_cast<uint8_t*>(rBuf_.get() + 10);
+  auto* ptr = reinterpret_cast<uint8_t*>(rBuf_.get() + 10);
 
   // Catch integer overflow, check for reasonable header size
   if (headerSize >= 16384) {
@@ -275,9 +275,9 @@
       stream.avail_in = sz;
 
       // Setting these to 0 means use the default free/alloc functions
-      stream.zalloc = (alloc_func)0;
-      stream.zfree = (free_func)0;
-      stream.opaque = (voidpf)0;
+      stream.zalloc = (alloc_func)nullptr;
+      stream.zfree = (free_func)nullptr;
+      stream.opaque = (voidpf)nullptr;
       err = inflateInit(&stream);
       if (err != Z_OK) {
         throw TApplicationException(TApplicationException::MISSING_RESULT,
@@ -317,7 +317,7 @@
 void THeaderTransport::resizeTransformBuffer(uint32_t additionalSize) {
   if (tBufSize_ < wBufSize_ + DEFAULT_BUFFER_SIZE) {
     uint32_t new_size = wBufSize_ + DEFAULT_BUFFER_SIZE + additionalSize;
-    uint8_t* new_buf = new uint8_t[new_size];
+    auto* new_buf = new uint8_t[new_size];
     tBuf_.reset(new_buf);
     tBufSize_ = new_size;
   }
@@ -337,9 +337,9 @@
       stream.next_in = ptr;
       stream.avail_in = sz;
 
-      stream.zalloc = (alloc_func)0;
-      stream.zfree = (free_func)0;
-      stream.opaque = (voidpf)0;
+      stream.zalloc = (alloc_func)nullptr;
+      stream.zfree = (free_func)nullptr;
+      stream.opaque = (voidpf)nullptr;
       err = deflateInit(&stream, Z_DEFAULT_COMPRESSION);
       if (err != Z_OK) {
         throw TTransportException(TTransportException::CORRUPTED_DATA,
@@ -389,7 +389,7 @@
  * Automatically advances ptr to after the written portion
  */
 void THeaderTransport::writeString(uint8_t*& ptr, const string& str) {
-  int32_t strLen = safe_numeric_cast<int32_t>(str.length());
+  auto strLen = safe_numeric_cast<int32_t>(str.length());
   ptr += writeVarint32(strLen, ptr);
   memcpy(ptr, str.c_str(), strLen); // no need to write \0
   ptr += strLen;
@@ -484,7 +484,7 @@
     // write info headers
 
     // for now only write kv-headers
-    int32_t headerCount = safe_numeric_cast<int32_t>(writeHeaders_.size());
+    auto headerCount = safe_numeric_cast<int32_t>(writeHeaders_.size());
     if (headerCount > 0) {
       pkt += writeVarint32(infoIdType::KEYVALUE, pkt);
       // Write key-value headers count
@@ -526,7 +526,7 @@
     outTransport_->write(pktStart, szHbo - haveBytes + 4);
     outTransport_->write(wBuf_.get(), haveBytes);
   } else if (clientType == THRIFT_FRAMED_BINARY || clientType == THRIFT_FRAMED_COMPACT) {
-    uint32_t szHbo = (uint32_t)haveBytes;
+    auto szHbo = (uint32_t)haveBytes;
     uint32_t szNbo = htonl(szHbo);
 
     outTransport_->write(reinterpret_cast<uint8_t*>(&szNbo), 4);
diff --git a/lib/cpp/src/thrift/transport/THeaderTransport.h b/lib/cpp/src/thrift/transport/THeaderTransport.h
index 350702d..d1e9d43 100644
--- a/lib/cpp/src/thrift/transport/THeaderTransport.h
+++ b/lib/cpp/src/thrift/transport/THeaderTransport.h
@@ -82,7 +82,7 @@
       seqId(0),
       flags(0),
       tBufSize_(0),
-      tBuf_(NULL) {
+      tBuf_(nullptr) {
     if (!transport_) throw std::invalid_argument("transport is empty");
     initBuffers();
   }
@@ -96,13 +96,13 @@
       seqId(0),
       flags(0),
       tBufSize_(0),
-      tBuf_(NULL) {
+      tBuf_(nullptr) {
     if (!transport_) throw std::invalid_argument("inTransport is empty");
     if (!outTransport_) throw std::invalid_argument("outTransport is empty");
     initBuffers();
   }
 
-  virtual uint32_t readSlow(uint8_t* buf, uint32_t len);
+  uint32_t readSlow(uint8_t* buf, uint32_t len) override;
   void flush() override;
 
   void resizeTransformBuffer(uint32_t additionalSize = 0);
@@ -175,13 +175,13 @@
    * Returns true if a frame was read successfully, or false on EOF.
    * (Raises a TTransportException if EOF occurs after a partial frame.)
    */
-  virtual bool readFrame();
+  bool readFrame() override;
 
   void ensureReadBuffer(uint32_t sz);
   uint32_t getWriteBytes();
 
   void initBuffers() {
-    setReadBuffer(NULL, 0);
+    setReadBuffer(nullptr, 0);
     setWriteBuffer(wBuf_.get(), wBufSize_);
   }
 
@@ -257,9 +257,9 @@
  */
 class THeaderTransportFactory : public TTransportFactory {
 public:
-  THeaderTransportFactory() {}
+  THeaderTransportFactory() = default;
 
-  virtual ~THeaderTransportFactory() {}
+  ~THeaderTransportFactory() override = default;
 
   /**
    * Wraps the transport into a header one.
diff --git a/lib/cpp/src/thrift/transport/THttpClient.cpp b/lib/cpp/src/thrift/transport/THttpClient.cpp
index d152197..04566c9 100644
--- a/lib/cpp/src/thrift/transport/THttpClient.cpp
+++ b/lib/cpp/src/thrift/transport/THttpClient.cpp
@@ -44,12 +44,11 @@
     path_(path) {
 }
 
-THttpClient::~THttpClient() {
-}
+THttpClient::~THttpClient() = default;
 
 void THttpClient::parseHeader(char* header) {
   char* colon = strchr(header, ':');
-  if (colon == NULL) {
+  if (colon == nullptr) {
     return;
   }
   char* value = colon + 1;
@@ -68,7 +67,7 @@
   char* http = status;
 
   char* code = strchr(http, ' ');
-  if (code == NULL) {
+  if (code == nullptr) {
     throw TTransportException(string("Bad Status: ") + status);
   }
 
@@ -77,7 +76,7 @@
   };
 
   char* msg = strchr(code, ' ');
-  if (msg == NULL) {
+  if (msg == nullptr) {
     throw TTransportException(string("Bad Status: ") + status);
   }
   *msg = '\0';
diff --git a/lib/cpp/src/thrift/transport/THttpClient.h b/lib/cpp/src/thrift/transport/THttpClient.h
index 31f593f..fdca505 100644
--- a/lib/cpp/src/thrift/transport/THttpClient.h
+++ b/lib/cpp/src/thrift/transport/THttpClient.h
@@ -32,7 +32,7 @@
 
   THttpClient(std::string host, int port, std::string path = "");
 
-  virtual ~THttpClient();
+  ~THttpClient() override;
 
   void flush() override;
 
@@ -40,8 +40,8 @@
   std::string host_;
   std::string path_;
 
-  virtual void parseHeader(char* header);
-  virtual bool parseStatusLine(char* status);
+  void parseHeader(char* header) override;
+  bool parseStatusLine(char* status) override;
 };
 }
 }
diff --git a/lib/cpp/src/thrift/transport/THttpServer.cpp b/lib/cpp/src/thrift/transport/THttpServer.cpp
index 96b2480..94ac681 100644
--- a/lib/cpp/src/thrift/transport/THttpServer.cpp
+++ b/lib/cpp/src/thrift/transport/THttpServer.cpp
@@ -37,8 +37,7 @@
 THttpServer::THttpServer(std::shared_ptr<TTransport> transport) : THttpTransport(transport) {
 }
 
-THttpServer::~THttpServer() {
-}
+THttpServer::~THttpServer() = default;
 
 #if defined(_MSC_VER) || defined(__MINGW32__)
   #define THRIFT_GMTIME(TM, TIME)             gmtime_s(&TM, &TIME)
@@ -52,14 +51,14 @@
 
 void THttpServer::parseHeader(char* header) {
   char* colon = strchr(header, ':');
-  if (colon == NULL) {
+  if (colon == nullptr) {
     return;
   }
   size_t sz = colon - header;
   char* value = colon + 1;
 
   if (THRIFT_strncasecmp(header, "Transfer-Encoding", sz) == 0) {
-    if (THRIFT_strcasestr(value, "chunked") != NULL) {
+    if (THRIFT_strcasestr(value, "chunked") != nullptr) {
       chunked_ = true;
     }
   } else if (THRIFT_strncasecmp(header, "Content-length", sz) == 0) {
@@ -74,7 +73,7 @@
   char* method = status;
 
   char* path = strchr(method, ' ');
-  if (path == NULL) {
+  if (path == nullptr) {
     throw TTransportException(string("Bad Status: ") + status);
   }
 
@@ -83,7 +82,7 @@
   };
 
   char* http = strchr(path, ' ');
-  if (http == NULL) {
+  if (http == nullptr) {
     throw TTransportException(string("Bad Status: ") + status);
   }
   *http = '\0';
@@ -149,7 +148,7 @@
       = {"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"};
   char buff[128];
 
-  time_t t = time(NULL);
+  time_t t = time(nullptr);
   struct tm tmb;
   THRIFT_GMTIME(tmb, t);
 
diff --git a/lib/cpp/src/thrift/transport/THttpServer.h b/lib/cpp/src/thrift/transport/THttpServer.h
index d72cb13..0e83399 100644
--- a/lib/cpp/src/thrift/transport/THttpServer.h
+++ b/lib/cpp/src/thrift/transport/THttpServer.h
@@ -30,14 +30,14 @@
 public:
   THttpServer(std::shared_ptr<TTransport> transport);
 
-  virtual ~THttpServer();
+  ~THttpServer() override;
 
   void flush() override;
 
 protected:
   void readHeaders();
-  virtual void parseHeader(char* header);
-  virtual bool parseStatusLine(char* status);
+  void parseHeader(char* header) override;
+  bool parseStatusLine(char* status) override;
   std::string getTimeRFC1123();
 };
 
@@ -46,9 +46,9 @@
  */
 class THttpServerTransportFactory : public TTransportFactory {
 public:
-  THttpServerTransportFactory() {}
+  THttpServerTransportFactory() = default;
 
-  virtual ~THttpServerTransportFactory() {}
+  ~THttpServerTransportFactory() override = default;
 
   /**
    * Wraps the transport into a buffered one.
diff --git a/lib/cpp/src/thrift/transport/THttpTransport.cpp b/lib/cpp/src/thrift/transport/THttpTransport.cpp
index 6ccc034..aea2b28 100644
--- a/lib/cpp/src/thrift/transport/THttpTransport.cpp
+++ b/lib/cpp/src/thrift/transport/THttpTransport.cpp
@@ -39,7 +39,7 @@
     chunkedDone_(false),
     chunkSize_(0),
     contentLength_(0),
-    httpBuf_(NULL),
+    httpBuf_(nullptr),
     httpPos_(0),
     httpBufLen_(0),
     httpBufSize_(1024) {
@@ -48,14 +48,14 @@
 
 void THttpTransport::init() {
   httpBuf_ = (char*)std::malloc(httpBufSize_ + 1);
-  if (httpBuf_ == NULL) {
+  if (httpBuf_ == nullptr) {
     throw std::bad_alloc();
   }
   httpBuf_[httpBufLen_] = '\0';
 }
 
 THttpTransport::~THttpTransport() {
-  if (httpBuf_ != NULL) {
+  if (httpBuf_ != nullptr) {
     std::free(httpBuf_);
   }
 }
@@ -132,7 +132,7 @@
 
 uint32_t THttpTransport::parseChunkSize(char* line) {
   char* semi = strchr(line, ';');
-  if (semi != NULL) {
+  if (semi != nullptr) {
     *semi = '\0';
   }
   uint32_t size = 0;
@@ -166,12 +166,12 @@
 
 char* THttpTransport::readLine() {
   while (true) {
-    char* eol = NULL;
+    char* eol = nullptr;
 
     eol = strstr(httpBuf_ + httpPos_, CRLF);
 
     // No CRLF yet?
-    if (eol == NULL) {
+    if (eol == nullptr) {
       // Shift whatever we have now to front and refill
       shift();
       refill();
@@ -203,7 +203,7 @@
   if (avail <= (httpBufSize_ / 4)) {
     httpBufSize_ *= 2;
     char* tmpBuf = (char*)std::realloc(httpBuf_, httpBufSize_ + 1);
-    if (tmpBuf == NULL) {
+    if (tmpBuf == nullptr) {
       throw std::bad_alloc();
     }
     httpBuf_ = tmpBuf;
@@ -257,7 +257,7 @@
   writeBuffer_.write(buf, len);
 }
 
-const std::string THttpTransport::getOrigin() {
+const std::string THttpTransport::getOrigin() const {
   std::ostringstream oss;
   if (!origin_.empty()) {
     oss << origin_ << ", ";
diff --git a/lib/cpp/src/thrift/transport/THttpTransport.h b/lib/cpp/src/thrift/transport/THttpTransport.h
index e46ab7f..1cf36b2 100644
--- a/lib/cpp/src/thrift/transport/THttpTransport.h
+++ b/lib/cpp/src/thrift/transport/THttpTransport.h
@@ -38,25 +38,25 @@
 public:
   THttpTransport(std::shared_ptr<TTransport> transport);
 
-  virtual ~THttpTransport();
+  ~THttpTransport() override;
 
-  void open() { transport_->open(); }
+  void open() override { transport_->open(); }
 
   bool isOpen() { return transport_->isOpen(); }
 
-  bool peek() { return transport_->peek(); }
+  bool peek() override { return transport_->peek(); }
 
-  void close() { transport_->close(); }
+  void close() override { transport_->close(); }
 
   uint32_t read(uint8_t* buf, uint32_t len);
 
-  uint32_t readEnd();
+  uint32_t readEnd() override;
 
   void write(const uint8_t* buf, uint32_t len);
 
-  virtual void flush() = 0;
+  void flush() override = 0;
 
-  virtual const std::string getOrigin();
+  const std::string getOrigin() const override;
 
 protected:
   std::shared_ptr<TTransport> transport_;
diff --git a/lib/cpp/src/thrift/transport/TNonblockingSSLServerSocket.h b/lib/cpp/src/thrift/transport/TNonblockingSSLServerSocket.h
index 215c405..a38bf12 100644
--- a/lib/cpp/src/thrift/transport/TNonblockingSSLServerSocket.h
+++ b/lib/cpp/src/thrift/transport/TNonblockingSSLServerSocket.h
@@ -66,7 +66,7 @@
                    std::shared_ptr<TSSLSocketFactory> factory);
 
 protected:
-  std::shared_ptr<TSocket> createSocket(THRIFT_SOCKET socket);
+  std::shared_ptr<TSocket> createSocket(THRIFT_SOCKET socket) override;
   std::shared_ptr<TSSLSocketFactory> factory_;
 };
 }
diff --git a/lib/cpp/src/thrift/transport/TNonblockingServerSocket.cpp b/lib/cpp/src/thrift/transport/TNonblockingServerSocket.cpp
index 3d34cca..51990b0 100644
--- a/lib/cpp/src/thrift/transport/TNonblockingServerSocket.cpp
+++ b/lib/cpp/src/thrift/transport/TNonblockingServerSocket.cpp
@@ -193,7 +193,7 @@
   hints.ai_flags = AI_PASSIVE | AI_ADDRCONFIG;
 
   // If address is not specified use wildcard address (NULL)
-  TGetAddrInfoWrapper info(address_.empty() ? NULL : &address_[0], port, &hints);
+  TGetAddrInfoWrapper info(address_.empty() ? nullptr : &address_[0], port, &hints);
 
   error = info.init();
   if (error) {
@@ -206,13 +206,13 @@
   // Pick the ipv6 address first since ipv4 addresses can be mapped
   // into ipv6 space.
   for (res = info.res(); res; res = res->ai_next) {
-    if (res->ai_family == AF_INET6 || res->ai_next == NULL)
+    if (res->ai_family == AF_INET6 || res->ai_next == nullptr)
       break;
   }
 
   if (!path_.empty()) {
     serverSocket_ = socket(PF_UNIX, SOCK_STREAM, IPPROTO_IP);
-  } else if (res != NULL) {
+  } else if (res != nullptr) {
     serverSocket_ = socket(res->ai_family, res->ai_socktype, res->ai_protocol);
   }
 
@@ -372,7 +372,7 @@
 
     // Unix Domain Socket
     size_t len = path_.size() + 1;
-    if (len > sizeof(((sockaddr_un*)NULL)->sun_path)) {
+    if (len > sizeof(((sockaddr_un*)nullptr)->sun_path)) {
       errno_copy = THRIFT_GET_SOCKET_ERROR;
       GlobalOutput.perror("TSocket::listen() Unix Domain socket path too long", errno_copy);
       throw TTransportException(TTransportException::NOT_OPEN,
@@ -384,7 +384,7 @@
     address.sun_family = AF_UNIX;
     memcpy(address.sun_path, path_.c_str(), len);
 
-    socklen_t structlen = static_cast<socklen_t>(sizeof(address));
+    auto structlen = static_cast<socklen_t>(sizeof(address));
 
     if (!address.sun_path[0]) { // abstract namespace socket
 #ifdef __linux__
@@ -428,10 +428,10 @@
         GlobalOutput.perror("TNonblockingServerSocket::getPort() getsockname() ", errno_copy);
       } else {
         if (sa.ss_family == AF_INET6) {
-          const struct sockaddr_in6* sin = reinterpret_cast<const struct sockaddr_in6*>(&sa);
+          const auto* sin = reinterpret_cast<const struct sockaddr_in6*>(&sa);
           listenPort_ = ntohs(sin->sin6_port);
         } else {
-          const struct sockaddr_in* sin = reinterpret_cast<const struct sockaddr_in*>(&sa);
+          const auto* sin = reinterpret_cast<const struct sockaddr_in*>(&sa);
           listenPort_ = ntohs(sin->sin_port);
         }
       }
diff --git a/lib/cpp/src/thrift/transport/TNonblockingServerSocket.h b/lib/cpp/src/thrift/transport/TNonblockingServerSocket.h
index 8466512..a68c28d 100644
--- a/lib/cpp/src/thrift/transport/TNonblockingServerSocket.h
+++ b/lib/cpp/src/thrift/transport/TNonblockingServerSocket.h
@@ -71,7 +71,7 @@
    */
   TNonblockingServerSocket(const std::string& path);
 
-  virtual ~TNonblockingServerSocket();
+  ~TNonblockingServerSocket() override;
 
   void setSendTimeout(int sendTimeout);
   void setRecvTimeout(int recvTimeout);
@@ -97,17 +97,17 @@
   // socket, this is the place to do it.
   void setAcceptCallback(const socket_func_t& acceptCallback) { acceptCallback_ = acceptCallback; }
 
-  THRIFT_SOCKET getSocketFD() { return serverSocket_; }
+  THRIFT_SOCKET getSocketFD() override { return serverSocket_; }
 
-  int getPort();
+  int getPort() override;
   
-  int getListenPort();
+  int getListenPort() override;
 
   void listen() override;
   void close() override;
 
 protected:
-  std::shared_ptr<TSocket> acceptImpl();
+  std::shared_ptr<TSocket> acceptImpl() override;
   virtual std::shared_ptr<TSocket> createSocket(THRIFT_SOCKET client);
 
 private:
diff --git a/lib/cpp/src/thrift/transport/TNonblockingServerTransport.h b/lib/cpp/src/thrift/transport/TNonblockingServerTransport.h
index 3142e19..f811328 100644
--- a/lib/cpp/src/thrift/transport/TNonblockingServerTransport.h
+++ b/lib/cpp/src/thrift/transport/TNonblockingServerTransport.h
@@ -35,7 +35,7 @@
  */
 class TNonblockingServerTransport {
 public:
-  virtual ~TNonblockingServerTransport() {}
+  virtual ~TNonblockingServerTransport() = default;
 
   /**
    * Starts the server transport listening for new connections. Prior to this
@@ -82,7 +82,7 @@
   virtual void close() = 0;
 
 protected:
-  TNonblockingServerTransport() {}
+  TNonblockingServerTransport() = default;
 
   /**
    * Subclasses should implement this function for accept.
diff --git a/lib/cpp/src/thrift/transport/TSSLServerSocket.h b/lib/cpp/src/thrift/transport/TSSLServerSocket.h
index 8b75de8..44df432 100644
--- a/lib/cpp/src/thrift/transport/TSSLServerSocket.h
+++ b/lib/cpp/src/thrift/transport/TSSLServerSocket.h
@@ -66,7 +66,7 @@
                    std::shared_ptr<TSSLSocketFactory> factory);
 
 protected:
-  std::shared_ptr<TSocket> createSocket(THRIFT_SOCKET socket);
+  std::shared_ptr<TSocket> createSocket(THRIFT_SOCKET socket) override;
   std::shared_ptr<TSSLSocketFactory> factory_;
 };
 }
diff --git a/lib/cpp/src/thrift/transport/TSSLSocket.cpp b/lib/cpp/src/thrift/transport/TSSLSocket.cpp
index 718e9b1..636bb2d 100644
--- a/lib/cpp/src/thrift/transport/TSSLSocket.cpp
+++ b/lib/cpp/src/thrift/transport/TSSLSocket.cpp
@@ -95,7 +95,7 @@
 }
 
 static void dyn_lock(int mode, struct CRYPTO_dynlock_value* lock, const char*, int) {
-  if (lock != NULL) {
+  if (lock != nullptr) {
     if (mode & CRYPTO_LOCK) {
       lock->mutex.lock();
     } else {
@@ -180,7 +180,7 @@
     throw TSSLException("SSL_CTX_new: Unknown protocol");
   }
 
-  if (ctx_ == NULL) {
+  if (ctx_ == nullptr) {
     string errors;
     buildErrors(errors);
     throw TSSLException("SSL_CTX_new: " + errors);
@@ -196,15 +196,15 @@
 }
 
 SSLContext::~SSLContext() {
-  if (ctx_ != NULL) {
+  if (ctx_ != nullptr) {
     SSL_CTX_free(ctx_);
-    ctx_ = NULL;
+    ctx_ = nullptr;
   }
 }
 
 SSL* SSLContext::createSSL() {
   SSL* ssl = SSL_new(ctx_);
-  if (ssl == NULL) {
+  if (ssl == nullptr) {
     string errors;
     buildErrors(errors);
     throw TSSLException("SSL_new: " + errors);
@@ -214,33 +214,33 @@
 
 // TSSLSocket implementation
 TSSLSocket::TSSLSocket(std::shared_ptr<SSLContext> ctx)
-  : TSocket(), server_(false), ssl_(NULL), ctx_(ctx) {
+  : TSocket(), server_(false), ssl_(nullptr), ctx_(ctx) {
   init();
 }
 
 TSSLSocket::TSSLSocket(std::shared_ptr<SSLContext> ctx, std::shared_ptr<THRIFT_SOCKET> interruptListener)
-        : TSocket(), server_(false), ssl_(NULL), ctx_(ctx) {
+        : TSocket(), server_(false), ssl_(nullptr), ctx_(ctx) {
   init();
   interruptListener_ = interruptListener;
 }
 
 TSSLSocket::TSSLSocket(std::shared_ptr<SSLContext> ctx, THRIFT_SOCKET socket)
-  : TSocket(socket), server_(false), ssl_(NULL), ctx_(ctx) {
+  : TSocket(socket), server_(false), ssl_(nullptr), ctx_(ctx) {
   init();
 }
 
 TSSLSocket::TSSLSocket(std::shared_ptr<SSLContext> ctx, THRIFT_SOCKET socket, std::shared_ptr<THRIFT_SOCKET> interruptListener)
-        : TSocket(socket, interruptListener), server_(false), ssl_(NULL), ctx_(ctx) {
+        : TSocket(socket, interruptListener), server_(false), ssl_(nullptr), ctx_(ctx) {
   init();
 }
 
 TSSLSocket::TSSLSocket(std::shared_ptr<SSLContext> ctx, string host, int port)
-  : TSocket(host, port), server_(false), ssl_(NULL), ctx_(ctx) {
+  : TSocket(host, port), server_(false), ssl_(nullptr), ctx_(ctx) {
   init();
 }
 
 TSSLSocket::TSSLSocket(std::shared_ptr<SSLContext> ctx, string host, int port, std::shared_ptr<THRIFT_SOCKET> interruptListener)
-        : TSocket(host, port), server_(false), ssl_(NULL), ctx_(ctx) {
+        : TSocket(host, port), server_(false), ssl_(nullptr), ctx_(ctx) {
   init();
   interruptListener_ = interruptListener;
 }
@@ -267,7 +267,7 @@
 }
 
 bool TSSLSocket::isOpen() {
-  if (ssl_ == NULL || !TSocket::isOpen()) {
+  if (ssl_ == nullptr || !TSocket::isOpen()) {
     return false;
   }
   int shutdown = SSL_get_shutdown(ssl_);
@@ -334,7 +334,7 @@
  * Note: This method is not libevent safe.
 */
 void TSSLSocket::close() {
-  if (ssl_ != NULL) {
+  if (ssl_ != nullptr) {
     try {
       int rc;
       int errno_copy = 0;
@@ -375,7 +375,7 @@
       GlobalOutput.printf("SSL_shutdown: %s", te.what());
     }
     SSL_free(ssl_);
-    ssl_ = NULL;
+    ssl_ = nullptr;
     handshakeCompleted_ = false;
     ERR_remove_state(0);
   }
@@ -552,14 +552,14 @@
 
 void TSSLSocket::flush() {
   // Don't throw exception if not open. Thrift servers close socket twice.
-  if (ssl_ == NULL) {
+  if (ssl_ == nullptr) {
     return;
   }
   initializeHandshake();
   if (!checkHandshake())
     throw TSSLException("BIO_flush: Handshake is not completed");
   BIO* bio = SSL_get_wbio(ssl_);
-  if (bio == NULL) {
+  if (bio == nullptr) {
     throw TSSLException("SSL_get_wbio returns NULL");
   }
   if (BIO_flush(bio) != 1) {
@@ -597,7 +597,7 @@
     return;
   }
 
-  if (ssl_ == NULL) {
+  if (ssl_ == nullptr) {
     initializeHandshakeParams();
   }
 
@@ -683,19 +683,19 @@
   }
 
   X509* cert = SSL_get_peer_certificate(ssl_);
-  if (cert == NULL) {
+  if (cert == nullptr) {
     // certificate is not present
     if (SSL_get_verify_mode(ssl_) & SSL_VERIFY_FAIL_IF_NO_PEER_CERT) {
       throw TSSLException("authorize: required certificate not present");
     }
     // certificate was optional: didn't intend to authorize remote
-    if (server() && access_ != NULL) {
+    if (server() && access_ != nullptr) {
       throw TSSLException("authorize: certificate required for authorization");
     }
     return;
   }
   // certificate is present
-  if (access_ == NULL) {
+  if (access_ == nullptr) {
     X509_free(cert);
     return;
   }
@@ -720,13 +720,13 @@
   }
 
   // extract subjectAlternativeName
-  STACK_OF(GENERAL_NAME)* alternatives
-      = (STACK_OF(GENERAL_NAME)*)X509_get_ext_d2i(cert, NID_subject_alt_name, NULL, NULL);
-  if (alternatives != NULL) {
+  auto* alternatives
+      = (STACK_OF(GENERAL_NAME)*)X509_get_ext_d2i(cert, NID_subject_alt_name, nullptr, nullptr);
+  if (alternatives != nullptr) {
     const int count = sk_GENERAL_NAME_num(alternatives);
     for (int i = 0; decision == AccessManager::SKIP && i < count; i++) {
       const GENERAL_NAME* name = sk_GENERAL_NAME_value(alternatives, i);
-      if (name == NULL) {
+      if (name == nullptr) {
         continue;
       }
       char* data = (char*)ASN1_STRING_data(name->d.ia5);
@@ -756,7 +756,7 @@
 
   // extract commonName
   X509_NAME* name = X509_get_subject_name(cert);
-  if (name != NULL) {
+  if (name != nullptr) {
     X509_NAME_ENTRY* entry;
     unsigned char* utf8;
     int last = -1;
@@ -765,7 +765,7 @@
       if (last == -1)
         break;
       entry = X509_NAME_get_entry(name, last);
-      if (entry == NULL)
+      if (entry == nullptr)
         continue;
       ASN1_STRING* common = X509_NAME_ENTRY_get_data(entry);
       int size = ASN1_STRING_to_UTF8(&utf8, common);
@@ -795,7 +795,7 @@
     bio = SSL_get_wbio(ssl_);
   }
 
-  if (bio == NULL) {
+  if (bio == nullptr) {
     throw TSSLException("SSL_get_?bio returned NULL");
   }
 
@@ -908,10 +908,10 @@
 
 void TSSLSocketFactory::setup(std::shared_ptr<TSSLSocket> ssl) {
   ssl->server(server());
-  if (access_ == NULL && !server()) {
+  if (access_ == nullptr && !server()) {
     access_ = std::shared_ptr<AccessManager>(new DefaultClientAccessManager);
   }
-  if (access_ != NULL) {
+  if (access_ != nullptr) {
     ssl->access(access_);
   }
 }
@@ -935,11 +935,11 @@
   } else {
     mode = SSL_VERIFY_NONE;
   }
-  SSL_CTX_set_verify(ctx_->get(), mode, NULL);
+  SSL_CTX_set_verify(ctx_->get(), mode, nullptr);
 }
 
 void TSSLSocketFactory::loadCertificate(const char* path, const char* format) {
-  if (path == NULL || format == NULL) {
+  if (path == nullptr || format == nullptr) {
     throw TTransportException(TTransportException::BAD_ARGS,
                               "loadCertificateChain: either <path> or <format> is NULL");
   }
@@ -956,7 +956,7 @@
 }
 
 void TSSLSocketFactory::loadPrivateKey(const char* path, const char* format) {
-  if (path == NULL || format == NULL) {
+  if (path == nullptr || format == nullptr) {
     throw TTransportException(TTransportException::BAD_ARGS,
                               "loadPrivateKey: either <path> or <format> is NULL");
   }
@@ -971,7 +971,7 @@
 }
 
 void TSSLSocketFactory::loadTrustedCertificates(const char* path, const char* capath) {
-  if (path == NULL) {
+  if (path == nullptr) {
     throw TTransportException(TTransportException::BAD_ARGS,
                               "loadTrustedCertificates: <path> is NULL");
   }
@@ -993,7 +993,7 @@
 }
 
 int TSSLSocketFactory::passwordCallback(char* password, int size, int, void* data) {
-  TSSLSocketFactory* factory = (TSSLSocketFactory*)data;
+  auto* factory = (TSSLSocketFactory*)data;
   string userPassword;
   factory->getPassword(userPassword, size);
   int length = static_cast<int>(userPassword.size());
@@ -1016,7 +1016,7 @@
       errors += "; ";
     }
     const char* reason = ERR_reason_error_string(errorCode);
-    if (reason == NULL) {
+    if (reason == nullptr) {
       THRIFT_SNPRINTF(message, sizeof(message) - 1, "SSL error # %lu", errorCode);
       reason = message;
     }
@@ -1054,7 +1054,7 @@
 Decision DefaultClientAccessManager::verify(const string& host,
                                             const char* name,
                                             int size) noexcept {
-  if (host.empty() || name == NULL || size <= 0) {
+  if (host.empty() || name == nullptr || size <= 0) {
     return SKIP;
   }
   return (matchName(host.c_str(), name, size) ? ALLOW : SKIP);
diff --git a/lib/cpp/src/thrift/transport/TSSLSocket.h b/lib/cpp/src/thrift/transport/TSSLSocket.h
index 5a87d1e..8f095dc 100644
--- a/lib/cpp/src/thrift/transport/TSSLSocket.h
+++ b/lib/cpp/src/thrift/transport/TSSLSocket.h
@@ -69,19 +69,19 @@
  */
 class TSSLSocket : public TSocket {
 public:
-  ~TSSLSocket();
+  ~TSSLSocket() override;
   /**
    * TTransport interface.
    */
   bool isOpen();
-  bool peek();
-  void open();
-  void close();
-  bool hasPendingDataToRead();
-  uint32_t read(uint8_t* buf, uint32_t len);
-  void write(const uint8_t* buf, uint32_t len);
-  uint32_t write_partial(const uint8_t* buf, uint32_t len);
-  void flush();
+  bool peek() override;
+  void open() override;
+  void close() override;
+  bool hasPendingDataToRead() override;
+  uint32_t read(uint8_t* buf, uint32_t len) override;
+  void write(const uint8_t* buf, uint32_t len) override;
+  uint32_t write_partial(const uint8_t* buf, uint32_t len) override;
+  void flush() override;
   /**
   * Set whether to use client or server side SSL handshake protocol.
   *
@@ -273,7 +273,7 @@
    *
    * @param path Path to trusted certificate file
    */
-  virtual void loadTrustedCertificates(const char* path, const char* capath = NULL);
+  virtual void loadTrustedCertificates(const char* path, const char* capath = nullptr);
   /**
    * Default randomize method.
    */
@@ -334,7 +334,7 @@
   TSSLException(const std::string& message)
     : TTransportException(TTransportException::INTERNAL_ERROR, message) {}
 
-  virtual const char* what() const noexcept {
+  const char* what() const noexcept override {
     if (message_.empty()) {
       return "TSSLException";
     } else {
@@ -373,7 +373,7 @@
   /**
    * Destructor
    */
-  virtual ~AccessManager() {}
+  virtual ~AccessManager() = default;
   /**
    * Determine whether the peer should be granted access or not. It's called
    * once after the SSL handshake completes successfully, before peer certificate
@@ -425,9 +425,9 @@
 class DefaultClientAccessManager : public AccessManager {
 public:
   // AccessManager interface
-  Decision verify(const sockaddr_storage& sa) noexcept;
-  Decision verify(const std::string& host, const char* name, int size) noexcept;
-  Decision verify(const sockaddr_storage& sa, const char* data, int size) noexcept;
+  Decision verify(const sockaddr_storage& sa) noexcept override;
+  Decision verify(const std::string& host, const char* name, int size) noexcept override;
+  Decision verify(const sockaddr_storage& sa, const char* data, int size) noexcept override;
 };
 }
 }
diff --git a/lib/cpp/src/thrift/transport/TServerSocket.cpp b/lib/cpp/src/thrift/transport/TServerSocket.cpp
index 118b993..1732c82 100644
--- a/lib/cpp/src/thrift/transport/TServerSocket.cpp
+++ b/lib/cpp/src/thrift/transport/TServerSocket.cpp
@@ -85,15 +85,15 @@
 TGetAddrInfoWrapper::TGetAddrInfoWrapper(const char* node,
                                          const char* service,
                                          const struct addrinfo* hints)
-  : node_(node), service_(service), hints_(hints), res_(NULL) {}
+  : node_(node), service_(service), hints_(hints), res_(nullptr) {}
 
 TGetAddrInfoWrapper::~TGetAddrInfoWrapper() {
-  if (this->res_ != NULL)
+  if (this->res_ != nullptr)
     freeaddrinfo(this->res_);
 }
 
 int TGetAddrInfoWrapper::init() {
-  if (this->res_ == NULL)
+  if (this->res_ == nullptr)
     return getaddrinfo(this->node_, this->service_, this->hints_, &(this->res_));
   return 0;
 }
@@ -268,7 +268,7 @@
   hints.ai_flags = AI_PASSIVE | AI_ADDRCONFIG;
 
   // If address is not specified use wildcard address (NULL)
-  TGetAddrInfoWrapper info(address_.empty() ? NULL : &address_[0], port, &hints);
+  TGetAddrInfoWrapper info(address_.empty() ? nullptr : &address_[0], port, &hints);
 
   error = info.init();
   if (error) {
@@ -281,13 +281,13 @@
   // Pick the ipv6 address first since ipv4 addresses can be mapped
   // into ipv6 space.
   for (res = info.res(); res; res = res->ai_next) {
-    if (res->ai_family == AF_INET6 || res->ai_next == NULL)
+    if (res->ai_family == AF_INET6 || res->ai_next == nullptr)
       break;
   }
 
   if (!path_.empty()) {
     serverSocket_ = socket(PF_UNIX, SOCK_STREAM, IPPROTO_IP);
-  } else if (res != NULL) {
+  } else if (res != nullptr) {
     serverSocket_ = socket(res->ai_family, res->ai_socktype, res->ai_protocol);
   }
 
@@ -434,7 +434,7 @@
 
     // Unix Domain Socket
     size_t len = path_.size() + 1;
-    if (len > sizeof(((sockaddr_un*)NULL)->sun_path)) {
+    if (len > sizeof(((sockaddr_un*)nullptr)->sun_path)) {
       errno_copy = THRIFT_GET_SOCKET_ERROR;
       GlobalOutput.perror("TSocket::listen() Unix Domain socket path too long", errno_copy);
       throw TTransportException(TTransportException::NOT_OPEN,
@@ -446,7 +446,7 @@
     address.sun_family = AF_UNIX;
     memcpy(address.sun_path, path_.c_str(), len);
 
-    socklen_t structlen = static_cast<socklen_t>(sizeof(address));
+    auto structlen = static_cast<socklen_t>(sizeof(address));
 
     if (!address.sun_path[0]) { // abstract namespace socket
 #ifdef __linux__
@@ -490,10 +490,10 @@
         GlobalOutput.perror("TServerSocket::getPort() getsockname() ", errno_copy);
       } else {
         if (sa.ss_family == AF_INET6) {
-          const struct sockaddr_in6* sin = reinterpret_cast<const struct sockaddr_in6*>(&sa);
+          const auto* sin = reinterpret_cast<const struct sockaddr_in6*>(&sa);
           port_ = ntohs(sin->sin6_port);
         } else {
-          const struct sockaddr_in* sin = reinterpret_cast<const struct sockaddr_in*>(&sa);
+          const auto* sin = reinterpret_cast<const struct sockaddr_in*>(&sa);
           port_ = ntohs(sin->sin_port);
         }
       }
diff --git a/lib/cpp/src/thrift/transport/TServerSocket.h b/lib/cpp/src/thrift/transport/TServerSocket.h
index b23d2c1..d640968 100644
--- a/lib/cpp/src/thrift/transport/TServerSocket.h
+++ b/lib/cpp/src/thrift/transport/TServerSocket.h
@@ -96,7 +96,7 @@
    */
   TServerSocket(const std::string& path);
 
-  virtual ~TServerSocket();
+  ~TServerSocket() override;
 
   void setSendTimeout(int sendTimeout);
   void setRecvTimeout(int recvTimeout);
@@ -136,17 +136,17 @@
   // \throws std::logic_error if listen() has been called
   void setInterruptableChildren(bool enable);
 
-  THRIFT_SOCKET getSocketFD() { return serverSocket_; }
+  THRIFT_SOCKET getSocketFD() override { return serverSocket_; }
 
   int getPort();
 
-  void listen();
-  void interrupt();
-  void interruptChildren();
-  void close();
+  void listen() override;
+  void interrupt() override;
+  void interruptChildren() override;
+  void close() override;
 
 protected:
-  std::shared_ptr<TTransport> acceptImpl();
+  std::shared_ptr<TTransport> acceptImpl() override;
   virtual std::shared_ptr<TSocket> createSocket(THRIFT_SOCKET client);
   bool interruptableChildren_;
   std::shared_ptr<THRIFT_SOCKET> pChildInterruptSockReader_; // if interruptableChildren_ this is shared with child TSockets
diff --git a/lib/cpp/src/thrift/transport/TServerTransport.h b/lib/cpp/src/thrift/transport/TServerTransport.h
index db7632a..f465bb3 100644
--- a/lib/cpp/src/thrift/transport/TServerTransport.h
+++ b/lib/cpp/src/thrift/transport/TServerTransport.h
@@ -35,7 +35,7 @@
  */
 class TServerTransport {
 public:
-  virtual ~TServerTransport() {}
+  virtual ~TServerTransport() = default;
 
   /**
    * Starts the server transport listening for new connections. Prior to this
@@ -96,7 +96,7 @@
   virtual void close() = 0;
 
 protected:
-  TServerTransport() {}
+  TServerTransport() = default;
 
   /**
    * Subclasses should implement this function for accept.
diff --git a/lib/cpp/src/thrift/transport/TShortReadTransport.h b/lib/cpp/src/thrift/transport/TShortReadTransport.h
index 118252d..2151606 100644
--- a/lib/cpp/src/thrift/transport/TShortReadTransport.h
+++ b/lib/cpp/src/thrift/transport/TShortReadTransport.h
@@ -43,11 +43,11 @@
 
   bool isOpen() { return transport_->isOpen(); }
 
-  bool peek() { return transport_->peek(); }
+  bool peek() override { return transport_->peek(); }
 
-  void open() { transport_->open(); }
+  void open() override { transport_->open(); }
 
-  void close() { transport_->close(); }
+  void close() override { transport_->close(); }
 
   uint32_t read(uint8_t* buf, uint32_t len) {
     if (len == 0) {
@@ -62,7 +62,7 @@
 
   void write(const uint8_t* buf, uint32_t len) { transport_->write(buf, len); }
 
-  void flush() { transport_->flush(); }
+  void flush() override { transport_->flush(); }
 
   const uint8_t* borrow(uint8_t* buf, uint32_t* len) { return transport_->borrow(buf, len); }
 
diff --git a/lib/cpp/src/thrift/transport/TSocket.cpp b/lib/cpp/src/thrift/transport/TSocket.cpp
index 6d5f932..977834d 100644
--- a/lib/cpp/src/thrift/transport/TSocket.cpp
+++ b/lib/cpp/src/thrift/transport/TSocket.cpp
@@ -324,7 +324,7 @@
 
 #ifndef _WIN32
     size_t len = path_.size() + 1;
-    if (len > sizeof(((sockaddr_un*)NULL)->sun_path)) {
+    if (len > sizeof(((sockaddr_un*)nullptr)->sun_path)) {
       int errno_copy = THRIFT_GET_SOCKET_ERROR;
       GlobalOutput.perror("TSocket::open() Unix Domain socket path too long", errno_copy);
       throw TTransportException(TTransportException::NOT_OPEN, " Unix Domain socket path too long");
@@ -334,7 +334,7 @@
     address.sun_family = AF_UNIX;
     memcpy(address.sun_path, path_.c_str(), len);
 
-    socklen_t structlen = static_cast<socklen_t>(sizeof(address));
+    auto structlen = static_cast<socklen_t>(sizeof(address));
 
     if (!address.sun_path[0]) { // abstract namespace socket
 #ifdef __linux__
@@ -433,7 +433,7 @@
 void TSocket::unix_open() {
   if (!path_.empty()) {
     // Unix Domain SOcket does not need addrinfo struct, so we pass NULL
-    openConnection(NULL);
+    openConnection(nullptr);
   }
 }
 
@@ -453,8 +453,8 @@
   }
 
   struct addrinfo hints, *res, *res0;
-  res = NULL;
-  res0 = NULL;
+  res = nullptr;
+  res0 = nullptr;
   int error;
   char port[sizeof("65535")];
   std::memset(&hints, 0, sizeof(hints));
@@ -540,7 +540,7 @@
   // Read from the socket
   struct timeval begin;
   if (recvTimeout_ > 0) {
-    THRIFT_GETTIMEOFDAY(&begin, NULL);
+    THRIFT_GETTIMEOFDAY(&begin, nullptr);
   } else {
     // if there is no read timeout we don't need the TOD to determine whether
     // an THRIFT_EAGAIN is due to a timeout or an out-of-resource condition.
@@ -592,8 +592,8 @@
       }
       // check if this is the lack of resources or timeout case
       struct timeval end;
-      THRIFT_GETTIMEOFDAY(&end, NULL);
-      uint32_t readElapsedMicros = static_cast<uint32_t>(((end.tv_sec - begin.tv_sec) * 1000 * 1000)
+      THRIFT_GETTIMEOFDAY(&end, nullptr);
+      auto readElapsedMicros = static_cast<uint32_t>(((end.tv_sec - begin.tv_sec) * 1000 * 1000)
                                                          + (end.tv_usec - begin.tv_usec));
 
       if (!eagainThresholdMicros || (readElapsedMicros < eagainThresholdMicros)) {
@@ -807,7 +807,7 @@
   maxRecvRetries_ = maxRecvRetries;
 }
 
-string TSocket::getSocketInfo() {
+string TSocket::getSocketInfo() const {
   std::ostringstream oss;
   if (path_.empty()) {
     if (host_.empty() || port_ == 0) {
@@ -822,7 +822,7 @@
   return oss.str();
 }
 
-std::string TSocket::getPeerHost() {
+std::string TSocket::getPeerHost() const {
   if (peerHost_.empty() && path_.empty()) {
     struct sockaddr_storage addr;
     struct sockaddr* addrPtr;
@@ -834,14 +834,14 @@
 
     addrPtr = getCachedAddress(&addrLen);
 
-    if (addrPtr == NULL) {
+    if (addrPtr == nullptr) {
       addrLen = sizeof(addr);
       if (getpeername(socket_, (sockaddr*)&addr, &addrLen) != 0) {
         return peerHost_;
       }
       addrPtr = (sockaddr*)&addr;
 
-      setCachedAddress(addrPtr, addrLen);
+      const_cast<TSocket&>(*this).setCachedAddress(addrPtr, addrLen);
     }
 
     char clienthost[NI_MAXHOST];
@@ -860,7 +860,7 @@
   return peerHost_;
 }
 
-std::string TSocket::getPeerAddress() {
+std::string TSocket::getPeerAddress() const {
   if (peerAddress_.empty() && path_.empty()) {
     struct sockaddr_storage addr;
     struct sockaddr* addrPtr;
@@ -872,14 +872,14 @@
 
     addrPtr = getCachedAddress(&addrLen);
 
-    if (addrPtr == NULL) {
+    if (addrPtr == nullptr) {
       addrLen = sizeof(addr);
       if (getpeername(socket_, (sockaddr*)&addr, &addrLen) != 0) {
         return peerAddress_;
       }
       addrPtr = (sockaddr*)&addr;
 
-      setCachedAddress(addrPtr, addrLen);
+      const_cast<TSocket&>(*this).setCachedAddress(addrPtr, addrLen);
     }
 
     char clienthost[NI_MAXHOST];
@@ -899,7 +899,7 @@
   return peerAddress_;
 }
 
-int TSocket::getPeerPort() {
+int TSocket::getPeerPort() const {
   getPeerAddress();
   return peerPort_;
 }
@@ -937,7 +937,7 @@
     return (sockaddr*)&cachedPeerAddr_.ipv6;
 
   default:
-    return NULL;
+    return nullptr;
   }
 }
 
@@ -949,7 +949,7 @@
   return useLowMinRto_;
 }
 
-const std::string TSocket::getOrigin() {
+const std::string TSocket::getOrigin() const {
   std::ostringstream oss;
   oss << getPeerHost() << ":" << getPeerPort();
   return oss.str();
diff --git a/lib/cpp/src/thrift/transport/TSocket.h b/lib/cpp/src/thrift/transport/TSocket.h
index 9dcd2d6..b0e8ade 100644
--- a/lib/cpp/src/thrift/transport/TSocket.h
+++ b/lib/cpp/src/thrift/transport/TSocket.h
@@ -74,7 +74,7 @@
   /**
    * Destroyes the socket object, closing it if necessary.
    */
-  virtual ~TSocket();
+  ~TSocket() override;
 
   /**
    * Whether the socket is alive.
@@ -208,22 +208,22 @@
   /**
    * Get socket information formatted as a string <Host: x Port: x>
    */
-  std::string getSocketInfo();
+  std::string getSocketInfo() const;
 
   /**
    * Returns the DNS name of the host to which the socket is connected
    */
-  std::string getPeerHost();
+  std::string getPeerHost() const;
 
   /**
    * Returns the address of the host to which the socket is connected
    */
-  std::string getPeerAddress();
+  std::string getPeerAddress() const;
 
   /**
    * Returns the port of the host to which the socket is connected
    **/
-  int getPeerPort();
+  int getPeerPort() const;
 
   /**
    * Returns the underlying socket file descriptor.
@@ -259,7 +259,7 @@
    *
    * @return string peer host identifier and port
    */
-  virtual const std::string getOrigin();
+  const std::string getOrigin() const override;
 
   /**
    * Constructor to create socket from file descriptor.
@@ -295,13 +295,13 @@
   THRIFT_SOCKET socket_;
 
   /** Peer hostname */
-  std::string peerHost_;
+  mutable std::string peerHost_;
 
   /** Peer address */
-  std::string peerAddress_;
+  mutable std::string peerAddress_;
 
   /** Peer port */
-  int peerPort_;
+  mutable int peerPort_;
 
   /**
    * A shared socket pointer that will interrupt a blocking read if data
diff --git a/lib/cpp/src/thrift/transport/TSocketPool.cpp b/lib/cpp/src/thrift/transport/TSocketPool.cpp
index 5477bbb..89eee6e 100644
--- a/lib/cpp/src/thrift/transport/TSocketPool.cpp
+++ b/lib/cpp/src/thrift/transport/TSocketPool.cpp
@@ -216,7 +216,7 @@
 
     if (server->lastFailTime_ > 0) {
       // The server was marked as down, so check if enough time has elapsed to retry
-      time_t elapsedTime = time(NULL) - server->lastFailTime_;
+      time_t elapsedTime = time(nullptr) - server->lastFailTime_;
       if (elapsedTime > retryInterval_) {
         retryIntervalPassed = true;
       }
@@ -245,7 +245,7 @@
       if (server->consecutiveFailures_ > maxConsecutiveFailures_) {
         // Mark server as down
         server->consecutiveFailures_ = 0;
-        server->lastFailTime_ = time(NULL);
+        server->lastFailTime_ = time(nullptr);
       }
     }
   }
diff --git a/lib/cpp/src/thrift/transport/TSocketPool.h b/lib/cpp/src/thrift/transport/TSocketPool.h
index 18f101c..97a2b90 100644
--- a/lib/cpp/src/thrift/transport/TSocketPool.h
+++ b/lib/cpp/src/thrift/transport/TSocketPool.h
@@ -105,7 +105,7 @@
   /**
    * Destroyes the socket object, closing it if necessary.
    */
-  virtual ~TSocketPool();
+  ~TSocketPool() override;
 
   /**
    * Add a server to the pool
@@ -155,12 +155,12 @@
   /**
    * Creates and opens the UNIX socket.
    */
-  void open();
+  void open() override;
 
   /*
    * Closes the UNIX socket
    */
-  void close();
+  void close() override;
 
 protected:
   void setCurrentServer(const std::shared_ptr<TSocketPoolServer>& server);
diff --git a/lib/cpp/src/thrift/transport/TTransport.h b/lib/cpp/src/thrift/transport/TTransport.h
index 0f92277..891bfe1 100644
--- a/lib/cpp/src/thrift/transport/TTransport.h
+++ b/lib/cpp/src/thrift/transport/TTransport.h
@@ -58,7 +58,7 @@
   /**
    * Virtual deconstructor.
    */
-  virtual ~TTransport() {}
+  virtual ~TTransport() = default;
 
   /**
    * Whether this transport is open.
@@ -209,7 +209,7 @@
     T_VIRTUAL_CALL();
     return borrow_virt(buf, len);
   }
-  virtual const uint8_t* borrow_virt(uint8_t* /* buf */, uint32_t* /* len */) { return NULL; }
+  virtual const uint8_t* borrow_virt(uint8_t* /* buf */, uint32_t* /* len */) { return nullptr; }
 
   /**
    * Remove len bytes from the transport.  This should always follow a borrow
@@ -236,13 +236,13 @@
    *
    * The returned value can be used in a log message for example
    */
-  virtual const std::string getOrigin() { return "Unknown"; }
+  virtual const std::string getOrigin() const { return "Unknown"; }
 
 protected:
   /**
    * Simple constructor.
    */
-  TTransport() {}
+  TTransport() = default;
 };
 
 /**
@@ -253,9 +253,9 @@
  */
 class TTransportFactory {
 public:
-  TTransportFactory() {}
+  TTransportFactory() = default;
 
-  virtual ~TTransportFactory() {}
+  virtual ~TTransportFactory() = default;
 
   /**
    * Default implementation does nothing, just returns the transport given.
diff --git a/lib/cpp/src/thrift/transport/TTransportException.h b/lib/cpp/src/thrift/transport/TTransportException.h
index fb5f00c..38b7521 100644
--- a/lib/cpp/src/thrift/transport/TTransportException.h
+++ b/lib/cpp/src/thrift/transport/TTransportException.h
@@ -65,7 +65,7 @@
   TTransportException(TTransportExceptionType type, const std::string& message, int errno_copy)
     : apache::thrift::TException(message + ": " + TOutput::strerror_s(errno_copy)), type_(type) {}
 
-  virtual ~TTransportException() noexcept {}
+  ~TTransportException() noexcept override = default;
 
   /**
    * Returns an error code that provides information about the type of error
@@ -75,7 +75,7 @@
    */
   TTransportExceptionType getType() const noexcept { return type_; }
 
-  virtual const char* what() const noexcept;
+  const char* what() const noexcept override;
 
 protected:
   /** Just like strerror_r but returns a C++ string object. */
diff --git a/lib/cpp/src/thrift/transport/TTransportUtils.cpp b/lib/cpp/src/thrift/transport/TTransportUtils.cpp
index eedcde1..69372f3 100644
--- a/lib/cpp/src/thrift/transport/TTransportUtils.cpp
+++ b/lib/cpp/src/thrift/transport/TTransportUtils.cpp
@@ -41,8 +41,8 @@
     // Double the size of the underlying buffer if it is full
     if (rLen_ == rBufSize_) {
       rBufSize_ *= 2;
-      uint8_t *tmpBuf = (uint8_t*)std::realloc(rBuf_, sizeof(uint8_t) * rBufSize_);
-      if (tmpBuf == NULL) {
+      auto *tmpBuf = (uint8_t*)std::realloc(rBuf_, sizeof(uint8_t) * rBufSize_);
+      if (tmpBuf == nullptr) {
        throw std::bad_alloc();
       }
       rBuf_ = tmpBuf;
@@ -77,8 +77,8 @@
     while ((len + wLen_) >= newBufSize) {
       newBufSize *= 2;
     }
-    uint8_t *tmpBuf= (uint8_t*)std::realloc(wBuf_, sizeof(uint8_t) * newBufSize);
-    if (tmpBuf == NULL) {
+    auto *tmpBuf= (uint8_t*)std::realloc(wBuf_, sizeof(uint8_t) * newBufSize);
+    if (tmpBuf == nullptr) {
       throw std::bad_alloc();
     }
     wBuf_ = tmpBuf;
@@ -108,8 +108,7 @@
   : TPipedTransport(srcTrans, dstTrans), srcTrans_(srcTrans) {
 }
 
-TPipedFileReaderTransport::~TPipedFileReaderTransport() {
-}
+TPipedFileReaderTransport::~TPipedFileReaderTransport() = default;
 
 bool TPipedFileReaderTransport::isOpen() const {
   return TPipedTransport::isOpen();
diff --git a/lib/cpp/src/thrift/transport/TTransportUtils.h b/lib/cpp/src/thrift/transport/TTransportUtils.h
index 8d67763..6cff76a 100644
--- a/lib/cpp/src/thrift/transport/TTransportUtils.h
+++ b/lib/cpp/src/thrift/transport/TTransportUtils.h
@@ -42,13 +42,13 @@
  */
 class TNullTransport : public TVirtualTransport<TNullTransport> {
 public:
-  TNullTransport() {}
+  TNullTransport() = default;
 
-  ~TNullTransport() {}
+  ~TNullTransport() override = default;
 
   bool isOpen() { return true; }
 
-  void open() {}
+  void open() override {}
 
   void write(const uint8_t* /* buf */, uint32_t /* len */) { return; }
 };
@@ -77,11 +77,11 @@
     pipeOnWrite_ = false;
 
     rBuf_ = (uint8_t*)std::malloc(sizeof(uint8_t) * rBufSize_);
-    if (rBuf_ == NULL) {
+    if (rBuf_ == nullptr) {
       throw std::bad_alloc();
     }
     wBuf_ = (uint8_t*)std::malloc(sizeof(uint8_t) * wBufSize_);
-    if (wBuf_ == NULL) {
+    if (wBuf_ == nullptr) {
       throw std::bad_alloc();
     }
   }
@@ -98,16 +98,16 @@
       wLen_(0) {
 
     rBuf_ = (uint8_t*)std::malloc(sizeof(uint8_t) * rBufSize_);
-    if (rBuf_ == NULL) {
+    if (rBuf_ == nullptr) {
       throw std::bad_alloc();
     }
     wBuf_ = (uint8_t*)std::malloc(sizeof(uint8_t) * wBufSize_);
-    if (wBuf_ == NULL) {
+    if (wBuf_ == nullptr) {
       throw std::bad_alloc();
     }
   }
 
-  ~TPipedTransport() {
+  ~TPipedTransport() override {
     std::free(rBuf_);
     std::free(wBuf_);
   }
@@ -119,8 +119,8 @@
       // Double the size of the underlying buffer if it is full
       if (rLen_ == rBufSize_) {
         rBufSize_ *= 2;
-        uint8_t * tmpBuf = (uint8_t*)std::realloc(rBuf_, sizeof(uint8_t) * rBufSize_);
-	if (tmpBuf == NULL) {
+        auto * tmpBuf = (uint8_t*)std::realloc(rBuf_, sizeof(uint8_t) * rBufSize_);
+	if (tmpBuf == nullptr) {
 	  throw std::bad_alloc();
 	}
 	rBuf_ = tmpBuf;
@@ -142,7 +142,7 @@
 
   uint32_t read(uint8_t* buf, uint32_t len);
 
-  uint32_t readEnd() {
+  uint32_t readEnd() override {
 
     if (pipeOnRead_) {
       dstTrans_->write(rBuf_, rPos_);
@@ -164,7 +164,7 @@
 
   void write(const uint8_t* buf, uint32_t len);
 
-  uint32_t writeEnd() {
+  uint32_t writeEnd() override {
     if (pipeOnWrite_) {
       dstTrans_->write(wBuf_, wLen_);
       dstTrans_->flush();
@@ -172,7 +172,7 @@
     return wLen_;
   }
 
-  void flush();
+  void flush() override;
 
   std::shared_ptr<TTransport> getTargetTransport() { return dstTrans_; }
 
@@ -207,11 +207,11 @@
  */
 class TPipedTransportFactory : public TTransportFactory {
 public:
-  TPipedTransportFactory() {}
+  TPipedTransportFactory() = default;
   TPipedTransportFactory(std::shared_ptr<TTransport> dstTrans) {
     initializeTargetTransport(dstTrans);
   }
-  virtual ~TPipedTransportFactory() {}
+  ~TPipedTransportFactory() override = default;
 
   /**
    * Wraps the base transport into a piped transport.
@@ -221,7 +221,7 @@
   }
 
   virtual void initializeTargetTransport(std::shared_ptr<TTransport> dstTrans) {
-    if (dstTrans_.get() == NULL) {
+    if (dstTrans_.get() == nullptr) {
       dstTrans_ = dstTrans;
     } else {
       throw TException("Target transport already initialized");
@@ -243,7 +243,7 @@
   TPipedFileReaderTransport(std::shared_ptr<TFileReaderTransport> srcTrans,
                             std::shared_ptr<TTransport> dstTrans);
 
-  ~TPipedFileReaderTransport();
+  ~TPipedFileReaderTransport() override;
 
   // TTransport functions
   bool isOpen() const override;
@@ -252,18 +252,18 @@
   void close() override;
   uint32_t read(uint8_t* buf, uint32_t len);
   uint32_t readAll(uint8_t* buf, uint32_t len);
-  uint32_t readEnd();
+  uint32_t readEnd() override;
   void write(const uint8_t* buf, uint32_t len);
-  uint32_t writeEnd();
-  void flush();
+  uint32_t writeEnd() override;
+  void flush() override;
 
   // TFileReaderTransport functions
-  int32_t getReadTimeout();
-  void setReadTimeout(int32_t readTimeout);
-  uint32_t getNumChunks();
-  uint32_t getCurChunk();
-  void seekToChunk(int32_t chunk);
-  void seekToEnd();
+  int32_t getReadTimeout() override;
+  void setReadTimeout(int32_t readTimeout) override;
+  uint32_t getNumChunks() override;
+  uint32_t getCurChunk() override;
+  void seekToChunk(int32_t chunk) override;
+  void seekToEnd() override;
 
   /*
    * Override TTransport *_virt() functions to invoke our implementations.
@@ -286,15 +286,15 @@
  */
 class TPipedFileReaderTransportFactory : public TPipedTransportFactory {
 public:
-  TPipedFileReaderTransportFactory() {}
+  TPipedFileReaderTransportFactory() = default;
   TPipedFileReaderTransportFactory(std::shared_ptr<TTransport> dstTrans)
     : TPipedTransportFactory(dstTrans) {}
-  virtual ~TPipedFileReaderTransportFactory() {}
+  ~TPipedFileReaderTransportFactory() override = default;
 
-  std::shared_ptr<TTransport> getTransport(std::shared_ptr<TTransport> srcTrans) {
+  std::shared_ptr<TTransport> getTransport(std::shared_ptr<TTransport> srcTrans) override {
     std::shared_ptr<TFileReaderTransport> pFileReaderTransport
         = std::dynamic_pointer_cast<TFileReaderTransport>(srcTrans);
-    if (pFileReaderTransport.get() != NULL) {
+    if (pFileReaderTransport.get() != nullptr) {
       return getFileReaderTransport(pFileReaderTransport);
     } else {
       return std::shared_ptr<TTransport>();
diff --git a/lib/cpp/src/thrift/transport/TVirtualTransport.h b/lib/cpp/src/thrift/transport/TVirtualTransport.h
index b5518cc..0a04857 100644
--- a/lib/cpp/src/thrift/transport/TVirtualTransport.h
+++ b/lib/cpp/src/thrift/transport/TVirtualTransport.h
@@ -57,7 +57,7 @@
   void consume(uint32_t len) { this->TTransport::consume_virt(len); }
 
 protected:
-  TTransportDefaults() {}
+  TTransportDefaults() = default;
 };
 
 /**
@@ -113,12 +113,12 @@
    * the correct parent implementation, if desired.
    */
   uint32_t readAll(uint8_t* buf, uint32_t len) {
-    Transport_* trans = static_cast<Transport_*>(this);
+    auto* trans = static_cast<Transport_*>(this);
     return ::apache::thrift::transport::readAll(*trans, buf, len);
   }
 
 protected:
-  TVirtualTransport() {}
+  TVirtualTransport() = default;
 
   /*
    * Templatized constructors, to allow arguments to be passed to the Super_
diff --git a/lib/cpp/src/thrift/transport/TZlibTransport.cpp b/lib/cpp/src/thrift/transport/TZlibTransport.cpp
index e426dc3..ddceb99 100644
--- a/lib/cpp/src/thrift/transport/TZlibTransport.cpp
+++ b/lib/cpp/src/thrift/transport/TZlibTransport.cpp
@@ -331,7 +331,7 @@
     *len = (uint32_t)readAvail();
     return urbuf_ + urpos_;
   }
-  return NULL;
+  return nullptr;
 }
 
 void TZlibTransport::consume(uint32_t len) {
diff --git a/lib/cpp/src/thrift/transport/TZlibTransport.h b/lib/cpp/src/thrift/transport/TZlibTransport.h
index a9b2664..be2d198 100644
--- a/lib/cpp/src/thrift/transport/TZlibTransport.h
+++ b/lib/cpp/src/thrift/transport/TZlibTransport.h
@@ -36,9 +36,9 @@
   TZlibTransportException(int status, const char* msg)
     : TTransportException(TTransportException::INTERNAL_ERROR, errorMessage(status, msg)),
       zlib_status_(status),
-      zlib_msg_(msg == NULL ? "(null)" : msg) {}
+      zlib_msg_(msg == nullptr ? "(null)" : msg) {}
 
-  virtual ~TZlibTransportException() noexcept {}
+  ~TZlibTransportException() noexcept override = default;
 
   int getZlibStatus() { return zlib_status_; }
   std::string getZlibMessage() { return zlib_msg_; }
@@ -93,12 +93,12 @@
       crbuf_size_(crbuf_size),
       uwbuf_size_(uwbuf_size),
       cwbuf_size_(cwbuf_size),
-      urbuf_(NULL),
-      crbuf_(NULL),
-      uwbuf_(NULL),
-      cwbuf_(NULL),
-      rstream_(NULL),
-      wstream_(NULL),
+      urbuf_(nullptr),
+      crbuf_(nullptr),
+      uwbuf_(nullptr),
+      cwbuf_(nullptr),
+      rstream_(nullptr),
+      wstream_(nullptr),
       comp_level_(comp_level) {
     if (uwbuf_size_ < MIN_DIRECT_DEFLATE_SIZE) {
       // Have to copy this into a local because of a linking issue.
@@ -136,20 +136,20 @@
    * unflushed data.  You must explicitly call flush() or finish() to ensure
    * that data is actually written and flushed to the underlying transport.
    */
-  ~TZlibTransport();
+  ~TZlibTransport() override;
 
   bool isOpen();
-  bool peek();
+  bool peek() override;
 
-  void open() { transport_->open(); }
+  void open() override { transport_->open(); }
 
-  void close() { transport_->close(); }
+  void close() override { transport_->close(); }
 
   uint32_t read(uint8_t* buf, uint32_t len);
 
   void write(const uint8_t* buf, uint32_t len);
 
-  void flush();
+  void flush() override;
 
   /**
    * Finalize the zlib stream.
@@ -227,9 +227,9 @@
  */
 class TZlibTransportFactory : public TTransportFactory {
 public:
-  TZlibTransportFactory() {}
+  TZlibTransportFactory() = default;
 
-  virtual ~TZlibTransportFactory() {}
+  ~TZlibTransportFactory() override = default;
 
   std::shared_ptr<TTransport> getTransport(std::shared_ptr<TTransport> trans) override {
     return std::shared_ptr<TTransport>(new TZlibTransport(trans));
diff --git a/lib/cpp/test/Benchmark.cpp b/lib/cpp/test/Benchmark.cpp
index 5ff77aa..56adac0 100644
--- a/lib/cpp/test/Benchmark.cpp
+++ b/lib/cpp/test/Benchmark.cpp
@@ -36,12 +36,12 @@
 public:
   timeval vStart;
 
-  Timer() { THRIFT_GETTIMEOFDAY(&vStart, 0); }
-  void start() { THRIFT_GETTIMEOFDAY(&vStart, 0); }
+  Timer() { THRIFT_GETTIMEOFDAY(&vStart, nullptr); }
+  void start() { THRIFT_GETTIMEOFDAY(&vStart, nullptr); }
 
   double frame() {
     timeval vEnd;
-    THRIFT_GETTIMEOFDAY(&vEnd, 0);
+    THRIFT_GETTIMEOFDAY(&vEnd, nullptr);
     double dstart = vStart.tv_sec + ((double)vStart.tv_usec / 1000000.0);
     double dend = vEnd.tv_sec + ((double)vEnd.tv_usec / 1000000.0);
     return dend - dstart;
@@ -70,7 +70,7 @@
   int num = 100000;
   std::shared_ptr<TMemoryBuffer> buf(new TMemoryBuffer(num*1000));
 
-  uint8_t* data = NULL;
+  uint8_t* data = nullptr;
   uint32_t datasize = 0;
 
   {
@@ -157,7 +157,7 @@
   }
 
 
-  data = NULL;
+  data = nullptr;
   datasize = 0;
   num = 10000000;
 
diff --git a/lib/cpp/test/EnumTest.cpp b/lib/cpp/test/EnumTest.cpp
index c935bc4..6487906 100644
--- a/lib/cpp/test/EnumTest.cpp
+++ b/lib/cpp/test/EnumTest.cpp
@@ -75,7 +75,7 @@
   BOOST_CHECK_EQUAL(EnumToString(MyEnumWithCustomOstream::CustoM2), "{2:CUSTOM!}");
 
   // some invalid or unknown value
-  MyEnum5::type uut = (MyEnum5::type)44;
+  auto uut = (MyEnum5::type)44;
   BOOST_CHECK_EQUAL(EnumToString(uut), "44");
 }
 
diff --git a/lib/cpp/test/OneWayHTTPTest.cpp b/lib/cpp/test/OneWayHTTPTest.cpp
index f369d8c..55d919b 100644
--- a/lib/cpp/test/OneWayHTTPTest.cpp
+++ b/lib/cpp/test/OneWayHTTPTest.cpp
@@ -66,14 +66,14 @@
 
 class OneWayServiceHandler : public onewaytest::OneWayServiceIf {
 public:
-  OneWayServiceHandler() {}
+  OneWayServiceHandler() = default;
 
   void roundTripRPC() override {
 #ifdef ENABLE_STDERR_LOGGING
     cerr << "roundTripRPC()" << endl;
 #endif
   }
-  void oneWayRPC() {
+  void oneWayRPC() override {
 #ifdef ENABLE_STDERR_LOGGING
     cerr << "oneWayRPC()" << std::endl ;
 #endif
@@ -82,13 +82,13 @@
 
 class OneWayServiceCloneFactory : virtual public onewaytest::OneWayServiceIfFactory {
  public:
-  virtual ~OneWayServiceCloneFactory() {}
-  virtual onewaytest::OneWayServiceIf* getHandler(const ::apache::thrift::TConnectionInfo& connInfo)
+  ~OneWayServiceCloneFactory() override = default;
+  onewaytest::OneWayServiceIf* getHandler(const ::apache::thrift::TConnectionInfo& connInfo) override
   {
     (void)connInfo ;
     return new OneWayServiceHandler;
   }
-  virtual void releaseHandler( onewaytest::OneWayServiceIf* handler) {
+  void releaseHandler( onewaytest::OneWayServiceIf* handler) override {
     delete handler;
   }
 };
@@ -96,7 +96,7 @@
 class RPC0ThreadClass {
 public:
   RPC0ThreadClass(TThreadedServer& server) : server_(server) { } // Constructor
-~RPC0ThreadClass() { } // Destructor
+~RPC0ThreadClass() = default; // Destructor
 
 void Run() {
   server_.serve() ;
@@ -112,21 +112,21 @@
 class TServerReadyEventHandler : public TServerEventHandler, public Monitor {
 public:
   TServerReadyEventHandler() : isListening_(false), accepted_(0) {}
-  virtual ~TServerReadyEventHandler() {}
-  virtual void preServe() {
+  ~TServerReadyEventHandler() override = default;
+  void preServe() override {
     Synchronized sync(*this);
     isListening_ = true;
     notify();
   }
-  virtual void* createContext(shared_ptr<TProtocol> input,
-                              shared_ptr<TProtocol> output) {
+  void* createContext(shared_ptr<TProtocol> input,
+                              shared_ptr<TProtocol> output) override {
     Synchronized sync(*this);
     ++accepted_;
     notify();
 
     (void)input;
     (void)output;
-    return NULL;
+    return nullptr;
   }
   bool isListening() const { return isListening_; }
   uint64_t acceptedCount() const { return accepted_; }
@@ -144,7 +144,7 @@
   }
 
   uint32_t write_buffer_length() {
-    uint32_t have_bytes = static_cast<uint32_t>(wBase_ - wBuf_.get());
+    auto have_bytes = static_cast<uint32_t>(wBase_ - wBuf_.get());
     return have_bytes ;
   }
 
diff --git a/lib/cpp/test/OpenSSLManualInitTest.cpp b/lib/cpp/test/OpenSSLManualInitTest.cpp
index a30b303..a751806 100644
--- a/lib/cpp/test/OpenSSLManualInitTest.cpp
+++ b/lib/cpp/test/OpenSSLManualInitTest.cpp
@@ -62,7 +62,7 @@
   // uninitialized.  It might also fail on very old versions of
   // OpenSSL...
   const EVP_MD* md = EVP_get_digestbyname("SHA256");
-  BOOST_CHECK(md != NULL);
+  BOOST_CHECK(md != nullptr);
   openssl_cleanup();
 }
 
diff --git a/lib/cpp/test/RecursiveTest.cpp b/lib/cpp/test/RecursiveTest.cpp
index 15f234c..ab2e46d 100644
--- a/lib/cpp/test/RecursiveTest.cpp
+++ b/lib/cpp/test/RecursiveTest.cpp
@@ -60,8 +60,8 @@
 
   RecList resultlist;
   resultlist.read(prot.get());
-  BOOST_CHECK(resultlist.nextitem != NULL);
-  BOOST_CHECK(resultlist.nextitem->nextitem == NULL);
+  BOOST_CHECK(resultlist.nextitem != nullptr);
+  BOOST_CHECK(resultlist.nextitem->nextitem == nullptr);
 }
 
 BOOST_AUTO_TEST_CASE(test_recursive_3) {
@@ -75,8 +75,8 @@
   c.write(prot.get());
 
   c.read(prot.get());
-  BOOST_CHECK(c.other != NULL);
-  BOOST_CHECK(c.other->other.other == NULL);
+  BOOST_CHECK(c.other != nullptr);
+  BOOST_CHECK(c.other->other.other == nullptr);
 }
 
 BOOST_AUTO_TEST_CASE(test_recursive_4) {
diff --git a/lib/cpp/test/TFileTransportTest.cpp b/lib/cpp/test/TFileTransportTest.cpp
index d0c26b3..ad32185 100644
--- a/lib/cpp/test/TFileTransportTest.cpp
+++ b/lib/cpp/test/TFileTransportTest.cpp
@@ -64,12 +64,12 @@
   };
   typedef std::list<FsyncCall> CallList;
 
-  FsyncLog() {}
+  FsyncLog() = default;
 
   void fsync(int fd) {
     (void)fd;
     FsyncCall call;
-    THRIFT_GETTIMEOFDAY(&call.time, NULL);
+    THRIFT_GETTIMEOFDAY(&call.time, nullptr);
     calls_.push_back(call);
   }
 
@@ -123,7 +123,7 @@
     if (path_) {
       ::unlink(path_);
       delete[] path_;
-      path_ = NULL;
+      path_ = nullptr;
     }
   }
 
@@ -195,9 +195,9 @@
     struct timeval start;
     struct timeval end;
 
-    THRIFT_GETTIMEOFDAY(&start, NULL);
+    THRIFT_GETTIMEOFDAY(&start, nullptr);
     delete transport;
-    THRIFT_GETTIMEOFDAY(&end, NULL);
+    THRIFT_GETTIMEOFDAY(&end, nullptr);
 
     int delta = time_diff(&start, &end);
 
@@ -264,7 +264,7 @@
   delete transport;
 
   // Stop logging new fsync() calls
-  fsync_log = NULL;
+  fsync_log = nullptr;
 
   // Examine the fsync() log
   //
@@ -278,8 +278,8 @@
   // Make sure TFileTransport called fsync at least once
   BOOST_WARN_GE(calls->size(), static_cast<FsyncLog::CallList::size_type>(1));
 
-  const struct timeval* prev_time = NULL;
-  for (FsyncLog::CallList::const_iterator it = calls->begin(); it != calls->end(); ++it) {
+  const struct timeval* prev_time = nullptr;
+  for (auto it = calls->begin(); it != calls->end(); ++it) {
     if (prev_time) {
       int delta = time_diff(prev_time, &it->time);
       BOOST_WARN( delta < max_allowed_delta );
@@ -318,13 +318,13 @@
   transport.write(buf, 1);
 
   struct timeval start;
-  THRIFT_GETTIMEOFDAY(&start, NULL);
+  THRIFT_GETTIMEOFDAY(&start, nullptr);
 
   for (unsigned int n = 0; n < 10; ++n) {
     transport.flush();
 
     struct timeval now;
-    THRIFT_GETTIMEOFDAY(&now, NULL);
+    THRIFT_GETTIMEOFDAY(&now, nullptr);
 
     // Fail if at any point we've been running for longer than half a second.
     // (With the buggy code, TFileTransport used to take 3 seconds per flush())
@@ -349,11 +349,11 @@
 
 void parse_args(int argc, char* argv[]) {
   struct option long_opts[]
-      = {{"help", false, NULL, 'h'}, {"tmp-dir", true, NULL, 't'}, {NULL, 0, NULL, 0}};
+      = {{"help", false, nullptr, 'h'}, {"tmp-dir", true, nullptr, 't'}, {nullptr, 0, nullptr, 0}};
 
   while (true) {
     optopt = 1;
-    int optchar = getopt_long(argc, argv, "ht:", long_opts, NULL);
+    int optchar = getopt_long(argc, argv, "ht:", long_opts, nullptr);
     if (optchar == -1) {
       break;
     }
@@ -378,7 +378,7 @@
 
 #ifdef BOOST_TEST_DYN_LINK
 static int myArgc = 0;
-static char **myArgv = NULL;
+static char **myArgv = nullptr;
 
 bool init_unit_test_suite() {
   boost::unit_test::framework::master_test_suite().p_name.value = "TFileTransportTest";
diff --git a/lib/cpp/test/TNonblockingSSLServerTest.cpp b/lib/cpp/test/TNonblockingSSLServerTest.cpp
index 2111de8..d0d8688 100644
--- a/lib/cpp/test/TNonblockingSSLServerTest.cpp
+++ b/lib/cpp/test/TNonblockingSSLServerTest.cpp
@@ -39,17 +39,17 @@
 using apache::thrift::transport::TSSLSocket;
 
 struct Handler : public test::ParentServiceIf {
-  void addString(const std::string& s) { strings_.push_back(s); }
-  void getStrings(std::vector<std::string>& _return) { _return = strings_; }
+  void addString(const std::string& s) override { strings_.push_back(s); }
+  void getStrings(std::vector<std::string>& _return) override { _return = strings_; }
   std::vector<std::string> strings_;
 
   // dummy overrides not used in this test
-  int32_t incrementGeneration() { return 0; }
-  int32_t getGeneration() { return 0; }
-  void getDataWait(std::string&, const int32_t) {}
-  void onewayWait() {}
-  void exceptionWait(const std::string&) {}
-  void unexpectedExceptionWait(const std::string&) {}
+  int32_t incrementGeneration() override { return 0; }
+  int32_t getGeneration() override { return 0; }
+  void getDataWait(std::string&, const int32_t) override {}
+  void onewayWait() override {}
+  void exceptionWait(const std::string&) override {}
+  void unexpectedExceptionWait(const std::string&) override {}
 };
 
 boost::filesystem::path keyDir;
@@ -131,7 +131,7 @@
     public:
       ListenEventHandler(Mutex* mutex) : listenMonitor_(mutex), ready_(false) {}
 
-      void preServe() /* override */ {
+      void preServe() override /* override */ {
         Guard g(listenMonitor_.mutex());
         ready_ = true;
         listenMonitor_.notify();
@@ -155,7 +155,7 @@
       listenHandler.reset(new ListenEventHandler(&mutex_));
     }
 
-    virtual void run() {
+    void run() override {
       // When binding to explicit port, allow retrying to workaround bind failures on ports in use
       int retryCount = port ? 10 : 0;
       pServerSocketFactory = createServerSocketFactory();  
diff --git a/lib/cpp/test/TNonblockingServerTest.cpp b/lib/cpp/test/TNonblockingServerTest.cpp
index f2f5922..434217e 100644
--- a/lib/cpp/test/TNonblockingServerTest.cpp
+++ b/lib/cpp/test/TNonblockingServerTest.cpp
@@ -44,17 +44,17 @@
 using namespace apache::thrift;
 
 struct Handler : public test::ParentServiceIf {
-  void addString(const std::string& s) { strings_.push_back(s); }
-  void getStrings(std::vector<std::string>& _return) { _return = strings_; }
+  void addString(const std::string& s) override { strings_.push_back(s); }
+  void getStrings(std::vector<std::string>& _return) override { _return = strings_; }
   std::vector<std::string> strings_;
 
   // dummy overrides not used in this test
-  int32_t incrementGeneration() { return 0; }
-  int32_t getGeneration() { return 0; }
-  void getDataWait(std::string&, const int32_t) {}
-  void onewayWait() {}
-  void exceptionWait(const std::string&) {}
-  void unexpectedExceptionWait(const std::string&) {}
+  int32_t incrementGeneration() override { return 0; }
+  int32_t getGeneration() override { return 0; }
+  void getDataWait(std::string&, const int32_t) override {}
+  void onewayWait() override {}
+  void exceptionWait(const std::string&) override {}
+  void unexpectedExceptionWait(const std::string&) override {}
 };
 
 class Fixture {
@@ -63,7 +63,7 @@
     public:
       ListenEventHandler(Mutex* mutex) : listenMonitor_(mutex), ready_(false) {}
 
-      void preServe() /* override */ {
+      void preServe() override /* override */ {
         Guard g(listenMonitor_.mutex());
         ready_ = true;
         listenMonitor_.notify();
@@ -86,7 +86,7 @@
       listenHandler.reset(new ListenEventHandler(&mutex_));
     }
 
-    virtual void run() {
+    void run() override {
       // When binding to explicit port, allow retrying to workaround bind failures on ports in use
       int retryCount = port ? 10 : 0;
       startServer(retryCount);
diff --git a/lib/cpp/test/TServerIntegrationTest.cpp b/lib/cpp/test/TServerIntegrationTest.cpp
index a7680d8..b88c35b 100644
--- a/lib/cpp/test/TServerIntegrationTest.cpp
+++ b/lib/cpp/test/TServerIntegrationTest.cpp
@@ -74,21 +74,21 @@
 class TServerReadyEventHandler : public TServerEventHandler, public Monitor {
 public:
   TServerReadyEventHandler() : isListening_(false), accepted_(0) {}
-  virtual ~TServerReadyEventHandler() {}
-  virtual void preServe() {
+  ~TServerReadyEventHandler() override = default;
+  void preServe() override {
     Synchronized sync(*this);
     isListening_ = true;
     notify();
   }
-  virtual void* createContext(shared_ptr<TProtocol> input,
-                              shared_ptr<TProtocol> output) {
+  void* createContext(shared_ptr<TProtocol> input,
+                              shared_ptr<TProtocol> output) override {
     Synchronized sync(*this);
     ++accepted_;
     notify();
 
     (void)input;
     (void)output;
-    return NULL;
+    return nullptr;
   }
   bool isListening() const { return isListening_; }
   uint64_t acceptedCount() const { return accepted_; }
@@ -105,36 +105,36 @@
 public:
   ParentHandler() : generation_(0) {}
 
-  int32_t incrementGeneration() {
+  int32_t incrementGeneration() override {
     Guard g(mutex_);
     return ++generation_;
   }
 
-  int32_t getGeneration() {
+  int32_t getGeneration() override {
     Guard g(mutex_);
     return generation_;
   }
 
-  void addString(const std::string& s) {
+  void addString(const std::string& s) override {
     Guard g(mutex_);
     strings_.push_back(s);
   }
 
-  void getStrings(std::vector<std::string>& _return) {
+  void getStrings(std::vector<std::string>& _return) override {
     Guard g(mutex_);
     _return = strings_;
   }
 
-  void getDataWait(std::string& _return, const int32_t length) {
+  void getDataWait(std::string& _return, const int32_t length) override {
     THRIFT_UNUSED_VARIABLE(_return);
     THRIFT_UNUSED_VARIABLE(length);
   }
 
-  void onewayWait() {}
+  void onewayWait() override {}
 
-  void exceptionWait(const std::string& message) { THRIFT_UNUSED_VARIABLE(message); }
+  void exceptionWait(const std::string& message) override { THRIFT_UNUSED_VARIABLE(message); }
 
-  void unexpectedExceptionWait(const std::string& message) { THRIFT_UNUSED_VARIABLE(message); }
+  void unexpectedExceptionWait(const std::string& message) override { THRIFT_UNUSED_VARIABLE(message); }
 
 protected:
   Mutex mutex_;
@@ -264,7 +264,7 @@
    * \returns  the server port number
    */
   int getServerPort() {
-    TServerSocket* pSock = dynamic_cast<TServerSocket*>(pServer->getServerTransport().get());
+    auto* pSock = dynamic_cast<TServerSocket*>(pServer->getServerTransport().get());
     if (!pSock) { throw std::logic_error("how come?"); }
     return pSock->getPort();
   }
diff --git a/lib/cpp/test/TServerTransportTest.cpp b/lib/cpp/test/TServerTransportTest.cpp
index 539bd28..15177a8 100644
--- a/lib/cpp/test/TServerTransportTest.cpp
+++ b/lib/cpp/test/TServerTransportTest.cpp
@@ -34,11 +34,11 @@
 class TestTServerTransport : public TServerTransport {
 public:
   TestTServerTransport() : valid_(true) {}
-  void close() {}
+  void close() override {}
   bool valid_;
 
 protected:
-  shared_ptr<TTransport> acceptImpl() {
+  shared_ptr<TTransport> acceptImpl() override {
     return valid_ ? shared_ptr<TestTTransport>(new TestTTransport)
                   : shared_ptr<TestTTransport>();
   }
diff --git a/lib/cpp/test/TransportTest.cpp b/lib/cpp/test/TransportTest.cpp
index 0d900d9..b0c84b6 100644
--- a/lib/cpp/test/TransportTest.cpp
+++ b/lib/cpp/test/TransportTest.cpp
@@ -57,7 +57,7 @@
 
 class SizeGenerator {
 public:
-  virtual ~SizeGenerator() {}
+  virtual ~SizeGenerator() = default;
   virtual uint32_t nextSize() = 0;
   virtual std::string describe() const = 0;
 };
@@ -65,8 +65,8 @@
 class ConstantSizeGenerator : public SizeGenerator {
 public:
   ConstantSizeGenerator(uint32_t value) : value_(value) {}
-  uint32_t nextSize() { return value_; }
-  std::string describe() const {
+  uint32_t nextSize() override { return value_; }
+  std::string describe() const override {
     std::ostringstream desc;
     desc << value_;
     return desc.str();
@@ -81,9 +81,9 @@
   RandomSizeGenerator(uint32_t min, uint32_t max)
     : generator_(rng, boost::uniform_int<int>(min, max)) {}
 
-  uint32_t nextSize() { return generator_(); }
+  uint32_t nextSize() override { return generator_(); }
 
-  std::string describe() const {
+  std::string describe() const override {
     std::ostringstream desc;
     desc << "rand(" << getMin() << ", " << getMax() << ")";
     return desc.str();
@@ -109,8 +109,8 @@
   GenericSizeGenerator(uint32_t min, uint32_t max)
     : generator_(new RandomSizeGenerator(min, max)) {}
 
-  uint32_t nextSize() { return generator_->nextSize(); }
-  std::string describe() const { return generator_->describe(); }
+  uint32_t nextSize() override { return generator_->nextSize(); }
+  std::string describe() const override { return generator_->describe(); }
 
 private:
   std::shared_ptr<SizeGenerator> generator_;
@@ -131,7 +131,7 @@
 template <class Transport_>
 class CoupledTransports {
 public:
-  virtual ~CoupledTransports() {}
+  virtual ~CoupledTransports() = default;
   typedef Transport_ TransportType;
 
   CoupledTransports() : in(), out() {}
@@ -282,7 +282,7 @@
     out.reset(new TFileTransport(filename));
   }
 
-  ~CoupledFileTransports() { remove(filename.c_str()); }
+  ~CoupledFileTransports() override { remove(filename.c_str()); }
 
   std::string filename;
 };
@@ -341,7 +341,7 @@
 
 struct TriggerInfo {
   TriggerInfo(int seconds, const std::shared_ptr<TTransport>& transport, uint32_t writeLength)
-    : timeoutSeconds(seconds), transport(transport), writeLength(writeLength), next(NULL) {}
+    : timeoutSeconds(seconds), transport(transport), writeLength(writeLength), next(nullptr) {}
 
   int timeoutSeconds;
   std::shared_ptr<TTransport> transport;
@@ -355,7 +355,7 @@
 bool g_teardown = false;
 
 void alarm_handler() {
-  TriggerInfo* info = NULL;
+  TriggerInfo* info = nullptr;
   {
     apache::thrift::concurrency::Synchronized s(g_alarm_monitor);
     // The alarm timed out, which almost certainly means we're stuck
@@ -366,7 +366,7 @@
     // tools/test/runner only records stdout messages in the failure messages for
     // boost tests.  (boost prints its test info to stdout.)
     printf("Timeout alarm expired; attempting to unblock transport\n");
-    if (g_triggerInfo == NULL) {
+    if (g_triggerInfo == nullptr) {
       printf("  trigger stack is empty!\n");
     }
 
@@ -377,7 +377,7 @@
   }
 
   // Write some data to the transport to hopefully unblock it.
-  uint8_t* buf = new uint8_t[info->writeLength];
+  auto* buf = new uint8_t[info->writeLength];
   memset(buf, 'b', info->writeLength);
   boost::scoped_array<uint8_t> array(buf);
   info->transport->write(buf, info->writeLength);
@@ -395,7 +395,7 @@
       if (g_teardown)
         return;
       // calculate timeout
-      if (g_triggerInfo == NULL) {
+      if (g_triggerInfo == nullptr) {
         timeout = 0;
       } else {
         timeout = g_triggerInfo->timeoutSeconds * 1000;
@@ -421,10 +421,10 @@
 void add_trigger(unsigned int seconds,
                  const std::shared_ptr<TTransport>& transport,
                  uint32_t write_len) {
-  TriggerInfo* info = new TriggerInfo(seconds, transport, write_len);
+  auto* info = new TriggerInfo(seconds, transport, write_len);
   {
     apache::thrift::concurrency::Synchronized s(g_alarm_monitor);
-    if (g_triggerInfo == NULL) {
+    if (g_triggerInfo == nullptr) {
       // This is the first trigger.
       // Set g_triggerInfo, and schedule the alarm
       g_triggerInfo = info;
@@ -441,17 +441,17 @@
 }
 
 void clear_triggers() {
-  TriggerInfo* info = NULL;
+  TriggerInfo* info = nullptr;
 
   {
     apache::thrift::concurrency::Synchronized s(g_alarm_monitor);
     info = g_triggerInfo;
-    g_triggerInfo = NULL;
+    g_triggerInfo = nullptr;
     g_numTriggersFired = 0;
     g_alarm_monitor.notify();
   }
 
-  while (info != NULL) {
+  while (info != nullptr) {
     TriggerInfo* next = info->next;
     delete info;
     info = next;
@@ -500,8 +500,8 @@
              SizeGenerator& rChunkGenerator,
              uint32_t maxOutstanding) {
   CoupledTransports transports;
-  BOOST_REQUIRE(transports.in != NULL);
-  BOOST_REQUIRE(transports.out != NULL);
+  BOOST_REQUIRE(transports.in != nullptr);
+  BOOST_REQUIRE(transports.out != nullptr);
 
   boost::shared_array<uint8_t> wbuf = boost::shared_array<uint8_t>(new uint8_t[totalSize]);
   boost::shared_array<uint8_t> rbuf = boost::shared_array<uint8_t>(new uint8_t[totalSize]);
@@ -593,8 +593,8 @@
 template <class CoupledTransports>
 void test_read_part_available() {
   CoupledTransports transports;
-  BOOST_REQUIRE(transports.in != NULL);
-  BOOST_REQUIRE(transports.out != NULL);
+  BOOST_REQUIRE(transports.in != nullptr);
+  BOOST_REQUIRE(transports.out != nullptr);
 
   uint8_t write_buf[16];
   uint8_t read_buf[16];
@@ -615,8 +615,8 @@
 template <class CoupledTransports>
 void test_read_part_available_in_chunks() {
   CoupledTransports transports;
-  BOOST_REQUIRE(transports.in != NULL);
-  BOOST_REQUIRE(transports.out != NULL);
+  BOOST_REQUIRE(transports.in != nullptr);
+  BOOST_REQUIRE(transports.out != nullptr);
 
   uint8_t write_buf[16];
   uint8_t read_buf[16];
@@ -642,8 +642,8 @@
 template <class CoupledTransports>
 void test_read_partial_midframe() {
   CoupledTransports transports;
-  BOOST_REQUIRE(transports.in != NULL);
-  BOOST_REQUIRE(transports.out != NULL);
+  BOOST_REQUIRE(transports.in != nullptr);
+  BOOST_REQUIRE(transports.out != nullptr);
 
   uint8_t write_buf[16];
   uint8_t read_buf[16];
@@ -700,8 +700,8 @@
 template <class CoupledTransports>
 void test_borrow_part_available() {
   CoupledTransports transports;
-  BOOST_REQUIRE(transports.in != NULL);
-  BOOST_REQUIRE(transports.out != NULL);
+  BOOST_REQUIRE(transports.in != nullptr);
+  BOOST_REQUIRE(transports.out != nullptr);
 
   uint8_t write_buf[16];
   uint8_t read_buf[16];
@@ -715,7 +715,7 @@
   uint32_t borrow_len = 10;
   const uint8_t* borrowed_buf = transports.in->borrow(read_buf, &borrow_len);
   BOOST_CHECK_EQUAL(g_numTriggersFired, (unsigned int)0);
-  BOOST_CHECK(borrowed_buf == NULL);
+  BOOST_CHECK(borrowed_buf == nullptr);
 
   clear_triggers();
 }
@@ -723,8 +723,8 @@
 template <class CoupledTransports>
 void test_read_none_available() {
   CoupledTransports transports;
-  BOOST_REQUIRE(transports.in != NULL);
-  BOOST_REQUIRE(transports.out != NULL);
+  BOOST_REQUIRE(transports.in != nullptr);
+  BOOST_REQUIRE(transports.out != nullptr);
 
   uint8_t read_buf[16];
 
@@ -751,8 +751,8 @@
 template <class CoupledTransports>
 void test_borrow_none_available() {
   CoupledTransports transports;
-  BOOST_REQUIRE(transports.in != NULL);
-  BOOST_REQUIRE(transports.out != NULL);
+  BOOST_REQUIRE(transports.in != nullptr);
+  BOOST_REQUIRE(transports.out != nullptr);
 
   uint8_t write_buf[16];
   memset(write_buf, 'a', sizeof(write_buf));
@@ -760,8 +760,8 @@
   // Attempting to borrow when no data is available should fail immediately
   set_trigger(1, transports.out, 10);
   uint32_t borrow_len = 10;
-  const uint8_t* borrowed_buf = transports.in->borrow(NULL, &borrow_len);
-  BOOST_CHECK(borrowed_buf == NULL);
+  const uint8_t* borrowed_buf = transports.in->borrow(nullptr, &borrow_len);
+  BOOST_CHECK(borrowed_buf == nullptr);
   BOOST_CHECK_EQUAL(g_numTriggersFired, (unsigned int)0);
 
   clear_triggers();
@@ -1055,7 +1055,7 @@
 #ifdef BOOST_TEST_DYN_LINK
 bool init_unit_test_suite() {
   struct timeval tv;
-  THRIFT_GETTIMEOFDAY(&tv, NULL);
+  THRIFT_GETTIMEOFDAY(&tv, nullptr);
   int seed = tv.tv_sec ^ tv.tv_usec;
 
   initrand(seed);
diff --git a/lib/cpp/test/ZlibTest.cpp b/lib/cpp/test/ZlibTest.cpp
index c826814..3e2eb81 100644
--- a/lib/cpp/test/ZlibTest.cpp
+++ b/lib/cpp/test/ZlibTest.cpp
@@ -58,14 +58,14 @@
 
 class SizeGenerator {
 public:
-  virtual ~SizeGenerator() {}
+  virtual ~SizeGenerator() = default;
   virtual unsigned int getSize() = 0;
 };
 
 class ConstantSizeGenerator : public SizeGenerator {
 public:
   ConstantSizeGenerator(unsigned int value) : value_(value) {}
-  virtual unsigned int getSize() { return value_; }
+  unsigned int getSize() override { return value_; }
 
 private:
   unsigned int value_;
@@ -76,10 +76,10 @@
   LogNormalSizeGenerator(double mean, double std_dev)
     : gen_(rng, boost::lognormal_distribution<double>(mean, std_dev)) {}
 
-  virtual unsigned int getSize() {
+  unsigned int getSize() override {
     // Loop until we get a size of 1 or more
     while (true) {
-      unsigned int value = static_cast<unsigned int>(gen_());
+      auto value = static_cast<unsigned int>(gen_());
       if (value >= 1) {
         return value;
       }
@@ -91,13 +91,13 @@
 };
 
 boost::shared_array<uint8_t> gen_uniform_buffer(uint32_t buf_len, uint8_t c) {
-  uint8_t* buf = new uint8_t[buf_len];
+  auto* buf = new uint8_t[buf_len];
   memset(buf, c, buf_len);
   return boost::shared_array<uint8_t>(buf);
 }
 
 boost::shared_array<uint8_t> gen_compressible_buffer(uint32_t buf_len) {
-  uint8_t* buf = new uint8_t[buf_len];
+  auto* buf = new uint8_t[buf_len];
 
   // Generate small runs of alternately increasing and decreasing bytes
   boost::uniform_smallint<uint32_t> run_length_distribution(1, 64);
@@ -129,7 +129,7 @@
 }
 
 boost::shared_array<uint8_t> gen_random_buffer(uint32_t buf_len) {
-  uint8_t* buf = new uint8_t[buf_len];
+  auto* buf = new uint8_t[buf_len];
 
   boost::uniform_smallint<uint8_t> distribution(0, UINT8_MAX);
   boost::variate_generator<boost::mt19937, boost::uniform_smallint<uint8_t> >
@@ -427,7 +427,7 @@
 
 #ifdef BOOST_TEST_DYN_LINK
 bool init_unit_test_suite() {
-  uint32_t seed = static_cast<uint32_t>(time(NULL));
+  auto seed = static_cast<uint32_t>(time(nullptr));
 #ifdef HAVE_INTTYPES_H
   printf("seed: %" PRIu32 "\n", seed);
 #endif
diff --git a/lib/cpp/test/concurrency/Tests.cpp b/lib/cpp/test/concurrency/Tests.cpp
index 019ae67..f2b0111 100644
--- a/lib/cpp/test/concurrency/Tests.cpp
+++ b/lib/cpp/test/concurrency/Tests.cpp
@@ -41,7 +41,7 @@
     args[ix - 1] = std::string(argv[ix]);
   }
 
-  if (getenv("VALGRIND") != 0) {
+  if (getenv("VALGRIND") != nullptr) {
 	  // lower the scale of every test
 	  WEIGHT = 1;
   }
diff --git a/lib/cpp/test/concurrency/ThreadFactoryTests.h b/lib/cpp/test/concurrency/ThreadFactoryTests.h
index ad1613b..febe3f8 100644
--- a/lib/cpp/test/concurrency/ThreadFactoryTests.h
+++ b/lib/cpp/test/concurrency/ThreadFactoryTests.h
@@ -51,7 +51,7 @@
   public:
     ReapNTask(Monitor& monitor, int& activeCount) : _monitor(monitor), _count(activeCount) {}
 
-    void run() {
+    void run() override {
       Synchronized s(_monitor);
       
       if (--_count == 0) {
@@ -122,7 +122,7 @@
 
     SynchStartTask(Monitor& monitor, volatile STATE& state) : _monitor(monitor), _state(state) {}
 
-    void run() {
+    void run() override {
       {
         Synchronized s(_monitor);
         if (_state == SynchStartTask::STARTING) {
@@ -247,14 +247,14 @@
   class FloodTask : public Runnable {
   public:
     FloodTask(const size_t id, Monitor& mon) : _id(id), _mon(mon) {}
-    ~FloodTask() {
+    ~FloodTask() override {
       if (_id % 10000 == 0) {
 		Synchronized sync(_mon);
         std::cout << "\t\tthread " << _id << " done" << std::endl;
       }
     }
 
-    void run() {
+    void run() override {
       if (_id % 10000 == 0) {
 		Synchronized sync(_mon);
         std::cout << "\t\tthread " << _id << " started" << std::endl;
diff --git a/lib/cpp/test/concurrency/ThreadManagerTests.h b/lib/cpp/test/concurrency/ThreadManagerTests.h
index e9ed756..fee7c7c 100644
--- a/lib/cpp/test/concurrency/ThreadManagerTests.h
+++ b/lib/cpp/test/concurrency/ThreadManagerTests.h
@@ -63,7 +63,7 @@
     Task(Monitor& monitor, size_t& count, int64_t timeout)
       : _monitor(monitor), _count(count), _timeout(timeout), _startTime(0), _endTime(0), _done(false) {}
 
-    void run() {
+    void run() override {
 
       _startTime = std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::steady_clock::now().time_since_epoch()).count();
 
@@ -124,7 +124,7 @@
 
     int64_t time00 = std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::steady_clock::now().time_since_epoch()).count();
 
-    for (std::set<shared_ptr<ThreadManagerTests::Task> >::iterator ix = tasks.begin();
+    for (auto ix = tasks.begin();
          ix != tasks.end();
          ix++) {
 
@@ -151,7 +151,7 @@
     int64_t minTime = 9223372036854775807LL;
     int64_t maxTime = 0;
 
-    for (std::set<shared_ptr<ThreadManagerTests::Task> >::iterator ix = tasks.begin();
+    for (auto ix = tasks.begin();
          ix != tasks.end();
          ix++) {
 
@@ -201,7 +201,7 @@
     BlockTask(Monitor& entryMonitor, Monitor& blockMonitor, bool& blocked, Monitor& doneMonitor, size_t& count)
       : _entryMonitor(entryMonitor), _entered(false), _blockMonitor(blockMonitor), _blocked(blocked), _doneMonitor(doneMonitor), _count(count) {}
 
-    void run() {
+    void run() override {
       {
         Synchronized s(_entryMonitor);
         _entered = true;
@@ -275,7 +275,7 @@
             new ThreadManagerTests::BlockTask(entryMonitor, blockMonitor, blocked[1], doneMonitor, activeCounts[1])));
       }
 
-      for (std::vector<shared_ptr<ThreadManagerTests::BlockTask> >::iterator ix = tasks.begin();
+      for (auto ix = tasks.begin();
            ix != tasks.end();
            ix++) {
         threadManager->add(*ix);
diff --git a/lib/cpp/test/concurrency/TimerManagerTests.h b/lib/cpp/test/concurrency/TimerManagerTests.h
index a922826..313572a 100644
--- a/lib/cpp/test/concurrency/TimerManagerTests.h
+++ b/lib/cpp/test/concurrency/TimerManagerTests.h
@@ -44,9 +44,9 @@
         _success(false),
         _done(false) {}
 
-    ~Task() { std::cerr << this << std::endl; }
+    ~Task() override { std::cerr << this << std::endl; }
 
-    void run() {
+    void run() override {
 
       _endTime = std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::steady_clock::now().time_since_epoch()).count();
       _success = (_endTime - _startTime) >= _timeout;
@@ -215,7 +215,7 @@
     // Verify behavior when removing the removed task
     try {
       timerManager.remove(timer);
-      assert(0 == "ERROR: This remove should send a NoSuchTaskException exception.");
+      assert(nullptr == "ERROR: This remove should send a NoSuchTaskException exception.");
     } catch (NoSuchTaskException&) {
     }
 
@@ -244,7 +244,7 @@
     // Verify behavior when removing the expired task
     try {
       timerManager.remove(timer);
-      assert(0 == "ERROR: This remove should send a NoSuchTaskException exception.");
+      assert(nullptr == "ERROR: This remove should send a NoSuchTaskException exception.");
     } catch (NoSuchTaskException&) {
     }
 
diff --git a/lib/cpp/test/processor/EventLog.cpp b/lib/cpp/test/processor/EventLog.cpp
index e3ddbcc..c8e0d9b 100644
--- a/lib/cpp/test/processor/EventLog.cpp
+++ b/lib/cpp/test/processor/EventLog.cpp
@@ -110,7 +110,7 @@
 Event EventLog::waitForConnEvent(uint32_t connId, int64_t timeout) {
   Synchronized s(monitor_);
 
-  EventList::iterator it = events_.begin();
+  auto it = events_.begin();
   while (true) {
     try {
       // TODO: it would be nicer to honor timeout for the duration of this
diff --git a/lib/cpp/test/processor/Handlers.h b/lib/cpp/test/processor/Handlers.h
index 29784d8..05d19ed 100644
--- a/lib/cpp/test/processor/Handlers.h
+++ b/lib/cpp/test/processor/Handlers.h
@@ -32,31 +32,31 @@
   ParentHandler(const std::shared_ptr<EventLog>& log)
     : triggerMonitor(&mutex_), generation_(0), wait_(false), log_(log) {}
 
-  int32_t incrementGeneration() {
+  int32_t incrementGeneration() override {
     concurrency::Guard g(mutex_);
     log_->append(EventLog::ET_CALL_INCREMENT_GENERATION, 0, 0);
     return ++generation_;
   }
 
-  int32_t getGeneration() {
+  int32_t getGeneration() override {
     concurrency::Guard g(mutex_);
     log_->append(EventLog::ET_CALL_GET_GENERATION, 0, 0);
     return generation_;
   }
 
-  void addString(const std::string& s) {
+  void addString(const std::string& s) override {
     concurrency::Guard g(mutex_);
     log_->append(EventLog::ET_CALL_ADD_STRING, 0, 0);
     strings_.push_back(s);
   }
 
-  void getStrings(std::vector<std::string>& _return) {
+  void getStrings(std::vector<std::string>& _return) override {
     concurrency::Guard g(mutex_);
     log_->append(EventLog::ET_CALL_GET_STRINGS, 0, 0);
     _return = strings_;
   }
 
-  void getDataWait(std::string& _return, const int32_t length) {
+  void getDataWait(std::string& _return, const int32_t length) override {
     concurrency::Guard g(mutex_);
     log_->append(EventLog::ET_CALL_GET_DATA_WAIT, 0, 0);
 
@@ -65,14 +65,14 @@
     _return.append(length, 'a');
   }
 
-  void onewayWait() {
+  void onewayWait() override {
     concurrency::Guard g(mutex_);
     log_->append(EventLog::ET_CALL_ONEWAY_WAIT, 0, 0);
 
     blockUntilTriggered();
   }
 
-  void exceptionWait(const std::string& message) {
+  void exceptionWait(const std::string& message) override {
     concurrency::Guard g(mutex_);
     log_->append(EventLog::ET_CALL_EXCEPTION_WAIT, 0, 0);
 
@@ -83,7 +83,7 @@
     throw e;
   }
 
-  void unexpectedExceptionWait(const std::string& message) {
+  void unexpectedExceptionWait(const std::string& message) override {
     concurrency::Guard g(mutex_);
     log_->append(EventLog::ET_CALL_UNEXPECTED_EXCEPTION_WAIT, 0, 0);
 
@@ -148,7 +148,7 @@
 public:
   ChildHandler(const std::shared_ptr<EventLog>& log) : ParentHandler(log), value_(0) {}
 
-  int32_t setValue(const int32_t value) {
+  int32_t setValue(const int32_t value) override {
     concurrency::Guard g(mutex_);
     log_->append(EventLog::ET_CALL_SET_VALUE, 0, 0);
 
@@ -157,7 +157,7 @@
     return oldValue;
   }
 
-  int32_t getValue() {
+  int32_t getValue() override {
     concurrency::Guard g(mutex_);
     log_->append(EventLog::ET_CALL_GET_VALUE, 0, 0);
 
@@ -198,20 +198,20 @@
 public:
   ServerEventHandler(const std::shared_ptr<EventLog>& log) : nextId_(1), log_(log) {}
 
-  virtual void preServe() {}
+  void preServe() override {}
 
-  virtual void* createContext(std::shared_ptr<protocol::TProtocol> input,
-                              std::shared_ptr<protocol::TProtocol> output) {
+  void* createContext(std::shared_ptr<protocol::TProtocol> input,
+                              std::shared_ptr<protocol::TProtocol> output) override {
     ConnContext* context = new ConnContext(input, output, nextId_);
     ++nextId_;
     log_->append(EventLog::ET_CONN_CREATED, context->id, 0);
     return context;
   }
 
-  virtual void deleteContext(void* serverContext,
+  void deleteContext(void* serverContext,
                              std::shared_ptr<protocol::TProtocol> input,
-                             std::shared_ptr<protocol::TProtocol> output) {
-    ConnContext* context = reinterpret_cast<ConnContext*>(serverContext);
+                             std::shared_ptr<protocol::TProtocol> output) override {
+    auto* context = reinterpret_cast<ConnContext*>(serverContext);
 
     if (input != context->input) {
       abort();
@@ -225,8 +225,8 @@
     delete context;
   }
 
-  virtual void processContext(void* serverContext,
-                              std::shared_ptr<transport::TTransport> transport) {
+  void processContext(void* serverContext,
+                              std::shared_ptr<transport::TTransport> transport) override {
 // TODO: We currently don't test the behavior of the processContext()
 // calls.  The various server implementations call processContext() at
 // slightly different times, and it is too annoying to try and account for
@@ -258,8 +258,8 @@
 public:
   ProcessorEventHandler(const std::shared_ptr<EventLog>& log) : nextId_(1), log_(log) {}
 
-  void* getContext(const char* fnName, void* serverContext) {
-    ConnContext* connContext = reinterpret_cast<ConnContext*>(serverContext);
+  void* getContext(const char* fnName, void* serverContext) override {
+    auto* connContext = reinterpret_cast<ConnContext*>(serverContext);
 
     CallContext* context = new CallContext(connContext, nextId_, fnName);
     ++nextId_;
@@ -268,47 +268,47 @@
     return context;
   }
 
-  void freeContext(void* ctx, const char* fnName) {
-    CallContext* context = reinterpret_cast<CallContext*>(ctx);
+  void freeContext(void* ctx, const char* fnName) override {
+    auto* context = reinterpret_cast<CallContext*>(ctx);
     checkName(context, fnName);
     log_->append(EventLog::ET_CALL_FINISHED, context->connContext->id, context->id, fnName);
     delete context;
   }
 
-  void preRead(void* ctx, const char* fnName) {
-    CallContext* context = reinterpret_cast<CallContext*>(ctx);
+  void preRead(void* ctx, const char* fnName) override {
+    auto* context = reinterpret_cast<CallContext*>(ctx);
     checkName(context, fnName);
     log_->append(EventLog::ET_PRE_READ, context->connContext->id, context->id, fnName);
   }
 
-  void postRead(void* ctx, const char* fnName, uint32_t bytes) {
+  void postRead(void* ctx, const char* fnName, uint32_t bytes) override {
     THRIFT_UNUSED_VARIABLE(bytes);
-    CallContext* context = reinterpret_cast<CallContext*>(ctx);
+    auto* context = reinterpret_cast<CallContext*>(ctx);
     checkName(context, fnName);
     log_->append(EventLog::ET_POST_READ, context->connContext->id, context->id, fnName);
   }
 
-  void preWrite(void* ctx, const char* fnName) {
-    CallContext* context = reinterpret_cast<CallContext*>(ctx);
+  void preWrite(void* ctx, const char* fnName) override {
+    auto* context = reinterpret_cast<CallContext*>(ctx);
     checkName(context, fnName);
     log_->append(EventLog::ET_PRE_WRITE, context->connContext->id, context->id, fnName);
   }
 
-  void postWrite(void* ctx, const char* fnName, uint32_t bytes) {
+  void postWrite(void* ctx, const char* fnName, uint32_t bytes) override {
     THRIFT_UNUSED_VARIABLE(bytes);
-    CallContext* context = reinterpret_cast<CallContext*>(ctx);
+    auto* context = reinterpret_cast<CallContext*>(ctx);
     checkName(context, fnName);
     log_->append(EventLog::ET_POST_WRITE, context->connContext->id, context->id, fnName);
   }
 
-  void asyncComplete(void* ctx, const char* fnName) {
-    CallContext* context = reinterpret_cast<CallContext*>(ctx);
+  void asyncComplete(void* ctx, const char* fnName) override {
+    auto* context = reinterpret_cast<CallContext*>(ctx);
     checkName(context, fnName);
     log_->append(EventLog::ET_ASYNC_COMPLETE, context->connContext->id, context->id, fnName);
   }
 
-  void handlerError(void* ctx, const char* fnName) {
-    CallContext* context = reinterpret_cast<CallContext*>(ctx);
+  void handlerError(void* ctx, const char* fnName) override {
+    auto* context = reinterpret_cast<CallContext*>(ctx);
     checkName(context, fnName);
     log_->append(EventLog::ET_HANDLER_ERROR, context->connContext->id, context->id, fnName);
   }
diff --git a/lib/cpp/test/processor/ProcessorTest.cpp b/lib/cpp/test/processor/ProcessorTest.cpp
index 9483a0e..a36ef3e 100644
--- a/lib/cpp/test/processor/ProcessorTest.cpp
+++ b/lib/cpp/test/processor/ProcessorTest.cpp
@@ -116,9 +116,9 @@
     // TNonblockingServer automatically uses TFramedTransport.
     // Raise an exception if the supplied transport factory is not a
     // TFramedTransportFactory
-    TFramedTransportFactory* framedFactory
+    auto* framedFactory
         = dynamic_cast<TFramedTransportFactory*>(transportFactory.get());
-    if (framedFactory == NULL) {
+    if (framedFactory == nullptr) {
       throw TException("TNonblockingServer must use TFramedTransport");
     }
 
@@ -145,9 +145,9 @@
     // TNonblockingServer automatically uses TFramedTransport.
     // Raise an exception if the supplied transport factory is not a
     // TFramedTransportFactory
-    TFramedTransportFactory* framedFactory
+    auto* framedFactory
         = dynamic_cast<TFramedTransportFactory*>(transportFactory.get());
-    if (framedFactory == NULL) {
+    if (framedFactory == nullptr) {
       throw TException("TNonblockingServer must use TFramedTransport");
     }
 
@@ -244,14 +244,14 @@
     processor_->setEventHandler(processorEventHandler_);
   }
 
-  std::shared_ptr<TServer> createServer(uint16_t port) {
+  std::shared_ptr<TServer> createServer(uint16_t port) override {
     ServerTraits_ serverTraits;
     return serverTraits.createServer(processor_, port, transportFactory_, protocolFactory_);
   }
 
-  std::shared_ptr<TServerEventHandler> getServerEventHandler() { return serverEventHandler_; }
+  std::shared_ptr<TServerEventHandler> getServerEventHandler() override { return serverEventHandler_; }
 
-  void bindSuccessful(uint16_t port) { port_ = port; }
+  void bindSuccessful(uint16_t port) override { port_ = port; }
 
   uint16_t getPort() const { return port_; }
 
@@ -524,7 +524,7 @@
   // can test the timing for the preRead() call.
   string requestName = "getDataWait";
   string eventName = "ParentService.getDataWait";
-  int32_t seqid = int32_t(time(NULL));
+  auto seqid = int32_t(time(nullptr));
   TBinaryProtocol protocol(socket);
   protocol.writeMessageBegin(requestName, T_CALL, seqid);
   socket->flush();
diff --git a/lib/cpp/test/processor/ServerThread.h b/lib/cpp/test/processor/ServerThread.h
index 61e31a3..9cca2d6 100644
--- a/lib/cpp/test/processor/ServerThread.h
+++ b/lib/cpp/test/processor/ServerThread.h
@@ -35,7 +35,7 @@
  */
 class ServerState {
 public:
-  virtual ~ServerState() {}
+  virtual ~ServerState() = default;
 
   /**
    * Create a server to listen on the specified port.
@@ -105,9 +105,9 @@
   public:
     Helper(ServerThread* serverThread) : serverThread_(serverThread) {}
 
-    void run() { serverThread_->run(); }
+    void run() override { serverThread_->run(); }
 
-    void preServe() { serverThread_->preServe(); }
+    void preServe() override { serverThread_->preServe(); }
 
   private:
     ServerThread* serverThread_;
diff --git a/lib/cpp/test/qt/TQTcpServerTest.cpp b/lib/cpp/test/qt/TQTcpServerTest.cpp
index 58d0c6d..3371a9a 100644
--- a/lib/cpp/test/qt/TQTcpServerTest.cpp
+++ b/lib/cpp/test/qt/TQTcpServerTest.cpp
@@ -20,25 +20,25 @@
 
 struct AsyncHandler : public test::ParentServiceCobSvIf {
   std::vector<std::string> strings;
-  virtual void addString(std::function<void()> cob, const std::string& s) {
+  void addString(std::function<void()> cob, const std::string& s) override {
     strings.push_back(s);
     cob();
   }
-  virtual void getStrings(std::function<void(std::vector<std::string> const& _return)> cob) {
+  void getStrings(std::function<void(std::vector<std::string> const& _return)> cob) override {
     cob(strings);
   }
 
   // Overrides not used in this test
-  virtual void incrementGeneration(std::function<void(int32_t const& _return)> cob) {}
-  virtual void getGeneration(std::function<void(int32_t const& _return)> cob) {}
-  virtual void getDataWait(std::function<void(std::string const& _return)> cob,
-                           const int32_t length) {}
-  virtual void onewayWait(std::function<void()> cob) {}
-  virtual void exceptionWait(
+  void incrementGeneration(std::function<void(int32_t const& _return)> cob) override {}
+  void getGeneration(std::function<void(int32_t const& _return)> cob) override {}
+  void getDataWait(std::function<void(std::string const& _return)> cob,
+                           const int32_t length) override {}
+  void onewayWait(std::function<void()> cob) override {}
+  void exceptionWait(
       std::function<void()> cob,
       std::function<void(::apache::thrift::TDelayedException* _throw)> /* exn_cob */,
-      const std::string& message) {}
-  virtual void unexpectedExceptionWait(std::function<void()> cob, const std::string& message) {}
+      const std::string& message) override {}
+  void unexpectedExceptionWait(std::function<void()> cob, const std::string& message) override {}
 };
 
 class TQTcpServerTest : public QObject {
