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

moleske pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/geode-native.git


The following commit(s) were added to refs/heads/develop by this push:
     new 4617f22  GEODE-8469: Enable no-missing-variable-declarations (#645)
4617f22 is described below

commit 4617f22a1fa91464e8f9a38b08eeff206c1677d4
Author: M. Oleske <mole...@users.noreply.github.com>
AuthorDate: Mon Sep 28 17:56:29 2020 -0700

    GEODE-8469: Enable no-missing-variable-declarations (#645)
    
    * Enable no-missing-variable-declarations
    * ignore the warning in integration-test.  We don't care about the old test 
code.
    
    Authored-by: M. Oleske <michael@oleske.engineer>
    Co-authored-by: Blake Bender <bben...@pivotal.io>
    Co-authored-by: Blake Bender <bbl...@vmware.com>
---
 CMakeLists.txt                                     |   1 -
 cppcache/benchmark/GeodeLoggingBM.cpp              |  28 ++--
 cppcache/integration-test/CMakeLists.txt           |   6 +
 cppcache/src/DataOutput.cpp                        |   3 +-
 cppcache/src/Exception.cpp                         |   2 +-
 cppcache/src/ExceptionTypes.cpp                    | 169 ++++++++++-----------
 cppcache/src/Log.cpp                               |  28 ++--
 cppcache/src/PdxFieldType.cpp                      |   4 +-
 cppcache/test/CacheXmlParserTest.cpp               |  10 +-
 tests/cpp/security/XmlAuthzCredentialGenerator.hpp |  18 +--
 10 files changed, 135 insertions(+), 134 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 5842f61..e71dd1b 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -255,7 +255,6 @@ elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
     -Wno-float-equal #TODO fix
     -Wno-header-hygiene #TODO fix
     -Wno-conversion #TODO fix
-    -Wno-missing-variable-declarations #TODO fix
     -Wno-reserved-id-macro #TODO fix
     -Wno-documentation # TODO fix
     -Wno-range-loop-analysis
diff --git a/cppcache/benchmark/GeodeLoggingBM.cpp 
b/cppcache/benchmark/GeodeLoggingBM.cpp
index ac49e31..3dd3ff7 100644
--- a/cppcache/benchmark/GeodeLoggingBM.cpp
+++ b/cppcache/benchmark/GeodeLoggingBM.cpp
@@ -35,9 +35,9 @@ using apache::geode::client::internal::geode_hash;
 
 const int STRING_ARRAY_LENGTH = 3;
 
-int g_iteration = 0;
+static int g_iteration = 0;
 
-std::array<const char*, STRING_ARRAY_LENGTH> logStrings{
+static std::array<const char*, STRING_ARRAY_LENGTH> logStrings{
     "Short test string", "Slightly longer test string",
     "Very long string: "
     
"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
@@ -106,17 +106,17 @@ void GeodeLogToFile(benchmark::State& state) {
   }
 }
 
-auto LogStringsToConsole = GeodeLogToConsole<GeodeLogStrings>;
-auto LogIntsToConsole = GeodeLogToConsole<GeodeLogInts>;
-auto LogComboToConsole = GeodeLogToConsole<GeodeLogCombo>;
+static const auto kLogStringsToConsole = GeodeLogToConsole<GeodeLogStrings>;
+static const auto kLogIntsToConsole = GeodeLogToConsole<GeodeLogInts>;
+static const auto kLogComboToConsole = GeodeLogToConsole<GeodeLogCombo>;
 
-auto LogStringsToFile = GeodeLogToFile<GeodeLogStrings>;
-auto LogIntsToFile = GeodeLogToFile<GeodeLogInts>;
-auto LogComboToFile = GeodeLogToFile<GeodeLogCombo>;
+static const auto kLogStringsToFile = GeodeLogToFile<GeodeLogStrings>;
+static const auto kLogIntsToFile = GeodeLogToFile<GeodeLogInts>;
+static const auto kLogComboToFile = GeodeLogToFile<GeodeLogCombo>;
 
-BENCHMARK(LogStringsToConsole)->Range(8, 8 << 10);
-BENCHMARK(LogIntsToConsole)->Range(8, 8 << 10);
-BENCHMARK(LogComboToConsole)->Range(8, 8 << 10);
-BENCHMARK(LogStringsToFile)->Range(8, 8 << 10);
-BENCHMARK(LogIntsToFile)->Range(8, 8 << 10);
-BENCHMARK(LogComboToFile)->Range(8, 8 << 10);
+BENCHMARK(kLogStringsToConsole)->Range(8, 8 << 10);
+BENCHMARK(kLogIntsToConsole)->Range(8, 8 << 10);
+BENCHMARK(kLogComboToConsole)->Range(8, 8 << 10);
+BENCHMARK(kLogStringsToFile)->Range(8, 8 << 10);
+BENCHMARK(kLogIntsToFile)->Range(8, 8 << 10);
+BENCHMARK(kLogComboToFile)->Range(8, 8 << 10);
diff --git a/cppcache/integration-test/CMakeLists.txt 
b/cppcache/integration-test/CMakeLists.txt
index 6dd225e..fb5170a 100644
--- a/cppcache/integration-test/CMakeLists.txt
+++ b/cppcache/integration-test/CMakeLists.txt
@@ -105,6 +105,12 @@ foreach(FILE ${SOURCES})
     FOLDER cpp/test/integration/legacy
   )
 
+if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
+  target_compile_options(_WarningsAsError INTERFACE
+          -Wno-missing-variable-declarations
+          )
+endif()
+
   target_link_libraries(${TEST}
     PRIVATE
       ACE::ACE
diff --git a/cppcache/src/DataOutput.cpp b/cppcache/src/DataOutput.cpp
index 12afb19..6b234ce 100644
--- a/cppcache/src/DataOutput.cpp
+++ b/cppcache/src/DataOutput.cpp
@@ -18,7 +18,6 @@
 #include <vector>
 
 #include <geode/DataOutput.hpp>
-#include <geode/SystemProperties.hpp>
 
 #include "CacheImpl.hpp"
 #include "CacheRegionHelper.hpp"
@@ -31,7 +30,7 @@ namespace apache {
 namespace geode {
 namespace client {
 
-std::recursive_mutex globalBigBufferMutex;
+static std::recursive_mutex globalBigBufferMutex;
 size_t DataOutput::m_highWaterMark = 50 * 1024 * 1024;
 size_t DataOutput::m_lowWaterMark = 8192;
 
diff --git a/cppcache/src/Exception.cpp b/cppcache/src/Exception.cpp
index 78e68c4..33a2837 100644
--- a/cppcache/src/Exception.cpp
+++ b/cppcache/src/Exception.cpp
@@ -51,7 +51,7 @@ std::string Exception::getStackTrace() const {
   return stack_ ? stack_->getString() : "No stack available.";
 }
 
-thread_local std::string threadLocalExceptionMessage;
+static thread_local std::string threadLocalExceptionMessage;
 
 void setThreadLocalExceptionMessage(std::string exMsg) {
   threadLocalExceptionMessage = std::move(exMsg);
diff --git a/cppcache/src/ExceptionTypes.cpp b/cppcache/src/ExceptionTypes.cpp
index 5c7ac65..fab930e 100644
--- a/cppcache/src/ExceptionTypes.cpp
+++ b/cppcache/src/ExceptionTypes.cpp
@@ -30,9 +30,9 @@ namespace client {
 void setThreadLocalExceptionMessage(std::string exMsg);
 const std::string& getThreadLocalExceptionMessage();
 
-std::map<GfErrType,
-         std::function<void(std::string, std::string&, GfErrType, 
std::string)>>
-    error_map_;
+static std::map<GfErrType, std::function<void(std::string, std::string&,
+                                              GfErrType, std::string)>>
+    error_map;
 
 [[noreturn]] void notConnectedException(std::string message, std::string& 
exMsg,
                                         GfErrType, std::string) {
@@ -393,107 +393,106 @@ std::map<GfErrType,
 }
 
 void setErrorMap() {
-  error_map_.emplace(std::make_pair(GF_NOTCON, notConnectedException));
-  error_map_.emplace(std::make_pair(GF_MSG, messageException));
-  error_map_.emplace(
+  error_map.emplace(std::make_pair(GF_NOTCON, notConnectedException));
+  error_map.emplace(std::make_pair(GF_MSG, messageException));
+  error_map.emplace(
       std::make_pair(GF_CACHESERVER_EXCEPTION, cacheServerException));
-  error_map_.emplace(std::make_pair(GF_NOTOWN, notOwnerException));
-  error_map_.emplace(
+  error_map.emplace(std::make_pair(GF_NOTOWN, notOwnerException));
+  error_map.emplace(
       std::make_pair(GF_CACHE_REGION_NOT_FOUND, cacheServerException));
-  error_map_.emplace(
+  error_map.emplace(
       std::make_pair(GF_CACHE_REGION_NOT_GLOBAL, illegalStateException));
-  error_map_.emplace(std::make_pair(GF_CACHE_ILLEGAL_ARGUMENT_EXCEPTION,
-                                    illegalArgumentException));
-  error_map_.emplace(
+  error_map.emplace(std::make_pair(GF_CACHE_ILLEGAL_ARGUMENT_EXCEPTION,
+                                   illegalArgumentException));
+  error_map.emplace(
       std::make_pair(GF_CACHE_ILLEGAL_STATE_EXCEPTION, illegalStateException));
-  error_map_.emplace(
+  error_map.emplace(
       std::make_pair(GF_CACHE_WRITER_EXCEPTION, cacheWriterException));
-  error_map_.emplace(
-      std::make_pair(GF_CACHEWRITER_ERROR, cacheWriterException));
-  error_map_.emplace(
+  error_map.emplace(std::make_pair(GF_CACHEWRITER_ERROR, 
cacheWriterException));
+  error_map.emplace(
       std::make_pair(GF_CACHE_LOADER_EXCEPTION, cacheLoaderException));
-  error_map_.emplace(
+  error_map.emplace(
       std::make_pair(GF_CACHE_LISTENER_EXCEPTION, cacheListenerException));
-  error_map_.emplace(
+  error_map.emplace(
       std::make_pair(GF_CACHE_REGION_INVALID, regionDestroyedException));
-  error_map_.emplace(std::make_pair(GF_CACHE_PROXY, cacheProxyException));
-  error_map_.emplace(std::make_pair(GF_IOERR, geodeIOException));
-  error_map_.emplace(std::make_pair(GF_ENOENT, noSystemException));
-  error_map_.emplace(std::make_pair(GF_CACHE_REGION_KEYS_NOT_STRINGS,
-                                    illegalArgumentException));
-  error_map_.emplace(std::make_pair(GF_CACHE_REGION_ENTRY_NOT_BYTES,
-                                    illegalArgumentException));
-  error_map_.emplace(
+  error_map.emplace(std::make_pair(GF_CACHE_PROXY, cacheProxyException));
+  error_map.emplace(std::make_pair(GF_IOERR, geodeIOException));
+  error_map.emplace(std::make_pair(GF_ENOENT, noSystemException));
+  error_map.emplace(std::make_pair(GF_CACHE_REGION_KEYS_NOT_STRINGS,
+                                   illegalArgumentException));
+  error_map.emplace(std::make_pair(GF_CACHE_REGION_ENTRY_NOT_BYTES,
+                                   illegalArgumentException));
+  error_map.emplace(
       std::make_pair(GF_CACHE_TIMEOUT_EXCEPTION, timeoutException));
-  error_map_.emplace(std::make_pair(GF_TIMEOUT, timeoutException));
-  error_map_.emplace(std::make_pair(GF_CLIENT_WAIT_TIMEOUT, timeoutException));
-  error_map_.emplace(std::make_pair(GF_ENOMEM, outOfMemoryException));
-  error_map_.emplace(std::make_pair(GF_ERANGE, bufferSizeExceededException));
-  error_map_.emplace(
+  error_map.emplace(std::make_pair(GF_TIMEOUT, timeoutException));
+  error_map.emplace(std::make_pair(GF_CLIENT_WAIT_TIMEOUT, timeoutException));
+  error_map.emplace(std::make_pair(GF_ENOMEM, outOfMemoryException));
+  error_map.emplace(std::make_pair(GF_ERANGE, bufferSizeExceededException));
+  error_map.emplace(
       std::make_pair(GF_CACHE_LEASE_EXPIRED_EXCEPTION, leaseExpiredException));
-  error_map_.emplace(
+  error_map.emplace(
       std::make_pair(GF_CACHE_REGION_EXISTS_EXCEPTION, regionExistsException));
-  error_map_.emplace(
+  error_map.emplace(
       std::make_pair(GF_CACHE_ENTRY_NOT_FOUND, entryNotFoundException));
-  error_map_.emplace(
+  error_map.emplace(
       std::make_pair(GF_CACHE_ENTRY_EXISTS, entryExistsException));
-  error_map_.emplace(std::make_pair(GF_CACHE_ENTRY_DESTROYED_EXCEPTION,
-                                    entryDestroyedException));
-  error_map_.emplace(std::make_pair(GF_CACHE_REGION_DESTROYED_EXCEPTION,
-                                    regionDestroyedException));
-  error_map_.emplace(
+  error_map.emplace(std::make_pair(GF_CACHE_ENTRY_DESTROYED_EXCEPTION,
+                                   entryDestroyedException));
+  error_map.emplace(std::make_pair(GF_CACHE_REGION_DESTROYED_EXCEPTION,
+                                   regionDestroyedException));
+  error_map.emplace(
       std::make_pair(GF_CACHE_CLOSED_EXCEPTION, cacheClosedException));
-  error_map_.emplace(std::make_pair(GF_CACHE_STATISTICS_DISABLED_EXCEPTION,
-                                    statisticsDisabledException));
-  error_map_.emplace(std::make_pair(GF_CACHE_CONCURRENT_MODIFICATION_EXCEPTION,
-                                    concurrentModificationException));
-  error_map_.emplace(
+  error_map.emplace(std::make_pair(GF_CACHE_STATISTICS_DISABLED_EXCEPTION,
+                                   statisticsDisabledException));
+  error_map.emplace(std::make_pair(GF_CACHE_CONCURRENT_MODIFICATION_EXCEPTION,
+                                   concurrentModificationException));
+  error_map.emplace(
       std::make_pair(GF_NOT_AUTHORIZED_EXCEPTION, notAuthorizedException));
-  error_map_.emplace(std::make_pair(GF_AUTHENTICATION_FAILED_EXCEPTION,
-                                    authenticationFailedException));
-  error_map_.emplace(std::make_pair(GF_AUTHENTICATION_REQUIRED_EXCEPTION,
-                                    authenticationRequiredException));
-  error_map_.emplace(std::make_pair(GF_DUPLICATE_DURABLE_CLIENT,
-                                    duplicateDurableClientException));
-  error_map_.emplace(std::make_pair(GF_REMOTE_QUERY_EXCEPTION, 
queryException));
-  error_map_.emplace(
+  error_map.emplace(std::make_pair(GF_AUTHENTICATION_FAILED_EXCEPTION,
+                                   authenticationFailedException));
+  error_map.emplace(std::make_pair(GF_AUTHENTICATION_REQUIRED_EXCEPTION,
+                                   authenticationRequiredException));
+  error_map.emplace(std::make_pair(GF_DUPLICATE_DURABLE_CLIENT,
+                                   duplicateDurableClientException));
+  error_map.emplace(std::make_pair(GF_REMOTE_QUERY_EXCEPTION, queryException));
+  error_map.emplace(
       std::make_pair(GF_CACHE_LOCATOR_EXCEPTION, 
noAvailableLocatorsException));
-  error_map_.emplace(std::make_pair(GF_ALL_CONNECTIONS_IN_USE_EXCEPTION,
-                                    allConnectionsInUseException));
-  error_map_.emplace(
+  error_map.emplace(std::make_pair(GF_ALL_CONNECTIONS_IN_USE_EXCEPTION,
+                                   allConnectionsInUseException));
+  error_map.emplace(
       std::make_pair(GF_FUNCTION_EXCEPTION, functionExecutionException));
-  error_map_.emplace(std::make_pair(GF_DISKFULL, diskFailureException));
-  error_map_.emplace(std::make_pair(GF_ROLLBACK_EXCEPTION, rollbackException));
-  error_map_.emplace(
+  error_map.emplace(std::make_pair(GF_DISKFULL, diskFailureException));
+  error_map.emplace(std::make_pair(GF_ROLLBACK_EXCEPTION, rollbackException));
+  error_map.emplace(
       std::make_pair(GF_COMMIT_CONFLICT_EXCEPTION, commitConflictException));
-  error_map_.emplace(std::make_pair(GF_TRANSACTION_DATA_REBALANCED_EXCEPTION,
-                                    transactionDataRebalancedException));
-  error_map_.emplace(
+  error_map.emplace(std::make_pair(GF_TRANSACTION_DATA_REBALANCED_EXCEPTION,
+                                   transactionDataRebalancedException));
+  error_map.emplace(
       std::make_pair(GF_TRANSACTION_DATA_NODE_HAS_DEPARTED_EXCEPTION,
                      transactionDataNodeHasDepartedException));
-  error_map_.emplace(std::make_pair(GF_PUTALL_PARTIAL_RESULT_EXCEPTION,
-                                    putAllPartialResultException));
-  error_map_.emplace(std::make_pair(GF_NOERR, unknownException));
-  error_map_.emplace(std::make_pair(GF_DEADLK, unknownException));
-  error_map_.emplace(std::make_pair(GF_EACCES, unknownException));
-  error_map_.emplace(std::make_pair(GF_ECONFL, unknownException));
-  error_map_.emplace(std::make_pair(GF_EINVAL, unknownException));
-  error_map_.emplace(std::make_pair(GF_ETYPE, unknownException));
-  error_map_.emplace(std::make_pair(GF_NOTOBJ, unknownException));
-  error_map_.emplace(std::make_pair(GF_NOTSUP, unknownException));
-  error_map_.emplace(std::make_pair(GF_SCPGBL, unknownException));
-  error_map_.emplace(std::make_pair(GF_SCPEXC, unknownException));
-  error_map_.emplace(std::make_pair(GF_OVRFLW, unknownException));
-  error_map_.emplace(std::make_pair(GF_EINTR, unknownException));
-  error_map_.emplace(std::make_pair(GF_NOSERVER_FOUND, unknownException));
-  error_map_.emplace(std::make_pair(GF_SERVER_FAILED, unknownException));
-  error_map_.emplace(std::make_pair(GF_CLIENT_WAIT_TIMEOUT_REFRESH_PRMETADATA,
-                                    unknownException));
-  error_map_.emplace(
+  error_map.emplace(std::make_pair(GF_PUTALL_PARTIAL_RESULT_EXCEPTION,
+                                   putAllPartialResultException));
+  error_map.emplace(std::make_pair(GF_NOERR, unknownException));
+  error_map.emplace(std::make_pair(GF_DEADLK, unknownException));
+  error_map.emplace(std::make_pair(GF_EACCES, unknownException));
+  error_map.emplace(std::make_pair(GF_ECONFL, unknownException));
+  error_map.emplace(std::make_pair(GF_EINVAL, unknownException));
+  error_map.emplace(std::make_pair(GF_ETYPE, unknownException));
+  error_map.emplace(std::make_pair(GF_NOTOBJ, unknownException));
+  error_map.emplace(std::make_pair(GF_NOTSUP, unknownException));
+  error_map.emplace(std::make_pair(GF_SCPGBL, unknownException));
+  error_map.emplace(std::make_pair(GF_SCPEXC, unknownException));
+  error_map.emplace(std::make_pair(GF_OVRFLW, unknownException));
+  error_map.emplace(std::make_pair(GF_EINTR, unknownException));
+  error_map.emplace(std::make_pair(GF_NOSERVER_FOUND, unknownException));
+  error_map.emplace(std::make_pair(GF_SERVER_FAILED, unknownException));
+  error_map.emplace(std::make_pair(GF_CLIENT_WAIT_TIMEOUT_REFRESH_PRMETADATA,
+                                   unknownException));
+  error_map.emplace(
       std::make_pair(GF_CANNOT_PROCESS_GII_REQUEST, unknownException));
-  error_map_.emplace(std::make_pair(GF_CACHE_ENTRY_UPDATED, unknownException));
-  error_map_.emplace(std::make_pair(GF_INVALID_DELTA, unknownException));
-  error_map_.emplace(std::make_pair(GF_EUNDEF, unknownException));
+  error_map.emplace(std::make_pair(GF_CACHE_ENTRY_UPDATED, unknownException));
+  error_map.emplace(std::make_pair(GF_INVALID_DELTA, unknownException));
+  error_map.emplace(std::make_pair(GF_EUNDEF, unknownException));
 }
 
 [[noreturn]] void GfErrTypeThrowException(const char* str, GfErrType err) {
@@ -507,8 +506,8 @@ void setErrorMap() {
   }
 
   setErrorMap();
-  auto iter = error_map_.find(err);
-  if (iter != std::end(error_map_)) {
+  auto iter = error_map.find(err);
+  if (iter != std::end(error_map)) {
     iter->second(message, exMsg, err, func);
   }
   unknownException(message, exMsg, err, func);
diff --git a/cppcache/src/Log.cpp b/cppcache/src/Log.cpp
index 57a8352..7b8c2ad 100644
--- a/cppcache/src/Log.cpp
+++ b/cppcache/src/Log.cpp
@@ -63,29 +63,27 @@ namespace geode {
 namespace log {
 namespace globals {
 
-std::string* g_logFile = nullptr;
-std::string* g_logFileWithExt = nullptr;
+static std::string* g_logFile = nullptr;
+static std::string* g_logFileWithExt = nullptr;
 
-size_t g_bytesWritten = 0;
-bool g_isLogFileOpened = false;
+static size_t g_bytesWritten = 0;
+static bool g_isLogFileOpened = false;
 
-size_t g_fileSizeLimit = GEODE_MAX_LOG_FILE_LIMIT;
-size_t g_diskSpaceLimit = GEODE_MAX_LOG_DISK_LIMIT;
+static size_t g_fileSizeLimit = GEODE_MAX_LOG_FILE_LIMIT;
+static size_t g_diskSpaceLimit = GEODE_MAX_LOG_DISK_LIMIT;
 
-char g_logFileNameBuffer[2048] = {0};
+static std::mutex g_logMutex;
 
-std::mutex g_logMutex;
-
-int g_rollIndex = 0;
-size_t g_spaceUsed = 0;
+static int g_rollIndex = 0;
+static size_t g_spaceUsed = 0;
 // Make a pair for the filename & its size
-std::pair<std::string, int64_t> g_fileInfoPair;
+static std::pair<std::string, int64_t> g_fileInfoPair;
 // Vector to hold the fileInformation
 typedef std::vector<std::pair<std::string, int64_t> > g_fileInfo;
 
-FILE* g_log = nullptr;
-ACE_utsname g_uname;
-pid_t g_pid = 0;
+static FILE* g_log = nullptr;
+static ACE_utsname g_uname;
+static pid_t g_pid = 0;
 
 }  // namespace globals
 }  // namespace log
diff --git a/cppcache/src/PdxFieldType.cpp b/cppcache/src/PdxFieldType.cpp
index 1cff01a..188ed35 100644
--- a/cppcache/src/PdxFieldType.cpp
+++ b/cppcache/src/PdxFieldType.cpp
@@ -31,7 +31,7 @@ namespace apache {
 namespace geode {
 namespace client {
 
-int32_t fixedTypeSizes[] = {
+static const int32_t kFixedTypeSizes[] = {
     PdxTypes::BOOLEAN_SIZE,  // BOOLEAN
     PdxTypes::BOOLEAN_SIZE,  // BYTE
     PdxTypes::CHAR_SIZE,     // CHAR
@@ -133,7 +133,7 @@ int32_t PdxFieldType::getFixedTypeSize() const {
   int32_t result = -1;
 
   if (m_typeId != PdxFieldTypes::UNKNOWN) {
-    result = fixedTypeSizes[static_cast<int32_t>(m_typeId)];
+    result = kFixedTypeSizes[static_cast<int32_t>(m_typeId)];
   }
 
   return result;
diff --git a/cppcache/test/CacheXmlParserTest.cpp 
b/cppcache/test/CacheXmlParserTest.cpp
index 4387da3..63ad51f 100644
--- a/cppcache/test/CacheXmlParserTest.cpp
+++ b/cppcache/test/CacheXmlParserTest.cpp
@@ -21,7 +21,7 @@
 
 using apache::geode::client::CacheXmlParser;
 
-std::string xsd_prefix = R"(<?xml version='1.0' encoding='UTF-8'?>
+static const std::string kXsdPrefix = R"(<?xml version='1.0' encoding='UTF-8'?>
 <client-cache
   xmlns="http://geode.apache.org/schema/cpp-cache";
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
@@ -30,7 +30,7 @@ std::string xsd_prefix = R"(<?xml version='1.0' 
encoding='UTF-8'?>
   version='1.0'
 >)";
 
-std::string valid_cache_config_body = R"(<region name = 'Root1' >
+static const std::string kValidCacheConfigBody = R"(<region name = 'Root1' >
         <region-attributes scope='local'
                            caching-enabled='true'
                            initial-capacity='25'
@@ -99,7 +99,7 @@ std::string valid_cache_config_body = R"(<region name = 
'Root1' >
     </region>
 </client-cache>)";
 
-std::string invalid_cache_config_body = R"(<region >
+static const std::string kInvalidCacheConfigBody = R"(<region >
         <region-attributes scope='local'
                            caching-enabled='true'
                            initial-capacity='25'
@@ -170,13 +170,13 @@ std::string invalid_cache_config_body = R"(<region >
 
 TEST(CacheXmlParser, CanParseRegionConfigFromAValidXsdCacheConfig) {
   CacheXmlParser parser(nullptr);
-  std::string xml = xsd_prefix + valid_cache_config_body;
+  std::string xml = kXsdPrefix + kValidCacheConfigBody;
   parser.parseMemory(xml.c_str(), static_cast<int>(xml.length()));
 }
 
 TEST(CacheXmlParser, ParseRegionConfigFromInvalidCacheConfigThrowsException) {
   CacheXmlParser parser(nullptr);
-  std::string xml = xsd_prefix + invalid_cache_config_body;
+  std::string xml = kXsdPrefix + kInvalidCacheConfigBody;
   ASSERT_THROW(parser.parseMemory(xml.c_str(), static_cast<int>(xml.length())),
                apache::geode::client::CacheXmlException);
 }
diff --git a/tests/cpp/security/XmlAuthzCredentialGenerator.hpp 
b/tests/cpp/security/XmlAuthzCredentialGenerator.hpp
index c3d34af..5b120a2 100644
--- a/tests/cpp/security/XmlAuthzCredentialGenerator.hpp
+++ b/tests/cpp/security/XmlAuthzCredentialGenerator.hpp
@@ -55,7 +55,7 @@ const opCodeList::value_type QArr[] = {OP_QUERY, 
OP_REGISTER_CQ};
 
 const stringList::value_type QRArr[] = {"Portfolios", "Positions"};
 
-const char* PRiUsnm = "%s%d";
+static const char* kPRiUsername = "%s%d";
 
 class XmlAuthzCredentialGenerator;
 
@@ -186,19 +186,19 @@ class XmlAuthzCredentialGenerator {
     char userName[100];
     switch (role) {
       case READER_ROLE:
-        sprintf(userName, PRiUsnm, "reader", randomValue(2));
+        sprintf(userName, kPRiUsername, "reader", randomValue(2));
         break;
       case WRITER_ROLE:
-        sprintf(userName, PRiUsnm, "writer", randomValue(2));
+        sprintf(userName, kPRiUsername, "writer", randomValue(2));
         break;
       case QUERY_ROLE:
-        sprintf(userName, PRiUsnm, "reader", randomValue(1) + 3);
+        sprintf(userName, kPRiUsername, "reader", randomValue(1) + 3);
         break;
       case ADMIN_ROLE:
         sprintf(userName, "%s", adminUsers[randomValue(adminUsrSz)]);
         break;
       case NO_ROLE:
-        sprintf(userName, PRiUsnm, "user", randomValue(2));
+        sprintf(userName, kPRiUsername, "user", randomValue(2));
         break;
     };
 
@@ -234,20 +234,20 @@ class XmlAuthzCredentialGenerator {
     char userName[256];
     switch (role) {
       case READER_ROLE:
-        sprintf(userName, PRiUsnm, userPrefix.c_str(),
+        sprintf(userName, kPRiUsername, userPrefix.c_str(),
                 readerIndices[randomValue(readerIndSz)]);
         break;
       case WRITER_ROLE:
-        sprintf(userName, PRiUsnm, userPrefix.c_str(),
+        sprintf(userName, kPRiUsername, userPrefix.c_str(),
                 writerIndices[randomValue(writerIndSz)]);
         break;
       case QUERY_ROLE:
-        sprintf(userName, PRiUsnm, userPrefix.c_str(),
+        sprintf(userName, kPRiUsername, userPrefix.c_str(),
                 queryIndices[randomValue(queryIndSz)]);
         break;
       case ADMIN_ROLE:
       case NO_ROLE:
-        sprintf(userName, PRiUsnm, userPrefix.c_str(),
+        sprintf(userName, kPRiUsername, userPrefix.c_str(),
                 adminIndices[randomValue(adminIndSz)]);
         break;
     };

Reply via email to