You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by jb...@apache.org on 2018/03/29 11:41:36 UTC

[geode-native] 10/15: More no warnings

This is an automated email from the ASF dual-hosted git repository.

jbarrett pushed a commit to branch feature/GEODE-4946-msvc-warn
in repository https://gitbox.apache.org/repos/asf/geode-native.git

commit 08491966d5180a767de276d43865893e88df38e1
Author: Jacob Barrett <jb...@pivotal.io>
AuthorDate: Thu Mar 29 04:04:39 2018 +0000

    More no warnings
---
 tests/cli/QueryHelper/QueryHelperN.cs |  4 ++--
 tests/cpp/fwk/CMakeLists.txt          |  1 +
 tests/cpp/fwklib/CMakeLists.txt       |  1 +
 tests/cpp/fwklib/QueryHelper.hpp      |  4 ++--
 tests/cpp/fwklib/RegionHelper.hpp     | 40 ++++++++++++++++++++++-------------
 tests/cpp/security/CMakeLists.txt     |  1 +
 tests/cpp/security/PkcsAuthInit.cpp   | 19 ++++++++---------
 tests/cpp/testobject/CMakeLists.txt   |  1 +
 8 files changed, 42 insertions(+), 29 deletions(-)

diff --git a/tests/cli/QueryHelper/QueryHelperN.cs b/tests/cli/QueryHelper/QueryHelperN.cs
index 3f71876..6b3b331 100644
--- a/tests/cli/QueryHelper/QueryHelperN.cs
+++ b/tests/cli/QueryHelper/QueryHelperN.cs
@@ -466,8 +466,8 @@ namespace Apache.Geode.Client.Tests
       p1.ToData(o1);
       p2.ToData(o2);
 
-      uint len1 = o1.BufferLength;
-      uint len2 = o2.BufferLength;
+      var len1 = o1.BufferLength;
+      var len2 = o2.BufferLength;
 
       if (len1 != len2)
       {
diff --git a/tests/cpp/fwk/CMakeLists.txt b/tests/cpp/fwk/CMakeLists.txt
index 85837c1..c6483a4 100644
--- a/tests/cpp/fwk/CMakeLists.txt
+++ b/tests/cpp/fwk/CMakeLists.txt
@@ -31,6 +31,7 @@ target_link_libraries(${PROJECT_NAME}
     framework
   PRIVATE
     ACE
+	_WarningsAsError
 )
 
 # For Visual Studio organization
diff --git a/tests/cpp/fwklib/CMakeLists.txt b/tests/cpp/fwklib/CMakeLists.txt
index 299ebb7..d0e3773 100644
--- a/tests/cpp/fwklib/CMakeLists.txt
+++ b/tests/cpp/fwklib/CMakeLists.txt
@@ -81,6 +81,7 @@ target_link_libraries(${PROJECT_NAME}
     xerces-c
   PRIVATE
     ACE
+	_WarningsAsError
 )
 
 # For Visual Studio organization
diff --git a/tests/cpp/fwklib/QueryHelper.hpp b/tests/cpp/fwklib/QueryHelper.hpp
index ead7c26..dbf1fe9 100644
--- a/tests/cpp/fwklib/QueryHelper.hpp
+++ b/tests/cpp/fwklib/QueryHelper.hpp
@@ -811,8 +811,8 @@ bool QueryHelper::compareTwoPositionObjects(
   p1->toData(o1);
   p2->toData(o2);
 
-  uint32_t len1 = o1.getBufferLength();
-  uint32_t len2 = o2.getBufferLength();
+  auto len1 = o1.getBufferLength();
+  auto len2 = o2.getBufferLength();
 
   if (len1 != len2) {
     return false;
diff --git a/tests/cpp/fwklib/RegionHelper.hpp b/tests/cpp/fwklib/RegionHelper.hpp
index 5f23202..5a4f8b1 100644
--- a/tests/cpp/fwklib/RegionHelper.hpp
+++ b/tests/cpp/fwklib/RegionHelper.hpp
@@ -79,7 +79,8 @@ class RegionHelper {
     std::string sString;
 
     sString += regionAttributes.getCachingEnabled() ? "Caching" : "NoCache";
-    sString += (regionAttributes.getCacheListener() == nullptr) ? "Nlstnr" : "Lstnr";
+    sString +=
+        (regionAttributes.getCacheListener() == nullptr) ? "Nlstnr" : "Lstnr";
     return sString;
   }
 
@@ -96,6 +97,7 @@ class RegionHelper {
       case ExpirationAction::INVALID_ACTION:
         return "INVALID_ACTION";
     }
+    throw std::invalid_argument("expirationAction is uknown.");
   }
 
   /** @brief Given RegionAttributes, return a string logging its configuration.
@@ -111,7 +113,8 @@ class RegionHelper {
     sString += "\nendpoints: ";
     sString += regionAttributes.getEndpoints();
     sString += "\nclientNotification: ";
-    sString += regionAttributes.getClientNotificationEnabled() ? "Enabled" : "Disabled";
+    sString += regionAttributes.getClientNotificationEnabled() ? "Enabled"
+                                                               : "Disabled";
     sString += "\ninitialCapacity: ";
     sString += std::to_string(regionAttributes.getInitialCapacity());
     sString += "\nloadFactor: ";
@@ -160,7 +163,8 @@ class RegionHelper {
                    ? "Disabled"
                    : "Enabled";
     sString += "\nConcurrencyChecksEnabled: ";
-    sString += regionAttributes.getConcurrencyChecksEnabled() ? "Enabled" : "Disabled";
+    sString +=
+        regionAttributes.getConcurrencyChecksEnabled() ? "Enabled" : "Disabled";
     sString += "\n";
 
     return sString;
@@ -184,31 +188,36 @@ class RegionHelper {
                                regionAttributes.getCacheWriterFactory());
     }
     if (regionAttributes.getEntryIdleTimeout().count() != 0) {
-      regionFac.setEntryIdleTimeout(regionAttributes.getEntryIdleTimeoutAction(),
-                                    regionAttributes.getEntryIdleTimeout());
+      regionFac.setEntryIdleTimeout(
+          regionAttributes.getEntryIdleTimeoutAction(),
+          regionAttributes.getEntryIdleTimeout());
     }
     if (regionAttributes.getEntryTimeToLive().count() != 0) {
       regionFac.setEntryTimeToLive(regionAttributes.getEntryTimeToLiveAction(),
                                    regionAttributes.getEntryTimeToLive());
     }
     if (regionAttributes.getRegionIdleTimeout().count() != 0) {
-      regionFac.setRegionIdleTimeout(regionAttributes.getRegionIdleTimeoutAction(),
-                                     regionAttributes.getRegionIdleTimeout());
+      regionFac.setRegionIdleTimeout(
+          regionAttributes.getRegionIdleTimeoutAction(),
+          regionAttributes.getRegionIdleTimeout());
     }
     if (regionAttributes.getRegionTimeToLive().count() != 0) {
-      regionFac.setRegionTimeToLive(regionAttributes.getRegionTimeToLiveAction(),
-                                    regionAttributes.getRegionTimeToLive());
+      regionFac.setRegionTimeToLive(
+          regionAttributes.getRegionTimeToLiveAction(),
+          regionAttributes.getRegionTimeToLive());
     }
     if (!(regionAttributes.getPartitionResolverLibrary().empty() ||
           regionAttributes.getPartitionResolverFactory().empty())) {
-      regionFac.setPartitionResolver(regionAttributes.getPartitionResolverLibrary(),
-                                     regionAttributes.getPartitionResolverFactory());
+      regionFac.setPartitionResolver(
+          regionAttributes.getPartitionResolverLibrary(),
+          regionAttributes.getPartitionResolverFactory());
     }
     if (!(regionAttributes.getPersistenceLibrary().empty() ||
           regionAttributes.getPersistenceFactory().empty())) {
-      regionFac.setPersistenceManager(regionAttributes.getPersistenceLibrary(),
-                                      regionAttributes.getPersistenceFactory(),
-                                      regionAttributes.getPersistenceProperties());
+      regionFac.setPersistenceManager(
+          regionAttributes.getPersistenceLibrary(),
+          regionAttributes.getPersistenceFactory(),
+          regionAttributes.getPersistenceProperties());
     }
     regionFac.setInitialCapacity(regionAttributes.getInitialCapacity());
     regionFac.setLoadFactor(regionAttributes.getLoadFactor());
@@ -217,7 +226,8 @@ class RegionHelper {
     regionFac.setDiskPolicy(regionAttributes.getDiskPolicy());
     regionFac.setCloningEnabled(regionAttributes.getCloningEnabled());
     regionFac.setPoolName(regionAttributes.getPoolName());
-    regionFac.setConcurrencyChecksEnabled(regionAttributes.getConcurrencyChecksEnabled());
+    regionFac.setConcurrencyChecksEnabled(
+        regionAttributes.getConcurrencyChecksEnabled());
   }
 
   std::shared_ptr<Region> createRootRegion(std::shared_ptr<Cache>& cachePtr) {
diff --git a/tests/cpp/security/CMakeLists.txt b/tests/cpp/security/CMakeLists.txt
index d1a6252..498008d 100644
--- a/tests/cpp/security/CMakeLists.txt
+++ b/tests/cpp/security/CMakeLists.txt
@@ -46,6 +46,7 @@ target_link_libraries(${PROJECT_NAME}
     ssl
   PRIVATE
     ACE
+	_WarningsAsError
 )
 
 # For Visual Studio organization
diff --git a/tests/cpp/security/PkcsAuthInit.cpp b/tests/cpp/security/PkcsAuthInit.cpp
index c53e1ca..61e6eee 100644
--- a/tests/cpp/security/PkcsAuthInit.cpp
+++ b/tests/cpp/security/PkcsAuthInit.cpp
@@ -63,16 +63,15 @@ uint8_t* createSignature(EVP_PKEY* key, X509* cert,
   if (key == NULL || cert == NULL || inputBuffer == NULL) {
     return NULL;
   }
-  const ASN1_OBJECT *macobj;
-  const X509_ALGOR *algorithm = nullptr;
+  const ASN1_OBJECT* macobj;
+  const X509_ALGOR* algorithm = nullptr;
   X509_ALGOR_get0(&macobj, NULL, NULL, algorithm);
   const EVP_MD* signatureDigest = EVP_get_digestbyobj(macobj);
   EVP_MD_CTX* signatureCtx = EVP_MD_CTX_new();
   uint8_t* signatureData = new uint8_t[EVP_PKEY_size(key)];
-  bool result =
-      (EVP_SignInit_ex(signatureCtx, signatureDigest, NULL) &&
-       EVP_SignUpdate(signatureCtx, inputBuffer, inputBufferLen) &&
-       EVP_SignFinal(signatureCtx, signatureData, signatureLen, key));
+  bool result = (EVP_SignInit_ex(signatureCtx, signatureDigest, NULL) &&
+                 EVP_SignUpdate(signatureCtx, inputBuffer, inputBufferLen) &&
+                 EVP_SignFinal(signatureCtx, signatureData, signatureLen, key));
   EVP_MD_CTX_free(signatureCtx);
   if (result) {
     return signatureData;
@@ -185,8 +184,8 @@ std::shared_ptr<Properties> PKCSAuthInitInternal::getCredentials(
   unsigned int lengthEncryptedData = 0;
 
   uint8_t* signatureData = createSignature(
-      privateKey, cert, reinterpret_cast<const unsigned char*>(alias), strlen(alias),
-      &lengthEncryptedData);
+      privateKey, cert, reinterpret_cast<const unsigned char*>(alias),
+      static_cast<uint32_t>(strlen(alias)), &lengthEncryptedData);
   EVP_PKEY_free(privateKey);
   X509_free(cert);
   if (signatureData == NULL) {
@@ -202,8 +201,8 @@ std::shared_ptr<Properties> PKCSAuthInitInternal::getCredentials(
     LOGINFO(" Converting CREDS to STRING: %s",
             signatureValPtr->toString().c_str());
   } else {
-    signatureValPtr = CacheableBytes::create(
-        std::vector<int8_t>(signatureData, signatureData + lengthEncryptedData));
+    signatureValPtr = CacheableBytes::create(std::vector<int8_t>(
+        signatureData, signatureData + lengthEncryptedData));
     LOGINFO(" Converting CREDS to BYTES: %s",
             signatureValPtr->toString().c_str());
   }
diff --git a/tests/cpp/testobject/CMakeLists.txt b/tests/cpp/testobject/CMakeLists.txt
index f548149..b318261 100644
--- a/tests/cpp/testobject/CMakeLists.txt
+++ b/tests/cpp/testobject/CMakeLists.txt
@@ -86,6 +86,7 @@ target_link_libraries(${PROJECT_NAME}
     fwk
   PRIVATE
     ACE
+	_WarningsAsError
 )
 
 # For Visual Studio organization

-- 
To stop receiving notification emails like this one, please contact
jbarrett@apache.org.