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 2017/06/06 17:56:34 UTC
[08/23] geode-native git commit: GEODE-2741: Code cleanup to move to
std::shared_ptr
http://git-wip-us.apache.org/repos/asf/geode-native/blob/11467dd9/src/cppcache/src/PdxLocalReader.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/PdxLocalReader.cpp b/src/cppcache/src/PdxLocalReader.cpp
index 6290272..425f629 100644
--- a/src/cppcache/src/PdxLocalReader.cpp
+++ b/src/cppcache/src/PdxLocalReader.cpp
@@ -15,10 +15,10 @@
* limitations under the License.
*/
/*
-* PdxLocalReader.cpp
-* Created on: Nov 3, 2011
-* Author: npatel
-*/
+ * PdxLocalReader.cpp
+ * Created on: Nov 3, 2011
+ * Author: npatel
+ */
#include "PdxLocalReader.hpp"
#include "PdxTypeRegistry.hpp"
@@ -28,16 +28,16 @@ namespace geode {
namespace client {
PdxLocalReader::PdxLocalReader()
- : m_dataInput(NULL),
- m_startBuffer(NULL),
+ : m_dataInput(nullptr),
+ m_startBuffer(nullptr),
m_startPosition(0),
m_serializedLength(0),
m_serializedLengthWithOffsets(0),
m_offsetSize(0),
- m_offsetsBuffer(NULL),
+ m_offsetsBuffer(nullptr),
m_isDataNeedToPreserve(false),
- m_localToRemoteMap(NULL),
- m_remoteToLocalMap(NULL),
+ m_localToRemoteMap(nullptr),
+ m_remoteToLocalMap(nullptr),
m_remoteToLocalMapSize(0) {}
PdxLocalReader::PdxLocalReader(DataInput& input, PdxTypePtr remoteType,
@@ -92,7 +92,7 @@ void PdxLocalReader::MoveStream() {
}
void PdxLocalReader::checkEmptyFieldName(const char* fieldName) {
- if (fieldName == NULL) {
+ if (fieldName == nullptr) {
throw IllegalStateException("Field name is null");
}
}
@@ -190,7 +190,7 @@ char* PdxLocalReader::readCharArray(const char* fieldName,
// Length to user for
// all primitive arrays
checkEmptyFieldName(fieldName);
- char* charArray = NULL;
+ char* charArray = nullptr;
m_dataInput->readCharArray(&charArray, length);
return charArray;
}
@@ -200,20 +200,20 @@ wchar_t* PdxLocalReader::readWideCharArray(
int32_t& length) { // TODO:: need to return Length to user for all
// primitive arrays
checkEmptyFieldName(fieldName);
- wchar_t* charArray = NULL;
+ wchar_t* charArray = nullptr;
m_dataInput->readWideCharArray(&charArray, length);
return charArray;
}
bool* PdxLocalReader::readBooleanArray(const char* fieldName, int32_t& length) {
checkEmptyFieldName(fieldName);
- bool* boolArray = NULL;
+ bool* boolArray = nullptr;
m_dataInput->readBooleanArray(&boolArray, length);
return boolArray;
}
int8_t* PdxLocalReader::readByteArray(const char* fieldName, int32_t& length) {
checkEmptyFieldName(fieldName);
- int8_t* byteArray = NULL;
+ int8_t* byteArray = nullptr;
m_dataInput->readByteArray(&byteArray, length);
return byteArray;
}
@@ -221,28 +221,28 @@ int8_t* PdxLocalReader::readByteArray(const char* fieldName, int32_t& length) {
int16_t* PdxLocalReader::readShortArray(const char* fieldName,
int32_t& length) {
checkEmptyFieldName(fieldName);
- int16_t* shortArray = NULL;
+ int16_t* shortArray = nullptr;
m_dataInput->readShortArray(&shortArray, length);
return shortArray;
}
int32_t* PdxLocalReader::readIntArray(const char* fieldName, int32_t& length) {
checkEmptyFieldName(fieldName);
- int32_t* intArray = NULL;
+ int32_t* intArray = nullptr;
m_dataInput->readIntArray(&intArray, length);
return intArray;
}
int64_t* PdxLocalReader::readLongArray(const char* fieldName, int32_t& length) {
checkEmptyFieldName(fieldName);
- int64_t* longArray = NULL;
+ int64_t* longArray = nullptr;
m_dataInput->readLongArray(&longArray, length);
return longArray;
}
float* PdxLocalReader::readFloatArray(const char* fieldName, int32_t& length) {
checkEmptyFieldName(fieldName);
- float* floatArray = NULL;
+ float* floatArray = nullptr;
m_dataInput->readFloatArray(&floatArray, length);
return floatArray;
}
@@ -250,14 +250,14 @@ float* PdxLocalReader::readFloatArray(const char* fieldName, int32_t& length) {
double* PdxLocalReader::readDoubleArray(const char* fieldName,
int32_t& length) {
checkEmptyFieldName(fieldName);
- double* doubleArray = NULL;
+ double* doubleArray = nullptr;
m_dataInput->readDoubleArray(&doubleArray, length);
return doubleArray;
}
char** PdxLocalReader::readStringArray(const char* fieldName, int32_t& length) {
checkEmptyFieldName(fieldName);
- char** stringArray = NULL;
+ char** stringArray = nullptr;
m_dataInput->readStringArray(&stringArray, length);
return stringArray;
}
@@ -265,7 +265,7 @@ char** PdxLocalReader::readStringArray(const char* fieldName, int32_t& length) {
wchar_t** PdxLocalReader::readWideStringArray(const char* fieldName,
int32_t& length) {
checkEmptyFieldName(fieldName);
- wchar_t** stringArray = NULL;
+ wchar_t** stringArray = nullptr;
m_dataInput->readWideStringArray(&stringArray, length);
return stringArray;
}
@@ -285,7 +285,7 @@ int8_t** PdxLocalReader::readArrayOfByteArrays(const char* fieldName,
int32_t& arrayLength,
int32_t** elementLength) {
checkEmptyFieldName(fieldName);
- int8_t** arrofBytearr = NULL;
+ int8_t** arrofBytearr = nullptr;
m_dataInput->readArrayOfByteArrays(&arrofBytearr, arrayLength, elementLength);
return arrofBytearr;
}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/11467dd9/src/cppcache/src/PdxLocalWriter.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/PdxLocalWriter.cpp b/src/cppcache/src/PdxLocalWriter.cpp
index e09ce0b..b30f31e 100644
--- a/src/cppcache/src/PdxLocalWriter.cpp
+++ b/src/cppcache/src/PdxLocalWriter.cpp
@@ -38,14 +38,15 @@ namespace client {
* constructor nor in any functions that it calls.
*/
PdxLocalWriter::PdxLocalWriter()
- : m_dataOutput(NULL),
+ : m_dataOutput(nullptr),
m_pdxType(nullptr),
- m_startPosition(NULL),
+ m_startPosition(nullptr),
m_startPositionOffset(0),
- m_domainClassName(NULL),
+ m_domainClassName(nullptr),
m_currentOffsetIndex(0),
- m_pdxClassName(NULL) { // COVERITY --> 29282 Uninitialized pointer field
- // m_dataOutput = NULL;
+ m_pdxClassName(
+ nullptr) { // COVERITY --> 29282 Uninitialized pointer field
+ // m_dataOutput = nullptr;
// m_pdxType =nullptr;
}
@@ -54,7 +55,7 @@ PdxLocalWriter::PdxLocalWriter(DataOutput& output, PdxTypePtr pdxType) {
m_pdxType = pdxType;
m_currentOffsetIndex = 0;
m_preserveData = nullptr;
- m_pdxClassName = NULL;
+ m_pdxClassName = nullptr;
if (pdxType != nullptr) m_pdxClassName = pdxType->getPdxClassName();
;
initialize();
@@ -64,7 +65,7 @@ PdxLocalWriter::PdxLocalWriter(DataOutput& output, PdxTypePtr pdxType) {
* constructor nor in any functions that it calls.
* Fix :
*/
- m_domainClassName = NULL;
+ m_domainClassName = nullptr;
}
PdxLocalWriter::PdxLocalWriter(DataOutput& dataOutput, PdxTypePtr pdxType,
@@ -81,23 +82,23 @@ PdxLocalWriter::PdxLocalWriter(DataOutput& dataOutput, PdxTypePtr pdxType,
* constructor nor in any functions that it calls.
* Fix :
*/
- m_domainClassName = NULL;
+ m_domainClassName = nullptr;
}
PdxLocalWriter::~PdxLocalWriter() {
- /*if (m_dataOutput != NULL) {
+ /*if (m_dataOutput != nullptr) {
delete m_dataOutput;
- m_dataOutput = NULL;
+ m_dataOutput = nullptr;
}
*/
- /*if (m_startPosition != NULL) {
+ /*if (m_startPosition != nullptr) {
delete m_startPosition;
- m_startPosition = NULL;
+ m_startPosition = nullptr;
}*/
- /*if (m_domainClassName != NULL) {
+ /*if (m_domainClassName != nullptr) {
delete m_domainClassName;
- m_domainClassName = NULL;
+ m_domainClassName = nullptr;
}*/
}
@@ -179,7 +180,7 @@ PdxWriterPtr PdxLocalWriter::writeUnreadFields(PdxUnreadFieldsPtr unread) {
} else {
throw IllegalStateException(
"PdxLocalWriter::writeUnreadFields: m_preserveData should not be "
- "NULL");
+ "nullptr");
}
}
return shared_from_this();
@@ -265,7 +266,7 @@ PdxWriterPtr PdxLocalWriter::writeDate(const char* fieldName,
PdxWriterPtr PdxLocalWriter::writeString(const char* fieldName,
const char* value) {
addOffset();
- if (value == NULL) {
+ if (value == nullptr) {
m_dataOutput->write(static_cast<int8_t>(GeodeTypeIds::CacheableNullString));
} else {
int32_t len = DataOutput::getEncodedLength(value);
@@ -286,7 +287,7 @@ PdxWriterPtr PdxLocalWriter::writeString(const char* fieldName,
PdxWriterPtr PdxLocalWriter::writeWideString(const char* fieldName,
const wchar_t* value) {
addOffset();
- if (value == NULL) {
+ if (value == nullptr) {
m_dataOutput->write(static_cast<int8_t>(GeodeTypeIds::CacheableNullString));
} else {
int32_t len = DataOutput::getEncodedLength(value);
@@ -305,7 +306,7 @@ PdxWriterPtr PdxLocalWriter::writeWideString(const char* fieldName,
}
PdxWriterPtr PdxLocalWriter::writeStringwithoutOffset(const char* value) {
- if (value == NULL) {
+ if (value == nullptr) {
m_dataOutput->write(static_cast<int8_t>(GeodeTypeIds::CacheableNullString));
} else {
int32_t len = DataOutput::getEncodedLength(value);
@@ -325,7 +326,7 @@ PdxWriterPtr PdxLocalWriter::writeStringwithoutOffset(const char* value) {
PdxWriterPtr PdxLocalWriter::writeWideStringwithoutOffset(
const wchar_t* value) {
- if (value == NULL) {
+ if (value == nullptr) {
m_dataOutput->write(static_cast<int8_t>(GeodeTypeIds::CacheableNullString));
} else {
int32_t len = DataOutput::getEncodedLength(value);
@@ -346,7 +347,7 @@ PdxWriterPtr PdxLocalWriter::writeWideStringwithoutOffset(
PdxWriterPtr PdxLocalWriter::writeStringArray(const char* fieldName,
char** array, int length) {
addOffset();
- if (array == NULL) {
+ if (array == nullptr) {
m_dataOutput->write(static_cast<int8_t>(-1));
// WriteByte(-1);
} else {
@@ -361,7 +362,7 @@ PdxWriterPtr PdxLocalWriter::writeStringArray(const char* fieldName,
PdxWriterPtr PdxLocalWriter::writeWideStringArray(const char* fieldName,
wchar_t** array, int length) {
addOffset();
- if (array == NULL) {
+ if (array == nullptr) {
m_dataOutput->write(static_cast<int8_t>(-1));
} else {
m_dataOutput->writeArrayLen(length);
@@ -399,11 +400,11 @@ PdxWriterPtr PdxLocalWriter::writeObject(const char* fieldName,
objArrPtr = std::dynamic_pointer_cast<CacheableObjectArray>(value);
m_dataOutput->write(
static_cast<int8_t>(GeodeTypeIds::CacheableObjectArray));
- m_dataOutput->writeArrayLen(objArrPtr->length());
+ m_dataOutput->writeArrayLen(static_cast<int32_t>(objArrPtr->size()));
m_dataOutput->write(static_cast<int8_t>(GeodeTypeIdsImpl::Class));
- _VectorOfCacheable::Iterator iter = objArrPtr->begin();
- PdxSerializablePtr actualObjPtr =
+ auto iter = objArrPtr->begin();
+ const auto actualObjPtr =
std::dynamic_pointer_cast<PdxSerializable>(*iter);
m_dataOutput->write(
@@ -499,7 +500,7 @@ PdxWriterPtr PdxLocalWriter::writeArrayOfByteArrays(const char* fieldName,
int arrayLength,
int* elementLength) {
addOffset();
- if (byteArrays != NULL) {
+ if (byteArrays != nullptr) {
m_dataOutput->writeArrayLen(arrayLength);
for (int i = 0; i < arrayLength; i++) {
m_dataOutput->writeBytes(byteArrays[i], elementLength[i]);
http://git-wip-us.apache.org/repos/asf/geode-native/blob/11467dd9/src/cppcache/src/PdxLocalWriter.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/PdxLocalWriter.hpp b/src/cppcache/src/PdxLocalWriter.hpp
index bfaa86c..d05e932 100644
--- a/src/cppcache/src/PdxLocalWriter.hpp
+++ b/src/cppcache/src/PdxLocalWriter.hpp
@@ -84,7 +84,7 @@ class PdxLocalWriter : public PdxWriter,
}
inline void writePdxCharArray(char* objArray, int arrayLen) {
- if (objArray != NULL) {
+ if (objArray != nullptr) {
m_dataOutput->writeArrayLen(arrayLen);
if (arrayLen > 0) {
char* ptr = objArray;
@@ -112,7 +112,7 @@ class PdxLocalWriter : public PdxWriter,
template <typename mType>
void writeObject(mType* objArray, int arrayLen) {
- if (objArray != NULL) {
+ if (objArray != nullptr) {
m_dataOutput->writeArrayLen(arrayLen);
if (arrayLen > 0) {
mType* ptr = objArray;
http://git-wip-us.apache.org/repos/asf/geode-native/blob/11467dd9/src/cppcache/src/PdxReaderWithTypeCollector.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/PdxReaderWithTypeCollector.cpp b/src/cppcache/src/PdxReaderWithTypeCollector.cpp
index e5c0821..54fa121 100644
--- a/src/cppcache/src/PdxReaderWithTypeCollector.cpp
+++ b/src/cppcache/src/PdxReaderWithTypeCollector.cpp
@@ -15,11 +15,11 @@
* limitations under the License.
*/
/*
-* PdxReaderWithTypeCollector.cpp
-*
-* Created on: Nov 3, 2011
-* Author: npatel
-*/
+ * PdxReaderWithTypeCollector.cpp
+ *
+ * Created on: Nov 3, 2011
+ * Author: npatel
+ */
#include "PdxReaderWithTypeCollector.hpp"
#include "PdxTypes.hpp"
@@ -44,7 +44,7 @@ PdxReaderWithTypeCollector::~PdxReaderWithTypeCollector() {}
void PdxReaderWithTypeCollector::checkType(const char* fieldName, int8_t typeId,
const char* fieldType) {
// Check for Empty Field.
- if (fieldName == NULL) {
+ if (fieldName == nullptr) {
throw IllegalStateException("Field name is null");
}
@@ -236,7 +236,7 @@ char* PdxReaderWithTypeCollector::readString(const char* fieldName) {
int32_t strSize =
static_cast<int32_t>(m_dataInput->currentBufferPosition() - startLoc);
m_dataInput->rewindCursor(strSize + position);
- startLoc = NULL;
+ startLoc = nullptr;
return str;
} else {
static char emptyString[] = {static_cast<char>(0)};
@@ -261,7 +261,7 @@ wchar_t* PdxReaderWithTypeCollector::readWideString(const char* fieldName) {
int32_t strSize =
static_cast<int32_t>(m_dataInput->currentBufferPosition() - startLoc);
m_dataInput->rewindCursor(strSize + position);
- startLoc = NULL;
+ startLoc = nullptr;
return str;
} else {
static wchar_t emptyString[] = {static_cast<wchar_t>(0)};
@@ -285,7 +285,7 @@ SerializablePtr PdxReaderWithTypeCollector::readObject(const char* fieldName) {
int32_t strSize =
static_cast<int32_t>(m_dataInput->currentBufferPosition() - startLoc);
m_dataInput->rewindCursor(strSize + position);
- startLoc = NULL;
+ startLoc = nullptr;
return ptr;
} else {
return nullptr;
@@ -308,10 +308,10 @@ char* PdxReaderWithTypeCollector::readCharArray(const char* fieldName,
int32_t strSize =
static_cast<int32_t>(m_dataInput->currentBufferPosition() - startLoc);
m_dataInput->rewindCursor(strSize + position);
- startLoc = NULL;
+ startLoc = nullptr;
return retVal;
} else {
- return NULL;
+ return nullptr;
}
}
@@ -331,10 +331,10 @@ wchar_t* PdxReaderWithTypeCollector::readWideCharArray(const char* fieldName,
int32_t strSize =
static_cast<int32_t>(m_dataInput->currentBufferPosition() - startLoc);
m_dataInput->rewindCursor(strSize + position);
- startLoc = NULL;
+ startLoc = nullptr;
return retVal;
} else {
- return NULL;
+ return nullptr;
}
}
@@ -357,10 +357,10 @@ bool* PdxReaderWithTypeCollector::readBooleanArray(const char* fieldName,
int32_t strSize =
static_cast<int32_t>(m_dataInput->currentBufferPosition() - startLoc);
m_dataInput->rewindCursor(strSize + position);
- startLoc = NULL;
+ startLoc = nullptr;
return retVal;
}
- return NULL;
+ return nullptr;
}
int8_t* PdxReaderWithTypeCollector::readByteArray(const char* fieldName,
@@ -380,10 +380,10 @@ int8_t* PdxReaderWithTypeCollector::readByteArray(const char* fieldName,
int32_t strSize =
static_cast<int32_t>(m_dataInput->currentBufferPosition() - startLoc);
m_dataInput->rewindCursor(strSize + position);
- startLoc = NULL;
+ startLoc = nullptr;
return byteArrptr;
} else {
- return NULL;
+ return nullptr;
}
}
@@ -404,10 +404,10 @@ int16_t* PdxReaderWithTypeCollector::readShortArray(const char* fieldName,
int32_t strSize =
static_cast<int32_t>(m_dataInput->currentBufferPosition() - startLoc);
m_dataInput->rewindCursor(strSize + position);
- startLoc = NULL;
+ startLoc = nullptr;
return shortArrptr;
} else {
- return NULL;
+ return nullptr;
}
}
@@ -428,10 +428,10 @@ int32_t* PdxReaderWithTypeCollector::readIntArray(const char* fieldName,
int32_t strSize =
static_cast<int32_t>(m_dataInput->currentBufferPosition() - startLoc);
m_dataInput->rewindCursor(strSize + position);
- startLoc = NULL;
+ startLoc = nullptr;
return intArrayptr;
} else {
- return NULL;
+ return nullptr;
}
}
@@ -452,10 +452,10 @@ int64_t* PdxReaderWithTypeCollector::readLongArray(const char* fieldName,
int32_t strSize =
static_cast<int32_t>(m_dataInput->currentBufferPosition() - startLoc);
m_dataInput->rewindCursor(strSize + position);
- startLoc = NULL;
+ startLoc = nullptr;
return longArrptr;
} else {
- return NULL;
+ return nullptr;
}
}
@@ -476,10 +476,10 @@ float* PdxReaderWithTypeCollector::readFloatArray(const char* fieldName,
int32_t strSize =
static_cast<int32_t>(m_dataInput->currentBufferPosition() - startLoc);
m_dataInput->rewindCursor(strSize + position);
- startLoc = NULL;
+ startLoc = nullptr;
return floatArrptr;
} else {
- return NULL;
+ return nullptr;
}
}
@@ -500,10 +500,10 @@ double* PdxReaderWithTypeCollector::readDoubleArray(const char* fieldName,
int32_t strSize =
static_cast<int32_t>(m_dataInput->currentBufferPosition() - startLoc);
m_dataInput->rewindCursor(strSize + position);
- startLoc = NULL;
+ startLoc = nullptr;
return doubleArrptr;
} else {
- return NULL;
+ return nullptr;
}
}
@@ -524,10 +524,10 @@ char** PdxReaderWithTypeCollector::readStringArray(const char* fieldName,
int32_t strSize =
static_cast<int32_t>(m_dataInput->currentBufferPosition() - startLoc);
m_dataInput->rewindCursor(strSize + position);
- startLoc = NULL;
+ startLoc = nullptr;
return strArray;
} else {
- return NULL;
+ return nullptr;
}
}
@@ -548,10 +548,10 @@ wchar_t** PdxReaderWithTypeCollector::readWideStringArray(const char* fieldName,
int32_t strSize =
static_cast<int32_t>(m_dataInput->currentBufferPosition() - startLoc);
m_dataInput->rewindCursor(strSize + position);
- startLoc = NULL;
+ startLoc = nullptr;
return strArray;
} else {
- return NULL;
+ return nullptr;
}
}
@@ -571,7 +571,7 @@ CacheableObjectArrayPtr PdxReaderWithTypeCollector::readObjectArray(
int32_t strSize =
static_cast<int32_t>(m_dataInput->currentBufferPosition() - startLoc);
m_dataInput->rewindCursor(strSize + position);
- startLoc = NULL;
+ startLoc = nullptr;
return retVal;
} else {
return nullptr;
@@ -595,10 +595,10 @@ int8_t** PdxReaderWithTypeCollector::readArrayOfByteArrays(
int32_t strSize =
static_cast<int32_t>(m_dataInput->currentBufferPosition() - startLoc);
m_dataInput->rewindCursor(strSize + position);
- startLoc = NULL;
+ startLoc = nullptr;
return retVal;
} else {
- return NULL;
+ return nullptr;
}
}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/11467dd9/src/cppcache/src/PdxRemoteReader.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/PdxRemoteReader.cpp b/src/cppcache/src/PdxRemoteReader.cpp
index e28ab22..829b1ac 100644
--- a/src/cppcache/src/PdxRemoteReader.cpp
+++ b/src/cppcache/src/PdxRemoteReader.cpp
@@ -15,11 +15,11 @@
* limitations under the License.
*/
/*
-* PdxRemoteReader.cpp
-*
-* Created on: Nov 3, 2011
-* Author: npatel
-*/
+ * PdxRemoteReader.cpp
+ *
+ * Created on: Nov 3, 2011
+ * Author: npatel
+ */
#include "PdxRemoteReader.hpp"
#include "PdxTypes.hpp"
@@ -560,7 +560,7 @@ char* PdxRemoteReader::readCharArray(const char* fieldName, int32_t& length) {
case -2:
return PdxLocalReader::readCharArray(fieldName, length); // in same order
case -1: {
- return NULL; // null value
+ return nullptr; // null value
}
default: {
// sequence id read field and then update
@@ -584,7 +584,7 @@ wchar_t* PdxRemoteReader::readWideCharArray(const char* fieldName,
return PdxLocalReader::readWideCharArray(fieldName,
length); // in same order
case -1: {
- return NULL; // null value
+ return nullptr; // null value
}
default: {
// sequence id read field and then update
@@ -608,7 +608,7 @@ bool* PdxRemoteReader::readBooleanArray(const char* fieldName,
return PdxLocalReader::readBooleanArray(fieldName,
length); // in same order
case -1: {
- return NULL; // null value
+ return nullptr; // null value
}
default: {
// sequence id read field and then update
@@ -631,7 +631,7 @@ int8_t* PdxRemoteReader::readByteArray(const char* fieldName, int32_t& length) {
return PdxLocalReader::readByteArray(fieldName, length); // in same order
}
case -1: {
- return NULL;
+ return nullptr;
}
default: {
// sequence id read field and then update
@@ -645,7 +645,7 @@ int8_t* PdxRemoteReader::readByteArray(const char* fieldName, int32_t& length) {
PdxLocalReader::resettoPdxHead();
return byteArrptr;
} else {
- return NULL;
+ return nullptr;
}
}
}
@@ -661,7 +661,7 @@ int16_t* PdxRemoteReader::readShortArray(const char* fieldName,
// order
}
case -1: {
- return NULL;
+ return nullptr;
}
default: {
// sequence id read field and then update
@@ -675,7 +675,7 @@ int16_t* PdxRemoteReader::readShortArray(const char* fieldName,
PdxLocalReader::resettoPdxHead();
return shortArrptr;
} else {
- return NULL;
+ return nullptr;
}
}
}
@@ -689,7 +689,7 @@ int32_t* PdxRemoteReader::readIntArray(const char* fieldName, int32_t& length) {
return PdxLocalReader::readIntArray(fieldName, length); // in same order
}
case -1: {
- return NULL;
+ return nullptr;
}
default: {
// sequence id read field and then update
@@ -703,7 +703,7 @@ int32_t* PdxRemoteReader::readIntArray(const char* fieldName, int32_t& length) {
PdxLocalReader::resettoPdxHead();
return intArrptr;
} else {
- return NULL;
+ return nullptr;
}
}
}
@@ -718,7 +718,7 @@ int64_t* PdxRemoteReader::readLongArray(const char* fieldName,
return PdxLocalReader::readLongArray(fieldName, length); // in same order
}
case -1: {
- return NULL;
+ return nullptr;
}
default: {
// sequence id read field and then update
@@ -732,7 +732,7 @@ int64_t* PdxRemoteReader::readLongArray(const char* fieldName,
PdxLocalReader::resettoPdxHead();
return longArrptr;
} else {
- return NULL;
+ return nullptr;
}
}
}
@@ -747,7 +747,7 @@ float* PdxRemoteReader::readFloatArray(const char* fieldName, int32_t& length) {
// order
}
case -1: {
- return NULL;
+ return nullptr;
}
default: {
// sequence id read field and then update
@@ -762,7 +762,7 @@ float* PdxRemoteReader::readFloatArray(const char* fieldName, int32_t& length) {
PdxLocalReader::resettoPdxHead();
return floatArrptr;
} else {
- return NULL;
+ return nullptr;
}
}
}
@@ -778,7 +778,7 @@ double* PdxRemoteReader::readDoubleArray(const char* fieldName,
length); // in same order
}
case -1: {
- return NULL;
+ return nullptr;
}
default: {
// sequence id read field and then update
@@ -793,7 +793,7 @@ double* PdxRemoteReader::readDoubleArray(const char* fieldName,
PdxLocalReader::resettoPdxHead();
return doubleArrptr;
} else {
- return NULL;
+ return nullptr;
}
}
}
@@ -809,7 +809,7 @@ char** PdxRemoteReader::readStringArray(const char* fieldName,
length); // in same order
}
case -1: {
- return NULL;
+ return nullptr;
}
default: {
// sequence id read field and then update
@@ -823,7 +823,7 @@ char** PdxRemoteReader::readStringArray(const char* fieldName,
PdxLocalReader::resettoPdxHead();
return strArray;
} else {
- return NULL;
+ return nullptr;
}
}
}
@@ -839,7 +839,7 @@ wchar_t** PdxRemoteReader::readWideStringArray(const char* fieldName,
length); // in same order
}
case -1: {
- return NULL;
+ return nullptr;
}
default: {
// sequence id read field and then update
@@ -853,7 +853,7 @@ wchar_t** PdxRemoteReader::readWideStringArray(const char* fieldName,
PdxLocalReader::resettoPdxHead();
return strArray;
} else {
- return NULL;
+ return nullptr;
}
}
}
@@ -893,7 +893,7 @@ int8_t** PdxRemoteReader::readArrayOfByteArrays(const char* fieldName,
return PdxLocalReader::readArrayOfByteArrays(
fieldName, arrayLength, elementLength); // in same order
case -1:
- return NULL; // null value
+ return nullptr; // null value
default: {
// sequence id read field and then update
int position = m_pdxType->getFieldPosition(
@@ -943,7 +943,7 @@ CacheableDatePtr PdxRemoteReader::readDate(const char* fieldName) {
}
case -1:
{
- bytes = NULL;//null value
+ bytes = nullptr;//null value
break;
}
default:
@@ -957,7 +957,7 @@ m_offsetSize, m_serializedLength);
m_dataInput->rewindCursor(position);
}
else {
- bytes = NULL;//null value
+ bytes = nullptr;//null value
}
}
}
@@ -976,7 +976,7 @@ void PdxRemoteReader::readBytes(const char* fieldName, int8_t*& bytes,
}
case -1:
{
- bytes = NULL;//null value
+ bytes = nullptr;//null value
break;
}
default:
@@ -990,7 +990,7 @@ m_offsetSize, m_serializedLength);
m_dataInput->rewindCursor(position);
}
else {
- bytes = NULL;//null value
+ bytes = nullptr;//null value
}
}
}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/11467dd9/src/cppcache/src/PdxRemoteReader.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/PdxRemoteReader.hpp b/src/cppcache/src/PdxRemoteReader.hpp
index 45df8de..2856f89 100644
--- a/src/cppcache/src/PdxRemoteReader.hpp
+++ b/src/cppcache/src/PdxRemoteReader.hpp
@@ -97,7 +97,7 @@ class PdxRemoteReader : public PdxLocalReader {
* @param value value of the field which needs to serialize
virtual void readASCII(const char* fieldName, char** value, uint16_t* len =
- NULL);
+ nullptr);
*
* Read a ASCII Huge string from the <code>PdxReader</code>.
@@ -105,7 +105,7 @@ class PdxRemoteReader : public PdxLocalReader {
* @param value value of the field which needs to serialize
virtual void readASCIIHuge(const char* fieldName, char** value, uint32_t* len
- = NULL);
+ = nullptr);
*
* Read a UTF string from the <code>PdxReader</code>.
@@ -113,7 +113,7 @@ class PdxRemoteReader : public PdxLocalReader {
* @param value value of the field which needs to serialize
virtual void readUTF(const char* fieldName, char** value, uint16_t* len =
- NULL);
+ nullptr);
*
* Read a string from the <code>PdxReader</code>.
@@ -121,7 +121,7 @@ class PdxRemoteReader : public PdxLocalReader {
* Returns String value
virtual void readUTFHuge(const char* fieldName, char** value, uint32_t* len =
- NULL);
+ nullptr);
*/
virtual char* readString(const char* fieldName);
http://git-wip-us.apache.org/repos/asf/geode-native/blob/11467dd9/src/cppcache/src/PdxType.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/PdxType.cpp b/src/cppcache/src/PdxType.cpp
index f5fb711..f505be3 100644
--- a/src/cppcache/src/PdxType.cpp
+++ b/src/cppcache/src/PdxType.cpp
@@ -15,11 +15,11 @@
* limitations under the License.
*/
/*
-* PdxType.cpp
-*
-* Created on: Nov 3, 2011
-* Author: npatel
-*/
+ * PdxType.cpp
+ *
+ * Created on: Nov 3, 2011
+ * Author: npatel
+ */
#include "PdxType.hpp"
#include "PdxHelper.hpp"
@@ -45,7 +45,7 @@ PdxType::~PdxType() {
PdxType::PdxType() : Serializable() {
// m_lockObj = nullptr;
- m_className = NULL;
+ m_className = nullptr;
m_isLocal = false;
m_numberOfVarLenFields = 0;
m_varLenFieldIdx = 0; // start with 0
@@ -54,8 +54,8 @@ PdxType::PdxType() : Serializable() {
m_noJavaClass = false;
// m_pdxDomainType = nullptr;
m_pdxFieldTypes = new std::vector<PdxFieldTypePtr>();
- m_localToRemoteFieldMap = NULL;
- m_remoteToLocalFieldMap = NULL;
+ m_localToRemoteFieldMap = nullptr;
+ m_remoteToLocalFieldMap = nullptr;
m_geodeTypeId = 0;
/* adongre
* Coverity - II
@@ -78,8 +78,8 @@ PdxType::PdxType(const char* pdxDomainClassName, bool isLocal)
// m_fieldNameVsPdxType = CacheableHashMap::create();
m_noJavaClass = false;
m_pdxFieldTypes = new std::vector<PdxFieldTypePtr>();
- m_localToRemoteFieldMap = NULL;
- m_remoteToLocalFieldMap = NULL;
+ m_localToRemoteFieldMap = nullptr;
+ m_remoteToLocalFieldMap = nullptr;
m_geodeTypeId = 0;
/* adongre
* Coverity - II
@@ -146,7 +146,7 @@ Serializable* PdxType::fromData(DataInput& input) {
bool foundVarLenType = false;
for (int i = 0; i < len; i++) {
- auto pft = std::make_shared<PdxFieldType>();
+ auto pft = std::make_shared<PdxFieldType>();
pft->fromData(input);
m_pdxFieldTypes->push_back(pft);
@@ -168,22 +168,22 @@ Serializable* PdxType::fromData(DataInput& input) {
void PdxType::addFixedLengthTypeField(const char* fieldName,
const char* className, int8_t typeId,
int32_t size) {
- if (fieldName == NULL /*|| *fieldName == '\0'*/ ||
+ if (fieldName == nullptr /*|| *fieldName == '\0'*/ ||
m_fieldNameVsPdxType.find(fieldName) !=
m_fieldNameVsPdxType
.end()) { // COVERITY ---> 30289 Same on both sides
char excpStr[256] = {0};
/* adongre
* Coverity - II
- * CID 29269: Calling risky function (SECURE_CODING)[VERY RISKY]. Using
- * "sprintf" can cause a
- * buffer overflow when done incorrectly. Because sprintf() assumes an
- * 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
- */
+ * CID 29269: Calling risky function (SECURE_CODING)[VERY RISKY]. Using
+ * "sprintf" can cause a
+ * buffer overflow when done incorrectly. Because sprintf() assumes an
+ * 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
+ */
ACE_OS::snprintf(
excpStr, 256,
"Field: %s is either already added into PdxWriter or it is null ",
@@ -191,15 +191,15 @@ void PdxType::addFixedLengthTypeField(const char* fieldName,
throw IllegalStateException(excpStr);
}
auto pfxPtr = std::make_shared<PdxFieldType>(
- fieldName, className, typeId, static_cast<int32_t>(m_pdxFieldTypes->size()),
- false, size, 0);
+ fieldName, className, typeId,
+ static_cast<int32_t>(m_pdxFieldTypes->size()), false, size, 0);
m_pdxFieldTypes->push_back(pfxPtr);
m_fieldNameVsPdxType[fieldName] = pfxPtr;
}
void PdxType::addVariableLengthTypeField(const char* fieldName,
const char* className, int8_t typeId) {
- if (fieldName == NULL /*|| *fieldName == '\0'*/ ||
+ if (fieldName == nullptr /*|| *fieldName == '\0'*/ ||
m_fieldNameVsPdxType.find(fieldName) !=
m_fieldNameVsPdxType
.end()) { // COVERITY ---> 30289 Same on both sides
@@ -218,8 +218,9 @@ void PdxType::addVariableLengthTypeField(const char* fieldName,
m_numberOfVarLenFields++;
m_isVarLenFieldAdded = true;
auto pfxPtr = std::make_shared<PdxFieldType>(
- fieldName, className, typeId, static_cast<int32_t>(m_pdxFieldTypes->size()),
- true, -1, m_varLenFieldIdx);
+ fieldName, className, typeId,
+ static_cast<int32_t>(m_pdxFieldTypes->size()), true, -1,
+ m_varLenFieldIdx);
m_pdxFieldTypes->push_back(pfxPtr);
m_fieldNameVsPdxType[fieldName] = pfxPtr;
}
@@ -430,12 +431,12 @@ int32_t PdxType::variableLengthFieldPosition(PdxFieldTypePtr varLenField,
}
int32_t* PdxType::getLocalToRemoteMap() {
- if (m_localToRemoteFieldMap != NULL) {
+ if (m_localToRemoteFieldMap != nullptr) {
return m_localToRemoteFieldMap;
}
ReadGuard guard(m_lockObj);
- if (m_localToRemoteFieldMap != NULL) {
+ if (m_localToRemoteFieldMap != nullptr) {
return m_localToRemoteFieldMap;
}
initLocalToRemote();
@@ -444,12 +445,12 @@ int32_t* PdxType::getLocalToRemoteMap() {
}
int32_t* PdxType::getRemoteToLocalMap() {
- if (m_remoteToLocalFieldMap != NULL) {
+ if (m_remoteToLocalFieldMap != nullptr) {
return m_remoteToLocalFieldMap;
}
ReadGuard guard(m_lockObj);
- if (m_remoteToLocalFieldMap != NULL) {
+ if (m_remoteToLocalFieldMap != nullptr) {
return m_remoteToLocalFieldMap;
}
initRemoteToLocal();
@@ -529,7 +530,7 @@ PdxTypePtr PdxType::mergeVersion(PdxTypePtr otherVersion) {
}
}
if (!found) {
- auto newFt = std::make_shared< PdxFieldType>(
+ auto newFt = std::make_shared<PdxFieldType>(
(*it)->getFieldName(), (*it)->getClassName(), (*it)->getTypeId(),
static_cast<int32_t>(newone->m_pdxFieldTypes->size()), // sequence id
(*it)->IsVariableLengthType(), (*it)->getFixedSize(),
@@ -610,7 +611,7 @@ bool PdxType::Equals(PdxTypePtr otherObj) {
PdxType* ot = dynamic_cast<PdxType*>(otherObj.get());
- if (ot == NULL) return false;
+ if (ot == nullptr) return false;
if (ot == this) return true;
http://git-wip-us.apache.org/repos/asf/geode-native/blob/11467dd9/src/cppcache/src/PdxType.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/PdxType.hpp b/src/cppcache/src/PdxType.hpp
index cefafa2..b14e767 100644
--- a/src/cppcache/src/PdxType.hpp
+++ b/src/cppcache/src/PdxType.hpp
@@ -123,7 +123,7 @@ class PdxType : public Serializable,
virtual uint32_t objectSize() const {
uint32_t size = sizeof(PdxType);
- if (m_pdxFieldTypes != NULL) {
+ if (m_pdxFieldTypes != nullptr) {
for (size_t i = 0; i < m_pdxFieldTypes->size(); i++) {
size += m_pdxFieldTypes->at(i)->objectSize();
}
@@ -134,14 +134,14 @@ class PdxType : public Serializable,
size += static_cast<uint32_t>(iter->first.length());
size += iter->second->objectSize();
}
- if (m_remoteToLocalFieldMap != NULL) {
- if (m_pdxFieldTypes != NULL) {
+ if (m_remoteToLocalFieldMap != nullptr) {
+ if (m_pdxFieldTypes != nullptr) {
size +=
static_cast<uint32_t>(sizeof(int32_t) * m_pdxFieldTypes->size());
}
}
- if (m_localToRemoteFieldMap != NULL) {
- if (m_pdxFieldTypes != NULL) {
+ if (m_localToRemoteFieldMap != nullptr) {
+ if (m_pdxFieldTypes != nullptr) {
size +=
static_cast<uint32_t>(sizeof(int32_t) * m_pdxFieldTypes->size());
}
@@ -155,7 +155,9 @@ class PdxType : public Serializable,
int32_t getNumberOfVarLenFields() const { return m_numberOfVarLenFields; }
- void setNumberOfVarLenFields(int32_t value) { m_numberOfVarLenFields = value; }
+ void setNumberOfVarLenFields(int32_t value) {
+ m_numberOfVarLenFields = value;
+ }
int32_t getTotalFields() const {
return static_cast<int32_t>(m_pdxFieldTypes->size());
http://git-wip-us.apache.org/repos/asf/geode-native/blob/11467dd9/src/cppcache/src/PdxTypeRegistry.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/PdxTypeRegistry.cpp b/src/cppcache/src/PdxTypeRegistry.cpp
index 0efbb3a..713341a 100644
--- a/src/cppcache/src/PdxTypeRegistry.cpp
+++ b/src/cppcache/src/PdxTypeRegistry.cpp
@@ -28,15 +28,15 @@ namespace apache {
namespace geode {
namespace client {
-TypeIdVsPdxType* PdxTypeRegistry::typeIdToPdxType = NULL;
+TypeIdVsPdxType* PdxTypeRegistry::typeIdToPdxType = nullptr;
-TypeIdVsPdxType* PdxTypeRegistry::remoteTypeIdToMergedPdxType = NULL;
+TypeIdVsPdxType* PdxTypeRegistry::remoteTypeIdToMergedPdxType = nullptr;
-TypeNameVsPdxType* PdxTypeRegistry::localTypeToPdxType = NULL;
+TypeNameVsPdxType* PdxTypeRegistry::localTypeToPdxType = nullptr;
// TODO::Add support for weakhashmap
// std::map<PdxSerializablePtr, PdxRemotePreservedDataPtr>
-// *PdxTypeRegistry::preserveData = NULL;
+// *PdxTypeRegistry::preserveData = nullptr;
PreservedHashMap PdxTypeRegistry::preserveData;
CacheableHashMapPtr PdxTypeRegistry::enumToInt = nullptr;
@@ -47,7 +47,7 @@ ACE_RW_Thread_Mutex PdxTypeRegistry::g_readerWriterLock;
ACE_RW_Thread_Mutex PdxTypeRegistry::g_preservedDataLock;
-PdxTypeToTypeIdMap* PdxTypeRegistry::pdxTypeToTypeIdMap = NULL;
+PdxTypeToTypeIdMap* PdxTypeRegistry::pdxTypeToTypeIdMap = nullptr;
bool PdxTypeRegistry::pdxReadSerialized;
bool PdxTypeRegistry::pdxIgnoreUnreadFields;
@@ -85,14 +85,16 @@ void PdxTypeRegistry::cleanup() {
// GF_SAFE_DELETE(preserveData);
}
-int PdxTypeRegistry::testGetNumberOfPdxIds() {
- return static_cast<int>(typeIdToPdxType->size());
+size_t PdxTypeRegistry::testGetNumberOfPdxIds() {
+ return typeIdToPdxType->size();
}
-int PdxTypeRegistry::testNumberOfPreservedData() { return preserveData.size(); }
+size_t PdxTypeRegistry::testNumberOfPreservedData() {
+ return preserveData.size();
+}
int32_t PdxTypeRegistry::getPDXIdForType(const char* type, const char* poolname,
- PdxTypePtr nType, bool checkIfThere) {
+ PdxTypePtr nType, bool checkIfThere) {
// WriteGuard guard(g_readerWriterLock);
if (checkIfThere) {
PdxTypePtr lpdx = getLocalPdxType(type);
@@ -111,7 +113,8 @@ int32_t PdxTypeRegistry::getPDXIdForType(const char* type, const char* poolname,
return typeId;
}
-int32_t PdxTypeRegistry::getPDXIdForType(PdxTypePtr nType, const char* poolname) {
+int32_t PdxTypeRegistry::getPDXIdForType(PdxTypePtr nType,
+ const char* poolname) {
PdxTypeToTypeIdMap* tmp = pdxTypeToTypeIdMap;
int32_t typeId = 0;
PdxTypeToTypeIdMap::iterator iter = tmp->find(nType);
@@ -141,19 +144,19 @@ int32_t PdxTypeRegistry::getPDXIdForType(PdxTypePtr nType, const char* poolname)
void PdxTypeRegistry::clear() {
{
WriteGuard guard(g_readerWriterLock);
- if (typeIdToPdxType != NULL) typeIdToPdxType->clear();
+ if (typeIdToPdxType != nullptr) typeIdToPdxType->clear();
- if (remoteTypeIdToMergedPdxType != NULL) {
+ if (remoteTypeIdToMergedPdxType != nullptr) {
remoteTypeIdToMergedPdxType->clear();
}
- if (localTypeToPdxType != NULL) localTypeToPdxType->clear();
+ if (localTypeToPdxType != nullptr) localTypeToPdxType->clear();
if (intToEnum != nullptr) intToEnum->clear();
if (enumToInt != nullptr) enumToInt->clear();
- if (pdxTypeToTypeIdMap != NULL) pdxTypeToTypeIdMap->clear();
+ if (pdxTypeToTypeIdMap != nullptr) pdxTypeToTypeIdMap->clear();
}
{
WriteGuard guard(getPreservedDataLock());
@@ -198,7 +201,8 @@ PdxTypePtr PdxTypeRegistry::getLocalPdxType(const char* localType) {
return nullptr;
}
-void PdxTypeRegistry::setMergedType(int32_t remoteTypeId, PdxTypePtr mergedType) {
+void PdxTypeRegistry::setMergedType(int32_t remoteTypeId,
+ PdxTypePtr mergedType) {
WriteGuard guard(g_readerWriterLock);
std::pair<int32_t, PdxTypePtr> mergedTypePair(remoteTypeId, mergedType);
remoteTypeIdToMergedPdxType->insert(mergedTypePair);
@@ -219,25 +223,24 @@ void PdxTypeRegistry::setPreserveData(PdxSerializablePtr obj,
PdxRemotePreservedDataPtr pData) {
WriteGuard guard(getPreservedDataLock());
pData->setOwner(obj);
- if (preserveData.contains(obj)) {
+ if (preserveData.find(obj) != preserveData.end()) {
// reset expiry task
- // TODO: check value for NULL
- long expTaskId = preserveData[obj]->getPreservedDataExpiryTaskId();
+ // TODO: check value for nullptr
+ auto expTaskId = preserveData[obj]->getPreservedDataExpiryTaskId();
CacheImpl::expiryTaskManager->resetTask(expTaskId, 5);
LOGDEBUG("PdxTypeRegistry::setPreserveData Reset expiry task Done");
pData->setPreservedDataExpiryTaskId(expTaskId);
preserveData[obj] = pData;
} else {
// schedule new expiry task
- PreservedDataExpiryHandler* handler =
- new PreservedDataExpiryHandler(obj, 20);
- long id =
+ auto handler = new PreservedDataExpiryHandler(obj, 20);
+ auto id =
CacheImpl::expiryTaskManager->scheduleExpiryTask(handler, 20, 0, false);
pData->setPreservedDataExpiryTaskId(id);
LOGDEBUG(
"PdxTypeRegistry::setPreserveData Schedule new expirt task with id=%ld",
id);
- preserveData.insert(obj, pData);
+ preserveData.emplace(obj, pData);
}
LOGDEBUG(
@@ -248,10 +251,9 @@ void PdxTypeRegistry::setPreserveData(PdxSerializablePtr obj,
PdxRemotePreservedDataPtr PdxTypeRegistry::getPreserveData(
PdxSerializablePtr pdxobj) {
ReadGuard guard(getPreservedDataLock());
- PreservedHashMap::Iterator iter = preserveData.find((pdxobj));
+ const auto& iter = preserveData.find((pdxobj));
if (iter != preserveData.end()) {
- PdxRemotePreservedDataPtr retValPtr = iter.second();
- return retValPtr;
+ return iter->second;
}
return nullptr;
}
@@ -260,19 +262,22 @@ int32_t PdxTypeRegistry::getEnumValue(EnumInfoPtr ei) {
// TODO locking - naive concurrent optimization?
CacheableHashMapPtr tmp;
tmp = enumToInt;
- if (tmp->contains(ei)) {
- auto val = std::static_pointer_cast<CacheableInt32>(tmp->operator[](ei));
+ const auto& entry = tmp->find(ei);
+ if (entry != tmp->end()) {
+ const auto val = std::static_pointer_cast<CacheableInt32>(entry->second);
return val->value();
}
+
WriteGuard guard(g_readerWriterLock);
tmp = enumToInt;
- if (tmp->contains(ei)) {
- auto val = std::static_pointer_cast<CacheableInt32>(tmp->operator[](ei));
- return val->value();
+ const auto& entry2 = tmp->find(ei);
+ if (entry2 != tmp->end()) {
+ const auto val2 = std::static_pointer_cast<CacheableInt32>(entry2->second);
+ return val2->value();
}
int val = SerializationRegistry::GetEnumValue(ei);
tmp = enumToInt;
- tmp->update(ei, CacheableInt32::create(val));
+ tmp->emplace(ei, CacheableInt32::create(val));
enumToInt = tmp;
return val;
}
@@ -282,29 +287,36 @@ EnumInfoPtr PdxTypeRegistry::getEnum(int32_t enumVal) {
EnumInfoPtr ret;
CacheableHashMapPtr tmp;
auto enumValPtr = CacheableInt32::create(enumVal);
+
tmp = intToEnum;
- if (tmp->contains(enumValPtr)) {
- ret = std::static_pointer_cast<EnumInfo>(tmp->operator[](enumValPtr));
- }
+ {
+ const auto& entry = tmp->find(enumValPtr);
+ if (entry != tmp->end()) {
+ ret = std::static_pointer_cast<EnumInfo>(entry->second);
+ }
- if (ret != nullptr) {
- return ret;
+ if (ret) {
+ return ret;
+ }
}
WriteGuard guard(g_readerWriterLock);
tmp = intToEnum;
- if (tmp->contains(enumValPtr)) {
- ret = std::static_pointer_cast<EnumInfo>(tmp->operator[](enumValPtr));
- }
+ {
+ const auto& entry = tmp->find(enumValPtr);
+ if (entry != tmp->end()) {
+ ret = std::static_pointer_cast<EnumInfo>(entry->second);
+ }
- if (ret != nullptr) {
- return ret;
+ if (ret) {
+ return ret;
+ }
}
ret = std::static_pointer_cast<EnumInfo>(
SerializationRegistry::GetEnum(enumVal));
tmp = intToEnum;
- tmp->update(enumValPtr, ret);
+ (*tmp)[enumValPtr] = ret;
intToEnum = tmp;
return ret;
}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/11467dd9/src/cppcache/src/PdxTypeRegistry.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/PdxTypeRegistry.hpp b/src/cppcache/src/PdxTypeRegistry.hpp
index 173fe36..2c2177f 100644
--- a/src/cppcache/src/PdxTypeRegistry.hpp
+++ b/src/cppcache/src/PdxTypeRegistry.hpp
@@ -1,8 +1,3 @@
-#pragma once
-
-#ifndef GEODE_PDXTYPEREGISTRY_H_
-#define GEODE_PDXTYPEREGISTRY_H_
-
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@@ -20,12 +15,22 @@
* limitations under the License.
*/
-#include <geode/PdxSerializable.hpp>
-#include "PdxRemotePreservedData.hpp"
-#include "ReadWriteLock.hpp"
+#pragma once
+
+#ifndef GEODE_PDXTYPEREGISTRY_H_
+#define GEODE_PDXTYPEREGISTRY_H_
+
+#include <unordered_map>
#include <map>
+
#include <ace/ACE.h>
#include <ace/Recursive_Thread_Mutex.h>
+
+#include <geode/utils.hpp>
+#include <geode/PdxSerializable.hpp>
+
+#include "PdxRemotePreservedData.hpp"
+#include "ReadWriteLock.hpp"
#include "PdxType.hpp"
#include "EnumInfo.hpp"
#include "PreservedDataExpiryHandler.hpp"
@@ -43,7 +48,9 @@ struct PdxTypeLessThan {
typedef std::map<int32_t, PdxTypePtr> TypeIdVsPdxType;
typedef std::map</*char**/ std::string, PdxTypePtr> TypeNameVsPdxType;
-typedef HashMapT<PdxSerializablePtr, PdxRemotePreservedDataPtr>
+typedef std::unordered_map<PdxSerializablePtr, PdxRemotePreservedDataPtr,
+ dereference_hash<CacheableKeyPtr>,
+ dereference_equal_to<CacheableKeyPtr>>
PreservedHashMap;
typedef std::map<PdxTypePtr, int32_t, PdxTypeLessThan> PdxTypeToTypeIdMap;
@@ -83,10 +90,10 @@ class CPPCACHE_EXPORT PdxTypeRegistry {
static void cleanup();
// test hook;
- static int testGetNumberOfPdxIds();
+ static size_t testGetNumberOfPdxIds();
// test hook
- static int testNumberOfPreservedData();
+ static size_t testNumberOfPreservedData();
static void addPdxType(int32_t typeId, PdxTypePtr pdxType);
@@ -109,7 +116,7 @@ class CPPCACHE_EXPORT PdxTypeRegistry {
static void clear();
static int32_t getPDXIdForType(const char* type, const char* poolname,
- PdxTypePtr nType, bool checkIfThere);
+ PdxTypePtr nType, bool checkIfThere);
static bool getPdxIgnoreUnreadFields() { return pdxIgnoreUnreadFields; }
http://git-wip-us.apache.org/repos/asf/geode-native/blob/11467dd9/src/cppcache/src/PdxWrapper.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/PdxWrapper.cpp b/src/cppcache/src/PdxWrapper.cpp
index 815ac7d..9306660 100644
--- a/src/cppcache/src/PdxWrapper.cpp
+++ b/src/cppcache/src/PdxWrapper.cpp
@@ -33,7 +33,7 @@ namespace client {
PdxWrapper::PdxWrapper(void *userObject, const char *className) {
m_userObject = userObject;
- if (className != NULL) {
+ if (className != nullptr) {
m_className = Utils::copyString(className);
} else {
LOGERROR("Class name not provided to PdxWrapper constructor");
@@ -51,7 +51,7 @@ PdxWrapper::PdxWrapper(void *userObject, const char *className) {
m_deallocator = m_serializer->getDeallocator(className);
- if (m_deallocator == NULL) {
+ if (m_deallocator == nullptr) {
LOGERROR(
"No deallocator function found from PDX serializer for PdxWrapper for "
"%s",
@@ -60,12 +60,12 @@ PdxWrapper::PdxWrapper(void *userObject, const char *className) {
"No deallocator function found from PDX serializer for PdxWrapper");
}
- /* m_sizer can be NULL - required only if heap LRU is enabled */
+ /* m_sizer can be nullptr - required only if heap LRU is enabled */
m_sizer = m_serializer->getObjectSizer(className);
}
PdxWrapper::PdxWrapper(const char *className) {
- if (className != NULL) {
+ if (className != nullptr) {
m_className = Utils::copyString(className);
} else {
LOGERROR("Class name not provided to PdxWrapper for deserialization");
@@ -84,7 +84,7 @@ PdxWrapper::PdxWrapper(const char *className) {
m_deallocator = m_serializer->getDeallocator(className);
- if (m_deallocator == NULL) {
+ if (m_deallocator == nullptr) {
LOGERROR(
"No deallocator function found from PDX serializer for PdxWrapper "
"deserialization for %s",
@@ -94,7 +94,7 @@ PdxWrapper::PdxWrapper(const char *className) {
"deserialization");
}
- /* m_sizer can be NULL - required only if heap LRU is enabled */
+ /* m_sizer can be nullptr - required only if heap LRU is enabled */
m_sizer = m_serializer->getObjectSizer(className);
/* adongre - Coverity II
@@ -106,7 +106,7 @@ PdxWrapper::PdxWrapper(const char *className) {
void *PdxWrapper::getObject(bool detach) {
void *retVal = m_userObject;
if (detach) {
- m_userObject = NULL;
+ m_userObject = nullptr;
}
return retVal;
}
@@ -118,7 +118,7 @@ const char *PdxWrapper::getClassName() const {
bool PdxWrapper::operator==(const CacheableKey &other) const {
PdxWrapper *wrapper =
dynamic_cast<PdxWrapper *>(const_cast<CacheableKey *>(&other));
- if (wrapper == NULL) {
+ if (wrapper == nullptr) {
return false;
}
return (intptr_t)m_userObject == (intptr_t)wrapper->m_userObject;
@@ -130,12 +130,12 @@ int32_t PdxWrapper::hashcode() const {
}
void PdxWrapper::toData(PdxWriterPtr output) {
- if (m_userObject != NULL) {
+ if (m_userObject != nullptr) {
m_serializer->toData(m_userObject, (const char *)m_className, output);
} else {
- LOGERROR("User object is NULL or detached in PdxWrapper toData");
+ LOGERROR("User object is nullptr or detached in PdxWrapper toData");
throw IllegalStateException(
- "User object is NULL or detached in PdxWrapper toData");
+ "User object is nullptr or detached in PdxWrapper toData");
}
}
@@ -154,7 +154,7 @@ Serializable *PdxWrapper::fromData(DataInput &input) {
}
uint32_t PdxWrapper::objectSize() const {
- if (m_sizer == NULL || m_userObject == NULL) {
+ if (m_sizer == nullptr || m_userObject == nullptr) {
return 0;
} else {
return m_sizer(m_userObject, (const char *)m_className);
@@ -168,7 +168,7 @@ CacheableStringPtr PdxWrapper::toString() const {
}
PdxWrapper::~PdxWrapper() {
- if (m_userObject != NULL) {
+ if (m_userObject != nullptr) {
m_deallocator(m_userObject, (const char *)m_className);
}
delete[] m_className;
http://git-wip-us.apache.org/repos/asf/geode-native/blob/11467dd9/src/cppcache/src/PdxWriterWithTypeCollector.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/PdxWriterWithTypeCollector.cpp b/src/cppcache/src/PdxWriterWithTypeCollector.cpp
index ab01cb2..f60fc53 100644
--- a/src/cppcache/src/PdxWriterWithTypeCollector.cpp
+++ b/src/cppcache/src/PdxWriterWithTypeCollector.cpp
@@ -35,7 +35,7 @@ PdxWriterWithTypeCollector::PdxWriterWithTypeCollector() {}
PdxWriterWithTypeCollector::PdxWriterWithTypeCollector(
DataOutput& output, const char* domainClassName)
- : PdxLocalWriter(output, NULL) {
+ : PdxLocalWriter(output, nullptr) {
m_domainClassName = domainClassName;
initialize();
}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/11467dd9/src/cppcache/src/Pool.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/Pool.cpp b/src/cppcache/src/Pool.cpp
index be14fb0..d2effd0 100644
--- a/src/cppcache/src/Pool.cpp
+++ b/src/cppcache/src/Pool.cpp
@@ -73,7 +73,7 @@ RegionServicePtr Pool::createSecureUserCache(PropertiesPtr credentials) {
if (this->getMultiuserAuthentication()) {
CachePtr realCache = CacheFactory::getAnyInstance();
- if (!(realCache != nullptr && realCache->m_cacheImpl != NULL)) {
+ if (!(realCache != nullptr && realCache->m_cacheImpl != nullptr)) {
throw IllegalStateException("cache has not been created yet.");
;
}
@@ -82,7 +82,7 @@ RegionServicePtr Pool::createSecureUserCache(PropertiesPtr credentials) {
throw IllegalStateException("cache has been closed. ");
}
- if (credentials != nullptr && credentials.get() == NULL) {
+ if (credentials != nullptr && credentials.get() == nullptr) {
LOGDEBUG("Pool::createSecureUserCache creds are null");
credentials = nullptr;
}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/11467dd9/src/cppcache/src/PoolAttributes.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/PoolAttributes.cpp b/src/cppcache/src/PoolAttributes.cpp
index 80d5879..fda231a 100644
--- a/src/cppcache/src/PoolAttributes.cpp
+++ b/src/cppcache/src/PoolAttributes.cpp
@@ -117,11 +117,11 @@ bool PoolAttributes::compareVectorOfStrings(
int32_t PoolAttributes::compareStringAttribute(const char* attributeA,
const char* attributeB) {
- if (attributeA == NULL && attributeB == NULL) {
+ if (attributeA == nullptr && attributeB == nullptr) {
return 0;
- } else if (attributeA == NULL && attributeB != NULL) {
+ } else if (attributeA == nullptr && attributeB != nullptr) {
return -1;
- } else if (attributeA != NULL && attributeB == NULL) {
+ } else if (attributeA != nullptr && attributeB == nullptr) {
return -1;
}
return (strcmp(attributeA, attributeB));
http://git-wip-us.apache.org/repos/asf/geode-native/blob/11467dd9/src/cppcache/src/PoolFactory.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/PoolFactory.cpp b/src/cppcache/src/PoolFactory.cpp
index 36bde60..aa5f9b1 100644
--- a/src/cppcache/src/PoolFactory.cpp
+++ b/src/cppcache/src/PoolFactory.cpp
@@ -122,7 +122,7 @@ PoolPtr PoolFactory::create(const char* name) {
// Create a clone of Attr;
PoolAttributesPtr copyAttrs = m_attrs->clone();
- if (CacheImpl::getInstance() == NULL) {
+ if (CacheImpl::getInstance() == nullptr) {
throw IllegalStateException("Cache has not been created.");
}
@@ -172,8 +172,7 @@ PoolPtr PoolFactory::create(const char* name) {
}
}
- connectionPools->insert(CacheableString::create(name),
- std::static_pointer_cast<GF_UNWRAP_SP(PoolPtr)>(poolDM));
+ connectionPools->insert({name, std::static_pointer_cast<Pool>(poolDM)});
}
// TODO: poolDM->init() should not throw exceptions!
@@ -182,7 +181,7 @@ PoolPtr PoolFactory::create(const char* name) {
poolDM->init();
}
- return std::static_pointer_cast<GF_UNWRAP_SP(PoolPtr)>(poolDM);
+ return std::static_pointer_cast<Pool>(poolDM);
}
void PoolFactory::addCheck(const char* host, int port) {
http://git-wip-us.apache.org/repos/asf/geode-native/blob/11467dd9/src/cppcache/src/PoolManager.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/PoolManager.cpp b/src/cppcache/src/PoolManager.cpp
index acad2d8..49a6425 100644
--- a/src/cppcache/src/PoolManager.cpp
+++ b/src/cppcache/src/PoolManager.cpp
@@ -21,18 +21,18 @@
using namespace apache::geode::client;
// TODO: make this a member of TcrConnectionManager.
-HashMapOfPools* connectionPools = NULL; /*new HashMapOfPools( )*/
+HashMapOfPools* connectionPools = nullptr; /*new HashMapOfPools( )*/
ACE_Recursive_Thread_Mutex connectionPoolsLock;
void removePool(const char* name) {
ACE_Guard<ACE_Recursive_Thread_Mutex> guard(connectionPoolsLock);
- connectionPools->erase(CacheableString::create(name));
+ connectionPools->erase(name);
}
PoolFactoryPtr PoolManager::createFactory() {
- if (connectionPools == NULL) {
+ if (connectionPools == nullptr) {
ACE_Guard<ACE_Recursive_Thread_Mutex> guard(connectionPoolsLock);
- if (connectionPools == NULL) {
+ if (connectionPools == nullptr) {
connectionPools = new HashMapOfPools();
}
}
@@ -42,20 +42,18 @@ PoolFactoryPtr PoolManager::createFactory() {
void PoolManager::close(bool keepAlive) {
ACE_Guard<ACE_Recursive_Thread_Mutex> guard(connectionPoolsLock);
- if (connectionPools == NULL) {
+ if (connectionPools == nullptr) {
return;
}
std::vector<PoolPtr> poolsList;
- for (HashMapOfPools::Iterator iter = connectionPools->begin();
- iter != connectionPools->end(); ++iter) {
- poolsList.push_back(iter.second());
+ for (const auto& c : *connectionPools) {
+ poolsList.push_back(c.second);
}
- for (std::vector<PoolPtr>::iterator iter = poolsList.begin();
- iter != poolsList.end(); ++iter) {
- (*iter)->destroy(keepAlive);
+ for (const auto& iter : poolsList) {
+ iter->destroy(keepAlive);
}
GF_SAFE_DELETE(connectionPools);
@@ -64,18 +62,17 @@ void PoolManager::close(bool keepAlive) {
PoolPtr PoolManager::find(const char* name) {
ACE_Guard<ACE_Recursive_Thread_Mutex> guard(connectionPoolsLock);
- if (connectionPools == NULL) {
+ if (connectionPools == nullptr) {
connectionPools = new HashMapOfPools();
}
if (name) {
- HashMapOfPools::Iterator iter =
- connectionPools->find(CacheableString::create(name));
+ const auto& iter = connectionPools->find(name);
PoolPtr poolPtr = nullptr;
if (iter != connectionPools->end()) {
- poolPtr = iter.second();
+ poolPtr = iter->second;
GF_DEV_ASSERT(poolPtr != nullptr);
}
@@ -90,9 +87,9 @@ PoolPtr PoolManager::find(RegionPtr region) {
}
const HashMapOfPools& PoolManager::getAll() {
- if (connectionPools == NULL) {
+ if (connectionPools == nullptr) {
ACE_Guard<ACE_Recursive_Thread_Mutex> guard(connectionPoolsLock);
- if (connectionPools == NULL) {
+ if (connectionPools == nullptr) {
connectionPools = new HashMapOfPools();
}
}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/11467dd9/src/cppcache/src/PoolStatistics.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/PoolStatistics.cpp b/src/cppcache/src/PoolStatistics.cpp
index 6c296aa..c7f2b0d 100644
--- a/src/cppcache/src/PoolStatistics.cpp
+++ b/src/cppcache/src/PoolStatistics.cpp
@@ -33,15 +33,15 @@ using namespace apache::geode::statistics;
////////////////////////////////////////////////////////////////////////////////
-PoolStatType* PoolStatType::single = NULL;
+PoolStatType* PoolStatType::single = nullptr;
SpinLock PoolStatType::m_singletonLock;
SpinLock PoolStatType::m_statTypeLock;
void PoolStatType::clean() {
SpinLockGuard guard(m_singletonLock);
- if (single != NULL) {
+ if (single != nullptr) {
delete single;
- single = NULL;
+ single = nullptr;
}
}
@@ -52,7 +52,7 @@ StatisticsType* PoolStatType::getStatType() {
StatisticsType* statsType = factory->findType("PoolStatistics");
- if (statsType == NULL) {
+ if (statsType == nullptr) {
m_stats[0] = factory->createIntGauge(
"locators", "Current number of locators discovered", "locators");
m_stats[1] = factory->createIntGauge(
@@ -180,7 +180,7 @@ StatisticsType* PoolStatType::getStatType() {
PoolStatType* PoolStatType::getInstance() {
SpinLockGuard guard(m_singletonLock);
- if (single == NULL) {
+ if (single == nullptr) {
single = new PoolStatType();
}
return single;
@@ -224,7 +224,7 @@ PoolStats::PoolStats(const char* poolName) {
StatisticsType* statsType = poolStatType->getStatType();
- GF_D_ASSERT(statsType != NULL);
+ GF_D_ASSERT(statsType != nullptr);
StatisticsFactory* factory = StatisticsFactory::getExistingInstance();
@@ -290,8 +290,8 @@ PoolStats::PoolStats(const char* poolName) {
}
PoolStats::~PoolStats() {
- if (m_poolStats != NULL) {
- m_poolStats = NULL;
+ if (m_poolStats != nullptr) {
+ m_poolStats = nullptr;
}
}
} // namespace client
http://git-wip-us.apache.org/repos/asf/geode-native/blob/11467dd9/src/cppcache/src/PoolXmlCreation.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/PoolXmlCreation.hpp b/src/cppcache/src/PoolXmlCreation.hpp
index d308b7e..c6a3446 100644
--- a/src/cppcache/src/PoolXmlCreation.hpp
+++ b/src/cppcache/src/PoolXmlCreation.hpp
@@ -41,7 +41,7 @@ class Cache;
class CPPCACHE_EXPORT PoolXmlCreation {
private:
/** An <code>AttributesFactory</code> for creating default
- * <code>PoolAttribute</code>s */
+ * <code>PoolAttribute</code>s */
PoolFactoryPtr poolFactory;
/** The name of this pool */
@@ -73,7 +73,7 @@ class CPPCACHE_EXPORT PoolXmlCreation {
*
* @throws OutOfMemoryException if the memory allocation failed
* @throws NotConnectedException if the cache is not connected
- * @throws InvalidArgumentException if the attributePtr is NULL.
+ * @throws InvalidArgumentException if the attributePtr is nullptr.
* or if PoolAttributes is null or if poolName is null or
* the empty string
* @throws PoolExistsException
http://git-wip-us.apache.org/repos/asf/geode-native/blob/11467dd9/src/cppcache/src/PreservedDataExpiryHandler.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/PreservedDataExpiryHandler.cpp b/src/cppcache/src/PreservedDataExpiryHandler.cpp
index be41284..550edf6 100644
--- a/src/cppcache/src/PreservedDataExpiryHandler.cpp
+++ b/src/cppcache/src/PreservedDataExpiryHandler.cpp
@@ -40,23 +40,15 @@ PreservedDataExpiryHandler::PreservedDataExpiryHandler(
int PreservedDataExpiryHandler::handle_timeout(
const ACE_Time_Value& current_time, const void* arg) {
WriteGuard guard(PdxTypeRegistry::getPreservedDataLock());
+ auto map = PdxTypeRegistry::getPreserveDataMap();
LOGDEBUG(
"Entered PreservedDataExpiryHandler "
"PdxTypeRegistry::getPreserveDataMap().size() = %d",
- PdxTypeRegistry::getPreserveDataMap().size());
+ map.size());
try {
// remove the entry from the map
- if (PdxTypeRegistry::getPreserveDataMap().contains(m_pdxObjectPtr)) {
- PdxTypeRegistry::getPreserveDataMap().erase(m_pdxObjectPtr);
- LOGDEBUG(
- "PreservedDataExpiry:: preserveData erased entry from map updated "
- "size = %d",
- PdxTypeRegistry::getPreserveDataMap().size());
- } else {
- LOGDEBUG("PreservedDataExpiry:: preserveData does not contains Entry");
- }
-
+ map.erase(m_pdxObjectPtr);
} catch (...) {
// Ignore whatever exception comes
LOGDEBUG(
http://git-wip-us.apache.org/repos/asf/geode-native/blob/11467dd9/src/cppcache/src/Properties.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/Properties.cpp b/src/cppcache/src/Properties.cpp
index a381653..8bf09d6 100644
--- a/src/cppcache/src/Properties.cpp
+++ b/src/cppcache/src/Properties.cpp
@@ -79,15 +79,15 @@ Properties::Properties() : Serializable() {
MAP->open();
}
Properties::~Properties() {
- if (m_map != NULL) {
+ if (m_map != nullptr) {
delete MAP;
- m_map = NULL;
+ m_map = nullptr;
}
}
/** this return value must be stored in a CacheableStringPtr. */
CacheableStringPtr Properties::find(const char* key) {
- if (key == NULL) {
+ if (key == nullptr) {
throw NullPointerException("Properties::find: Null key given.");
}
CacheableStringPtr keyptr = CacheableString::create(key);
@@ -117,17 +117,18 @@ CacheablePtr Properties::find(const CacheableKeyPtr& key) {
}
void Properties::insert(const char* key, const char* value) {
- if (key == NULL) {
+ if (key == nullptr) {
throw NullPointerException("Properties::insert: Null key given.");
}
CacheableStringPtr keyptr = CacheableString::create(key);
- CacheableStringPtr valptr = (value == NULL ? CacheableString::create("")
- : CacheableString::create(value));
+ CacheableStringPtr valptr =
+ (value == nullptr ? CacheableString::create("")
+ : CacheableString::create(value));
MAP->rebind(keyptr, valptr);
}
void Properties::insert(const char* key, const int value) {
- if (key == NULL) {
+ if (key == nullptr) {
throw NullPointerException("Properties::insert: Null key given.");
}
char temp[64];
@@ -145,7 +146,7 @@ void Properties::insert(const CacheableKeyPtr& key, const CacheablePtr& value) {
}
void Properties::remove(const char* key) {
- if (key == NULL) {
+ if (key == nullptr) {
throw NullPointerException("Properties::remove: Null key given.");
}
CacheableStringPtr keyptr = CacheableString::create(key);
@@ -191,7 +192,7 @@ void Properties::addAll(const PropertiesPtr& other) {
}
void Properties::load(const char* fileName) {
- GF_R_ASSERT(fileName != NULL);
+ GF_R_ASSERT(fileName != nullptr);
PropertiesFile pf(*this);
pf.readFile(fileName);
}
@@ -201,7 +202,7 @@ PropertiesFile::PropertiesFile(Properties& props) : m_props(props) {}
void PropertiesFile::readFile(const std::string& fileName) {
char buf[8192];
FILE* fp = fopen(fileName.c_str(), "r");
- if (fp != NULL) {
+ if (fp != nullptr) {
size_t len = 0;
while ((len = fread(buf, 1, 8192, fp)) != 0) {
/* adongre
@@ -211,7 +212,7 @@ void PropertiesFile::readFile(const std::string& fileName) {
buf[len] = '\0';
char* tmp = buf;
char* line = 0;
- while ((line = nextBufferLine(&tmp, buf, len)) != NULL) {
+ while ((line = nextBufferLine(&tmp, buf, len)) != nullptr) {
parseLine(line);
}
}
@@ -291,14 +292,14 @@ void Properties::toData(DataOutput& output) const {
// changed
CacheableString* csPtr =
dynamic_cast<CacheableString*>(((*iter).ext_id_).get());
- if (csPtr == NULL) {
+ if (csPtr == nullptr) {
output.writeObject((*iter).ext_id_); // changed
} else {
output.writeNativeString(csPtr->asChar());
}
csPtr = dynamic_cast<CacheableString*>(((*iter).int_id_).get());
- if (csPtr == NULL) {
+ if (csPtr == nullptr) {
output.writeObject((*iter).int_id_); // changed
} else {
output.writeNativeString(csPtr->asChar());
http://git-wip-us.apache.org/repos/asf/geode-native/blob/11467dd9/src/cppcache/src/PutAllPartialResult.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/PutAllPartialResult.hpp b/src/cppcache/src/PutAllPartialResult.hpp
index 6240b09..91854a5 100644
--- a/src/cppcache/src/PutAllPartialResult.hpp
+++ b/src/cppcache/src/PutAllPartialResult.hpp
@@ -116,7 +116,7 @@ class PutAllPartialResult : public Serializable {
Serializable* fromData(DataInput& input) {
throw IllegalStateException(
"PutAllPartialResult::fromData is not intended for use.");
- return NULL;
+ return nullptr;
}
int32_t classId() const {
http://git-wip-us.apache.org/repos/asf/geode-native/blob/11467dd9/src/cppcache/src/PutAllPartialResultServerException.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/PutAllPartialResultServerException.cpp b/src/cppcache/src/PutAllPartialResultServerException.cpp
index 1585e70..6588bff 100644
--- a/src/cppcache/src/PutAllPartialResultServerException.cpp
+++ b/src/cppcache/src/PutAllPartialResultServerException.cpp
@@ -75,7 +75,7 @@ void PutAllPartialResultServerException::toData(DataOutput& output) const {
Serializable* PutAllPartialResultServerException::fromData(DataInput& input) {
throw IllegalStateException(
"PutAllPartialResultServerException::fromData is not intended for use.");
- return NULL;
+ return nullptr;
}
int32_t PutAllPartialResultServerException::classId() const {
http://git-wip-us.apache.org/repos/asf/geode-native/blob/11467dd9/src/cppcache/src/QueueConnectionRequest.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/QueueConnectionRequest.cpp b/src/cppcache/src/QueueConnectionRequest.cpp
index d6164c3..d2e2ddc 100644
--- a/src/cppcache/src/QueueConnectionRequest.cpp
+++ b/src/cppcache/src/QueueConnectionRequest.cpp
@@ -37,7 +37,7 @@ void QueueConnectionRequest::toData(DataOutput& output) const {
QueueConnectionRequest* QueueConnectionRequest::fromData(
DataInput& input) // NOt needed as of now.
{
- return NULL;
+ return nullptr;
}
int8_t QueueConnectionRequest::typeId() const {
return static_cast<int8_t>(GeodeTypeIdsImpl::QueueConnectionRequest);
http://git-wip-us.apache.org/repos/asf/geode-native/blob/11467dd9/src/cppcache/src/RegionAttributes.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/RegionAttributes.cpp b/src/cppcache/src/RegionAttributes.cpp
index 6eee620..256dc89 100644
--- a/src/cppcache/src/RegionAttributes.cpp
+++ b/src/cppcache/src/RegionAttributes.cpp
@@ -49,22 +49,22 @@ RegionAttributes::RegionAttributes()
m_initialCapacity(10000),
m_loadFactor(0.75),
m_concurrencyLevel(16),
- m_cacheLoaderLibrary(NULL),
- m_cacheWriterLibrary(NULL),
- m_cacheListenerLibrary(NULL),
- m_partitionResolverLibrary(NULL),
- m_cacheLoaderFactory(NULL),
- m_cacheWriterFactory(NULL),
- m_cacheListenerFactory(NULL),
- m_partitionResolverFactory(NULL),
+ m_cacheLoaderLibrary(nullptr),
+ m_cacheWriterLibrary(nullptr),
+ m_cacheListenerLibrary(nullptr),
+ m_partitionResolverLibrary(nullptr),
+ m_cacheLoaderFactory(nullptr),
+ m_cacheWriterFactory(nullptr),
+ m_cacheListenerFactory(nullptr),
+ m_partitionResolverFactory(nullptr),
m_diskPolicy(DiskPolicyType::NONE),
- m_endpoints(NULL),
+ m_endpoints(nullptr),
m_clientNotificationEnabled(false),
- m_persistenceLibrary(NULL),
- m_persistenceFactory(NULL),
+ m_persistenceLibrary(nullptr),
+ m_persistenceFactory(nullptr),
m_persistenceProperties(nullptr),
m_persistenceManager(nullptr),
- m_poolName(NULL),
+ m_poolName(nullptr),
m_isClonable(false),
m_isConcurrencyChecksEnabled(true) {}
@@ -97,99 +97,99 @@ RegionAttributes::RegionAttributes(const RegionAttributes& rhs)
m_persistenceManager(rhs.m_persistenceManager),
m_isClonable(rhs.m_isClonable),
m_isConcurrencyChecksEnabled(rhs.m_isConcurrencyChecksEnabled) {
- if (rhs.m_cacheLoaderLibrary != NULL) {
+ if (rhs.m_cacheLoaderLibrary != nullptr) {
size_t len = strlen(rhs.m_cacheLoaderLibrary) + 1;
m_cacheLoaderLibrary = new char[len];
ACE_OS::strncpy(m_cacheLoaderLibrary, rhs.m_cacheLoaderLibrary, len);
} else {
- m_cacheLoaderLibrary = NULL;
+ m_cacheLoaderLibrary = nullptr;
}
- if (rhs.m_cacheWriterLibrary != NULL) {
+ if (rhs.m_cacheWriterLibrary != nullptr) {
size_t len = strlen(rhs.m_cacheWriterLibrary) + 1;
m_cacheWriterLibrary = new char[len];
ACE_OS::strncpy(m_cacheWriterLibrary, rhs.m_cacheWriterLibrary, len);
} else {
- m_cacheWriterLibrary = NULL;
+ m_cacheWriterLibrary = nullptr;
}
- if (rhs.m_cacheListenerLibrary != NULL) {
+ if (rhs.m_cacheListenerLibrary != nullptr) {
size_t len = strlen(rhs.m_cacheListenerLibrary) + 1;
m_cacheListenerLibrary = new char[len];
ACE_OS::strncpy(m_cacheListenerLibrary, rhs.m_cacheListenerLibrary, len);
} else {
- m_cacheListenerLibrary = NULL;
+ m_cacheListenerLibrary = nullptr;
}
- if (rhs.m_partitionResolverLibrary != NULL) {
+ if (rhs.m_partitionResolverLibrary != nullptr) {
size_t len = strlen(rhs.m_partitionResolverLibrary) + 1;
m_partitionResolverLibrary = new char[len];
ACE_OS::strncpy(m_partitionResolverLibrary, rhs.m_partitionResolverLibrary,
len);
} else {
- m_partitionResolverLibrary = NULL;
+ m_partitionResolverLibrary = nullptr;
}
- if (rhs.m_cacheLoaderFactory != NULL) {
+ if (rhs.m_cacheLoaderFactory != nullptr) {
size_t len = strlen(rhs.m_cacheLoaderFactory) + 1;
m_cacheLoaderFactory = new char[len];
ACE_OS::strncpy(m_cacheLoaderFactory, rhs.m_cacheLoaderFactory, len);
} else {
- m_cacheLoaderFactory = NULL;
+ m_cacheLoaderFactory = nullptr;
}
- if (rhs.m_cacheWriterFactory != NULL) {
+ if (rhs.m_cacheWriterFactory != nullptr) {
size_t len = strlen(rhs.m_cacheWriterFactory) + 1;
m_cacheWriterFactory = new char[len];
ACE_OS::strncpy(m_cacheWriterFactory, rhs.m_cacheWriterFactory, len);
} else {
- m_cacheWriterFactory = NULL;
+ m_cacheWriterFactory = nullptr;
}
- if (rhs.m_cacheListenerFactory != NULL) {
+ if (rhs.m_cacheListenerFactory != nullptr) {
size_t len = strlen(rhs.m_cacheListenerFactory) + 1;
m_cacheListenerFactory = new char[len];
ACE_OS::strncpy(m_cacheListenerFactory, rhs.m_cacheListenerFactory, len);
} else {
- m_cacheListenerFactory = NULL;
+ m_cacheListenerFactory = nullptr;
}
- if (rhs.m_partitionResolverFactory != NULL) {
+ if (rhs.m_partitionResolverFactory != nullptr) {
size_t len = strlen(rhs.m_partitionResolverFactory) + 1;
m_partitionResolverFactory = new char[len];
ACE_OS::strncpy(m_partitionResolverFactory, rhs.m_partitionResolverFactory,
len);
} else {
- m_partitionResolverFactory = NULL;
+ m_partitionResolverFactory = nullptr;
}
- if (rhs.m_endpoints != NULL) {
+ if (rhs.m_endpoints != nullptr) {
size_t len = strlen(rhs.m_endpoints) + 1;
m_endpoints = new char[len];
ACE_OS::strncpy(m_endpoints, rhs.m_endpoints, len);
} else {
- m_endpoints = NULL;
+ m_endpoints = nullptr;
}
- if (rhs.m_poolName != NULL) {
+ if (rhs.m_poolName != nullptr) {
size_t len = strlen(rhs.m_poolName) + 1;
m_poolName = new char[len];
ACE_OS::strncpy(m_poolName, rhs.m_poolName, len);
} else {
- m_poolName = NULL;
+ m_poolName = nullptr;
}
- if (rhs.m_persistenceLibrary != NULL) {
+ if (rhs.m_persistenceLibrary != nullptr) {
size_t len = strlen(rhs.m_persistenceLibrary) + 1;
m_persistenceLibrary = new char[len];
ACE_OS::strncpy(m_persistenceLibrary, rhs.m_persistenceLibrary, len);
} else {
- m_persistenceLibrary = NULL;
+ m_persistenceLibrary = nullptr;
}
- if (rhs.m_persistenceFactory != NULL) {
+ if (rhs.m_persistenceFactory != nullptr) {
size_t len = strlen(rhs.m_persistenceFactory) + 1;
m_persistenceFactory = new char[len];
ACE_OS::strncpy(m_persistenceFactory, rhs.m_persistenceFactory, len);
} else {
- m_persistenceFactory = NULL;
+ m_persistenceFactory = nullptr;
}
}
#define RA_DELSTRING(x) \
- if (x != NULL) { \
+ if (x != nullptr) { \
delete[] x; \
} \
- x = NULL
+ x = nullptr
RegionAttributes::~RegionAttributes() {
RA_DELSTRING(m_cacheLoaderLibrary);
@@ -226,7 +226,7 @@ void* getFactoryFunc(const char* lib, const char* funcName) {
throw IllegalArgumentException(msg);
}
void* func = dll.symbol(funcName);
- if (func == NULL) {
+ if (func == nullptr) {
char msg[1000];
ACE_OS::snprintf(msg, 1000, "cannot find factory function %s in library %s",
funcName, lib);
@@ -240,9 +240,9 @@ void* getFactoryFunc(const char* lib, const char* funcName) {
} // namespace apache
CacheLoaderPtr RegionAttributes::getCacheLoader() {
- if ((m_cacheLoader == nullptr) && (m_cacheLoaderLibrary != NULL)) {
- if (CacheXmlParser::managedCacheLoaderFn != NULL &&
- strchr(m_cacheLoaderFactory, '.') != NULL) {
+ if ((m_cacheLoader == nullptr) && (m_cacheLoaderLibrary != nullptr)) {
+ if (CacheXmlParser::managedCacheLoaderFn != nullptr &&
+ strchr(m_cacheLoaderFactory, '.') != nullptr) {
// this is a managed library
m_cacheLoader.reset((*CacheXmlParser::managedCacheLoaderFn)(
m_cacheLoaderLibrary, m_cacheLoaderFactory));
@@ -258,9 +258,9 @@ CacheLoaderPtr RegionAttributes::getCacheLoader() {
}
CacheWriterPtr RegionAttributes::getCacheWriter() {
- if ((m_cacheWriter == nullptr) && (m_cacheWriterLibrary != NULL)) {
- if (CacheXmlParser::managedCacheWriterFn != NULL &&
- strchr(m_cacheWriterFactory, '.') != NULL) {
+ if ((m_cacheWriter == nullptr) && (m_cacheWriterLibrary != nullptr)) {
+ if (CacheXmlParser::managedCacheWriterFn != nullptr &&
+ strchr(m_cacheWriterFactory, '.') != nullptr) {
// this is a managed library
m_cacheWriter.reset((*CacheXmlParser::managedCacheWriterFn)(
m_cacheWriterLibrary, m_cacheWriterFactory));
@@ -276,9 +276,9 @@ CacheWriterPtr RegionAttributes::getCacheWriter() {
}
CacheListenerPtr RegionAttributes::getCacheListener() {
- if ((m_cacheListener == nullptr) && (m_cacheListenerLibrary != NULL)) {
- if (CacheXmlParser::managedCacheListenerFn != NULL &&
- strchr(m_cacheListenerFactory, '.') != NULL) {
+ if ((m_cacheListener == nullptr) && (m_cacheListenerLibrary != nullptr)) {
+ if (CacheXmlParser::managedCacheListenerFn != nullptr &&
+ strchr(m_cacheListenerFactory, '.') != nullptr) {
// LOGDEBUG( "RegionAttributes::getCacheListener: Trying to create
// instance from managed library." );
// this is a managed library
@@ -297,9 +297,9 @@ CacheListenerPtr RegionAttributes::getCacheListener() {
PartitionResolverPtr RegionAttributes::getPartitionResolver() {
if ((m_partitionResolver == nullptr) &&
- (m_partitionResolverLibrary != NULL)) {
- if (CacheXmlParser::managedPartitionResolverFn != NULL &&
- strchr(m_partitionResolverFactory, '.') != NULL) {
+ (m_partitionResolverLibrary != nullptr)) {
+ if (CacheXmlParser::managedPartitionResolverFn != nullptr &&
+ strchr(m_partitionResolverFactory, '.') != nullptr) {
// LOGDEBUG( "RegionAttributes::getCacheListener: Trying to create
// instance from managed library." );
// this is a managed library
@@ -317,9 +317,9 @@ PartitionResolverPtr RegionAttributes::getPartitionResolver() {
}
PersistenceManagerPtr RegionAttributes::getPersistenceManager() {
- if ((m_persistenceManager == nullptr) && (m_persistenceLibrary != NULL)) {
- if (CacheXmlParser::managedPartitionResolverFn != NULL &&
- strchr(m_persistenceFactory, '.') != NULL) {
+ if ((m_persistenceManager == nullptr) && (m_persistenceLibrary != nullptr)) {
+ if (CacheXmlParser::managedPartitionResolverFn != nullptr &&
+ strchr(m_persistenceFactory, '.') != nullptr) {
LOGDEBUG(
"RegionAttributes::getPersistenceManager: Trying to create instance "
"from managed library.");
@@ -453,7 +453,7 @@ void readBool(DataInput& in, bool* field) {
}
void writeCharStar(DataOutput& out, const char* field) {
- if (field == NULL) {
+ if (field == nullptr) {
out.writeBytes(reinterpret_cast<const int8_t*>(""),
static_cast<uint32_t>(0));
} else {
@@ -463,7 +463,7 @@ void writeCharStar(DataOutput& out, const char* field) {
/** this one allocates the memory and modifies field to point to it. */
void readCharStar(DataInput& in, char** field) {
- GF_D_ASSERT(*field == NULL);
+ GF_D_ASSERT(*field == nullptr);
int32_t memlen = 0;
in.readArrayLen(&memlen);
if (memlen != 0) {
@@ -635,11 +635,11 @@ bool RegionAttributes::operator==(const RegionAttributes& other) const {
int32_t RegionAttributes::compareStringAttribute(char* attributeA,
char* attributeB) {
- if (attributeA == NULL && attributeB == NULL) {
+ if (attributeA == nullptr && attributeB == nullptr) {
return 0;
- } else if (attributeA == NULL && attributeB != NULL) {
+ } else if (attributeA == nullptr && attributeB != nullptr) {
return -1;
- } else if (attributeA != NULL && attributeB == NULL) {
+ } else if (attributeA != nullptr && attributeB == nullptr) {
return -1;
}
return (strcmp(attributeA, attributeB));
@@ -681,37 +681,37 @@ void RegionAttributes::validateSerializableAttributes() {
}
void RegionAttributes::setCacheListener(const char* lib, const char* func) {
- GF_R_ASSERT(lib != NULL);
- GF_R_ASSERT(func != NULL);
+ GF_R_ASSERT(lib != nullptr);
+ GF_R_ASSERT(func != nullptr);
copyStringAttribute(m_cacheListenerLibrary, lib);
copyStringAttribute(m_cacheListenerFactory, func);
}
void RegionAttributes::setPartitionResolver(const char* lib, const char* func) {
- GF_R_ASSERT(lib != NULL);
- GF_R_ASSERT(func != NULL);
+ GF_R_ASSERT(lib != nullptr);
+ GF_R_ASSERT(func != nullptr);
copyStringAttribute(m_partitionResolverLibrary, lib);
copyStringAttribute(m_partitionResolverFactory, func);
}
void RegionAttributes::setCacheLoader(const char* lib, const char* func) {
- GF_R_ASSERT(lib != NULL);
- GF_R_ASSERT(func != NULL);
+ GF_R_ASSERT(lib != nullptr);
+ GF_R_ASSERT(func != nullptr);
copyStringAttribute(m_cacheLoaderLibrary, lib);
copyStringAttribute(m_cacheLoaderFactory, func);
}
void RegionAttributes::setCacheWriter(const char* lib, const char* func) {
- GF_R_ASSERT(lib != NULL);
- GF_R_ASSERT(func != NULL);
+ GF_R_ASSERT(lib != nullptr);
+ GF_R_ASSERT(func != nullptr);
copyStringAttribute(m_cacheWriterLibrary, lib);
copyStringAttribute(m_cacheWriterFactory, func);
}
void RegionAttributes::setPersistenceManager(const char* lib, const char* func,
const PropertiesPtr& config) {
- GF_R_ASSERT(lib != NULL);
- GF_R_ASSERT(func != NULL);
+ GF_R_ASSERT(lib != nullptr);
+ GF_R_ASSERT(func != nullptr);
copyStringAttribute(m_persistenceLibrary, lib);
copyStringAttribute(m_persistenceFactory, func);
m_persistenceProperties = config;
@@ -735,7 +735,7 @@ void RegionAttributes::setDiskPolicy(DiskPolicyType::PolicyType diskPolicy) {
}
void RegionAttributes::copyStringAttribute(char*& lhs, const char* rhs) {
- if (lhs != NULL) {
+ if (lhs != nullptr) {
delete[] lhs;
}
lhs = Utils::copyString(rhs);
http://git-wip-us.apache.org/repos/asf/geode-native/blob/11467dd9/src/cppcache/src/RegionFactory.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/RegionFactory.cpp b/src/cppcache/src/RegionFactory.cpp
index cd40cef..a25b7e3 100644
--- a/src/cppcache/src/RegionFactory.cpp
+++ b/src/cppcache/src/RegionFactory.cpp
@@ -49,7 +49,7 @@ RegionPtr RegionFactory::create(const char* name) {
RegionAttributesPtr regAttr = m_attributeFactory->createRegionAttributes();
// assuming pool name is not DEFAULT_POOL_NAME
- if (regAttr->getPoolName() != NULL && strlen(regAttr->getPoolName()) > 0) {
+ if (regAttr->getPoolName() != nullptr && strlen(regAttr->getPoolName()) > 0) {
// poolname is set
CachePtr cache = CacheFactory::getAnyInstance();
CacheImpl* cacheImpl = CacheRegionHelper::getCacheImpl(cache.get());
http://git-wip-us.apache.org/repos/asf/geode-native/blob/11467dd9/src/cppcache/src/RegionInternal.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/RegionInternal.hpp b/src/cppcache/src/RegionInternal.hpp
index 8478a29..bf5a5ee 100644
--- a/src/cppcache/src/RegionInternal.hpp
+++ b/src/cppcache/src/RegionInternal.hpp
@@ -117,15 +117,15 @@ class VersionTag;
typedef SharedPtr<VersionTag> VersionTagPtr;
_GF_PTR_DEF_(MapEntryImpl, MapEntryImplPtr);
/**
-* @class RegionInternal RegionInternal.hpp
-*
-* This class specifies internal common interface for all regions.
-*/
+ * @class RegionInternal RegionInternal.hpp
+ *
+ * This class specifies internal common interface for all regions.
+ */
class RegionInternal : public Region {
public:
/**
- * @brief destructor
- */
+ * @brief destructor
+ */
virtual ~RegionInternal();
/** @brief Default implementation of Public Methods from Region
*/
@@ -154,7 +154,7 @@ class RegionInternal : public Region {
const char* predicate, uint32_t timeout = DEFAULT_QUERY_RESPONSE_TIMEOUT);
/** @brief Public Methods
- */
+ */
virtual PersistenceManagerPtr getPersistenceManager() = 0;
virtual void setPersistenceManager(PersistenceManagerPtr& pmPtr) = 0;
@@ -171,7 +171,7 @@ class RegionInternal : public Region {
CacheablePtr& oldValue, int updateCount,
const CacheEventFlags eventFlags,
VersionTagPtr versionTag,
- DataInput* delta = NULL,
+ DataInput* delta = nullptr,
EventIdPtr eventId = nullptr) = 0;
virtual GfErrType createNoThrow(const CacheableKeyPtr& key,
const CacheablePtr& value,
@@ -252,8 +252,8 @@ class RegionInternal : public Region {
protected:
/**
- * @brief constructor
- */
+ * @brief constructor
+ */
RegionInternal(const RegionAttributesPtr& attributes);
void setLruEntriesLimit(uint32_t limit);
http://git-wip-us.apache.org/repos/asf/geode-native/blob/11467dd9/src/cppcache/src/RegionStats.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/RegionStats.cpp b/src/cppcache/src/RegionStats.cpp
index 19e0d56..26bebbd 100644
--- a/src/cppcache/src/RegionStats.cpp
+++ b/src/cppcache/src/RegionStats.cpp
@@ -36,15 +36,15 @@ using namespace apache::geode::statistics;
////////////////////////////////////////////////////////////////////////////////
-RegionStatType* RegionStatType::single = NULL;
+RegionStatType* RegionStatType::single = nullptr;
SpinLock RegionStatType::m_singletonLock;
SpinLock RegionStatType::m_statTypeLock;
void RegionStatType::clean() {
SpinLockGuard guard(m_singletonLock);
- if (single != NULL) {
+ if (single != nullptr) {
delete single;
- single = NULL;
+ single = nullptr;
}
}
@@ -56,7 +56,7 @@ StatisticsType* RegionStatType::getStatType() {
StatisticsType* statsType = factory->findType("RegionStatistics");
- if (statsType == NULL) {
+ if (statsType == nullptr) {
m_stats[0] = factory->createIntCounter(
"creates", "The total number of cache creates for this region",
"entries", largerIsBetter);
@@ -186,7 +186,7 @@ StatisticsType* RegionStatType::getStatType() {
RegionStatType* RegionStatType::getInstance() {
SpinLockGuard guard(m_singletonLock);
- if (single == NULL) {
+ if (single == nullptr) {
single = new RegionStatType();
}
return single;
@@ -205,7 +205,7 @@ RegionStats::RegionStats(const char* regionName) {
StatisticsType* statsType = regStatType->getStatType();
- GF_D_ASSERT(statsType != NULL);
+ GF_D_ASSERT(statsType != nullptr);
StatisticsFactory* factory = StatisticsFactory::getExistingInstance();
@@ -266,10 +266,10 @@ RegionStats::RegionStats(const char* regionName) {
}
RegionStats::~RegionStats() {
- if (m_regionStats != NULL) {
- // Don't Delete, Already closed, Just set NULL
+ if (m_regionStats != nullptr) {
+ // Don't Delete, Already closed, Just set nullptr
// delete m_regionStats;
- m_regionStats = NULL;
+ m_regionStats = nullptr;
}
}
} // namespace client