You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by jb...@apache.org on 2018/03/29 11:41:30 UTC
[geode-native] 04/15: clicache warning free
This is an automated email from the ASF dual-hosted git repository.
jbarrett pushed a commit to branch feature/GEODE-4946-msvc-warn
in repository https://gitbox.apache.org/repos/asf/geode-native.git
commit d67d649e87fcb7abaf220db09a87ac0aa54c8c7c
Author: Jacob Barrett <jb...@pivotal.io>
AuthorDate: Tue Mar 27 20:27:18 2018 +0000
clicache warning free
---
clicache/src/CMakeLists.txt | 1 +
clicache/src/Cache.cpp | 3 +--
clicache/src/CacheableObject.cpp | 11 ++++++-----
clicache/src/CacheableObjectXml.cpp | 12 +++++++-----
clicache/src/CqAttributes.cpp | 2 +-
clicache/src/DataInput.cpp | 26 +++++++++++++-------------
clicache/src/DataInput.hpp | 26 +++++++++++++-------------
7 files changed, 42 insertions(+), 39 deletions(-)
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/CacheableObject.cpp b/clicache/src/CacheableObject.cpp
index 1b15069..e775dc8 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);
}
}
diff --git a/clicache/src/CacheableObjectXml.cpp b/clicache/src/CacheableObjectXml.cpp
index ca1b99f..91b45b5 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 = stat_cast<uint32_t>(m_objectSize);
+
+ output->RewindCursor(size + 4);
+ output->WriteInt32(size);
+ output->AdvanceCursor(size);
}
}
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;
--
To stop receiving notification emails like this one, please contact
jbarrett@apache.org.