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/01/29 23:10:55 UTC
[geode-native] branch develop updated: GEODE-4038: More size_t
conversion. (#195)
This is an automated email from the ASF dual-hosted git repository.
jbarrett pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/geode-native.git
The following commit(s) were added to refs/heads/develop by this push:
new 694e59f GEODE-4038: More size_t conversion. (#195)
694e59f is described below
commit 694e59f28045d436b5c1d44dd66f258f1a60511e
Author: Jacob Barrett <jb...@pivotal.io>
AuthorDate: Mon Jan 29 15:10:52 2018 -0800
GEODE-4038: More size_t conversion. (#195)
- Refactors UserObjectSizer to use size_t.
- Standardizes on std::function for function pointers.
- Refactors DataIn/Output buffer methods to use size_t
- Refactors Properties::getSize
- Refactors Serializer::objectSize
- Removes unused SystemProperties::maxQueueSize
- Rename unused SystemProperties::javaConnectionPoolSize
---
clicache/src/SystemProperties.cpp | 5 ---
clicache/src/SystemProperties.hpp | 9 -----
cppcache/include/geode/Cache.hpp | 2 +-
cppcache/include/geode/CacheableBuiltins.hpp | 23 +++++------
cppcache/include/geode/DataInput.hpp | 32 ++++++++--------
cppcache/include/geode/DataOutput.hpp | 44 +++++++++++-----------
cppcache/include/geode/PdxSerializer.hpp | 4 +-
cppcache/include/geode/Properties.hpp | 2 +-
cppcache/include/geode/ResultSet.hpp | 2 +-
cppcache/include/geode/SelectResults.hpp | 2 +-
cppcache/include/geode/Serializer.hpp | 15 ++++----
cppcache/include/geode/StructSet.hpp | 2 +-
cppcache/include/geode/SystemProperties.hpp | 12 +++---
.../integration-test/ThinClientPdxSerializers.hpp | 3 +-
cppcache/integration-test/testSerialization.cpp | 2 +-
cppcache/src/Cache.cpp | 2 +-
cppcache/src/ClientProxyMembershipID.cpp | 2 +-
cppcache/src/DataOutput.cpp | 16 ++++----
cppcache/src/PdxWrapper.cpp | 2 +-
cppcache/src/Properties.cpp | 4 +-
cppcache/src/ResultSetImpl.cpp | 2 +-
cppcache/src/ResultSetImpl.hpp | 13 ++++---
cppcache/src/StructSetImpl.cpp | 2 +-
cppcache/src/StructSetImpl.hpp | 17 +++++----
cppcache/src/SystemProperties.cpp | 16 ++++----
cppcache/src/TcrConnection.cpp | 4 +-
cppcache/src/TcrEndpoint.cpp | 4 +-
sqliteimpl/SqLiteImpl.cpp | 6 +--
tests/cpp/testobject/PdxClassV1.hpp | 3 +-
tests/cpp/testobject/PdxClassV2.hpp | 3 +-
30 files changed, 116 insertions(+), 139 deletions(-)
diff --git a/clicache/src/SystemProperties.cpp b/clicache/src/SystemProperties.cpp
index 5dc6501..c680512 100644
--- a/clicache/src/SystemProperties.cpp
+++ b/clicache/src/SystemProperties.cpp
@@ -132,11 +132,6 @@ namespace Apache
return m_nativeptr->statsDiskSpaceLimit( );
}
- System::UInt32 SystemProperties::MaxQueueSize::get( )
- {
- return m_nativeptr->maxQueueSize( );
- }
-
bool SystemProperties::SSLEnabled::get( )
{
return m_nativeptr->sslEnabled();
diff --git a/clicache/src/SystemProperties.hpp b/clicache/src/SystemProperties.hpp
index 40ed04e..e3d4bf1 100644
--- a/clicache/src/SystemProperties.hpp
+++ b/clicache/src/SystemProperties.hpp
@@ -232,15 +232,6 @@ namespace Apache
}
/// <summary>
- /// Returns the max queue size for notification messages
- /// </summary>
- /// <returns>the max queue size</returns>
- property System::UInt32 MaxQueueSize
- {
- System::UInt32 get();
- }
-
- /// <summary>
/// True if ssl connection support is enabled.
/// </summary>
/// <returns>true if enabled</returns>
diff --git a/cppcache/include/geode/Cache.hpp b/cppcache/include/geode/Cache.hpp
index 3da05a7..ed753b2 100644
--- a/cppcache/include/geode/Cache.hpp
+++ b/cppcache/include/geode/Cache.hpp
@@ -234,7 +234,7 @@ class _GEODE_EXPORT Cache : public GeodeCache,
std::string className) const override;
virtual std::unique_ptr<DataInput> createDataInput(const uint8_t* m_buffer,
- int32_t len) const;
+ size_t len) const;
virtual std::unique_ptr<DataOutput> createDataOutput() const;
virtual PoolManager& getPoolManager() const;
diff --git a/cppcache/include/geode/CacheableBuiltins.hpp b/cppcache/include/geode/CacheableBuiltins.hpp
index beba9df..adaf1b8 100644
--- a/cppcache/include/geode/CacheableBuiltins.hpp
+++ b/cppcache/include/geode/CacheableBuiltins.hpp
@@ -128,7 +128,7 @@ class CacheableKeyType : public CacheableKey {
/** Function to copy an array from source to destination. */
template <typename TObj>
-inline void copyArray(TObj* dest, const TObj* src, int32_t length) {
+inline void copyArray(TObj* dest, const TObj* src, size_t length) {
std::memcpy(dest, src, length * sizeof(TObj));
}
@@ -138,8 +138,8 @@ inline void copyArray(TObj* dest, const TObj* src, int32_t length) {
*/
template <typename TObj>
inline void copyArray(std::shared_ptr<TObj>* dest,
- const std::shared_ptr<TObj>* src, int32_t length) {
- for (int32_t index = 0; index < length; index++) {
+ const std::shared_ptr<TObj>* src, size_t length) {
+ for (size_t index = 0; index < length; index++) {
dest[index] = src[index];
}
}
@@ -153,8 +153,8 @@ template <typename TObj, int8_t TYPEID>
inline void copyArray(
std::shared_ptr<CacheableArrayType<TObj, TYPEID>>* dest,
const std::shared_ptr<CacheableArrayType<TObj, TYPEID>>* src,
- int32_t length) {
- for (int32_t index = 0; index < length; index++) {
+ size_t length) {
+ for (size_t index = 0; index < length; index++) {
dest[index] = src[index];
}
}
@@ -206,8 +206,8 @@ class CacheableArrayType : public Cacheable {
inline int32_t length() const { return m_length; }
/** Get the element at given index. */
- inline TObj operator[](uint32_t index) const {
- if (static_cast<int32_t>(index) >= m_length) {
+ inline TObj operator[](size_t index) const {
+ if (index >= m_length) {
throw OutOfRangeException(
"CacheableArray::operator[]: Index out of range.");
}
@@ -252,9 +252,8 @@ class CacheableArrayType : public Cacheable {
* cache memory utilization.
*/
virtual size_t objectSize() const override {
- return static_cast<uint32_t>(
- sizeof(CacheableArrayType) +
- apache::geode::client::serializer::objectSize(m_value, m_length));
+ return sizeof(CacheableArrayType) +
+ serializer::objectSize(m_value, m_length);
}
};
@@ -304,9 +303,7 @@ class CacheableContainerType : public Cacheable, public TBase {
* cache memory utilization.
*/
virtual size_t objectSize() const override {
- return static_cast<uint32_t>(
- sizeof(CacheableContainerType) +
- apache::geode::client::serializer::objectSize(*this));
+ return sizeof(CacheableContainerType) + serializer::objectSize(*this);
}
};
diff --git a/cppcache/include/geode/DataInput.hpp b/cppcache/include/geode/DataInput.hpp
index 513d318..3b92fa6 100644
--- a/cppcache/include/geode/DataInput.hpp
+++ b/cppcache/include/geode/DataInput.hpp
@@ -89,7 +89,7 @@ class _GEODE_EXPORT DataInput {
* @param buffer array to hold the bytes read from stream
* @param len number of unsigned bytes to be read
*/
- inline void readBytesOnly(uint8_t* buffer, uint32_t len) {
+ inline void readBytesOnly(uint8_t* buffer, size_t len) {
if (len > 0) {
_GEODE_CHECK_BUFFER_SIZE(len);
std::memcpy(buffer, m_buf, len);
@@ -107,7 +107,7 @@ class _GEODE_EXPORT DataInput {
* @param buffer array to hold the bytes read from stream
* @param len number of signed bytes to be read
*/
- inline void readBytesOnly(int8_t* buffer, uint32_t len) {
+ inline void readBytesOnly(int8_t* buffer, size_t len) {
if (len > 0) {
_GEODE_CHECK_BUFFER_SIZE(len);
std::memcpy(buffer, m_buf, len);
@@ -494,20 +494,18 @@ class _GEODE_EXPORT DataInput {
inline const uint8_t* currentBufferPosition() const { return m_buf; }
/** get the number of bytes read in the buffer */
- inline int32_t getBytesRead() const {
- return static_cast<int32_t>(m_buf - m_bufHead);
- }
+ inline size_t getBytesRead() const { return m_buf - m_bufHead; }
/** get the number of bytes remaining to be read in the buffer */
- inline int32_t getBytesRemaining() const {
+ inline size_t getBytesRemaining() const {
return (m_bufLength - getBytesRead());
}
/** advance the cursor by given offset */
- inline void advanceCursor(int32_t offset) { m_buf += offset; }
+ inline void advanceCursor(size_t offset) { m_buf += offset; }
/** rewind the cursor by given offset */
- inline void rewindCursor(int32_t offset) { m_buf -= offset; }
+ inline void rewindCursor(size_t offset) { m_buf -= offset; }
/** reset the cursor to the start of buffer */
inline void reset() { m_buf = m_bufHead; }
@@ -517,11 +515,11 @@ class _GEODE_EXPORT DataInput {
m_bufLength = getBytesRemaining();
}
- inline void resetPdx(int32_t offset) { m_buf = m_bufHead + offset; }
+ inline void resetPdx(size_t offset) { m_buf = m_bufHead + offset; }
- inline int32_t getPdxBytes() const { return m_bufLength; }
+ inline size_t getPdxBytes() const { return m_bufLength; }
- static uint8_t* getBufferCopy(const uint8_t* from, uint32_t length) {
+ static uint8_t* getBufferCopy(const uint8_t* from, size_t length) {
uint8_t* result;
_GEODE_NEW(result, uint8_t[length]);
std::memcpy(result, from, length);
@@ -529,9 +527,9 @@ class _GEODE_EXPORT DataInput {
return result;
}
- inline void reset(int32_t offset) { m_buf = m_bufHead + offset; }
+ inline void reset(size_t offset) { m_buf = m_bufHead + offset; }
- uint8_t* getBufferCopyFrom(const uint8_t* from, uint32_t length) {
+ uint8_t* getBufferCopyFrom(const uint8_t* from, size_t length) {
uint8_t* result;
_GEODE_NEW(result, uint8_t[length]);
std::memcpy(result, from, length);
@@ -543,7 +541,7 @@ class _GEODE_EXPORT DataInput {
protected:
/** constructor given a pre-allocated byte array with size */
- DataInput(const uint8_t* m_buffer, int32_t len, const CacheImpl* cache)
+ DataInput(const uint8_t* m_buffer, size_t len, const CacheImpl* cache)
: m_buf(m_buffer),
m_bufHead(m_buffer),
m_bufLength(len),
@@ -555,7 +553,7 @@ class _GEODE_EXPORT DataInput {
private:
const uint8_t* m_buf;
const uint8_t* m_bufHead;
- int32_t m_bufLength;
+ size_t m_bufLength;
std::reference_wrapper<const std::string> m_poolName;
const CacheImpl* m_cache;
@@ -580,7 +578,7 @@ class _GEODE_EXPORT DataInput {
inline char readPdxChar() { return static_cast<char>(readInt16()); }
- inline void _checkBufferSize(int32_t size, int32_t line) {
+ inline void _checkBufferSize(size_t size, int32_t line) {
if ((m_bufLength - (m_buf - m_bufHead)) < size) {
throw OutOfRangeException(
"DataInput: attempt to read beyond buffer at line " +
@@ -646,7 +644,7 @@ class _GEODE_EXPORT DataInput {
template <class CharT, class... Tail>
inline void readAscii(std::basic_string<CharT, Tail...>& value,
size_t length) {
- _GEODE_CHECK_BUFFER_SIZE(static_cast<int32_t>(length));
+ _GEODE_CHECK_BUFFER_SIZE(length);
value.reserve(length);
while (length-- > 0) {
// blindly assumes ASCII so mask off 7 bits
diff --git a/cppcache/include/geode/DataOutput.hpp b/cppcache/include/geode/DataOutput.hpp
index 18344a2..5e7b5f1 100644
--- a/cppcache/include/geode/DataOutput.hpp
+++ b/cppcache/include/geode/DataOutput.hpp
@@ -112,7 +112,7 @@ class _GEODE_EXPORT DataOutput {
* @param value the array of unsigned bytes to be written
* @param len the number of bytes from the start of array to be written
*/
- inline void writeBytesOnly(const uint8_t* bytes, uint32_t len) {
+ inline void writeBytesOnly(const uint8_t* bytes, size_t len) {
ensureCapacity(len);
std::memcpy(m_buf, bytes, len);
m_buf += len;
@@ -129,7 +129,7 @@ class _GEODE_EXPORT DataOutput {
* @param value the array of signed bytes to be written
* @param len the number of bytes from the start of array to be written
*/
- inline void writeBytesOnly(const int8_t* bytes, uint32_t len) {
+ inline void writeBytesOnly(const int8_t* bytes, size_t len) {
writeBytesOnly(reinterpret_cast<const uint8_t*>(bytes), len);
}
@@ -376,7 +376,7 @@ class _GEODE_EXPORT DataOutput {
*
* @param offset the offset by which to advance the cursor
*/
- void advanceCursor(uint32_t offset) {
+ void advanceCursor(size_t offset) {
ensureCapacity(offset);
m_buf += offset;
}
@@ -386,13 +386,13 @@ class _GEODE_EXPORT DataOutput {
*
* @param offset the offset by which to rewind the cursor
*/
- void rewindCursor(uint32_t offset) { m_buf -= offset; }
+ void rewindCursor(size_t offset) { m_buf -= offset; }
- void updateValueAtPos(uint32_t offset, uint8_t value) {
+ void updateValueAtPos(size_t offset, uint8_t value) {
m_bytes[offset] = value;
}
- uint8_t getValueAtPos(uint32_t offset) { return m_bytes[offset]; }
+ uint8_t getValueAtPos(size_t offset) { return m_bytes[offset]; }
/** Destruct a DataOutput, including releasing the created buffer. */
~DataOutput() {
reset();
@@ -410,7 +410,7 @@ class _GEODE_EXPORT DataOutput {
/**
* Get a pointer to the internal buffer of <code>DataOutput</code>.
*/
- inline uint32_t getRemainingBufferLength() const {
+ inline size_t getRemainingBufferLength() const {
// GF_R_ASSERT(!((uint32_t)(m_bytes) % 4));
return m_size - getBufferLength();
}
@@ -421,14 +421,14 @@ class _GEODE_EXPORT DataOutput {
* @param rsize the size of buffer is filled in this output parameter;
* should not be nullptr
*/
- inline const uint8_t* getBuffer(uint32_t* rsize) const {
- *rsize = static_cast<uint32_t>(m_buf - m_bytes);
+ inline const uint8_t* getBuffer(size_t* rsize) const {
+ *rsize = m_buf - m_bytes;
// GF_R_ASSERT(!((uint32_t)(m_bytes) % 4));
return m_bytes;
}
inline uint8_t* getBufferCopy() {
- uint32_t size = static_cast<uint32_t>(m_buf - m_bytes);
+ size_t size = m_buf - m_bytes;
uint8_t* result;
result = (uint8_t*)std::malloc(size * sizeof(uint8_t));
if (result == nullptr) {
@@ -442,9 +442,7 @@ class _GEODE_EXPORT DataOutput {
* Get the length of current data in the internal buffer of
* <code>DataOutput</code>.
*/
- inline uint32_t getBufferLength() const {
- return static_cast<uint32_t>(m_buf - m_bytes);
- }
+ inline size_t getBufferLength() const { return m_buf - m_bytes; }
/**
* Reset the internal cursor to the start of the buffer.
@@ -468,10 +466,10 @@ class _GEODE_EXPORT DataOutput {
}
// make sure there is room left for the requested size item.
- inline void ensureCapacity(uint32_t size) {
- uint32_t offset = static_cast<uint32_t>(m_buf - m_bytes);
+ inline void ensureCapacity(size_t size) {
+ size_t offset = m_buf - m_bytes;
if ((m_size - offset) < size) {
- uint32_t newSize = m_size * 2 + (8192 * (size / 8192));
+ size_t newSize = m_size * 2 + (8192 * (size / 8192));
if (newSize >= m_highWaterMark && !m_haveBigBuffer) {
// acquire the lock
acquireLock();
@@ -489,7 +487,7 @@ class _GEODE_EXPORT DataOutput {
}
}
- uint8_t* getBufferCopyFrom(const uint8_t* from, uint32_t length) {
+ uint8_t* getBufferCopyFrom(const uint8_t* from, size_t length) {
uint8_t* result;
_GEODE_NEW(result, uint8_t[length]);
std::memcpy(result, from, length);
@@ -522,10 +520,10 @@ class _GEODE_EXPORT DataOutput {
// cursor.
uint8_t* m_buf;
// size of m_bytes.
- uint32_t m_size;
+ size_t m_size;
// high and low water marks for buffer size
- static uint32_t m_lowWaterMark;
- static uint32_t m_highWaterMark;
+ static size_t m_lowWaterMark;
+ static size_t m_highWaterMark;
// flag to indicate we have a big buffer
volatile bool m_haveBigBuffer;
const CacheImpl* m_cache;
@@ -653,7 +651,7 @@ class _GEODE_EXPORT DataOutput {
}
inline void writeUtf16(const char16_t* data, size_t length) {
- ensureCapacity(static_cast<uint32_t>(length) * 2);
+ ensureCapacity(length * 2);
for (; length > 0; length--, data++) {
writeNoCheck(static_cast<uint8_t>(*data >> 8));
writeNoCheck(static_cast<uint8_t>(*data));
@@ -748,8 +746,8 @@ class _GEODE_EXPORT DataOutput {
m_poolName = std::ref(poolName);
}
- static uint8_t* checkoutBuffer(uint32_t* size);
- static void checkinBuffer(uint8_t* buffer, uint32_t size);
+ static uint8_t* checkoutBuffer(size_t* size);
+ static void checkinBuffer(uint8_t* buffer, size_t size);
// disable copy constructor and assignment
DataOutput(const DataOutput&);
diff --git a/cppcache/include/geode/PdxSerializer.hpp b/cppcache/include/geode/PdxSerializer.hpp
index 08dd2ff..ba65ebf 100644
--- a/cppcache/include/geode/PdxSerializer.hpp
+++ b/cppcache/include/geode/PdxSerializer.hpp
@@ -32,13 +32,13 @@ namespace client {
* Function pointer type which takes a void pointer to an instance of a user
* object to delete and class name.
*/
-typedef void (*UserDeallocator)(void*, const std::string&);
+using UserDeallocator = std::function<void(void*, const std::string&)>;
/**
* Function pointer type which takes a void pointer to an instance of a user
* object and class name to return the size of the user object.
*/
-typedef uint32_t (*UserObjectSizer)(void*, const std::string&);
+using UserObjectSizer = std::function<size_t(const void*, const std::string&)>;
/**
* The PdxSerializer class allows domain classes to be
diff --git a/cppcache/include/geode/Properties.hpp b/cppcache/include/geode/Properties.hpp
index 350a670..c0f71fc 100644
--- a/cppcache/include/geode/Properties.hpp
+++ b/cppcache/include/geode/Properties.hpp
@@ -123,7 +123,7 @@ class _GEODE_EXPORT Properties : public Serializable {
void foreach (Visitor& visitor) const;
/** Return the number of entries in the collection. */
- uint32_t getSize() const;
+ size_t getSize() const;
/** Add the contents of other to this instance, replacing any existing
* values with those from other.
diff --git a/cppcache/include/geode/ResultSet.hpp b/cppcache/include/geode/ResultSet.hpp
index a5a1516..f570e19 100644
--- a/cppcache/include/geode/ResultSet.hpp
+++ b/cppcache/include/geode/ResultSet.hpp
@@ -62,7 +62,7 @@ class _GEODE_EXPORT ResultSet : public SelectResults {
* @returns A smart pointer to the item indexed.
*/
virtual const std::shared_ptr<Serializable> operator[](
- int32_t index) const override = 0;
+ size_t index) const override = 0;
/**
* Get a SelectResultsIterator with which to iterate over the items in the
diff --git a/cppcache/include/geode/SelectResults.hpp b/cppcache/include/geode/SelectResults.hpp
index 8ed8717..45616b8 100644
--- a/cppcache/include/geode/SelectResults.hpp
+++ b/cppcache/include/geode/SelectResults.hpp
@@ -65,7 +65,7 @@ class _GEODE_EXPORT SelectResults {
* @returns A smart pointer to the item indexed.
*/
virtual const std::shared_ptr<Serializable> operator[](
- int32_t index) const = 0;
+ size_t index) const = 0;
/**
* Get a SelectResultsIterator with which to iterate over the items in the
diff --git a/cppcache/include/geode/Serializer.hpp b/cppcache/include/geode/Serializer.hpp
index 2995245..7e043a3 100644
--- a/cppcache/include/geode/Serializer.hpp
+++ b/cppcache/include/geode/Serializer.hpp
@@ -234,15 +234,15 @@ inline void readObject(apache::geode::client::DataInput& input, TObj*& array,
template <typename TObj, typename TLen,
typename std::enable_if<!std::is_base_of<Serializable, TObj>::value,
Serializable>::type* = nullptr>
-inline uint32_t objectSize(const TObj* array, TLen len) {
- return (uint32_t)(sizeof(TObj) * len);
+inline size_t objectSize(const TObj* array, TLen len) {
+ return sizeof(TObj) * len;
}
template <typename TObj, typename TLen,
typename std::enable_if<std::is_base_of<Serializable, TObj>::value,
Serializable>::type* = nullptr>
-inline uint32_t objectSize(const TObj* array, TLen len) {
- uint32_t size = 0;
+inline size_t objectSize(const TObj* array, TLen len) {
+ size_t size = 0;
const TObj* endArray = array + len;
while (array < endArray) {
if (*array != nullptr) {
@@ -250,7 +250,7 @@ inline uint32_t objectSize(const TObj* array, TLen len) {
}
array++;
}
- size += (uint32_t)(sizeof(TObj) * len);
+ size += sizeof(TObj) * len;
return size;
}
@@ -265,8 +265,7 @@ inline void writeObject(apache::geode::client::DataOutput& output,
}
}
-inline uint32_t objectSize(
- const std::vector<std::shared_ptr<Cacheable>>& value) {
+inline size_t objectSize(const std::vector<std::shared_ptr<Cacheable>>& value) {
size_t objectSize = 0;
for (const auto& iter : value) {
if (iter) {
@@ -274,7 +273,7 @@ inline uint32_t objectSize(
}
}
objectSize += sizeof(std::shared_ptr<Cacheable>) * value.size();
- return static_cast<uint32_t>(objectSize);
+ return objectSize;
}
template <typename TObj, typename _tail>
diff --git a/cppcache/include/geode/StructSet.hpp b/cppcache/include/geode/StructSet.hpp
index f793149..677445d 100644
--- a/cppcache/include/geode/StructSet.hpp
+++ b/cppcache/include/geode/StructSet.hpp
@@ -64,7 +64,7 @@ class _GEODE_EXPORT StructSet : public CqResults {
* @returns A smart pointer to the item indexed.
*/
virtual const std::shared_ptr<Serializable> operator[](
- int32_t index) const = 0;
+ size_t index) const = 0;
/**
* Get the index number of the specified field name in the StructSet.
diff --git a/cppcache/include/geode/SystemProperties.hpp b/cppcache/include/geode/SystemProperties.hpp
index 84f77f8..7a5d85b 100644
--- a/cppcache/include/geode/SystemProperties.hpp
+++ b/cppcache/include/geode/SystemProperties.hpp
@@ -155,6 +155,7 @@ class _GEODE_EXPORT SystemProperties {
* it has exceeded the HeapLRULimit. Defaults to 10%
*/
const int32_t heapLRUDelta() const { return m_heapLRUDelta; }
+
/**
* Returns the maximum socket buffer size to use
*/
@@ -248,13 +249,11 @@ class _GEODE_EXPORT SystemProperties {
*/
const uint32_t statsDiskSpaceLimit() const { return m_statsDiskSpaceLimit; }
- const uint32_t maxQueueSize() { return m_maxQueueSize; }
-
- const uint32_t javaConnectionPoolSize() const {
- return m_javaConnectionPoolSize;
+ const uint32_t connectionPoolSize() const {
+ return m_connectionPoolSize;
}
void setjavaConnectionPoolSize(uint32_t size) {
- m_javaConnectionPoolSize = size;
+ m_connectionPoolSize = size;
}
/**
@@ -384,8 +383,7 @@ class _GEODE_EXPORT SystemProperties {
uint32_t m_statsFileSizeLimit;
uint32_t m_statsDiskSpaceLimit;
- uint32_t m_maxQueueSize;
- uint32_t m_javaConnectionPoolSize;
+ uint32_t m_connectionPoolSize;
int32_t m_heapLRULimit;
int32_t m_heapLRUDelta;
diff --git a/cppcache/integration-test/ThinClientPdxSerializers.hpp b/cppcache/integration-test/ThinClientPdxSerializers.hpp
index 8183256..a0b6a1e 100644
--- a/cppcache/integration-test/ThinClientPdxSerializers.hpp
+++ b/cppcache/integration-test/ThinClientPdxSerializers.hpp
@@ -40,7 +40,8 @@ class TestPdxSerializer : public PdxSerializer {
}
}
- static uint32_t objectSize(void *testObject, const std::string &className) {
+ static size_t objectSize(const void *testObject,
+ const std::string &className) {
ASSERT(className == CLASSNAME1 || className == CLASSNAME2,
"Unexpected classname in objectSize()");
LOG("TestPdxSerializer::objectSize called");
diff --git a/cppcache/integration-test/testSerialization.cpp b/cppcache/integration-test/testSerialization.cpp
index 26f0006..240ea23 100644
--- a/cppcache/integration-test/testSerialization.cpp
+++ b/cppcache/integration-test/testSerialization.cpp
@@ -51,7 +51,7 @@ std::shared_ptr<T> duplicate(const std::shared_ptr<T>& orig) {
auto dout = getHelper()->getCache()->createDataOutput();
dout->writeObject(orig);
- uint32_t length = 0;
+ size_t length = 0;
const uint8_t* buffer = dout->getBuffer(&length);
auto din = getHelper()->getCache()->createDataInput(buffer, length);
din->readObject(result);
diff --git a/cppcache/src/Cache.cpp b/cppcache/src/Cache.cpp
index bd81b63..d95d6b6 100644
--- a/cppcache/src/Cache.cpp
+++ b/cppcache/src/Cache.cpp
@@ -229,7 +229,7 @@ PoolManager& Cache::getPoolManager() const {
}
std::unique_ptr<DataInput> Cache::createDataInput(const uint8_t* m_buffer,
- int32_t len) const {
+ size_t len) const {
return std::unique_ptr<DataInput>(
new DataInput(m_buffer, len, m_cacheImpl.get()));
}
diff --git a/cppcache/src/ClientProxyMembershipID.cpp b/cppcache/src/ClientProxyMembershipID.cpp
index 642aa7e..0dbcd88 100644
--- a/cppcache/src/ClientProxyMembershipID.cpp
+++ b/cppcache/src/ClientProxyMembershipID.cpp
@@ -143,7 +143,7 @@ void ClientProxyMembershipID::initObjectVars(
int32ptr->toData(m_memID);
}
writeVersion(Version::getOrdinal(), m_memID);
- uint32_t len;
+ size_t len;
char* buf = (char*)m_memID.getBuffer(&len);
m_memIDStr.append(buf, len);
diff --git a/cppcache/src/DataOutput.cpp b/cppcache/src/DataOutput.cpp
index 3e0fde5..ef4cab1 100644
--- a/cppcache/src/DataOutput.cpp
+++ b/cppcache/src/DataOutput.cpp
@@ -37,16 +37,16 @@ namespace client {
using namespace internal;
ACE_Recursive_Thread_Mutex g_bigBufferLock;
-uint32_t DataOutput::m_highWaterMark = 50 * 1024 * 1024;
-uint32_t DataOutput::m_lowWaterMark = 8192;
+size_t DataOutput::m_highWaterMark = 50 * 1024 * 1024;
+size_t DataOutput::m_lowWaterMark = 8192;
/** This represents a allocation in this thread local pool. */
class BufferDesc {
public:
uint8_t* m_buf;
- uint32_t m_size;
+ size_t m_size;
- BufferDesc(uint8_t* buf, uint32_t size) : m_buf(buf), m_size(size) {}
+ BufferDesc(uint8_t* buf, size_t size) : m_buf(buf), m_size(size) {}
BufferDesc() : m_buf(nullptr), m_size(0) {}
@@ -73,7 +73,7 @@ class TSSDataOutput {
TSSDataOutput();
~TSSDataOutput();
- uint8_t* getBuffer(uint32_t* size) {
+ uint8_t* getBuffer(size_t* size) {
if (!m_buffers.empty()) {
BufferDesc desc = m_buffers.back();
m_buffers.pop_back();
@@ -90,7 +90,7 @@ class TSSDataOutput {
}
}
- void poolBuffer(uint8_t* buf, uint32_t size) {
+ void poolBuffer(uint8_t* buf, size_t size) {
BufferDesc desc(buf, size);
m_buffers.push_back(desc);
}
@@ -121,11 +121,11 @@ DataOutput::DataOutput(const CacheImpl* cache)
m_buf = m_bytes = DataOutput::checkoutBuffer(&m_size);
}
-uint8_t* DataOutput::checkoutBuffer(uint32_t* size) {
+uint8_t* DataOutput::checkoutBuffer(size_t* size) {
return TSSDataOutput::s_tssDataOutput->getBuffer(size);
}
-void DataOutput::checkinBuffer(uint8_t* buffer, uint32_t size) {
+void DataOutput::checkinBuffer(uint8_t* buffer, size_t size) {
TSSDataOutput::s_tssDataOutput->poolBuffer(buffer, size);
}
diff --git a/cppcache/src/PdxWrapper.cpp b/cppcache/src/PdxWrapper.cpp
index 0f3aae6..bd4265c 100644
--- a/cppcache/src/PdxWrapper.cpp
+++ b/cppcache/src/PdxWrapper.cpp
@@ -74,7 +74,7 @@ PdxWrapper::PdxWrapper(std::string className,
}
/* m_sizer can be nullptr - required only if heap LRU is enabled */
- m_sizer = m_serializer->getObjectSizer(className.c_str());
+ m_sizer = m_serializer->getObjectSizer(className);
/* adongre - Coverity II
* CID 29277: Uninitialized pointer field (UNINIT_CTOR)
diff --git a/cppcache/src/Properties.cpp b/cppcache/src/Properties.cpp
index 43d2ec5..88320c1 100644
--- a/cppcache/src/Properties.cpp
+++ b/cppcache/src/Properties.cpp
@@ -139,9 +139,7 @@ void Properties::remove(const std::shared_ptr<CacheableKey>& key) {
MAP->unbind(key);
}
-uint32_t Properties::getSize() const {
- return static_cast<uint32_t>(MAP->current_size());
-}
+size_t Properties::getSize() const { return MAP->current_size(); }
void Properties::foreach (Visitor& visitor) const {
CacheableKeyCacheableMapGuard guard(MAP->mutex());
diff --git a/cppcache/src/ResultSetImpl.cpp b/cppcache/src/ResultSetImpl.cpp
index 145343b..ac5cbe0 100644
--- a/cppcache/src/ResultSetImpl.cpp
+++ b/cppcache/src/ResultSetImpl.cpp
@@ -35,7 +35,7 @@ int32_t ResultSetImpl::size() const {
}
const std::shared_ptr<Serializable> ResultSetImpl::operator[](
- int32_t index) const {
+ size_t index) const {
if (index >= m_resultSetVector->size()) {
throw IllegalArgumentException("index out of bounds");
}
diff --git a/cppcache/src/ResultSetImpl.hpp b/cppcache/src/ResultSetImpl.hpp
index d17bca0..7de288d 100644
--- a/cppcache/src/ResultSetImpl.hpp
+++ b/cppcache/src/ResultSetImpl.hpp
@@ -41,19 +41,20 @@ class _GEODE_EXPORT ResultSetImpl
public:
ResultSetImpl(const std::shared_ptr<CacheableVector>& response);
- bool isModifiable() const;
+ bool isModifiable() const override;
- int32_t size() const;
+ int32_t size() const override;
- const std::shared_ptr<Serializable> operator[](int32_t index) const;
+ const std::shared_ptr<Serializable> operator[](
+ size_t index) const override;
- SelectResultsIterator getIterator();
+ SelectResultsIterator getIterator() override;
/** Get an iterator pointing to the start of vector. */
- virtual SelectResults::Iterator begin() const;
+ virtual SelectResults::Iterator begin() const override;
/** Get an iterator pointing to the end of vector. */
- virtual SelectResults::Iterator end() const;
+ virtual SelectResults::Iterator end() const override;
~ResultSetImpl();
diff --git a/cppcache/src/StructSetImpl.cpp b/cppcache/src/StructSetImpl.cpp
index ec8e4ce..39ca52d 100644
--- a/cppcache/src/StructSetImpl.cpp
+++ b/cppcache/src/StructSetImpl.cpp
@@ -56,7 +56,7 @@ bool StructSetImpl::isModifiable() const { return false; }
int32_t StructSetImpl::size() const { return m_structVector->size(); }
const std::shared_ptr<Serializable> StructSetImpl::operator[](
- int32_t index) const {
+ size_t index) const {
if (index >= m_structVector->size()) {
throw IllegalArgumentException("Index out of bounds");
}
diff --git a/cppcache/src/StructSetImpl.hpp b/cppcache/src/StructSetImpl.hpp
index 63ba425..dbd1683 100644
--- a/cppcache/src/StructSetImpl.hpp
+++ b/cppcache/src/StructSetImpl.hpp
@@ -46,23 +46,24 @@ class _GEODE_EXPORT StructSetImpl
StructSetImpl(const std::shared_ptr<CacheableVector>& values,
const std::vector<std::string>& fieldNames);
- bool isModifiable() const;
+ bool isModifiable() const override;
- int32_t size() const;
+ int32_t size() const override;
- const std::shared_ptr<Serializable> operator[](int32_t index) const;
+ const std::shared_ptr<Serializable> operator[](
+ size_t index) const override;
- const int32_t getFieldIndex(const std::string& fieldname);
+ const int32_t getFieldIndex(const std::string& fieldname) override;
- const std::string& getFieldName(int32_t index);
+ const std::string& getFieldName(int32_t index) override;
- SelectResultsIterator getIterator();
+ SelectResultsIterator getIterator() override;
/** Get an iterator pointing to the start of vector. */
- virtual SelectResults::Iterator begin() const;
+ virtual SelectResults::Iterator begin() const override;
/** Get an iterator pointing to the end of vector. */
- virtual SelectResults::Iterator end() const;
+ virtual SelectResults::Iterator end() const override;
virtual ~StructSetImpl();
diff --git a/cppcache/src/SystemProperties.cpp b/cppcache/src/SystemProperties.cpp
index 8ae4e5c..2d5d64a 100644
--- a/cppcache/src/SystemProperties.cpp
+++ b/cppcache/src/SystemProperties.cpp
@@ -46,7 +46,7 @@ const char LogFilename[] = "log-file";
const char LogLevelProperty[] = "log-level";
const char Name[] = "name";
-const char JavaConnectionPoolSize[] = "connection-pool-size";
+const char ConnectionPoolSize[] = "connection-pool-size";
const char LicenseFilename[] = "license-file";
const char LicenseType[] = "license-type";
@@ -103,7 +103,7 @@ const char DefaultLogFilename[] = ""; // stdout...
const apache::geode::client::LogLevel DefaultLogLevel =
apache::geode::client::LogLevel::Config;
-const int DefaultJavaConnectionPoolSize = 5;
+const int DefaultConnectionPoolSize = 5;
// defaults for crash dump related properties
const bool DefaultCrashDumpEnabled = true;
@@ -123,8 +123,7 @@ const uint32_t DefaultLogDiskSpaceLimit = 0; // = unlimited
const uint32_t DefaultStatsFileSizeLimit = 0; // = unlimited
const uint32_t DefaultStatsDiskSpaceLimit = 0; // = unlimited
-const uint32_t DefaultMaxQueueSize = 80000;
-const uint32_t DefaultHeapLRULimit = 0; // = unlimited, disabled when it is 0
+const size_t DefaultHeapLRULimit = 0; // = unlimited, disabled when it is 0
const int32_t DefaultHeapLRUDelta = 10; // = unlimited, disabled when it is 0
const int32_t DefaultMaxSocketBufferSize = 65 * 1024;
@@ -168,8 +167,7 @@ SystemProperties::SystemProperties(
m_logDiskSpaceLimit(DefaultLogDiskSpaceLimit),
m_statsFileSizeLimit(DefaultStatsFileSizeLimit),
m_statsDiskSpaceLimit(DefaultStatsDiskSpaceLimit),
- m_maxQueueSize(DefaultMaxQueueSize),
- m_javaConnectionPoolSize(DefaultJavaConnectionPoolSize),
+ m_connectionPoolSize(DefaultConnectionPoolSize),
m_heapLRULimit(DefaultHeapLRULimit),
m_heapLRUDelta(DefaultHeapLRUDelta),
m_maxSocketBufferSize(DefaultMaxSocketBufferSize),
@@ -339,8 +337,8 @@ void SystemProperties::processProperty(const std::string& property,
("SystemProperties: unknown log level " + property + "=" + value)
.c_str());
}
- } else if (property == JavaConnectionPoolSize) {
- m_javaConnectionPoolSize = std::stol(value);
+ } else if (property == ConnectionPoolSize) {
+ m_connectionPoolSize = std::stol(value);
} else if (property == Name) {
m_name = value;
} else if (property == DurableClientId) {
@@ -409,7 +407,7 @@ void SystemProperties::logSettings() {
settings += to_string(connectTimeout());
settings += "\n connection-pool-size = ";
- settings += std::to_string(javaConnectionPoolSize());
+ settings += std::to_string(connectionPoolSize());
settings += "\n connect-wait-timeout = ";
settings += to_string(connectWaitTimeout());
diff --git a/cppcache/src/TcrConnection.cpp b/cppcache/src/TcrConnection.cpp
index d892f5a..31bb454 100644
--- a/cppcache/src/TcrConnection.cpp
+++ b/cppcache/src/TcrConnection.cpp
@@ -295,7 +295,7 @@ bool TcrConnection::InitTcrConnection(
}
}
- uint32_t msgLengh;
+ size_t msgLengh;
char* data = (char*)handShakeMsg->getBuffer(&msgLengh);
LOGFINE("Attempting handshake with endpoint %s for %s%s connection", endpoint,
isClientNotification ? (isSecondary ? "secondary " : "primary ") : "",
@@ -360,7 +360,7 @@ bool TcrConnection::InitTcrConnection(
auto sendCreds = cacheImpl->createDataOutput();
ciphertext->toData(*sendCreds);
- uint32_t credLen;
+ size_t credLen;
char* credData = (char*)sendCreds->getBuffer(&credLen);
// send the encrypted bytes and check the response
error = sendData(credData, credLen, connectTimeout, false);
diff --git a/cppcache/src/TcrEndpoint.cpp b/cppcache/src/TcrEndpoint.cpp
index 791ca30..c6503fb 100644
--- a/cppcache/src/TcrEndpoint.cpp
+++ b/cppcache/src/TcrEndpoint.cpp
@@ -55,7 +55,7 @@ TcrEndpoint::TcrEndpoint(const std::string& name, CacheImpl* cacheImpl,
m_connectLockCond(m_connectLock),
m_maxConnections(cacheImpl->getDistributedSystem()
.getSystemProperties()
- .javaConnectionPoolSize()),
+ .connectionPoolSize()),
m_notifyConnection(0),
m_notifyReceiver(0),
m_numRegionListener(0),
@@ -1234,7 +1234,7 @@ void TcrEndpoint::closeConnections() {
m_ports.clear();
m_maxConnections = m_cacheImpl->getDistributedSystem()
.getSystemProperties()
- .javaConnectionPoolSize();
+ .connectionPoolSize();
}
/*
diff --git a/sqliteimpl/SqLiteImpl.cpp b/sqliteimpl/SqLiteImpl.cpp
index a1baab2..2208e8e 100644
--- a/sqliteimpl/SqLiteImpl.cpp
+++ b/sqliteimpl/SqLiteImpl.cpp
@@ -107,7 +107,7 @@ void SqLiteImpl::write(const std::shared_ptr<CacheableKey>& key,
auto& cache = m_regionPtr->getCache();
auto keyDataBuffer = cache.createDataOutput();
auto valueDataBuffer = cache.createDataOutput();
- uint32_t keyBufferSize, valueBufferSize;
+ size_t keyBufferSize, valueBufferSize;
keyDataBuffer->writeObject(key);
valueDataBuffer->writeObject(value);
@@ -126,7 +126,7 @@ std::shared_ptr<Cacheable> SqLiteImpl::read(
const std::shared_ptr<CacheableKey>& key, void*& dbHandle) {
// Serialize key.
auto keyDataBuffer = m_regionPtr->getCache().createDataOutput();
- uint32_t keyBufferSize;
+ size_t keyBufferSize;
keyDataBuffer->writeObject(key);
void* keyData = const_cast<uint8_t*>(keyDataBuffer->getBuffer(&keyBufferSize));
void* valueData;
@@ -169,7 +169,7 @@ void SqLiteImpl::destroyRegion() {
void SqLiteImpl::destroy(const std::shared_ptr<CacheableKey>& key, void*& dbHandle) {
// Serialize key and value.
auto keyDataBuffer = m_regionPtr->getCache().createDataOutput();
- uint32_t keyBufferSize;
+ size_t keyBufferSize;
keyDataBuffer->writeObject(key);
void* keyData = const_cast<uint8_t*>(keyDataBuffer->getBuffer(&keyBufferSize));
if (m_sqliteHelper->removeKey(keyData, keyBufferSize) != 0) {
diff --git a/tests/cpp/testobject/PdxClassV1.hpp b/tests/cpp/testobject/PdxClassV1.hpp
index 3c8a3c1..3f9b78b 100644
--- a/tests/cpp/testobject/PdxClassV1.hpp
+++ b/tests/cpp/testobject/PdxClassV1.hpp
@@ -421,7 +421,8 @@ class TestPdxSerializerForV1 : public PdxSerializer {
}
}
- static uint32_t objectSize(void* testObject, const std::string& className) {
+ static size_t objectSize(const void* testObject,
+ const std::string& className) {
// ASSERT(strcmp(className, V1CLASSNAME1) == 0 || strcmp(className,
// V1CLASSNAME2) == 0, "Unexpected classname in objectSize()");
LOGINFO("TestPdxSerializer::objectSize called");
diff --git a/tests/cpp/testobject/PdxClassV2.hpp b/tests/cpp/testobject/PdxClassV2.hpp
index 8127af9..f690f20 100644
--- a/tests/cpp/testobject/PdxClassV2.hpp
+++ b/tests/cpp/testobject/PdxClassV2.hpp
@@ -448,7 +448,8 @@ class TestPdxSerializerForV2 : public PdxSerializer {
}
}
- static uint32_t objectSize(void* testObject, const std::string& className) {
+ static size_t objectSize(const void* testObject,
+ const std::string& className) {
// ASSERT(strcmp(className, V2CLASSNAME3) == 0 || strcmp(className,
// V2CLASSNAME4) == 0, "Unexpected classname in objectSize()");
LOGINFO("TestPdxSerializer::objectSize called");
--
To stop receiving notification emails like this one, please contact
jbarrett@apache.org.