Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id DDE75200C1C for ; Wed, 15 Feb 2017 19:50:30 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id DC785160B70; Wed, 15 Feb 2017 18:50:30 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id B6529160B4D for ; Wed, 15 Feb 2017 19:50:28 +0100 (CET) Received: (qmail 61199 invoked by uid 500); 15 Feb 2017 18:50:28 -0000 Mailing-List: contact commits-help@geode.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@geode.apache.org Delivered-To: mailing list commits@geode.apache.org Received: (qmail 61181 invoked by uid 99); 15 Feb 2017 18:50:27 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 15 Feb 2017 18:50:27 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id C110BE038F; Wed, 15 Feb 2017 18:50:27 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: jbarrett@apache.org To: commits@geode.apache.org Date: Wed, 15 Feb 2017 18:50:29 -0000 Message-Id: In-Reply-To: References: X-Mailer: ASF-Git Admin Mailer Subject: [3/3] geode-native git commit: GEODE-2484 Replace ace calls to standard functions archived-at: Wed, 15 Feb 2017 18:50:31 -0000 GEODE-2484 Replace ace calls to standard functions - Fix compile errors related to including headers - Fix formatting and c-style cast warnings This closes #3. Project: http://git-wip-us.apache.org/repos/asf/geode-native/repo Commit: http://git-wip-us.apache.org/repos/asf/geode-native/commit/d4e0a844 Tree: http://git-wip-us.apache.org/repos/asf/geode-native/tree/d4e0a844 Diff: http://git-wip-us.apache.org/repos/asf/geode-native/diff/d4e0a844 Branch: refs/heads/develop Commit: d4e0a8447b1e54d5c34a35069bc24a30d8258e2e Parents: ad8b5a8 Author: David Kimura Authored: Fri Feb 10 10:14:02 2017 -0800 Committer: Jacob Barrett Committed: Wed Feb 15 10:50:06 2017 -0800 ---------------------------------------------------------------------- src/cppcache/src/CacheImpl.cpp | 9 +- src/cppcache/src/CacheXmlParser.cpp | 330 +++++++++++-------- src/cppcache/src/CacheableDate.cpp | 13 +- src/cppcache/src/CacheableKey.cpp | 6 +- src/cppcache/src/CacheableString.cpp | 8 +- src/cppcache/src/ClientProxyMembershipID.cpp | 17 +- src/cppcache/src/ClientProxyMembershipID.hpp | 5 +- src/cppcache/src/CqEventImpl.cpp | 2 +- src/cppcache/src/DiffieHellman.cpp | 14 +- src/cppcache/src/DiskStoreId.cpp | 6 +- src/cppcache/src/EventId.cpp | 14 +- src/cppcache/src/Exception.cpp | 8 +- src/cppcache/src/ExceptionTypes.cpp | 2 +- src/cppcache/src/Log.cpp | 72 ++-- src/cppcache/src/PdxFieldType.cpp | 5 +- src/cppcache/src/PdxInstanceFactoryImpl.cpp | 10 +- src/cppcache/src/PdxInstanceImpl.cpp | 154 ++++----- src/cppcache/src/PdxReaderWithTypeCollector.cpp | 3 +- src/cppcache/src/PdxType.cpp | 10 +- src/cppcache/src/PoolAttributes.cpp | 4 +- src/cppcache/src/PoolFactory.cpp | 4 +- src/cppcache/src/Properties.cpp | 2 +- src/cppcache/src/ProxyRegion.cpp | 2 +- src/cppcache/src/ProxyRemoteQueryService.cpp | 8 +- src/cppcache/src/PutAllPartialResult.hpp | 12 +- src/cppcache/src/RegionAttributes.cpp | 30 +- src/cppcache/src/RegionFactory.cpp | 2 +- src/cppcache/src/RemoteQuery.cpp | 16 +- src/cppcache/src/ServerLocation.cpp | 3 +- src/cppcache/src/SslSockStream.cpp | 7 +- src/cppcache/src/StackFrame.cpp | 6 +- src/cppcache/src/SystemProperties.cpp | 63 ++-- src/cppcache/src/TcpConn.cpp | 23 +- src/cppcache/src/TcpSslConn.cpp | 24 +- src/cppcache/src/TcrMessage.hpp | 36 +- src/cppcache/src/ThinClientPoolDM.cpp | 12 +- src/cppcache/src/ThinClientRegion.cpp | 10 +- src/cppcache/src/Utils.cpp | 13 +- .../src/statistics/AtomicStatisticsImpl.cpp | 22 +- src/cppcache/src/statistics/HostStatHelper.cpp | 6 +- .../src/statistics/HostStatHelperLinux.cpp | 3 +- .../src/statistics/HostStatHelperSolaris.cpp | 11 +- .../src/statistics/HostStatHelperWin.cpp | 9 +- src/cppcache/src/statistics/HostStatSampler.cpp | 34 +- .../src/statistics/OsStatisticsImpl.cpp | 26 +- .../src/statistics/StatisticDescriptorImpl.cpp | 8 +- .../src/statistics/StatisticsTypeImpl.cpp | 6 +- 47 files changed, 551 insertions(+), 539 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/geode-native/blob/d4e0a844/src/cppcache/src/CacheImpl.cpp ---------------------------------------------------------------------- diff --git a/src/cppcache/src/CacheImpl.cpp b/src/cppcache/src/CacheImpl.cpp index 308e13d..71fbb4f 100644 --- a/src/cppcache/src/CacheImpl.cpp +++ b/src/cppcache/src/CacheImpl.cpp @@ -34,7 +34,6 @@ #include "ClientProxyMembershipID.hpp" #include "AutoDelete.hpp" #include -#include "ace/OS.h" #include #include #include "ThinClientPoolHADM.hpp" @@ -484,7 +483,7 @@ void CacheImpl::createRegion(const char* name, RegionPtr tmp; if (0 == m_regions->find(namestr, tmp)) { char buffer[256]; - ACE_OS::snprintf( + std::snprintf( buffer, 256, "Cache::createRegion: \"%s\" region exists in local cache", namestr.c_str()); @@ -506,14 +505,14 @@ void CacheImpl::createRegion(const char* name, throw; } catch (std::exception& ex) { char buffer[512]; - ACE_OS::snprintf(buffer, 512, + std::snprintf(buffer, 512, "Cache::createRegion: Failed to create Region \"%s\" " "due to unknown exception: %s", namestr.c_str(), ex.what()); throw UnknownException(buffer); } catch (...) { char buffer[256]; - ACE_OS::snprintf(buffer, 256, + std::snprintf(buffer, 256, "Cache::createRegion: Failed to create Region \"%s\" " "due to unknown exception.", namestr.c_str()); @@ -521,7 +520,7 @@ void CacheImpl::createRegion(const char* name, } if (rpImpl == NULL) { char buffer[256]; - ACE_OS::snprintf(buffer, 256, + std::snprintf(buffer, 256, "Cache::createRegion: Failed to create Region \"%s\"", namestr.c_str()); throw RegionCreationFailedException(buffer); http://git-wip-us.apache.org/repos/asf/geode-native/blob/d4e0a844/src/cppcache/src/CacheXmlParser.cpp ---------------------------------------------------------------------- diff --git a/src/cppcache/src/CacheXmlParser.cpp b/src/cppcache/src/CacheXmlParser.cpp index e4f43ce..e73e974 100644 --- a/src/cppcache/src/CacheXmlParser.cpp +++ b/src/cppcache/src/CacheXmlParser.cpp @@ -20,6 +20,7 @@ #include #include "AutoDelete.hpp" #include "CacheImpl.hpp" +#include #if defined(_WIN32) #include @@ -82,47 +83,67 @@ extern "C" void startElementSAX2Function(void* ctx, const xmlChar* name, (!parser->isIllegalStateException()) && (!parser->isAnyOtherException())) { try { - if (strcmp((char*)name, parser->CACHE) == 0) { + if (strcmp(reinterpret_cast(name), parser->CACHE) == 0) { parser->startCache(ctx, atts); - } else if (strcmp((char*)name, parser->CLIENT_CACHE) == 0) { + } else if (strcmp(reinterpret_cast(name), + parser->CLIENT_CACHE) == 0) { parser->startCache(ctx, atts); - } else if (strcmp((char*)name, parser->PDX) == 0) { + } else if (strcmp(reinterpret_cast(name), + parser->PDX) == 0) { parser->startPdx(atts); - } else if (strcmp((char*)name, parser->REGION) == 0) { + } else if (strcmp(reinterpret_cast(name), + parser->REGION) == 0) { parser->incNesting(); parser->startRegion(atts, parser->isRootLevel()); - } else if (strcmp((char*)name, parser->ROOT_REGION) == 0) { + } else if (strcmp(reinterpret_cast(name), + parser->ROOT_REGION) == 0) { parser->incNesting(); parser->startRegion(atts, parser->isRootLevel()); - } else if (strcmp((char*)name, parser->REGION_ATTRIBUTES) == 0) { + } else if (strcmp(reinterpret_cast(name), + parser->REGION_ATTRIBUTES) == 0) { parser->startRegionAttributes(atts); - } else if (strcmp((char*)name, parser->REGION_TIME_TO_LIVE) == 0) { - } else if (strcmp((char*)name, parser->REGION_IDLE_TIME) == 0) { - } else if (strcmp((char*)name, parser->ENTRY_TIME_TO_LIVE) == 0) { - } else if (strcmp((char*)name, parser->ENTRY_IDLE_TIME) == 0) { - } else if (strcmp((char*)name, parser->EXPIRATION_ATTRIBUTES) == 0) { + } else if (strcmp(reinterpret_cast(name), + parser->REGION_TIME_TO_LIVE) == 0) { + } else if (strcmp(reinterpret_cast(name), + parser->REGION_IDLE_TIME) == 0) { + } else if (strcmp(reinterpret_cast(name), + parser->ENTRY_TIME_TO_LIVE) == 0) { + } else if (strcmp(reinterpret_cast(name), + parser->ENTRY_IDLE_TIME) == 0) { + } else if (strcmp(reinterpret_cast(name), + parser->EXPIRATION_ATTRIBUTES) == 0) { parser->startExpirationAttributes(atts); - } else if (strcmp((char*)name, parser->CACHE_LOADER) == 0) { + } else if (strcmp(reinterpret_cast(name), + parser->CACHE_LOADER) == 0) { parser->startCacheLoader(atts); - } else if (strcmp((char*)name, parser->CACHE_WRITER) == 0) { + } else if (strcmp(reinterpret_cast(name), + parser->CACHE_WRITER) == 0) { parser->startCacheWriter(atts); - } else if (strcmp((char*)name, parser->CACHE_LISTENER) == 0) { + } else if (strcmp(reinterpret_cast(name), + parser->CACHE_LISTENER) == 0) { parser->startCacheListener(atts); - } else if (strcmp((char*)name, parser->PARTITION_RESOLVER) == 0) { + } else if (strcmp(reinterpret_cast(name), + parser->PARTITION_RESOLVER) == 0) { parser->startPartitionResolver(atts); - } else if (strcmp((char*)name, parser->PERSISTENCE_MANAGER) == 0) { + } else if (strcmp(reinterpret_cast(name), + parser->PERSISTENCE_MANAGER) == 0) { parser->startPersistenceManager(atts); - } else if (strcmp((char*)name, parser->PROPERTIES) == 0) { - } else if (strcmp((char*)name, parser->PROPERTY) == 0) { + } else if (strcmp(reinterpret_cast(name), + parser->PROPERTIES) == 0) { + } else if (strcmp(reinterpret_cast(name), + parser->PROPERTY) == 0) { parser->startPersistenceProperties(atts); - } else if (strcmp((char*)name, parser->POOL) == 0) { + } else if (strcmp(reinterpret_cast(name), + parser->POOL) == 0) { parser->startPool(atts); - } else if (strcmp((char*)name, parser->LOCATOR) == 0) { + } else if (strcmp(reinterpret_cast(name), + parser->LOCATOR) == 0) { parser->startLocator(atts); - } else if (strcmp((char*)name, parser->SERVER) == 0) { + } else if (strcmp(reinterpret_cast(name), + parser->SERVER) == 0) { parser->startServer(atts); } else { - std::string temp((char*)name); + std::string temp(reinterpret_cast(name)); std::string s = "XML:Unknown XML element \"" + temp + "\""; throw CacheXmlException(s.c_str()); } @@ -155,45 +176,65 @@ extern "C" void endElementSAX2Function(void* ctx, const xmlChar* name) { (!parser->isIllegalStateException()) && (!parser->isAnyOtherException())) { try { - if (strcmp((char*)name, parser->CACHE) == 0) { + if (strcmp(reinterpret_cast(name), parser->CACHE) == 0) { parser->endCache(); - } else if (strcmp((char*)name, parser->CLIENT_CACHE) == 0) { + } else if (strcmp(reinterpret_cast(name), + parser->CLIENT_CACHE) == 0) { parser->endCache(); - } else if (strcmp((char*)name, parser->PDX) == 0) { + } else if (strcmp(reinterpret_cast(name), + parser->PDX) == 0) { parser->endPdx(); - } else if (strcmp((char*)name, parser->REGION) == 0) { + } else if (strcmp(reinterpret_cast(name), + parser->REGION) == 0) { parser->endRegion(parser->isRootLevel()); parser->decNesting(); - } else if (strcmp((char*)name, parser->ROOT_REGION) == 0) { + } else if (strcmp(reinterpret_cast(name), + parser->ROOT_REGION) == 0) { parser->endRegion(parser->isRootLevel()); parser->decNesting(); - } else if (strcmp((char*)name, parser->REGION_ATTRIBUTES) == 0) { + } else if (strcmp(reinterpret_cast(name), + parser->REGION_ATTRIBUTES) == 0) { parser->endRegionAttributes(); - } else if (strcmp((char*)name, parser->REGION_TIME_TO_LIVE) == 0) { + } else if (strcmp(reinterpret_cast(name), + parser->REGION_TIME_TO_LIVE) == 0) { parser->endRegionTimeToLive(); - } else if (strcmp((char*)name, parser->REGION_IDLE_TIME) == 0) { + } else if (strcmp(reinterpret_cast(name), + parser->REGION_IDLE_TIME) == 0) { parser->endRegionIdleTime(); - } else if (strcmp((char*)name, parser->ENTRY_TIME_TO_LIVE) == 0) { + } else if (strcmp(reinterpret_cast(name), + parser->ENTRY_TIME_TO_LIVE) == 0) { parser->endEntryTimeToLive(); - } else if (strcmp((char*)name, parser->ENTRY_IDLE_TIME) == 0) { + } else if (strcmp(reinterpret_cast(name), + parser->ENTRY_IDLE_TIME) == 0) { parser->endEntryIdleTime(); - } else if (strcmp((char*)name, parser->EXPIRATION_ATTRIBUTES) == 0) { - } else if (strcmp((char*)name, parser->CACHE_LOADER) == 0) { - } else if (strcmp((char*)name, parser->CACHE_WRITER) == 0) { - } else if (strcmp((char*)name, parser->CACHE_LISTENER) == 0) { - } else if (strcmp((char*)name, parser->PARTITION_RESOLVER) == 0) { - } else if (strcmp((char*)name, parser->PERSISTENCE_MANAGER) == 0) { + } else if (strcmp(reinterpret_cast(name), + parser->EXPIRATION_ATTRIBUTES) == 0) { + } else if (strcmp(reinterpret_cast(name), + parser->CACHE_LOADER) == 0) { + } else if (strcmp(reinterpret_cast(name), + parser->CACHE_WRITER) == 0) { + } else if (strcmp(reinterpret_cast(name), + parser->CACHE_LISTENER) == 0) { + } else if (strcmp(reinterpret_cast(name), + parser->PARTITION_RESOLVER) == 0) { + } else if (strcmp(reinterpret_cast(name), + parser->PERSISTENCE_MANAGER) == 0) { parser->endPersistenceManager(); - } else if (strcmp((char*)name, parser->PROPERTIES) == 0) { - } else if (strcmp((char*)name, parser->PROPERTY) == 0) { - } else if (strcmp((char*)name, parser->POOL) == 0) { + } else if (strcmp(reinterpret_cast(name), + parser->PROPERTIES) == 0) { + } else if (strcmp(reinterpret_cast(name), + parser->PROPERTY) == 0) { + } else if (strcmp(reinterpret_cast(name), + parser->POOL) == 0) { parser->endPool(); - } else if (strcmp((char*)name, parser->LOCATOR) == 0) { + } else if (strcmp(reinterpret_cast(name), + parser->LOCATOR) == 0) { // parser->endLocator(); - } else if (strcmp((char*)name, parser->SERVER) == 0) { + } else if (strcmp(reinterpret_cast(name), + parser->SERVER) == 0) { // parser->endServer(); } else { - std::string temp((char*)name); + std::string temp(reinterpret_cast(name)); std::string s = "XML:Unknown XML element \"" + temp + "\""; throw CacheXmlException(s.c_str()); } @@ -342,7 +383,7 @@ void CacheXmlParser::handleParserErrors(int res) { if (res != 0) // xml file is not well-formed { char buf[256]; - ACE_OS::snprintf(buf, 256, "Error code returned by xml parser is : %d ", + std::snprintf(buf, 256, "Error code returned by xml parser is : %d ", res); Log::error(buf); @@ -438,10 +479,10 @@ void CacheXmlParser::create(Cache* cache) { void CacheXmlParser::startCache(void* ctx, const xmlChar** attrs) { int attrsCount = 0; if (attrs != NULL) { - char* attrName; - char* attrValue; - while ((attrName = (char*)attrs[attrsCount++]) != NULL) { - attrValue = (char*)attrs[attrsCount++]; + const char* attrName; + const char* attrValue; + while ((attrName = reinterpret_cast(attrs[attrsCount++])) != NULL) { + attrValue = reinterpret_cast(attrs[attrsCount++]); if (attrValue == NULL) { std::string exStr = "XML: No value provided for attribute: "; exStr += attrName; @@ -719,11 +760,11 @@ void CacheXmlParser::startRegion(const xmlChar** atts, bool isRoot) { } char* regionName = NULL; - char* refid = NULL; + const char* refid = NULL; for (int i = 0; (atts[i] != NULL); i++) { if (atts[i] != NULL) { - char* name = (char*)atts[i]; + const char* name = (char*)atts[i]; i++; if (atts[i] != NULL) { char* value = (char*)atts[i]; @@ -799,7 +840,7 @@ void CacheXmlParser::startRegionAttributes(const xmlChar** atts) { throw CacheXmlException(s.c_str()); } - char* refid = NULL; + const char* refid = NULL; for (int i = 0; (atts[i] != NULL); i++) { i++; @@ -815,12 +856,14 @@ void CacheXmlParser::startRegionAttributes(const xmlChar** atts) { throw CacheXmlException(s.c_str()); } - if (strcmp((char*)atts[i - 1], ID) == 0) { + if (strcmp(reinterpret_cast(atts[i - 1]), ID) == 0) { RegionXmlCreation* region = reinterpret_cast(_stack.top()); - region->setAttrId(std::string((char*)atts[i])); - } else if (strcmp((char*)atts[i - 1], REFID) == 0) { - refid = (char*)atts[i]; + region->setAttrId( + std::string(reinterpret_cast(atts[i]))); + } else if (strcmp(reinterpret_cast(atts[i - 1]), + REFID) == 0) { + refid = reinterpret_cast(atts[i]); } } } @@ -849,13 +892,15 @@ void CacheXmlParser::startRegionAttributes(const xmlChar** atts) { _stack.push(attrsFactory); for (int i = 0; (atts[i] != NULL); i++) { - if (strcmp(ID, (char*)atts[i]) == 0 || - strcmp(REFID, (char*)atts[i]) == 0) { + if (strcmp(ID, reinterpret_cast(atts[i])) == 0 || + strcmp(REFID, reinterpret_cast(atts[i])) == 0) { i++; continue; - } else if (strcmp(CLIENT_NOTIFICATION_ENABLED, (char*)atts[i]) == 0) { + } else if (strcmp(CLIENT_NOTIFICATION_ENABLED, + reinterpret_cast(atts[i])) == 0) { i++; - char* client_notification_enabled = (char*)atts[i]; + const char* client_notification_enabled = + reinterpret_cast(atts[i]); if (strcmp("false", client_notification_enabled) == 0 || strcmp("FALSE", client_notification_enabled) == 0) { if (m_poolFactory) { @@ -867,30 +912,34 @@ void CacheXmlParser::startRegionAttributes(const xmlChar** atts) { m_poolFactory->setSubscriptionEnabled(true); } } else { - char* name = (char*)atts[i]; + const char* name = reinterpret_cast(atts[i]); std::string temp(name); std::string s = "XML: " + temp + " is not a valid value for the attribute \n"; throw CacheXmlException(s.c_str()); } - } else if (strcmp(INITIAL_CAPACITY, (char*)atts[i]) == 0) { + } else if (strcmp(INITIAL_CAPACITY, + reinterpret_cast(atts[i])) == 0) { i++; - char* initialCapacity = (char*)atts[i]; + const char* initialCapacity = reinterpret_cast(atts[i]); attrsFactory->setInitialCapacity(atoi(initialCapacity)); - } else if (strcmp(CONCURRENCY_LEVEL, (char*)atts[i]) == 0) { + } else if (strcmp(CONCURRENCY_LEVEL, + reinterpret_cast(atts[i])) == 0) { i++; - char* concurrencyLevel = (char*)atts[i]; + const char* concurrencyLevel = reinterpret_cast(atts[i]); attrsFactory->setConcurrencyLevel(atoi(concurrencyLevel)); - } else if (strcmp(LOAD_FACTOR, (char*)atts[i]) == 0) { + } else if (strcmp(LOAD_FACTOR, + reinterpret_cast(atts[i])) == 0) { i++; - char* loadFactor = (char*)atts[i]; + const char* loadFactor = reinterpret_cast(atts[i]); attrsFactory->setLoadFactor( static_cast(atof(loadFactor))); // check whether this works - } else if (strcmp(CACHING_ENABLED, (char*)atts[i]) == 0) { + } else if (strcmp(CACHING_ENABLED, + reinterpret_cast(atts[i])) == 0) { bool flag = false; i++; - char* cachingEnabled = (char*)atts[i]; + const char* cachingEnabled = reinterpret_cast(atts[i]); if (strcmp("true", cachingEnabled) == 0 || strcmp("TRUE", cachingEnabled) == 0) { flag = true; @@ -898,7 +947,7 @@ void CacheXmlParser::startRegionAttributes(const xmlChar** atts) { strcmp("FALSE", cachingEnabled) == 0) { flag = false; } else { - char* name = (char*)atts[i]; + const char* name = reinterpret_cast(atts[i]); std::string temp(name); std::string s = "XML: " + temp + @@ -906,15 +955,17 @@ void CacheXmlParser::startRegionAttributes(const xmlChar** atts) { throw CacheXmlException(s.c_str()); } attrsFactory->setCachingEnabled(flag); // check whether this works - } else if (strcmp(LRU_ENTRIES_LIMIT, (char*)atts[i]) == 0) { + } else if (strcmp(LRU_ENTRIES_LIMIT, + reinterpret_cast(atts[i])) == 0) { i++; - char* lruentriesLimit = (char*)atts[i]; + const char* lruentriesLimit = reinterpret_cast(atts[i]); int lruentriesLimitInt = atoi(lruentriesLimit); uint32_t temp = static_cast(lruentriesLimitInt); attrsFactory->setLruEntriesLimit(temp); - } else if (strcmp(DISK_POLICY, (char*)atts[i]) == 0) { + } else if (strcmp(DISK_POLICY, + reinterpret_cast(atts[i])) == 0) { i++; - char* diskPolicy = (char*)atts[i]; + const char* diskPolicy = reinterpret_cast(atts[i]); if (strcmp(OVERFLOWS, diskPolicy) == 0) { attrsFactory->setDiskPolicy( apache::geode::client::DiskPolicyType::OVERFLOWS); @@ -924,18 +975,19 @@ void CacheXmlParser::startRegionAttributes(const xmlChar** atts) { attrsFactory->setDiskPolicy( apache::geode::client::DiskPolicyType::NONE); } else { - char* name = (char*)atts[i]; + const char* name = reinterpret_cast(atts[i]); std::string temp(name); std::string s = "XML: " + temp + " is not a valid value for the attribute "; throw CacheXmlException(s.c_str()); } - } else if (strcmp(ENDPOINTS, (char*)atts[i]) == 0) { + } else if (strcmp(ENDPOINTS, + reinterpret_cast(atts[i])) == 0) { i++; if (m_poolFactory) { std::vector> endPoints( - parseEndPoints((char*)atts[i])); + parseEndPoints(reinterpret_cast(atts[i]))); std::vector>::iterator endPoint; for (endPoint = endPoints.begin(); endPoint != endPoints.end(); endPoint++) { @@ -943,15 +995,17 @@ void CacheXmlParser::startRegionAttributes(const xmlChar** atts) { } } isTCR = true; - } else if (strcmp(POOL_NAME, (char*)atts[i]) == 0) { + } else if (strcmp(POOL_NAME, + reinterpret_cast(atts[i])) == 0) { i++; - char* poolName = (char*)atts[i]; + const char* poolName = reinterpret_cast(atts[i]); attrsFactory->setPoolName(poolName); isTCR = true; - } else if (strcmp(CLONING_ENABLED, (char*)atts[i]) == 0) { + } else if (strcmp(CLONING_ENABLED, + reinterpret_cast(atts[i])) == 0) { i++; bool flag = false; - char* isClonable = (char*)atts[i]; + const char* isClonable = reinterpret_cast(atts[i]); if (strcmp("true", isClonable) == 0 || strcmp("TRUE", isClonable) == 0) { @@ -960,7 +1014,7 @@ void CacheXmlParser::startRegionAttributes(const xmlChar** atts) { strcmp("FALSE", isClonable) == 0) { flag = false; } else { - char* name = (char*)atts[i]; + const char* name = reinterpret_cast(atts[i]); std::string temp(name); std::string s = "XML: " + temp + @@ -970,10 +1024,12 @@ void CacheXmlParser::startRegionAttributes(const xmlChar** atts) { attrsFactory->setCloningEnabled(flag); isTCR = true; - } else if (strcmp(CONCURRENCY_CHECKS_ENABLED, (char*)atts[i]) == 0) { + } else if (strcmp(CONCURRENCY_CHECKS_ENABLED, + reinterpret_cast(atts[i])) == 0) { bool flag = false; i++; - char* concurrencyChecksEnabled = (char*)atts[i]; + const char* concurrencyChecksEnabled = + reinterpret_cast(atts[i]); if (strcmp("true", concurrencyChecksEnabled) == 0 || strcmp("TRUE", concurrencyChecksEnabled) == 0) { flag = true; @@ -981,7 +1037,7 @@ void CacheXmlParser::startRegionAttributes(const xmlChar** atts) { strcmp("FALSE", concurrencyChecksEnabled) == 0) { flag = false; } else { - char* name = (char*)atts[i]; + const char* name = reinterpret_cast(atts[i]); std::string temp(name); std::string s = "XML: " + temp + " is not a valid value for the attribute " @@ -1051,22 +1107,22 @@ void CacheXmlParser::startExpirationAttributes(const xmlChar** atts) { ""; throw CacheXmlException(s.c_str()); } - char* timeOut = NULL; + const char* timeOut = NULL; int timeOutInt = 0; ExpirationAction::Action expire = ExpirationAction::INVALID_ACTION; for (int i = 0; (atts[i] != NULL); i++) { - if (strcmp(TIMEOUT, (char*)atts[i]) == 0) { + if (strcmp(TIMEOUT, reinterpret_cast(atts[i])) == 0) { i++; - timeOut = (char*)atts[i]; + timeOut = reinterpret_cast(atts[i]); if (strcmp(timeOut, "") == 0) { std::string s = "XML:Value for attribute needs to be specified"; throw CacheXmlException(s.c_str()); } timeOutInt = atoi(timeOut); - } else if (strcmp(ACTION, (char*)atts[i]) == 0) { + } else if (strcmp(ACTION, reinterpret_cast(atts[i])) == 0) { i++; - char* action = (char*)atts[i]; + const char* action = reinterpret_cast(atts[i]); if (strcmp(action, "") == 0) { @@ -1085,14 +1141,14 @@ void CacheXmlParser::startExpirationAttributes(const xmlChar** atts) { } else if (strcmp(LOCAL_DESTROY, action) == 0) { expire = ExpirationAction::LOCAL_DESTROY; } else { - char* name = (char*)atts[i]; + const char* name = reinterpret_cast(atts[i]); std::string temp(name); std::string s = "XML: " + temp + " is not a valid value for the attribute "; throw CacheXmlException(s.c_str()); } } else { - char* name = (char*)atts[i]; + const char* name = reinterpret_cast(atts[i]); std::string temp(name); std::string s = "XML:Incorrect attribute name specified in " @@ -1132,9 +1188,9 @@ void CacheXmlParser::startPersistenceManager(const xmlChar** atts) { char* libraryName = NULL; char* libraryFunctionName = NULL; for (int i = 0; (atts[i] != NULL); i++) { - if (strcmp(LIBRARY_NAME, (char*)atts[i]) == 0) { + if (strcmp(LIBRARY_NAME, reinterpret_cast(atts[i])) == 0) { i++; - size_t len = strlen((char*)atts[i]) + 1; + size_t len = strlen(reinterpret_cast(atts[i])) + 1; libraryName = new char[len]; /* adongre * CID 28824: Dereference before null check (REVERSE_INULL) @@ -1143,7 +1199,7 @@ void CacheXmlParser::startPersistenceManager(const xmlChar** atts) { std::string s = "Memory allocation fails"; throw CacheXmlException(s.c_str()); } - ACE_OS::strncpy(libraryName, (char*)atts[i], len); + std::strncpy(libraryName, reinterpret_cast(atts[i]), len); if (libraryName == NULL) { std::string s = @@ -1153,9 +1209,10 @@ void CacheXmlParser::startPersistenceManager(const xmlChar** atts) { "will be set"; throw CacheXmlException(s.c_str()); } - } else if (strcmp(LIBRARY_FUNCTION_NAME, (char*)atts[i]) == 0) { + } else if (strcmp(LIBRARY_FUNCTION_NAME, + reinterpret_cast(atts[i])) == 0) { i++; - size_t len = strlen((char*)atts[i]) + 1; + size_t len = strlen(reinterpret_cast(atts[i])) + 1; libraryFunctionName = new char[len]; /* adongre * CID 28823: Dereference before null check (REVERSE_INULL) @@ -1165,7 +1222,8 @@ void CacheXmlParser::startPersistenceManager(const xmlChar** atts) { throw CacheXmlException(s.c_str()); } - ACE_OS::strncpy(libraryFunctionName, (char*)atts[i], len); + std::strncpy(libraryFunctionName, + reinterpret_cast(atts[i]), len); if (libraryFunctionName == NULL) { std::string s = "XML:Value for the needs to be provided"; @@ -1173,7 +1231,7 @@ void CacheXmlParser::startPersistenceManager(const xmlChar** atts) { throw CacheXmlException(s.c_str()); } } else { - char* name = (char*)atts[i]; + const char* name = reinterpret_cast(atts[i]); std::string temp(name); std::string s = "XML:Incorrect attribute name specified in : " + @@ -1219,21 +1277,21 @@ void CacheXmlParser::startPersistenceProperties(const xmlChar** atts) { m_config = Properties::create(); } } - char* propName = NULL; - char* propValue = NULL; + const char* propName = NULL; + const char* propValue = NULL; for (int i = 0; (atts[i] != NULL); i++) { - if (strcmp("name", (char*)atts[i]) == 0) { + if (strcmp("name", reinterpret_cast(atts[i])) == 0) { i++; - propName = (char*)atts[i]; + propName = reinterpret_cast(atts[i]); if (propName == NULL || strcmp(propName, "") == 0) { std::string s = "XML:Value for attribute needs to be specified in the " ""; throw CacheXmlException(s.c_str()); } - } else if (strcmp("value", (char*)atts[i]) == 0) { + } else if (strcmp("value", reinterpret_cast(atts[i])) == 0) { i++; - propValue = (char*)atts[i]; + propValue = reinterpret_cast(atts[i]); if (propValue == NULL || strcmp(propValue, "") == 0) { std::string s = "XML:Value for attribute needs to be " @@ -1241,7 +1299,7 @@ void CacheXmlParser::startPersistenceProperties(const xmlChar** atts) { throw CacheXmlException(s.c_str()); } } else { - char* name = (char*)atts[i]; + const char* name = reinterpret_cast(atts[i]); std::string temp(name); std::string s = "XML:Incorrect attribute name specified in : " + temp; @@ -1262,8 +1320,8 @@ void CacheXmlParser::startPersistenceProperties(const xmlChar** atts) { } void CacheXmlParser::startCacheLoader(const xmlChar** atts) { - char* libraryName = NULL; - char* libraryFunctionName = NULL; + const char* libraryName = NULL; + const char* libraryFunctionName = NULL; int attrsCount = 0; if (!atts) { std::string s = "XML:No attributes provided for "; @@ -1277,9 +1335,9 @@ void CacheXmlParser::startCacheLoader(const xmlChar** atts) { } for (int i = 0; (atts[i] != NULL); i++) { - if (strcmp(LIBRARY_NAME, (char*)atts[i]) == 0) { + if (strcmp(LIBRARY_NAME, reinterpret_cast(atts[i])) == 0) { i++; - libraryName = (char*)atts[i]; + libraryName = reinterpret_cast(atts[i]); if (libraryName == NULL || strcmp(libraryName, "") == 0) { std::string s = "XML:The attribute of cannot be set " @@ -1288,16 +1346,17 @@ void CacheXmlParser::startCacheLoader(const xmlChar** atts) { "will be set"; throw CacheXmlException(s.c_str()); } - } else if (strcmp(LIBRARY_FUNCTION_NAME, (char*)atts[i]) == 0) { + } else if (strcmp(LIBRARY_FUNCTION_NAME, + reinterpret_cast(atts[i])) == 0) { i++; - libraryFunctionName = (char*)atts[i]; + libraryFunctionName = reinterpret_cast(atts[i]); if (libraryFunctionName == NULL || strcmp(libraryFunctionName, "") == 0) { std::string s = "XML:Value for the needs to be provided"; throw CacheXmlException(s.c_str()); } } else { - char* name = (char*)atts[i]; + const char* name = reinterpret_cast(atts[i]); std::string temp(name); std::string s = "XML:Incorrect attribute name specified in : " + temp; @@ -1328,8 +1387,8 @@ void CacheXmlParser::startCacheLoader(const xmlChar** atts) { } void CacheXmlParser::startCacheListener(const xmlChar** atts) { - char* libraryName = NULL; - char* libraryFunctionName = NULL; + const char* libraryName = NULL; + const char* libraryFunctionName = NULL; int attrsCount = 0; if (!atts) { std::string s = "XML:No attributes provided for "; @@ -1343,9 +1402,9 @@ void CacheXmlParser::startCacheListener(const xmlChar** atts) { } for (int i = 0; (atts[i] != NULL); i++) { - if (strcmp(LIBRARY_NAME, (char*)atts[i]) == 0) { + if (strcmp(LIBRARY_NAME, reinterpret_cast(atts[i])) == 0) { i++; - libraryName = (char*)atts[i]; + libraryName = reinterpret_cast(atts[i]); if (libraryName == NULL || strcmp(libraryName, "") == 0) { std::string s = "XML:The attribute of the tag " @@ -1354,16 +1413,17 @@ void CacheXmlParser::startCacheListener(const xmlChar** atts) { "default value will be set"; throw CacheXmlException(s.c_str()); } - } else if (strcmp(LIBRARY_FUNCTION_NAME, (char*)atts[i]) == 0) { + } else if (strcmp(LIBRARY_FUNCTION_NAME, + reinterpret_cast(atts[i])) == 0) { i++; - libraryFunctionName = (char*)atts[i]; + libraryFunctionName = reinterpret_cast(atts[i]); if (libraryFunctionName == NULL || strcmp(libraryFunctionName, "") == 0) { std::string s = "XML:Value for needs to be provided"; throw CacheXmlException(s.c_str()); } } else { - char* name = (char*)atts[i]; + const char* name = reinterpret_cast(atts[i]); std::string temp(name); std::string s = "XML:Incorrect attribute name specified in : " + @@ -1395,8 +1455,8 @@ void CacheXmlParser::startCacheListener(const xmlChar** atts) { } void CacheXmlParser::startPartitionResolver(const xmlChar** atts) { - char* libraryName = NULL; - char* libraryFunctionName = NULL; + const char* libraryName = NULL; + const char* libraryFunctionName = NULL; int attrsCount = 0; if (!atts) { std::string s = "XML:No attributes provided for "; @@ -1410,9 +1470,9 @@ void CacheXmlParser::startPartitionResolver(const xmlChar** atts) { } for (int i = 0; (atts[i] != NULL); i++) { - if (strcmp(LIBRARY_NAME, (char*)atts[i]) == 0) { + if (strcmp(LIBRARY_NAME, reinterpret_cast(atts[i])) == 0) { i++; - libraryName = (char*)atts[i]; + libraryName = reinterpret_cast(atts[i]); if (libraryName == NULL || strcmp(libraryName, "") == 0) { std::string s = "XML:The attribute of the tag " @@ -1421,16 +1481,17 @@ void CacheXmlParser::startPartitionResolver(const xmlChar** atts) { "default value will be set"; throw CacheXmlException(s.c_str()); } - } else if (strcmp(LIBRARY_FUNCTION_NAME, (char*)atts[i]) == 0) { + } else if (strcmp(LIBRARY_FUNCTION_NAME, + reinterpret_cast(atts[i])) == 0) { i++; - libraryFunctionName = (char*)atts[i]; + libraryFunctionName = reinterpret_cast(atts[i]); if (libraryFunctionName == NULL || strcmp(libraryFunctionName, "") == 0) { std::string s = "XML:Value for needs to be provided"; throw CacheXmlException(s.c_str()); } } else { - char* name = (char*)atts[i]; + const char* name = reinterpret_cast(atts[i]); std::string temp(name); std::string s = "XML:Incorrect attribute name specified in : " + @@ -1462,8 +1523,8 @@ void CacheXmlParser::startPartitionResolver(const xmlChar** atts) { } void CacheXmlParser::startCacheWriter(const xmlChar** atts) { - char* libraryName = NULL; - char* libraryFunctionName = NULL; + const char* libraryName = NULL; + const char* libraryFunctionName = NULL; int attrsCount = 0; if (!atts) { std::string s = "XML:No attributes provided for "; @@ -1477,9 +1538,9 @@ void CacheXmlParser::startCacheWriter(const xmlChar** atts) { } for (int i = 0; (atts[i] != NULL); i++) { - if (strcmp(LIBRARY_NAME, (char*)atts[i]) == 0) { + if (strcmp(LIBRARY_NAME, reinterpret_cast(atts[i])) == 0) { i++; - libraryName = (char*)atts[i]; + libraryName = reinterpret_cast(atts[i]); if (libraryName == NULL || strcmp(libraryName, "") == 0) { std::string s = "XML:The attribute of cannot be set " @@ -1488,16 +1549,17 @@ void CacheXmlParser::startCacheWriter(const xmlChar** atts) { "will be set"; throw CacheXmlException(s.c_str()); } - } else if (strcmp(LIBRARY_FUNCTION_NAME, (char*)atts[i]) == 0) { + } else if (strcmp(LIBRARY_FUNCTION_NAME, + reinterpret_cast(atts[i])) == 0) { i++; - libraryFunctionName = (char*)atts[i]; + libraryFunctionName = reinterpret_cast(atts[i]); if (libraryFunctionName == NULL || strcmp(libraryFunctionName, "") == 0) { std::string s = "XML:Value for the needs to be provided"; throw CacheXmlException(s.c_str()); } } else { - char* name = (char*)atts[i]; + const char* name = reinterpret_cast(atts[i]); std::string temp(name); std::string s = "XML:Incorrect attribute name specified in : " + temp; http://git-wip-us.apache.org/repos/asf/geode-native/blob/d4e0a844/src/cppcache/src/CacheableDate.cpp ---------------------------------------------------------------------- diff --git a/src/cppcache/src/CacheableDate.cpp b/src/cppcache/src/CacheableDate.cpp index cbddfbc..ca2369d 100644 --- a/src/cppcache/src/CacheableDate.cpp +++ b/src/cppcache/src/CacheableDate.cpp @@ -23,6 +23,7 @@ #include #include +#include #include #include @@ -113,9 +114,9 @@ CacheableStringPtr CacheableDate::toString() const { struct tm date = {0}; time_t sec = m_timevalue / 1000; ACE_OS::localtime_r(&sec, &date); - ACE_OS::snprintf(buffer, 24, "%d/%d/%d %d:%d:%d", date.tm_mon + 1, - date.tm_mday, date.tm_year + 1900, date.tm_hour, date.tm_min, - date.tm_sec); + std::snprintf(buffer, 24, "%d/%d/%d %d:%d:%d", date.tm_mon + 1, + date.tm_mday, date.tm_year + 1900, date.tm_hour, date.tm_min, + date.tm_sec); return CacheableString::create(buffer); } @@ -123,9 +124,9 @@ int32_t CacheableDate::logString(char* buffer, int32_t maxLength) const { struct tm date = {0}; time_t sec = m_timevalue / 1000; ACE_OS::localtime_r(&sec, &date); - return ACE_OS::snprintf(buffer, maxLength, - "CacheableDate (mm/dd/yyyy) ( %d/%d/%d )", - date.tm_mon + 1, date.tm_mday, date.tm_year + 1900); + return std::snprintf(buffer, maxLength, + "CacheableDate (mm/dd/yyyy) ( %d/%d/%d )", + date.tm_mon + 1, date.tm_mday, date.tm_year + 1900); } } // namespace client http://git-wip-us.apache.org/repos/asf/geode-native/blob/d4e0a844/src/cppcache/src/CacheableKey.cpp ---------------------------------------------------------------------- diff --git a/src/cppcache/src/CacheableKey.cpp b/src/cppcache/src/CacheableKey.cpp index 065aea2..660127d 100644 --- a/src/cppcache/src/CacheableKey.cpp +++ b/src/cppcache/src/CacheableKey.cpp @@ -19,7 +19,7 @@ #include -#include +#include #include namespace apache { @@ -27,8 +27,8 @@ namespace geode { namespace client { int32_t CacheableKey::logString(char* buffer, int32_t maxLength) const { - return ACE_OS::snprintf(buffer, maxLength, "%s( @0x%08lX )", - typeid(*this).name(), (unsigned long)this); + return std::snprintf(buffer, maxLength, "%s( @0x%08lX )", + typeid(*this).name(), (unsigned long)this); } } // namespace client } // namespace geode http://git-wip-us.apache.org/repos/asf/geode-native/blob/d4e0a844/src/cppcache/src/CacheableString.cpp ---------------------------------------------------------------------- diff --git a/src/cppcache/src/CacheableString.cpp b/src/cppcache/src/CacheableString.cpp index 50d638d..875af4a 100644 --- a/src/cppcache/src/CacheableString.cpp +++ b/src/cppcache/src/CacheableString.cpp @@ -23,8 +23,6 @@ #include #include -#include -#include using namespace apache::geode::client; @@ -299,12 +297,12 @@ CacheableString::~CacheableString() { int32_t CacheableString::logString(char* buffer, int32_t maxLength) const { if (isCString()) { - return ACE_OS::snprintf( + return std::snprintf( buffer, maxLength, "%s( %s )", className(), (m_str != NULL ? reinterpret_cast(m_str) : "null")); } else { GF_DEV_ASSERT(isWideString()); - int32_t numChars = ACE_OS::snprintf(buffer, maxLength, "%s( ", className()); + int32_t numChars = std::snprintf(buffer, maxLength, "%s( ", className()); if (numChars >= (int)maxLength || numChars <= 0) { return numChars; } @@ -318,7 +316,7 @@ int32_t CacheableString::logString(char* buffer, int32_t maxLength) const { } buffer += numChars; maxLength -= numChars; - numChars = ACE_OS::snprintf(buffer, maxLength, " )"); + numChars = std::snprintf(buffer, maxLength, " )"); return numChars + static_cast(buffer - bufStart); } } http://git-wip-us.apache.org/repos/asf/geode-native/blob/d4e0a844/src/cppcache/src/ClientProxyMembershipID.cpp ---------------------------------------------------------------------- diff --git a/src/cppcache/src/ClientProxyMembershipID.cpp b/src/cppcache/src/ClientProxyMembershipID.cpp index 2e546d3..407c1f6 100644 --- a/src/cppcache/src/ClientProxyMembershipID.cpp +++ b/src/cppcache/src/ClientProxyMembershipID.cpp @@ -89,7 +89,7 @@ void ClientProxyMembershipID::init(const std::string& dsName) { randString[RAND_STRING_LEN] = '\0'; } char ps[15] = {0}; - ACE_OS::snprintf(ps, 15, "%d", pid); + std::snprintf(ps, 15, "%d", pid); g_randString = "GFNative_"; g_randString.append(randString).append(ps); LOGINFO("Using %s as random data for ClientProxyMembershipID", @@ -217,13 +217,12 @@ void ClientProxyMembershipID::initObjectVars( * callers must be careful not to overflow the actual space of the * destination. * Use snprintf() instead, or correct precision specifiers. - * Fix : using ACE_OS::snprintf */ char PID[15] = {0}; char Synch_Counter[15] = {0}; - // ACE_OS::snprintf(PID, 15, "%d",vPID); + // std::snprintf(PID, 15, "%d",vPID); ACE_OS::itoa(vPID, PID, 10); - // ACE_OS::snprintf(Synch_Counter, 15, "%d",synch_counter); + // std::snprintf(Synch_Counter, 15, "%d",synch_counter); ACE_OS::itoa(synch_counter, Synch_Counter, 10); clientID.append(hostname); clientID.append("("); @@ -239,7 +238,7 @@ void ClientProxyMembershipID::initObjectVars( // int offset = 0; for (uint32_t i = 0; i < getHostAddrLen(); i++) { char hostInfo[16] = {0}; - // offset += ACE_OS::snprintf(hostInfo + offset , 255 - offset, ":%x", + // offset += std::snprintf(hostInfo + offset , 255 - offset, ":%x", // m_hostAddr[i]); ACE_OS::itoa(m_hostAddr[i], hostInfo, 16); m_hashKey.append(":"); @@ -248,7 +247,7 @@ void ClientProxyMembershipID::initObjectVars( m_hashKey.append(":"); char hostInfoPort[16] = {0}; ACE_OS::itoa(getHostPort(), hostInfoPort, 10); - // offset += ACE_OS::snprintf(hostInfo + offset, 255 - offset , ":%d", + // offset += std::snprintf(hostInfo + offset, 255 - offset , ":%d", // getHostPort()); m_hashKey.append(hostInfoPort); m_hashKey.append(":"); @@ -260,7 +259,7 @@ void ClientProxyMembershipID::initObjectVars( m_hashKey.append(":"); char viewid[16] = {0}; ACE_OS::itoa(m_vmViewId, viewid, 10); - // offset += ACE_OS::snprintf(hostInfo + offset , 255 - offset , ":%d", + // offset += std::snprintf(hostInfo + offset , 255 - offset , ":%d", // m_vmViewId); m_hashKey.append(viewid); } @@ -318,7 +317,7 @@ void ClientProxyMembershipID::getClientProxyMembershipID() { // DSMemberId = DSMemberId.append(host); // DSMemberId= DSMemberId.append("("); m_dsmemID.write(static_cast('(')); - int lenPid = ACE_OS::snprintf(buf, 50, "%d", pid); + int lenPid = std::snprintf(buf, 50, "%d", pid); // DSMemberId.append(buf); // m_dsmemID.writeInt((int32_t)pid); m_dsmemID.writeBytesOnly(reinterpret_cast(buf), lenPid); @@ -336,7 +335,7 @@ void ClientProxyMembershipID::getClientProxyMembershipID() { m_dsmemID.writeBytesOnly(reinterpret_cast(hexBuf), 8); m_dsmemID.write(static_cast(':')); // DSMemberId = DSMemberId.append(":"); - ACE_OS::snprintf(dsName, 50, "%s", dsPtr->getName()); + std::snprintf(dsName, 50, "%s", dsPtr->getName()); // DSMemberId.append(dsName); uint32_t dsLen = static_cast(strlen(dsName)); m_dsmemID.writeBytesOnly(reinterpret_cast(dsName), dsLen); http://git-wip-us.apache.org/repos/asf/geode-native/blob/d4e0a844/src/cppcache/src/ClientProxyMembershipID.hpp ---------------------------------------------------------------------- diff --git a/src/cppcache/src/ClientProxyMembershipID.hpp b/src/cppcache/src/ClientProxyMembershipID.hpp index 8856b2c..ab3214d 100644 --- a/src/cppcache/src/ClientProxyMembershipID.hpp +++ b/src/cppcache/src/ClientProxyMembershipID.hpp @@ -25,7 +25,6 @@ #include #include "GeodeTypeIdsImpl.hpp" #include "DSMemberForVersionStamp.hpp" -#include #include namespace apache { @@ -92,8 +91,8 @@ class ClientProxyMembershipID : public DSMemberForVersionStamp { char hostInfo[255] = {0}; uint32_t offset = 0; for (uint32_t i = 0; i < getHostAddrLen(); i++) { - offset += ACE_OS::snprintf(hostInfo + offset, 255 - offset, ":%x", - m_hostAddr[i]); + offset += std::snprintf(hostInfo + offset, 255 - offset, ":%x", + m_hostAddr[i]); } CacheableStringPtr tempHashCode = CacheableString::create(hostInfo, offset); result = result + tempHashCode->hashcode(); http://git-wip-us.apache.org/repos/asf/geode-native/blob/d4e0a844/src/cppcache/src/CqEventImpl.cpp ---------------------------------------------------------------------- diff --git a/src/cppcache/src/CqEventImpl.cpp b/src/cppcache/src/CqEventImpl.cpp index 6f796db..d583fdf 100644 --- a/src/cppcache/src/CqEventImpl.cpp +++ b/src/cppcache/src/CqEventImpl.cpp @@ -90,7 +90,7 @@ bool CqEventImpl::getError() { return m_error; } std::string CqEventImpl::toString() { char buffer[1024]; - ACE_OS::snprintf( + std::snprintf( buffer, 1024, "CqEvent CqName=%s; base operation=%d; cq operation= %d;key=%s;value=%s", m_cQuery->getName(), m_baseOp, m_queryOp, m_key->toString()->asChar(), http://git-wip-us.apache.org/repos/asf/geode-native/blob/d4e0a844/src/cppcache/src/DiffieHellman.cpp ---------------------------------------------------------------------- diff --git a/src/cppcache/src/DiffieHellman.cpp b/src/cppcache/src/DiffieHellman.cpp index e58d286..9f30df8 100644 --- a/src/cppcache/src/DiffieHellman.cpp +++ b/src/cppcache/src/DiffieHellman.cpp @@ -44,8 +44,8 @@ void* DiffieHellman::getOpenSSLFuncPtr(const char* function_name) { void* func = m_dll.symbol(function_name); if (func == NULL) { char msg[1000]; - ACE_OS::snprintf(msg, 1000, "cannot find function %s in library %s", - function_name, "cryptoImpl"); + std::snprintf(msg, 1000, "cannot find function %s in library %s", + function_name, "cryptoImpl"); LOGERROR(msg); throw IllegalStateException(msg); } @@ -61,7 +61,7 @@ void DiffieHellman::initOpenSSLFuncPtrs() { if (m_dll.open(libName, ACE_DEFAULT_SHLIB_MODE, 0) == -1) { char msg[1000]; - ACE_OS::snprintf(msg, 1000, "cannot open library: %s", libName); + std::snprintf(msg, 1000, "cannot open library: %s", libName); LOGERROR(msg); throw FileNotFoundException(msg); } @@ -99,13 +99,13 @@ void DiffieHellman::initDhKeys(const PropertiesPtr& props) { if (error == DH_ERR_UNSUPPORTED_ALGO) { // Unsupported Algorithm char msg[64] = {'\0'}; - ACE_OS::snprintf(msg, 64, "Algorithm %s is not supported.", - dhAlgo->asChar()); + std::snprintf(msg, 64, "Algorithm %s is not supported.", + dhAlgo->asChar()); throw IllegalArgumentException(msg); } else if (error == DH_ERR_ILLEGAL_KEYSIZE) { // Illegal Key size char msg[64] = {'\0'}; - ACE_OS::snprintf(msg, 64, "Illegal key size for algorithm %s.", - dhAlgo->asChar()); + std::snprintf(msg, 64, "Illegal key size for algorithm %s.", + dhAlgo->asChar()); throw IllegalArgumentException(msg); } else if (m_dhCtx == NULL) { throw IllegalStateException( http://git-wip-us.apache.org/repos/asf/geode-native/blob/d4e0a844/src/cppcache/src/DiskStoreId.cpp ---------------------------------------------------------------------- diff --git a/src/cppcache/src/DiskStoreId.cpp b/src/cppcache/src/DiskStoreId.cpp index cf5b2e7..5adfa81 100644 --- a/src/cppcache/src/DiskStoreId.cpp +++ b/src/cppcache/src/DiskStoreId.cpp @@ -16,7 +16,6 @@ */ #include "DiskStoreId.hpp" -#include namespace apache { namespace geode { @@ -32,10 +31,9 @@ std::string DiskStoreId::getHashKey() { * callers must be careful not to overflow the actual space of the * destination. * Use snprintf() instead, or correct precision specifiers. - * Fix : using ACE_OS::snprintf */ - ACE_OS::snprintf(hashCode, 128, "%" PRIx64 "_%" PRIx64, m_mostSig, - m_leastSig); + std::snprintf(hashCode, 128, "%" PRIx64 "_%" PRIx64, m_mostSig, + m_leastSig); m_hashCode.append(hashCode); } return m_hashCode; http://git-wip-us.apache.org/repos/asf/geode-native/blob/d4e0a844/src/cppcache/src/EventId.cpp ---------------------------------------------------------------------- diff --git a/src/cppcache/src/EventId.cpp b/src/cppcache/src/EventId.cpp index d4c9f49..197d2cb 100644 --- a/src/cppcache/src/EventId.cpp +++ b/src/cppcache/src/EventId.cpp @@ -19,9 +19,7 @@ #include "GeodeTypeIdsImpl.hpp" #include "ClientProxyMembershipID.hpp" #include - -#include -#include +#include namespace apache { namespace geode { @@ -134,7 +132,7 @@ int8_t EventId::typeId() const { return GeodeTypeIdsImpl::EventId; } EventId::EventId(char* memId, uint32_t memIdLen, int64_t thr, int64_t seq) { // TODO: statics being assigned; not thread-safe?? - ACE_OS::memcpy(m_eidMem, memId, memIdLen); + std::memcpy(m_eidMem, memId, memIdLen); m_eidMemLen = memIdLen; m_eidThr = thr; m_eidSeq = seq; @@ -180,10 +178,10 @@ EventId::~EventId() {} /** used to render as a string for logging. */ size_t EventId::logString(char* buffer, size_t maxLength) const { - return ACE_OS::snprintf(buffer, maxLength, - "EventId( memID=[binary], thr=%" PRIi64 - ", seq=%" PRIi64 " )", - m_eidThr, m_eidSeq); + return std::snprintf(buffer, maxLength, + "EventId( memID=[binary], thr=%" PRIi64 + ", seq=%" PRIi64 " )", + m_eidThr, m_eidSeq); } } // namespace client } // namespace geode http://git-wip-us.apache.org/repos/asf/geode-native/blob/d4e0a844/src/cppcache/src/Exception.cpp ---------------------------------------------------------------------- diff --git a/src/cppcache/src/Exception.cpp b/src/cppcache/src/Exception.cpp index bffdc47..71a9058 100644 --- a/src/cppcache/src/Exception.cpp +++ b/src/cppcache/src/Exception.cpp @@ -19,13 +19,13 @@ extern "C" { #include #include } -#include #include #include #include #include +#include #include namespace apache { @@ -54,10 +54,10 @@ Exception::Exception(const char* msg1, const char* msg2, bool forceTrace, char* msg; GF_NEW(msg, char[len + 1]); if (msg1) { - ACE_OS::memcpy(msg, msg1, len1); + std::memcpy(msg, msg1, len1); } if (msg2) { - ACE_OS::memcpy(msg + len1, msg2, len2); + std::memcpy(msg + len1, msg2, len2); } msg[len] = '\0'; @@ -107,7 +107,7 @@ size_t Exception::getStackTrace(char* buffer, size_t maxLength) const { traceString += "Cause by exception: "; m_cause->m_stack->getString(traceString); } - len = ACE_OS::snprintf(buffer, maxLength, "%s", traceString.c_str()); + len = std::snprintf(buffer, maxLength, "%s", traceString.c_str()); } return len; } http://git-wip-us.apache.org/repos/asf/geode-native/blob/d4e0a844/src/cppcache/src/ExceptionTypes.cpp ---------------------------------------------------------------------- diff --git a/src/cppcache/src/ExceptionTypes.cpp b/src/cppcache/src/ExceptionTypes.cpp index ea03c72..1d76e58 100644 --- a/src/cppcache/src/ExceptionTypes.cpp +++ b/src/cppcache/src/ExceptionTypes.cpp @@ -329,7 +329,7 @@ void GfErrTypeThrowException(const char* str, GfErrType err) { char buf[64]; LOGINFO("error code: %d", err); if (exMsg == NULL) { - ACE_OS::snprintf(buf, 64, "Unknown error code[0x%X]", err); + std::snprintf(buf, 64, "Unknown error code[0x%X]", err); exMsg = buf; } UnknownException ex(str, exMsg); http://git-wip-us.apache.org/repos/asf/geode-native/blob/d4e0a844/src/cppcache/src/Log.cpp ---------------------------------------------------------------------- diff --git a/src/cppcache/src/Log.cpp b/src/cppcache/src/Log.cpp index 972452a..205c742 100644 --- a/src/cppcache/src/Log.cpp +++ b/src/cppcache/src/Log.cpp @@ -18,6 +18,9 @@ #include #include +#include +#include +#include #include #include #include @@ -110,7 +113,7 @@ static int selector(const dirent* d) { size_t fileHyphenPos = tempname.find_last_of('-'); if (fileHyphenPos != std::string::npos) { std::string buff1 = tempname.substr(0, fileHyphenPos); - if (ACE_OS::strstr(filebasename.c_str(), buff1.c_str()) == 0) { + if (std::strstr(filebasename.c_str(), buff1.c_str()) == 0) { return 0; } if (fileHyphenPos != actualHyphenPos) return 0; @@ -138,7 +141,7 @@ static int comparator(const dirent** d1, const dirent** d2) { return 1; } - int diff = ACE_OS::strcmp((*d1)->d_name, (*d2)->d_name); + int diff = std::strcmp((*d1)->d_name, (*d2)->d_name); if (diff < 0) { return -1; } else if (diff > 0) { @@ -186,7 +189,7 @@ const char* Log::logFileName() { throw IllegalStateException( ("Log file name is too long: " + *g_logFile).c_str()); } - ACE_OS::strncpy(g_logFileNameBuffer, g_logFile->c_str(), + std::strncpy(g_logFileNameBuffer, g_logFile->c_str(), sizeof(g_logFileNameBuffer)); } @@ -230,7 +233,7 @@ void Log::init(LogLevel level, const char* logFileName, int32 logFileLimit, // replace all '\' with '/' to make everything easier.. size_t length = g_logFile->length() + 1; char* slashtmp = new char[length]; - ACE_OS::strncpy(slashtmp, g_logFile->c_str(), length); + std::strncpy(slashtmp, g_logFile->c_str(), length); for (size_t i = 0; i < g_logFile->length(); i++) { if (slashtmp[i] == '/') { slashtmp[i] = '\\'; @@ -319,7 +322,7 @@ void Log::init(LogLevel level, const char* logFileName, int32 logFileLimit, if (fileHyphenPos != std::string::npos) { std::string buff = tempname.substr(fileHyphenPos + 1, tempname.length()); - g_rollIndex = ACE_OS::atoi(buff.c_str()) + 1; + g_rollIndex = std::atoi(buff.c_str()) + 1; } } // if loop } // for loop @@ -354,7 +357,6 @@ void Log::init(LogLevel level, const char* logFileName, int32 logFileLimit, * callers must be careful not to overflow the actual space of the * destination. * Use snprintf() instead, or correct precision specifiers. - * Fix : using ACE_OS::snprintf */ char rollFile[1024] = {0}; std::string logsdirname; @@ -382,18 +384,18 @@ void Log::init(LogLevel level, const char* logFileName, int32 logFileLimit, fnameBeforeExt = logsbasename.substr(0, posOfExt); extName = logsbasename.substr(posOfExt + 1, baselen); } - ACE_OS::snprintf(rollFile, 1024, "%s%c%s-%d.%s", logsdirname.c_str(), - ACE_DIRECTORY_SEPARATOR_CHAR, fnameBeforeExt.c_str(), - g_rollIndex++, extName.c_str()); + std::snprintf(rollFile, 1024, "%s%c%s-%d.%s", logsdirname.c_str(), + ACE_DIRECTORY_SEPARATOR_CHAR, fnameBeforeExt.c_str(), + g_rollIndex++, extName.c_str()); bool rollFileNameGot = false; while (!rollFileNameGot) { FILE* checkFile = fopen(rollFile, "r"); if (checkFile != NULL) { fclose(checkFile); checkFile = NULL; - ACE_OS::snprintf(rollFile, 1024, "%s%c%s-%d.%s", logsdirname.c_str(), - ACE_DIRECTORY_SEPARATOR_CHAR, fnameBeforeExt.c_str(), - g_rollIndex++, extName.c_str()); + std::snprintf(rollFile, 1024, "%s%c%s-%d.%s", logsdirname.c_str(), + ACE_DIRECTORY_SEPARATOR_CHAR, fnameBeforeExt.c_str(), + g_rollIndex++, extName.c_str()); } else { rollFileNameGot = true; } @@ -562,7 +564,7 @@ const char* Log::levelToChars(Log::LogLevel level) { default: { char buf[64] = {0}; - ACE_OS::snprintf(buf, 64, "Unexpected log level: %d", level); + std::snprintf(buf, 64, "Unexpected log level: %d", level); throw IllegalArgumentException(buf); } } @@ -614,14 +616,14 @@ char* Log::formatLogLine(char* buf, Log::LogLevel level) { time_t secs = clock.sec(); struct tm* tm_val = ACE_OS::localtime(&secs); char* pbuf = buf; - pbuf += ACE_OS::snprintf(pbuf, 15, "[%s ", Log::levelToChars(level)); - pbuf += ACE_OS::strftime(pbuf, MINBUFSIZE, "%Y/%m/%d %H:%M:%S", tm_val); + pbuf += std::snprintf(pbuf, 15, "[%s ", Log::levelToChars(level)); + pbuf += std::strftime(pbuf, MINBUFSIZE, "%Y/%m/%d %H:%M:%S", tm_val); pbuf += - ACE_OS::snprintf(pbuf, 15, ".%06ld ", static_cast(clock.usec())); - pbuf += ACE_OS::strftime(pbuf, MINBUFSIZE, "%Z ", tm_val); + std::snprintf(pbuf, 15, ".%06ld ", static_cast(clock.usec())); + pbuf += std::strftime(pbuf, MINBUFSIZE, "%Z ", tm_val); - ACE_OS::snprintf(pbuf, 300, "%s:%d %lu] ", g_uname.nodename, g_pid, - (unsigned long)ACE_OS::thr_self()); + std::snprintf(pbuf, 300, "%s:%d %lu] ", g_uname.nodename, g_pid, + (unsigned long)ACE_OS::thr_self()); return buf; } @@ -660,7 +662,7 @@ void Log::put(LogLevel level, const char* msg) { formatLogLine(buf, level); size_t numChars = - static_cast(ACE_OS::strlen(buf) + ACE_OS::strlen(msg)); + static_cast(std::strlen(buf) + std::strlen(msg)); g_bytesWritten += numChars + 2; // bcoz we have to count trailing new line (\n) @@ -691,17 +693,17 @@ void Log::put(LogLevel level, const char* msg) { fnameBeforeExt = logsbasename.substr(0, posOfExt); extName = logsbasename.substr(posOfExt + 1, baselen); } - ACE_OS::snprintf(rollFile, 1024, "%s%c%s-%d.%s", logsdirname.c_str(), - ACE_DIRECTORY_SEPARATOR_CHAR, fnameBeforeExt.c_str(), - g_rollIndex++, extName.c_str()); + std::snprintf(rollFile, 1024, "%s%c%s-%d.%s", logsdirname.c_str(), + ACE_DIRECTORY_SEPARATOR_CHAR, fnameBeforeExt.c_str(), + g_rollIndex++, extName.c_str()); bool rollFileNameGot = false; while (!rollFileNameGot) { FILE* fp1 = fopen(rollFile, "r"); if (fp1 != NULL) { fclose(fp1); - ACE_OS::snprintf(rollFile, 1024, "%s%c%s-%d.%s", logsdirname.c_str(), - ACE_DIRECTORY_SEPARATOR_CHAR, fnameBeforeExt.c_str(), - g_rollIndex++, extName.c_str()); + std::snprintf(rollFile, 1024, "%s%c%s-%d.%s", logsdirname.c_str(), + ACE_DIRECTORY_SEPARATOR_CHAR, fnameBeforeExt.c_str(), + g_rollIndex++, extName.c_str()); } else { rollFileNameGot = true; } @@ -736,7 +738,7 @@ void Log::put(LogLevel level, const char* msg) { g_spaceUsed = 0; ACE_stat statBuf = {0}; /*for(int i = 1; i < entries_count; i++) { - ACE_OS::snprintf(fullpath , 512 , + std::snprintf(fullpath , 512 , "%s%c%s",dirname.c_str(),ACE_DIRECTORY_SEPARATOR_CHAR,resultArray[i]->d_name); ACE_OS::stat(fullpath,&statBuf); g_fileInfoPair = std::make_pair(fullpath,statBuf.st_size); @@ -756,8 +758,8 @@ void Log::put(LogLevel level, const char* msg) { int status = sds.open(dirname.c_str(), selector, comparator); if (status != -1) { for (int index = 1; index < sds.length(); ++index) { - ACE_OS::snprintf(fullpath, 512, "%s%c%s", dirname.c_str(), - ACE_DIRECTORY_SEPARATOR_CHAR, sds[index]->d_name); + std::snprintf(fullpath, 512, "%s%c%s", dirname.c_str(), + ACE_DIRECTORY_SEPARATOR_CHAR, sds[index]->d_name); ACE_OS::stat(fullpath, &statBuf); g_fileInfoPair = std::make_pair(fullpath, statBuf.st_size); fileInfo.push_back(g_fileInfoPair); @@ -774,8 +776,8 @@ void Log::put(LogLevel level, const char* msg) { g_spaceUsed -= fileSize; } else { char printmsg[256]; - ACE_OS::snprintf(printmsg, 256, "%s\t%s\n", "Could not delete", - fileInfo[fileIndex].first.c_str()); + std::snprintf(printmsg, 256, "%s\t%s\n", "Could not delete", + fileInfo[fileIndex].first.c_str()); int numChars = fprintf(g_log, "%s%s\n", formatLogLine(buf, level), printmsg); g_bytesWritten += @@ -808,13 +810,13 @@ void Log::put(LogLevel level, const char* msg) { void Log::putThrow(LogLevel level, const char* msg, const Exception& ex) { char buf[128] = {0}; - ACE_OS::snprintf(buf, 128, "Geode exception %s thrown: ", ex.getName()); + std::snprintf(buf, 128, "Geode exception %s thrown: ", ex.getName()); put(level, (std::string(buf) + ex.getMessage() + "\n" + msg).c_str()); } void Log::putCatch(LogLevel level, const char* msg, const Exception& ex) { char buf[128] = {0}; - ACE_OS::snprintf(buf, 128, "Geode exception %s caught: ", ex.getName()); + std::snprintf(buf, 128, "Geode exception %s caught: ", ex.getName()); put(level, (std::string(buf) + ex.getMessage() + "\n" + msg).c_str()); } @@ -825,7 +827,7 @@ void Log::enterFn(LogLevel level, const char* functionName) { fn = fn.substr(fn.size() - MAX_NAME_LENGTH, MAX_NAME_LENGTH); } char buf[MAX_NAME_LENGTH + 512] = {0}; - ACE_OS::snprintf(buf, 1536, "{{{===>>> Entering function %s", fn.c_str()); + std::snprintf(buf, 1536, "{{{===>>> Entering function %s", fn.c_str()); put(level, buf); } @@ -836,7 +838,7 @@ void Log::exitFn(LogLevel level, const char* functionName) { fn = fn.substr(fn.size() - MAX_NAME_LENGTH, MAX_NAME_LENGTH); } char buf[MAX_NAME_LENGTH + 512] = {0}; - ACE_OS::snprintf(buf, 1536, "<<<===}}} Exiting function %s", fn.c_str()); + std::snprintf(buf, 1536, "<<<===}}} Exiting function %s", fn.c_str()); put(level, buf); } http://git-wip-us.apache.org/repos/asf/geode-native/blob/d4e0a844/src/cppcache/src/PdxFieldType.cpp ---------------------------------------------------------------------- diff --git a/src/cppcache/src/PdxFieldType.cpp b/src/cppcache/src/PdxFieldType.cpp index 04b5ae1..fb1f815 100644 --- a/src/cppcache/src/PdxFieldType.cpp +++ b/src/cppcache/src/PdxFieldType.cpp @@ -27,8 +27,6 @@ #include //#include -#include "ace/OS.h" - namespace apache { namespace geode { namespace client { @@ -155,9 +153,8 @@ CacheableStringPtr PdxFieldType::toString() const { * callers must be careful not to overflow the actual space of the * destination. * Use snprintf() instead, or correct precision specifiers. - * Fix : using ACE_OS::snprintf */ - ACE_OS::snprintf( + std::snprintf( stringBuf, 1024, " PdxFieldName=%s TypeId=%d VarLenFieldIdx=%d sequenceid=%d\n", this->m_fieldName.c_str(), this->m_typeId, this->m_varLenFieldIdx, http://git-wip-us.apache.org/repos/asf/geode-native/blob/d4e0a844/src/cppcache/src/PdxInstanceFactoryImpl.cpp ---------------------------------------------------------------------- diff --git a/src/cppcache/src/PdxInstanceFactoryImpl.cpp b/src/cppcache/src/PdxInstanceFactoryImpl.cpp index 6342ec0..fa0a11f 100644 --- a/src/cppcache/src/PdxInstanceFactoryImpl.cpp +++ b/src/cppcache/src/PdxInstanceFactoryImpl.cpp @@ -18,7 +18,6 @@ #include "PdxType.hpp" #include "PdxTypes.hpp" #include "PdxInstanceImpl.hpp" -#include namespace apache { namespace geode { @@ -394,12 +393,11 @@ void PdxInstanceFactoryImpl::isFieldAdded(const char* fieldName) { * callers must be careful not to overflow the actual space of the * destination. * Use snprintf() instead, or correct precision specifiers. - * Fix : using ACE_OS::snprintf */ - ACE_OS::snprintf(excpStr, 256, - "Field: %s is either already added into " - "PdxInstanceFactory or it is null ", - fieldName); + std::snprintf(excpStr, 256, + "Field: %s is either already added into " + "PdxInstanceFactory or it is null ", + fieldName); throw IllegalStateException(excpStr); } }