You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by jb...@apache.org on 2018/03/29 11:41:28 UTC
[geode-native] 02/15: Fixes cppcache warnings on Windows.
This is an automated email from the ASF dual-hosted git repository.
jbarrett pushed a commit to branch feature/GEODE-4946-msvc-warn
in repository https://gitbox.apache.org/repos/asf/geode-native.git
commit f76b216978a9a19fdb0081c2d1c7e2b626dd5e7a
Author: Jacob Barrett <jb...@pivotal.io>
AuthorDate: Tue Mar 27 15:28:56 2018 +0000
Fixes cppcache warnings on Windows.
---
CMakeLists.txt | 6 +
cppcache/include/geode/CacheableBuiltins.hpp | 47 +++----
cppcache/include/geode/ResultSet.hpp | 2 +-
cppcache/include/geode/SelectResults.hpp | 2 +-
cppcache/include/geode/Serializer.hpp | 5 +-
cppcache/include/geode/StructSet.hpp | 4 +-
cppcache/shared/CMakeLists.txt | 1 +
cppcache/src/CacheImpl.hpp | 14 +-
cppcache/src/ClientProxyMembershipID.cpp | 14 +-
cppcache/src/Connector.hpp | 8 +-
cppcache/src/DataInputInternal.hpp | 4 +-
cppcache/src/DiffieHellman.cpp | 33 +++--
cppcache/src/DiffieHellman.hpp | 8 +-
cppcache/src/DiskStoreId.hpp | 5 +-
cppcache/src/DiskVersionTag.hpp | 4 +-
cppcache/src/ExecutionImpl.cpp | 4 +-
cppcache/src/LocalRegion.cpp | 159 ++++++++++++----------
cppcache/src/MapSegment.cpp | 56 ++++----
cppcache/src/MapSegment.hpp | 42 +++---
cppcache/src/PdxInstanceImpl.cpp | 62 +++++----
cppcache/src/PdxLocalReader.cpp | 125 +++++++++--------
cppcache/src/PdxLocalWriter.cpp | 152 ++++++++++-----------
cppcache/src/PdxLocalWriter.hpp | 51 +++----
cppcache/src/PdxRemoteReader.cpp | 17 ++-
cppcache/src/PdxWriterWithTypeCollector.cpp | 103 +++++++-------
cppcache/src/ResultSetImpl.cpp | 3 +-
cppcache/src/ResultSetImpl.hpp | 5 +-
cppcache/src/Struct.cpp | 2 +-
cppcache/src/StructSetImpl.cpp | 11 +-
cppcache/src/StructSetImpl.hpp | 7 +-
cppcache/src/TcpConn.cpp | 20 +--
cppcache/src/TcpConn.hpp | 17 ++-
cppcache/src/TcpSslConn.cpp | 17 +--
cppcache/src/TcpSslConn.hpp | 8 +-
cppcache/src/TcrConnection.cpp | 61 ++++-----
cppcache/src/TcrConnection.hpp | 15 +-
cppcache/src/TcrMessage.cpp | 20 ++-
cppcache/src/TcrMessage.hpp | 4 +-
cppcache/src/ThinClientLocatorHelper.cpp | 54 ++++----
cppcache/src/ThinClientPoolDM.cpp | 21 +--
cppcache/src/ThinClientPoolDM.hpp | 8 +-
cppcache/src/ThinClientRegion.cpp | 28 ++--
cppcache/src/TombstoneList.cpp | 3 +-
cppcache/src/VersionedCacheableObjectPartList.cpp | 5 +-
cppcache/src/statistics/PoolStatsSampler.cpp | 10 +-
cppcache/src/statistics/StatArchiveWriter.cpp | 30 ++--
cppcache/static/CMakeLists.txt | 4 +-
cppcache/test/CMakeLists.txt | 7 +-
cppcache/test/DataInputTest.cpp | 8 +-
cppcache/test/DataOutputTest.cpp | 4 +-
cryptoimpl/DHImpl.cpp | 32 ++---
cryptoimpl/DHImpl.hpp | 4 +-
dhimpl/DHImpl.cpp | 36 ++---
dhimpl/DHImpl.hpp | 2 +-
templates/security/PkcsAuthInit.cpp | 5 +-
tests/cpp/fwklib/FrameworkTest.cpp | 8 +-
tests/cpp/fwklib/FwkObjects.hpp | 6 +-
tests/cpp/testobject/InvalidPdxUsage.cpp | 6 +-
tests/cpp/testobject/InvalidPdxUsage.hpp | 4 +-
tests/cpp/testobject/NonPdxType.cpp | 6 +-
tests/cpp/testobject/NonPdxType.hpp | 4 +-
tests/cpp/testobject/PdxClassV2.cpp | 1 -
tests/cpp/testobject/PdxType.cpp | 6 +-
tests/cpp/testobject/PdxType.hpp | 4 +-
tests/cpp/testobject/PdxVersioned1.cpp | 6 +-
tests/cpp/testobject/PdxVersioned1.hpp | 4 +-
tests/cpp/testobject/PdxVersioned2.cpp | 6 +-
tests/cpp/testobject/PdxVersioned2.hpp | 4 +-
68 files changed, 734 insertions(+), 710 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 0d8e74a..26a8fe0 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -168,6 +168,8 @@ target_compile_options(c++cli
# Interface for C++11 language
add_library(c++11 INTERFACE)
+# Interface for warning flags
+add_library(_WarningsAsError INTERFACE)
if(CMAKE_CXX_COMPILER_ID STREQUAL "SunPro")
# Force linker to error on undefined symbols in shared libraries
@@ -186,8 +188,12 @@ elseif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
elseif(CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
set(BUILD_CLI 1)
+ target_compile_options(_WarningsAsError INTERFACE /WX)
+
# TODO error on warnings
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4996")
+ set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /ignore:4099")
+ set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /ignore:4099")
# Enables multiprocess compiles
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP")
diff --git a/cppcache/include/geode/CacheableBuiltins.hpp b/cppcache/include/geode/CacheableBuiltins.hpp
index 34be344..26489e1 100644
--- a/cppcache/include/geode/CacheableBuiltins.hpp
+++ b/cppcache/include/geode/CacheableBuiltins.hpp
@@ -324,8 +324,7 @@ _GEODE_CACHEABLE_KEY_TYPE_(char16_t, CacheableCharacter, 3);
template <typename T, GeodeTypeIds::IdValues GeodeTypeId>
class _GEODE_EXPORT CacheableArray : public Cacheable {
-protected:
-
+ protected:
inline CacheableArray() = default;
CacheableArray(const CacheableArray& other) = delete;
@@ -337,30 +336,22 @@ protected:
virtual int32_t classId() const override { return 0; }
- virtual int8_t typeId() const override {
- return GeodeTypeId;
- }
+ virtual int8_t typeId() const override { return GeodeTypeId; }
virtual size_t objectSize() const override {
return static_cast<uint32_t>(
apache::geode::client::serializer::objectArraySize(m_value));
}
-private:
-
+ private:
_GEODE_FRIEND_STD_SHARED_PTR(CacheableArray)
std::vector<T> m_value;
-public:
-
- inline const std::vector<T>& value() const {
- return m_value;
- }
+ public:
+ inline const std::vector<T>& value() const { return m_value; }
- inline int32_t length() const {
- return m_value.size();
- }
+ inline int32_t length() const { return static_cast<int32_t>(m_value.size()); }
static std::shared_ptr<Serializable> createDeserializable() {
return std::make_shared<CacheableArray<T, GeodeTypeId>>();
@@ -383,7 +374,7 @@ public:
inline T operator[](uint32_t index) const {
if (static_cast<int32_t>(index) >= m_value.size()) {
throw OutOfRangeException(
- "CacheableArray::operator[]: Index out of range.");
+ "CacheableArray::operator[]: Index out of range.");
}
return m_value[index];
}
@@ -398,9 +389,9 @@ public:
};
/**
-* An immutable wrapper for byte arrays that can serve as
-* a distributable object for caching.
-*/
+ * An immutable wrapper for byte arrays that can serve as
+ * a distributable object for caching.
+ */
using CacheableBytes = CacheableArray<int8_t, GeodeTypeIds::CacheableBytes>;
/**
@@ -419,37 +410,43 @@ using CharArray = CacheableArray<char16_t, GeodeTypeIds::CharArray>;
* An immutable wrapper for array of doubles that can serve as
* a distributable object for caching.
*/
-using CacheableDoubleArray = CacheableArray<double, GeodeTypeIds::CacheableDoubleArray>;
+using CacheableDoubleArray =
+ CacheableArray<double, GeodeTypeIds::CacheableDoubleArray>;
/**
* An immutable wrapper for array of floats that can serve as
* a distributable object for caching.
*/
-using CacheableFloatArray = CacheableArray<float, GeodeTypeIds::CacheableFloatArray>;
+using CacheableFloatArray =
+ CacheableArray<float, GeodeTypeIds::CacheableFloatArray>;
/**
* An immutable wrapper for array of 16-bit integers that can serve as
* a distributable object for caching.
*/
-using CacheableInt16Array = CacheableArray<int16_t, GeodeTypeIds::CacheableInt16Array>;
+using CacheableInt16Array =
+ CacheableArray<int16_t, GeodeTypeIds::CacheableInt16Array>;
/**
* An immutable wrapper for array of 32-bit integers that can serve as
* a distributable object for caching.
*/
-using CacheableInt32Array = CacheableArray<int32_t, GeodeTypeIds::CacheableInt32Array>;
+using CacheableInt32Array =
+ CacheableArray<int32_t, GeodeTypeIds::CacheableInt32Array>;
/**
* An immutable wrapper for array of 64-bit integers that can serve as
* a distributable object for caching.
*/
-using CacheableInt64Array = CacheableArray<int64_t, GeodeTypeIds::CacheableInt64Array>;
+using CacheableInt64Array =
+ CacheableArray<int64_t, GeodeTypeIds::CacheableInt64Array>;
/**
* An immutable wrapper for array of strings that can serve as
* a distributable object for caching.
*/
-using CacheableStringArray = CacheableArray<std::shared_ptr<CacheableString>, GeodeTypeIds::CacheableStringArray>;
+using CacheableStringArray = CacheableArray<std::shared_ptr<CacheableString>,
+ GeodeTypeIds::CacheableStringArray>;
// Instantiations for container types (Vector/HashMap/HashSet) Cacheables
diff --git a/cppcache/include/geode/ResultSet.hpp b/cppcache/include/geode/ResultSet.hpp
index 665eb19..156b69c 100644
--- a/cppcache/include/geode/ResultSet.hpp
+++ b/cppcache/include/geode/ResultSet.hpp
@@ -52,7 +52,7 @@ class _GEODE_EXPORT ResultSet : public SelectResults {
*
* @returns the number of items in the ResultSet.
*/
- virtual int32_t size() const override = 0;
+ virtual size_t size() const override = 0;
/**
* Index operator to directly access an item in the ResultSet.
diff --git a/cppcache/include/geode/SelectResults.hpp b/cppcache/include/geode/SelectResults.hpp
index 9bdfd39..f5916c1 100644
--- a/cppcache/include/geode/SelectResults.hpp
+++ b/cppcache/include/geode/SelectResults.hpp
@@ -57,7 +57,7 @@ class _GEODE_EXPORT SelectResults {
*
* @returns the number of items in the SelectResults.
*/
- virtual int32_t size() const = 0;
+ virtual size_t size() const = 0;
/**
* Index operator to directly access an item in the SelectResults.
diff --git a/cppcache/include/geode/Serializer.hpp b/cppcache/include/geode/Serializer.hpp
index dc1fbc9..69e922e 100644
--- a/cppcache/include/geode/Serializer.hpp
+++ b/cppcache/include/geode/Serializer.hpp
@@ -223,14 +223,15 @@ inline void writeObject(apache::geode::client::DataOutput& output,
template <typename TObj>
inline void writeArrayObject(apache::geode::client::DataOutput& output,
const std::vector<TObj>& array) {
- output.writeArrayLen(array.size());
+ output.writeArrayLen(static_cast<int32_t>(array.size()));
for (auto&& obj : array) {
writeObject(output, obj);
}
}
template <typename TObj>
-inline std::vector<TObj> readArrayObject(apache::geode::client::DataInput& input) {
+inline std::vector<TObj> readArrayObject(
+ apache::geode::client::DataInput& input) {
std::vector<TObj> array;
int len = input.readArrayLen();
if (len >= 0) {
diff --git a/cppcache/include/geode/StructSet.hpp b/cppcache/include/geode/StructSet.hpp
index 677445d..70372db 100644
--- a/cppcache/include/geode/StructSet.hpp
+++ b/cppcache/include/geode/StructSet.hpp
@@ -54,7 +54,7 @@ class _GEODE_EXPORT StructSet : public CqResults {
*
* @returns the number of items in the StructSet.
*/
- virtual int32_t size() const = 0;
+ virtual size_t size() const = 0;
/**
* Index operator to directly access an item in the StructSet.
@@ -73,7 +73,7 @@ class _GEODE_EXPORT StructSet : public CqResults {
* @returns the index number of the specified field name.
* @throws std::invalid_argument if the field name is not found.
*/
- virtual const int32_t getFieldIndex(const std::string& fieldname) = 0;
+ virtual const size_t getFieldIndex(const std::string& fieldname) = 0;
/**
* Get the field name of the StructSet from the specified index number.
diff --git a/cppcache/shared/CMakeLists.txt b/cppcache/shared/CMakeLists.txt
index 779415c..bac2a1d 100644
--- a/cppcache/shared/CMakeLists.txt
+++ b/cppcache/shared/CMakeLists.txt
@@ -23,6 +23,7 @@ set_source_files_properties(${CONFIGURE_OUT_FILES} PROPERTIES GENERATED TRUE)
target_link_libraries(${PROJECT_NAME}
PRIVATE
_apache-geode
+ _WarningsAsError
PUBLIC
c++11)
diff --git a/cppcache/src/CacheImpl.hpp b/cppcache/src/CacheImpl.hpp
index 3ed5834..28c97fa 100644
--- a/cppcache/src/CacheImpl.hpp
+++ b/cppcache/src/CacheImpl.hpp
@@ -131,7 +131,9 @@ class _GEODE_EXPORT CacheImpl : private NonCopyable, private NonAssignable {
bool isClosed() const;
/** Get the <code>CacheAttributes</code> for this cache. */
- inline std::shared_ptr<CacheAttributes> getAttributes() const { return m_attributes; }
+ inline std::shared_ptr<CacheAttributes> getAttributes() const {
+ return m_attributes;
+ }
/** Set the <code>CacheAttributes</code> for this cache. */
void setAttributes(const std::shared_ptr<CacheAttributes>& attrs);
@@ -169,8 +171,7 @@ class _GEODE_EXPORT CacheImpl : private NonCopyable, private NonAssignable {
* @throws NotConnectedException if the cache is not connected
* @throws UnknownException otherwise
*/
- void createRegion(std::string name,
- RegionAttributes aRegionAttributes,
+ void createRegion(std::string name, RegionAttributes aRegionAttributes,
std::shared_ptr<Region>& regionPtr);
void getRegion(const std::string& path, std::shared_ptr<Region>& rptr);
@@ -290,7 +291,7 @@ class _GEODE_EXPORT CacheImpl : private NonCopyable, private NonAssignable {
}
virtual std::unique_ptr<DataInput> createDataInput(const uint8_t* buffer,
- int32_t len) const {
+ size_t len) const {
return std::unique_ptr<DataInput>(new DataInput(buffer, len, this));
}
@@ -319,9 +320,8 @@ class _GEODE_EXPORT CacheImpl : private NonCopyable, private NonAssignable {
void sendNotificationCloseMsgs();
- void validateRegionAttributes(
- const std::string& name,
- const RegionAttributes attrs) const;
+ void validateRegionAttributes(const std::string& name,
+ const RegionAttributes attrs) const;
inline void getSubRegions(MapOfRegionWithLock& srm) {
MapOfRegionGuard guard(m_regions->mutex());
diff --git a/cppcache/src/ClientProxyMembershipID.cpp b/cppcache/src/ClientProxyMembershipID.cpp
index a8de2db..ba381c3 100644
--- a/cppcache/src/ClientProxyMembershipID.cpp
+++ b/cppcache/src/ClientProxyMembershipID.cpp
@@ -139,7 +139,8 @@ void ClientProxyMembershipID::initObjectVars(
if (durableClientId != nullptr &&
durableClntTimeOut != std::chrono::seconds::zero()) {
m_memID.writeString(durableClientId);
- const auto int32ptr = CacheableInt32::create(durableClntTimeOut.count());
+ const auto int32ptr = CacheableInt32::create(
+ static_cast<int32_t>(durableClntTimeOut.count()));
int32ptr->toData(m_memID);
}
writeVersion(Version::getOrdinal(), m_memID);
@@ -230,17 +231,18 @@ void ClientProxyMembershipID::fromData(DataInput& input) {
input.readBytesOnly(hostAddr, len); // inetaddress
hostPort = input.readInt32(); // port
hostname = std::static_pointer_cast<CacheableString>(input.readObject());
- splitbrain = input.read(); // splitbrain
- dcport = input.readInt32(); // port
- vPID = input.readInt32(); // pid
- vmKind = input.read(); // vmkind
+ splitbrain = input.read(); // splitbrain
+ dcport = input.readInt32(); // port
+ vPID = input.readInt32(); // pid
+ vmKind = input.read(); // vmkind
auto aStringArray = CacheableStringArray::create();
aStringArray->fromData(input);
dsName = std::static_pointer_cast<CacheableString>(input.readObject());
uniqueTag = std::static_pointer_cast<CacheableString>(input.readObject());
durableClientId =
std::static_pointer_cast<CacheableString>(input.readObject());
- auto durableClntTimeOut = std::chrono::seconds(input.readInt32()); // durable client timeout
+ auto durableClntTimeOut =
+ std::chrono::seconds(input.readInt32()); // durable client timeout
int32_t vmViewId = 0;
readVersion(splitbrain, input);
diff --git a/cppcache/src/Connector.hpp b/cppcache/src/Connector.hpp
index 7b96122..652330e 100644
--- a/cppcache/src/Connector.hpp
+++ b/cppcache/src/Connector.hpp
@@ -74,8 +74,8 @@ class Connector {
* @exception GeodeIOException, TimeoutException, IllegalArgumentException,
* OutOfMemoryException.
*/
- virtual int32_t receive(char *b, int32_t len,
- std::chrono::microseconds waitSeconds) = 0;
+ virtual size_t receive(char *b, size_t len,
+ std::chrono::microseconds waitSeconds) = 0;
/**
* Writes <code>len</code> bytes from the specified byte array
@@ -88,8 +88,8 @@ class Connector {
* @return the actual number of bytes written.
* @exception GeodeIOException, TimeoutException, IllegalArgumentException.
*/
- virtual int32_t send(const char *b, int32_t len,
- std::chrono::microseconds waitSeconds) = 0;
+ virtual size_t send(const char *b, size_t len,
+ std::chrono::microseconds waitSeconds) = 0;
/**
* Initialises the connection.
diff --git a/cppcache/src/DataInputInternal.hpp b/cppcache/src/DataInputInternal.hpp
index e1ab6e4..10952c1 100644
--- a/cppcache/src/DataInputInternal.hpp
+++ b/cppcache/src/DataInputInternal.hpp
@@ -28,10 +28,10 @@ namespace client {
class DataInputInternal : public DataInput {
public:
- DataInputInternal(const uint8_t* buffer, int32_t len)
+ DataInputInternal(const uint8_t* buffer, size_t len)
: DataInput(buffer, len, nullptr) {}
- DataInputInternal(const uint8_t* buffer, int32_t len, const CacheImpl* cache)
+ DataInputInternal(const uint8_t* buffer, size_t len, const CacheImpl* cache)
: DataInput(buffer, len, cache) {}
virtual const Cache* getCache() override {
diff --git a/cppcache/src/DiffieHellman.cpp b/cppcache/src/DiffieHellman.cpp
index c96f8c1..be2ccb8 100644
--- a/cppcache/src/DiffieHellman.cpp
+++ b/cppcache/src/DiffieHellman.cpp
@@ -128,8 +128,8 @@ void DiffieHellman::clearDhKeys(void) {
std::shared_ptr<CacheableBytes> DiffieHellman::getPublicKey(void) {
int keyLen = 0;
auto pubKeyPtr = gf_getPublicKey_Ptr(m_dhCtx, &keyLen);
- return CacheableBytes::create(std::vector<int8_t>(pubKeyPtr, pubKeyPtr +
- keyLen));
+ return CacheableBytes::create(
+ std::vector<int8_t>(pubKeyPtr, pubKeyPtr + keyLen));
}
void DiffieHellman::setPublicKeyOther(
@@ -148,12 +148,11 @@ std::shared_ptr<CacheableBytes> DiffieHellman::encrypt(
cleartext->length());
}
std::shared_ptr<CacheableBytes> DiffieHellman::encrypt(const uint8_t* cleartext,
- int len) {
- int cipherLen = 0;
- unsigned char* ciphertextPtr =
- gf_encryptDH_Ptr(m_dhCtx, cleartext, len, &cipherLen);
- return CacheableBytes::create(std::vector<int8_t>(ciphertextPtr, ciphertextPtr +
- cipherLen));
+ size_t len) {
+ size_t cipherLen = 0;
+ auto ciphertextPtr = gf_encryptDH_Ptr(m_dhCtx, cleartext, len, &cipherLen);
+ return CacheableBytes::create(
+ std::vector<int8_t>(ciphertextPtr, ciphertextPtr + cipherLen));
}
std::shared_ptr<CacheableBytes> DiffieHellman::decrypt(
const std::shared_ptr<CacheableBytes>& cleartext) {
@@ -161,12 +160,11 @@ std::shared_ptr<CacheableBytes> DiffieHellman::decrypt(
cleartext->length());
}
std::shared_ptr<CacheableBytes> DiffieHellman::decrypt(const uint8_t* cleartext,
- int len) {
- int cipherLen = 0;
- unsigned char* ciphertextPtr =
- gf_decryptDH_Ptr(m_dhCtx, cleartext, len, &cipherLen);
- return CacheableBytes::create(std::vector<int8_t>(ciphertextPtr, ciphertextPtr +
- cipherLen));
+ size_t len) {
+ size_t cipherLen = 0;
+ auto ciphertextPtr = gf_decryptDH_Ptr(m_dhCtx, cleartext, len, &cipherLen);
+ return CacheableBytes::create(
+ std::vector<int8_t>(ciphertextPtr, ciphertextPtr + cipherLen));
}
bool DiffieHellman::verify(const std::shared_ptr<CacheableString>& subject,
@@ -176,9 +174,10 @@ bool DiffieHellman::verify(const std::shared_ptr<CacheableString>& subject,
LOGDEBUG("DiffieHellman::verify");
bool result = gf_verifyDH_Ptr(
m_dhCtx, subject->value().c_str(),
- reinterpret_cast<const uint8_t*>(challenge->value().data()), challenge->length(),
- reinterpret_cast<const uint8_t*>(response->value().data()), response->length(),
- &errCode);
+ reinterpret_cast<const uint8_t*>(challenge->value().data()),
+ challenge->length(),
+ reinterpret_cast<const uint8_t*>(response->value().data()),
+ response->length(), &errCode);
LOGDEBUG("DiffieHellman::verify 2");
if (errCode == DH_ERR_SUBJECT_NOT_FOUND) {
LOGERROR("Subject name %s not found in imported certificates.",
diff --git a/cppcache/src/DiffieHellman.hpp b/cppcache/src/DiffieHellman.hpp
index 9813c39..245a745 100644
--- a/cppcache/src/DiffieHellman.hpp
+++ b/cppcache/src/DiffieHellman.hpp
@@ -49,10 +49,10 @@ class DiffieHellman {
void computeSharedSecret(void);
std::shared_ptr<CacheableBytes> encrypt(
const std::shared_ptr<CacheableBytes>& cleartext);
- std::shared_ptr<CacheableBytes> encrypt(const uint8_t* cleartext, int len);
+ std::shared_ptr<CacheableBytes> encrypt(const uint8_t* cleartext, size_t len);
std::shared_ptr<CacheableBytes> decrypt(
const std::shared_ptr<CacheableBytes>& cleartext);
- std::shared_ptr<CacheableBytes> decrypt(const uint8_t* cleartext, int len);
+ std::shared_ptr<CacheableBytes> decrypt(const uint8_t* cleartext, size_t len);
bool verify(const std::shared_ptr<CacheableString>& subject,
const std::shared_ptr<CacheableBytes>& challenge,
const std::shared_ptr<CacheableBytes>& response);
@@ -78,10 +78,10 @@ class DiffieHellman {
typedef void (*gf_computeSharedSecret_Type)(void* dhCtx);
typedef unsigned char* (*gf_encryptDH_Type)(void* dhCtx,
const unsigned char* cleartext,
- int len, int* retLen);
+ size_t len, size_t* retLen);
typedef unsigned char* (*gf_decryptDH_Type)(void* dhCtx,
const unsigned char* cleartext,
- int len, int* retLen);
+ size_t len, size_t* retLen);
typedef bool (*gf_verifyDH_Type)(void* dhCtx, const char* subject,
const unsigned char* challenge,
int challengeLen,
diff --git a/cppcache/src/DiskStoreId.hpp b/cppcache/src/DiskStoreId.hpp
index e88d6de..16c3fae 100644
--- a/cppcache/src/DiskStoreId.hpp
+++ b/cppcache/src/DiskStoreId.hpp
@@ -56,11 +56,10 @@ class DiskStoreId : public DSMemberForVersionStamp {
m_mostSig = input.readInt64();
m_leastSig = input.readInt64();
}
+
int32_t classId() const override { return 0; }
- int8_t typeId() const override {
- return static_cast<int8_t>(GeodeTypeIdsImpl::DiskStoreId);
- }
+ int8_t typeId() const override { return 0; }
int16_t compareTo(const DSMemberForVersionStamp& tagID) const override {
const DiskStoreId& otherDiskStoreId =
diff --git a/cppcache/src/DiskVersionTag.hpp b/cppcache/src/DiskVersionTag.hpp
index 56528be..cda1c35 100644
--- a/cppcache/src/DiskVersionTag.hpp
+++ b/cppcache/src/DiskVersionTag.hpp
@@ -57,9 +57,7 @@ class DiskVersionTag : public VersionTag {
int32_t classId() const override { return 0; }
- int8_t typeId() const override {
- return static_cast<int8_t>(GeodeTypeIdsImpl::DiskVersionTag);
- }
+ int8_t typeId() const override { return 0; }
static std::shared_ptr<Serializable> createDeserializable(
MemberListForVersionStamp& memberListForVersionStamp) {
diff --git a/cppcache/src/ExecutionImpl.cpp b/cppcache/src/ExecutionImpl.cpp
index 3c430a7..f08de92 100644
--- a/cppcache/src/ExecutionImpl.cpp
+++ b/cppcache/src/ExecutionImpl.cpp
@@ -202,8 +202,8 @@ std::shared_ptr<ResultCollector> ExecutionImpl::execute(
std::make_shared<ClientMetadataService::ServerToKeysMap>(
serverToBucketsMap->size());
for (const auto& entry : *serverToBucketsMap) {
- auto keys =
- std::make_shared<CacheableHashSet>(entry.second->size());
+ auto keys = std::make_shared<CacheableHashSet>(
+ static_cast<int32_t>(entry.second->size()));
for (const auto& bucket : *(entry.second)) {
keys->insert(CacheableInt32::create(bucket));
}
diff --git a/cppcache/src/LocalRegion.cpp b/cppcache/src/LocalRegion.cpp
index beebd22..a5547ae 100644
--- a/cppcache/src/LocalRegion.cpp
+++ b/cppcache/src/LocalRegion.cpp
@@ -127,20 +127,21 @@ void LocalRegion::updateAccessAndModifiedTime(bool modified) {
}
}
}
- std::shared_ptr<CacheStatistics> LocalRegion::getStatistics() const {
- CHECK_DESTROY_PENDING(TryReadGuard, LocalRegion::getStatistics);
- bool m_statisticsEnabled = true;
- auto& props = m_cacheImpl->getDistributedSystem().getSystemProperties();
- m_statisticsEnabled = props.statisticsEnabled();
- if (!m_statisticsEnabled) {
- throw StatisticsDisabledException(
- "LocalRegion::getStatistics statistics disabled for this region");
- }
+std::shared_ptr<CacheStatistics> LocalRegion::getStatistics() const {
+ CHECK_DESTROY_PENDING(TryReadGuard, LocalRegion::getStatistics);
+ bool m_statisticsEnabled = true;
+ auto& props = m_cacheImpl->getDistributedSystem().getSystemProperties();
+ m_statisticsEnabled = props.statisticsEnabled();
+ if (!m_statisticsEnabled) {
+ throw StatisticsDisabledException(
+ "LocalRegion::getStatistics statistics disabled for this region");
+ }
- return m_cacheStatistics;
+ return m_cacheStatistics;
}
-void LocalRegion::invalidateRegion(const std::shared_ptr<Serializable>& aCallbackArgument) {
+void LocalRegion::invalidateRegion(
+ const std::shared_ptr<Serializable>& aCallbackArgument) {
GfErrType err =
invalidateRegionNoThrow(aCallbackArgument, CacheEventFlags::NORMAL);
GfErrTypeToException("Region::invalidateRegion", err);
@@ -153,13 +154,15 @@ void LocalRegion::localInvalidateRegion(
GfErrTypeToException("Region::localInvalidateRegion", err);
}
-void LocalRegion::destroyRegion(const std::shared_ptr<Serializable>& aCallbackArgument) {
+void LocalRegion::destroyRegion(
+ const std::shared_ptr<Serializable>& aCallbackArgument) {
GfErrType err =
destroyRegionNoThrow(aCallbackArgument, true, CacheEventFlags::NORMAL);
GfErrTypeToException("Region::destroyRegion", err);
}
-void LocalRegion::localDestroyRegion(const std::shared_ptr<Serializable>& aCallbackArgument) {
+void LocalRegion::localDestroyRegion(
+ const std::shared_ptr<Serializable>& aCallbackArgument) {
GfErrType err =
destroyRegionNoThrow(aCallbackArgument, true, CacheEventFlags::LOCAL);
GfErrTypeToException("Region::localDestroyRegion", err);
@@ -225,8 +228,7 @@ std::shared_ptr<Region> LocalRegion::getSubregion(const std::string& path) {
}
std::shared_ptr<Region> LocalRegion::createSubregion(
- const std::string& subregionName,
- RegionAttributes regionAttributes) {
+ const std::string& subregionName, RegionAttributes regionAttributes) {
CHECK_DESTROY_PENDING(TryWriteGuard, LocalRegion::createSubregion);
{
std::string namestr = subregionName;
@@ -244,13 +246,13 @@ std::shared_ptr<Region> LocalRegion::createSubregion(
}
auto csptr = std::make_shared<CacheStatistics>();
- auto rPtr = m_cacheImpl->createRegion_internal(
+ auto rPtr = m_cacheImpl->createRegion_internal(
subregionName,
std::static_pointer_cast<RegionInternal>(shared_from_this()),
regionAttributes, csptr, false);
- region_ptr = rPtr;
- if (!rPtr) {
- throw OutOfMemoryException("createSubregion: failed to create region");
+ region_ptr = rPtr;
+ if (!rPtr) {
+ throw OutOfMemoryException("createSubregion: failed to create region");
}
// Instantiate a PersistenceManager object if DiskPolicy is overflow
@@ -274,9 +276,11 @@ std::shared_ptr<Region> LocalRegion::createSubregion(
return region_ptr;
}
-std::vector<std::shared_ptr<Region>> LocalRegion::subregions(const bool recursive) {
+std::vector<std::shared_ptr<Region>> LocalRegion::subregions(
+ const bool recursive) {
CHECK_DESTROY_PENDING(TryReadGuard, LocalRegion::subregions);
- if (m_subRegions.current_size() == 0) return std::vector<std::shared_ptr<Region>>();
+ if (m_subRegions.current_size() == 0)
+ return std::vector<std::shared_ptr<Region>>();
return subregions_internal(recursive);
}
@@ -295,7 +299,8 @@ std::shared_ptr<RegionEntry> LocalRegion::getEntry(
return rptr;
}
-void LocalRegion::getEntry(const std::shared_ptr<CacheableKey>& key, std::shared_ptr<Cacheable>& valuePtr) {
+void LocalRegion::getEntry(const std::shared_ptr<CacheableKey>& key,
+ std::shared_ptr<Cacheable>& valuePtr) {
if (key == nullptr) {
throw IllegalArgumentException("LocalRegion::getEntry: null key");
}
@@ -322,7 +327,8 @@ std::shared_ptr<Cacheable> LocalRegion::get(
return rptr;
}
-void LocalRegion::put(const std::shared_ptr<CacheableKey>& key, const std::shared_ptr<Cacheable>& value,
+void LocalRegion::put(const std::shared_ptr<CacheableKey>& key,
+ const std::shared_ptr<Cacheable>& value,
const std::shared_ptr<Serializable>& aCallbackArgument) {
std::shared_ptr<Cacheable> oldValue;
int64_t sampleStartNanos = startStatOpTime();
@@ -335,9 +341,10 @@ void LocalRegion::put(const std::shared_ptr<CacheableKey>& key, const std::share
GfErrTypeToException("Region::put", err);
}
-void LocalRegion::localPut(const std::shared_ptr<CacheableKey>& key,
- const std::shared_ptr<Cacheable>& value,
- const std::shared_ptr<Serializable>& aCallbackArgument) {
+void LocalRegion::localPut(
+ const std::shared_ptr<CacheableKey>& key,
+ const std::shared_ptr<Cacheable>& value,
+ const std::shared_ptr<Serializable>& aCallbackArgument) {
std::shared_ptr<Cacheable> oldValue;
std::shared_ptr<VersionTag> versionTag;
GfErrType err = putNoThrow(key, value, aCallbackArgument, oldValue, -1,
@@ -358,8 +365,9 @@ void LocalRegion::putAll(
GfErrTypeToException("Region::putAll", err);
}
-void LocalRegion::removeAll(const std::vector<std::shared_ptr<CacheableKey>> & keys,
- const std::shared_ptr<Serializable>& aCallbackArgument) {
+void LocalRegion::removeAll(
+ const std::vector<std::shared_ptr<CacheableKey>>& keys,
+ const std::shared_ptr<Serializable>& aCallbackArgument) {
if (keys.size() == 0) {
throw IllegalArgumentException("Region::removeAll: zero keys provided");
}
@@ -370,8 +378,10 @@ void LocalRegion::removeAll(const std::vector<std::shared_ptr<CacheableKey>> & k
GfErrTypeToException("Region::removeAll", err);
}
-void LocalRegion::create(const std::shared_ptr<CacheableKey>& key, const std::shared_ptr<Cacheable>& value,
- const std::shared_ptr<Serializable>& aCallbackArgument) {
+void LocalRegion::create(
+ const std::shared_ptr<CacheableKey>& key,
+ const std::shared_ptr<Cacheable>& value,
+ const std::shared_ptr<Serializable>& aCallbackArgument) {
std::shared_ptr<VersionTag> versionTag;
GfErrType err = createNoThrow(key, value, aCallbackArgument, -1,
CacheEventFlags::NORMAL, versionTag);
@@ -379,9 +389,10 @@ void LocalRegion::create(const std::shared_ptr<CacheableKey>& key, const std::sh
GfErrTypeToException("Region::create", err);
}
-void LocalRegion::localCreate(const std::shared_ptr<CacheableKey>& key,
- const std::shared_ptr<Cacheable>& value,
- const std::shared_ptr<Serializable>& aCallbackArgument) {
+void LocalRegion::localCreate(
+ const std::shared_ptr<CacheableKey>& key,
+ const std::shared_ptr<Cacheable>& value,
+ const std::shared_ptr<Serializable>& aCallbackArgument) {
std::shared_ptr<VersionTag> versionTag;
GfErrType err = createNoThrow(key, value, aCallbackArgument, -1,
CacheEventFlags::LOCAL, versionTag);
@@ -398,8 +409,9 @@ void LocalRegion::invalidate(
GfErrTypeToException("Region::invalidate", err);
}
-void LocalRegion::localInvalidate(const std::shared_ptr<CacheableKey>& keyPtr,
- const std::shared_ptr<Serializable>& aCallbackArgument) {
+void LocalRegion::localInvalidate(
+ const std::shared_ptr<CacheableKey>& keyPtr,
+ const std::shared_ptr<Serializable>& aCallbackArgument) {
std::shared_ptr<VersionTag> versionTag;
GfErrType err = invalidateNoThrow(keyPtr, aCallbackArgument, -1,
CacheEventFlags::LOCAL, versionTag);
@@ -417,8 +429,9 @@ void LocalRegion::destroy(
GfErrTypeToException("Region::destroy", err);
}
-void LocalRegion::localDestroy(const std::shared_ptr<CacheableKey>& key,
- const std::shared_ptr<Serializable>& aCallbackArgument) {
+void LocalRegion::localDestroy(
+ const std::shared_ptr<CacheableKey>& key,
+ const std::shared_ptr<Serializable>& aCallbackArgument) {
std::shared_ptr<VersionTag> versionTag;
GfErrType err = destroyNoThrow(key, aCallbackArgument, -1,
CacheEventFlags::LOCAL, versionTag);
@@ -687,7 +700,7 @@ void LocalRegion::registerEntryExpiryTask(
const auto& duration = getEntryExpiryDuration();
auto handler =
new EntryExpiryHandler(rptr, entry, getEntryExpirationAction(), duration);
- int64_t id = rptr->getCacheImpl()->getExpiryTaskManager().scheduleExpiryTask(
+ auto id = rptr->getCacheImpl()->getExpiryTaskManager().scheduleExpiryTask(
handler, duration, std::chrono::seconds::zero());
if (Log::finestEnabled()) {
std::shared_ptr<CacheableKey> key;
@@ -1441,10 +1454,10 @@ class RemoveActions {
: GF_ENOENT;
if (updateCount >= 0 &&
!m_region.getAttributes()
- .getConcurrencyChecksEnabled()) { // This means server has
- // deleted an entry &
- // same entry has been
- // destroyed locally
+ .getConcurrencyChecksEnabled()) { // This means server has
+ // deleted an entry &
+ // same entry has been
+ // destroyed locally
// So call removeTrackerForEntry to remove key that was added in the
// map during addTrackerForEntry call.
m_region.m_entries->removeTrackerForEntry(key);
@@ -1690,7 +1703,8 @@ GfErrType LocalRegion::updateNoThrow(
TAction::name(), Utils::nullSafeToString(key).c_str());
m_cacheImpl->getCachePerfStats().incFailureOnDeltaReceived();
// Get full object from server.
- std::shared_ptr<Cacheable>& newValue1 = const_cast<std::shared_ptr<Cacheable>&>(value);
+ std::shared_ptr<Cacheable>& newValue1 =
+ const_cast<std::shared_ptr<Cacheable>&>(value);
std::shared_ptr<VersionTag> versionTag1;
err = getNoThrow_FullObject(eventId, newValue1, versionTag1);
if (err == GF_NOERR && newValue1 != nullptr) {
@@ -1712,8 +1726,7 @@ GfErrType LocalRegion::updateNoThrow(
}
} else { // if (getProcessedMarker())
action.getCallbackOldValue(cachingEnabled, key, entry, oldValue);
- if (updateCount >= 0 &&
- !m_regionAttributes.getConcurrencyChecksEnabled()) {
+ if (updateCount >= 0 && !m_regionAttributes.getConcurrencyChecksEnabled()) {
m_entries->removeTrackerForEntry(key);
}
}
@@ -1769,8 +1782,7 @@ GfErrType LocalRegion::updateNoThrowTX(
}
} else { // if (getProcessedMarker())
action.getCallbackOldValue(cachingEnabled, key, entry, oldValue);
- if (updateCount >= 0 &&
- !m_regionAttributes.getConcurrencyChecksEnabled()) {
+ if (updateCount >= 0 && !m_regionAttributes.getConcurrencyChecksEnabled()) {
m_entries->removeTrackerForEntry(key);
}
}
@@ -1929,8 +1941,7 @@ GfErrType LocalRegion::putAllNoThrow(
std::shared_ptr<Cacheable> oldValue;
for (const auto& iter : map) {
const auto& key = iter.first;
- if (cachingEnabled &&
- !m_regionAttributes.getConcurrencyChecksEnabled()) {
+ if (cachingEnabled && !m_regionAttributes.getConcurrencyChecksEnabled()) {
int updateCount =
m_entries->addTrackerForEntry(key, oldValue, true, false, true);
oldValueMap.insert(
@@ -2247,7 +2258,7 @@ GfErrType LocalRegion::invalidateRegionNoThrow(
GfErrType err = GF_NOERR;
if (m_regionAttributes.getCachingEnabled()) {
- std::vector<std::shared_ptr<CacheableKey>> v = keys_internal();
+ std::vector<std::shared_ptr<CacheableKey>> v = keys_internal();
const auto size = v.size();
std::shared_ptr<MapEntryImpl> me;
for (size_t i = 0; i < size; i++) {
@@ -2485,7 +2496,7 @@ GfErrType LocalRegion::putLocal(const std::string& name, bool isCreate,
}
std::vector<std::shared_ptr<CacheableKey>> LocalRegion::keys_internal() {
- std::vector<std::shared_ptr<CacheableKey>> keys;
+ std::vector<std::shared_ptr<CacheableKey>> keys;
if (m_regionAttributes.getCachingEnabled()) {
m_entries->getKeys(keys);
@@ -2494,8 +2505,8 @@ std::vector<std::shared_ptr<CacheableKey>> LocalRegion::keys_internal() {
return keys;
}
-void LocalRegion::entries_internal(std::vector<std::shared_ptr<RegionEntry>>& me,
- const bool recursive) {
+void LocalRegion::entries_internal(
+ std::vector<std::shared_ptr<RegionEntry>>& me, const bool recursive) {
m_entries->getEntries(me);
if (recursive == true) {
@@ -2760,8 +2771,8 @@ GfErrType LocalRegion::invokeCacheListenerForRegionEvent(
// TODO: pass current time instead of evaluating it twice, here
// and in region
-void LocalRegion::updateAccessAndModifiedTimeForEntry(std::shared_ptr<MapEntryImpl>& ptr,
- bool modified) {
+void LocalRegion::updateAccessAndModifiedTimeForEntry(
+ std::shared_ptr<MapEntryImpl>& ptr, bool modified) {
// locking is not required since setters use atomic operations
if (ptr != nullptr && entryExpiryEnabled()) {
ExpEntryProperties& expProps = ptr->getExpProperties();
@@ -2788,7 +2799,7 @@ void LocalRegion::updateAccessAndModifiedTimeForEntry(std::shared_ptr<MapEntryIm
uint32_t LocalRegion::adjustLruEntriesLimit(uint32_t limit) {
CHECK_DESTROY_PENDING(TryReadGuard, LocalRegion::adjustLruEntriesLimit);
- auto attrs = m_regionAttributes;
+ auto attrs = m_regionAttributes;
if (!attrs.getCachingEnabled()) return 0;
bool hadlru = (attrs.getLruEntriesLimit() != 0);
bool needslru = (limit != 0);
@@ -2811,12 +2822,12 @@ ExpirationAction LocalRegion::adjustRegionExpiryAction(
ExpirationAction action) {
CHECK_DESTROY_PENDING(TryReadGuard, LocalRegion::adjustRegionExpiryAction);
- auto attrs = m_regionAttributes;
- bool hadExpiry = (getRegionExpiryDuration() > std::chrono::seconds::zero());
- if (!hadExpiry) {
- throw IllegalStateException(
- "Cannot change region ExpirationAction for region created without "
- "region expiry.");
+ auto attrs = m_regionAttributes;
+ bool hadExpiry = (getRegionExpiryDuration() > std::chrono::seconds::zero());
+ if (!hadExpiry) {
+ throw IllegalStateException(
+ "Cannot change region ExpirationAction for region created without "
+ "region expiry.");
}
ExpirationAction oldValue = getRegionExpiryAction();
@@ -2830,13 +2841,13 @@ ExpirationAction LocalRegion::adjustRegionExpiryAction(
ExpirationAction LocalRegion::adjustEntryExpiryAction(ExpirationAction action) {
CHECK_DESTROY_PENDING(TryReadGuard, LocalRegion::adjustEntryExpiryAction);
- auto attrs = m_regionAttributes;
- bool hadExpiry = (getEntryExpiryDuration() > std::chrono::seconds::zero());
- if (!hadExpiry) {
- throw IllegalStateException(
- "Cannot change entry ExpirationAction for region created without "
- "entry "
- "expiry.");
+ auto attrs = m_regionAttributes;
+ bool hadExpiry = (getEntryExpiryDuration() > std::chrono::seconds::zero());
+ if (!hadExpiry) {
+ throw IllegalStateException(
+ "Cannot change entry ExpirationAction for region created without "
+ "entry "
+ "expiry.");
}
ExpirationAction oldValue = getEntryExpirationAction();
@@ -2913,8 +2924,7 @@ bool LocalRegion::useModifiedTimeForEntryExpiry() {
bool LocalRegion::isEntryIdletimeEnabled() {
if (m_regionAttributes.getCachingEnabled() &&
- m_regionAttributes.getEntryIdleTimeout() >
- std::chrono::seconds::zero()) {
+ m_regionAttributes.getEntryIdleTimeout() > std::chrono::seconds::zero()) {
return true;
} else {
return false;
@@ -3079,7 +3089,8 @@ void LocalRegion::adjustCacheLoader(const std::string& lib,
m_loader = m_regionAttributes.getCacheLoader();
}
-void LocalRegion::adjustCacheWriter(const std::shared_ptr<CacheWriter>& aWriter) {
+void LocalRegion::adjustCacheWriter(
+ const std::shared_ptr<CacheWriter>& aWriter) {
WriteGuard guard(m_rwLock);
setCacheWriter(aWriter);
m_writer = aWriter;
@@ -3145,7 +3156,9 @@ std::shared_ptr<Cacheable> LocalRegion::handleReplay(
return value;
}
- std::shared_ptr<TombstoneList> LocalRegion::getTombstoneList() { return m_tombstoneList; }
+std::shared_ptr<TombstoneList> LocalRegion::getTombstoneList() {
+ return m_tombstoneList;
+}
int64_t LocalRegion::startStatOpTime() {
return m_enableTimeStatistics ? Utils::startStatOpTime() : 0;
diff --git a/cppcache/src/MapSegment.cpp b/cppcache/src/MapSegment.cpp
index d3b03e7..61cf044 100644
--- a/cppcache/src/MapSegment.cpp
+++ b/cppcache/src/MapSegment.cpp
@@ -77,7 +77,7 @@ GfErrType MapSegment::create(const std::shared_ptr<CacheableKey>& key,
std::shared_ptr<Cacheable>& oldValue,
int updateCount, int destroyTracker,
std::shared_ptr<VersionTag> versionTag) {
- int64_t taskid = -1;
+ ExpiryTaskManager::id_type taskid = -1;
TombstoneExpiryHandler* handler = nullptr;
GfErrType err = GF_NOERR;
{
@@ -146,7 +146,7 @@ GfErrType MapSegment::put(const std::shared_ptr<CacheableKey>& key,
int destroyTracker, bool& isUpdate,
std::shared_ptr<VersionTag> versionTag,
DataInput* delta) {
- int64_t taskid = -1;
+ ExpiryTaskManager::id_type taskid = -1;
TombstoneExpiryHandler* handler = nullptr;
GfErrType err = GF_NOERR;
{
@@ -261,8 +261,8 @@ GfErrType MapSegment::removeWhenConcurrencyEnabled(
const std::shared_ptr<CacheableKey>& key,
std::shared_ptr<Cacheable>& oldValue, std::shared_ptr<MapEntryImpl>& me,
int updateCount, std::shared_ptr<VersionTag> versionTag, bool afterRemote,
- bool& isEntryFound, int64_t expiryTaskID, TombstoneExpiryHandler* handler,
- bool& expTaskSet) {
+ bool& isEntryFound, ExpiryTaskManager::id_type expiryTaskID,
+ TombstoneExpiryHandler* handler, bool& expTaskSet) {
GfErrType err = GF_NOERR;
int status;
std::shared_ptr<MapEntry> entry;
@@ -336,7 +336,7 @@ GfErrType MapSegment::remove(const std::shared_ptr<CacheableKey>& key,
std::shared_ptr<MapEntry> entry;
if (m_concurrencyChecksEnabled) {
TombstoneExpiryHandler* handler;
- int64_t id = m_tombstoneList->getExpiryTask(&handler);
+ auto id = m_tombstoneList->getExpiryTask(&handler);
bool expTaskSet = false;
GfErrType err;
{
@@ -378,8 +378,8 @@ GfErrType MapSegment::remove(const std::shared_ptr<CacheableKey>& key,
return GF_NOERR;
}
-bool MapSegment::unguardedRemoveActualEntry(const std::shared_ptr<CacheableKey>& key,
- bool cancelTask) {
+bool MapSegment::unguardedRemoveActualEntry(
+ const std::shared_ptr<CacheableKey>& key, bool cancelTask) {
std::shared_ptr<MapEntry> entry;
m_tombstoneList->eraseEntryFromTombstoneList(key, cancelTask);
if (m_map->unbind(key, entry) == -1) {
@@ -390,7 +390,7 @@ bool MapSegment::unguardedRemoveActualEntry(const std::shared_ptr<CacheableKey>&
bool MapSegment::unguardedRemoveActualEntryWithoutCancelTask(
const std::shared_ptr<CacheableKey>& key, TombstoneExpiryHandler*& handler,
- int64_t& taskid) {
+ ExpiryTaskManager::id_type& taskid) {
std::shared_ptr<MapEntry> entry;
taskid = m_tombstoneList->eraseEntryFromTombstoneListWithoutCancelTask(
key, handler);
@@ -408,7 +408,8 @@ bool MapSegment::removeActualEntry(const std::shared_ptr<CacheableKey>& key,
/**
* @brief get MapEntry for key. throws NoEntryException if absent.
*/
-bool MapSegment::getEntry(const std::shared_ptr<CacheableKey>& key, std::shared_ptr<MapEntryImpl>& result,
+bool MapSegment::getEntry(const std::shared_ptr<CacheableKey>& key,
+ std::shared_ptr<MapEntryImpl>& result,
std::shared_ptr<Cacheable>& value) {
std::lock_guard<spinlock_mutex> lk(m_spinlock);
int status;
@@ -420,7 +421,7 @@ bool MapSegment::getEntry(const std::shared_ptr<CacheableKey>& key, std::shared_
}
// If the value is a tombstone return not found
- auto mePtr = entry->getImplPtr();
+ auto mePtr = entry->getImplPtr();
mePtr->getValueI(value);
if (value == nullptr || CacheableToken::isTombstone(value)) {
result = nullptr;
@@ -443,7 +444,7 @@ bool MapSegment::containsKey(const std::shared_ptr<CacheableKey>& key) {
}
// If the value is a tombstone return not found
std::shared_ptr<Cacheable> value;
- auto mePtr1 = mePtr->getImplPtr();
+ auto mePtr1 = mePtr->getImplPtr();
mePtr1->getValueI(value);
if (value != nullptr && CacheableToken::isTombstone(value)) return false;
@@ -453,7 +454,7 @@ bool MapSegment::containsKey(const std::shared_ptr<CacheableKey>& key) {
/**
* @brief return the all the keys in the provided list.
*/
-void MapSegment::getKeys(std::vector<std::shared_ptr<CacheableKey>> & result) {
+void MapSegment::getKeys(std::vector<std::shared_ptr<CacheableKey>>& result) {
std::lock_guard<spinlock_mutex> lk(m_spinlock);
for (CacheableKeyHashMap::iterator iter = m_map->begin();
iter != m_map->end(); iter++) {
@@ -481,8 +482,8 @@ void MapSegment::getEntries(std::vector<std::shared_ptr<RegionEntry>>& result) {
valuePtr = nullptr;
}
me->getKeyI(keyPtr);
- auto rePtr = m_region->createRegionEntry(keyPtr, valuePtr);
- result.push_back(rePtr);
+ auto rePtr = m_region->createRegionEntry(keyPtr, valuePtr);
+ result.push_back(rePtr);
}
}
}
@@ -490,7 +491,7 @@ void MapSegment::getEntries(std::vector<std::shared_ptr<RegionEntry>>& result) {
/**
* @brief return all values in the provided list.
*/
-void MapSegment::getValues(std::vector<std::shared_ptr<Cacheable>> & result) {
+void MapSegment::getValues(std::vector<std::shared_ptr<Cacheable>>& result) {
std::lock_guard<spinlock_mutex> lk(m_spinlock);
for (CacheableKeyHashMap::iterator iter = m_map->begin();
iter != m_map->end(); iter++) {
@@ -504,7 +505,7 @@ void MapSegment::getValues(std::vector<std::shared_ptr<Cacheable>> & result) {
status = m_map->find(keyPtr, entry);
if (status != -1) {
- auto entryImpl = entry->getImplPtr();
+ auto entryImpl = entry->getImplPtr();
if (valuePtr != nullptr && !CacheableToken::isInvalid(valuePtr) &&
!CacheableToken::isDestroyed(valuePtr) &&
!CacheableToken::isTombstone(valuePtr)) {
@@ -522,8 +523,9 @@ void MapSegment::getValues(std::vector<std::shared_ptr<Cacheable>> & result) {
// versioning
// changes takes care of the version and no need for tracking the entry
int MapSegment::addTrackerForEntry(const std::shared_ptr<CacheableKey>& key,
- std::shared_ptr<Cacheable>& oldValue, bool addIfAbsent,
- bool failIfPresent, bool incUpdateCount) {
+ std::shared_ptr<Cacheable>& oldValue,
+ bool addIfAbsent, bool failIfPresent,
+ bool incUpdateCount) {
if (m_concurrencyChecksEnabled) return -1;
std::lock_guard<spinlock_mutex> lk(m_spinlock);
std::shared_ptr<MapEntry> entry;
@@ -570,7 +572,8 @@ int MapSegment::addTrackerForEntry(const std::shared_ptr<CacheableKey>& key,
// This function will not get called if concurrency checks are enabled. The
// versioning
// changes takes care of the version and no need for tracking the entry
-void MapSegment::removeTrackerForEntry(const std::shared_ptr<CacheableKey>& key) {
+void MapSegment::removeTrackerForEntry(
+ const std::shared_ptr<CacheableKey>& key) {
if (m_concurrencyChecksEnabled) return;
std::lock_guard<spinlock_mutex> lk(m_spinlock);
std::shared_ptr<MapEntry> entry;
@@ -644,9 +647,10 @@ std::shared_ptr<Cacheable> MapSegment::getFromDisc(
}
GfErrType MapSegment::putForTrackedEntry(
- const std::shared_ptr<CacheableKey>& key, const std::shared_ptr<Cacheable>& newValue,
- std::shared_ptr<MapEntry>& entry, std::shared_ptr<MapEntryImpl>& entryImpl, int updateCount,
- VersionStamp& versionStamp, DataInput* delta) {
+ const std::shared_ptr<CacheableKey>& key,
+ const std::shared_ptr<Cacheable>& newValue,
+ std::shared_ptr<MapEntry>& entry, std::shared_ptr<MapEntryImpl>& entryImpl,
+ int updateCount, VersionStamp& versionStamp, DataInput* delta) {
if (updateCount < 0 || m_concurrencyChecksEnabled) {
// for a non-tracked put (e.g. from notification) go ahead with the
// create/update and increment the update counter
@@ -672,10 +676,11 @@ GfErrType MapSegment::putForTrackedEntry(
}
}
auto valueWithDelta = std::dynamic_pointer_cast<Delta>(oldValue);
- std::shared_ptr<Cacheable>& newValue1 = const_cast<std::shared_ptr<Cacheable>&>(newValue);
+ std::shared_ptr<Cacheable>& newValue1 =
+ const_cast<std::shared_ptr<Cacheable>&>(newValue);
try {
if (m_region->getAttributes().getCloningEnabled()) {
- auto tempVal = valueWithDelta->clone();
+ auto tempVal = valueWithDelta->clone();
ACE_Time_Value currTimeBefore = ACE_OS::gettimeofday();
tempVal->fromDelta(*delta);
if (m_poolDM) {
@@ -731,7 +736,8 @@ void MapSegment::reapTombstones(std::shared_ptr<CacheableHashSet> removedKeys) {
m_tombstoneList->reapTombstones(removedKeys);
}
-GfErrType MapSegment::isTombstone(std::shared_ptr<CacheableKey> key, std::shared_ptr<MapEntryImpl>& me,
+GfErrType MapSegment::isTombstone(std::shared_ptr<CacheableKey> key,
+ std::shared_ptr<MapEntryImpl>& me,
bool& result) {
std::shared_ptr<Cacheable> value;
std::shared_ptr<MapEntry> entry;
diff --git a/cppcache/src/MapSegment.hpp b/cppcache/src/MapSegment.hpp
index 65b886f..61d8a07 100644
--- a/cppcache/src/MapSegment.hpp
+++ b/cppcache/src/MapSegment.hpp
@@ -50,7 +50,8 @@ ACE_BEGIN_VERSIONED_NAMESPACE_DECL
template <>
class ACE_Hash<std::shared_ptr<apache::geode::client::CacheableKey>> {
public:
- u_long operator()(const std::shared_ptr<apache::geode::client::CacheableKey>& key) {
+ u_long operator()(
+ const std::shared_ptr<apache::geode::client::CacheableKey>& key) {
return key->hashcode();
}
};
@@ -58,8 +59,9 @@ class ACE_Hash<std::shared_ptr<apache::geode::client::CacheableKey>> {
template <>
class ACE_Equal_To<std::shared_ptr<apache::geode::client::CacheableKey>> {
public:
- bool operator()(const std::shared_ptr<apache::geode::client::CacheableKey>& key1,
- const std::shared_ptr<apache::geode::client::CacheableKey>& key2) {
+ bool operator()(
+ const std::shared_ptr<apache::geode::client::CacheableKey>& key1,
+ const std::shared_ptr<apache::geode::client::CacheableKey>& key2) {
return key1->operator==(*key2);
}
};
@@ -188,14 +190,16 @@ class _GEODE_EXPORT MapSegment {
int updateCount, VersionStamp& versionStamp,
DataInput* delta = nullptr);
- std::shared_ptr<Cacheable> getFromDisc(std::shared_ptr<CacheableKey> key, std::shared_ptr<MapEntryImpl>& entryImpl);
+ std::shared_ptr<Cacheable> getFromDisc(
+ std::shared_ptr<CacheableKey> key,
+ std::shared_ptr<MapEntryImpl>& entryImpl);
GfErrType removeWhenConcurrencyEnabled(
const std::shared_ptr<CacheableKey>& key,
std::shared_ptr<Cacheable>& oldValue, std::shared_ptr<MapEntryImpl>& me,
int updateCount, std::shared_ptr<VersionTag> versionTag, bool afterRemote,
- bool& isEntryFound, int64_t expiryTaskID, TombstoneExpiryHandler* handler,
- bool& expTaskSet);
+ bool& isEntryFound, ExpiryTaskManager::id_type expiryTaskID,
+ TombstoneExpiryHandler* handler, bool& expTaskSet);
public:
MapSegment()
@@ -224,7 +228,8 @@ class _GEODE_EXPORT MapSegment {
*/
void open(RegionInternal* region, const EntryFactory* entryFactory,
ExpiryTaskManager* expiryTaskManager, uint32_t size,
- std::atomic<int32_t>* destroyTrackers, bool concurrencyChecksEnabled);
+ std::atomic<int32_t>* destroyTrackers,
+ bool concurrencyChecksEnabled);
void close();
void clear();
@@ -251,14 +256,17 @@ class _GEODE_EXPORT MapSegment {
std::shared_ptr<VersionTag> versionTag,
DataInput* delta = nullptr);
- GfErrType invalidate(const std::shared_ptr<CacheableKey>& key, std::shared_ptr<MapEntryImpl>& me,
- std::shared_ptr<Cacheable>& oldValue, std::shared_ptr<VersionTag> versionTag,
+ GfErrType invalidate(const std::shared_ptr<CacheableKey>& key,
+ std::shared_ptr<MapEntryImpl>& me,
+ std::shared_ptr<Cacheable>& oldValue,
+ std::shared_ptr<VersionTag> versionTag,
bool& isTokenAdded);
/**
* @brief remove an entry from the map, setting oldValue.
*/
- GfErrType remove(const std::shared_ptr<CacheableKey>& key, std::shared_ptr<Cacheable>& oldValue,
+ GfErrType remove(const std::shared_ptr<CacheableKey>& key,
+ std::shared_ptr<Cacheable>& oldValue,
std::shared_ptr<MapEntryImpl>& me, int updateCount,
std::shared_ptr<VersionTag> versionTag, bool afterRemote,
bool& isEntryFound);
@@ -279,7 +287,7 @@ class _GEODE_EXPORT MapSegment {
/**
* @brief return the all the keys in the provided list.
*/
- void getKeys(std::vector<std::shared_ptr<CacheableKey>> & result);
+ void getKeys(std::vector<std::shared_ptr<CacheableKey>>& result);
/**
* @brief return all the entries in the provided list.
@@ -289,7 +297,7 @@ class _GEODE_EXPORT MapSegment {
/**
* @brief return all values in the provided list.
*/
- void getValues(std::vector<std::shared_ptr<Cacheable>> & result);
+ void getValues(std::vector<std::shared_ptr<Cacheable>>& result);
inline uint32_t rehashCount() { return m_rehashCount; }
@@ -307,16 +315,18 @@ class _GEODE_EXPORT MapSegment {
void reapTombstones(std::shared_ptr<CacheableHashSet> removedKeys);
- bool removeActualEntry(const std::shared_ptr<CacheableKey>& key, bool cancelTask = true);
+ bool removeActualEntry(const std::shared_ptr<CacheableKey>& key,
+ bool cancelTask = true);
bool unguardedRemoveActualEntryWithoutCancelTask(
- const std::shared_ptr<CacheableKey>& key, TombstoneExpiryHandler*& handler,
- int64_t& taskid);
+ const std::shared_ptr<CacheableKey>& key,
+ TombstoneExpiryHandler*& handler, ExpiryTaskManager::id_type& taskid);
bool unguardedRemoveActualEntry(const std::shared_ptr<CacheableKey>& key,
bool cancelTask = true);
- GfErrType isTombstone(std::shared_ptr<CacheableKey> key, std::shared_ptr<MapEntryImpl>& me, bool& result);
+ GfErrType isTombstone(std::shared_ptr<CacheableKey> key,
+ std::shared_ptr<MapEntryImpl>& me, bool& result);
static bool boolVal;
};
diff --git a/cppcache/src/PdxInstanceImpl.cpp b/cppcache/src/PdxInstanceImpl.cpp
index 3e21440..dfb60be 100644
--- a/cppcache/src/PdxInstanceImpl.cpp
+++ b/cppcache/src/PdxInstanceImpl.cpp
@@ -153,7 +153,7 @@ void PdxInstanceImpl::writeField(PdxWriter& writer,
}
case PdxFieldTypes::BYTE_ARRAY: {
if (auto&& val = std::dynamic_pointer_cast<
- CacheableArray<int8_t, GeodeTypeIds::CacheableBytes>>(value)) {
+ CacheableArray<int8_t, GeodeTypeIds::CacheableBytes>>(value)) {
writer.writeByteArray(fieldName, val->value());
}
break;
@@ -815,42 +815,50 @@ std::string PdxInstanceImpl::getStringField(
return dataInput->readString();
}
-std::vector<bool> PdxInstanceImpl::getBooleanArrayField(const std::string& fieldname) const {
+std::vector<bool> PdxInstanceImpl::getBooleanArrayField(
+ const std::string& fieldname) const {
auto dataInput = getDataInputForField(fieldname);
return dataInput->readBooleanArray();
}
-std::vector<int8_t> PdxInstanceImpl::getByteArrayField(const std::string& fieldname) const {
+std::vector<int8_t> PdxInstanceImpl::getByteArrayField(
+ const std::string& fieldname) const {
auto dataInput = getDataInputForField(fieldname);
return dataInput->readByteArray();
}
-std::vector<int16_t> PdxInstanceImpl::getShortArrayField(const std::string& fieldname) const {
+std::vector<int16_t> PdxInstanceImpl::getShortArrayField(
+ const std::string& fieldname) const {
auto dataInput = getDataInputForField(fieldname);
return dataInput->readShortArray();
}
-std::vector<int32_t> PdxInstanceImpl::getIntArrayField(const std::string& fieldname) const {
+std::vector<int32_t> PdxInstanceImpl::getIntArrayField(
+ const std::string& fieldname) const {
auto dataInput = getDataInputForField(fieldname);
return dataInput->readIntArray();
}
-std::vector<int64_t> PdxInstanceImpl::getLongArrayField(const std::string& fieldname) const {
+std::vector<int64_t> PdxInstanceImpl::getLongArrayField(
+ const std::string& fieldname) const {
auto dataInput = getDataInputForField(fieldname);
return dataInput->readLongArray();
}
-std::vector<float> PdxInstanceImpl::getFloatArrayField(const std::string& fieldname) const {
+std::vector<float> PdxInstanceImpl::getFloatArrayField(
+ const std::string& fieldname) const {
auto dataInput = getDataInputForField(fieldname);
return dataInput->readFloatArray();
}
-std::vector<double> PdxInstanceImpl::getDoubleArrayField(const std::string& fieldname) const {
+std::vector<double> PdxInstanceImpl::getDoubleArrayField(
+ const std::string& fieldname) const {
auto dataInput = getDataInputForField(fieldname);
return dataInput->readDoubleArray();
}
-std::vector<char16_t> PdxInstanceImpl::getCharArrayField(const std::string& fieldname) const {
+std::vector<char16_t> PdxInstanceImpl::getCharArrayField(
+ const std::string& fieldname) const {
auto dataInput = getDataInputForField(fieldname);
return dataInput->readCharArray();
}
@@ -954,8 +962,7 @@ std::string PdxInstanceImpl::toString() const {
}
case PdxFieldTypes::CHAR: {
auto value = getCharField(identityFields.at(i)->getFieldName());
- // TODO string convert UTF16 to UTF8
- toString += value;
+ toString += to_utf8(std::u16string{value});
break;
}
case PdxFieldTypes::STRING: {
@@ -965,11 +972,9 @@ std::string PdxInstanceImpl::toString() const {
}
case PdxFieldTypes::CHAR_ARRAY: {
auto value = getCharArrayField(identityFields.at(i)->getFieldName());
- int32_t length = value.size();
+ auto length = value.size();
if (length > 0) {
- for (auto&& v : value) {
- toString += to_utf8(std::u16string(v, length));
- }
+ toString += to_utf8(std::u16string(value.data(), length));
}
break;
}
@@ -982,7 +987,7 @@ std::string PdxInstanceImpl::toString() const {
}
case PdxFieldTypes::BYTE_ARRAY: {
auto value = getByteArrayField(identityFields.at(i)->getFieldName());
- int32_t length = value.size();
+ auto length = value.size();
if (length > 0) {
for (auto&& v : value) {
toString += std::to_string(v);
@@ -992,7 +997,7 @@ std::string PdxInstanceImpl::toString() const {
}
case PdxFieldTypes::SHORT_ARRAY: {
auto value = getShortArrayField(identityFields.at(i)->getFieldName());
- int32_t length = value.size();
+ auto length = value.size();
if (length > 0) {
for (auto&& v : value) {
toString += std::to_string(v);
@@ -1002,7 +1007,7 @@ std::string PdxInstanceImpl::toString() const {
}
case PdxFieldTypes::INT_ARRAY: {
auto value = getIntArrayField(identityFields.at(i)->getFieldName());
- int32_t length = value.size();
+ auto length = value.size();
if (length > 0) {
for (auto&& v : value) {
toString += std::to_string(v);
@@ -1012,7 +1017,7 @@ std::string PdxInstanceImpl::toString() const {
}
case PdxFieldTypes::LONG_ARRAY: {
auto value = getLongArrayField(identityFields.at(i)->getFieldName());
- int32_t length = value.size();
+ auto length = value.size();
if (length > 0) {
for (auto&& v : value) {
toString += std::to_string(v);
@@ -1022,7 +1027,7 @@ std::string PdxInstanceImpl::toString() const {
}
case PdxFieldTypes::FLOAT_ARRAY: {
auto value = getFloatArrayField(identityFields.at(i)->getFieldName());
- int32_t length = value.size();
+ auto length = value.size();
if (length > 0) {
for (auto&& v : value) {
toString += std::to_string(v);
@@ -1032,7 +1037,7 @@ std::string PdxInstanceImpl::toString() const {
}
case PdxFieldTypes::DOUBLE_ARRAY: {
auto value = getDoubleArrayField(identityFields.at(i)->getFieldName());
- int32_t length = value.size();
+ auto length = value.size();
if (length > 0) {
for (auto&& v : value) {
toString += std::to_string(v);
@@ -1050,7 +1055,7 @@ std::string PdxInstanceImpl::toString() const {
}
case PdxFieldTypes::BOOLEAN_ARRAY: {
auto value = getBooleanArrayField(identityFields.at(i)->getFieldName());
- int32_t length = value.size();
+ auto length = value.size();
if (length > 0) {
for (auto&& v : value) {
toString += v ? "true" : "false";
@@ -1346,7 +1351,7 @@ std::shared_ptr<CacheableStringArray> PdxInstanceImpl::getFieldNames() {
if (size > 0) {
return CacheableStringArray::create(
- std::vector<std::shared_ptr<CacheableString>>(ptrArr, ptrArr + size));
+ std::vector<std::shared_ptr<CacheableString>>(ptrArr, ptrArr + size));
}
return nullptr;
}
@@ -1490,7 +1495,7 @@ int PdxInstanceImpl::getOffset(DataInput& dataInput,
int offsetSize = 0;
int serializedLength = 0;
- int pdxSerializedLength = dataInput.getPdxBytes();
+ int pdxSerializedLength = static_cast<int32_t>(dataInput.getPdxBytes());
LOGDEBUG("getOffset pdxSerializedLength = %d ", pdxSerializedLength);
if (pdxSerializedLength <= 0xff) {
offsetSize = 1;
@@ -1560,7 +1565,7 @@ int PdxInstanceImpl::getSerializedLength(DataInput& dataInput,
int offsetSize = 0;
int serializedLength = 0;
- int pdxSerializedLength = dataInput.getPdxBytes();
+ int pdxSerializedLength = static_cast<int32_t>(dataInput.getPdxBytes());
LOGDEBUG("pdxSerializedLength = %d ", pdxSerializedLength);
if (pdxSerializedLength <= 0xff) {
offsetSize = 1;
@@ -1842,7 +1847,8 @@ void PdxInstanceImpl::setField(const std::string& fieldName,
" or type of field not matched " +
(pft != nullptr ? pft->toString() : ""));
}
- auto cacheableObject = CacheableArray<int8_t, GeodeTypeIds::CacheableBytes>::create(value);
+ auto cacheableObject =
+ CacheableArray<int8_t, GeodeTypeIds::CacheableBytes>::create(value);
m_updatedFields[fieldName] = cacheableObject;
}
@@ -1958,7 +1964,7 @@ void PdxInstanceImpl::setField(const std::string& fieldName, int8_t** value,
auto cacheableObject = CacheableVector::create();
for (int i = 0; i < arrayLength; i++) {
auto ptr = CacheableBytes::create(
- std::vector<int8_t>(value[i], value[i] + elementLength[i]));
+ std::vector<int8_t>(value[i], value[i] + elementLength[i]));
cacheableObject->push_back(ptr);
}
m_updatedFields[fieldName] = cacheableObject;
@@ -1983,7 +1989,7 @@ void PdxInstanceImpl::setField(const std::string& fieldName, std::string* value,
}
if (length > 0) {
auto cacheableObject = CacheableStringArray::create(
- std::vector<std::shared_ptr<CacheableString>>(ptrArr, ptrArr + length));
+ std::vector<std::shared_ptr<CacheableString>>(ptrArr, ptrArr + length));
m_updatedFields[fieldName] = cacheableObject;
}
}
diff --git a/cppcache/src/PdxLocalReader.cpp b/cppcache/src/PdxLocalReader.cpp
index f41e790..f75c7ac 100644
--- a/cppcache/src/PdxLocalReader.cpp
+++ b/cppcache/src/PdxLocalReader.cpp
@@ -67,8 +67,7 @@ void PdxLocalReader::resettoPdxHead() {
void PdxLocalReader::initialize() {
m_startBuffer = const_cast<uint8_t*>(m_dataInput->currentBufferPosition());
- m_startPosition = m_dataInput->getBytesRead(); // number of bytes read in
- // c++;
+ m_startPosition = static_cast<int32_t>(m_dataInput->getBytesRead());
if (m_serializedLengthWithOffsets <= 0xff) {
m_offsetSize = 1;
@@ -147,7 +146,7 @@ std::vector<char16_t> PdxLocalReader::readCharArray(
}
std::vector<bool> PdxLocalReader::readBooleanArray(
- const std::string& fieldName) {
+ const std::string& fieldName) {
return m_dataInput->readBooleanArray();
}
@@ -209,66 +208,66 @@ std::shared_ptr<CacheableDate> PdxLocalReader::readDate(
auto cd = CacheableDate::create();
cd->fromData(*m_dataInput);
return cd;
- }
- std::shared_ptr<PdxRemotePreservedData> PdxLocalReader::getPreservedData(
- std::shared_ptr<PdxType> mergedVersion,
- std::shared_ptr<PdxSerializable> pdxObject) {
- int nFieldExtra = m_pdxType->getNumberOfExtraFields();
- LOGDEBUG(
- "PdxLocalReader::getPreservedData::nFieldExtra = %d AND "
- "PdxTypeRegistry::getPdxIgnoreUnreadFields = %d ",
- nFieldExtra, m_pdxTypeRegistry->getPdxIgnoreUnreadFields());
- if (nFieldExtra > 0 &&
- m_pdxTypeRegistry->getPdxIgnoreUnreadFields() == false) {
- m_pdxRemotePreserveData->initialize(
- m_pdxType != nullptr ? m_pdxType->getTypeId() : 0,
- mergedVersion->getTypeId(), nFieldExtra, pdxObject);
- LOGDEBUG("PdxLocalReader::getPreservedData - 1");
-
- m_localToRemoteMap = m_pdxType->getLocalToRemoteMap();
- m_remoteToLocalMap = m_pdxType->getRemoteToLocalMap();
-
- int currentIdx = 0;
- std::vector<int8_t> pdVector;
- for (int i = 0; i < m_remoteToLocalMapSize; i++) {
- if (m_remoteToLocalMap[i] == -1 ||
- m_remoteToLocalMap[i] == -2) // this field needs to preserve
- {
- int pos = m_pdxType->getFieldPosition(i, m_offsetsBuffer, m_offsetSize,
- m_serializedLength);
- int nFieldPos = 0;
-
- if (i == m_remoteToLocalMapSize - 1) {
- nFieldPos = m_serializedLength;
- } else {
- nFieldPos = m_pdxType->getFieldPosition(
- i + 1, m_offsetsBuffer, m_offsetSize, m_serializedLength);
- }
-
- resettoPdxHead();
- m_dataInput->advanceCursor(pos);
-
- for (int i = 0; i < (nFieldPos - pos); i++) {
- pdVector.push_back(m_dataInput->read());
- }
- resettoPdxHead();
-
- m_pdxRemotePreserveData->setPreservedData(pdVector);
- currentIdx++;
- pdVector.erase(pdVector.begin(), pdVector.end());
- } else {
- LOGDEBUG("PdxLocalReader::getPreservedData No need to preserve");
- }
- }
-
- if (m_isDataNeedToPreserve) {
- return m_pdxRemotePreserveData;
- } else {
- LOGDEBUG(
- "PdxLocalReader::GetPreservedData m_isDataNeedToPreserve is false");
- }
- }
- return nullptr;
+}
+std::shared_ptr<PdxRemotePreservedData> PdxLocalReader::getPreservedData(
+ std::shared_ptr<PdxType> mergedVersion,
+ std::shared_ptr<PdxSerializable> pdxObject) {
+ int nFieldExtra = m_pdxType->getNumberOfExtraFields();
+ LOGDEBUG(
+ "PdxLocalReader::getPreservedData::nFieldExtra = %d AND "
+ "PdxTypeRegistry::getPdxIgnoreUnreadFields = %d ",
+ nFieldExtra, m_pdxTypeRegistry->getPdxIgnoreUnreadFields());
+ if (nFieldExtra > 0 &&
+ m_pdxTypeRegistry->getPdxIgnoreUnreadFields() == false) {
+ m_pdxRemotePreserveData->initialize(
+ m_pdxType != nullptr ? m_pdxType->getTypeId() : 0,
+ mergedVersion->getTypeId(), nFieldExtra, pdxObject);
+ LOGDEBUG("PdxLocalReader::getPreservedData - 1");
+
+ m_localToRemoteMap = m_pdxType->getLocalToRemoteMap();
+ m_remoteToLocalMap = m_pdxType->getRemoteToLocalMap();
+
+ int currentIdx = 0;
+ std::vector<int8_t> pdVector;
+ for (int i = 0; i < m_remoteToLocalMapSize; i++) {
+ if (m_remoteToLocalMap[i] == -1 ||
+ m_remoteToLocalMap[i] == -2) // this field needs to preserve
+ {
+ int pos = m_pdxType->getFieldPosition(i, m_offsetsBuffer, m_offsetSize,
+ m_serializedLength);
+ int nFieldPos = 0;
+
+ if (i == m_remoteToLocalMapSize - 1) {
+ nFieldPos = m_serializedLength;
+ } else {
+ nFieldPos = m_pdxType->getFieldPosition(
+ i + 1, m_offsetsBuffer, m_offsetSize, m_serializedLength);
+ }
+
+ resettoPdxHead();
+ m_dataInput->advanceCursor(pos);
+
+ for (int i = 0; i < (nFieldPos - pos); i++) {
+ pdVector.push_back(m_dataInput->read());
+ }
+ resettoPdxHead();
+
+ m_pdxRemotePreserveData->setPreservedData(pdVector);
+ currentIdx++;
+ pdVector.erase(pdVector.begin(), pdVector.end());
+ } else {
+ LOGDEBUG("PdxLocalReader::getPreservedData No need to preserve");
+ }
+ }
+
+ if (m_isDataNeedToPreserve) {
+ return m_pdxRemotePreserveData;
+ } else {
+ LOGDEBUG(
+ "PdxLocalReader::GetPreservedData m_isDataNeedToPreserve is false");
+ }
+ }
+ return nullptr;
}
bool PdxLocalReader::hasField(const std::string& fieldName) {
diff --git a/cppcache/src/PdxLocalWriter.cpp b/cppcache/src/PdxLocalWriter.cpp
index cea4e02..76a6a5d 100644
--- a/cppcache/src/PdxLocalWriter.cpp
+++ b/cppcache/src/PdxLocalWriter.cpp
@@ -64,7 +64,7 @@ void PdxLocalWriter::initialize() {
m_startPosition = m_dataOutput->getBuffer();
// data has been write
- m_startPositionOffset = m_dataOutput->getBufferLength();
+ m_startPositionOffset = static_cast<int32_t>(m_dataOutput->getBufferLength());
// Advance cursor to write pdx header
m_dataOutput->advanceCursor(PdxHelper::PdxHeader);
@@ -73,9 +73,9 @@ void PdxLocalWriter::initialize() {
void PdxLocalWriter::addOffset() {
// bufferLen gives lenght which has been written to DataOutput
// m_startPositionOffset: from where pdx header length starts
- int bufferLen = m_dataOutput->getBufferLength() - m_startPositionOffset;
+ auto bufferLen = m_dataOutput->getBufferLength() - m_startPositionOffset;
- int offset = bufferLen - PdxHelper::PdxHeader;
+ auto offset = static_cast<int32_t>(bufferLen - PdxHelper::PdxHeader);
m_offsets.push_back(offset);
}
@@ -139,13 +139,14 @@ PdxWriter& PdxLocalWriter::writeUnreadFields(
}
int32_t PdxLocalWriter::calculateLenWithOffsets() {
- int bufferLen = m_dataOutput->getBufferLength() - m_startPositionOffset;
+ auto bufferLen = m_dataOutput->getBufferLength() - m_startPositionOffset;
int32_t totalOffsets = 0;
if (m_pdxType->getNumberOfVarLenFields() > 0) {
totalOffsets = m_pdxType->getNumberOfVarLenFields() -
1; // for first var len no need to append offset
}
- int32_t totalLen = bufferLen - PdxHelper::PdxHeader + totalOffsets;
+ auto totalLen =
+ static_cast<int32_t>(bufferLen - PdxHelper::PdxHeader + totalOffsets);
if (totalLen <= 0xff) { // 1 byte
return totalLen;
@@ -158,8 +159,8 @@ int32_t PdxLocalWriter::calculateLenWithOffsets() {
bool PdxLocalWriter::isFieldWritingStarted() { return true; }
-PdxWriter& PdxLocalWriter::writeChar(
- const std::string& fieldName, char16_t value) {
+PdxWriter& PdxLocalWriter::writeChar(const std::string& fieldName,
+ char16_t value) {
m_dataOutput->writeChar(value);
return *this;
}
@@ -167,50 +168,50 @@ PdxWriter& PdxLocalWriter::writeBoolean(const std::string& fieldName,
bool value) {
m_dataOutput->writeBoolean(value);
return *this;
- }
- PdxWriter& PdxLocalWriter::writeByte(const std::string& fieldName,
- int8_t value) {
- m_dataOutput->write(value);
- return *this;
- }
- PdxWriter& PdxLocalWriter::writeShort(const std::string& fieldName,
- int16_t value) {
- m_dataOutput->writeInt(value);
- return *this;
+}
+PdxWriter& PdxLocalWriter::writeByte(const std::string& fieldName,
+ int8_t value) {
+ m_dataOutput->write(value);
+ return *this;
+}
+PdxWriter& PdxLocalWriter::writeShort(const std::string& fieldName,
+ int16_t value) {
+ m_dataOutput->writeInt(value);
+ return *this;
}
PdxWriter& PdxLocalWriter::writeInt(const std::string& fieldName,
int32_t value) {
m_dataOutput->writeInt(value);
return *this;
- }
- PdxWriter& PdxLocalWriter::writeLong(const std::string& fieldName,
- int64_t value) {
- m_dataOutput->writeInt(value);
- return *this;
- }
- PdxWriter& PdxLocalWriter::writeFloat(const std::string& fieldName,
- float value) {
- m_dataOutput->writeFloat(value);
- return *this;
- }
- PdxWriter& PdxLocalWriter::writeDouble(const std::string& fieldName,
- double value) {
- m_dataOutput->writeDouble(value);
- return *this;
- }
- PdxWriter& PdxLocalWriter::writeDate(const std::string& fieldName,
- std::shared_ptr<CacheableDate> date) {
- // m_dataOutput->writeObject(date.get());
- if (date != nullptr) {
- date->toData(*m_dataOutput);
- } else {
- m_dataOutput->writeInt(static_cast<uint64_t>(-1L));
- }
- return *this;
-}
-
-PdxWriter& PdxLocalWriter::writeString(
- const std::string& fieldName, const std::string& value) {
+}
+PdxWriter& PdxLocalWriter::writeLong(const std::string& fieldName,
+ int64_t value) {
+ m_dataOutput->writeInt(value);
+ return *this;
+}
+PdxWriter& PdxLocalWriter::writeFloat(const std::string& fieldName,
+ float value) {
+ m_dataOutput->writeFloat(value);
+ return *this;
+}
+PdxWriter& PdxLocalWriter::writeDouble(const std::string& fieldName,
+ double value) {
+ m_dataOutput->writeDouble(value);
+ return *this;
+}
+PdxWriter& PdxLocalWriter::writeDate(const std::string& fieldName,
+ std::shared_ptr<CacheableDate> date) {
+ // m_dataOutput->writeObject(date.get());
+ if (date != nullptr) {
+ date->toData(*m_dataOutput);
+ } else {
+ m_dataOutput->writeInt(static_cast<uint64_t>(-1L));
+ }
+ return *this;
+}
+
+PdxWriter& PdxLocalWriter::writeString(const std::string& fieldName,
+ const std::string& value) {
addOffset();
m_dataOutput->writeString(value);
return *this;
@@ -219,15 +220,15 @@ PdxWriter& PdxLocalWriter::writeString(
PdxWriter& PdxLocalWriter::writeStringArray(
const std::string& fieldName, const std::vector<std::string>& array) {
addOffset();
- m_dataOutput->writeArrayLen(array.size());
+ m_dataOutput->writeArrayLen(static_cast<int32_t>(array.size()));
for (auto&& entry : array) {
m_dataOutput->writeString(entry);
}
return *this;
}
-PdxWriter& PdxLocalWriter::writeObject(
- const std::string& fieldName, std::shared_ptr<Serializable> value) {
+PdxWriter& PdxLocalWriter::writeObject(const std::string& fieldName,
+ std::shared_ptr<Serializable> value) {
addOffset();
std::shared_ptr<CacheableEnum> enumValPtr = nullptr;
std::shared_ptr<CacheableObjectArray> objArrPtr = nullptr;
@@ -278,15 +279,15 @@ PdxWriter& PdxLocalWriter::writeBooleanArray(const std::string& fieldName,
return *this;
}
-PdxWriter& PdxLocalWriter::writeCharArray(
- const std::string& fieldName, const std::vector<char16_t>& array) {
+PdxWriter& PdxLocalWriter::writeCharArray(const std::string& fieldName,
+ const std::vector<char16_t>& array) {
addOffset();
writeArrayObject(array);
return *this;
}
-PdxWriter& PdxLocalWriter::writeByteArray(
- const std::string& fieldName, const std::vector<int8_t>& array) {
+PdxWriter& PdxLocalWriter::writeByteArray(const std::string& fieldName,
+ const std::vector<int8_t>& array) {
addOffset();
writeArrayObject(array);
return *this;
@@ -308,29 +309,28 @@ PdxWriter& PdxLocalWriter::writeLongArray(const std::string& fieldName,
addOffset();
writeArrayObject(array);
return *this;
- }
- PdxWriter& PdxLocalWriter::writeFloatArray(const std::string& fieldName,
- const std::vector<float>& array) {
- addOffset();
- writeArrayObject(array);
- return *this;
- }
- PdxWriter& PdxLocalWriter::writeDoubleArray(const std::string& fieldName,
- const std::vector<double>& array) {
- addOffset();
- writeArrayObject(array);
- return *this;
- }
- PdxWriter& PdxLocalWriter::writeObjectArray(
- const std::string& fieldName,
- std::shared_ptr<CacheableObjectArray> array) {
- addOffset();
- if (array != nullptr) {
- array->toData(*m_dataOutput);
- } else {
- m_dataOutput->write(static_cast<int8_t>(-1));
- }
- return *this;
+}
+PdxWriter& PdxLocalWriter::writeFloatArray(const std::string& fieldName,
+ const std::vector<float>& array) {
+ addOffset();
+ writeArrayObject(array);
+ return *this;
+}
+PdxWriter& PdxLocalWriter::writeDoubleArray(const std::string& fieldName,
+ const std::vector<double>& array) {
+ addOffset();
+ writeArrayObject(array);
+ return *this;
+}
+PdxWriter& PdxLocalWriter::writeObjectArray(
+ const std::string& fieldName, std::shared_ptr<CacheableObjectArray> array) {
+ addOffset();
+ if (array != nullptr) {
+ array->toData(*m_dataOutput);
+ } else {
+ m_dataOutput->write(static_cast<int8_t>(-1));
+ }
+ return *this;
}
PdxWriter& PdxLocalWriter::writeArrayOfByteArrays(
const std::string& fieldName, int8_t* const* const byteArrays,
diff --git a/cppcache/src/PdxLocalWriter.hpp b/cppcache/src/PdxLocalWriter.hpp
index 8fa2e90..14f7697 100644
--- a/cppcache/src/PdxLocalWriter.hpp
+++ b/cppcache/src/PdxLocalWriter.hpp
@@ -112,14 +112,14 @@ class PdxLocalWriter : public PdxWriter {
template <typename mType>
void writeArrayObject(std::vector<mType> array) {
- m_dataOutput->writeArrayLen(array.size());
+ m_dataOutput->writeArrayLen(static_cast<int32_t>(array.size()));
for (auto&& obj : array) {
writeObject(obj);
}
}
virtual PdxWriter& writeChar(const std::string& fieldName,
- char16_t value) override;
+ char16_t value) override;
virtual PdxWriter& writeBoolean(const std::string& fieldName,
bool value) override;
@@ -145,44 +145,36 @@ class PdxLocalWriter : public PdxWriter {
virtual PdxWriter& writeDate(const std::string& fieldName,
std::shared_ptr<CacheableDate> date) override;
- virtual PdxWriter& writeString(
- const std::string& fieldName, const std::string& value) override;
+ virtual PdxWriter& writeString(const std::string& fieldName,
+ const std::string& value) override;
- virtual PdxWriter& writeObject(
- const std::string& fieldName,
- std::shared_ptr<Serializable> value) override;
+ virtual PdxWriter& writeObject(const std::string& fieldName,
+ std::shared_ptr<Serializable> value) override;
- virtual PdxWriter& writeBooleanArray(
- const std::string& fieldName,
- const std::vector<bool>& array) override;
+ virtual PdxWriter& writeBooleanArray(const std::string& fieldName,
+ const std::vector<bool>& array) override;
virtual PdxWriter& writeCharArray(
const std::string& fieldName,
const std::vector<char16_t>& array) override;
- virtual PdxWriter& writeByteArray(
- const std::string& fieldName,
- const std::vector<int8_t>& array) override;
+ virtual PdxWriter& writeByteArray(const std::string& fieldName,
+ const std::vector<int8_t>& array) override;
virtual PdxWriter& writeShortArray(
- const std::string& fieldName,
- const std::vector<int16_t>& array) override;
+ const std::string& fieldName, const std::vector<int16_t>& array) override;
- virtual PdxWriter& writeIntArray(
- const std::string& fieldName,
- const std::vector<int32_t>& array) override;
+ virtual PdxWriter& writeIntArray(const std::string& fieldName,
+ const std::vector<int32_t>& array) override;
- virtual PdxWriter& writeLongArray(
- const std::string& fieldName,
- const std::vector<int64_t>& array) override;
+ virtual PdxWriter& writeLongArray(const std::string& fieldName,
+ const std::vector<int64_t>& array) override;
- virtual PdxWriter& writeFloatArray(
- const std::string& fieldName,
- const std::vector<float>& array) override;
+ virtual PdxWriter& writeFloatArray(const std::string& fieldName,
+ const std::vector<float>& array) override;
virtual PdxWriter& writeDoubleArray(
- const std::string& fieldName,
- const std::vector<double>& array) override;
+ const std::string& fieldName, const std::vector<double>& array) override;
virtual PdxWriter& writeStringArray(
const std::string& fieldName,
@@ -192,9 +184,10 @@ class PdxLocalWriter : public PdxWriter {
const std::string& fieldName,
std::shared_ptr<CacheableObjectArray> array) override;
- virtual PdxWriter& writeArrayOfByteArrays(
- const std::string& fieldName, int8_t* const* const array, int arrayLength,
- const int* elementLength) override;
+ virtual PdxWriter& writeArrayOfByteArrays(const std::string& fieldName,
+ int8_t* const* const array,
+ int arrayLength,
+ const int* elementLength) override;
virtual PdxWriter& markIdentityField(const std::string& fieldName) override;
diff --git a/cppcache/src/PdxRemoteReader.cpp b/cppcache/src/PdxRemoteReader.cpp
index 9057e14..c93a0fe 100644
--- a/cppcache/src/PdxRemoteReader.cpp
+++ b/cppcache/src/PdxRemoteReader.cpp
@@ -47,7 +47,7 @@ char16_t PdxRemoteReader::readChar(const std::string& fieldName) {
choice, m_offsetsBuffer, m_offsetSize, m_serializedLength);
PdxLocalReader::resettoPdxHead();
m_dataInput->advanceCursor(position);
- char retVal = PdxLocalReader::readChar(fieldName);
+ auto retVal = PdxLocalReader::readChar(fieldName);
PdxLocalReader::resettoPdxHead();
return retVal;
}
@@ -306,7 +306,8 @@ std::shared_ptr<Serializable> PdxRemoteReader::readObject(
}
}
-std::vector<char16_t> PdxRemoteReader::readCharArray(const std::string& fieldName) {
+std::vector<char16_t> PdxRemoteReader::readCharArray(
+ const std::string& fieldName) {
int choice = m_localToRemoteMap[m_currentIndex++];
std::vector<char16_t> array;
@@ -419,7 +420,8 @@ std::vector<int32_t> PdxRemoteReader::readIntArray(
return array;
}
-std::vector<int64_t> PdxRemoteReader::readLongArray(const std::string& fieldName) {
+std::vector<int64_t> PdxRemoteReader::readLongArray(
+ const std::string& fieldName) {
int choice = m_localToRemoteMap[m_currentIndex++];
std::vector<int64_t> array;
@@ -442,7 +444,8 @@ std::vector<int64_t> PdxRemoteReader::readLongArray(const std::string& fieldName
return array;
}
-std::vector<float> PdxRemoteReader::readFloatArray(const std::string& fieldName) {
+std::vector<float> PdxRemoteReader::readFloatArray(
+ const std::string& fieldName) {
int choice = m_localToRemoteMap[m_currentIndex++];
std::vector<float> array;
@@ -465,7 +468,8 @@ std::vector<float> PdxRemoteReader::readFloatArray(const std::string& fieldName)
return array;
}
-std::vector<double> PdxRemoteReader::readDoubleArray(const std::string& fieldName) {
+std::vector<double> PdxRemoteReader::readDoubleArray(
+ const std::string& fieldName) {
int choice = m_localToRemoteMap[m_currentIndex++];
std::vector<double> array;
@@ -480,8 +484,7 @@ std::vector<double> PdxRemoteReader::readDoubleArray(const std::string& fieldNam
if (position != -1) {
PdxLocalReader::resettoPdxHead();
m_dataInput->advanceCursor(position);
- array = PdxLocalReader::readDoubleArray(
- fieldName); // in same order
+ array = PdxLocalReader::readDoubleArray(fieldName); // in same order
PdxLocalReader::resettoPdxHead();
}
}
diff --git a/cppcache/src/PdxWriterWithTypeCollector.cpp b/cppcache/src/PdxWriterWithTypeCollector.cpp
index 14bc343..ccff708 100644
--- a/cppcache/src/PdxWriterWithTypeCollector.cpp
+++ b/cppcache/src/PdxWriterWithTypeCollector.cpp
@@ -40,7 +40,8 @@ PdxWriterWithTypeCollector::PdxWriterWithTypeCollector(
}
void PdxWriterWithTypeCollector::initialize() {
- m_pdxType = std::make_shared<PdxType>(m_pdxTypeRegistry, m_domainClassName, true);
+ m_pdxType =
+ std::make_shared<PdxType>(m_pdxTypeRegistry, m_domainClassName, true);
}
void PdxWriterWithTypeCollector::endObjectWriting() {
@@ -65,7 +66,8 @@ void PdxWriterWithTypeCollector::writeOffsets(int32_t len) {
}
int32_t PdxWriterWithTypeCollector::calculateLenWithOffsets() {
- int bufferLen = m_dataOutput->getBufferLength() - m_startPositionOffset;
+ int bufferLen = static_cast<int32_t>(m_dataOutput->getBufferLength()) -
+ m_startPositionOffset;
int32_t totalOffsets = 0;
if (m_offsets.size() > 0) {
totalOffsets = static_cast<int32_t>(m_offsets.size()) -
@@ -83,7 +85,8 @@ int32_t PdxWriterWithTypeCollector::calculateLenWithOffsets() {
}
void PdxWriterWithTypeCollector::addOffset() {
- int bufferLen = m_dataOutput->getBufferLength() - m_startPositionOffset;
+ int bufferLen = static_cast<int32_t>(m_dataOutput->getBufferLength()) -
+ m_startPositionOffset;
int offset = bufferLen - PdxHelper::PdxHeader;
m_offsets.push_back(offset);
@@ -98,26 +101,26 @@ PdxWriter& PdxWriterWithTypeCollector::writeUnreadFields(
return *this;
}
-PdxWriter& PdxWriterWithTypeCollector::writeChar(
- const std::string& fieldName, char16_t value) {
+PdxWriter& PdxWriterWithTypeCollector::writeChar(const std::string& fieldName,
+ char16_t value) {
m_pdxType->addFixedLengthTypeField(fieldName, "char", PdxFieldTypes::CHAR,
PdxTypes::CHAR_SIZE);
PdxLocalWriter::writeChar(fieldName, value);
return *this;
- }
- PdxWriter& PdxWriterWithTypeCollector::writeBoolean(
- const std::string& fieldName, bool value) {
- m_pdxType->addFixedLengthTypeField(
- fieldName, "boolean", PdxFieldTypes::BOOLEAN, PdxTypes::BOOLEAN_SIZE);
- PdxLocalWriter::writeBoolean(fieldName, value);
- return *this;
- }
- PdxWriter& PdxWriterWithTypeCollector::writeByte(const std::string& fieldName,
- int8_t value) {
- m_pdxType->addFixedLengthTypeField(fieldName, "byte", PdxFieldTypes::BYTE,
- PdxTypes::BYTE_SIZE);
- PdxLocalWriter::writeByte(fieldName, value);
- return *this;
+}
+PdxWriter& PdxWriterWithTypeCollector::writeBoolean(
+ const std::string& fieldName, bool value) {
+ m_pdxType->addFixedLengthTypeField(
+ fieldName, "boolean", PdxFieldTypes::BOOLEAN, PdxTypes::BOOLEAN_SIZE);
+ PdxLocalWriter::writeBoolean(fieldName, value);
+ return *this;
+}
+PdxWriter& PdxWriterWithTypeCollector::writeByte(const std::string& fieldName,
+ int8_t value) {
+ m_pdxType->addFixedLengthTypeField(fieldName, "byte", PdxFieldTypes::BYTE,
+ PdxTypes::BYTE_SIZE);
+ PdxLocalWriter::writeByte(fieldName, value);
+ return *this;
}
PdxWriter& PdxWriterWithTypeCollector::writeShort(const std::string& fieldName,
int16_t value) {
@@ -125,34 +128,34 @@ PdxWriter& PdxWriterWithTypeCollector::writeShort(const std::string& fieldName,
PdxTypes::SHORT_SIZE);
PdxLocalWriter::writeShort(fieldName, value);
return *this;
- }
- PdxWriter& PdxWriterWithTypeCollector::writeInt(const std::string& fieldName,
- int32_t value) {
- m_pdxType->addFixedLengthTypeField(fieldName, "int", PdxFieldTypes::INT,
- PdxTypes::INTEGER_SIZE);
- PdxLocalWriter::writeInt(fieldName, value);
- return *this;
- }
- PdxWriter& PdxWriterWithTypeCollector::writeLong(const std::string& fieldName,
- int64_t value) {
- m_pdxType->addFixedLengthTypeField(fieldName, "long", PdxFieldTypes::LONG,
- PdxTypes::LONG_SIZE);
- PdxLocalWriter::writeLong(fieldName, value);
- return *this;
- }
- PdxWriter& PdxWriterWithTypeCollector::writeFloat(const std::string& fieldName,
- float value) {
- m_pdxType->addFixedLengthTypeField(fieldName, "float", PdxFieldTypes::FLOAT,
- PdxTypes::FLOAT_SIZE);
- PdxLocalWriter::writeFloat(fieldName, value);
- return *this;
- }
- PdxWriter& PdxWriterWithTypeCollector::writeDouble(
- const std::string& fieldName, double value) {
- m_pdxType->addFixedLengthTypeField(
- fieldName, "double", PdxFieldTypes::DOUBLE, PdxTypes::DOUBLE_SIZE);
- PdxLocalWriter::writeDouble(fieldName, value);
- return *this;
+}
+PdxWriter& PdxWriterWithTypeCollector::writeInt(const std::string& fieldName,
+ int32_t value) {
+ m_pdxType->addFixedLengthTypeField(fieldName, "int", PdxFieldTypes::INT,
+ PdxTypes::INTEGER_SIZE);
+ PdxLocalWriter::writeInt(fieldName, value);
+ return *this;
+}
+PdxWriter& PdxWriterWithTypeCollector::writeLong(const std::string& fieldName,
+ int64_t value) {
+ m_pdxType->addFixedLengthTypeField(fieldName, "long", PdxFieldTypes::LONG,
+ PdxTypes::LONG_SIZE);
+ PdxLocalWriter::writeLong(fieldName, value);
+ return *this;
+}
+PdxWriter& PdxWriterWithTypeCollector::writeFloat(const std::string& fieldName,
+ float value) {
+ m_pdxType->addFixedLengthTypeField(fieldName, "float", PdxFieldTypes::FLOAT,
+ PdxTypes::FLOAT_SIZE);
+ PdxLocalWriter::writeFloat(fieldName, value);
+ return *this;
+}
+PdxWriter& PdxWriterWithTypeCollector::writeDouble(const std::string& fieldName,
+ double value) {
+ m_pdxType->addFixedLengthTypeField(fieldName, "double", PdxFieldTypes::DOUBLE,
+ PdxTypes::DOUBLE_SIZE);
+ PdxLocalWriter::writeDouble(fieldName, value);
+ return *this;
}
PdxWriter& PdxWriterWithTypeCollector::writeDate(
const std::string& fieldName, std::shared_ptr<CacheableDate> date) {
@@ -162,13 +165,13 @@ PdxWriter& PdxWriterWithTypeCollector::writeDate(
return *this;
}
-PdxWriter& PdxWriterWithTypeCollector::writeString(
- const std::string& fieldName, const std::string& value) {
+PdxWriter& PdxWriterWithTypeCollector::writeString(const std::string& fieldName,
+ const std::string& value) {
m_pdxType->addVariableLengthTypeField(fieldName, "String",
PdxFieldTypes::STRING);
PdxLocalWriter::writeString(fieldName, value);
return *this;
- }
+}
PdxWriter& PdxWriterWithTypeCollector::writeObject(
const std::string& fieldName, std::shared_ptr<Serializable> value) {
diff --git a/cppcache/src/ResultSetImpl.cpp b/cppcache/src/ResultSetImpl.cpp
index c9096fa..00b74c7 100644
--- a/cppcache/src/ResultSetImpl.cpp
+++ b/cppcache/src/ResultSetImpl.cpp
@@ -30,7 +30,7 @@ ResultSetImpl::ResultSetImpl(const std::shared_ptr<CacheableVector>& response)
bool ResultSetImpl::isModifiable() const { return false; }
-int32_t ResultSetImpl::size() const {
+size_t ResultSetImpl::size() const {
return static_cast<int32_t>(m_resultSetVector->size());
}
@@ -53,4 +53,3 @@ SelectResults::Iterator ResultSetImpl::begin() const {
SelectResults::Iterator ResultSetImpl::end() const {
return m_resultSetVector->end();
}
-
diff --git a/cppcache/src/ResultSetImpl.hpp b/cppcache/src/ResultSetImpl.hpp
index 12a456c..fc92a59 100644
--- a/cppcache/src/ResultSetImpl.hpp
+++ b/cppcache/src/ResultSetImpl.hpp
@@ -43,10 +43,9 @@ class _GEODE_EXPORT ResultSetImpl
bool isModifiable() const override;
- int32_t size() const override;
+ size_t size() const override;
- const std::shared_ptr<Serializable> operator[](
- size_t index) const override;
+ const std::shared_ptr<Serializable> operator[](size_t index) const override;
SelectResultsIterator getIterator() override;
diff --git a/cppcache/src/Struct.cpp b/cppcache/src/Struct.cpp
index 4239d4d..d1b042f 100644
--- a/cppcache/src/Struct.cpp
+++ b/cppcache/src/Struct.cpp
@@ -108,7 +108,7 @@ const std::shared_ptr<Serializable> Struct::operator[](int32_t index) const {
const std::shared_ptr<Serializable> Struct::operator[](
const std::string& fieldName) const {
- int32_t index;
+ size_t index;
if (m_parent == nullptr) {
const auto& iter = m_fieldNames.find(fieldName);
if (iter == m_fieldNames.end()) {
diff --git a/cppcache/src/StructSetImpl.cpp b/cppcache/src/StructSetImpl.cpp
index c3ff2d5..a06d775 100644
--- a/cppcache/src/StructSetImpl.cpp
+++ b/cppcache/src/StructSetImpl.cpp
@@ -36,8 +36,8 @@ StructSetImpl::StructSetImpl(const std::shared_ptr<CacheableVector>& response,
m_fieldNameIndexMap.emplace(fieldName, i++);
}
- int32_t numOfValues = response->size();
- int32_t valStoredCnt = 0;
+ auto numOfValues = response->size();
+ size_t valStoredCnt = 0;
const auto numOfFields = fieldNames.size();
m_structVector = CacheableVector::create();
@@ -53,7 +53,7 @@ StructSetImpl::StructSetImpl(const std::shared_ptr<CacheableVector>& response,
bool StructSetImpl::isModifiable() const { return false; }
-int32_t StructSetImpl::size() const { return m_structVector->size(); }
+size_t StructSetImpl::size() const { return m_structVector->size(); }
const std::shared_ptr<Serializable> StructSetImpl::operator[](
size_t index) const {
@@ -68,9 +68,8 @@ SelectResultsIterator StructSetImpl::getIterator() {
return SelectResultsIterator(m_structVector, shared_from_this());
}
-const int32_t StructSetImpl::getFieldIndex(const std::string& fieldname) {
- const auto& iter =
- m_fieldNameIndexMap.find(fieldname);
+const size_t StructSetImpl::getFieldIndex(const std::string& fieldname) {
+ const auto& iter = m_fieldNameIndexMap.find(fieldname);
if (iter != m_fieldNameIndexMap.end()) {
return iter->second;
} else {
diff --git a/cppcache/src/StructSetImpl.hpp b/cppcache/src/StructSetImpl.hpp
index c50f9d2..b463e97 100644
--- a/cppcache/src/StructSetImpl.hpp
+++ b/cppcache/src/StructSetImpl.hpp
@@ -48,12 +48,11 @@ class _GEODE_EXPORT StructSetImpl
bool isModifiable() const override;
- int32_t size() const override;
+ size_t size() const override;
- const std::shared_ptr<Serializable> operator[](
- size_t index) const override;
+ const std::shared_ptr<Serializable> operator[](size_t index) const override;
- const int32_t getFieldIndex(const std::string& fieldname) override;
+ const size_t getFieldIndex(const std::string& fieldname) override;
const std::string& getFieldName(int32_t index) override;
diff --git a/cppcache/src/TcpConn.cpp b/cppcache/src/TcpConn.cpp
index aacaafe..e87f4f1 100644
--- a/cppcache/src/TcpConn.cpp
+++ b/cppcache/src/TcpConn.cpp
@@ -253,18 +253,18 @@ void TcpConn::close() {
}
}
-int32_t TcpConn::receive(char *buff, int32_t len,
- std::chrono::microseconds waitSeconds) {
+size_t TcpConn::receive(char *buff, size_t len,
+ std::chrono::microseconds waitSeconds) {
return socketOp(SOCK_READ, buff, len, waitSeconds);
}
-int32_t TcpConn::send(const char *buff, int32_t len,
- std::chrono::microseconds waitSeconds) {
+size_t TcpConn::send(const char *buff, size_t len,
+ std::chrono::microseconds waitSeconds) {
return socketOp(SOCK_WRITE, const_cast<char *>(buff), len, waitSeconds);
}
-int32_t TcpConn::socketOp(TcpConn::SockOp op, char *buff, int32_t len,
- std::chrono::microseconds waitSeconds) {
+size_t TcpConn::socketOp(TcpConn::SockOp op, char *buff, size_t len,
+ std::chrono::microseconds waitSeconds) {
{
/*{
ACE_HANDLE handle = m_io->get_handle();
@@ -301,8 +301,8 @@ int32_t TcpConn::socketOp(TcpConn::SockOp op, char *buff, int32_t len,
ssize_t retVal;
bool errnoSet = false;
- int32_t sendlen = len;
- int32_t totalsend = 0;
+ auto sendlen = len;
+ size_t totalsend = 0;
while (len > 0 && waitTime > ACE_Time_Value::zero) {
if (len > m_chunkSize) {
@@ -318,8 +318,8 @@ int32_t TcpConn::socketOp(TcpConn::SockOp op, char *buff, int32_t len,
} else {
retVal = m_io->send_n(buff, sendlen, &waitTime, &readLen);
}
- sendlen -= static_cast<int32_t>(readLen);
- totalsend += static_cast<int32_t>(readLen);
+ sendlen -= readLen;
+ totalsend += readLen;
if (retVal < 0) {
int32_t lastError = ACE_OS::last_error();
if (lastError == EAGAIN) {
diff --git a/cppcache/src/TcpConn.hpp b/cppcache/src/TcpConn.hpp
index 9d56b28..0b01377 100644
--- a/cppcache/src/TcpConn.hpp
+++ b/cppcache/src/TcpConn.hpp
@@ -61,8 +61,8 @@ class _GEODE_EXPORT TcpConn : public Connector {
void clearNagle(ACE_HANDLE sock);
int32_t maxSize(ACE_HANDLE sock, int32_t flag, int32_t size);
- virtual int32_t socketOp(SockOp op, char* buff, int32_t len,
- std::chrono::microseconds waitSeconds);
+ virtual size_t socketOp(SockOp op, char* buff, size_t len,
+ std::chrono::microseconds waitSeconds);
virtual void createSocket(ACE_HANDLE sock);
@@ -113,16 +113,15 @@ class _GEODE_EXPORT TcpConn : public Connector {
virtual void connect();
- int32_t receive(char* buff, int32_t len,
- std::chrono::microseconds waitSeconds) override;
- int32_t send(const char* buff, int32_t len,
- std::chrono::microseconds waitSeconds) override;
+ size_t receive(char* buff, size_t len,
+ std::chrono::microseconds waitSeconds) override;
+ size_t send(const char* buff, size_t len,
+ std::chrono::microseconds waitSeconds) override;
- virtual void setOption(int32_t level, int32_t option, void* val,
- int32_t len) {
+ virtual void setOption(int32_t level, int32_t option, void* val, size_t len) {
GF_DEV_ASSERT(m_io != nullptr);
- if (m_io->set_option(level, option, val, len) == -1) {
+ if (m_io->set_option(level, option, val, static_cast<int32_t>(len)) == -1) {
int32_t lastError = ACE_OS::last_error();
LOGERROR("Failed to set option, errno: %d: %s", lastError,
ACE_OS::strerror(lastError));
diff --git a/cppcache/src/TcpSslConn.cpp b/cppcache/src/TcpSslConn.cpp
index 3cadd3d..8ad2ab8 100644
--- a/cppcache/src/TcpSslConn.cpp
+++ b/cppcache/src/TcpSslConn.cpp
@@ -89,7 +89,8 @@ void TcpSslConn::connect() {
std::chrono::microseconds waitMicroSeconds = m_waitMilliSeconds;
LOGDEBUG("Connecting SSL socket stream to %s:%d waiting %d micro sec",
- m_addr.get_host_name(), m_addr.get_port_number(), waitMicroSeconds.count());
+ m_addr.get_host_name(), m_addr.get_port_number(),
+ waitMicroSeconds.count());
int32_t retVal = m_ssl->connect(m_addr, waitMicroSeconds);
@@ -121,8 +122,8 @@ void TcpSslConn::close() {
}
}
-int32_t TcpSslConn::socketOp(TcpConn::SockOp op, char* buff, int32_t len,
- std::chrono::microseconds waitSeconds) {
+size_t TcpSslConn::socketOp(TcpConn::SockOp op, char* buff, size_t len,
+ std::chrono::microseconds waitSeconds) {
{
GF_DEV_ASSERT(m_ssl != nullptr);
GF_DEV_ASSERT(buff != nullptr);
@@ -142,11 +143,11 @@ int32_t TcpSslConn::socketOp(TcpConn::SockOp op, char* buff, int32_t len,
endTime += waitTime;
ACE_Time_Value sleepTime(0, 100);
size_t readLen = 0;
- ssize_t retVal;
+ size_t retVal;
bool errnoSet = false;
- int32_t sendlen = len;
- int32_t totalsend = 0;
+ auto sendlen = len;
+ size_t totalsend = 0;
while (len > 0 && waitTime > ACE_Time_Value::zero) {
if (len > m_chunkSize) {
@@ -162,8 +163,8 @@ int32_t TcpSslConn::socketOp(TcpConn::SockOp op, char* buff, int32_t len,
} else {
retVal = m_ssl->send(buff, sendlen, &waitTime, &readLen);
}
- sendlen -= static_cast<int32_t>(readLen);
- totalsend += static_cast<int32_t>(readLen);
+ sendlen -= readLen;
+ totalsend += readLen;
if (retVal < 0) {
int32_t lastError = ACE_OS::last_error();
if (lastError == EAGAIN) {
diff --git a/cppcache/src/TcpSslConn.hpp b/cppcache/src/TcpSslConn.hpp
index f0af974..e8fca30 100644
--- a/cppcache/src/TcpSslConn.hpp
+++ b/cppcache/src/TcpSslConn.hpp
@@ -46,8 +46,8 @@ class TcpSslConn : public TcpConn {
const char* privkeyfile);
protected:
- int32_t socketOp(SockOp op, char* buff, int32_t len,
- std::chrono::microseconds waitSeconds) override;
+ size_t socketOp(SockOp op, char* buff, size_t len,
+ std::chrono::microseconds waitSeconds) override;
void createSocket(ACE_HANDLE sock) override;
@@ -86,10 +86,10 @@ class TcpSslConn : public TcpConn {
void connect() override;
void setOption(int32_t level, int32_t option, void* val,
- int32_t len) override {
+ size_t len) override {
GF_DEV_ASSERT(m_ssl != nullptr);
- if (m_ssl->setOption(level, option, val, len) == -1) {
+ if (m_ssl->setOption(level, option, val, static_cast<int32_t>(len)) == -1) {
int32_t lastError = ACE_OS::last_error();
LOGERROR("Failed to set option, errno: %d: %s", lastError,
ACE_OS::strerror(lastError));
diff --git a/cppcache/src/TcrConnection.cpp b/cppcache/src/TcrConnection.cpp
index 103dcd3..f590d36 100644
--- a/cppcache/src/TcrConnection.cpp
+++ b/cppcache/src/TcrConnection.cpp
@@ -270,8 +270,8 @@ bool TcrConnection::InitTcrConnection(
for (int pos = 0; pos < 64; pos++) {
serverChallengeBytes[pos] = getrand(255);
}
- serverChallenge = CacheableBytes::create(
- std::vector<int8_t>(serverChallengeBytes, serverChallengeBytes + 64));
+ serverChallenge = CacheableBytes::create(std::vector<int8_t>(
+ serverChallengeBytes, serverChallengeBytes + 64));
serverChallenge->toData(*handShakeMsg);
}
} else { // if isDhOn
@@ -367,8 +367,7 @@ bool TcrConnection::InitTcrConnection(
if (error == CONN_NOERR) {
acceptanceCode = readHandshakeData(1, connectTimeout);
- LOGDEBUG("Handshake: Got acceptanceCode Finally %d",
- acceptanceCode[0]);
+ LOGDEBUG("Handshake: Got acceptanceCode Finally %d", acceptanceCode[0]);
} else {
int32_t lastError = ACE_OS::last_error();
LOGERROR("Handshake failed, errno: %d, server may not be running",
@@ -518,8 +517,7 @@ bool TcrConnection::InitTcrConnection(
recvMessage.data());
auto message =
std::string("TcrConnection::TcrConnection: Unknown error") +
- " received from server in handshake: " +
- (char*)recvMessage.data();
+ " received from server in handshake: " + (char*)recvMessage.data();
MessageException ex(message);
GF_SAFE_DELETE_CON(m_conn);
throw ex;
@@ -590,7 +588,7 @@ Connector* TcrConnection::createConnection(
* Body: default timeout
*/
inline ConnErrType TcrConnection::receiveData(
- char* buffer, int32_t length, std::chrono::microseconds receiveTimeoutSec,
+ char* buffer, size_t length, std::chrono::microseconds receiveTimeoutSec,
bool checkConnected, bool isNotificationMessage) {
GF_DEV_ASSERT(buffer != nullptr);
GF_DEV_ASSERT(m_conn != nullptr);
@@ -599,7 +597,7 @@ inline ConnErrType TcrConnection::receiveData(
isNotificationMessage ? std::chrono::seconds(1) : std::chrono::seconds(2);
if (defaultWaitSecs > receiveTimeoutSec) defaultWaitSecs = receiveTimeoutSec;
- int32_t startLen = length;
+ auto startLen = length;
while (length > 0 && receiveTimeoutSec > std::chrono::microseconds::zero()) {
if (checkConnected && !m_connected) {
@@ -608,7 +606,7 @@ inline ConnErrType TcrConnection::receiveData(
if (receiveTimeoutSec < defaultWaitSecs) {
defaultWaitSecs = receiveTimeoutSec;
}
- int32_t readBytes = m_conn->receive(buffer, length, defaultWaitSecs);
+ auto readBytes = m_conn->receive(buffer, length, defaultWaitSecs);
int32_t lastError = ACE_OS::last_error();
length -= readBytes;
if (length > 0 && lastError != ETIME && lastError != ETIMEDOUT) {
@@ -640,14 +638,14 @@ inline ConnErrType TcrConnection::receiveData(
}
inline ConnErrType TcrConnection::sendData(
- const char* buffer, int32_t length, std::chrono::microseconds sendTimeout,
+ const char* buffer, size_t length, std::chrono::microseconds sendTimeout,
bool checkConnected) {
std::chrono::microseconds dummy{0};
return sendData(dummy, buffer, length, sendTimeout, checkConnected);
}
inline ConnErrType TcrConnection::sendData(
- std::chrono::microseconds& timeSpent, const char* buffer, int32_t length,
+ std::chrono::microseconds& timeSpent, const char* buffer, size_t length,
std::chrono::microseconds sendTimeout, bool checkConnected) {
GF_DEV_ASSERT(buffer != nullptr);
GF_DEV_ASSERT(m_conn != nullptr);
@@ -665,7 +663,7 @@ inline ConnErrType TcrConnection::sendData(
if (sendTimeout < defaultWaitSecs) {
defaultWaitSecs = sendTimeout;
}
- int32_t sentBytes = m_conn->send(buffer, length, defaultWaitSecs);
+ auto sentBytes = m_conn->send(buffer, length, defaultWaitSecs);
length -= sentBytes;
buffer += sentBytes;
@@ -685,7 +683,7 @@ inline ConnErrType TcrConnection::sendData(
return (length == 0 ? CONN_NOERR : CONN_TIMEOUT);
}
-char* TcrConnection::sendRequest(const char* buffer, int32_t len,
+char* TcrConnection::sendRequest(const char* buffer, size_t len,
size_t* recvLen,
std::chrono::microseconds sendTimeoutSec,
std::chrono::microseconds receiveTimeoutSec,
@@ -705,7 +703,7 @@ char* TcrConnection::sendRequest(const char* buffer, int32_t len,
}
void TcrConnection::sendRequestForChunkedResponse(
- const TcrMessage& request, int32_t len, TcrMessageReply& reply,
+ const TcrMessage& request, size_t len, TcrMessageReply& reply,
std::chrono::microseconds sendTimeoutSec,
std::chrono::microseconds receiveTimeoutSec) {
int32_t msgType = request.getMessageType();
@@ -784,7 +782,7 @@ void TcrConnection::sendRequestForChunkedResponse(
readMessageChunked(reply, receiveTimeoutSec, true);
}
-void TcrConnection::send(const char* buffer, int len,
+void TcrConnection::send(const char* buffer, size_t len,
std::chrono::microseconds sendTimeoutSec,
bool checkConnected) {
std::chrono::microseconds dummy;
@@ -792,7 +790,7 @@ void TcrConnection::send(const char* buffer, int len,
}
void TcrConnection::send(std::chrono::microseconds& timeSpent,
- const char* buffer, int len,
+ const char* buffer, size_t len,
std::chrono::microseconds sendTimeoutSec,
bool checkConnected) {
GF_DEV_ASSERT(m_conn != nullptr);
@@ -992,8 +990,8 @@ void TcrConnection::readMessageChunked(
"endpoint %s; bytes: %s",
m_endpoint, Utils::convertBytesToString(msg_header, HDR_LEN_12).c_str());
- auto input = m_connectionManager->getCacheImpl()->createDataInput(
- msg_header, HDR_LEN_12);
+ auto input = m_connectionManager->getCacheImpl()->createDataInput(msg_header,
+ HDR_LEN_12);
int32_t msgType = input->readInt32();
reply.setMessageType(msgType);
int32_t txId;
@@ -1057,9 +1055,8 @@ void TcrConnection::readMessageChunked(
.c_str());
- auto input =
- m_connectionManager->getCacheImpl()->createDataInput(
- msg_header + HDR_LEN_12, HDR_LEN);
+ auto input = m_connectionManager->getCacheImpl()->createDataInput(
+ msg_header + HDR_LEN_12, HDR_LEN);
int32_t chunkLen;
chunkLen = input->readInt32();
// check that chunk length is valid.
@@ -1137,7 +1134,7 @@ std::vector<int8_t> TcrConnection::readHandshakeData(
_GEODE_NEW(recvMessage, char[msgLength + 1]);
recvMessage[msgLength] = '\0';
if (msgLength == 0) {
- return std::vector<int8_t>(recvMessage, recvMessage +1);
+ return std::vector<int8_t>(recvMessage, recvMessage + 1);
}
if ((error = receiveData(recvMessage, msgLength, connectTimeout, false)) !=
CONN_NOERR) {
@@ -1189,8 +1186,8 @@ std::shared_ptr<CacheableBytes> TcrConnection::readHandshakeRawData(
// not expected to be reached
return nullptr;
} else {
- return CacheableBytes::create(std::vector<int8_t>(recvMessage, recvMessage +
- msgLength));
+ return CacheableBytes::create(
+ std::vector<int8_t>(recvMessage, recvMessage + msgLength));
}
}
@@ -1205,8 +1202,7 @@ uint32_t TcrConnection::readHandshakeArraySize(
std::chrono::microseconds connectTimeout) {
auto codeBytes = readHandshakeData(1, connectTimeout);
auto codeDI = m_connectionManager->getCacheImpl()->createDataInput(
- reinterpret_cast<const uint8_t*>(codeBytes.data()),
- codeBytes.size());
+ reinterpret_cast<const uint8_t*>(codeBytes.data()), codeBytes.size());
uint8_t code = codeDI->read();
uint32_t arraySize = 0;
if (code == 0xFF) {
@@ -1217,15 +1213,13 @@ uint32_t TcrConnection::readHandshakeArraySize(
if (code == 0xFE) {
auto lenBytes = readHandshakeData(2, connectTimeout);
auto lenDI = m_connectionManager->getCacheImpl()->createDataInput(
- reinterpret_cast<const uint8_t*>(lenBytes.data()),
- lenBytes.size());
+ reinterpret_cast<const uint8_t*>(lenBytes.data()), lenBytes.size());
uint16_t val = lenDI->readInt16();
tempLen = val;
} else if (code == 0xFD) {
auto lenBytes = readHandshakeData(4, connectTimeout);
auto lenDI = m_connectionManager->getCacheImpl()->createDataInput(
- reinterpret_cast<const uint8_t*>(lenBytes.data()),
- lenBytes.size());
+ reinterpret_cast<const uint8_t*>(lenBytes.data()), lenBytes.size());
uint32_t val = lenDI->readInt32();
tempLen = val;
} else {
@@ -1317,8 +1311,8 @@ int32_t TcrConnection::readHandShakeInt(
}
}
- auto di = m_connectionManager->getCacheImpl()->createDataInput(
- recvMessage, 4);
+ auto di =
+ m_connectionManager->getCacheImpl()->createDataInput(recvMessage, 4);
int32_t val = di->readInt32();
_GEODE_SAFE_DELETE_ARRAY(recvMessage);
@@ -1357,8 +1351,7 @@ std::shared_ptr<CacheableString> TcrConnection::readHandshakeString(
case GeodeTypeIds::CacheableASCIIString: {
auto lenBytes = readHandshakeData(2, connectTimeout);
auto lenDI = m_connectionManager->getCacheImpl()->createDataInput(
- reinterpret_cast<const uint8_t*>(lenBytes.data()),
- lenBytes.size());
+ reinterpret_cast<const uint8_t*>(lenBytes.data()), lenBytes.size());
length = lenDI->readInt16();
break;
diff --git a/cppcache/src/TcrConnection.hpp b/cppcache/src/TcrConnection.hpp
index 5472749..645a0e9 100644
--- a/cppcache/src/TcrConnection.hpp
+++ b/cppcache/src/TcrConnection.hpp
@@ -164,7 +164,7 @@ class _GEODE_EXPORT TcrConnection {
* operation: 1 write, 2 read
*/
char* sendRequest(
- const char* buffer, int32_t len, size_t* recvLen,
+ const char* buffer, size_t len, size_t* recvLen,
std::chrono::microseconds sendTimeoutSec = DEFAULT_WRITE_TIMEOUT,
std::chrono::microseconds receiveTimeoutSec = DEFAULT_READ_TIMEOUT_SECS,
int32_t request = -1);
@@ -182,7 +182,7 @@ class _GEODE_EXPORT TcrConnection {
* operation: 1 write, 2 read
*/
void sendRequestForChunkedResponse(
- const TcrMessage& request, int32_t len, TcrMessageReply& message,
+ const TcrMessage& request, size_t len, TcrMessageReply& message,
std::chrono::microseconds sendTimeoutSec = DEFAULT_WRITE_TIMEOUT,
std::chrono::microseconds receiveTimeoutSec = DEFAULT_READ_TIMEOUT_SECS);
@@ -198,11 +198,12 @@ class _GEODE_EXPORT TcrConnection {
* @exception TimeoutException if timeout happens at any of the 3 socket
* operation: 1 write, 2 read
*/
- void send(const char* buffer, int len,
+ void send(const char* buffer, size_t len,
std::chrono::microseconds sendTimeoutSec = DEFAULT_WRITE_TIMEOUT,
bool checkConnected = true);
- void send(std::chrono::microseconds& timeSpent, const char* buffer, int len,
+ void send(std::chrono::microseconds& timeSpent, const char* buffer,
+ size_t len,
std::chrono::microseconds sendTimeoutSec = DEFAULT_WRITE_TIMEOUT,
bool checkConnected = true);
@@ -376,18 +377,18 @@ class _GEODE_EXPORT TcrConnection {
/**
* Send data to the connection till sendTimeout
*/
- ConnErrType sendData(const char* buffer, int32_t length,
+ ConnErrType sendData(const char* buffer, size_t length,
std::chrono::microseconds sendTimeout,
bool checkConnected = true);
ConnErrType sendData(std::chrono::microseconds& timeSpent, const char* buffer,
- int32_t length, std::chrono::microseconds sendTimeout,
+ size_t length, std::chrono::microseconds sendTimeout,
bool checkConnected = true);
/**
* Read data from the connection till receiveTimeoutSec
*/
- ConnErrType receiveData(char* buffer, int32_t length,
+ ConnErrType receiveData(char* buffer, size_t length,
std::chrono::microseconds receiveTimeoutSec,
bool checkConnected = true,
bool isNotificationMessage = false);
diff --git a/cppcache/src/TcrMessage.cpp b/cppcache/src/TcrMessage.cpp
index 598352c..3a4583a 100644
--- a/cppcache/src/TcrMessage.cpp
+++ b/cppcache/src/TcrMessage.cpp
@@ -465,7 +465,7 @@ void TcrMessage::writeObjectPart(
if (se != nullptr && se->typeId() == GeodeTypeIds::CacheableBytes) {
// for an emty byte array write EMPTY_BYTEARRAY_CODE(2) to is object
try {
- int byteArrLength = -1;
+ size_t byteArrLength = -1;
if (auto cacheableBytes = std::dynamic_pointer_cast<CacheableBytes>(se)) {
byteArrLength = cacheableBytes->length();
@@ -495,7 +495,7 @@ void TcrMessage::writeObjectPart(
m_request->write(isObject);
}
- uint32_t sizeBeforeWritingObj = m_request->getBufferLength();
+ auto sizeBeforeWritingObj = m_request->getBufferLength();
if (isDelta) {
auto deltaPtr = std::dynamic_pointer_cast<Delta>(se);
deltaPtr->toDelta(*m_request);
@@ -522,8 +522,8 @@ void TcrMessage::writeObjectPart(
// m_request->writeBytesOnly(rawByteArray->value(), rawByteArray->length());
writeBytesOnly(se);
}
- uint32_t sizeAfterWritingObj = m_request->getBufferLength();
- uint32_t sizeOfSerializedObj = sizeAfterWritingObj - sizeBeforeWritingObj;
+ auto sizeAfterWritingObj = m_request->getBufferLength();
+ auto sizeOfSerializedObj = sizeAfterWritingObj - sizeBeforeWritingObj;
m_request->rewindCursor(sizeOfSerializedObj + 1 + 4); //
m_request->writeInt(static_cast<int32_t>(sizeOfSerializedObj));
m_request->advanceCursor(sizeOfSerializedObj + 1);
@@ -544,7 +544,7 @@ void TcrMessage::readInt(uint8_t* buffer, uint32_t* value) {
}
void TcrMessage::writeBytesOnly(const std::shared_ptr<Serializable>& se) {
- uint32_t cBufferLength = m_request->getBufferLength();
+ auto cBufferLength = m_request->getBufferLength();
uint8_t* startBytes = nullptr;
m_request->writeObject(se);
uint8_t* cursor =
@@ -659,8 +659,8 @@ void TcrMessage::writeEventIdPart(int reserveSize,
}
void TcrMessage::writeMessageLength() {
- uint32_t totalLen = m_request->getBufferLength();
- uint32_t msgLen = totalLen - g_headerLen;
+ auto totalLen = m_request->getBufferLength();
+ auto msgLen = totalLen - g_headerLen;
m_request->rewindCursor(
totalLen -
4); // msg len is written after the msg type which is of 4 bytes ...
@@ -2850,11 +2850,9 @@ const char* TcrMessage::getMsgBody() const {
return (char*)m_request->getBuffer() + g_headerLen;
}
-uint32_t TcrMessage::getMsgLength() const {
- return m_request->getBufferLength();
-}
+size_t TcrMessage::getMsgLength() const { return m_request->getBufferLength(); }
-uint32_t TcrMessage::getMsgBodyLength() const {
+size_t TcrMessage::getMsgBodyLength() const {
return m_request->getBufferLength() - g_headerLen;
}
std::shared_ptr<EventId> TcrMessage::getEventId() const { return m_eventid; }
diff --git a/cppcache/src/TcrMessage.hpp b/cppcache/src/TcrMessage.hpp
index 8012a29..8d1b2d1 100644
--- a/cppcache/src/TcrMessage.hpp
+++ b/cppcache/src/TcrMessage.hpp
@@ -334,8 +334,8 @@ class _GEODE_EXPORT TcrMessage {
const char* getMsgData() const;
const char* getMsgHeader() const;
const char* getMsgBody() const;
- uint32_t getMsgLength() const;
- uint32_t getMsgBodyLength() const;
+ size_t getMsgLength() const;
+ size_t getMsgBodyLength() const;
std::shared_ptr<EventId> getEventId() const;
int32_t getTransId() const;
diff --git a/cppcache/src/ThinClientLocatorHelper.cpp b/cppcache/src/ThinClientLocatorHelper.cpp
index 5f94f8f..62fe50b 100644
--- a/cppcache/src/ThinClientLocatorHelper.cpp
+++ b/cppcache/src/ThinClientLocatorHelper.cpp
@@ -102,10 +102,11 @@ GfErrType ThinClientLocatorHelper::getAllServers(
createConnection(conn, loc.getServerName().c_str(), loc.getPort(),
sysProps.connectTimeout(), buffSize);
GetAllServersRequest request(serverGrp);
- auto data = m_poolDM->getConnectionManager().getCacheImpl()->createDataOutput();
+ auto data =
+ m_poolDM->getConnectionManager().getCacheImpl()->createDataOutput();
data->writeInt((int32_t)1001); // GOSSIPVERSION
data->writeObject(&request);
- int sentLength = conn->send(
+ auto sentLength = conn->send(
(char*)(data->getBuffer()), data->getBufferLength(),
m_poolDM ? m_poolDM->getReadTimeout() : std::chrono::seconds(10));
if (sentLength <= 0) {
@@ -113,7 +114,7 @@ GfErrType ThinClientLocatorHelper::getAllServers(
continue;
}
char buff[BUFF_SIZE];
- int receivedLength = conn->receive(
+ auto receivedLength = conn->receive(
buff, BUFF_SIZE,
m_poolDM ? m_poolDM->getReadTimeout() : std::chrono::seconds(10));
// conn->close();
@@ -122,8 +123,9 @@ GfErrType ThinClientLocatorHelper::getAllServers(
continue;
}
- auto di = m_poolDM->getConnectionManager().getCacheImpl()->createDataInput(
- reinterpret_cast<uint8_t*>(buff), receivedLength);
+ auto di =
+ m_poolDM->getConnectionManager().getCacheImpl()->createDataInput(
+ reinterpret_cast<uint8_t*>(buff), receivedLength);
/* adongre
* SSL Enabled on Location and not in the client
@@ -194,10 +196,11 @@ GfErrType ThinClientLocatorHelper::getEndpointForNewCallBackConn(
sysProps.connectTimeout(), buffSize);
QueueConnectionRequest request(memId, exclEndPts, redundancy, false,
serverGrp);
- auto data = m_poolDM->getConnectionManager().getCacheImpl()->createDataOutput();
+ auto data =
+ m_poolDM->getConnectionManager().getCacheImpl()->createDataOutput();
data->writeInt((int32_t)1001); // GOSSIPVERSION
data->writeObject(&request);
- int sentLength = conn->send(
+ auto sentLength = conn->send(
(char*)(data->getBuffer()), data->getBufferLength(),
m_poolDM ? m_poolDM->getReadTimeout() : sysProps.connectTimeout());
if (sentLength <= 0) {
@@ -205,7 +208,7 @@ GfErrType ThinClientLocatorHelper::getEndpointForNewCallBackConn(
continue;
}
char buff[BUFF_SIZE];
- int receivedLength = conn->receive(
+ auto receivedLength = conn->receive(
buff, BUFF_SIZE,
m_poolDM ? m_poolDM->getReadTimeout() : sysProps.connectTimeout());
// conn->close();
@@ -213,8 +216,9 @@ GfErrType ThinClientLocatorHelper::getEndpointForNewCallBackConn(
if (receivedLength <= 0) {
continue;
}
- auto di = m_poolDM->getConnectionManager().getCacheImpl()->createDataInput(
- reinterpret_cast<uint8_t*>(buff), receivedLength);
+ auto di =
+ m_poolDM->getConnectionManager().getCacheImpl()->createDataInput(
+ reinterpret_cast<uint8_t*>(buff), receivedLength);
/* adongre
* ssl defect
@@ -282,9 +286,8 @@ GfErrType ThinClientLocatorHelper::getEndpointForNewFwdConn(
ConnectionWrapper cw(conn);
createConnection(conn, serLoc.getServerName().c_str(), serLoc.getPort(),
sysProps.connectTimeout(), buffSize);
- auto data = m_poolDM->getConnectionManager()
- .getCacheImpl()
- ->createDataOutput();
+ auto data =
+ m_poolDM->getConnectionManager().getCacheImpl()->createDataOutput();
data->writeInt(1001); // GOSSIPVERSION
if (currentServer == nullptr) {
LOGDEBUG("Creating ClientConnectionRequest");
@@ -297,7 +300,7 @@ GfErrType ThinClientLocatorHelper::getEndpointForNewFwdConn(
currentServer->getEndpointObject()->name(), exclEndPts, serverGrp);
data->writeObject(&request);
}
- int sentLength = conn->send(
+ auto sentLength = conn->send(
(char*)(data->getBuffer()), data->getBufferLength(),
m_poolDM ? m_poolDM->getReadTimeout() : sysProps.connectTimeout());
if (sentLength <= 0) {
@@ -306,7 +309,7 @@ GfErrType ThinClientLocatorHelper::getEndpointForNewFwdConn(
continue;
}
char buff[BUFF_SIZE];
- int receivedLength = conn->receive(
+ auto receivedLength = conn->receive(
buff, BUFF_SIZE,
m_poolDM ? m_poolDM->getReadTimeout() : sysProps.connectTimeout());
// conn->close();
@@ -314,8 +317,9 @@ GfErrType ThinClientLocatorHelper::getEndpointForNewFwdConn(
if (receivedLength <= 0) {
continue; // return GF_EUNDEF;
}
- auto di = m_poolDM->getConnectionManager().getCacheImpl()->createDataInput(
- reinterpret_cast<uint8_t*>(buff), receivedLength);
+ auto di =
+ m_poolDM->getConnectionManager().getCacheImpl()->createDataInput(
+ reinterpret_cast<uint8_t*>(buff), receivedLength);
/* adongre
* SSL is enabled on locator and not in the client
@@ -380,12 +384,11 @@ GfErrType ThinClientLocatorHelper::updateLocators(
createConnection(conn, serLoc.getServerName().c_str(), serLoc.getPort(),
sysProps.connectTimeout(), buffSize);
LocatorListRequest request(serverGrp);
- auto data = m_poolDM->getConnectionManager()
- .getCacheImpl()
- ->createDataOutput();
+ auto data =
+ m_poolDM->getConnectionManager().getCacheImpl()->createDataOutput();
data->writeInt((int32_t)1001); // GOSSIPVERSION
data->writeObject(&request);
- int sentLength = conn->send(
+ auto sentLength = conn->send(
(char*)(data->getBuffer()), data->getBufferLength(),
m_poolDM ? m_poolDM->getReadTimeout() : sysProps.connectTimeout());
if (sentLength <= 0) {
@@ -395,7 +398,7 @@ GfErrType ThinClientLocatorHelper::updateLocators(
continue;
}
char buff[BUFF_SIZE];
- int receivedLength = conn->receive(
+ auto receivedLength = conn->receive(
buff, BUFF_SIZE,
m_poolDM ? m_poolDM->getReadTimeout() : sysProps.connectTimeout());
// conn->close();
@@ -403,10 +406,9 @@ GfErrType ThinClientLocatorHelper::updateLocators(
if (receivedLength <= 0) {
continue;
}
- auto di = m_poolDM->getConnectionManager()
- .getCacheImpl()
- ->createDataInput(reinterpret_cast<uint8_t*>(buff),
- receivedLength);
+ auto di =
+ m_poolDM->getConnectionManager().getCacheImpl()->createDataInput(
+ reinterpret_cast<uint8_t*>(buff), receivedLength);
/* adongre
* SSL Enabled on Location and not in the client
diff --git a/cppcache/src/ThinClientPoolDM.cpp b/cppcache/src/ThinClientPoolDM.cpp
index 7681d4c..d92bd10 100644
--- a/cppcache/src/ThinClientPoolDM.cpp
+++ b/cppcache/src/ThinClientPoolDM.cpp
@@ -278,7 +278,8 @@ void ThinClientPoolDM::startBackgroundThreads() {
ACE_Event_Handler* pingHandler =
new ExpiryHandler_T<ThinClientPoolDM>(this, &ThinClientPoolDM::doPing);
- long pingInterval = getPingInterval().count() / (1000 * 2);
+ auto pingInterval =
+ static_cast<int32_t>(getPingInterval().count() / (1000 * 2));
if (pingInterval > 0) {
LOGDEBUG(
"ThinClientPoolDM::startBackgroundThreads: Scheduling ping task at %ld",
@@ -293,7 +294,8 @@ void ThinClientPoolDM::startBackgroundThreads() {
getPingInterval().count());
}
- long updateLocatorListInterval = getUpdateLocatorListInterval().count();
+ auto updateLocatorListInterval =
+ static_cast<uint32_t>(getUpdateLocatorListInterval().count());
if (updateLocatorListInterval > 0) {
m_updateLocatorListTask =
@@ -702,7 +704,7 @@ const std::shared_ptr<CacheableStringArray> ThinClientPoolDM::getLocators()
ptrArr[i++] = CacheableString::create(locator);
}
return CacheableStringArray::create(
- std::vector<std::shared_ptr<CacheableString>>(ptrArr, ptrArr + i));
+ std::vector<std::shared_ptr<CacheableString>>(ptrArr, ptrArr + i));
}
const std::shared_ptr<CacheableStringArray> ThinClientPoolDM::getServers() {
@@ -714,7 +716,7 @@ const std::shared_ptr<CacheableStringArray> ThinClientPoolDM::getServers() {
ptrArr[i++] = CacheableString::create(server);
}
return CacheableStringArray::create(
- std::vector<std::shared_ptr<CacheableString>>(ptrArr, ptrArr + i));
+ std::vector<std::shared_ptr<CacheableString>>(ptrArr, ptrArr + i));
} else if (!m_attrs->m_initLocList.empty()) {
std::vector<ServerLocation> vec;
// TODO thread - why is this member volatile?
@@ -728,9 +730,11 @@ const std::shared_ptr<CacheableStringArray> ThinClientPoolDM::getServers() {
ptrArr[i++] = CacheableString::create(serLoc.getServerName() + ":" +
std::to_string(serLoc.getPort()));
}
- return CacheableStringArray::create(std::vector<std::shared_ptr<CacheableString>>(ptrArr, ptrArr + i));
+ return CacheableStringArray::create(
+ std::vector<std::shared_ptr<CacheableString>>(ptrArr, ptrArr + i));
} else {
- return CacheableStringArray::create(std::vector<std::shared_ptr<CacheableString>>{});
+ return CacheableStringArray::create(
+ std::vector<std::shared_ptr<CacheableString>>{});
}
}
@@ -1414,9 +1418,8 @@ GfErrType ThinClientPoolDM::sendSyncRequest(
"ThinClientPoolDM::sendSyncRequest: after "
"getConnectionInMultiuserMode %d",
isUserNeedToReAuthenticate);
- if (conn !=
- nullptr) { // need to chk whether user is already authenticated
- // to this endpoint or not.
+ if (conn != nullptr) { // need to chk whether user is already
+ // authenticated to this endpoint or not.
isUserNeedToReAuthenticate =
!(userAttr->isEndpointAuthenticated(conn->getEndpointObject()));
}
diff --git a/cppcache/src/ThinClientPoolDM.hpp b/cppcache/src/ThinClientPoolDM.hpp
index 37d748b..956e3ff 100644
--- a/cppcache/src/ThinClientPoolDM.hpp
+++ b/cppcache/src/ThinClientPoolDM.hpp
@@ -413,7 +413,7 @@ class ThinClientPoolDM
Task<ThinClientPoolDM>* m_updateLocatorListTask;
Task<ThinClientPoolDM>* m_cliCallbackTask;
long m_pingTaskId;
- long m_updateLocatorListTaskId;
+ ExpiryTaskManager::id_type m_updateLocatorListTaskId;
long m_connManageTaskId;
int manageConnections(volatile bool& isRunning);
int doPing(const ACE_Time_Value&, const void*);
@@ -514,7 +514,6 @@ class FunctionExecution : public PooledWork<GfErrType> {
m_error = m_poolDM->handleEPError(m_ep, reply, m_error);
if (m_error != GF_NOERR) {
if (m_error == GF_NOTCON || m_error == GF_IOERR) {
-
delete resultProcessor;
resultProcessor = nullptr;
return GF_NOERR; // if server is unavailable its not an error for
@@ -537,7 +536,6 @@ class FunctionExecution : public PooledWork<GfErrType> {
exceptionPtr = CacheableString::create(reply.getException());
}
if (resultProcessor->getResult() == true) {
-
}
delete resultProcessor;
resultProcessor = nullptr;
@@ -609,7 +607,9 @@ class OnRegionFunctionExecution : public PooledWork<GfErrType> {
TcrMessage* getReply() { return m_reply; }
- std::shared_ptr<CacheableHashSet> getFailedNode() { return m_reply->getFailedNode(); }
+ std::shared_ptr<CacheableHashSet> getFailedNode() {
+ return m_reply->getFailedNode();
+ }
ChunkedFunctionExecutionResponse* getResultCollector() {
return static_cast<ChunkedFunctionExecutionResponse*>(m_resultCollector);
diff --git a/cppcache/src/ThinClientRegion.cpp b/cppcache/src/ThinClientRegion.cpp
index 3017916..73adc7d 100644
--- a/cppcache/src/ThinClientRegion.cpp
+++ b/cppcache/src/ThinClientRegion.cpp
@@ -241,9 +241,9 @@ class RemoveAllWork : public PooledWork<GfErrType>,
m_keys(keys),
m_papException(nullptr),
m_isPapeReceived(false) {
- m_request = new TcrMessageRemoveAll(
- m_region->getCache().createDataOutput(), m_region.get(), *keys,
- m_aCallbackArgument, m_poolDM);
+ m_request = new TcrMessageRemoveAll(m_region->getCache().createDataOutput(),
+ m_region.get(), *keys,
+ m_aCallbackArgument, m_poolDM);
m_reply = new TcrMessageReply(true, m_poolDM);
// create new instanceof VCOPL
ACE_Recursive_Thread_Mutex responseLock;
@@ -345,8 +345,7 @@ class RemoveAllWork : public PooledWork<GfErrType>,
ThinClientRegion::ThinClientRegion(
const std::string& name, CacheImpl* cacheImpl,
- const std::shared_ptr<RegionInternal>& rPtr,
- RegionAttributes attributes,
+ const std::shared_ptr<RegionInternal>& rPtr, RegionAttributes attributes,
const std::shared_ptr<CacheStatistics>& stats, bool shared)
: LocalRegion(name, cacheImpl, rPtr, attributes, stats, shared),
m_tcrdm((ThinClientBaseDM*)0),
@@ -2913,8 +2912,8 @@ void ThinClientRegion::registerInterestGetValues(
const std::shared_ptr<std::vector<std::shared_ptr<CacheableKey>>>&
resultKeys) {
auto exceptions = std::make_shared<HashMapOfException>();
- auto err = getAllNoThrow_remote(keys, nullptr, exceptions, resultKeys,
- true, nullptr);
+ auto err = getAllNoThrow_remote(keys, nullptr, exceptions, resultKeys, true,
+ nullptr);
GfErrTypeToException(method, err);
// log any exceptions here
for (const auto& iter : *exceptions) {
@@ -3621,7 +3620,7 @@ void ChunkedFunctionExecutionResponse::handleChunk(
return;
}
- int startLen =
+ auto startLen =
input->getBytesRead() -
1; // from here need to look value part + memberid AND -1 for array type
int32_t len = input->readArrayLen();
@@ -3685,13 +3684,13 @@ void ChunkedFunctionExecutionResponse::handleChunk(
input->readObject(value);
// TODO: track this memberId for PrFxHa
// input->readObject(memberId);
- int objectlen = input->getBytesRead() - startLen;
+ auto objectlen = input->getBytesRead() - startLen;
- int memberIdLen = partLen - objectlen;
+ auto memberIdLen = partLen - objectlen;
input->advanceCursor(memberIdLen);
- LOGDEBUG("function partlen = %d , objectlen = %d, memberidlen = %d ",
+ LOGDEBUG("function partlen = %d , objectlen = %z, memberidlen = %z ",
partLen, objectlen, memberIdLen);
- LOGDEBUG("function input->getBytesRemaining() = %d ",
+ LOGDEBUG("function input->getBytesRemaining() = %z ",
input->getBytesRemaining());
} else {
@@ -3920,9 +3919,8 @@ void ChunkedDurableCQListResponse::handleChunk(const uint8_t* chunk,
input->advanceCursor(1); // skip the CacheableArrayList type ID byte
- const auto stringParts =
- input->read(); // read the number of strings in the message this
- // is one byte
+ const auto stringParts = input->read(); // read the number of strings in the
+ // message this is one byte
for (int i = 0; i < stringParts; i++) {
m_resultList->push_back(
diff --git a/cppcache/src/TombstoneList.cpp b/cppcache/src/TombstoneList.cpp
index f4437a2..b8926a6 100644
--- a/cppcache/src/TombstoneList.cpp
+++ b/cppcache/src/TombstoneList.cpp
@@ -53,7 +53,8 @@ long TombstoneList::getExpiryTask(TombstoneExpiryHandler** handler) {
}
void TombstoneList::add(const std::shared_ptr<MapEntryImpl>& entry,
- TombstoneExpiryHandler* handler, long taskid) {
+ TombstoneExpiryHandler* handler,
+ ExpiryTaskManager::id_type taskid) {
// This function is not guarded as all functions of this class are called from
// MapSegment
// read TombstoneTImeout from systemProperties.
diff --git a/cppcache/src/VersionedCacheableObjectPartList.cpp b/cppcache/src/VersionedCacheableObjectPartList.cpp
index 05c1011..b270bd4 100644
--- a/cppcache/src/VersionedCacheableObjectPartList.cpp
+++ b/cppcache/src/VersionedCacheableObjectPartList.cpp
@@ -67,7 +67,8 @@ void VersionedCacheableObjectPartList::readObjectPart(
bytes = new int8_t[skipLen];
input.readBytesOnly(bytes, skipLen);
}
- m_values->emplace(keyPtr, CacheableBytes::create(std::vector<int8_t>(bytes, bytes + skipLen)));
+ m_values->emplace(keyPtr, CacheableBytes::create(
+ std::vector<int8_t>(bytes, bytes + skipLen)));
/* adongre
* CID 29377: Resource leak (RESOURCE_LEAK)Calling allocation function
@@ -227,7 +228,7 @@ void VersionedCacheableObjectPartList::fromData(DataInput& input) {
new VersionTag(memberListForVersionStamp));
}
versionTag->fromData(input);
- int32_t idNumber = input.readUnsignedVL();
+ auto idNumber = input.readUnsignedVL();
versionTag->setInternalMemID(ids.at(idNumber));
break;
}
diff --git a/cppcache/src/statistics/PoolStatsSampler.cpp b/cppcache/src/statistics/PoolStatsSampler.cpp
index 79b816d..078b61c 100644
--- a/cppcache/src/statistics/PoolStatsSampler.cpp
+++ b/cppcache/src/statistics/PoolStatsSampler.cpp
@@ -30,8 +30,8 @@ namespace apache {
namespace geode {
namespace statistics {
-using std::chrono::high_resolution_clock;
using std::chrono::duration_cast;
+using std::chrono::high_resolution_clock;
using std::chrono::milliseconds;
using std::chrono::nanoseconds;
@@ -122,13 +122,11 @@ void PoolStatsSampler::putStatsInAdminRegion() {
} catch (const AllConnectionsInUseException&) {
LOGDEBUG("All connection are in use, trying again.");
} catch (const NotConnectedException& ex) {
- try
- {
+ try {
std::rethrow_if_nested(ex);
- } catch (const NoAvailableLocatorsException& ex) {
+ } catch (const NoAvailableLocatorsException&) {
LOGDEBUG("No locators available, trying again.");
- }
- catch (...) {
+ } catch (...) {
LOGDEBUG("Not connected to geode, trying again.");
}
} catch (...) {
diff --git a/cppcache/src/statistics/StatArchiveWriter.cpp b/cppcache/src/statistics/StatArchiveWriter.cpp
index 795b978..3d2bd0f 100644
--- a/cppcache/src/statistics/StatArchiveWriter.cpp
+++ b/cppcache/src/statistics/StatArchiveWriter.cpp
@@ -32,19 +32,20 @@ namespace apache {
namespace geode {
namespace statistics {
-using std::chrono::steady_clock;
-using std::chrono::system_clock;
using std::chrono::duration_cast;
using std::chrono::milliseconds;
using std::chrono::nanoseconds;
+using std::chrono::steady_clock;
+using std::chrono::system_clock;
// Constructor and Member functions of StatDataOutput class
-StatDataOutput::StatDataOutput(CacheImpl* cache) : bytesWritten(0), m_fp(nullptr), closed(false) {
+StatDataOutput::StatDataOutput(CacheImpl *cache)
+ : bytesWritten(0), m_fp(nullptr), closed(false) {
dataBuffer = cache->getCache()->createDataOutput();
}
-StatDataOutput::StatDataOutput(std::string filename, CacheImpl* cache) {
+StatDataOutput::StatDataOutput(std::string filename, CacheImpl *cache) {
if (filename.length() == 0) {
std::string s("undefined archive file name");
throw IllegalArgumentException(s.c_str());
@@ -298,20 +299,21 @@ void ResourceInst::writeResourceInst(StatDataOutput *dataOutArg,
int32_t instId) {
if (instId > MAX_BYTE_RESOURCE_INST_ID) {
if (instId > MAX_SHORT_RESOURCE_INST_ID) {
- dataOutArg->writeByte(static_cast<int8_t>(INT_RESOURCE_INST_ID_TOKEN));
+ dataOutArg->writeByte(static_cast<uint8_t>(INT_RESOURCE_INST_ID_TOKEN));
dataOutArg->writeInt(instId);
} else {
- dataOutArg->writeByte(static_cast<int8_t>(SHORT_RESOURCE_INST_ID_TOKEN));
+ dataOutArg->writeByte(static_cast<uint8_t>(SHORT_RESOURCE_INST_ID_TOKEN));
dataOutArg->writeShort(instId);
}
} else {
- dataOutArg->writeByte(static_cast<int8_t>(instId));
+ dataOutArg->writeByte(static_cast<uint8_t>(instId));
}
}
// Constructor and Member functions of StatArchiveWriter class
StatArchiveWriter::StatArchiveWriter(std::string outfile,
- HostStatSampler *samplerArg, CacheImpl* cache)
+ HostStatSampler *samplerArg,
+ CacheImpl *cache)
: cache(cache) {
resourceTypeId = 0;
resourceInstId = 0;
@@ -516,10 +518,10 @@ void StatArchiveWriter::resampleResources() {
void StatArchiveWriter::writeTimeStamp(
const steady_clock::time_point &timeStamp) {
- int32_t delta =
- duration_cast<milliseconds>(timeStamp - this->previousTimeStamp).count();
+ auto delta = static_cast<int32_t>(
+ duration_cast<milliseconds>(timeStamp - this->previousTimeStamp).count());
if (delta > MAX_SHORT_TIMESTAMP) {
- dataBuffer->writeShort(static_cast<int16_t>(INT_TIMESTAMP_TOKEN));
+ dataBuffer->writeShort(static_cast<uint16_t>(INT_TIMESTAMP_TOKEN));
dataBuffer->writeInt(delta);
} else {
dataBuffer->writeShort(static_cast<uint16_t>(delta));
@@ -605,14 +607,14 @@ void StatArchiveWriter::writeResourceInst(StatDataOutput *dataOut,
int32_t instId) {
if (instId > MAX_BYTE_RESOURCE_INST_ID) {
if (instId > MAX_SHORT_RESOURCE_INST_ID) {
- dataOut->writeByte(static_cast<int8_t>(INT_RESOURCE_INST_ID_TOKEN));
+ dataOut->writeByte(static_cast<uint8_t>(INT_RESOURCE_INST_ID_TOKEN));
dataOut->writeInt(instId);
} else {
- dataOut->writeByte(static_cast<int8_t>(SHORT_RESOURCE_INST_ID_TOKEN));
+ dataOut->writeByte(static_cast<uint8_t>(SHORT_RESOURCE_INST_ID_TOKEN));
dataOut->writeShort(instId);
}
} else {
- dataOut->writeByte(static_cast<int8_t>(instId));
+ dataOut->writeByte(static_cast<uint8_t>(instId));
}
}
} // namespace statistics
diff --git a/cppcache/static/CMakeLists.txt b/cppcache/static/CMakeLists.txt
index 4d6fa2e..5ea3ba6 100644
--- a/cppcache/static/CMakeLists.txt
+++ b/cppcache/static/CMakeLists.txt
@@ -22,7 +22,9 @@ set_source_files_properties(${CONFIGURE_OUT_FILES} PROPERTIES GENERATED TRUE)
target_link_libraries(${PROJECT_NAME}
PUBLIC
- _apache-geode)
+ _apache-geode
+ PRIVATE
+ _WarningsAsError)
add_dependencies(client-libraries ${PROJECT_NAME})
diff --git a/cppcache/test/CMakeLists.txt b/cppcache/test/CMakeLists.txt
index 91b1e3d..87b2073 100644
--- a/cppcache/test/CMakeLists.txt
+++ b/cppcache/test/CMakeLists.txt
@@ -4,9 +4,9 @@
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
-#
+#
# http://www.apache.org/licenses/LICENSE-2.0
-#
+#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,7 +18,7 @@ project(apache-geode_unittests LANGUAGES CXX)
file(GLOB_RECURSE SOURCES "*.cpp")
-add_executable(${PROJECT_NAME}
+add_executable(${PROJECT_NAME}
AutoDeleteTest.cpp
ByteArray.cpp
ByteArray.hpp
@@ -54,6 +54,7 @@ target_link_libraries(${PROJECT_NAME}
GTest::GTest
GTest::Main
Boost::boost
+ _WarningsAsError
)
target_include_directories(${PROJECT_NAME}
diff --git a/cppcache/test/DataInputTest.cpp b/cppcache/test/DataInputTest.cpp
index fa55a10..44eedf0 100644
--- a/cppcache/test/DataInputTest.cpp
+++ b/cppcache/test/DataInputTest.cpp
@@ -120,9 +120,7 @@ class TestDataInput {
m_dataInput.readObject(ptr);
}
- std::vector<char16_t> readCharArray() {
- return m_dataInput.readCharArray();
- }
+ std::vector<char16_t> readCharArray() { return m_dataInput.readCharArray(); }
std::vector<std::string> readStringArray() {
return m_dataInput.readStringArray();
@@ -142,9 +140,9 @@ class TestDataInput {
return m_dataInput.currentBufferPosition();
}
- int32_t getBytesRead() const { return m_dataInput.getBytesRead(); }
+ size_t getBytesRead() const { return m_dataInput.getBytesRead(); }
- int32_t getBytesRemaining() const { return m_dataInput.getBytesRemaining(); }
+ size_t getBytesRemaining() const { return m_dataInput.getBytesRemaining(); }
void advanceCursor(int32_t offset) { m_dataInput.advanceCursor(offset); }
diff --git a/cppcache/test/DataOutputTest.cpp b/cppcache/test/DataOutputTest.cpp
index b57745c..d272458 100644
--- a/cppcache/test/DataOutputTest.cpp
+++ b/cppcache/test/DataOutputTest.cpp
@@ -317,7 +317,7 @@ TEST_F(DataOutputTest, TestCursorAdvance) {
"001B596F7520686164206D65206174206D65617420746F726E61646F2E",
dataOutput.getByteArray());
- const uint32_t originalLength = dataOutput.getBufferLength();
+ const auto originalLength = dataOutput.getBufferLength();
dataOutput.advanceCursor(2);
EXPECT_EQ((originalLength + 2), dataOutput.getBufferLength())
<< "Correct length after advance";
@@ -330,7 +330,7 @@ TEST_F(DataOutputTest, TestCursorNegativeAdvance) {
"001B596F7520686164206D65206174206D65617420746F726E61646F2E",
dataOutput.getByteArray());
- const uint32_t originalLength = dataOutput.getBufferLength();
+ const auto originalLength = dataOutput.getBufferLength();
dataOutput.advanceCursor(-2);
EXPECT_EQ((originalLength - 2), dataOutput.getBufferLength())
<< "Correct length after negative advance";
diff --git a/cryptoimpl/DHImpl.cpp b/cryptoimpl/DHImpl.cpp
index f381edf..28d3519 100644
--- a/cryptoimpl/DHImpl.cpp
+++ b/cryptoimpl/DHImpl.cpp
@@ -101,16 +101,16 @@ ASN1_SEQUENCE(
int ret = -1;
- const BIGNUM* pbn,* gbn;
+ const BIGNUM *pbn, *gbn;
DH_get0_pqg(dhimpl->m_dh, &pbn, NULL, &gbn);
- ret = BN_dec2bn((BIGNUM**)&pbn, dhP);
+ ret = BN_dec2bn((BIGNUM **)&pbn, dhP);
LOGDH(" DHInit: BN_dec2bn dhP ret %d", ret);
LOGDH(" DHInit: P ptr is %p", pbn);
LOGDH(" DHInit: G ptr is %p", gbn);
LOGDH(" DHInit: length is %d", DH_get_length(dhimpl->m_dh));
- ret = BN_dec2bn((BIGNUM**)&gbn, dhG);
+ ret = BN_dec2bn((BIGNUM **)&gbn, dhG);
LOGDH(" DHInit: BN_dec2bn dhG ret %d", ret);
DH_set_length(dhimpl->m_dh, dhL);
@@ -118,7 +118,7 @@ ASN1_SEQUENCE(
ret = DH_generate_key(dhimpl->m_dh);
LOGDH(" DHInit: DH_generate_key ret %d", ret);
- const BIGNUM* pub_key, *priv_key;
+ const BIGNUM *pub_key, *priv_key;
DH_get0_key(dhimpl->m_dh, &pub_key, &priv_key);
ret = BN_num_bits(priv_key);
LOGDH(" DHInit: BN_num_bits priv_key is %d", ret);
@@ -197,7 +197,7 @@ void gf_clearDhKeys(void *dhCtx) {
unsigned char *gf_getPublicKey(void *dhCtx, int *pLen) {
DHImpl *dhimpl = reinterpret_cast<DHImpl *>(dhCtx);
- const BIGNUM* pub_key, *priv_key;
+ const BIGNUM *pub_key, *priv_key;
DH_get0_key(dhimpl->m_dh, &pub_key, &priv_key);
if (pub_key == NULL || pLen == NULL) {
@@ -255,8 +255,8 @@ void gf_setPublicKeyOther(void *dhCtx, const unsigned char *pubkey,
LOGDH(" setPubKeyOther: after dhpubkey get evp ptr is %p\n", evppkey);
LOGDH(" setPubKeyOther: before BNdup ptr is %p\n", dhimpl->m_pubKeyOther);
- const BIGNUM* pub_key, *priv_key;
- DH* dh = EVP_PKEY_get1_DH(evppkey);
+ const BIGNUM *pub_key, *priv_key;
+ DH *dh = EVP_PKEY_get1_DH(evppkey);
DH_get0_key(dh, &pub_key, &priv_key);
dhimpl->m_pubKeyOther = BN_dup(pub_key);
LOGDH(" setPubKeyOther: after BNdup ptr is %p\n", dhimpl->m_pubKeyOther);
@@ -352,7 +352,7 @@ const EVP_CIPHER *DHImpl::getCipherFunc() {
}
unsigned char *gf_encryptDH(void *dhCtx, const unsigned char *cleartext,
- int len, int *retLen) {
+ size_t len, size_t *retLen) {
DHImpl *dhimpl = reinterpret_cast<DHImpl *>(dhCtx);
// Validation
@@ -420,7 +420,7 @@ unsigned char *gf_encryptDH(void *dhCtx, const unsigned char *cleartext,
}
unsigned char *gf_decryptDH(void *dhCtx, const unsigned char *cleartext,
- int len, int *retLen) {
+ size_t len, size_t *retLen) {
DHImpl *dhimpl = reinterpret_cast<DHImpl *>(dhCtx);
// Validation
@@ -531,7 +531,7 @@ bool gf_verifyDH(void *dhCtx, const char *subject,
return false;
}
- RSA* dh = EVP_PKEY_get1_RSA(evpkey);
+ RSA *dh = EVP_PKEY_get1_RSA(evpkey);
const ASN1_OBJECT *macobj;
const X509_ALGOR *algorithm = nullptr;
@@ -543,7 +543,7 @@ bool gf_verifyDH(void *dhCtx, const char *subject,
const EVP_MD *signatureDigest = EVP_get_digestbyobj(macobj);
LOGDH("after EVP_get_digestbyobj : err(%d): %s", ERR_get_error(),
ERR_error_string(ERR_get_error(), NULL));
- EVP_MD_CTX* signatureCtx = EVP_MD_CTX_new();
+ EVP_MD_CTX *signatureCtx = EVP_MD_CTX_new();
int result1 = EVP_VerifyInit_ex(signatureCtx, signatureDigest, NULL);
LOGDH("after EVP_VerifyInit_ex ret %d : err(%d): %s", result1,
@@ -634,7 +634,7 @@ int DH_PUBKEY_set(DH_PUBKEY **x, EVP_PKEY *pkey) {
goto err;
}
- const BIGNUM* pub_key, *priv_key;
+ const BIGNUM *pub_key, *priv_key;
DH_get0_key(dh, &pub_key, &priv_key);
asn1int = BN_to_ASN1_INTEGER(pub_key, NULL);
@@ -645,7 +645,7 @@ int DH_PUBKEY_set(DH_PUBKEY **x, EVP_PKEY *pkey) {
}
p = s;
i2d_ASN1_INTEGER(asn1int, &p);
- if (!ASN1_BIT_STRING_set((ASN1_STRING*)pk->public_key, s, i)) {
+ if (!ASN1_BIT_STRING_set((ASN1_STRING *)pk->public_key, s, i)) {
X509err(X509_F_X509_PUBKEY_SET, ERR_R_MALLOC_FAILURE);
goto err;
}
@@ -719,7 +719,7 @@ EVP_PKEY *DH_PUBKEY_get(DH_PUBKEY *key) {
}
cp = p = a->parameter->value.sequence->data;
j = a->parameter->value.sequence->length;
- DH* dh = EVP_PKEY_get1_DH(ret);
+ DH *dh = EVP_PKEY_get1_DH(ret);
if (!d2i_DHparams(&dh, &cp, j)) {
if (asn1int != NULL) ASN1_INTEGER_free(asn1int);
if (ret != NULL) EVP_PKEY_free(ret);
@@ -734,9 +734,9 @@ EVP_PKEY *DH_PUBKEY_get(DH_PUBKEY *key) {
asn1int = d2i_ASN1_INTEGER(NULL, &p, j);
LOGDH("after d2i asn1 integer ptr is %p", asn1int);
- DH* dh = EVP_PKEY_get1_DH(ret);
+ DH *dh = EVP_PKEY_get1_DH(ret);
DH_set0_key(dh, ASN1_INTEGER_to_BN(asn1int, NULL), NULL);
- //LOGDH(" after asn1int to bn ptr is %p", ret->pkey.dh->pub_key);
+ // LOGDH(" after asn1int to bn ptr is %p", ret->pkey.dh->pub_key);
key->pkey = ret;
EVP_PKEY_up_ref(ret);
diff --git a/cryptoimpl/DHImpl.hpp b/cryptoimpl/DHImpl.hpp
index f54b4da..665744c 100644
--- a/cryptoimpl/DHImpl.hpp
+++ b/cryptoimpl/DHImpl.hpp
@@ -63,10 +63,10 @@ _GEODE_EXPORT void gf_setPublicKeyOther(void* dhCtx,
_GEODE_EXPORT void gf_computeSharedSecret(void* dhCtx);
_GEODE_EXPORT unsigned char* gf_encryptDH(void* dhCtx,
const unsigned char* cleartext,
- int len, int* retLen);
+ size_t len, size_t* retLen);
_GEODE_EXPORT unsigned char* gf_decryptDH(void* dhCtx,
const unsigned char* cleartext,
- int len, int* retLen);
+ size_t len, size_t* retLen);
_GEODE_EXPORT bool gf_verifyDH(void* dhCtx, const char* subject,
const unsigned char* challenge, int challengeLen,
const unsigned char* response, int responseLen,
diff --git a/dhimpl/DHImpl.cpp b/dhimpl/DHImpl.cpp
index 6832045..db10507 100644
--- a/dhimpl/DHImpl.cpp
+++ b/dhimpl/DHImpl.cpp
@@ -90,16 +90,16 @@ ASN1_SEQUENCE(
int ret = -1;
- const BIGNUM* pbn,* gbn;
+ const BIGNUM *pbn, *gbn;
DH_get0_pqg(m_dh, &pbn, NULL, &gbn);
- ret = BN_dec2bn((BIGNUM**)&pbn, dhP);
+ ret = BN_dec2bn((BIGNUM **)&pbn, dhP);
LOGDH(" DHInit: BN_dec2bn dhP ret %d", ret);
LOGDH(" DHInit: P ptr is %p", pbn);
LOGDH(" DHInit: G ptr is %p", gbn);
LOGDH(" DHInit: length is %d", DH_get_length(m_dh));
- ret = BN_dec2bn((BIGNUM**)&gbn, dhP);
+ ret = BN_dec2bn((BIGNUM **)&gbn, dhP);
LOGDH(" DHInit: BN_dec2bn dhG ret %d", ret);
DH_set_length(m_dh, dhL);
@@ -107,7 +107,7 @@ ASN1_SEQUENCE(
ret = DH_generate_key(m_dh);
LOGDH(" DHInit: DH_generate_key ret %d", ret);
- const BIGNUM* pub_key, *priv_key;
+ const BIGNUM *pub_key, *priv_key;
DH_get0_key(m_dh, &pub_key, &priv_key);
ret = BN_num_bits(priv_key);
@@ -151,7 +151,7 @@ ASN1_SEQUENCE(
}
} while (cert != NULL);
- LOGDH(" Total certificats imported # %d", m_serverCerts.size());
+ LOGDH(" Total certificats imported # %zd", m_serverCerts.size());
fclose(keyStoreFP);
@@ -182,7 +182,7 @@ void gf_clearDhKeys(void) {
}
unsigned char *gf_getPublicKey(int *pLen) {
- const BIGNUM* pub_key, *priv_key;
+ const BIGNUM *pub_key, *priv_key;
DH_get0_key(m_dh, &pub_key, &priv_key);
if (pub_key == NULL || pLen == NULL) {
@@ -237,8 +237,8 @@ void gf_setPublicKeyOther(const unsigned char *pubkey, int length) {
LOGDH(" setPubKeyOther: after dhpubkey get evp ptr is %p", evppkey);
LOGDH(" setPubKeyOther: before BNdup ptr is %p", m_pubKeyOther);
- const BIGNUM* pub_key, *priv_key;
- DH* dh = EVP_PKEY_get1_DH(evppkey);
+ const BIGNUM *pub_key, *priv_key;
+ DH *dh = EVP_PKEY_get1_DH(evppkey);
DH_get0_key(dh, &pub_key, &priv_key);
m_pubKeyOther = BN_dup(pub_key);
LOGDH(" setPubKeyOther: after BNdup ptr is %p", m_pubKeyOther);
@@ -334,8 +334,8 @@ const EVP_CIPHER *getCipherFunc() {
}
}
-unsigned char *gf_encryptDH(const unsigned char *cleartext, int len,
- int *retLen) {
+unsigned char *gf_encryptDH(const unsigned char *cleartext, size_t len,
+ size_t *retLen) {
// Validation
if (cleartext == NULL || len < 1 || retLen == NULL) {
return NULL;
@@ -347,7 +347,7 @@ unsigned char *gf_encryptDH(const unsigned char *cleartext, int len,
unsigned char *ciphertext =
new unsigned char[len + 50]; // give enough room for padding
int outlen, tmplen;
- EVP_CIPHER_CTX* ctx = EVP_CIPHER_CTX_new();
+ EVP_CIPHER_CTX *ctx = EVP_CIPHER_CTX_new();
int ret = -123;
@@ -391,7 +391,7 @@ unsigned char *gf_encryptDH(const unsigned char *cleartext, int len,
ret = EVP_CIPHER_CTX_cleanup(ctx);
- LOGDH("DHencrypt: in len is %d, out len is %d", len, outlen);
+ LOGDH("DHencrypt: in len is %zd, out len is %d", len, outlen);
*retLen = outlen;
return ciphertext;
@@ -444,7 +444,7 @@ bool gf_verifyDH(const char *subject, const unsigned char *challenge,
X509_ALGOR_get0(&macobj, NULL, NULL, algorithm);
const EVP_MD *signatureDigest = EVP_get_digestbyobj(macobj);
- EVP_MD_CTX* signatureCtx = EVP_MD_CTX_new();
+ EVP_MD_CTX *signatureCtx = EVP_MD_CTX_new();
int result1 = EVP_VerifyInit_ex(signatureCtx, signatureDigest, NULL);
LOGDH(" Result of VerifyInit is %d", result1);
@@ -473,7 +473,7 @@ int DH_PUBKEY_set(DH_PUBKEY **x, EVP_PKEY *pkey) {
unsigned char *s, *p = NULL;
int i;
ASN1_INTEGER *asn1int = NULL;
- DH* dh = EVP_PKEY_get1_DH(pkey);
+ DH *dh = EVP_PKEY_get1_DH(pkey);
if (x == NULL) return (0);
@@ -500,7 +500,7 @@ int DH_PUBKEY_set(DH_PUBKEY **x, EVP_PKEY *pkey) {
} else if (EVP_PKEY_base_id(pkey) == EVP_PKEY_DH) {
unsigned char *pp;
- const BIGNUM* pub_key, *priv_key;
+ const BIGNUM *pub_key, *priv_key;
DH_get0_key(dh, &pub_key, &priv_key);
ASN1_TYPE_free(a->parameter);
if ((i = i2d_DHparams(dh, NULL)) <= 0) goto err;
@@ -532,7 +532,7 @@ int DH_PUBKEY_set(DH_PUBKEY **x, EVP_PKEY *pkey) {
goto err;
}
- const BIGNUM* pub_key, *priv_key;
+ const BIGNUM *pub_key, *priv_key;
DH_get0_key(dh, &pub_key, &priv_key);
asn1int = BN_to_ASN1_INTEGER(pub_key, NULL);
@@ -616,7 +616,7 @@ EVP_PKEY *DH_PUBKEY_get(DH_PUBKEY *key) {
}
cp = p = a->parameter->value.sequence->data;
j = a->parameter->value.sequence->length;
- DH* dh = EVP_PKEY_get1_DH(ret);
+ DH *dh = EVP_PKEY_get1_DH(ret);
if (!d2i_DHparams(&dh, &cp, j)) {
if (asn1int != NULL) ASN1_INTEGER_free(asn1int);
if (ret != NULL) EVP_PKEY_free(ret);
@@ -631,7 +631,7 @@ EVP_PKEY *DH_PUBKEY_get(DH_PUBKEY *key) {
asn1int = d2i_ASN1_INTEGER(NULL, &p, j);
LOGDH("after d2i asn1 integer ptr is %p", asn1int);
- DH* dh = EVP_PKEY_get1_DH(ret);
+ DH *dh = EVP_PKEY_get1_DH(ret);
DH_set0_key(dh, ASN1_INTEGER_to_BN(asn1int, NULL), NULL);
key->pkey = ret;
diff --git a/dhimpl/DHImpl.hpp b/dhimpl/DHImpl.hpp
index 3eb3860..d66b158 100644
--- a/dhimpl/DHImpl.hpp
+++ b/dhimpl/DHImpl.hpp
@@ -58,7 +58,7 @@ _GEODE_EXPORT void gf_setPublicKeyOther(const unsigned char* pubkey,
int length);
_GEODE_EXPORT void gf_computeSharedSecret(void);
_GEODE_EXPORT unsigned char* gf_encryptDH(const unsigned char* cleartext,
- int len, int* retLen);
+ size_t len, size_t* retLen);
_GEODE_EXPORT bool gf_verifyDH(const char* subject,
const unsigned char* challenge, int challengeLen,
const unsigned char* response, int responseLen,
diff --git a/templates/security/PkcsAuthInit.cpp b/templates/security/PkcsAuthInit.cpp
index 5dc6be3..f7f5511 100644
--- a/templates/security/PkcsAuthInit.cpp
+++ b/templates/security/PkcsAuthInit.cpp
@@ -39,8 +39,7 @@ uint8_t* createSignature(EVP_PKEY* key, X509* cert,
}
const ASN1_OBJECT *macobj;
- const X509_ALGOR *algorithm;
- X509_ALGOR_get0(&macobj, NULL, NULL, algorithm);
+ X509_ALGOR_get0(&macobj, NULL, NULL, NULL);
const EVP_MD* signatureDigest = EVP_get_digestbyobj(macobj);
EVP_MD_CTX* signatureCtx = EVP_MD_CTX_new();
@@ -165,7 +164,7 @@ std::shared_ptr<Properties> PKCSAuthInit::getCredentials(
auto signatureData = createSignature(
privateKey, cert, reinterpret_cast<const unsigned char*>(alias),
- strlen(alias), &lengthEncryptedData);
+ static_cast<uint32_t>(strlen(alias)), &lengthEncryptedData);
EVP_PKEY_free(privateKey);
X509_free(cert);
if (signatureData == NULL) {
diff --git a/tests/cpp/fwklib/FrameworkTest.cpp b/tests/cpp/fwklib/FrameworkTest.cpp
index 33172dd..a9302cf 100644
--- a/tests/cpp/fwklib/FrameworkTest.cpp
+++ b/tests/cpp/fwklib/FrameworkTest.cpp
@@ -265,9 +265,9 @@ void FrameworkTest::cacheInitialize(
if (m_istransaction) {
txManager = m_cache->getCacheTransactionManager();
}
- } catch (CacheExistsException& ignore) {
+ } catch (const CacheExistsException&) {
m_cache = nullptr;
- } catch (Exception& e) {
+ } catch (const Exception& e) {
FWKEXCEPTION(
"CacheFactory::create encountered Exception: " << e.what());
}
@@ -284,8 +284,8 @@ void FrameworkTest::cacheFinalize() {
try {
destroyAllRegions();
m_cache->close();
- } catch (CacheClosedException& ignore) {
- } catch (Exception& e) {
+ } catch (const CacheClosedException&) {
+ } catch (const Exception& e) {
FWKSEVERE("Caught an unexpected Exception during cache close: "
<< e.what());
} catch (...) {
diff --git a/tests/cpp/fwklib/FwkObjects.hpp b/tests/cpp/fwklib/FwkObjects.hpp
index acd7539..a1befb9 100644
--- a/tests/cpp/fwklib/FwkObjects.hpp
+++ b/tests/cpp/fwklib/FwkObjects.hpp
@@ -1409,11 +1409,7 @@ class LocalFileSet : public TFwkSet<LocalFile> {};
class FwkDomErrorHandler : public DOMErrorHandler {
public:
FwkDomErrorHandler() : m_hadErrors(false) {}
- ~FwkDomErrorHandler() {
- if (m_hadErrors) {
- FWKEXCEPTION("Encountered errors during parse.");
- }
- }
+ ~FwkDomErrorHandler() = default;
bool hadErrors() const { return m_hadErrors; }
bool handleError(const DOMError& domError);
diff --git a/tests/cpp/testobject/InvalidPdxUsage.cpp b/tests/cpp/testobject/InvalidPdxUsage.cpp
index 3dc3867..74e1e16 100644
--- a/tests/cpp/testobject/InvalidPdxUsage.cpp
+++ b/tests/cpp/testobject/InvalidPdxUsage.cpp
@@ -34,9 +34,9 @@ bool InvalidPdxUsage::genericValCompare(T1 value1, T2 value2) const {
return true;
}
-template <typename T1, typename T2>
-bool InvalidPdxUsage::genericCompare(T1* value1, T2* value2, int length) const {
- int i = 0;
+template <typename T1, typename T2, typename L>
+bool InvalidPdxUsage::genericCompare(T1* value1, T2* value2, L length) const {
+ L i = 0;
while (i < length) {
if (value1[i] != value2[i]) {
return false;
diff --git a/tests/cpp/testobject/InvalidPdxUsage.hpp b/tests/cpp/testobject/InvalidPdxUsage.hpp
index c7e5ad9..e50d852 100644
--- a/tests/cpp/testobject/InvalidPdxUsage.hpp
+++ b/tests/cpp/testobject/InvalidPdxUsage.hpp
@@ -628,8 +628,8 @@ class TESTOBJECT_EXPORT InvalidPdxUsage : public PdxSerializable {
template <typename T1, typename T2>
bool genericValCompare(T1 value1, T2 value2) const;
- template <typename T1, typename T2>
- bool genericCompare(T1* value1, T2* value2, int length) const;
+ template <typename T1, typename T2, typename L>
+ bool genericCompare(T1* value1, T2* value2, L length) const;
template <typename T1, typename T2>
bool generic2DCompare(T1** value1, T2** value2, int length,
diff --git a/tests/cpp/testobject/NonPdxType.cpp b/tests/cpp/testobject/NonPdxType.cpp
index 5f22cba..83484a9 100644
--- a/tests/cpp/testobject/NonPdxType.cpp
+++ b/tests/cpp/testobject/NonPdxType.cpp
@@ -33,10 +33,10 @@ bool PdxTests::NonPdxType::genericValCompare(T1 value1, T2 value2) const {
return true;
}
-template <typename T1, typename T2>
+template <typename T1, typename T2, typename L>
bool PdxTests::NonPdxType::genericCompare(T1* value1, T2* value2,
- int length) const {
- int i = 0;
+ L length) const {
+ L i = 0;
while (i < length) {
if (value1[i] != value2[i]) {
return false;
diff --git a/tests/cpp/testobject/NonPdxType.hpp b/tests/cpp/testobject/NonPdxType.hpp
index e292d81..d35a901 100644
--- a/tests/cpp/testobject/NonPdxType.hpp
+++ b/tests/cpp/testobject/NonPdxType.hpp
@@ -483,8 +483,8 @@ class TESTOBJECT_EXPORT NonPdxType {
template <typename T1, typename T2>
bool genericValCompare(T1 value1, T2 value2) const;
- template <typename T1, typename T2>
- bool genericCompare(T1* value1, T2* value2, int length) const;
+ template <typename T1, typename T2, typename L>
+ bool genericCompare(T1* value1, T2* value2, L length) const;
template <typename T1, typename T2>
bool generic2DCompare(T1** value1, T2** value2, int length,
diff --git a/tests/cpp/testobject/PdxClassV2.cpp b/tests/cpp/testobject/PdxClassV2.cpp
index 027b458..bb99688 100644
--- a/tests/cpp/testobject/PdxClassV2.cpp
+++ b/tests/cpp/testobject/PdxClassV2.cpp
@@ -288,7 +288,6 @@ void PdxTypes3V2::fromData(PdxReader& pr) {
m_i6 = pr.readInt("i6");
auto tmp = pr.readString("m_str3");
- char extraFieldsStr[20];
if (tmp.empty()) {
m_str3 = std::to_string(m_diffInExtraFields);
} else {
diff --git a/tests/cpp/testobject/PdxType.cpp b/tests/cpp/testobject/PdxType.cpp
index 68b6b68..a7544a7 100644
--- a/tests/cpp/testobject/PdxType.cpp
+++ b/tests/cpp/testobject/PdxType.cpp
@@ -33,10 +33,10 @@ bool PdxTests::PdxType::genericValCompare(T1 value1, T2 value2) const {
return true;
}
-template <typename T1, typename T2>
+template <typename T1, typename T2, typename L>
bool PdxTests::PdxType::genericCompare(T1* value1, T2* value2,
- int length) const {
- int i = 0;
+ L length) const {
+ L i = 0;
while (i < length) {
if (value1[i] != value2[i]) {
return false;
diff --git a/tests/cpp/testobject/PdxType.hpp b/tests/cpp/testobject/PdxType.hpp
index 09b7919..74b71d8 100644
--- a/tests/cpp/testobject/PdxType.hpp
+++ b/tests/cpp/testobject/PdxType.hpp
@@ -755,8 +755,8 @@ class TESTOBJECT_EXPORT PdxType : public PdxSerializable {
template <typename T1, typename T2>
bool genericValCompare(T1 value1, T2 value2) const;
- template <typename T1, typename T2>
- bool genericCompare(T1* value1, T2* value2, int length) const;
+ template <typename T1, typename T2, typename L>
+ bool genericCompare(T1* value1, T2* value2, L length) const;
template <typename T1, typename T2>
bool generic2DCompare(T1** value1, T2** value2, int length,
diff --git a/tests/cpp/testobject/PdxVersioned1.cpp b/tests/cpp/testobject/PdxVersioned1.cpp
index 82d7c6f..e0604f8 100644
--- a/tests/cpp/testobject/PdxVersioned1.cpp
+++ b/tests/cpp/testobject/PdxVersioned1.cpp
@@ -34,10 +34,10 @@ bool PdxTests::PdxVersioned1::genericValCompare(T1 value1, T2 value2) const {
return true;
}
-template <typename T1, typename T2>
+template <typename T1, typename T2, typename L>
bool PdxTests::PdxVersioned1::genericCompare(T1* value1, T2* value2,
- int length) const {
- int i = 0;
+ L length) const {
+ L i = 0;
while (i < length) {
if (value1[i] != value2[i]) {
return false;
diff --git a/tests/cpp/testobject/PdxVersioned1.hpp b/tests/cpp/testobject/PdxVersioned1.hpp
index 5f8b3b2..8ee1fee 100644
--- a/tests/cpp/testobject/PdxVersioned1.hpp
+++ b/tests/cpp/testobject/PdxVersioned1.hpp
@@ -248,8 +248,8 @@ class TESTOBJECT_EXPORT PdxVersioned1 : public PdxSerializable {
template <typename T1, typename T2>
bool genericValCompare(T1 value1, T2 value2) const;
- template <typename T1, typename T2>
- bool genericCompare(T1* value1, T2* value2, int length) const;
+ template <typename T1, typename T2, typename L>
+ bool genericCompare(T1* value1, T2* value2, L length) const;
template <typename T1, typename T2>
bool generic2DCompare(T1** value1, T2** value2, int length,
diff --git a/tests/cpp/testobject/PdxVersioned2.cpp b/tests/cpp/testobject/PdxVersioned2.cpp
index a0e5eee..8e1d80a 100644
--- a/tests/cpp/testobject/PdxVersioned2.cpp
+++ b/tests/cpp/testobject/PdxVersioned2.cpp
@@ -37,10 +37,10 @@ bool PdxTests::PdxVersioned2::genericValCompare(T1 value1, T2 value2) const {
return true;
}
-template <typename T1, typename T2>
+template <typename T1, typename T2, typename L>
bool PdxTests::PdxVersioned2::genericCompare(T1* value1, T2* value2,
- int length) const {
- int i = 0;
+ L length) const {
+ L i = 0;
while (i < length) {
if (value1[i] != value2[i]) {
return false;
diff --git a/tests/cpp/testobject/PdxVersioned2.hpp b/tests/cpp/testobject/PdxVersioned2.hpp
index b1e888e..041c444 100644
--- a/tests/cpp/testobject/PdxVersioned2.hpp
+++ b/tests/cpp/testobject/PdxVersioned2.hpp
@@ -252,8 +252,8 @@ class TESTOBJECT_EXPORT PdxVersioned2 : public PdxSerializable {
template <typename T1, typename T2>
bool genericValCompare(T1 value1, T2 value2) const;
- template <typename T1, typename T2>
- bool genericCompare(T1* value1, T2* value2, int length) const;
+ template <typename T1, typename T2, typename L>
+ bool genericCompare(T1* value1, T2* value2, L length) const;
template <typename T1, typename T2>
bool generic2DCompare(T1** value1, T2** value2, int length,
--
To stop receiving notification emails like this one, please contact
jbarrett@apache.org.