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:31 UTC

[geode-native] 05/15: .NET 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 8455c24cb40c35402f913c312ce2af13a727878e
Author: Jacob Barrett <jb...@pivotal.io>
AuthorDate: Wed Mar 28 19:08:24 2018 +0000

    .NET warning free.
---
 clicache/src/CacheableHashSet.hpp                  |  6 ++---
 clicache/src/CacheableObject.cpp                   |  2 +-
 clicache/src/CacheableObjectXml.cpp                |  4 +--
 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 +
 26 files changed, 65 insertions(+), 71 deletions(-)

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 e775dc8..7215219 100644
--- a/clicache/src/CacheableObject.cpp
+++ b/clicache/src/CacheableObject.cpp
@@ -57,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 91b45b5..15a60bd 100644
--- a/clicache/src/CacheableObjectXml.cpp
+++ b/clicache/src/CacheableObjectXml.cpp
@@ -58,7 +58,7 @@ namespace Apache
           xs.Serialize(%dos, m_obj);
           m_objectSize = dos.Length - checkpoint;
 
-          auto size = stat_cast<uint32_t>(m_objectSize);
+          auto size = static_cast<uint32_t>(m_objectSize);
 
           output->RewindCursor(size + 4);
           output->WriteInt32(size);
@@ -85,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/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}")

-- 
To stop receiving notification emails like this one, please contact
jbarrett@apache.org.