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 18:09:29 UTC
[geode-native] branch develop updated: GEODE-4946: Treat warnings
as error on MSVC (#252)
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 456602e GEODE-4946: Treat warnings as error on MSVC (#252)
456602e is described below
commit 456602ef10e52b1f50e24116b9b1ca0ec797de56
Author: Jacob Barrett <jb...@pivotal.io>
AuthorDate: Thu Mar 29 11:09:27 2018 -0700
GEODE-4946: Treat warnings as error on MSVC (#252)
- Removes LTCG warning on Release builds.
- Fixes compiler warnings on MSVC.
---
CMakeLists.txt | 23 ++-
clicache/integration-test/DurableListenerN.cs | 1 -
clicache/integration-test/PutGetTestsN.cs | 5 -
.../RegionAttributesFactoryTestsN.cs | 2 -
clicache/integration-test/TallyLoaderN.cs | 1 -
clicache/integration-test/TallyResolverN.cs | 1 -
.../ThinClientAppDomainFunctionExecutionTests.cs | 1 -
.../ThinClientAppDomainQueryTests.cs | 6 -
clicache/integration-test/ThinClientQueryTestsN.cs | 2 -
clicache/src/CMakeLists.txt | 1 +
clicache/src/Cache.cpp | 3 +-
clicache/src/CacheableHashSet.hpp | 6 +-
clicache/src/CacheableObject.cpp | 13 +-
clicache/src/CacheableObjectXml.cpp | 14 +-
clicache/src/CqAttributes.cpp | 2 +-
clicache/src/DataInput.cpp | 26 ++--
clicache/src/DataInput.hpp | 26 ++--
clicache/src/DataOutput.cpp | 4 +-
clicache/src/DataOutput.hpp | 4 +-
clicache/src/ExceptionTypes.cpp | 5 +-
clicache/src/Properties.cpp | 2 +-
clicache/src/QueryService.cpp | 2 +-
clicache/src/Region.cpp | 6 +-
clicache/src/ResultCollector.cpp | 2 +-
clicache/src/ResultSet.cpp | 2 +-
clicache/src/StructSet.cpp | 2 +-
clicache/src/impl/AuthenticatedCache.cpp | 2 +-
clicache/src/impl/CacheWriter.hpp | 12 +-
clicache/src/impl/FixedPartitionResolver.hpp | 30 ++--
clicache/src/impl/GeodeDataInputStream.hpp | 14 +-
clicache/src/impl/ManagedCacheableDelta.cpp | 2 +-
clicache/src/impl/ManagedCacheableKey.cpp | 2 +-
.../src/impl/ManagedFixedPartitionResolver.cpp | 8 +-
clicache/src/impl/ManagedPartitionResolver.cpp | 6 +-
clicache/src/impl/PdxLocalReader.cpp | 2 +-
clicache/src/impl/PdxLocalWriter.cpp | 6 +-
clicache/src/impl/PdxManagedCacheableKey.cpp | 2 +-
clicache/src/impl/PdxWriterWithTypeCollector.cpp | 4 +-
clicache/src/native_conditional_unique_ptr.hpp | 4 +-
clicache/test/CMakeLists.txt | 1 +
cppcache/CMakeLists.txt | 11 ++
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/integration-test/CMakeLists.txt | 3 +
cppcache/integration-test/ThinClientDistOps.hpp | 4 +-
cppcache/integration-test/testDataOutput.cpp | 12 +-
.../testThinClientCacheableStringArray.cpp | 12 +-
.../integration-test/testThinClientCqDurable.cpp | 21 +--
.../testThinClientCqHAFailover.cpp | 15 +-
cppcache/integration-test/testThinClientCqIR.cpp | 16 ++-
.../testThinClientHAQueryFailover.cpp | 7 +-
.../testThinClientLocatorFailover.cpp | 13 +-
.../integration-test/testThinClientPdxInstance.cpp | 111 ++++++++------
.../integration-test/testThinClientPoolLocator.cpp | 2 +-
.../testThinClientRemoteQueryFailover.cpp | 7 +-
.../testThinClientRemoteQueryFailoverPdx.cpp | 7 +-
.../testThinClientSecurityMultiUserTest.cpp | 30 ++--
.../testXmlCacheCreationWithOverFlow.cpp | 65 +++++----
cppcache/shared/CMakeLists.txt | 1 +
cppcache/src/CacheImpl.hpp | 14 +-
cppcache/src/CacheTransactionManagerImpl.hpp | 9 +-
cppcache/src/ClientProxyMembershipID.cpp | 14 +-
cppcache/src/Connector.hpp | 8 +-
cppcache/src/DataInputInternal.hpp | 4 +-
cppcache/src/DiffieHellman.cpp | 25 ++--
cppcache/src/DiskStoreId.hpp | 5 +-
cppcache/src/DiskVersionTag.hpp | 4 +-
cppcache/src/ExecutionImpl.cpp | 12 +-
.../src/InternalCacheTransactionManager2PC.hpp | 2 +-
.../src/InternalCacheTransactionManager2PCImpl.hpp | 4 +-
cppcache/src/LocalRegion.cpp | 159 +++++++++++----------
cppcache/src/MapSegment.cpp | 58 ++++----
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 | 64 ++++-----
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 | 14 +-
cppcache/src/ThinClientRegion.cpp | 32 ++---
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/CMakeLists.txt | 7 +-
cryptoimpl/DHImpl.cpp | 46 +++---
cryptoimpl/SSLImpl.cpp | 11 +-
cryptoimpl/SSLImpl.hpp | 6 +-
dhimpl/CMakeLists.txt | 7 +
dhimpl/DHImpl.cpp | 61 ++++----
plugins/SQLiteCLI/SQLiteCLI.csproj.in | 29 +---
plugins/SQLiteCLI/SqLiteImpl.cs | 10 +-
sqliteimpl/CMakeLists.txt | 6 +-
sqliteimpl/SqLiteHelper.cpp | 11 +-
sqliteimpl/SqLiteHelper.hpp | 10 +-
sqliteimpl/SqLiteImpl.cpp | 26 ++--
templates/security/CMakeLists.txt | 2 +
templates/security/PkcsAuthInit.cpp | 5 +-
templates/security/csharp/securityImpl.csproj.in | 4 +
tests/cli/DUnitFramework/DUnitFramework.csproj.in | 29 +---
tests/cli/FwkClient/FwkClient.csproj.in | 28 +---
tests/cli/FwkLauncher/FwkLauncher.csproj.in | 28 +---
tests/cli/FwkUtil/FwkUtil.csproj.in | 24 +---
tests/cli/NewFwkLib/CacheHelper.cs | 3 -
.../DeltaTest/DeltaClientValidationListener.cs | 4 +-
tests/cli/NewFwkLib/NewFwkLib.csproj.in | 25 +---
.../cli/PdxClassLibrary/PdxClassLibrary.csproj.in | 27 +---
tests/cli/PdxClassLibrary/VariousPdxTypes.cs | 108 ++++++++++++++
tests/cli/PdxVersion2Lib/Version2.cs | 91 +++++++++++-
tests/cli/QueryHelper/QueryHelperN.cs | 4 +-
tests/cli/SecurityUtil/SecurityUtil.csproj.in | 30 +---
tests/cpp/fwk/CMakeLists.txt | 1 +
tests/cpp/fwklib/CMakeLists.txt | 1 +
tests/cpp/fwklib/FrameworkTest.cpp | 8 +-
tests/cpp/fwklib/FwkObjects.hpp | 6 +-
tests/cpp/fwklib/QueryHelper.hpp | 4 +-
tests/cpp/fwklib/RegionHelper.hpp | 40 ++++--
tests/cpp/fwklib/TcpIpc.cpp | 45 ++----
tests/cpp/fwklib/TcpIpc.hpp | 6 +-
tests/cpp/security/CMakeLists.txt | 1 +
tests/cpp/security/PkcsAuthInit.cpp | 19 ++-
tests/cpp/testobject/CMakeLists.txt | 1 +
tests/cpp/testobject/InvalidPdxUsage.cpp | 6 +-
tests/cpp/testobject/InvalidPdxUsage.hpp | 4 +-
tests/cpp/testobject/NonPdxType.cpp | 6 +-
tests/cpp/testobject/NonPdxType.hpp | 6 +-
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 +-
156 files changed, 1429 insertions(+), 1307 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index b3fd8e1..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
@@ -183,12 +185,25 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "SunPro")
target_link_libraries(c++11 INTERFACE -std=c++11 stdc++ gcc_s CrunG3 m c)
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-z,defs")
-endif()
-if(MSVC)
- # TODO error on warnings
+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")
- set(BUILD_CLI 1)
+
+ # Enables whole program optimizaion and link time code generation for release.
+ set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /GL")
+ set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /LTCG:incremental")
+ set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} /LTCG:incremental")
+
+ # Enables strong name signing
set(STRONG_NAME_KEY "" CACHE FILEPATH "Strong Name Key File")
if(EXISTS "${STRONG_NAME_KEY}")
set(SHARED_LINKER_FLAGS_STRONG_KEY "/keyfile:${STRONG_NAME_KEY}")
diff --git a/clicache/integration-test/DurableListenerN.cs b/clicache/integration-test/DurableListenerN.cs
index c01211d..25bc956 100644
--- a/clicache/integration-test/DurableListenerN.cs
+++ b/clicache/integration-test/DurableListenerN.cs
@@ -24,7 +24,6 @@ namespace Apache.Geode.Client.UnitTests
using NUnit.Framework;
using Apache.Geode.DUnitFramework;
using Apache.Geode.Client;
- using Apache.Geode.Client;
//using Com.Vmware.Cache;
//using Region = Com.Vmware.Cache.IRegion<object, object>;
diff --git a/clicache/integration-test/PutGetTestsN.cs b/clicache/integration-test/PutGetTestsN.cs
index 5097ac4..5b1b3a4 100644
--- a/clicache/integration-test/PutGetTestsN.cs
+++ b/clicache/integration-test/PutGetTestsN.cs
@@ -46,9 +46,6 @@ namespace Apache.Geode.Client.UnitTests
private uint[] m_cKeyCksums;
private CacheableWrapper[] m_cValues;
private uint[] m_cValCksums;
- private static string FEOnRegionPrSHOP_OptimizeForWrite = "FEOnRegionPrSHOP_OptimizeForWrite";
- private static string FEOnRegionPrSHOP = "FEOnRegionPrSHOP";
- private static string getFuncName = "MultiGetFunction";
#endregion
@@ -219,8 +216,6 @@ namespace Apache.Geode.Client.UnitTests
public void DoPRSHFixedPartitionResolverTests(string rname)
{
IRegion<object, object> region = CacheHelper.GetRegion<object, object>(rname);
- int metadatarefreshCount = 0;
- int metadatarefreshCount1 = 0;
Assert.IsNotNull(region, "DoPRSHPartitionResolverPuts: null region.");
Util.Log("Inside DoPRSHFixedPartitionResolverTests region name is {0} ", region.Name.ToString());
for (int i = 0; i < 2000; i++)
diff --git a/clicache/integration-test/RegionAttributesFactoryTestsN.cs b/clicache/integration-test/RegionAttributesFactoryTestsN.cs
index 304c6ee..358bc5b 100644
--- a/clicache/integration-test/RegionAttributesFactoryTestsN.cs
+++ b/clicache/integration-test/RegionAttributesFactoryTestsN.cs
@@ -34,8 +34,6 @@ namespace Apache.Geode.Client.UnitTests
public class RegionAttributesFactoryTests : UnitTests
{
- private UnitProcess m_client1, m_client2;
-
protected override ClientBase[] GetClients()
{
return new ClientBase[] {};
diff --git a/clicache/integration-test/TallyLoaderN.cs b/clicache/integration-test/TallyLoaderN.cs
index 64db895..dcbbcc4 100644
--- a/clicache/integration-test/TallyLoaderN.cs
+++ b/clicache/integration-test/TallyLoaderN.cs
@@ -23,7 +23,6 @@ namespace Apache.Geode.Client.UnitTests
using Apache.Geode.DUnitFramework;
using Apache.Geode.Client;
- using Apache.Geode.Client;
class TallyLoader<TKey, TVal> : ICacheLoader<TKey, TVal>
{
diff --git a/clicache/integration-test/TallyResolverN.cs b/clicache/integration-test/TallyResolverN.cs
index a37c3a0..be0b409 100755
--- a/clicache/integration-test/TallyResolverN.cs
+++ b/clicache/integration-test/TallyResolverN.cs
@@ -23,7 +23,6 @@ namespace Apache.Geode.Client.UnitTests
using Apache.Geode.DUnitFramework;
using Apache.Geode.Client;
- using Apache.Geode.Client;
class TallyResolver<TKey, TVal> : IPartitionResolver<TKey, TVal>
{
diff --git a/clicache/integration-test/ThinClientAppDomainFunctionExecutionTests.cs b/clicache/integration-test/ThinClientAppDomainFunctionExecutionTests.cs
index 223debe..3f3836f 100644
--- a/clicache/integration-test/ThinClientAppDomainFunctionExecutionTests.cs
+++ b/clicache/integration-test/ThinClientAppDomainFunctionExecutionTests.cs
@@ -179,7 +179,6 @@ namespace Apache.Geode.Client.UnitTests
args1.Add(routingObj[i]);
}
- Boolean getResult = true;
//test data independant function execution with result onServer
Pool/*<TKey, TValue>*/ pool = CacheHelper.DCache.GetPoolManager().Find(poolName);
diff --git a/clicache/integration-test/ThinClientAppDomainQueryTests.cs b/clicache/integration-test/ThinClientAppDomainQueryTests.cs
index 1376208..6ebc8ac 100644
--- a/clicache/integration-test/ThinClientAppDomainQueryTests.cs
+++ b/clicache/integration-test/ThinClientAppDomainQueryTests.cs
@@ -35,16 +35,10 @@ namespace Apache.Geode.Client.UnitTests
{
#region Private members
- private UnitProcess m_client1;
- private UnitProcess m_client2;
private static string[] QueryRegionNames = { "Portfolios", "Positions", "Portfolios2",
"Portfolios3" };
- private static string QERegionName = "Portfolios";
- private static string endpoint1;
- private static string endpoint2;
-
#endregion Private members
protected override ClientBase[] GetClients()
diff --git a/clicache/integration-test/ThinClientQueryTestsN.cs b/clicache/integration-test/ThinClientQueryTestsN.cs
index 8156c23..c48035d 100644
--- a/clicache/integration-test/ThinClientQueryTestsN.cs
+++ b/clicache/integration-test/ThinClientQueryTestsN.cs
@@ -44,8 +44,6 @@ namespace Apache.Geode.Client.UnitTests
private static string[] QueryRegionNames = { "Portfolios", "Positions", "Portfolios2",
"Portfolios3" };
private static string QERegionName = "Portfolios";
- private static string endpoint1;
- private static string endpoint2;
#endregion
protected override ClientBase[] GetClients()
diff --git a/clicache/src/CMakeLists.txt b/clicache/src/CMakeLists.txt
index d382d36..59d6030 100644
--- a/clicache/src/CMakeLists.txt
+++ b/clicache/src/CMakeLists.txt
@@ -326,6 +326,7 @@ target_link_libraries(${PROJECT_NAME}
c++cli
c++11
apache-geode-static
+ _WarningsAsError
)
string(REPLACE "/RTC1" "" CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}")
diff --git a/clicache/src/Cache.cpp b/clicache/src/Cache.cpp
index 155f213..fd988bd 100644
--- a/clicache/src/Cache.cpp
+++ b/clicache/src/Cache.cpp
@@ -174,8 +174,7 @@ namespace Apache
{
GC::KeepAlive(m_nativeptr);
}
- array<Client::IRegion<TKey, TValue>^>^ rootRegions =
- gcnew array<Client::IRegion<TKey, TValue>^>( vrr.size( ) );
+ auto rootRegions = gcnew array<Client::IRegion<TKey, TValue>^>(static_cast<int>(vrr.size()));
for( System::Int32 index = 0; index < vrr.size( ); index++ )
{
diff --git a/clicache/src/CacheableHashSet.hpp b/clicache/src/CacheableHashSet.hpp
index 3a8db68..4364cfb 100644
--- a/clicache/src/CacheableHashSet.hpp
+++ b/clicache/src/CacheableHashSet.hpp
@@ -280,7 +280,7 @@ namespace Apache
{
try
{
- return static_cast<HSTYPE*>(m_nativeptr->get())->max_size();
+ return static_cast<int>(static_cast<HSTYPE*>(m_nativeptr->get())->max_size());
}
finally
{
@@ -316,7 +316,7 @@ namespace Apache
{
try
{
- return static_cast<HSTYPE*>(m_nativeptr->get())->bucket_count();
+ return static_cast<int>(static_cast<HSTYPE*>(m_nativeptr->get())->bucket_count());
}
finally
{
@@ -482,7 +482,7 @@ namespace Apache
{
try
{
- return static_cast<HSTYPE*>(m_nativeptr->get())->size();
+ return static_cast<int>(static_cast<HSTYPE*>(m_nativeptr->get())->size());
}
finally
{
diff --git a/clicache/src/CacheableObject.cpp b/clicache/src/CacheableObject.cpp
index 1b15069..7215219 100644
--- a/clicache/src/CacheableObject.cpp
+++ b/clicache/src/CacheableObject.cpp
@@ -42,13 +42,14 @@ namespace Apache
GeodeDataOutputStream dos(output);
BinaryFormatter bf;
- System::Int64 checkpoint = dos.Length;
+ auto checkpoint = dos.Length;
bf.Serialize(%dos, m_obj);
- m_objectSize = (System::UInt32) (dos.Length - checkpoint);
+ m_objectSize = dos.Length - checkpoint;
- output->RewindCursor(m_objectSize + 4);
- output->WriteInt32(m_objectSize);
- output->AdvanceCursor(m_objectSize);
+ auto size = static_cast<uint32_t>(m_objectSize);
+ output->RewindCursor(size + 4);
+ output->WriteInt32(size);
+ output->AdvanceCursor(size);
}
}
@@ -56,7 +57,7 @@ namespace Apache
{
int maxSize = input->ReadInt32();
GeodeDataInputStream dis(input, maxSize);
- System::UInt32 checkpoint = dis.BytesRead;
+ auto checkpoint = dis.BytesRead;
BinaryFormatter bf;
m_obj = bf.Deserialize(%dis);
m_objectSize = dis.BytesRead - checkpoint;
diff --git a/clicache/src/CacheableObjectXml.cpp b/clicache/src/CacheableObjectXml.cpp
index ca1b99f..15a60bd 100644
--- a/clicache/src/CacheableObjectXml.cpp
+++ b/clicache/src/CacheableObjectXml.cpp
@@ -54,13 +54,15 @@ namespace Apache
XmlSerializer xs(objType);
GeodeDataOutputStream dos(output);
- System::Int64 checkpoint = dos.Length;
+ auto checkpoint = dos.Length;
xs.Serialize(%dos, m_obj);
- m_objectSize = (System::UInt32) (dos.Length - checkpoint);
+ m_objectSize = dos.Length - checkpoint;
- output->RewindCursor(m_objectSize + 4);
- output->WriteInt32(m_objectSize);
- output->AdvanceCursor(m_objectSize);
+ auto size = static_cast<uint32_t>(m_objectSize);
+
+ output->RewindCursor(size + 4);
+ output->WriteInt32(size);
+ output->AdvanceCursor(size);
}
}
@@ -83,7 +85,7 @@ namespace Apache
int maxSize = input->ReadInt32();
GeodeDataInputStream dis(input, maxSize);
XmlSerializer xs(objType);
- System::UInt32 checkpoint = dis.BytesRead;
+ auto checkpoint = dis.BytesRead;
m_obj = xs.Deserialize(%dis);
m_objectSize = dis.BytesRead - checkpoint;
}
diff --git a/clicache/src/CqAttributes.cpp b/clicache/src/CqAttributes.cpp
index e273259..29615ce 100644
--- a/clicache/src/CqAttributes.cpp
+++ b/clicache/src/CqAttributes.cpp
@@ -50,7 +50,7 @@ namespace Apache
{
GC::KeepAlive(m_nativeptr);
}
- auto listners = gcnew array<ICqListener<TKey, TResult>^>(vrr.size());
+ auto listners = gcnew array<ICqListener<TKey, TResult>^>(static_cast<int>(vrr.size()));
for (System::Int32 index = 0; index < vrr.size(); index++)
{
diff --git a/clicache/src/DataInput.cpp b/clicache/src/DataInput.cpp
index 12e3169..f8a64ed 100644
--- a/clicache/src/DataInput.cpp
+++ b/clicache/src/DataInput.cpp
@@ -53,7 +53,7 @@ namespace Apache
using namespace msclr::interop;
namespace native = apache::geode::client;
- DataInput::DataInput(System::Byte* buffer, int size, Apache::Geode::Client::Cache^ cache)
+ DataInput::DataInput(System::Byte* buffer, size_t size, Apache::Geode::Client::Cache^ cache)
{
m_ispdxDesrialization = false;
m_isRootObjectPdx = false;
@@ -120,7 +120,7 @@ namespace Apache
}
}
- DataInput::DataInput(array<Byte>^ buffer, System::Int32 len, Apache::Geode::Client::Cache^ cache)
+ DataInput::DataInput(array<Byte>^ buffer, size_t len, Apache::Geode::Client::Cache^ cache)
{
m_ispdxDesrialization = false;
m_isRootObjectPdx = false;
@@ -358,7 +358,7 @@ namespace Apache
CheckBufferSize(len);
int i = 0;
- int j = m_cursor + len - 1;
+ auto j = m_cursor + len - 1;
array<Byte>^ bytes = gcnew array<Byte>(len);
while (i < len)
@@ -664,11 +664,11 @@ namespace Apache
else if (compId == GeodeClassIds::PDX)
{
//cache current state and reset after reading pdx object
- int cacheCursor = m_cursor;
+ auto cacheCursor = m_cursor;
System::Byte* cacheBuffer = m_buffer;
- unsigned int cacheBufferLength = m_bufferLength;
+ auto cacheBufferLength = m_bufferLength;
Object^ ret = Internal::PdxHelper::DeserializePdx(this, false, CacheRegionHelper::getCacheImpl(m_cache->GetNative().get())->getSerializationRegistry().get());
- int tmp = m_nativeptr->get()->getBytesRemaining();
+ auto tmp = m_nativeptr->get()->getBytesRemaining();
m_cursor = cacheBufferLength - tmp;
m_buffer = cacheBuffer;
m_bufferLength = cacheBufferLength;
@@ -883,7 +883,7 @@ namespace Apache
throw gcnew IllegalStateException("Unregistered typeId in deserialization, aborting.");
}
- System::UInt32 DataInput::BytesRead::get()
+ size_t DataInput::BytesRead::get()
{
AdvanceUMCursor();
SetBuffer();
@@ -898,12 +898,12 @@ namespace Apache
}
}
- System::UInt32 DataInput::BytesReadInternally::get()
+ size_t DataInput::BytesReadInternally::get()
{
return m_cursor;
}
- System::UInt32 DataInput::BytesRemaining::get()
+ size_t DataInput::BytesRemaining::get()
{
AdvanceUMCursor();
SetBuffer();
@@ -917,12 +917,12 @@ namespace Apache
}
}
- void DataInput::AdvanceCursor(System::Int32 offset)
+ void DataInput::AdvanceCursor(size_t offset)
{
m_cursor += offset;
}
- void DataInput::RewindCursor(System::Int32 offset)
+ void DataInput::RewindCursor(size_t offset)
{
AdvanceUMCursor();
try
@@ -1070,8 +1070,8 @@ namespace Apache
List<Object^>^ DataInput::ReadObjectArray()
{
//this to know whether it is null or it is empty
- int storeCursor = m_cursor;
- int len = this->ReadArrayLen();
+ auto storeCursor = m_cursor;
+ auto len = this->ReadArrayLen();
if (len == -1)
return nullptr;
//this will be read further by fromdata
diff --git a/clicache/src/DataInput.hpp b/clicache/src/DataInput.hpp
index d71c62d..ca6cc0b 100644
--- a/clicache/src/DataInput.hpp
+++ b/clicache/src/DataInput.hpp
@@ -74,7 +74,7 @@ namespace Apache
/// <exception cref="IllegalArgumentException">
/// if the buffer is null
/// </exception>
- DataInput( array<Byte>^ buffer, System::Int32 len, Cache^ cache );
+ DataInput( array<Byte>^ buffer, size_t len, Cache^ cache );
/// <summary>
/// Dispose: frees the internal buffer.
@@ -174,17 +174,17 @@ namespace Apache
/// <summary>
/// Get the count of bytes that have been read from the stream.
/// </summary>
- property System::UInt32 BytesRead
+ property size_t BytesRead
{
- System::UInt32 get( );
+ size_t get( );
}
/// <summary>
/// Get the count of bytes that are remaining in the buffer.
/// </summary>
- property System::UInt32 BytesRemaining
+ property size_t BytesRemaining
{
- System::UInt32 get();
+ size_t get();
}
property Apache::Geode::Client::Cache^ Cache
@@ -198,7 +198,7 @@ namespace Apache
/// <param name="offset">
/// The offset(number of bytes) by which to advance the cursor.
/// </param>
- void AdvanceCursor( System::Int32 offset );
+ void AdvanceCursor( size_t offset );
/// <summary>
/// Rewind the cursor of the buffer by the given offset.
@@ -206,7 +206,7 @@ namespace Apache
/// <param name="offset">
/// The offset(number of bytes) by which to rewind the cursor.
/// </param>
- void RewindCursor( System::Int32 offset );
+ void RewindCursor( size_t offset );
/// <summary>
/// Reset the cursor to the start of buffer.
@@ -315,9 +315,9 @@ namespace Apache
/// <summary>
/// Get the count of bytes that have been read from the stream, for internal use only.
/// </summary>
- property System::UInt32 BytesReadInternally
+ property size_t BytesReadInternally
{
- System::UInt32 get( );
+ size_t get( );
}
void ReadObject(bool% obj)
@@ -672,7 +672,7 @@ namespace Apache
}
}
- DataInput( System::Byte* buffer, int size, Apache::Geode::Client::Cache^ cache );
+ DataInput( System::Byte* buffer, size_t size, Apache::Geode::Client::Cache^ cache );
bool IsManagedObject()
{
@@ -681,7 +681,7 @@ namespace Apache
int GetPdxBytes()
{
- return m_bufferLength;
+ return static_cast<int>(m_bufferLength);
}
private:
@@ -694,8 +694,8 @@ namespace Apache
bool m_isRootObjectPdx;
Apache::Geode::Client::Cache^ m_cache;
System::Byte* m_buffer;
- unsigned int m_bufferLength;
- int m_cursor;
+ size_t m_bufferLength;
+ size_t m_cursor;
bool m_isManagedObject;
array<Char>^ m_forStringDecode;
diff --git a/clicache/src/DataOutput.cpp b/clicache/src/DataOutput.cpp
index 070f058..3d5423b 100644
--- a/clicache/src/DataOutput.cpp
+++ b/clicache/src/DataOutput.cpp
@@ -774,7 +774,7 @@ namespace Apache
{
WriteBytesToUMDataOutput();
SetBuffer();
- int buffLen = m_nativeptr->get()->getBufferLength();
+ auto buffLen = static_cast<int>(m_nativeptr->get()->getBufferLength());
array<Byte>^ buffer = gcnew array<Byte>(buffLen);
if (buffLen > 0) {
@@ -789,7 +789,7 @@ namespace Apache
}
}
- System::UInt32 DataOutput::BufferLength::get()
+ size_t DataOutput::BufferLength::get()
{
//first set native one
WriteBytesToUMDataOutput();
diff --git a/clicache/src/DataOutput.hpp b/clicache/src/DataOutput.hpp
index 7b02848..895b51b 100644
--- a/clicache/src/DataOutput.hpp
+++ b/clicache/src/DataOutput.hpp
@@ -249,9 +249,9 @@ namespace Apache
/// <summary>
/// Get the length of current data in the buffer.
/// </summary>
- property System::UInt32 BufferLength
+ property size_t BufferLength
{
- System::UInt32 get( );
+ size_t get( );
}
property Apache::Geode::Client::Cache^ Cache
diff --git a/clicache/src/ExceptionTypes.cpp b/clicache/src/ExceptionTypes.cpp
index f59ad9c..db10029 100644
--- a/clicache/src/ExceptionTypes.cpp
+++ b/clicache/src/ExceptionTypes.cpp
@@ -154,10 +154,9 @@ namespace Apache
return gcnew GeodeException(exName + ": " + exMsg,
gcnew GeodeException(GetStackTrace(nativeEx)));
}
- else {
- return gcnew GeodeException(exName + ": " + exMsg, innerException);
- }
}
+
+ return gcnew GeodeException(exName + ": " + exMsg, innerException);
}
} // namespace Client
diff --git a/clicache/src/Properties.cpp b/clicache/src/Properties.cpp
index 9b8c7db..3971c65 100644
--- a/clicache/src/Properties.cpp
+++ b/clicache/src/Properties.cpp
@@ -153,7 +153,7 @@ namespace Apache
try
{
- return m_nativeptr->get()->getSize( );
+ return static_cast<uint32_t>(m_nativeptr->get()->getSize( ));
}
finally
{
diff --git a/clicache/src/QueryService.cpp b/clicache/src/QueryService.cpp
index 01dcd1b..af28116 100644
--- a/clicache/src/QueryService.cpp
+++ b/clicache/src/QueryService.cpp
@@ -114,7 +114,7 @@ namespace Apache
{
apache::geode::client::QueryService::query_container_type vrr =
m_nativeptr->get()->getCqs();
- auto cqs = gcnew array<CqQuery<TKey, TResult>^>(vrr.size());
+ auto cqs = gcnew array<CqQuery<TKey, TResult>^>(static_cast<int>(vrr.size()));
for (System::Int32 index = 0; index < vrr.size(); index++)
{
diff --git a/clicache/src/Region.cpp b/clicache/src/Region.cpp
index 327efe2..589cbe2 100644
--- a/clicache/src/Region.cpp
+++ b/clicache/src/Region.cpp
@@ -358,7 +358,7 @@ namespace Apache
{
GC::KeepAlive(m_nativeptr);
}
- auto valarr = gcnew array<TValue>(vc.size());
+ auto valarr = gcnew array<TValue>(static_cast<int>(vc.size()));
for (System::Int32 index = 0; index < vc.size(); index++)
{
auto& nativeptr = vc[index];
@@ -730,8 +730,8 @@ namespace Apache
if (values != nullptr) {
valuesPtr = std::make_shared<native::HashMapOfCacheable>();
}
- auto callbackptr = Serializable::GetUnmanagedValueGeneric<Object^>(callbackArg, &m_nativeptr->get()->getCache());
- native::HashMapOfCacheable native_value;
+ auto callbackptr = Serializable::GetUnmanagedValueGeneric<Object^>(callbackArg);
+ native::HashMapOfCacheable native_value;
try
{
native_value = m_nativeptr->get()->getAll(vecKeys, callbackptr);
diff --git a/clicache/src/ResultCollector.cpp b/clicache/src/ResultCollector.cpp
index 6235b06..cfe9414 100644
--- a/clicache/src/ResultCollector.cpp
+++ b/clicache/src/ResultCollector.cpp
@@ -64,7 +64,7 @@ namespace Apache
try
{
auto results = m_nativeptr->get()->getResult(TimeUtils::TimeSpanToDurationCeil<std::chrono::milliseconds>(timeout));
- auto rs = gcnew array<TResult>(results->size());
+ auto rs = gcnew array<TResult>(static_cast<int>(results->size()));
for (System::Int32 index = 0; index < results->size(); index++)
{
auto nativeptr = results->operator[](index);
diff --git a/clicache/src/ResultSet.cpp b/clicache/src/ResultSet.cpp
index ce41ba4..2b24182 100644
--- a/clicache/src/ResultSet.cpp
+++ b/clicache/src/ResultSet.cpp
@@ -49,7 +49,7 @@ namespace Apache
{
try
{
- return m_nativeptr->get()->size( );
+ return static_cast<int>(m_nativeptr->get()->size( ));
}
finally
{
diff --git a/clicache/src/StructSet.cpp b/clicache/src/StructSet.cpp
index 4752223..b7b4a58 100644
--- a/clicache/src/StructSet.cpp
+++ b/clicache/src/StructSet.cpp
@@ -49,7 +49,7 @@ namespace Apache
{
try
{
- return m_nativeptr->get()->size( );
+ return static_cast<int>(m_nativeptr->get()->size( ));
}
finally
{
diff --git a/clicache/src/impl/AuthenticatedCache.cpp b/clicache/src/impl/AuthenticatedCache.cpp
index 683dc6a..f0603a3 100644
--- a/clicache/src/impl/AuthenticatedCache.cpp
+++ b/clicache/src/impl/AuthenticatedCache.cpp
@@ -128,7 +128,7 @@ namespace Apache
IPdxInstanceFactory^ AuthenticatedCache::CreatePdxInstanceFactory(String^ className)
{
- return gcnew Internal::PdxInstanceFactoryImpl(className, (Cache^)this);
+ return gcnew Internal::PdxInstanceFactoryImpl(className, nullptr);
}
} // namespace Client
} // namespace Geode
diff --git a/clicache/src/impl/CacheWriter.hpp b/clicache/src/impl/CacheWriter.hpp
index 149ed3b..0f19279 100644
--- a/clicache/src/impl/CacheWriter.hpp
+++ b/clicache/src/impl/CacheWriter.hpp
@@ -47,37 +47,37 @@ namespace Apache
m_writer = writer;
}
- virtual bool BeforeUpdate( Apache::Geode::Client::EntryEvent<Object^, Object^>^ ev ) override
+ bool BeforeUpdate( Apache::Geode::Client::EntryEvent<Object^, Object^>^ ev ) override
{
EntryEvent<TKey, TValue> gevent(ev->GetNative());
return m_writer->BeforeUpdate(%gevent);
}
- virtual bool BeforeCreate(Apache::Geode::Client::EntryEvent<Object^, Object^>^ ev) override
+ bool BeforeCreate(Apache::Geode::Client::EntryEvent<Object^, Object^>^ ev) override
{
EntryEvent<TKey, TValue> gevent(ev->GetNative());
return m_writer->BeforeCreate(%gevent);
}
- virtual bool BeforeDestroy(Apache::Geode::Client::EntryEvent<Object^, Object^>^ ev) override
+ bool BeforeDestroy(Apache::Geode::Client::EntryEvent<Object^, Object^>^ ev) override
{
EntryEvent<TKey, TValue> gevent(ev->GetNative());
return m_writer->BeforeDestroy(%gevent);
}
- virtual bool BeforeRegionClear( Apache::Geode::Client::RegionEvent<Object^, Object^>^ ev ) override
+ bool BeforeRegionClear( Apache::Geode::Client::RegionEvent<Object^, Object^>^ ev ) override
{
RegionEvent<TKey, TValue> gevent(ev->GetNative());
return m_writer->BeforeRegionClear(%gevent);
}
- virtual bool BeforeRegionDestroy(Apache::Geode::Client::RegionEvent<Object^, Object^>^ ev) override
+ bool BeforeRegionDestroy(Apache::Geode::Client::RegionEvent<Object^, Object^>^ ev) override
{
RegionEvent<TKey, TValue> gevent(ev->GetNative());
return m_writer->BeforeRegionDestroy(%gevent);
}
- virtual void Close(Apache::Geode::Client::Region<Object^, Object^>^ region) override
+ void Close(Apache::Geode::Client::IRegion<Object^, Object^>^ region) override
{
m_writer->Close((IRegion<TKey, TValue>^) region);
}
diff --git a/clicache/src/impl/FixedPartitionResolver.hpp b/clicache/src/impl/FixedPartitionResolver.hpp
index f9bf95e..c16fd6e 100644
--- a/clicache/src/impl/FixedPartitionResolver.hpp
+++ b/clicache/src/impl/FixedPartitionResolver.hpp
@@ -21,10 +21,10 @@
#include "../IFixedPartitionResolver.hpp"
#include "../Region.hpp"
#include "SafeConvert.hpp"
-#include "ManagedString.hpp"
+#include "../native_shared_ptr.hpp"
using namespace System;
-using namespace System::Collections::Generic;
+using namespace System::Collections::Concurrent;
using namespace System::Threading;
namespace Apache
@@ -50,14 +50,14 @@ namespace Apache
IPartitionResolver<TKey, TValue>^ m_resolver;
IFixedPartitionResolver<TKey, TValue>^ m_fixedResolver;
- Dictionary<String^, ManagedString^> ^m_strList;
+ ConcurrentDictionary<String^, native_shared_ptr<std::string>^>^ m_partitionNames;
public:
void SetPartitionResolver(IPartitionResolver<TKey, TValue>^ resolver)
{
m_resolver = resolver;
m_fixedResolver = dynamic_cast<IFixedPartitionResolver<TKey, TValue>^>(resolver);
- m_strList = gcnew Dictionary<String^, ManagedString^>();
+ m_partitionNames = gcnew ConcurrentDictionary<String^, native_shared_ptr<std::string>^>();
}
virtual std::shared_ptr<apache::geode::client::CacheableKey> getRoutingObject(const apache::geode::client::EntryEvent& ev)
@@ -81,23 +81,17 @@ namespace Apache
}
EntryEvent<TKey, TValue> gevent(&opDetails);
- String^ str = m_fixedResolver->GetPartitionName(%gevent);
- ManagedString ^mnStr = nullptr;
- try
+ String^ managedString = m_fixedResolver->GetPartitionName(%gevent);
+
+ native_shared_ptr<std::string>^ unmanagedString = nullptr;
+ if(!m_partitionNames->TryGetValue(managedString, unmanagedString))
{
- Monitor::Enter( m_strList );
- if(!m_strList->TryGetValue(str,mnStr))
- {
- mnStr= gcnew ManagedString(str);
- m_strList->Add(str,mnStr);
- }
- }
- finally
- {
- Monitor::Exit( m_strList );
+ unmanagedString = gcnew native_shared_ptr<std::string>(std::shared_ptr<std::string>(
+ new std::string(marshal_as<std::string>(managedString))));
+ m_partitionNames->TryAdd(managedString, unmanagedString);
}
- return mnStr->CharPtr;
+ return *(unmanagedString->get());
}
};
} // namespace Client
diff --git a/clicache/src/impl/GeodeDataInputStream.hpp b/clicache/src/impl/GeodeDataInputStream.hpp
index c75fb4b..138c542 100644
--- a/clicache/src/impl/GeodeDataInputStream.hpp
+++ b/clicache/src/impl/GeodeDataInputStream.hpp
@@ -98,10 +98,10 @@ namespace Apache
virtual int Read(array<Byte> ^ buffer, int offset, int count) override
{
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
- int bytesRemaining = m_maxSize - (int) m_buffer->BytesReadInternally;
- if(bytesRemaining == 0)
+ auto bytesRemaining = static_cast<int>(m_maxSize - m_buffer->BytesReadInternally);
+ if(bytesRemaining <= 0)
return bytesRemaining;
- int actual = bytesRemaining < count ? bytesRemaining : count;
+ auto actual = static_cast<int>(bytesRemaining < count ? bytesRemaining : count);
if (actual > 0)
{
/*
@@ -119,17 +119,17 @@ namespace Apache
virtual void Flush() override { /* do nothing */ }
- property System::UInt32 BytesRead
+ property size_t BytesRead
{
- System::UInt32 get()
+ size_t get()
{
return m_buffer->BytesReadInternally;
}
}
private:
- int m_position;
- int m_maxSize;
+ size_t m_position;
+ size_t m_maxSize;
DataInput ^ m_buffer;
};
} // namespace Client
diff --git a/clicache/src/impl/ManagedCacheableDelta.cpp b/clicache/src/impl/ManagedCacheableDelta.cpp
index fdebece..5546bb3 100644
--- a/clicache/src/impl/ManagedCacheableDelta.cpp
+++ b/clicache/src/impl/ManagedCacheableDelta.cpp
@@ -60,7 +60,7 @@ namespace apache
void ManagedCacheableDeltaGeneric::fromData(DataInput& input)
{
try {
- int pos = input.getBytesRead();
+ auto pos = input.getBytesRead();
auto cache = CacheResolver::Lookup(input.getCache());
Apache::Geode::Client::DataInput mg_input(&input, true, cache);
m_managedSerializableptr->FromData(%mg_input);
diff --git a/clicache/src/impl/ManagedCacheableKey.cpp b/clicache/src/impl/ManagedCacheableKey.cpp
index e86816a..74cdef9 100644
--- a/clicache/src/impl/ManagedCacheableKey.cpp
+++ b/clicache/src/impl/ManagedCacheableKey.cpp
@@ -63,7 +63,7 @@ namespace apache
void ManagedCacheableKeyGeneric::fromData(apache::geode::client::DataInput& input)
{
try {
- int pos = input.getBytesRead();
+ auto pos = input.getBytesRead();
auto cache = CacheResolver::Lookup(input.getCache());
Apache::Geode::Client::DataInput mg_input(&input, true, cache);
m_managedptr->FromData(%mg_input);
diff --git a/clicache/src/impl/ManagedFixedPartitionResolver.cpp b/clicache/src/impl/ManagedFixedPartitionResolver.cpp
index 7d9a7dc..f482f22 100644
--- a/clicache/src/impl/ManagedFixedPartitionResolver.cpp
+++ b/clicache/src/impl/ManagedFixedPartitionResolver.cpp
@@ -210,7 +210,7 @@ namespace apache
"loading managed library: "+ marshal_as<std::string>(ex->ToString());
throw IllegalArgumentException(ex_str);
}
- return NULL;
+ throw IllegalStateException("Unexpected exception.");
}
std::shared_ptr<CacheableKey> ManagedFixedPartitionResolverGeneric::getRoutingObject(const EntryEvent& key)
@@ -224,7 +224,7 @@ namespace apache
catch (System::Exception^ ex) {
Apache::Geode::Client::GeodeException::ThrowNative(ex);
}
- return nullptr;
+ throw IllegalStateException("Unexpected exception.");
}
const std::string& ManagedFixedPartitionResolverGeneric::getName()
@@ -238,7 +238,7 @@ namespace apache
catch (System::Exception^ ex) {
Apache::Geode::Client::GeodeException::ThrowNative(ex);
}
- return NULL;
+ throw IllegalStateException("Unexpected exception.");
}
const std::string& ManagedFixedPartitionResolverGeneric::getPartitionName(const EntryEvent& opDetails)
@@ -252,7 +252,7 @@ namespace apache
catch (System::Exception^ ex) {
Apache::Geode::Client::GeodeException::ThrowNative(ex);
}
- return NULL;
+ throw IllegalStateException("Unexpected exception.");
}
} // namespace client
diff --git a/clicache/src/impl/ManagedPartitionResolver.cpp b/clicache/src/impl/ManagedPartitionResolver.cpp
index 0900d4e..cd8425f 100644
--- a/clicache/src/impl/ManagedPartitionResolver.cpp
+++ b/clicache/src/impl/ManagedPartitionResolver.cpp
@@ -214,7 +214,7 @@ namespace apache
"loading managed library: " + marshal_as<std::string>(ex->ToString());
throw IllegalArgumentException(ex_str);
}
- return NULL;
+ throw IllegalStateException("Unexpected exception.");
}
std::shared_ptr<CacheableKey> ManagedPartitionResolverGeneric::getRoutingObject(const EntryEvent& key)
@@ -228,7 +228,7 @@ namespace apache
catch (System::Exception^ ex) {
Apache::Geode::Client::GeodeException::ThrowNative(ex);
}
- return nullptr;
+ throw IllegalStateException("Unexpected exception.");
}
const std::string& ManagedPartitionResolverGeneric::getName()
@@ -242,7 +242,7 @@ namespace apache
catch (System::Exception^ ex) {
Apache::Geode::Client::GeodeException::ThrowNative(ex);
}
- return NULL;
+ throw IllegalStateException("Unexpected exception.");
}
} // namespace client
diff --git a/clicache/src/impl/PdxLocalReader.cpp b/clicache/src/impl/PdxLocalReader.cpp
index e9773de..418a532 100644
--- a/clicache/src/impl/PdxLocalReader.cpp
+++ b/clicache/src/impl/PdxLocalReader.cpp
@@ -37,7 +37,7 @@ namespace Apache
{
//pdx header already read before this
m_startBuffer = m_dataInput->GetCursor();
- m_startPosition = m_dataInput->BytesRead;//number of bytes read in c++;
+ m_startPosition = static_cast<int32_t>(m_dataInput->BytesRead);//number of bytes read in c++;
//m_serializedLengthWithOffsets = PdxHelper::ReadInt32(m_startBuffer);
diff --git a/clicache/src/impl/PdxLocalWriter.cpp b/clicache/src/impl/PdxLocalWriter.cpp
index eb305d9..fa2ad4f 100644
--- a/clicache/src/impl/PdxLocalWriter.cpp
+++ b/clicache/src/impl/PdxLocalWriter.cpp
@@ -70,7 +70,7 @@ namespace Apache
//start position, this should start of c++ dataoutput buffer and then use bufferlen
m_startPosition = m_dataOutput->GetStartBufferPosition();
//TODO: need to use this carefully
- m_startPositionOffset = m_dataOutput->BufferLength;//data has been write
+ m_startPositionOffset = static_cast<int>(m_dataOutput->BufferLength);//data has been write
m_dataOutput->AdvanceCursor(PdxHelper::PdxHeader);//to write pdx header
}
@@ -78,7 +78,7 @@ namespace Apache
{
//bufferlength gives lenght which has been writeen to unmanged Dataoutput
//m_startPositionOffset: from where pdx header length starts
- int bufferLen = m_dataOutput->BufferLength - m_startPositionOffset;
+ int bufferLen = static_cast<int>(m_dataOutput->BufferLength - m_startPositionOffset);
int offset = bufferLen - PdxHelper::PdxHeader/* this needs to subtract*/;
m_offsets[m_currentOffsetIndex++] = offset;
@@ -116,7 +116,7 @@ namespace Apache
Int32 PdxLocalWriter::calculateLenWithOffsets()
{
//int bufferLen = m_dataOutput->GetCursorPdx();
- int bufferLen = m_dataOutput->BufferLength - m_startPositionOffset;
+ int bufferLen = static_cast<int>(m_dataOutput->BufferLength - m_startPositionOffset);
Int32 totalOffsets = 0;
if(m_offsets->Length > 0)
totalOffsets = m_offsets->Length -1;//for first var len no need to append offset
diff --git a/clicache/src/impl/PdxManagedCacheableKey.cpp b/clicache/src/impl/PdxManagedCacheableKey.cpp
index 458ec19..93b6f7e 100644
--- a/clicache/src/impl/PdxManagedCacheableKey.cpp
+++ b/clicache/src/impl/PdxManagedCacheableKey.cpp
@@ -66,7 +66,7 @@ namespace apache
void PdxManagedCacheableKey::fromData(apache::geode::client::DataInput& input)
{
try {
- int pos = input.getBytesRead();
+ auto pos = input.getBytesRead();
auto cache = CacheResolver::Lookup(input.getCache());
Apache::Geode::Client::DataInput mg_input(&input, true, cache);
//m_managedptr = m_managedptr->FromData( %mg_input );
diff --git a/clicache/src/impl/PdxWriterWithTypeCollector.cpp b/clicache/src/impl/PdxWriterWithTypeCollector.cpp
index 6b0264a..78926e8 100644
--- a/clicache/src/impl/PdxWriterWithTypeCollector.cpp
+++ b/clicache/src/impl/PdxWriterWithTypeCollector.cpp
@@ -45,7 +45,7 @@ namespace Apache
Int32 PdxWriterWithTypeCollector::calculateLenWithOffsets()
{
- int bufferLen = m_dataOutput->BufferLength - m_startPositionOffset;
+ int bufferLen = static_cast<int>(m_dataOutput->BufferLength - m_startPositionOffset);
Int32 totalOffsets = 0;
if (m_offsets->Count > 0)
totalOffsets = m_offsets->Count - 1;//for first var len no need to append offset
@@ -62,7 +62,7 @@ namespace Apache
void PdxWriterWithTypeCollector::AddOffset()
{
- int bufferLen = m_dataOutput->BufferLength - m_startPositionOffset;
+ int bufferLen = static_cast<int>(m_dataOutput->BufferLength - m_startPositionOffset);
int offset = bufferLen - PdxHelper::PdxHeader;
m_offsets->Add(offset);
diff --git a/clicache/src/native_conditional_unique_ptr.hpp b/clicache/src/native_conditional_unique_ptr.hpp
index b0612c5..8a4b22f 100644
--- a/clicache/src/native_conditional_unique_ptr.hpp
+++ b/clicache/src/native_conditional_unique_ptr.hpp
@@ -56,8 +56,8 @@ namespace Apache
return __nullptr == owned_ptr ? unowned_ptr : owned_ptr->get();
}
- inline _T& operator*() {
- return *get();
+ static inline _T& operator*(native_conditional_unique_ptr<_T>^ t) {
+ return *(t->get());
}
};
}
diff --git a/clicache/test/CMakeLists.txt b/clicache/test/CMakeLists.txt
index 989ea81..21b819a 100644
--- a/clicache/test/CMakeLists.txt
+++ b/clicache/test/CMakeLists.txt
@@ -55,6 +55,7 @@ target_link_libraries(${PROJECT_NAME}
PRIVATE
c++cli
c++11
+ _WarningsAsError
)
string(REPLACE "/RTC1" "" CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}")
diff --git a/cppcache/CMakeLists.txt b/cppcache/CMakeLists.txt
index 6be25d5..e429914 100644
--- a/cppcache/CMakeLists.txt
+++ b/cppcache/CMakeLists.txt
@@ -85,14 +85,25 @@ target_link_libraries(_apache-geode INTERFACE
boost
libxml2
)
+
target_compile_definitions(_apache-geode INTERFACE
# TODO replace BUILD_CPPCACHE with built-in _DLL
$<BUILD_INTERFACE:BUILD_CPPCACHE>
)
+
+if (USE_PCH)
+ # TODO figure out why PCH causes these warnings
+ # Ignore warnings resulting from using PCH
+ target_compile_options(_apache-geode INTERFACE
+ /wd4251 /wd4103 /wd4275 /wd4250
+ )
+endif()
+
target_include_directories(_apache-geode INTERFACE
$<BUILD_INTERFACE:${COMMON_INCLUDE_DIR}>
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>
)
+
add_dependencies(_apache-geode version-header)
install(DIRECTORY ${COMMON_INCLUDE_DIR} DESTINATION .)
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/integration-test/CMakeLists.txt b/cppcache/integration-test/CMakeLists.txt
index 226d07d..37cfd37 100644
--- a/cppcache/integration-test/CMakeLists.txt
+++ b/cppcache/integration-test/CMakeLists.txt
@@ -21,6 +21,7 @@ add_library(${TEST_UTILS_LIB} STATIC fw_dunit.cpp BBNamingContext.cpp CacheHelpe
target_link_libraries(${TEST_UTILS_LIB}
PRIVATE
ACE
+ _WarningsAsError
PUBLIC
apache-geode
fwk
@@ -38,6 +39,7 @@ add_library(unit_test_callbacks SHARED LibraryCallbacks.cpp)
target_link_libraries(unit_test_callbacks
PRIVATE
ACE
+ _WarningsAsError
PUBLIC
apache-geode
)
@@ -79,6 +81,7 @@ foreach(FILE ${SOURCES})
PRIVATE
ACE
${TEST_UTILS_LIB}
+ _WarningsAsError
PUBLIC
apache-geode
testobject
diff --git a/cppcache/integration-test/ThinClientDistOps.hpp b/cppcache/integration-test/ThinClientDistOps.hpp
index b4eca6e..0322f31 100644
--- a/cppcache/integration-test/ThinClientDistOps.hpp
+++ b/cppcache/integration-test/ThinClientDistOps.hpp
@@ -598,13 +598,13 @@ DUNIT_TASK_DEFINITION(CLIENT1, VerifyUpdateLocatorListThread)
dunit::sleep(sleepSeconds * 1000);
auto pptr = getHelper()->getCache()->getPoolManager().find("__TESTPOOL1_");
- int updateIntervalSeconds =
+ auto updateIntervalSeconds =
pptr->getUpdateLocatorListInterval().count() / 1000;
int numLocatorListUpdates =
CacheHelper::getNumLocatorListUpdates("Querying locator list at:");
- int numExpectedLocatorListUpdates = 0;
+ decltype(updateIntervalSeconds) numExpectedLocatorListUpdates = 0;
if (updateIntervalSeconds > 0) {
numExpectedLocatorListUpdates = sleepSeconds / updateIntervalSeconds;
}
diff --git a/cppcache/integration-test/testDataOutput.cpp b/cppcache/integration-test/testDataOutput.cpp
index 11e6acf..ef617b9 100644
--- a/cppcache/integration-test/testDataOutput.cpp
+++ b/cppcache/integration-test/testDataOutput.cpp
@@ -31,21 +31,21 @@
using namespace apache::geode::client;
-void dumpnbytes(const uint8_t* buf, uint32_t length) {
- for (uint32_t i = 0; i < length; i++) {
+void dumpnbytes(const uint8_t* buf, size_t length) {
+ for (size_t i = 0; i < length; i++) {
std::cout << "buf[" << i << "] = " << std::setfill('0') << std::setw(2)
<< std::hex << (static_cast<int16_t>(buf[i]) & 0xff) << std::dec
<< " " << static_cast<char>(buf[i]) << std::endl;
}
}
-void dumpnshorts(const uint16_t* buf, uint32_t length) {
- for (uint32_t i = 0; i < length; i++) {
+void dumpnshorts(const uint16_t* buf, size_t length) {
+ for (size_t i = 0; i < length; i++) {
std::cout << "buf[" << i << "] = " << std::hex
<< static_cast<uint16_t>(buf[i]) << std::dec << std::endl;
}
}
-void dumpnwords(const uint32_t* buf, uint32_t length) {
- for (uint32_t i = 0; i < length; i++) {
+void dumpnwords(const uint32_t* buf, size_t length) {
+ for (size_t i = 0; i < length; i++) {
std::cout << "buf[" << i << "] = " << std::hex
<< static_cast<uint32_t>(buf[i]) << std::dec << std::endl;
}
diff --git a/cppcache/integration-test/testThinClientCacheableStringArray.cpp b/cppcache/integration-test/testThinClientCacheableStringArray.cpp
index 62eaed2..725ac55 100644
--- a/cppcache/integration-test/testThinClientCacheableStringArray.cpp
+++ b/cppcache/integration-test/testThinClientCacheableStringArray.cpp
@@ -77,7 +77,8 @@ DUNIT_TASK(CLIENT1, StepOne)
auto regptr = getHelper()->createPooledRegion(
_regionNames[0], USE_ACK, locHostPort, "__TEST_POOL1__", true, true);
- auto subregPtr = regptr->createSubregion(_regionNames[1], regptr->getAttributes());
+ auto subregPtr =
+ regptr->createSubregion(_regionNames[1], regptr->getAttributes());
auto&& qh = &QueryHelper::getHelper();
std::vector<std::shared_ptr<CacheableString>> cstr{
@@ -103,8 +104,8 @@ DUNIT_TASK(CLIENT1, StepThree)
SelectResultsIterator iter = results->getIterator();
char buf[100];
- int count = results->size();
- sprintf(buf, "results size=%d", count);
+ auto count = results->size();
+ sprintf(buf, "results size=%zd", count);
LOG(buf);
while (iter.hasNext()) {
count--;
@@ -131,12 +132,11 @@ DUNIT_TASK(CLIENT1, StepThree)
}
}
}
- sprintf(buf, "results last count=%d", count);
+ sprintf(buf, "results last count=%zd", count);
LOG(buf);
} catch (IllegalStateException& ise) {
char isemsg[500] = {0};
- ACE_OS::snprintf(isemsg, 499, "IllegalStateException: %s",
- ise.what());
+ ACE_OS::snprintf(isemsg, 499, "IllegalStateException: %s", ise.what());
LOG(isemsg);
FAIL(isemsg);
} catch (Exception& excp) {
diff --git a/cppcache/integration-test/testThinClientCqDurable.cpp b/cppcache/integration-test/testThinClientCqDurable.cpp
index c4528ba..0c437a1 100644
--- a/cppcache/integration-test/testThinClientCqDurable.cpp
+++ b/cppcache/integration-test/testThinClientCqDurable.cpp
@@ -177,7 +177,8 @@ void stepOne() {
initClientWithId(0);
createRegionForCQ(regionNamesCq[0], USE_ACK, true);
auto regptr = getHelper()->getRegion(regionNamesCq[0]);
- auto subregPtr = regptr->createSubregion(regionNamesCq[1], regptr->getAttributes());
+ auto subregPtr =
+ regptr->createSubregion(regionNamesCq[1], regptr->getAttributes());
LOG("StepOne complete.");
}
@@ -199,7 +200,8 @@ void RunDurableCqClient() {
LOGINFO("Created the Geode Cache Programmatically");
- auto regionFactory = cachePtr->createRegionFactory(RegionShortcut::CACHING_PROXY);
+ auto regionFactory =
+ cachePtr->createRegionFactory(RegionShortcut::CACHING_PROXY);
// Create the Region Programmatically.
auto regionPtr = regionFactory.create("DistRegionAck");
@@ -339,7 +341,8 @@ void stepOne2() {
initClientWithId(1);
createRegionForCQ(regionNamesCq[0], USE_ACK, true);
auto regptr = getHelper()->getRegion(regionNamesCq[0]);
- auto subregPtr = regptr->createSubregion(regionNamesCq[1], regptr->getAttributes());
+ auto subregPtr =
+ regptr->createSubregion(regionNamesCq[1], regptr->getAttributes());
LOG("StepOne2 complete.");
}
@@ -395,8 +398,8 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepThree)
LOG("EXECUTE 1 STOP");
SelectResultsIterator iter = results->getIterator();
char buf[100];
- int count = results->size();
- sprintf(buf, "results size=%d", count);
+ auto count = results->size();
+ sprintf(buf, "results size=%zd", count);
LOG(buf);
} catch (const Exception& excp) {
std::string logmsg = "";
@@ -460,10 +463,10 @@ void client1Up() {
QueryHelper::getHelper();
std::shared_ptr<QueryService> qs = getHelper()
- ->getCache()
- ->getPoolManager()
- .find(regionNamesCq[0])
- ->getQueryService();
+ ->getCache()
+ ->getPoolManager()
+ .find(regionNamesCq[0])
+ ->getQueryService();
CqAttributesFactory cqFac;
auto cqLstner = std::make_shared<MyCqListener>();
cqFac.addCqListener(cqLstner);
diff --git a/cppcache/integration-test/testThinClientCqHAFailover.cpp b/cppcache/integration-test/testThinClientCqHAFailover.cpp
index f3addff..5dd9c32 100644
--- a/cppcache/integration-test/testThinClientCqHAFailover.cpp
+++ b/cppcache/integration-test/testThinClientCqHAFailover.cpp
@@ -168,7 +168,8 @@ void stepOne() {
createRegionForCQ(regionNamesCq[0], USE_ACK, true, 1);
auto regptr = getHelper()->getRegion(regionNamesCq[0]);
- auto subregPtr = regptr->createSubregion(regionNamesCq[1], regptr->getAttributes());
+ auto subregPtr =
+ regptr->createSubregion(regionNamesCq[1], regptr->getAttributes());
QueryHelper* qh = &QueryHelper::getHelper();
@@ -186,7 +187,8 @@ void stepOne2() {
initClientCq(1);
createRegionForCQ(regionNamesCq[0], USE_ACK, true, 1);
auto regptr = getHelper()->getRegion(regionNamesCq[0]);
- auto subregPtr = regptr->createSubregion(regionNamesCq[1], regptr->getAttributes());
+ auto subregPtr =
+ regptr->createSubregion(regionNamesCq[1], regptr->getAttributes());
LOG("StepOne2 complete.");
}
@@ -220,8 +222,8 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepThree)
SelectResultsIterator iter = results->getIterator();
char buf[100];
- int count = results->size();
- sprintf(buf, "results size=%d", count);
+ auto count = results->size();
+ sprintf(buf, "results size=%zd", count);
LOG(buf);
while (iter.hasNext()) {
count--;
@@ -249,14 +251,13 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepThree)
}
}
}
- sprintf(buf, "results last count=%d", count);
+ sprintf(buf, "results last count=%zd", count);
LOG(buf);
// ASSERT( count==0, "results traversal count incorrect!" );
SLEEP(15000);
} catch (IllegalStateException& ise) {
char isemsg[500] = {0};
- ACE_OS::snprintf(isemsg, 499, "IllegalStateException: %s",
- ise.what());
+ ACE_OS::snprintf(isemsg, 499, "IllegalStateException: %s", ise.what());
LOG(isemsg);
FAIL(isemsg);
} catch (Exception& excp) {
diff --git a/cppcache/integration-test/testThinClientCqIR.cpp b/cppcache/integration-test/testThinClientCqIR.cpp
index 25fdd60..f7199d6 100644
--- a/cppcache/integration-test/testThinClientCqIR.cpp
+++ b/cppcache/integration-test/testThinClientCqIR.cpp
@@ -97,7 +97,8 @@ DUNIT_TASK_DEFINITION(CLIENT1, CreateClient1Regions)
createRegionForCQ(regionNamesCq[0], USE_ACK, true);
createRegionForCQ(regionNamesCq[2], USE_ACK, true);
auto regptr = getHelper()->getRegion(regionNamesCq[0]);
- auto subregPtr = regptr->createSubregion(regionNamesCq[1], regptr->getAttributes());
+ auto subregPtr =
+ regptr->createSubregion(regionNamesCq[1], regptr->getAttributes());
LOG("CreateClient1Regions complete.");
}
@@ -108,7 +109,8 @@ DUNIT_TASK_DEFINITION(CLIENT2, CreateClient2Regions)
initClientCq(true);
createRegionForCQ(regionNamesCq[0], USE_ACK, true);
auto regptr = getHelper()->getRegion(regionNamesCq[0]);
- auto subregPtr = regptr->createSubregion(regionNamesCq[1], regptr->getAttributes());
+ auto subregPtr =
+ regptr->createSubregion(regionNamesCq[1], regptr->getAttributes());
LOG("CreateClient2Regions complete.");
}
@@ -181,8 +183,8 @@ DUNIT_TASK_DEFINITION(CLIENT1, QueryData)
auto iter = results->getIterator();
char buf[100];
- int count = results->size();
- sprintf(buf, "results size=%d", count);
+ auto count = results->size();
+ sprintf(buf, "results size=%zd", count);
LOG(buf);
ASSERT(count > 0, "count should be > 0");
while (iter.hasNext()) {
@@ -216,7 +218,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, QueryData)
printf(" query pulled bad object\n");
}
}
- sprintf(buf, "results last count=%d", count);
+ sprintf(buf, "results last count=%zd", count);
LOG(buf);
qry = qs->newCq("MyCq2", "select * from /Portfolios2", cqAttr);
@@ -228,7 +230,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, QueryData)
auto iter2 = results->getIterator();
count = results->size();
- sprintf(buf, "results2 size=%d", count);
+ sprintf(buf, "results2 size=%zd", count);
LOG(buf);
ASSERT(count > 0, "count should be > 0");
while (iter2.hasNext()) {
@@ -262,7 +264,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, QueryData)
printf(" query pulled bad object\n");
}
}
- sprintf(buf, "results last count=%d", count);
+ sprintf(buf, "results last count=%zd", count);
LOG(buf);
{
diff --git a/cppcache/integration-test/testThinClientHAQueryFailover.cpp b/cppcache/integration-test/testThinClientHAQueryFailover.cpp
index 6c4a82c..d5e61b8 100644
--- a/cppcache/integration-test/testThinClientHAQueryFailover.cpp
+++ b/cppcache/integration-test/testThinClientHAQueryFailover.cpp
@@ -234,10 +234,10 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepThree)
// SLEEP(15000);
}
- int resultsize = results->size();
+ auto resultsize = results->size();
if (i % 100 == 0) {
- printf("Iteration upto %d done, result size is %d\n", i, resultsize);
+ printf("Iteration upto %d done, result size is %zd\n", i, resultsize);
}
// ASSERT(resultsize==4, "Failed verification");
@@ -253,8 +253,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepThree)
kst->stop();
} catch (IllegalStateException& ise) {
char isemsg[500] = {0};
- ACE_OS::snprintf(isemsg, 499, "IllegalStateException: %s",
- ise.what());
+ ACE_OS::snprintf(isemsg, 499, "IllegalStateException: %s", ise.what());
LOG(isemsg);
FAIL(isemsg);
} catch (Exception& excp) {
diff --git a/cppcache/integration-test/testThinClientLocatorFailover.cpp b/cppcache/integration-test/testThinClientLocatorFailover.cpp
index a60d8cd..8179398 100644
--- a/cppcache/integration-test/testThinClientLocatorFailover.cpp
+++ b/cppcache/integration-test/testThinClientLocatorFailover.cpp
@@ -213,14 +213,15 @@ DUNIT_TASK(CLIENT1, AgainAgainFailoverC1_All)
FAIL(
"No locator exception should "
"have been raised");
- } catch (const NoAvailableLocatorsException& ex) {
+ } catch (const NoAvailableLocatorsException&) {
LOG("Caught expected NoAvailableLocatorsException.");
} catch (...) {
- FAIL("NotConnectedException "
- "with cause "
- "NoAvailableLocatorsExcepti"
- "on should have been "
- "raised");
+ FAIL(
+ "NotConnectedException "
+ "with cause "
+ "NoAvailableLocatorsExcepti"
+ "on should have been "
+ "raised");
}
}
END_TASK(AgainAgainFailoverC1_All)
diff --git a/cppcache/integration-test/testThinClientPdxInstance.cpp b/cppcache/integration-test/testThinClientPdxInstance.cpp
index 77dba6f..c4699e5 100644
--- a/cppcache/integration-test/testThinClientPdxInstance.cpp
+++ b/cppcache/integration-test/testThinClientPdxInstance.cpp
@@ -64,10 +64,11 @@ bool genericValCompare(T1 value1, T2 value2) /*const*/
return true;
}
-template <typename T1, typename T2>
-bool genericCompare(std::vector<T1> value1, std::vector<T2> value2, int length) /*const*/
+template <typename T1, typename T2, typename L>
+bool genericCompare(std::vector<T1> value1, std::vector<T2> value2,
+ L length) /*const*/
{
- int i = 0;
+ L i = 0;
while (i < length) {
if (value1[i] != value2[i]) {
return false;
@@ -232,7 +233,9 @@ DUNIT_TASK_DEFINITION(CLIENT1, putPdxWithIdentityField)
LOG("putPdxWithIdentityField started ");
try {
- auto serializationRegistry = CacheRegionHelper::getCacheImpl(cacheHelper->getCache().get())->getSerializationRegistry();
+ auto serializationRegistry =
+ CacheRegionHelper::getCacheImpl(cacheHelper->getCache().get())
+ ->getSerializationRegistry();
serializationRegistry->addPdxType(SerializePdx::createDeserializable);
LOG("SerializePdx Registered Successfully....");
} catch (apache::geode::client::IllegalStateException& /* ex*/) {
@@ -256,7 +259,9 @@ DUNIT_TASK_DEFINITION(CLIENT1, putCacheableObjectArrayWithPdxFields)
LOG("putCacheableObjectArrayWithPdxFields started ");
try {
- auto serializationRegistry = CacheRegionHelper::getCacheImpl(cacheHelper->getCache().get())->getSerializationRegistry();
+ auto serializationRegistry =
+ CacheRegionHelper::getCacheImpl(cacheHelper->getCache().get())
+ ->getSerializationRegistry();
serializationRegistry->addPdxType(Address::createDeserializable);
LOG("Address Registered Successfully....");
} catch (apache::geode::client::IllegalStateException& /* ex*/) {
@@ -280,10 +285,14 @@ DUNIT_TASK_DEFINITION(CLIENT1, putCacheableObjectArrayWithPdxFields)
std::shared_ptr<Address>(new Address(5, "street4", "city4")));
objectArray->push_back(
std::shared_ptr<Address>(new Address(6, "street5", "city5")));
- objectArray->push_back(std::shared_ptr<Address>(new Address(7, "street6", "city6")));
- objectArray->push_back(std::shared_ptr<Address>(new Address(8, "street7", "city7")));
- objectArray->push_back(std::shared_ptr<Address>(new Address(9, "street8", "city8")));
- objectArray->push_back(std::shared_ptr<Address>(new Address(10, "street9", "city9")));
+ objectArray->push_back(
+ std::shared_ptr<Address>(new Address(7, "street6", "city6")));
+ objectArray->push_back(
+ std::shared_ptr<Address>(new Address(8, "street7", "city7")));
+ objectArray->push_back(
+ std::shared_ptr<Address>(new Address(9, "street8", "city8")));
+ objectArray->push_back(
+ std::shared_ptr<Address>(new Address(10, "street9", "city9")));
// PUT Operation
rptr->put(CacheableInt32::create(100), objectArray);
@@ -298,7 +307,9 @@ DUNIT_TASK_DEFINITION(CLIENT2, verifyPdxIdentityField)
LOG("verifyPdxIdentityField started ");
try {
- auto serializationRegistry = CacheRegionHelper::getCacheImpl(cacheHelper->getCache().get())->getSerializationRegistry();
+ auto serializationRegistry =
+ CacheRegionHelper::getCacheImpl(cacheHelper->getCache().get())
+ ->getSerializationRegistry();
serializationRegistry->addPdxType(SerializePdx::createDeserializable);
LOG("SerializePdx Registered Successfully....");
} catch (apache::geode::client::IllegalStateException& /* ex*/) {
@@ -357,7 +368,8 @@ DUNIT_TASK_DEFINITION(CLIENT2, verifyPdxIdentityField)
ASSERT(pi->hasField("i3") == false,
"There is no field i3 in SerializePdx1's PdxInstance stream");
- std::shared_ptr<CacheableKey> javaPdxHCKey = CacheableKey::create("javaPdxHC");
+ std::shared_ptr<CacheableKey> javaPdxHCKey =
+ CacheableKey::create("javaPdxHC");
auto pIPtr2 = std::dynamic_pointer_cast<Cacheable>(rptr->get(javaPdxHCKey));
LOG("javaPdxHCKey get done");
CacheableInt32* val = dynamic_cast<CacheableInt32*>(pIPtr2.get());
@@ -417,7 +429,9 @@ DUNIT_TASK_DEFINITION(CLIENT2, verifyCacheableObjectArrayWithPdxField)
LOG("verifyCacheableObjectArrayWithPdxField started ");
try {
- auto serializationRegistry = CacheRegionHelper::getCacheImpl(cacheHelper->getCache().get())->getSerializationRegistry();
+ auto serializationRegistry =
+ CacheRegionHelper::getCacheImpl(cacheHelper->getCache().get())
+ ->getSerializationRegistry();
serializationRegistry->addPdxType(Address::createDeserializable);
LOG("Address Registered Successfully....");
} catch (apache::geode::client::IllegalStateException& /* ex*/) {
@@ -492,7 +506,8 @@ DUNIT_TASK_DEFINITION(CLIENT2, verifyPdxNullIdentityFieldHC)
rptr->get(CacheableInt32::create(2)));
LOG("PdxInstancePtr get complete");
- std::shared_ptr<CacheableKey> javaPdxHCKey = CacheableKey::create("javaPdxHC");
+ std::shared_ptr<CacheableKey> javaPdxHCKey =
+ CacheableKey::create("javaPdxHC");
auto pIPtr2 = std::dynamic_pointer_cast<Cacheable>(rptr->get(javaPdxHCKey));
LOG("javaPdxHCKey get done");
CacheableInt32* val = dynamic_cast<CacheableInt32*>(pIPtr2.get());
@@ -531,7 +546,9 @@ END_TASK_DEFINITION
DUNIT_TASK_DEFINITION(CLIENT1, pdxPut)
{
LOG("pdxPut started ");
- auto serializationRegistry = CacheRegionHelper::getCacheImpl(cacheHelper->getCache().get())->getSerializationRegistry();
+ auto serializationRegistry =
+ CacheRegionHelper::getCacheImpl(cacheHelper->getCache().get())
+ ->getSerializationRegistry();
try {
serializationRegistry->addPdxType(
PdxTests::PdxType::createDeserializable);
@@ -543,9 +560,9 @@ DUNIT_TASK_DEFINITION(CLIENT1, pdxPut)
// Creating object of type PdxObject
auto pdxobj = std::make_shared<PdxTests::PdxType>();
- auto keyport = CacheableKey::create("pdxput");
- auto keyport1 = CacheableKey::create("pdxput2");
- auto rptr = getHelper()->getRegion(regionNames[0]);
+ auto keyport = CacheableKey::create("pdxput");
+ auto keyport1 = CacheableKey::create("pdxput2");
+ auto rptr = getHelper()->getRegion(regionNames[0]);
// PUT Operation
rptr->put(keyport, pdxobj);
@@ -615,9 +632,12 @@ END_TASK_DEFINITION
DUNIT_TASK_DEFINITION(CLIENT2, getObject)
{
LOG("getObject started ");
- auto serializationRegistry = CacheRegionHelper::getCacheImpl(cacheHelper->getCache().get())->getSerializationRegistry();
+ auto serializationRegistry =
+ CacheRegionHelper::getCacheImpl(cacheHelper->getCache().get())
+ ->getSerializationRegistry();
try {
- serializationRegistry->addPdxType(PdxTests::PdxType::createDeserializable);
+ serializationRegistry->addPdxType(
+ PdxTests::PdxType::createDeserializable);
LOG("PdxObject Registered Successfully....");
} catch (apache::geode::client::IllegalStateException& /* ex*/) {
LOG("PdxObject IllegalStateException");
@@ -747,8 +767,11 @@ DUNIT_TASK_DEFINITION(CLIENT2, verifyPdxInstanceEquals)
LOG("Task verifyPdxInstanceEquals started.");
try {
- auto serializationRegistry = CacheRegionHelper::getCacheImpl(cacheHelper->getCache().get())->getSerializationRegistry();
- serializationRegistry->addPdxType(PdxTests::PdxType::createDeserializable);
+ auto serializationRegistry =
+ CacheRegionHelper::getCacheImpl(cacheHelper->getCache().get())
+ ->getSerializationRegistry();
+ serializationRegistry->addPdxType(
+ PdxTests::PdxType::createDeserializable);
LOG("PdxObject Registered Successfully....");
} catch (apache::geode::client::IllegalStateException& /* ex*/) {
LOG("PdxObject IllegalStateException");
@@ -810,9 +833,12 @@ END_TASK_DEFINITION
DUNIT_TASK_DEFINITION(CLIENT2, accessPdxInstance)
{
LOG("accessPdxInstance started ");
- auto serializationRegistry = CacheRegionHelper::getCacheImpl(cacheHelper->getCache().get())->getSerializationRegistry();
+ auto serializationRegistry =
+ CacheRegionHelper::getCacheImpl(cacheHelper->getCache().get())
+ ->getSerializationRegistry();
try {
- serializationRegistry->addPdxType(PdxTests::PdxType::createDeserializable);
+ serializationRegistry->addPdxType(
+ PdxTests::PdxType::createDeserializable);
LOG("PdxObject Registered Successfully....");
} catch (apache::geode::client::IllegalStateException& /* ex*/) {
LOG("PdxObject IllegalStateException");
@@ -936,7 +962,7 @@ DUNIT_TASK_DEFINITION(CLIENT2, accessPdxInstance)
"Type Value BYTE_ARRAY Mismatch");
auto boolArray = pIPtr->getBooleanArrayField("m_boolArray");
- int32_t boolArrayLength = boolArray.size();
+ auto boolArrayLength = boolArray.size();
ASSERT(genericValCompare(pdxobjPtr->getBoolArrayLength(),
boolArrayLength) == true,
"boolArrayLength should be equal");
@@ -947,7 +973,7 @@ DUNIT_TASK_DEFINITION(CLIENT2, accessPdxInstance)
"Type Value BOOLEAN_ARRAY Mismatch");
auto shortArray = pIPtr->getShortArrayField("m_int16Array");
- int32_t shortArrayLength = shortArray.size();
+ auto shortArrayLength = shortArray.size();
ASSERT(genericValCompare(pdxobjPtr->getShortArrayLength(),
shortArrayLength) == true,
"shortArrayLength should be equal");
@@ -969,7 +995,7 @@ DUNIT_TASK_DEFINITION(CLIENT2, accessPdxInstance)
"Type Value SHORT_ARRAY Mismatch");
auto intArray = pIPtr->getIntArrayField("m_int32Array");
- int32_t intArrayLength = intArray.size();
+ auto intArrayLength = intArray.size();
ASSERT(genericValCompare(pdxobjPtr->getIntArrayLength(), intArrayLength) ==
true,
"intArrayLength should be equal");
@@ -990,7 +1016,7 @@ DUNIT_TASK_DEFINITION(CLIENT2, accessPdxInstance)
"Type Value INT_ARRAY Mismatch");
auto longArray = pIPtr->getLongArrayField("m_longArray");
- int32_t longArrayLength = longArray.size();
+ auto longArrayLength = longArray.size();
ASSERT(genericValCompare(pdxobjPtr->getLongArrayLength(),
longArrayLength) == true,
"longArrayLength should be equal");
@@ -1012,7 +1038,7 @@ DUNIT_TASK_DEFINITION(CLIENT2, accessPdxInstance)
"Type Value LONG_ARRAY Mismatch");
auto doubleArray = pIPtr->getDoubleArrayField("m_doubleArray");
- int32_t doubleArrayLength = doubleArray.size();
+ auto doubleArrayLength = doubleArray.size();
ASSERT(genericValCompare(pdxobjPtr->getDoubleArrayLength(),
doubleArrayLength) == true,
"doubleArrayLength should be equal");
@@ -1023,7 +1049,7 @@ DUNIT_TASK_DEFINITION(CLIENT2, accessPdxInstance)
"Type Value DOUBLE_ARRAY Mismatch");
auto floatArray = pIPtr->getFloatArrayField("m_floatArray");
- int32_t floatArrayLength = floatArray.size();
+ auto floatArrayLength = floatArray.size();
ASSERT(genericValCompare(pdxobjPtr->getFloatArrayLength(),
floatArrayLength) == true,
"floatArrayLength should be equal");
@@ -1375,9 +1401,9 @@ DUNIT_TASK_DEFINITION(CLIENT2, modifyPdxInstance)
"IllegalStateException");
}
-
- std::vector<bool> setBoolArray{true, false, true, false, true, true, false, true};
- int arrayLen = setBoolArray.size();
+ std::vector<bool> setBoolArray{true, false, true, false,
+ true, true, false, true};
+ auto arrayLen = setBoolArray.size();
wpiPtr->setField("m_boolArray", setBoolArray);
rptr->put(keyport, wpiPtr);
newPiPtr = std::dynamic_pointer_cast<PdxInstance>(rptr->get(keyport));
@@ -1812,7 +1838,8 @@ DUNIT_TASK_DEFINITION(CLIENT2, modifyPdxInstance)
wpiPtr = pIPtr->createWriter();
try {
- wpiPtr->setField("m_byteByteArray", (std::shared_ptr<Cacheable>)linkedhashset);
+ wpiPtr->setField("m_byteByteArray",
+ (std::shared_ptr<Cacheable>)linkedhashset);
FAIL(
"setField on m_byteByteArray with linkedhashset value should throw "
"expected IllegalStateException");
@@ -1956,8 +1983,9 @@ DUNIT_TASK_DEFINITION(CLIENT2, modifyPdxInstanceAndCheckLocally)
ASSERT((*pIPtr.get() == *newPiPtr.get()) == false,
"PdxInstance should not be equal");
- std::vector<bool> setBoolArray{true, false, true, false, true, true, false, true};
- int arrayLen = setBoolArray.size();
+ std::vector<bool> setBoolArray{true, false, true, false,
+ true, true, false, true};
+ auto arrayLen = setBoolArray.size();
wpiPtr->setField("m_boolArray", setBoolArray);
rptr->put(keyport, wpiPtr);
newPiPtr = std::dynamic_pointer_cast<PdxInstance>(rptr->get(keyport));
@@ -2194,7 +2222,6 @@ DUNIT_TASK_DEFINITION(CLIENT2, modifyPdxInstanceAndCheckLocally)
ASSERT((*pIPtr.get() == *newPiPtr.get()) == false,
"PdxInstance should not be equal");
-
LOG("modifyPdxInstanceAndCheckLocally complete.");
}
END_TASK_DEFINITION
@@ -2202,7 +2229,9 @@ END_TASK_DEFINITION
DUNIT_TASK_DEFINITION(CLIENT1, pdxIFPutGetTest)
{
LOG("pdxIFPutGetTest started ");
- auto serializationRegistry = CacheRegionHelper::getCacheImpl(cacheHelper->getCache().get())->getSerializationRegistry();
+ auto serializationRegistry =
+ CacheRegionHelper::getCacheImpl(cacheHelper->getCache().get())
+ ->getSerializationRegistry();
try {
serializationRegistry->addPdxType(Address::createDeserializable);
LOG("Address Registered Successfully....");
@@ -2211,7 +2240,8 @@ DUNIT_TASK_DEFINITION(CLIENT1, pdxIFPutGetTest)
}
try {
- serializationRegistry->addPdxType(PdxTests::PdxType::createDeserializable);
+ serializationRegistry->addPdxType(
+ PdxTests::PdxType::createDeserializable);
LOG("PdxObject Registered Successfully....");
} catch (apache::geode::client::IllegalStateException& /* ex*/) {
LOG("PdxObject IllegalStateException");
@@ -2443,9 +2473,8 @@ DUNIT_TASK_DEFINITION(CLIENT1, pdxIFPutGetTest)
"Pdxhashcode hashcode not matched with java pdx hash code.");
auto pp = std::make_shared<ParentPdx>(10);
- auto if2 =
- cacheHelper->getCache()->createPdxInstanceFactory(
- "testobject::ParentPdx");
+ auto if2 = cacheHelper->getCache()->createPdxInstanceFactory(
+ "testobject::ParentPdx");
if2->writeInt("m_parentId", pp->getParentId());
if2->writeObject("m_enum", pp->getEnum());
if2->writeString("m_parentName", pp->getParentName());
diff --git a/cppcache/integration-test/testThinClientPoolLocator.cpp b/cppcache/integration-test/testThinClientPoolLocator.cpp
index 018093a..f0901bf 100644
--- a/cppcache/integration-test/testThinClientPoolLocator.cpp
+++ b/cppcache/integration-test/testThinClientPoolLocator.cpp
@@ -36,7 +36,7 @@ DUNIT_TASK(CLIENT1, SetupClient1_NoLocators_At_Init)
try {
createEntry(regionNames[0], keys[0], vals[0]);
- } catch (NoAvailableLocatorsException& ex) {
+ } catch (NoAvailableLocatorsException&) {
LOG("Caught expected exception.");
} catch (...) {
FAIL("NoAvailableLocatorsException was not thrown.");
diff --git a/cppcache/integration-test/testThinClientRemoteQueryFailover.cpp b/cppcache/integration-test/testThinClientRemoteQueryFailover.cpp
index 001aa4e..e59d876 100644
--- a/cppcache/integration-test/testThinClientRemoteQueryFailover.cpp
+++ b/cppcache/integration-test/testThinClientRemoteQueryFailover.cpp
@@ -171,10 +171,10 @@ DUNIT_TASK_DEFINITION(CLIENT1, ValidateQueryExecutionAcrossServerFailure)
kst->start();
}
- int resultsize = results->size();
+ auto resultsize = results->size();
if (i % 100 == 0) {
- printf("Iteration upto %d done, result size is %d\n", i, resultsize);
+ printf("Iteration upto %d done, result size is %zd\n", i, resultsize);
}
if (resultsize != 4) // the XMLs for server 1 and server 2 have 1 and 2
@@ -188,8 +188,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, ValidateQueryExecutionAcrossServerFailure)
kst->stop();
} catch (IllegalStateException& ise) {
char isemsg[500] = {0};
- ACE_OS::snprintf(isemsg, 499, "IllegalStateException: %s",
- ise.what());
+ ACE_OS::snprintf(isemsg, 499, "IllegalStateException: %s", ise.what());
LOG(isemsg);
FAIL(isemsg);
} catch (Exception& excp) {
diff --git a/cppcache/integration-test/testThinClientRemoteQueryFailoverPdx.cpp b/cppcache/integration-test/testThinClientRemoteQueryFailoverPdx.cpp
index 6a4f034..6045f33 100644
--- a/cppcache/integration-test/testThinClientRemoteQueryFailoverPdx.cpp
+++ b/cppcache/integration-test/testThinClientRemoteQueryFailoverPdx.cpp
@@ -167,10 +167,10 @@ DUNIT_TASK_DEFINITION(CLIENT1, ValidateQueryExecutionAcrossServerFailure)
kst->start();
}
- int resultsize = results->size();
+ auto resultsize = results->size();
if (i % 100 == 0) {
- printf("Iteration upto %d done, result size is %d\n", i, resultsize);
+ printf("Iteration upto %d done, result size is %zd\n", i, resultsize);
}
if (resultsize != 4) // the XMLs for server 1 and server 2 have 1 and 2
@@ -184,8 +184,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, ValidateQueryExecutionAcrossServerFailure)
kst->stop();
} catch (IllegalStateException& ise) {
char isemsg[500] = {0};
- ACE_OS::snprintf(isemsg, 499, "IllegalStateException: %s",
- ise.what());
+ ACE_OS::snprintf(isemsg, 499, "IllegalStateException: %s", ise.what());
LOG(isemsg);
FAIL(isemsg);
} catch (Exception& excp) {
diff --git a/cppcache/integration-test/testThinClientSecurityMultiUserTest.cpp b/cppcache/integration-test/testThinClientSecurityMultiUserTest.cpp
index 2a50337..dd8af43 100644
--- a/cppcache/integration-test/testThinClientSecurityMultiUserTest.cpp
+++ b/cppcache/integration-test/testThinClientSecurityMultiUserTest.cpp
@@ -36,10 +36,10 @@ END_TASK_DEFINITION
DUNIT_TASK_DEFINITION(LOCATORSERVER, CreateServer)
{
CacheHelper::initServer(
- 1, "cacheserver_notify_subscription2.xml",
- CacheHelper::getLocatorHostPort(isLocator, isLocalServer, 1),
- "--J=-Dsecurity-manager=javaobject.SimpleSecurityManager",
- false, true, false, false, false, true);
+ 1, "cacheserver_notify_subscription2.xml",
+ CacheHelper::getLocatorHostPort(isLocator, isLocalServer, 1),
+ "--J=-Dsecurity-manager=javaobject.SimpleSecurityManager", false, true,
+ false, false, false, true);
LOG("Server started");
}
END_TASK_DEFINITION
@@ -60,18 +60,20 @@ DUNIT_TASK_DEFINITION(CLIENT1, PerformSecureOperationsWithUserCredentials)
config1->insert("security-username", "root");
config1->insert("security-password", "root-password");
- cache.createAuthenticatedView(config1, "mypool")->getRegion("DistRegionAck")
- ->put("akey", "avalue");
+ cache.createAuthenticatedView(config1, "mypool")
+ ->getRegion("DistRegionAck")
+ ->put("akey", "avalue");
auto config2 = Properties::create();
config2->insert("security-username", "reader");
config2->insert("security-password", "reader-password");
try {
- cache.createAuthenticatedView(config2, "mypool")->getRegion("DistRegionAck")
- ->put("akey", "avalue");
+ cache.createAuthenticatedView(config2, "mypool")
+ ->getRegion("DistRegionAck")
+ ->put("akey", "avalue");
FAIL("Didn't throw expected AuthenticationFailedException.");
- } catch (const apache::geode::client::NotAuthorizedException& other) {
+ } catch (const apache::geode::client::NotAuthorizedException&) {
LOG("Caught expected AuthenticationFailedException.");
}
}
@@ -93,10 +95,10 @@ END_TASK_DEFINITION
DUNIT_MAIN
{
- CALL_TASK(CreateLocator);
- CALL_TASK(CreateServer);
- CALL_TASK(PerformSecureOperationsWithUserCredentials);
- CALL_TASK(CloseServer);
- CALL_TASK(CloseLocator);
+ CALL_TASK(CreateLocator);
+ CALL_TASK(CreateServer);
+ CALL_TASK(PerformSecureOperationsWithUserCredentials);
+ CALL_TASK(CloseServer);
+ CALL_TASK(CloseLocator);
}
END_MAIN
diff --git a/cppcache/integration-test/testXmlCacheCreationWithOverFlow.cpp b/cppcache/integration-test/testXmlCacheCreationWithOverFlow.cpp
index b436a2b..89c3df5 100644
--- a/cppcache/integration-test/testXmlCacheCreationWithOverFlow.cpp
+++ b/cppcache/integration-test/testXmlCacheCreationWithOverFlow.cpp
@@ -38,8 +38,8 @@ int testXmlCacheCreationWithOverflow() {
std::cout << "create DistributedSytem with name=" << host_name << std::endl;
std::cout << "Create cache with the configurations provided in "
- "valid_overflowAttr.xml"
- << std::endl;
+ "valid_overflowAttr.xml"
+ << std::endl;
try {
std::string filePath = directory + "/resources/non-existent.xml";
@@ -93,9 +93,10 @@ int testXmlCacheCreationWithOverflow() {
}
auto regPtr1 = vrp.at(0);
- std::cout << "Test if the number of sub regions with the root region Root1 are "
- "correct"
- << std::endl;
+ std::cout
+ << "Test if the number of sub regions with the root region Root1 are "
+ "correct"
+ << std::endl;
std::vector<std::shared_ptr<Region>> vr = regPtr1->subregions(true);
std::cout << " vr.size=" << vr.size() << std::endl;
if (vr.size() != totalSubRegionsRoot1) {
@@ -104,7 +105,7 @@ int testXmlCacheCreationWithOverflow() {
}
std::cout << "get subregions from the root region :" << vrp.at(0)->getName()
- << std::endl;
+ << std::endl;
for (int32_t i = 0; i < vr.size(); i++) {
std::cout << "vc[" << i << "].m_reaPtr=" << vr.at(i).get() << std::endl;
std::cout << "vc[" << i << "]=" << vr.at(i)->getName() << std::endl;
@@ -118,13 +119,15 @@ int testXmlCacheCreationWithOverflow() {
auto&& parentName = regPtr->getParentRegion()->getName();
if (childName == "SubSubRegion221") {
if (parentName != "SubRegion22") {
- std::cout << "Incorrect parent: tree structure not formed correctly" << std::endl;
+ std::cout << "Incorrect parent: tree structure not formed correctly"
+ << std::endl;
return -1;
}
}
}
- std::cout << "****Correct region tree structure created from valid_cache.xml****"
- << std::endl;
+ std::cout
+ << "****Correct region tree structure created from valid_cache.xml****"
+ << std::endl;
vr.clear();
vrp.clear();
@@ -154,7 +157,7 @@ int testXmlCacheCreationWithOverflow() {
if (initialCapacity != 25) {
return -1;
}
- int regionIdleTO = regionAttributes.getRegionIdleTimeout().count();
+ auto regionIdleTO = regionAttributes.getRegionIdleTimeout().count();
std::cout << "RegionIdleTimeout:20 " << std::endl;
if (regionIdleTO != 20) {
return -1;
@@ -172,8 +175,10 @@ int testXmlCacheCreationWithOverflow() {
return -1;
}
- std::cout << "persistence library = " << regionAttributes.getPersistenceLibrary() << std::endl;
- std::cout << "persistence function = " << regionAttributes.getPersistenceFactory() << std::endl;
+ std::cout << "persistence library = "
+ << regionAttributes.getPersistenceLibrary() << std::endl;
+ std::cout << "persistence function = "
+ << regionAttributes.getPersistenceFactory() << std::endl;
auto pconfig = regionAttributes.getPersistenceProperties();
if (pconfig != nullptr) {
std::cout << " persistence property is not null" << std::endl;
@@ -188,8 +193,10 @@ int testXmlCacheCreationWithOverflow() {
std::cout << "****Attributes of Root1 are correctly set****" << std::endl;
auto regionAttributes2 = regPtr2->getAttributes();
- std::cout << "persistence library = " << regionAttributes2.getPersistenceLibrary() << std::endl;
- std::cout << "persistence function = " << regionAttributes2.getPersistenceFactory() << std::endl;
+ std::cout << "persistence library = "
+ << regionAttributes2.getPersistenceLibrary() << std::endl;
+ std::cout << "persistence function = "
+ << regionAttributes2.getPersistenceFactory() << std::endl;
auto pconfig2 = regionAttributes2.getPersistenceProperties();
if (pconfig2 != nullptr) {
std::cout << " persistence property is not null for Root2" << std::endl;
@@ -221,11 +228,11 @@ int testXmlCacheCreationWithOverflow() {
////////////////////////////testing of cache.xml completed///////////////////
std::cout << "Create cache with the configurations provided in the "
- "invalid_overflowAttr1.xml."
- << std::endl;
+ "invalid_overflowAttr1.xml."
+ << std::endl;
std::cout << "This is a well-formed xml....attributes not provided for "
- "persistence manager. exception should be thrown"
- << std::endl;
+ "persistence manager. exception should be thrown"
+ << std::endl;
try {
const auto filePath = directory + "/invalid_overflowAttr1.xml";
@@ -241,11 +248,12 @@ int testXmlCacheCreationWithOverflow() {
///////////////testing of invalid_cache1.xml completed///////////////////
std::cout << "Create cache with the configurations provided in the "
- "invalid_overflowAttr2.xml."
- << std::endl;
- std::cout << " This is a well-formed xml....attribute values is not provided for "
- "persistence library name......should throw an exception"
- << std::endl;
+ "invalid_overflowAttr2.xml."
+ << std::endl;
+ std::cout
+ << " This is a well-formed xml....attribute values is not provided for "
+ "persistence library name......should throw an exception"
+ << std::endl;
try {
const auto filePath = directory + "/invalid_overflowAttr2.xml";
@@ -261,12 +269,13 @@ int testXmlCacheCreationWithOverflow() {
///////////////testing of invalid_cache2.xml completed///////////////////
std::cout << "Create cache with the configurations provided in the "
- "invalid_overflowAttr3.xml."
- << std::endl;
+ "invalid_overflowAttr3.xml."
+ << std::endl;
- std::cout << "This is a well-formed xml....but region-attributes for persistence "
- "invalid......should throw an exception"
- << std::endl;
+ std::cout
+ << "This is a well-formed xml....but region-attributes for persistence "
+ "invalid......should throw an exception"
+ << std::endl;
try {
const auto filePath = directory + "/invalid_overflowAttr3.xml";
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/CacheTransactionManagerImpl.hpp b/cppcache/src/CacheTransactionManagerImpl.hpp
index 81999f9..562f761 100644
--- a/cppcache/src/CacheTransactionManagerImpl.hpp
+++ b/cppcache/src/CacheTransactionManagerImpl.hpp
@@ -33,8 +33,7 @@ namespace client {
enum status { STATUS_COMMITTED = 3, STATUS_ROLLEDBACK = 4 };
enum commitOp { BEFORE_COMMIT, AFTER_COMMIT };
-class CacheTransactionManagerImpl
- : public virtual apache::geode::client::CacheTransactionManager {
+class CacheTransactionManagerImpl : public virtual CacheTransactionManager {
public:
CacheTransactionManagerImpl(CacheImpl* cache);
virtual ~CacheTransactionManagerImpl();
@@ -45,11 +44,9 @@ class CacheTransactionManagerImpl
virtual bool exists() override;
virtual TransactionId& suspend() override;
virtual void resume(TransactionId& transactionId) override;
- virtual bool isSuspended(
- TransactionId& transactionId) override;
+ virtual bool isSuspended(TransactionId& transactionId) override;
virtual bool tryResume(TransactionId& transactionId) override;
- bool tryResume(TransactionId& transactionId,
- bool cancelExpiryTask);
+ bool tryResume(TransactionId& transactionId, bool cancelExpiryTask);
virtual bool tryResume(TransactionId& transactionId,
std::chrono::milliseconds waitTime) override;
virtual bool exists(TransactionId& transactionId) override;
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..454482a 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(
@@ -150,10 +150,9 @@ std::shared_ptr<CacheableBytes> DiffieHellman::encrypt(
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));
+ 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) {
@@ -163,10 +162,9 @@ std::shared_ptr<CacheableBytes> DiffieHellman::decrypt(
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));
+ 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/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..12c4956 100644
--- a/cppcache/src/ExecutionImpl.cpp
+++ b/cppcache/src/ExecutionImpl.cpp
@@ -184,7 +184,8 @@ std::shared_ptr<ResultCollector> ExecutionImpl::execute(
LOGDEBUG("ExecutionImpl::execute: m_routingObj is empty");
auto serverToBucketsMap = cms->groupByServerToAllBuckets(
m_region,
- /*serverOptimizeForWrite*/ (isHAHasResultOptimizeForWrite & 4));
+ /*serverOptimizeForWrite*/ (isHAHasResultOptimizeForWrite & 4) ==
+ 4);
if (!serverToBucketsMap || serverToBucketsMap->empty()) {
LOGDEBUG(
"ExecutionImpl::execute: m_routingObj is empty and locationMap "
@@ -202,8 +203,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));
}
@@ -250,7 +251,7 @@ std::shared_ptr<ResultCollector> ExecutionImpl::execute(
if (txState == nullptr) {
auto serverToKeysMap = cms->getServerToFilterMapFESHOP(
m_routingObj, m_region, /*serverOptimizeForWrite*/
- (isHAHasResultOptimizeForWrite & 4));
+ (isHAHasResultOptimizeForWrite & 4) == 4);
if (!serverToKeysMap || serverToKeysMap->empty()) {
LOGDEBUG(
"ExecutionImpl::execute: withFilter but locationMap is empty "
@@ -493,7 +494,8 @@ std::shared_ptr<CacheableVector> ExecutionImpl::executeOnPool(
funcName, m_args, getResult, tcrdm, timeout);
TcrMessageReply reply(true, tcrdm);
ChunkedFunctionExecutionResponse* resultCollector(
- new ChunkedFunctionExecutionResponse(reply, (getResult & 2), m_rc));
+ new ChunkedFunctionExecutionResponse(reply, (getResult & 2) == 2,
+ m_rc));
reply.setChunkedResultHandler(resultCollector);
reply.setTimeout(timeout);
diff --git a/cppcache/src/InternalCacheTransactionManager2PC.hpp b/cppcache/src/InternalCacheTransactionManager2PC.hpp
index 090c26a..7f5dc5c 100644
--- a/cppcache/src/InternalCacheTransactionManager2PC.hpp
+++ b/cppcache/src/InternalCacheTransactionManager2PC.hpp
@@ -49,7 +49,7 @@ namespace client {
*
*/
class _GEODE_EXPORT InternalCacheTransactionManager2PC
- : public virtual apache::geode::client::CacheTransactionManager {
+ : public virtual CacheTransactionManager {
public:
/**
* Performs prepare during 2 phase commit completion.
diff --git a/cppcache/src/InternalCacheTransactionManager2PCImpl.hpp b/cppcache/src/InternalCacheTransactionManager2PCImpl.hpp
index 732154a..fdb250f 100644
--- a/cppcache/src/InternalCacheTransactionManager2PCImpl.hpp
+++ b/cppcache/src/InternalCacheTransactionManager2PCImpl.hpp
@@ -28,8 +28,8 @@ namespace geode {
namespace client {
class InternalCacheTransactionManager2PCImpl
- : public apache::geode::client::CacheTransactionManagerImpl,
- public apache::geode::client::InternalCacheTransactionManager2PC {
+ : public CacheTransactionManagerImpl,
+ public InternalCacheTransactionManager2PC {
public:
InternalCacheTransactionManager2PCImpl(CacheImpl* cache);
virtual ~InternalCacheTransactionManager2PCImpl();
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..b0801ce 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) {
@@ -705,7 +710,7 @@ GfErrType MapSegment::putForTrackedEntry(
}
if (m_concurrencyChecksEnabled) {
// erase if the entry is in tombstone
- m_tombstoneList->eraseEntryFromTombstoneList(key, m_region);
+ m_tombstoneList->eraseEntryFromTombstoneList(key, true);
entryImpl->getVersionStamp().setVersions(versionStamp);
}
(void)incrementUpdateCount(key, entry);
@@ -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..78e9729 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
@@ -356,7 +356,8 @@ bool TcrConnection::InitTcrConnection(
}
challengeBytes->toData(*cleartext);
auto ciphertext =
- m_dh->encrypt(cleartext->getBuffer(), cleartext->getBufferLength());
+ m_dh->encrypt(cleartext->getBuffer(),
+ static_cast<int>(cleartext->getBufferLength()));
auto sendCreds = cacheImpl->createDataOutput();
ciphertext->toData(*sendCreds);
@@ -367,8 +368,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 +518,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 +589,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 +598,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 +607,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 +639,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 +664,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 +684,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 +704,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 +783,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 +791,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 +991,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 +1056,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 +1135,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 +1187,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 +1203,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 +1214,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 +1312,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 +1352,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..dc72b88 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*);
@@ -500,8 +500,8 @@ class FunctionExecution : public PooledWork<GfErrType> {
m_timeout);
TcrMessageReply reply(true, m_poolDM);
ChunkedFunctionExecutionResponse* resultProcessor(
- new ChunkedFunctionExecutionResponse(reply, (m_getResult & 2), *m_rc,
- m_resultCollectorLock));
+ new ChunkedFunctionExecutionResponse(reply, (m_getResult & 2) == 2,
+ *m_rc, m_resultCollectorLock));
reply.setChunkedResultHandler(resultProcessor);
reply.setTimeout(m_timeout);
reply.setDM(m_poolDM);
@@ -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;
@@ -595,7 +593,7 @@ class OnRegionFunctionExecution : public PooledWork<GfErrType> {
m_allBuckets, timeout, m_poolDM);
m_reply = new TcrMessageReply(true, m_poolDM);
m_resultCollector = new ChunkedFunctionExecutionResponse(
- *m_reply, (m_getResult & 2), m_rc, m_resultCollectorLock);
+ *m_reply, (m_getResult & 2) == 2, m_rc, m_resultCollectorLock);
m_reply->setChunkedResultHandler(m_resultCollector);
m_reply->setTimeout(m_timeout);
m_reply->setDM(m_poolDM);
@@ -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..91ccb7d 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) {
@@ -3003,7 +3002,7 @@ void ThinClientRegion::executeFunction(
TcrMessageReply reply(true, m_tcrdm);
// need to check
ChunkedFunctionExecutionResponse* resultCollector(
- new ChunkedFunctionExecutionResponse(reply, (getResult & 2), rc));
+ new ChunkedFunctionExecutionResponse(reply, (getResult & 2) == 2, rc));
reply.setChunkedResultHandler(resultCollector);
reply.setTimeout(timeout);
GfErrType err = GF_NOERR;
@@ -3097,7 +3096,7 @@ std::shared_ptr<CacheableVector> ThinClientRegion::reExecuteFunction(
TcrMessageReply reply(true, m_tcrdm);
// need to check
ChunkedFunctionExecutionResponse* resultCollector(
- new ChunkedFunctionExecutionResponse(reply, (getResult & 2), rc));
+ new ChunkedFunctionExecutionResponse(reply, (getResult & 2) == 2, rc));
reply.setChunkedResultHandler(resultCollector);
reply.setTimeout(timeout);
@@ -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/CMakeLists.txt b/cryptoimpl/CMakeLists.txt
index b3d9969..cf2339a 100644
--- a/cryptoimpl/CMakeLists.txt
+++ b/cryptoimpl/CMakeLists.txt
@@ -13,15 +13,20 @@
# See the License for the specific language governing permissions and
# limitations under the License.
cmake_minimum_required(VERSION 3.4)
-project(cryptoimpl LANGUAGES CXX)
+project(cryptoImpl LANGUAGES CXX)
file(GLOB_RECURSE SOURCES "*.cpp")
add_library(cryptoImpl SHARED ${SOURCES})
+target_compile_definitions(cryptoImpl
+ PRIVATE
+ BUILD_CPPCACHE)
+
target_link_libraries(cryptoImpl
PRIVATE
ACE_SSL
+ _WarningsAsError
PUBLIC
apache-geode
crypto
diff --git a/cryptoimpl/DHImpl.cpp b/cryptoimpl/DHImpl.cpp
index f381edf..5365928 100644
--- a/cryptoimpl/DHImpl.cpp
+++ b/cryptoimpl/DHImpl.cpp
@@ -64,16 +64,16 @@ static const EVP_CIPHER* getCipherFunc();
static int setSkAlgo(const char * skalgo);
*/
-ASN1_SEQUENCE(
- DH_PUBKEY) = {ASN1_SIMPLE(DH_PUBKEY, algor, X509_ALGOR),
- ASN1_SIMPLE(DH_PUBKEY, public_key,
- ASN1_BIT_STRING)} ASN1_SEQUENCE_END(DH_PUBKEY)
+ASN1_SEQUENCE(DH_PUBKEY) = {
+ ASN1_SIMPLE(DH_PUBKEY, algor, X509_ALGOR),
+ ASN1_SIMPLE(DH_PUBKEY, public_key, ASN1_BIT_STRING)};
+ASN1_SEQUENCE_END(DH_PUBKEY);
- // This gives us the i2d/d2i x.509 (ASN1 DER) encode/decode functions
- IMPLEMENT_ASN1_FUNCTIONS(DH_PUBKEY)
+// This gives us the i2d/d2i x.509 (ASN1 DER) encode/decode functions
+IMPLEMENT_ASN1_FUNCTIONS(DH_PUBKEY);
- // Returns Error code
- int gf_initDhKeys(void **dhCtx, const char *dhAlgo, const char *ksPath) {
+// Returns Error code
+int gf_initDhKeys(void **dhCtx, const char *dhAlgo, const char *ksPath) {
int errorCode = DH_ERR_NO_ERROR; // No error;
DHImpl *dhimpl = new DHImpl();
@@ -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);
@@ -161,7 +161,7 @@ ASN1_SEQUENCE(
}
} while (cert != NULL);
- LOGDH(" Total certificats imported # %d", dhimpl->m_serverCerts.size());
+ LOGDH(" Total certificats imported # %zd", dhimpl->m_serverCerts.size());
fclose(keyStoreFP);
@@ -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);
@@ -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/SSLImpl.cpp b/cryptoimpl/SSLImpl.cpp
index 59420c0..9fa0835 100644
--- a/cryptoimpl/SSLImpl.cpp
+++ b/cryptoimpl/SSLImpl.cpp
@@ -17,14 +17,10 @@
#include "SSLImpl.hpp"
-#include <ace/INET_Addr.h>
-#include <ace/SOCK_IO.h>
-#include <ace/Guard_T.h>
-#include <ace/SSL/SSL_SOCK_Connector.h>
-#include <ace/SSL/SSL_SOCK_Acceptor.h>
-#include <ace/OS.h>
#include <cstdint>
+#include <ace/Guard_T.h>
+
namespace apache {
namespace geode {
namespace client {
@@ -44,11 +40,10 @@ void gf_destroy_SslImpl(void *impl) {
}
extern "C" {
-
static int pem_passwd_cb(char *buf, int size, int rwflag, void *passwd) {
strncpy(buf, (char *)passwd, size);
buf[size - 1] = '\0';
- return (strlen(buf));
+ return static_cast<int>(strlen(buf));
}
}
diff --git a/cryptoimpl/SSLImpl.hpp b/cryptoimpl/SSLImpl.hpp
index e2085a6..57aeee3 100644
--- a/cryptoimpl/SSLImpl.hpp
+++ b/cryptoimpl/SSLImpl.hpp
@@ -20,7 +20,10 @@
#ifndef GEODE_CRYPTOIMPL_SSLIMPL_H_
#define GEODE_CRYPTOIMPL_SSLIMPL_H_
-#include <ace/ACE.h>
+#pragma warning(push)
+#pragma warning(disable : 4311)
+#pragma warning(disable : 4302)
+#pragma pack(push)
#include <ace/OS.h>
#include <ace/INET_Addr.h>
#include <ace/SOCK_IO.h>
@@ -29,6 +32,7 @@
#include <ace/OS.h>
#include <ace/Recursive_Thread_Mutex.h>
#include <ace/Time_Value.h>
+#pragma pack(pop)
#include <geode/internal/geode_base.hpp>
diff --git a/dhimpl/CMakeLists.txt b/dhimpl/CMakeLists.txt
index 41d2f83..5d459de 100644
--- a/dhimpl/CMakeLists.txt
+++ b/dhimpl/CMakeLists.txt
@@ -19,9 +19,16 @@ project(dhimpl LANGUAGES CXX)
file(GLOB_RECURSE SOURCES "*.cpp")
add_library(DHImpl SHARED ${SOURCES})
+
+target_compile_definitions(DHImpl
+ PRIVATE
+ BUILD_CPPCACHE)
+
target_link_libraries(DHImpl
PUBLIC
apache-geode
crypto
c++11
+ PRIVATE
+ _WarningsAsError
)
diff --git a/dhimpl/DHImpl.cpp b/dhimpl/DHImpl.cpp
index 6832045..0b9b85b 100644
--- a/dhimpl/DHImpl.cpp
+++ b/dhimpl/DHImpl.cpp
@@ -59,16 +59,16 @@ static EVP_PKEY *DH_PUBKEY_get(DH_PUBKEY *key);
static const EVP_CIPHER *getCipherFunc();
static int setSkAlgo(const char *skalgo);
-ASN1_SEQUENCE(
- DH_PUBKEY) = {ASN1_SIMPLE(DH_PUBKEY, algor, X509_ALGOR),
- ASN1_SIMPLE(DH_PUBKEY, public_key,
- ASN1_BIT_STRING)} ASN1_SEQUENCE_END(DH_PUBKEY)
+ASN1_SEQUENCE(DH_PUBKEY) = {
+ ASN1_SIMPLE(DH_PUBKEY, algor, X509_ALGOR),
+ ASN1_SIMPLE(DH_PUBKEY, public_key, ASN1_BIT_STRING)};
+ASN1_SEQUENCE_END(DH_PUBKEY);
- // This gives us the i2d/d2i x.509 (ASN1 DER) encode/decode functions
- IMPLEMENT_ASN1_FUNCTIONS(DH_PUBKEY)
+// This gives us the i2d/d2i x.509 (ASN1 DER) encode/decode functions
+IMPLEMENT_ASN1_FUNCTIONS(DH_PUBKEY);
- // Returns Error code
- int gf_initDhKeys(const char *dhAlgo, const char *ksPath) {
+// Returns Error code
+int gf_initDhKeys(const char *dhAlgo, const char *ksPath) {
int errorCode = DH_ERR_NO_ERROR; // No error;
// ksPath can be null
@@ -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) {
@@ -209,9 +209,9 @@ unsigned char *gf_getPublicKey(int *pLen) {
//
// Note, this temp pointer is needed because OpenSSL increments the pointer
// passed in
- // so that following encoding can be done at the current output location, this
- // will cause a
- // problem if we try to free the pointer which has been moved by OpenSSL.
+ // so that following encoding can be done at the current output location,
+ // this will cause a problem if we try to free the pointer which has been
+ // moved by OpenSSL.
//
i2d_DH_PUBKEY(dhpubkey, &temp);
@@ -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);
@@ -253,7 +253,7 @@ void gf_setPublicKeyOther(const unsigned char *pubkey, int length) {
#endif
}
-void gf_computeSharedSecret(void) {
+void gf_computeSharedSecret() {
LOGDH("COMPUTE: DH ptr %p, pubkeyOther ptr %p", m_dh, m_pubKeyOther);
LOGDH("DHcomputeKey DHSize is %d", DH_size(m_dh));
@@ -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;
@@ -397,7 +397,8 @@ unsigned char *gf_encryptDH(const unsigned char *cleartext, int len,
return ciphertext;
}
-// std::shared_ptr<CacheableBytes> decrypt(const uint8_t * ciphertext, int len)
+// std::shared_ptr<CacheableBytes> decrypt(const uint8_t * ciphertext, int
+// len)
// {
// LOGDH("DH: Used unimplemented decrypt!");
// return NULL;
@@ -444,7 +445,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 +474,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 +501,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 +533,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 +617,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 +632,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;
@@ -639,8 +640,4 @@ EVP_PKEY *DH_PUBKEY_get(DH_PUBKEY *key) {
if (asn1int != NULL) ASN1_INTEGER_free(asn1int);
return (ret);
-err:
- if (asn1int != NULL) ASN1_INTEGER_free(asn1int);
- if (ret != NULL) EVP_PKEY_free(ret);
- return (NULL);
}
diff --git a/plugins/SQLiteCLI/SQLiteCLI.csproj.in b/plugins/SQLiteCLI/SQLiteCLI.csproj.in
index 8fefebf..54ac914 100644
--- a/plugins/SQLiteCLI/SQLiteCLI.csproj.in
+++ b/plugins/SQLiteCLI/SQLiteCLI.csproj.in
@@ -53,29 +53,6 @@
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
</PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
- <DebugSymbols>true</DebugSymbols>
- <DebugType>full</DebugType>
- <Optimize>false</Optimize>
- <IntermediateOutputPath>Debug</IntermediateOutputPath>
- <OutputPath>Debug</OutputPath>
- <DefineConstants>DEBUG;TRACE</DefineConstants>
- <ErrorReport>prompt</ErrorReport>
- <WarningLevel>4</WarningLevel>
- <PlatformTarget>x86</PlatformTarget>
- <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
- <DebugType>pdbonly</DebugType>
- <Optimize>true</Optimize>
- <IntermediateOutputPath>Release</IntermediateOutputPath>
- <OutputPath>Release</OutputPath>
- <DefineConstants>TRACE</DefineConstants>
- <ErrorReport>prompt</ErrorReport>
- <WarningLevel>4</WarningLevel>
- <PlatformTarget>x86</PlatformTarget>
- <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
- </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x64' ">
<DebugSymbols>true</DebugSymbols>
<IntermediateOutputPath>Debug</IntermediateOutputPath>
@@ -85,7 +62,9 @@
<PlatformTarget>x64</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
- </PropertyGroup>
+ <WarningLevel>4</WarningLevel>
+ <TreatWarningsAsErrors>true</TreatWarningsAsErrors>
+ </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x64' ">
<IntermediateOutputPath>Release</IntermediateOutputPath>
<OutputPath>Release</OutputPath>
@@ -95,6 +74,8 @@
<PlatformTarget>x64</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
+ <WarningLevel>4</WarningLevel>
+ <TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
diff --git a/plugins/SQLiteCLI/SqLiteImpl.cs b/plugins/SQLiteCLI/SqLiteImpl.cs
index 5edb2e4..b67f888 100644
--- a/plugins/SQLiteCLI/SqLiteImpl.cs
+++ b/plugins/SQLiteCLI/SqLiteImpl.cs
@@ -68,7 +68,7 @@ namespace Apache.Geode.Plugins.SQLite
Path.Combine(m_regionDir, m_tableName + ".db"), pageSize, maxPageCount);
SqliteHelper.InitalizeSqLite(m_tableName, m_connectionString);
}
- catch (Exception ex)
+ catch (Exception)
{
throw;
}
@@ -81,7 +81,7 @@ namespace Apache.Geode.Plugins.SQLite
{
return (TValue)SqliteHelper.GetValue(key, m_tableName, m_connectionString);
}
- catch (Exception ex)
+ catch (Exception)
{
throw;
}
@@ -93,7 +93,7 @@ namespace Apache.Geode.Plugins.SQLite
{
SqliteHelper.InsertKeyValue(key, value, m_tableName, m_connectionString);
}
- catch (Exception ex)
+ catch (Exception)
{
throw;
}
@@ -115,7 +115,7 @@ namespace Apache.Geode.Plugins.SQLite
{
SqliteHelper.RemoveKey(key, m_tableName, m_connectionString);
}
- catch (Exception ex)
+ catch (Exception)
{
throw;
}
@@ -129,7 +129,7 @@ namespace Apache.Geode.Plugins.SQLite
Directory.Delete(m_regionDir, true);
Directory.Delete(m_persistenceDir);
}
- catch (Exception ex)
+ catch (Exception)
{
}
}
diff --git a/sqliteimpl/CMakeLists.txt b/sqliteimpl/CMakeLists.txt
index 33cee04..c8c8a72 100644
--- a/sqliteimpl/CMakeLists.txt
+++ b/sqliteimpl/CMakeLists.txt
@@ -16,15 +16,17 @@
cmake_minimum_required(VERSION 3.10)
project(SqLiteImpl LANGUAGES CXX)
-add_library(${PROJECT_NAME} SHARED
+add_library(SqLiteImpl SHARED
SqLiteHelper.cpp
SqLiteHelper.hpp
SqLiteImpl.cpp
SqLiteImpl.hpp
)
-target_link_libraries(${PROJECT_NAME}
+target_link_libraries(SqLiteImpl
PUBLIC
apache-geode
sqlite
+ PRIVATE
+ _WarningsAsError
)
diff --git a/sqliteimpl/SqLiteHelper.cpp b/sqliteimpl/SqLiteHelper.cpp
index 324056a..45621b5 100644
--- a/sqliteimpl/SqLiteHelper.cpp
+++ b/sqliteimpl/SqLiteHelper.cpp
@@ -23,7 +23,6 @@
int SqLiteHelper::initDB(const char *regionName, int maxPageCount, int pageSize,
const char *regionDBfile, int busy_timeout_ms) {
-
// open the database
int retCode = sqlite3_open(regionDBfile, &m_dbHandle);
if (retCode == SQLITE_OK) {
@@ -65,8 +64,8 @@ int SqLiteHelper::createTable() {
return retCode == SQLITE_DONE ? 0 : retCode;
}
-int SqLiteHelper::insertKeyValue(void *keyData, uint32_t keyDataSize,
- void *valueData, uint32_t valueDataSize) {
+int SqLiteHelper::insertKeyValue(void *keyData, int keyDataSize,
+ void *valueData, int valueDataSize) {
// construct query
char query[QUERY_SIZE];
SNPRINTF(query, QUERY_SIZE, "REPLACE INTO %s VALUES(?,?);", m_tableName);
@@ -85,7 +84,7 @@ int SqLiteHelper::insertKeyValue(void *keyData, uint32_t keyDataSize,
return retCode == SQLITE_DONE ? 0 : retCode;
}
-int SqLiteHelper::removeKey(void *keyData, uint32_t keyDataSize) {
+int SqLiteHelper::removeKey(void *keyData, int keyDataSize) {
// construct query
char query[QUERY_SIZE];
SNPRINTF(query, QUERY_SIZE, "DELETE FROM %s WHERE key=?;", m_tableName);
@@ -103,8 +102,8 @@ int SqLiteHelper::removeKey(void *keyData, uint32_t keyDataSize) {
return retCode == SQLITE_DONE ? 0 : retCode;
}
-int SqLiteHelper::getValue(void *keyData, uint32_t keyDataSize,
- void *&valueData, uint32_t &valueDataSize) {
+int SqLiteHelper::getValue(void *keyData, int keyDataSize, void *&valueData,
+ int &valueDataSize) {
// construct query
char query[QUERY_SIZE];
SNPRINTF(query, QUERY_SIZE,
diff --git a/sqliteimpl/SqLiteHelper.hpp b/sqliteimpl/SqLiteHelper.hpp
index abef843..3815614 100644
--- a/sqliteimpl/SqLiteHelper.hpp
+++ b/sqliteimpl/SqLiteHelper.hpp
@@ -41,11 +41,11 @@ class SqLiteHelper {
public:
int initDB(const char* regionName, int maxPageCount, int pageSize,
const char* regionDBfile, int busy_timeout_ms = 5000);
- int insertKeyValue(void* keyData, uint32_t keyDataSize, void* valueData,
- uint32_t valueDataSize);
- int removeKey(void* keyData, uint32_t keyDataSize);
- int getValue(void* keyData, uint32_t keyDataSize, void*& valueData,
- uint32_t& valueDataSize);
+ int insertKeyValue(void* keyData, int keyDataSize, void* valueData,
+ int valueDataSize);
+ int removeKey(void* keyData, int keyDataSize);
+ int getValue(void* keyData, int keyDataSize, void*& valueData,
+ int& valueDataSize);
int closeDB();
private:
diff --git a/sqliteimpl/SqLiteImpl.cpp b/sqliteimpl/SqLiteImpl.cpp
index 2208e8e..e0c24a2 100644
--- a/sqliteimpl/SqLiteImpl.cpp
+++ b/sqliteimpl/SqLiteImpl.cpp
@@ -111,12 +111,14 @@ void SqLiteImpl::write(const std::shared_ptr<CacheableKey>& key,
keyDataBuffer->writeObject(key);
valueDataBuffer->writeObject(value);
- void* keyData = const_cast<uint8_t*>(keyDataBuffer->getBuffer(&keyBufferSize));
+ void* keyData =
+ const_cast<uint8_t*>(keyDataBuffer->getBuffer(&keyBufferSize));
void* valueData =
const_cast<uint8_t*>(valueDataBuffer->getBuffer(&valueBufferSize));
- if (m_sqliteHelper->insertKeyValue(keyData, keyBufferSize, valueData,
- valueBufferSize) != 0) {
+ if (m_sqliteHelper->insertKeyValue(keyData, static_cast<int>(keyBufferSize),
+ valueData,
+ static_cast<int>(valueBufferSize)) != 0) {
throw IllegalStateException("Failed to write key value in SQLITE.");
}
}
@@ -128,12 +130,13 @@ std::shared_ptr<Cacheable> SqLiteImpl::read(
auto keyDataBuffer = m_regionPtr->getCache().createDataOutput();
size_t keyBufferSize;
keyDataBuffer->writeObject(key);
- void* keyData = const_cast<uint8_t*>(keyDataBuffer->getBuffer(&keyBufferSize));
+ void* keyData =
+ const_cast<uint8_t*>(keyDataBuffer->getBuffer(&keyBufferSize));
void* valueData;
- uint32_t valueBufferSize;
+ int valueBufferSize;
- if (m_sqliteHelper->getValue(keyData, keyBufferSize, valueData,
- valueBufferSize) != 0) {
+ if (m_sqliteHelper->getValue(keyData, static_cast<int>(keyBufferSize),
+ valueData, valueBufferSize) != 0) {
throw IllegalStateException("Failed to read the value from SQLITE.");
}
@@ -166,13 +169,16 @@ void SqLiteImpl::destroyRegion() {
#endif
}
-void SqLiteImpl::destroy(const std::shared_ptr<CacheableKey>& key, void*& dbHandle) {
+void SqLiteImpl::destroy(const std::shared_ptr<CacheableKey>& key,
+ void*& dbHandle) {
// Serialize key and value.
auto keyDataBuffer = m_regionPtr->getCache().createDataOutput();
size_t keyBufferSize;
keyDataBuffer->writeObject(key);
- void* keyData = const_cast<uint8_t*>(keyDataBuffer->getBuffer(&keyBufferSize));
- if (m_sqliteHelper->removeKey(keyData, keyBufferSize) != 0) {
+ void* keyData =
+ const_cast<uint8_t*>(keyDataBuffer->getBuffer(&keyBufferSize));
+ if (m_sqliteHelper->removeKey(keyData, static_cast<int>(keyBufferSize)) !=
+ 0) {
throw IllegalStateException("Failed to destroy the key from SQLITE.");
}
}
diff --git a/templates/security/CMakeLists.txt b/templates/security/CMakeLists.txt
index 9b38c15..9eefc92 100644
--- a/templates/security/CMakeLists.txt
+++ b/templates/security/CMakeLists.txt
@@ -28,4 +28,6 @@ target_link_libraries(securityImpl
PUBLIC
apache-geode
crypto
+ PRIVATE
+ _WarningsAsError
)
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/templates/security/csharp/securityImpl.csproj.in b/templates/security/csharp/securityImpl.csproj.in
index d312d84..7fe52c6 100644
--- a/templates/security/csharp/securityImpl.csproj.in
+++ b/templates/security/csharp/securityImpl.csproj.in
@@ -36,6 +36,8 @@
<PlatformTarget>x64</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
+ <WarningLevel>4</WarningLevel>
+ <TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<OutputPath>bin\x64\Release\</OutputPath>
@@ -45,6 +47,8 @@
<PlatformTarget>x64</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
+ <WarningLevel>4</WarningLevel>
+ <TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</PropertyGroup>
<ItemGroup>
<Reference Include="Apache.Geode.Client">
diff --git a/tests/cli/DUnitFramework/DUnitFramework.csproj.in b/tests/cli/DUnitFramework/DUnitFramework.csproj.in
index 79a8a38..eab062a 100755
--- a/tests/cli/DUnitFramework/DUnitFramework.csproj.in
+++ b/tests/cli/DUnitFramework/DUnitFramework.csproj.in
@@ -54,30 +54,6 @@
<BootstrapperEnabled>true</BootstrapperEnabled>
<TargetFrameworkProfile />
</PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
- <DebugSymbols>true</DebugSymbols>
- <DebugType>full</DebugType>
- <Optimize>false</Optimize>
- <IntermediateOutputPath>Debug</IntermediateOutputPath>
- <OutputPath>Debug</OutputPath>
- <DefineConstants>DEBUG;TRACE</DefineConstants>
- <ErrorReport>prompt</ErrorReport>
- <WarningLevel>4</WarningLevel>
- <PlatformTarget>x86</PlatformTarget>
- <NoWarn>618</NoWarn>
- <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
- <DebugType>pdbonly</DebugType>
- <Optimize>true</Optimize>
- <IntermediateOutputPath>Release</IntermediateOutputPath>
- <OutputPath>Release</OutputPath>
- <DefineConstants>TRACE</DefineConstants>
- <ErrorReport>prompt</ErrorReport>
- <WarningLevel>4</WarningLevel>
- <PlatformTarget>x86</PlatformTarget>
- <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
- </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x64' ">
<DebugSymbols>true</DebugSymbols>
<IntermediateOutputPath>Debug</IntermediateOutputPath>
@@ -87,8 +63,9 @@
<Optimize>false</Optimize>
<PlatformTarget>x64</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
- <NoWarn>618</NoWarn>
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
+ <WarningLevel>4</WarningLevel>
+ <TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x64' ">
<DefineConstants>TRACE</DefineConstants>
@@ -99,6 +76,8 @@
<PlatformTarget>x64</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
+ <WarningLevel>4</WarningLevel>
+ <TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</PropertyGroup>
<ItemGroup>
<Reference Include="nunit.framework">
diff --git a/tests/cli/FwkClient/FwkClient.csproj.in b/tests/cli/FwkClient/FwkClient.csproj.in
index 3ed8bd4..53f5834 100644
--- a/tests/cli/FwkClient/FwkClient.csproj.in
+++ b/tests/cli/FwkClient/FwkClient.csproj.in
@@ -53,30 +53,6 @@
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
</PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
- <DebugSymbols>true</DebugSymbols>
- <DebugType>full</DebugType>
- <IntermediateOutputPath>Debug</IntermediateOutputPath>
- <OutputPath>Debug</OutputPath>
- <Optimize>false</Optimize>
- <DefineConstants>DEBUG;TRACE</DefineConstants>
- <ErrorReport>prompt</ErrorReport>
- <WarningLevel>4</WarningLevel>
- <PlatformTarget>x86</PlatformTarget>
- <NoWarn>618</NoWarn>
- <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
- <DebugType>pdbonly</DebugType>
- <Optimize>true</Optimize>
- <IntermediateOutputPath>Release</IntermediateOutputPath>
- <OutputPath>Release</OutputPath>
- <DefineConstants>TRACE</DefineConstants>
- <ErrorReport>prompt</ErrorReport>
- <WarningLevel>4</WarningLevel>
- <PlatformTarget>x86</PlatformTarget>
- <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
- </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x64' ">
<DebugSymbols>true</DebugSymbols>
<Optimize>false</Optimize>
@@ -87,7 +63,7 @@
<PlatformTarget>x64</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
- <NoWarn>618</NoWarn>
+ <TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x64' ">
@@ -99,6 +75,8 @@
<PlatformTarget>x64</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
+ <WarningLevel>4</WarningLevel>
+ <TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
diff --git a/tests/cli/FwkLauncher/FwkLauncher.csproj.in b/tests/cli/FwkLauncher/FwkLauncher.csproj.in
index 669cef4..db68f30 100644
--- a/tests/cli/FwkLauncher/FwkLauncher.csproj.in
+++ b/tests/cli/FwkLauncher/FwkLauncher.csproj.in
@@ -53,30 +53,6 @@
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
</PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
- <DebugSymbols>true</DebugSymbols>
- <DebugType>full</DebugType>
- <Optimize>false</Optimize>
- <IntermediateOutputPath>Debug</IntermediateOutputPath>
- <OutputPath>Debug</OutputPath>
- <DefineConstants>DEBUG;TRACE</DefineConstants>
- <ErrorReport>prompt</ErrorReport>
- <WarningLevel>4</WarningLevel>
- <PlatformTarget>x86</PlatformTarget>
- <NoWarn>618</NoWarn>
- <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
- <DebugType>pdbonly</DebugType>
- <Optimize>true</Optimize>
- <IntermediateOutputPath>Release</IntermediateOutputPath>
- <OutputPath>Release</OutputPath>
- <DefineConstants>TRACE</DefineConstants>
- <ErrorReport>prompt</ErrorReport>
- <WarningLevel>4</WarningLevel>
- <PlatformTarget>x86</PlatformTarget>
- <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
- </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x64' ">
<DebugSymbols>true</DebugSymbols>
<Optimize>false</Optimize>
@@ -87,7 +63,7 @@
<PlatformTarget>x64</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
- <NoWarn>618</NoWarn>
+ <TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x64' ">
@@ -99,6 +75,8 @@
<PlatformTarget>x64</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
+ <WarningLevel>4</WarningLevel>
+ <TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
diff --git a/tests/cli/FwkUtil/FwkUtil.csproj.in b/tests/cli/FwkUtil/FwkUtil.csproj.in
index 47c2d7b..9652025 100644
--- a/tests/cli/FwkUtil/FwkUtil.csproj.in
+++ b/tests/cli/FwkUtil/FwkUtil.csproj.in
@@ -62,7 +62,8 @@
<DebugType>full</DebugType>
<PlatformTarget>x64</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
- <NoWarn>618</NoWarn>
+ <WarningLevel>4</WarningLevel>
+ <TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x64' ">
@@ -74,25 +75,8 @@
<PlatformTarget>x64</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
- <DebugSymbols>true</DebugSymbols>
- <OutputPath>Debug</OutputPath>
- <DefineConstants>DEBUG;TRACE</DefineConstants>
- <NoWarn>618</NoWarn>
- <DebugType>full</DebugType>
- <PlatformTarget>x86</PlatformTarget>
- <ErrorReport>prompt</ErrorReport>
- <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
- <OutputPath>Release</OutputPath>
- <DefineConstants>TRACE</DefineConstants>
- <Optimize>true</Optimize>
- <DebugType>pdbonly</DebugType>
- <PlatformTarget>x86</PlatformTarget>
- <ErrorReport>prompt</ErrorReport>
- <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
+ <WarningLevel>4</WarningLevel>
+ <TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</PropertyGroup>
<ItemGroup>
<Reference Include="nunit.framework">
diff --git a/tests/cli/NewFwkLib/CacheHelper.cs b/tests/cli/NewFwkLib/CacheHelper.cs
index 6e6d381..43a9905 100644
--- a/tests/cli/NewFwkLib/CacheHelper.cs
+++ b/tests/cli/NewFwkLib/CacheHelper.cs
@@ -102,7 +102,6 @@ namespace Apache.Geode.Client.FwkLib
private static DistributedSystem m_dsys = null;
private static Cache m_cache = null;
private static IRegion<TKey,TVal> m_currRegion = null;
- private static bool m_doDisconnect = true;
private const string DefaultDSName = "dstest";
private const string DefaultCacheName = "cachetest";
@@ -244,8 +243,6 @@ namespace Apache.Geode.Client.FwkLib
{
try
{
- CacheHelper<TKey, TVal>.m_doDisconnect = false;
-
CacheFactory cf = new CacheFactory(config);
if (cacheXml != null && cacheXml.Length > 0)
diff --git a/tests/cli/NewFwkLib/DeltaTest/DeltaClientValidationListener.cs b/tests/cli/NewFwkLib/DeltaTest/DeltaClientValidationListener.cs
index b13cd02..87b591c 100644
--- a/tests/cli/NewFwkLib/DeltaTest/DeltaClientValidationListener.cs
+++ b/tests/cli/NewFwkLib/DeltaTest/DeltaClientValidationListener.cs
@@ -147,11 +147,11 @@ namespace Apache.Geode.Client.FwkLib
{
}
- public void Close(Apache.Geode.Client.IRegion<TKey, TVal> region)
+ public override void Close(Apache.Geode.Client.IRegion<TKey, TVal> region)
{
}
- public void AfterRegionDisconnected(Apache.Geode.Client.IRegion<TKey, TVal> region)
+ public override void AfterRegionDisconnected(Apache.Geode.Client.IRegion<TKey, TVal> region)
{
}
public override void AfterRegionClear(RegionEvent<TKey, TVal> ev)
diff --git a/tests/cli/NewFwkLib/NewFwkLib.csproj.in b/tests/cli/NewFwkLib/NewFwkLib.csproj.in
index f58de91..8263912 100644
--- a/tests/cli/NewFwkLib/NewFwkLib.csproj.in
+++ b/tests/cli/NewFwkLib/NewFwkLib.csproj.in
@@ -62,8 +62,9 @@
<DebugType>full</DebugType>
<PlatformTarget>x64</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
- <NoWarn>618</NoWarn>
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
+ <WarningLevel>4</WarningLevel>
+ <TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x64' ">
<DefineConstants>TRACE</DefineConstants>
@@ -75,26 +76,8 @@
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
<NoWarn>618</NoWarn>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
- <DebugSymbols>true</DebugSymbols>
- <OutputPath>Debug</OutputPath>
- <DefineConstants>DEBUG;TRACE</DefineConstants>
- <NoWarn>618</NoWarn>
- <DebugType>full</DebugType>
- <PlatformTarget>x86</PlatformTarget>
- <ErrorReport>prompt</ErrorReport>
- <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
- <OutputPath>Release</OutputPath>
- <DefineConstants>TRACE</DefineConstants>
- <Optimize>true</Optimize>
- <DebugType>pdbonly</DebugType>
- <PlatformTarget>x86</PlatformTarget>
- <ErrorReport>prompt</ErrorReport>
- <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
- <NoWarn>618</NoWarn>
+ <WarningLevel>4</WarningLevel>
+ <TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</PropertyGroup>
<ItemGroup>
<Reference Include="nunit.framework">
diff --git a/tests/cli/PdxClassLibrary/PdxClassLibrary.csproj.in b/tests/cli/PdxClassLibrary/PdxClassLibrary.csproj.in
index 2110a83..ffc642f 100644
--- a/tests/cli/PdxClassLibrary/PdxClassLibrary.csproj.in
+++ b/tests/cli/PdxClassLibrary/PdxClassLibrary.csproj.in
@@ -53,29 +53,6 @@
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
</PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
- <DebugSymbols>true</DebugSymbols>
- <DebugType>full</DebugType>
- <Optimize>false</Optimize>
- <IntermediateOutputPath>Debug</IntermediateOutputPath>
- <OutputPath>Debug</OutputPath>
- <DefineConstants>DEBUG;TRACE</DefineConstants>
- <ErrorReport>prompt</ErrorReport>
- <WarningLevel>4</WarningLevel>
- <PlatformTarget>x86</PlatformTarget>
- <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
- <DebugType>pdbonly</DebugType>
- <Optimize>true</Optimize>
- <IntermediateOutputPath>Release</IntermediateOutputPath>
- <OutputPath>Release</OutputPath>
- <DefineConstants>TRACE</DefineConstants>
- <ErrorReport>prompt</ErrorReport>
- <WarningLevel>4</WarningLevel>
- <PlatformTarget>x86</PlatformTarget>
- <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
- </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x64' ">
<DebugSymbols>true</DebugSymbols>
<DefineConstants>DEBUG;TRACE</DefineConstants>
@@ -85,6 +62,8 @@
<PlatformTarget>x64</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
+ <WarningLevel>4</WarningLevel>
+ <TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x64' ">
<DefineConstants>TRACE</DefineConstants>
@@ -95,6 +74,8 @@
<PlatformTarget>x64</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
+ <WarningLevel>4</WarningLevel>
+ <TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
diff --git a/tests/cli/PdxClassLibrary/VariousPdxTypes.cs b/tests/cli/PdxClassLibrary/VariousPdxTypes.cs
index 13e0958..4557952 100644
--- a/tests/cli/PdxClassLibrary/VariousPdxTypes.cs
+++ b/tests/cli/PdxClassLibrary/VariousPdxTypes.cs
@@ -1368,6 +1368,114 @@ namespace PdxTests
return true;
}
+ public override int GetHashCode()
+ {
+ var hashCode = 1263783689;
+ hashCode = hashCode * -1521134295 + EqualityComparer<string>.Default.GetHashCode(_asciiNULL);
+ hashCode = hashCode * -1521134295 + EqualityComparer<string>.Default.GetHashCode(_ascii0);
+ hashCode = hashCode * -1521134295 + EqualityComparer<string>.Default.GetHashCode(_ascii255);
+ hashCode = hashCode * -1521134295 + EqualityComparer<string>.Default.GetHashCode(_ascii35000);
+ hashCode = hashCode * -1521134295 + EqualityComparer<string>.Default.GetHashCode(_ascii89000);
+ hashCode = hashCode * -1521134295 + EqualityComparer<string>.Default.GetHashCode(_utf10);
+ hashCode = hashCode * -1521134295 + EqualityComparer<string>.Default.GetHashCode(_utf255);
+ hashCode = hashCode * -1521134295 + EqualityComparer<string>.Default.GetHashCode(_utf2000);
+ hashCode = hashCode * -1521134295 + EqualityComparer<string>.Default.GetHashCode(_utf4000);
+ hashCode = hashCode * -1521134295 + EqualityComparer<List<object>>.Default.GetHashCode(_listNULL);
+ hashCode = hashCode * -1521134295 + EqualityComparer<List<object>>.Default.GetHashCode(_list0);
+ hashCode = hashCode * -1521134295 + EqualityComparer<List<object>>.Default.GetHashCode(_list252);
+ hashCode = hashCode * -1521134295 + EqualityComparer<List<object>>.Default.GetHashCode(_list253);
+ hashCode = hashCode * -1521134295 + EqualityComparer<List<object>>.Default.GetHashCode(_list35000);
+ hashCode = hashCode * -1521134295 + EqualityComparer<List<object>>.Default.GetHashCode(_list70000);
+ hashCode = hashCode * -1521134295 + EqualityComparer<List<object>>.Default.GetHashCode(_oalistNULL);
+ hashCode = hashCode * -1521134295 + EqualityComparer<List<object>>.Default.GetHashCode(_oalist0);
+ hashCode = hashCode * -1521134295 + EqualityComparer<List<object>>.Default.GetHashCode(_oalist252);
+ hashCode = hashCode * -1521134295 + EqualityComparer<List<object>>.Default.GetHashCode(_oalist253);
+ hashCode = hashCode * -1521134295 + EqualityComparer<List<object>>.Default.GetHashCode(_oalist35000);
+ hashCode = hashCode * -1521134295 + EqualityComparer<List<object>>.Default.GetHashCode(_oalist70000);
+ hashCode = hashCode * -1521134295 + EqualityComparer<ArrayList>.Default.GetHashCode(_arraylistNULL);
+ hashCode = hashCode * -1521134295 + EqualityComparer<ArrayList>.Default.GetHashCode(_arraylist0);
+ hashCode = hashCode * -1521134295 + EqualityComparer<ArrayList>.Default.GetHashCode(_arraylist252);
+ hashCode = hashCode * -1521134295 + EqualityComparer<ArrayList>.Default.GetHashCode(_arraylist253);
+ hashCode = hashCode * -1521134295 + EqualityComparer<ArrayList>.Default.GetHashCode(_arraylist35000);
+ hashCode = hashCode * -1521134295 + EqualityComparer<ArrayList>.Default.GetHashCode(_arraylist70000);
+ hashCode = hashCode * -1521134295 + EqualityComparer<Hashtable>.Default.GetHashCode(_hashtableNULL);
+ hashCode = hashCode * -1521134295 + EqualityComparer<Hashtable>.Default.GetHashCode(_hashtable0);
+ hashCode = hashCode * -1521134295 + EqualityComparer<Hashtable>.Default.GetHashCode(_hashtable252);
+ hashCode = hashCode * -1521134295 + EqualityComparer<Hashtable>.Default.GetHashCode(_hashtable253);
+ hashCode = hashCode * -1521134295 + EqualityComparer<Hashtable>.Default.GetHashCode(_hashtable35000);
+ hashCode = hashCode * -1521134295 + EqualityComparer<Hashtable>.Default.GetHashCode(_hashtable70000);
+ hashCode = hashCode * -1521134295 + EqualityComparer<Dictionary<object, object>>.Default.GetHashCode(_dictNULL);
+ hashCode = hashCode * -1521134295 + EqualityComparer<Dictionary<object, object>>.Default.GetHashCode(_dict0);
+ hashCode = hashCode * -1521134295 + EqualityComparer<Dictionary<object, object>>.Default.GetHashCode(_dict252);
+ hashCode = hashCode * -1521134295 + EqualityComparer<Dictionary<object, object>>.Default.GetHashCode(_dict253);
+ hashCode = hashCode * -1521134295 + EqualityComparer<Dictionary<object, object>>.Default.GetHashCode(_dict35000);
+ hashCode = hashCode * -1521134295 + EqualityComparer<Dictionary<object, object>>.Default.GetHashCode(_dict70000);
+ hashCode = hashCode * -1521134295 + EqualityComparer<string[]>.Default.GetHashCode(_stringArrayNULL);
+ hashCode = hashCode * -1521134295 + EqualityComparer<string[]>.Default.GetHashCode(_stringArrayEmpty);
+ hashCode = hashCode * -1521134295 + EqualityComparer<string[]>.Default.GetHashCode(_stringArray252);
+ hashCode = hashCode * -1521134295 + EqualityComparer<string[]>.Default.GetHashCode(_stringArray253);
+ hashCode = hashCode * -1521134295 + EqualityComparer<string[]>.Default.GetHashCode(_stringArray255);
+ hashCode = hashCode * -1521134295 + EqualityComparer<string[]>.Default.GetHashCode(_stringArray40000);
+ hashCode = hashCode * -1521134295 + EqualityComparer<string[]>.Default.GetHashCode(_stringArray70000);
+ hashCode = hashCode * -1521134295 + EqualityComparer<byte[]>.Default.GetHashCode(_byteArrayNULL);
+ hashCode = hashCode * -1521134295 + EqualityComparer<byte[]>.Default.GetHashCode(_byteArrayEmpty);
+ hashCode = hashCode * -1521134295 + EqualityComparer<byte[]>.Default.GetHashCode(_byteArray252);
+ hashCode = hashCode * -1521134295 + EqualityComparer<byte[]>.Default.GetHashCode(_byteArray253);
+ hashCode = hashCode * -1521134295 + EqualityComparer<byte[]>.Default.GetHashCode(_byteArray255);
+ hashCode = hashCode * -1521134295 + EqualityComparer<byte[]>.Default.GetHashCode(_byteArray40000);
+ hashCode = hashCode * -1521134295 + EqualityComparer<byte[]>.Default.GetHashCode(_byteArray70000);
+ hashCode = hashCode * -1521134295 + EqualityComparer<short[]>.Default.GetHashCode(_shortArrayNULL);
+ hashCode = hashCode * -1521134295 + EqualityComparer<short[]>.Default.GetHashCode(_shortArrayEmpty);
+ hashCode = hashCode * -1521134295 + EqualityComparer<short[]>.Default.GetHashCode(_shortArray252);
+ hashCode = hashCode * -1521134295 + EqualityComparer<short[]>.Default.GetHashCode(_shortArray253);
+ hashCode = hashCode * -1521134295 + EqualityComparer<short[]>.Default.GetHashCode(_shortArray255);
+ hashCode = hashCode * -1521134295 + EqualityComparer<short[]>.Default.GetHashCode(_shortArray40000);
+ hashCode = hashCode * -1521134295 + EqualityComparer<short[]>.Default.GetHashCode(_shortArray70000);
+ hashCode = hashCode * -1521134295 + EqualityComparer<int[]>.Default.GetHashCode(_intArrayNULL);
+ hashCode = hashCode * -1521134295 + EqualityComparer<int[]>.Default.GetHashCode(_intArrayEmpty);
+ hashCode = hashCode * -1521134295 + EqualityComparer<int[]>.Default.GetHashCode(_intArray252);
+ hashCode = hashCode * -1521134295 + EqualityComparer<int[]>.Default.GetHashCode(_intArray253);
+ hashCode = hashCode * -1521134295 + EqualityComparer<int[]>.Default.GetHashCode(_intArray255);
+ hashCode = hashCode * -1521134295 + EqualityComparer<int[]>.Default.GetHashCode(_intArray40000);
+ hashCode = hashCode * -1521134295 + EqualityComparer<int[]>.Default.GetHashCode(_intArray70000);
+ hashCode = hashCode * -1521134295 + EqualityComparer<long[]>.Default.GetHashCode(_longArrayNULL);
+ hashCode = hashCode * -1521134295 + EqualityComparer<long[]>.Default.GetHashCode(_longArrayEmpty);
+ hashCode = hashCode * -1521134295 + EqualityComparer<long[]>.Default.GetHashCode(_longArray252);
+ hashCode = hashCode * -1521134295 + EqualityComparer<long[]>.Default.GetHashCode(_longArray253);
+ hashCode = hashCode * -1521134295 + EqualityComparer<long[]>.Default.GetHashCode(_longArray255);
+ hashCode = hashCode * -1521134295 + EqualityComparer<long[]>.Default.GetHashCode(_longArray40000);
+ hashCode = hashCode * -1521134295 + EqualityComparer<long[]>.Default.GetHashCode(_longArray70000);
+ hashCode = hashCode * -1521134295 + EqualityComparer<double[]>.Default.GetHashCode(_doubleArrayNULL);
+ hashCode = hashCode * -1521134295 + EqualityComparer<double[]>.Default.GetHashCode(_doubleArrayEmpty);
+ hashCode = hashCode * -1521134295 + EqualityComparer<double[]>.Default.GetHashCode(_doubleArray252);
+ hashCode = hashCode * -1521134295 + EqualityComparer<double[]>.Default.GetHashCode(_doubleArray253);
+ hashCode = hashCode * -1521134295 + EqualityComparer<double[]>.Default.GetHashCode(_doubleArray255);
+ hashCode = hashCode * -1521134295 + EqualityComparer<double[]>.Default.GetHashCode(_doubleArray40000);
+ hashCode = hashCode * -1521134295 + EqualityComparer<double[]>.Default.GetHashCode(_doubleArray70000);
+ hashCode = hashCode * -1521134295 + EqualityComparer<float[]>.Default.GetHashCode(_floatArrayNULL);
+ hashCode = hashCode * -1521134295 + EqualityComparer<float[]>.Default.GetHashCode(_floatArrayEmpty);
+ hashCode = hashCode * -1521134295 + EqualityComparer<float[]>.Default.GetHashCode(_floatArray252);
+ hashCode = hashCode * -1521134295 + EqualityComparer<float[]>.Default.GetHashCode(_floatArray253);
+ hashCode = hashCode * -1521134295 + EqualityComparer<float[]>.Default.GetHashCode(_floatArray255);
+ hashCode = hashCode * -1521134295 + EqualityComparer<float[]>.Default.GetHashCode(_floatArray40000);
+ hashCode = hashCode * -1521134295 + EqualityComparer<float[]>.Default.GetHashCode(_floatArray70000);
+ hashCode = hashCode * -1521134295 + EqualityComparer<char[]>.Default.GetHashCode(_charArrayNULL);
+ hashCode = hashCode * -1521134295 + EqualityComparer<char[]>.Default.GetHashCode(_charArrayEmpty);
+ hashCode = hashCode * -1521134295 + EqualityComparer<char[]>.Default.GetHashCode(_charArray252);
+ hashCode = hashCode * -1521134295 + EqualityComparer<char[]>.Default.GetHashCode(_charArray253);
+ hashCode = hashCode * -1521134295 + EqualityComparer<char[]>.Default.GetHashCode(_charArray255);
+ hashCode = hashCode * -1521134295 + EqualityComparer<char[]>.Default.GetHashCode(_charArray40000);
+ hashCode = hashCode * -1521134295 + EqualityComparer<char[]>.Default.GetHashCode(_charArray70000);
+ hashCode = hashCode * -1521134295 + EqualityComparer<byte[][]>.Default.GetHashCode(_bytebytearrayNULL);
+ hashCode = hashCode * -1521134295 + EqualityComparer<byte[][]>.Default.GetHashCode(_bytebytearrayEmpty);
+ hashCode = hashCode * -1521134295 + EqualityComparer<byte[][]>.Default.GetHashCode(_bytebyteArray252);
+ hashCode = hashCode * -1521134295 + EqualityComparer<byte[][]>.Default.GetHashCode(_bytebyteArray253);
+ hashCode = hashCode * -1521134295 + EqualityComparer<byte[][]>.Default.GetHashCode(_bytebyteArray255);
+ hashCode = hashCode * -1521134295 + EqualityComparer<byte[][]>.Default.GetHashCode(_bytebyteArray40000);
+ hashCode = hashCode * -1521134295 + EqualityComparer<byte[][]>.Default.GetHashCode(_bytebyteArray70000);
+ return hashCode;
+ }
+
#region IPdxSerializable Members
public void FromData(IPdxReader reader)
diff --git a/tests/cli/PdxVersion2Lib/Version2.cs b/tests/cli/PdxVersion2Lib/Version2.cs
index 9532291..c6e6359 100755
--- a/tests/cli/PdxVersion2Lib/Version2.cs
+++ b/tests/cli/PdxVersion2Lib/Version2.cs
@@ -1040,6 +1040,15 @@ namespace PdxVersionTests
throw new IllegalStateException("In TestDiffTypePdxS.ToData serializer class not found " + classname);
}
+ public override int GetHashCode()
+ {
+ var hashCode = -414132507;
+ hashCode = hashCode * -1521134295 + EqualityComparer<string>.Default.GetHashCode(_id);
+ hashCode = hashCode * -1521134295 + EqualityComparer<string>.Default.GetHashCode(_name);
+ hashCode = hashCode * -1521134295 + _count.GetHashCode();
+ return hashCode;
+ }
+
#endregion
@@ -2038,8 +2047,88 @@ static Random _random = new Random();
{
return "PdxVersioned 2 : " + m_string;
}
- #endregion
+
+ public override int GetHashCode()
+ {
+ var hashCode = 1454868752;
+ hashCode = hashCode * -1521134295 + m_char.GetHashCode();
+ hashCode = hashCode * -1521134295 + m_bool.GetHashCode();
+ hashCode = hashCode * -1521134295 + m_byte.GetHashCode();
+ hashCode = hashCode * -1521134295 + m_sbyte.GetHashCode();
+ hashCode = hashCode * -1521134295 + m_int16.GetHashCode();
+ hashCode = hashCode * -1521134295 + m_uint16.GetHashCode();
+ hashCode = hashCode * -1521134295 + m_int32.GetHashCode();
+ hashCode = hashCode * -1521134295 + m_uint32.GetHashCode();
+ hashCode = hashCode * -1521134295 + m_long.GetHashCode();
+ hashCode = hashCode * -1521134295 + m_ulong.GetHashCode();
+ hashCode = hashCode * -1521134295 + m_float.GetHashCode();
+ hashCode = hashCode * -1521134295 + m_double.GetHashCode();
+ hashCode = hashCode * -1521134295 + EqualityComparer<string>.Default.GetHashCode(m_string);
+ hashCode = hashCode * -1521134295 + EqualityComparer<bool[]>.Default.GetHashCode(m_boolArray);
+ hashCode = hashCode * -1521134295 + EqualityComparer<byte[]>.Default.GetHashCode(m_byteArray);
+ hashCode = hashCode * -1521134295 + EqualityComparer<byte[]>.Default.GetHashCode(m_sbyteArray);
+ hashCode = hashCode * -1521134295 + EqualityComparer<char[]>.Default.GetHashCode(m_charArray);
+ hashCode = hashCode * -1521134295 + m_dateTime.GetHashCode();
+ hashCode = hashCode * -1521134295 + EqualityComparer<short[]>.Default.GetHashCode(m_int16Array);
+ hashCode = hashCode * -1521134295 + EqualityComparer<short[]>.Default.GetHashCode(m_uint16Array);
+ hashCode = hashCode * -1521134295 + EqualityComparer<int[]>.Default.GetHashCode(m_int32Array);
+ hashCode = hashCode * -1521134295 + EqualityComparer<int[]>.Default.GetHashCode(m_uint32Array);
+ hashCode = hashCode * -1521134295 + EqualityComparer<long[]>.Default.GetHashCode(m_longArray);
+ hashCode = hashCode * -1521134295 + EqualityComparer<long[]>.Default.GetHashCode(m_ulongArray);
+ hashCode = hashCode * -1521134295 + EqualityComparer<float[]>.Default.GetHashCode(m_floatArray);
+ hashCode = hashCode * -1521134295 + EqualityComparer<double[]>.Default.GetHashCode(m_doubleArray);
+ hashCode = hashCode * -1521134295 + EqualityComparer<byte[][]>.Default.GetHashCode(m_byteByteArray);
+ hashCode = hashCode * -1521134295 + EqualityComparer<string[]>.Default.GetHashCode(m_stringArray);
+ hashCode = hashCode * -1521134295 + EqualityComparer<List<object>>.Default.GetHashCode(m_arraylist);
+ hashCode = hashCode * -1521134295 + EqualityComparer<IDictionary<object, object>>.Default.GetHashCode(m_map);
+ hashCode = hashCode * -1521134295 + EqualityComparer<Hashtable>.Default.GetHashCode(m_hashtable);
+ hashCode = hashCode * -1521134295 + EqualityComparer<ArrayList>.Default.GetHashCode(m_vector);
+ hashCode = hashCode * -1521134295 + EqualityComparer<byte[]>.Default.GetHashCode(m_byte252);
+ hashCode = hashCode * -1521134295 + EqualityComparer<byte[]>.Default.GetHashCode(m_byte253);
+ hashCode = hashCode * -1521134295 + EqualityComparer<byte[]>.Default.GetHashCode(m_byte65535);
+ hashCode = hashCode * -1521134295 + EqualityComparer<byte[]>.Default.GetHashCode(m_byte65536);
+ hashCode = hashCode * -1521134295 + m_pdxEnum.GetHashCode();
+ hashCode = hashCode * -1521134295 + EqualityComparer<string>.Default.GetHashCode(PString);
+ hashCode = hashCode * -1521134295 + Char.GetHashCode();
+ hashCode = hashCode * -1521134295 + Bool.GetHashCode();
+ hashCode = hashCode * -1521134295 + Byte.GetHashCode();
+ hashCode = hashCode * -1521134295 + Sbyte.GetHashCode();
+ hashCode = hashCode * -1521134295 + Int16.GetHashCode();
+ hashCode = hashCode * -1521134295 + Uint16.GetHashCode();
+ hashCode = hashCode * -1521134295 + Int32.GetHashCode();
+ hashCode = hashCode * -1521134295 + Uint32.GetHashCode();
+ hashCode = hashCode * -1521134295 + Long.GetHashCode();
+ hashCode = hashCode * -1521134295 + Ulong.GetHashCode();
+ hashCode = hashCode * -1521134295 + Float.GetHashCode();
+ hashCode = hashCode * -1521134295 + Double.GetHashCode();
+ hashCode = hashCode * -1521134295 + EqualityComparer<bool[]>.Default.GetHashCode(BoolArray);
+ hashCode = hashCode * -1521134295 + EqualityComparer<byte[]>.Default.GetHashCode(ByteArray);
+ hashCode = hashCode * -1521134295 + EqualityComparer<byte[]>.Default.GetHashCode(SbyteArray);
+ hashCode = hashCode * -1521134295 + EqualityComparer<char[]>.Default.GetHashCode(CharArray);
+ hashCode = hashCode * -1521134295 + DateTime.GetHashCode();
+ hashCode = hashCode * -1521134295 + EqualityComparer<short[]>.Default.GetHashCode(Int16Array);
+ hashCode = hashCode * -1521134295 + EqualityComparer<short[]>.Default.GetHashCode(Uint16Array);
+ hashCode = hashCode * -1521134295 + EqualityComparer<int[]>.Default.GetHashCode(Int32Array);
+ hashCode = hashCode * -1521134295 + EqualityComparer<int[]>.Default.GetHashCode(Uint32Array);
+ hashCode = hashCode * -1521134295 + EqualityComparer<long[]>.Default.GetHashCode(LongArray);
+ hashCode = hashCode * -1521134295 + EqualityComparer<long[]>.Default.GetHashCode(UlongArray);
+ hashCode = hashCode * -1521134295 + EqualityComparer<float[]>.Default.GetHashCode(FloatArray);
+ hashCode = hashCode * -1521134295 + EqualityComparer<double[]>.Default.GetHashCode(DoubleArray);
+ hashCode = hashCode * -1521134295 + EqualityComparer<byte[][]>.Default.GetHashCode(ByteByteArray);
+ hashCode = hashCode * -1521134295 + EqualityComparer<string[]>.Default.GetHashCode(StringArray);
+ hashCode = hashCode * -1521134295 + EqualityComparer<List<object>>.Default.GetHashCode(Arraylist);
+ hashCode = hashCode * -1521134295 + EqualityComparer<IDictionary<object, object>>.Default.GetHashCode(Map);
+ hashCode = hashCode * -1521134295 + EqualityComparer<Hashtable>.Default.GetHashCode(Hashtable);
+ hashCode = hashCode * -1521134295 + EqualityComparer<ArrayList>.Default.GetHashCode(Vector);
+ hashCode = hashCode * -1521134295 + EqualityComparer<byte[]>.Default.GetHashCode(Byte252);
+ hashCode = hashCode * -1521134295 + EqualityComparer<byte[]>.Default.GetHashCode(Byte253);
+ hashCode = hashCode * -1521134295 + EqualityComparer<byte[]>.Default.GetHashCode(Byte65535);
+ hashCode = hashCode * -1521134295 + EqualityComparer<byte[]>.Default.GetHashCode(Byte65536);
+ hashCode = hashCode * -1521134295 + PdxEnum.GetHashCode();
+ return hashCode;
}
+ #endregion
+ }
public class InnerPdx : IPdxSerializable
{
diff --git a/tests/cli/QueryHelper/QueryHelperN.cs b/tests/cli/QueryHelper/QueryHelperN.cs
index 3f71876..6b3b331 100644
--- a/tests/cli/QueryHelper/QueryHelperN.cs
+++ b/tests/cli/QueryHelper/QueryHelperN.cs
@@ -466,8 +466,8 @@ namespace Apache.Geode.Client.Tests
p1.ToData(o1);
p2.ToData(o2);
- uint len1 = o1.BufferLength;
- uint len2 = o2.BufferLength;
+ var len1 = o1.BufferLength;
+ var len2 = o2.BufferLength;
if (len1 != len2)
{
diff --git a/tests/cli/SecurityUtil/SecurityUtil.csproj.in b/tests/cli/SecurityUtil/SecurityUtil.csproj.in
index ff92148..6874ba8 100644
--- a/tests/cli/SecurityUtil/SecurityUtil.csproj.in
+++ b/tests/cli/SecurityUtil/SecurityUtil.csproj.in
@@ -53,31 +53,6 @@
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
</PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
- <DebugSymbols>true</DebugSymbols>
- <DebugType>full</DebugType>
- <IntermediateOutputPath>Debug</IntermediateOutputPath>
- <OutputPath>Debug</OutputPath>
- <Optimize>false</Optimize>
- <DefineConstants>DEBUG;TRACE</DefineConstants>
- <ErrorReport>prompt</ErrorReport>
- <WarningLevel>4</WarningLevel>
- <PlatformTarget>x86</PlatformTarget>
- <NoWarn>618</NoWarn>
- <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
- <DebugType>pdbonly</DebugType>
- <Optimize>true</Optimize>
- <IntermediateOutputPath>Release</IntermediateOutputPath>
- <OutputPath>Release</OutputPath>
- <DefineConstants>TRACE</DefineConstants>
- <ErrorReport>prompt</ErrorReport>
- <WarningLevel>4</WarningLevel>
- <PlatformTarget>x86</PlatformTarget>
- <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
- <NoWarn>618</NoWarn>
- </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x64' ">
<DebugSymbols>true</DebugSymbols>
<Optimize>false</Optimize>
@@ -88,7 +63,7 @@
<PlatformTarget>x64</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
- <NoWarn>618</NoWarn>
+ <TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x64' ">
@@ -100,7 +75,8 @@
<PlatformTarget>x64</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
- <NoWarn>618</NoWarn>
+ <WarningLevel>4</WarningLevel>
+ <TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
diff --git a/tests/cpp/fwk/CMakeLists.txt b/tests/cpp/fwk/CMakeLists.txt
index 85837c1..c6483a4 100644
--- a/tests/cpp/fwk/CMakeLists.txt
+++ b/tests/cpp/fwk/CMakeLists.txt
@@ -31,6 +31,7 @@ target_link_libraries(${PROJECT_NAME}
framework
PRIVATE
ACE
+ _WarningsAsError
)
# For Visual Studio organization
diff --git a/tests/cpp/fwklib/CMakeLists.txt b/tests/cpp/fwklib/CMakeLists.txt
index 299ebb7..d0e3773 100644
--- a/tests/cpp/fwklib/CMakeLists.txt
+++ b/tests/cpp/fwklib/CMakeLists.txt
@@ -81,6 +81,7 @@ target_link_libraries(${PROJECT_NAME}
xerces-c
PRIVATE
ACE
+ _WarningsAsError
)
# For Visual Studio organization
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/fwklib/QueryHelper.hpp b/tests/cpp/fwklib/QueryHelper.hpp
index ead7c26..dbf1fe9 100644
--- a/tests/cpp/fwklib/QueryHelper.hpp
+++ b/tests/cpp/fwklib/QueryHelper.hpp
@@ -811,8 +811,8 @@ bool QueryHelper::compareTwoPositionObjects(
p1->toData(o1);
p2->toData(o2);
- uint32_t len1 = o1.getBufferLength();
- uint32_t len2 = o2.getBufferLength();
+ auto len1 = o1.getBufferLength();
+ auto len2 = o2.getBufferLength();
if (len1 != len2) {
return false;
diff --git a/tests/cpp/fwklib/RegionHelper.hpp b/tests/cpp/fwklib/RegionHelper.hpp
index 5f23202..5a4f8b1 100644
--- a/tests/cpp/fwklib/RegionHelper.hpp
+++ b/tests/cpp/fwklib/RegionHelper.hpp
@@ -79,7 +79,8 @@ class RegionHelper {
std::string sString;
sString += regionAttributes.getCachingEnabled() ? "Caching" : "NoCache";
- sString += (regionAttributes.getCacheListener() == nullptr) ? "Nlstnr" : "Lstnr";
+ sString +=
+ (regionAttributes.getCacheListener() == nullptr) ? "Nlstnr" : "Lstnr";
return sString;
}
@@ -96,6 +97,7 @@ class RegionHelper {
case ExpirationAction::INVALID_ACTION:
return "INVALID_ACTION";
}
+ throw std::invalid_argument("expirationAction is uknown.");
}
/** @brief Given RegionAttributes, return a string logging its configuration.
@@ -111,7 +113,8 @@ class RegionHelper {
sString += "\nendpoints: ";
sString += regionAttributes.getEndpoints();
sString += "\nclientNotification: ";
- sString += regionAttributes.getClientNotificationEnabled() ? "Enabled" : "Disabled";
+ sString += regionAttributes.getClientNotificationEnabled() ? "Enabled"
+ : "Disabled";
sString += "\ninitialCapacity: ";
sString += std::to_string(regionAttributes.getInitialCapacity());
sString += "\nloadFactor: ";
@@ -160,7 +163,8 @@ class RegionHelper {
? "Disabled"
: "Enabled";
sString += "\nConcurrencyChecksEnabled: ";
- sString += regionAttributes.getConcurrencyChecksEnabled() ? "Enabled" : "Disabled";
+ sString +=
+ regionAttributes.getConcurrencyChecksEnabled() ? "Enabled" : "Disabled";
sString += "\n";
return sString;
@@ -184,31 +188,36 @@ class RegionHelper {
regionAttributes.getCacheWriterFactory());
}
if (regionAttributes.getEntryIdleTimeout().count() != 0) {
- regionFac.setEntryIdleTimeout(regionAttributes.getEntryIdleTimeoutAction(),
- regionAttributes.getEntryIdleTimeout());
+ regionFac.setEntryIdleTimeout(
+ regionAttributes.getEntryIdleTimeoutAction(),
+ regionAttributes.getEntryIdleTimeout());
}
if (regionAttributes.getEntryTimeToLive().count() != 0) {
regionFac.setEntryTimeToLive(regionAttributes.getEntryTimeToLiveAction(),
regionAttributes.getEntryTimeToLive());
}
if (regionAttributes.getRegionIdleTimeout().count() != 0) {
- regionFac.setRegionIdleTimeout(regionAttributes.getRegionIdleTimeoutAction(),
- regionAttributes.getRegionIdleTimeout());
+ regionFac.setRegionIdleTimeout(
+ regionAttributes.getRegionIdleTimeoutAction(),
+ regionAttributes.getRegionIdleTimeout());
}
if (regionAttributes.getRegionTimeToLive().count() != 0) {
- regionFac.setRegionTimeToLive(regionAttributes.getRegionTimeToLiveAction(),
- regionAttributes.getRegionTimeToLive());
+ regionFac.setRegionTimeToLive(
+ regionAttributes.getRegionTimeToLiveAction(),
+ regionAttributes.getRegionTimeToLive());
}
if (!(regionAttributes.getPartitionResolverLibrary().empty() ||
regionAttributes.getPartitionResolverFactory().empty())) {
- regionFac.setPartitionResolver(regionAttributes.getPartitionResolverLibrary(),
- regionAttributes.getPartitionResolverFactory());
+ regionFac.setPartitionResolver(
+ regionAttributes.getPartitionResolverLibrary(),
+ regionAttributes.getPartitionResolverFactory());
}
if (!(regionAttributes.getPersistenceLibrary().empty() ||
regionAttributes.getPersistenceFactory().empty())) {
- regionFac.setPersistenceManager(regionAttributes.getPersistenceLibrary(),
- regionAttributes.getPersistenceFactory(),
- regionAttributes.getPersistenceProperties());
+ regionFac.setPersistenceManager(
+ regionAttributes.getPersistenceLibrary(),
+ regionAttributes.getPersistenceFactory(),
+ regionAttributes.getPersistenceProperties());
}
regionFac.setInitialCapacity(regionAttributes.getInitialCapacity());
regionFac.setLoadFactor(regionAttributes.getLoadFactor());
@@ -217,7 +226,8 @@ class RegionHelper {
regionFac.setDiskPolicy(regionAttributes.getDiskPolicy());
regionFac.setCloningEnabled(regionAttributes.getCloningEnabled());
regionFac.setPoolName(regionAttributes.getPoolName());
- regionFac.setConcurrencyChecksEnabled(regionAttributes.getConcurrencyChecksEnabled());
+ regionFac.setConcurrencyChecksEnabled(
+ regionAttributes.getConcurrencyChecksEnabled());
}
std::shared_ptr<Region> createRootRegion(std::shared_ptr<Cache>& cachePtr) {
diff --git a/tests/cpp/fwklib/TcpIpc.cpp b/tests/cpp/fwklib/TcpIpc.cpp
index 2dab7cb..68d5fc8 100644
--- a/tests/cpp/fwklib/TcpIpc.cpp
+++ b/tests/cpp/fwklib/TcpIpc.cpp
@@ -33,30 +33,22 @@
using namespace apache::geode::client;
using namespace apache::geode::client::testframework;
-void TcpIpc::clearNagle(int32_t sock) {
+void TcpIpc::clearNagle(ACE_HANDLE sock) {
int32_t val = 1;
-#ifdef WIN32
- const char *param = (const char *)&val;
-#else
- const void *param = (const void *)&val;
-#endif
- int32_t plen = sizeof(param);
+ char *param = (char *)&val;
+ int32_t plen = sizeof(val);
- if (0 != setsockopt(sock, IPPROTO_TCP, 1, param, plen)) {
+ if (0 != ACE_OS::setsockopt(sock, IPPROTO_TCP, 1, param, plen)) {
FWKSEVERE("Failed to set NAGLE on socket. Errno: " << errno);
}
}
-int32_t TcpIpc::getSize(int32_t sock, int32_t flag) {
+int32_t TcpIpc::getSize(ACE_HANDLE sock, int32_t flag) {
int32_t val = 0;
-#ifdef _WIN32
- char *param = (char *)&val;
-#else
- void *param = (void *)&val;
-#endif
- socklen_t plen = sizeof(val);
+ auto *param = reinterpret_cast<char *>(&val);
+ int32_t plen = sizeof(val);
- if (0 != getsockopt(sock, SOL_SOCKET, flag, param, &plen)) {
+ if (0 != ACE_OS::getsockopt(sock, SOL_SOCKET, flag, param, &plen)) {
FWKSEVERE("Failed to get buff size for flag "
<< flag << " on socket. Errno: " << errno);
}
@@ -66,19 +58,12 @@ int32_t TcpIpc::getSize(int32_t sock, int32_t flag) {
return val;
}
-int32_t TcpIpc::setSize(int32_t sock, int32_t flag, int32_t size) {
+int32_t TcpIpc::setSize(ACE_HANDLE sock, int32_t flag, int32_t size) {
int32_t val = 0;
if (size <= 0) return 0;
-#ifdef _WIN32
- const char *cparam = (const char *)&val;
- char *param = (char *)&val;
-#else
- const void *cparam = (const void *)&val;
- void *param = (void *)&val;
-#endif
- socklen_t plen = sizeof(val);
- socklen_t clen = sizeof(val);
+ auto *param = reinterpret_cast<char *>(&val);
+ int32_t plen = sizeof(val);
int32_t inc = 32120;
val = size - (3 * inc);
@@ -88,8 +73,8 @@ int32_t TcpIpc::setSize(int32_t sock, int32_t flag, int32_t size) {
while (lastRed != red) {
lastRed = red;
val += inc;
- setsockopt(sock, SOL_SOCKET, flag, cparam, clen);
- if (0 != getsockopt(sock, SOL_SOCKET, flag, param, &plen)) {
+ ACE_OS::setsockopt(sock, SOL_SOCKET, flag, param, plen);
+ if (0 != ACE_OS::getsockopt(sock, SOL_SOCKET, flag, param, &plen)) {
FWKSEVERE("Failed to get buff size for flag "
<< flag << " on socket. Errno: " << errno);
}
@@ -102,7 +87,7 @@ int32_t TcpIpc::setSize(int32_t sock, int32_t flag, int32_t size) {
}
void TcpIpc::init(int32_t sockBufferSize) {
- int32_t sock = (int32_t)socket(AF_INET, SOCK_STREAM, 0);
+ auto sock = ACE_OS::socket(AF_INET, SOCK_STREAM, 0);
if (sock < 0) {
FWKSEVERE("Failed to create socket. Errno: " << errno);
}
@@ -116,7 +101,7 @@ void TcpIpc::init(int32_t sockBufferSize) {
int32_t size = getSize(sock, SO_SNDBUF);
size = getSize(sock, SO_RCVBUF);
}
- m_io = new ACE_SOCK_Stream((ACE_HANDLE)sock);
+ m_io = new ACE_SOCK_Stream(sock);
ACE_OS::signal(SIGPIPE, SIG_IGN); // Ignore broken pipe
}
diff --git a/tests/cpp/fwklib/TcpIpc.hpp b/tests/cpp/fwklib/TcpIpc.hpp
index c4e20f0..d5f2ada 100644
--- a/tests/cpp/fwklib/TcpIpc.hpp
+++ b/tests/cpp/fwklib/TcpIpc.hpp
@@ -37,9 +37,9 @@ class TcpIpc {
std::string m_ipaddr;
void init(int32_t sockBufferSize = 0);
- void clearNagle(int32_t sock);
- int32_t setSize(int32_t sock, int32_t flag, int32_t size);
- int32_t getSize(int32_t sock, int32_t flag);
+ void clearNagle(ACE_HANDLE sock);
+ int32_t setSize(ACE_HANDLE sock, int32_t flag, int32_t size);
+ int32_t getSize(ACE_HANDLE sock, int32_t flag);
public:
TcpIpc(std::string& ipaddr, int32_t sockBufferSize = 0) : m_ipaddr(ipaddr) {
diff --git a/tests/cpp/security/CMakeLists.txt b/tests/cpp/security/CMakeLists.txt
index d1a6252..498008d 100644
--- a/tests/cpp/security/CMakeLists.txt
+++ b/tests/cpp/security/CMakeLists.txt
@@ -46,6 +46,7 @@ target_link_libraries(${PROJECT_NAME}
ssl
PRIVATE
ACE
+ _WarningsAsError
)
# For Visual Studio organization
diff --git a/tests/cpp/security/PkcsAuthInit.cpp b/tests/cpp/security/PkcsAuthInit.cpp
index c53e1ca..61e6eee 100644
--- a/tests/cpp/security/PkcsAuthInit.cpp
+++ b/tests/cpp/security/PkcsAuthInit.cpp
@@ -63,16 +63,15 @@ uint8_t* createSignature(EVP_PKEY* key, X509* cert,
if (key == NULL || cert == NULL || inputBuffer == NULL) {
return NULL;
}
- const ASN1_OBJECT *macobj;
- const X509_ALGOR *algorithm = nullptr;
+ const ASN1_OBJECT* macobj;
+ const X509_ALGOR* algorithm = nullptr;
X509_ALGOR_get0(&macobj, NULL, NULL, algorithm);
const EVP_MD* signatureDigest = EVP_get_digestbyobj(macobj);
EVP_MD_CTX* signatureCtx = EVP_MD_CTX_new();
uint8_t* signatureData = new uint8_t[EVP_PKEY_size(key)];
- bool result =
- (EVP_SignInit_ex(signatureCtx, signatureDigest, NULL) &&
- EVP_SignUpdate(signatureCtx, inputBuffer, inputBufferLen) &&
- EVP_SignFinal(signatureCtx, signatureData, signatureLen, key));
+ bool result = (EVP_SignInit_ex(signatureCtx, signatureDigest, NULL) &&
+ EVP_SignUpdate(signatureCtx, inputBuffer, inputBufferLen) &&
+ EVP_SignFinal(signatureCtx, signatureData, signatureLen, key));
EVP_MD_CTX_free(signatureCtx);
if (result) {
return signatureData;
@@ -185,8 +184,8 @@ std::shared_ptr<Properties> PKCSAuthInitInternal::getCredentials(
unsigned int lengthEncryptedData = 0;
uint8_t* signatureData = createSignature(
- privateKey, cert, reinterpret_cast<const unsigned char*>(alias), strlen(alias),
- &lengthEncryptedData);
+ privateKey, cert, reinterpret_cast<const unsigned char*>(alias),
+ static_cast<uint32_t>(strlen(alias)), &lengthEncryptedData);
EVP_PKEY_free(privateKey);
X509_free(cert);
if (signatureData == NULL) {
@@ -202,8 +201,8 @@ std::shared_ptr<Properties> PKCSAuthInitInternal::getCredentials(
LOGINFO(" Converting CREDS to STRING: %s",
signatureValPtr->toString().c_str());
} else {
- signatureValPtr = CacheableBytes::create(
- std::vector<int8_t>(signatureData, signatureData + lengthEncryptedData));
+ signatureValPtr = CacheableBytes::create(std::vector<int8_t>(
+ signatureData, signatureData + lengthEncryptedData));
LOGINFO(" Converting CREDS to BYTES: %s",
signatureValPtr->toString().c_str());
}
diff --git a/tests/cpp/testobject/CMakeLists.txt b/tests/cpp/testobject/CMakeLists.txt
index f548149..b318261 100644
--- a/tests/cpp/testobject/CMakeLists.txt
+++ b/tests/cpp/testobject/CMakeLists.txt
@@ -86,6 +86,7 @@ target_link_libraries(${PROJECT_NAME}
fwk
PRIVATE
ACE
+ _WarningsAsError
)
# For Visual Studio organization
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..5867a2f 100644
--- a/tests/cpp/testobject/NonPdxType.hpp
+++ b/tests/cpp/testobject/NonPdxType.hpp
@@ -88,7 +88,7 @@ enum pdxEnumTest { pdx1, pdx2, pdx3 };
class TESTOBJECT_EXPORT NonPdxType {
public:
- char m_char;
+ char16_t m_char;
bool m_bool;
int8_t m_byte;
int8_t m_sbyte; //
@@ -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.