geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbarr...@apache.org
Subject [1/3] geode-native git commit: GEODE-2484 Replace ace calls to standard functions
Date Wed, 15 Feb 2017 18:50:27 GMT
Repository: geode-native
Updated Branches:
  refs/heads/develop ad8b5a83b -> d4e0a8447


http://git-wip-us.apache.org/repos/asf/geode-native/blob/d4e0a844/src/cppcache/src/statistics/OsStatisticsImpl.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/statistics/OsStatisticsImpl.cpp b/src/cppcache/src/statistics/OsStatisticsImpl.cpp
index 668ddf3..567052b 100644
--- a/src/cppcache/src/statistics/OsStatisticsImpl.cpp
+++ b/src/cppcache/src/statistics/OsStatisticsImpl.cpp
@@ -19,7 +19,7 @@
 #include "StatisticsTypeImpl.hpp"
 #include "StatisticDescriptorImpl.hpp"
 
-#include "ace/OS.h"
+#include <cstring>
 
 using namespace apache::geode::statistics;
 
@@ -44,7 +44,7 @@ int64 OsStatisticsImpl::calcNumericId(StatisticsFactory* system,
 
 const char* OsStatisticsImpl::calcTextId(StatisticsFactory* system,
                                          const char* userValue) {
-  if (userValue != NULL && strcmp(userValue, "") != 0) {
+  if (userValue != NULL && std::strcmp(userValue, "") != 0) {
     return userValue;
   } else {
     if (system != NULL) {
@@ -159,7 +159,7 @@ void OsStatisticsImpl::close() {
 void OsStatisticsImpl::_setInt(int32 offset, int32 value) {
   if (offset >= statsType->getIntStatCount()) {
     char s[128] = {'\0'};
-    ACE_OS::snprintf(
+    std::snprintf(
         s, 128, "setInt:The id (%d) of the Statistic Descriptor is not valid ",
         offset);
     throw IllegalArgumentException(s);
@@ -177,12 +177,10 @@ void OsStatisticsImpl::_setLong(int32 offset, int64 value) {
      * arbitrarily long string,
      * 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
      */
     // sprintf(s, "setLong:The id (%d) of the Statistic Descriptor is not valid
     // ", offset);
-    ACE_OS::snprintf(
+    std::snprintf(
         s, 128, "setLong:The id (%d) of the Statistic Descriptor is not valid ",
         offset);
     throw IllegalArgumentException(s);
@@ -193,7 +191,7 @@ void OsStatisticsImpl::_setLong(int32 offset, int64 value) {
 void OsStatisticsImpl::_setDouble(int32 offset, double value) {
   if (offset >= statsType->getDoubleStatCount()) {
     char s[128] = {'\0'};
-    ACE_OS::snprintf(
+    std::snprintf(
         s, 128,
         "setDouble:The id (%d) of the Statistic Descriptor is not valid ",
         offset);
@@ -207,7 +205,7 @@ void OsStatisticsImpl::_setDouble(int32 offset, double value) {
 int32 OsStatisticsImpl::_getInt(int32 offset) {
   if (offset >= statsType->getIntStatCount()) {
     char s[128] = {'\0'};
-    ACE_OS::snprintf(
+    std::snprintf(
         s, 128, "getInt:The id (%d) of the Statistic Descriptor is not valid ",
         offset);
     throw IllegalArgumentException(s);
@@ -219,7 +217,7 @@ int32 OsStatisticsImpl::_getInt(int32 offset) {
 int64 OsStatisticsImpl::_getLong(int32 offset) {
   if (offset >= statsType->getLongStatCount()) {
     char s[128] = {'\0'};
-    ACE_OS::snprintf(
+    std::snprintf(
         s, 128, "getLong:The id (%d) of the Statistic Descriptor is not valid ",
         offset);
     throw IllegalArgumentException(s);
@@ -231,7 +229,7 @@ int64 OsStatisticsImpl::_getLong(int32 offset) {
 double OsStatisticsImpl::_getDouble(int32 offset) {
   if (offset >= statsType->getDoubleStatCount()) {
     char s[128] = {'\0'};
-    ACE_OS::snprintf(
+    std::snprintf(
         s, 128,
         "getDouble:The id (%d) of the Statistic Descriptor is not valid ",
         offset);
@@ -269,7 +267,7 @@ int64 OsStatisticsImpl::_getRawBits(StatisticDescriptor* statDscp) {
 int32 OsStatisticsImpl::_incInt(int32 offset, int32 delta) {
   if (offset >= statsType->getIntStatCount()) {
     char s[128] = {'\0'};
-    ACE_OS::snprintf(
+    std::snprintf(
         s, 128, "incInt:The id (%d) of the Statistic Descriptor is not valid ",
         offset);
     throw IllegalArgumentException(s);
@@ -289,13 +287,11 @@ int64 OsStatisticsImpl::_incLong(int32 offset, int64 delta) {
      * arbitrarily long string,
      * 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
      */
     // sprintf(s, "incLong:The id (%d) of the Statistic Descriptor is not valid
     // ", offset);
 
-    ACE_OS::snprintf(
+    std::snprintf(
         s, 128, "incLong:The id (%d) of the Statistic Descriptor is not valid ",
         offset);
     throw IllegalArgumentException(s);
@@ -307,7 +303,7 @@ int64 OsStatisticsImpl::_incLong(int32 offset, int64 delta) {
 double OsStatisticsImpl::_incDouble(int32 offset, double delta) {
   if (offset >= statsType->getDoubleStatCount()) {
     char s[128] = {'\0'};
-    ACE_OS::snprintf(
+    std::snprintf(
         s, 128,
         "incDouble:The id (%d) of the Statistic Descriptor is not valid ",
         offset);

http://git-wip-us.apache.org/repos/asf/geode-native/blob/d4e0a844/src/cppcache/src/statistics/StatisticDescriptorImpl.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/statistics/StatisticDescriptorImpl.cpp b/src/cppcache/src/statistics/StatisticDescriptorImpl.cpp
index bf01763..e08736e 100644
--- a/src/cppcache/src/statistics/StatisticDescriptorImpl.cpp
+++ b/src/cppcache/src/statistics/StatisticDescriptorImpl.cpp
@@ -17,7 +17,7 @@
 
 #include "StatisticDescriptorImpl.hpp"
 
-#include <ace/OS.h>
+#include <cstring>
 
 using namespace apache::geode::statistics;
 
@@ -45,12 +45,12 @@ StatisticDescriptorImpl::StatisticDescriptorImpl(const char* statName,
                                                  int8 statIsStatLargerBetter) {
   name = statName;
   descriptorType = statDescriptorType;
-  if (strcmp(statDescription, "") == 0) {
+  if (std::strcmp(statDescription, "") == 0) {
     description = "";
   } else {
     description = statDescription;
   }
-  if (strcmp(statUnit, "") == 0) {
+  if (std::strcmp(statUnit, "") == 0) {
     unit = "";
   } else {
     unit = statUnit;
@@ -167,7 +167,7 @@ const char* StatisticDescriptorImpl::getTypeCodeName(FieldType code) throw(
       return DoubleTypeName;
     default: {
       char buf[20];
-      ACE_OS::snprintf(buf, 20, "%d", code);
+      std::snprintf(buf, 20, "%d", code);
       std::string temp(buf);
       std::string s = "Unknown type code:" + temp;
       throw IllegalArgumentException(s.c_str());

http://git-wip-us.apache.org/repos/asf/geode-native/blob/d4e0a844/src/cppcache/src/statistics/StatisticsTypeImpl.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/statistics/StatisticsTypeImpl.cpp b/src/cppcache/src/statistics/StatisticsTypeImpl.cpp
index e1bea61..50df5ca 100644
--- a/src/cppcache/src/statistics/StatisticsTypeImpl.cpp
+++ b/src/cppcache/src/statistics/StatisticsTypeImpl.cpp
@@ -18,7 +18,7 @@
 #include "StatisticsTypeImpl.hpp"
 #include "StatisticDescriptorImpl.hpp"
 #include <string>
-#include <ace/OS.h>
+#include <cstring>
 using namespace apache::geode::statistics;
 
 /**
@@ -61,11 +61,11 @@ StatisticsTypeImpl::StatisticsTypeImpl(const char* nameArg,
   }
   if (statsLengthArg > MAX_DESCRIPTORS_PER_TYPE) {
     char buffer[100];
-    ACE_OS::snprintf(buffer, 100, "%d", statsLengthArg);
+    std::snprintf(buffer, 100, "%d", statsLengthArg);
     std::string temp(buffer);
     std::string s = "The requested descriptor count " + temp +
                     " exceeds the maximum which is ";
-    ACE_OS::snprintf(buffer, 100, "%d", MAX_DESCRIPTORS_PER_TYPE);
+    std::snprintf(buffer, 100, "%d", MAX_DESCRIPTORS_PER_TYPE);
     std::string buf(buffer);
     s += buf + ".";
     throw IllegalArgumentException(s.c_str());


Mime
View raw message