changeset 1545:33d34bc4ac15

fix msvc warnings
author jodogne
date Thu, 13 Aug 2015 21:02:31 +0200
parents 4d0e2c38d15b
children 17a3814fd8a1
files Core/Compression/GzipCompressor.cpp Core/Compression/ZlibCompressor.cpp Core/HttpServer/HttpStreamTranscoder.cpp Core/Lua/LuaContext.cpp OrthancServer/LuaScripting.cpp OrthancServer/OrthancInitialization.cpp OrthancServer/Scheduler/ServerScheduler.cpp Plugins/Engine/OrthancPluginDatabase.cpp Plugins/Engine/OrthancPlugins.cpp UnitTestsSources/RestApiTests.cpp UnitTestsSources/StreamTests.cpp UnitTestsSources/VersionsTests.cpp
diffstat 12 files changed, 25 insertions(+), 19 deletions(-) [+]
line wrap: on
line diff
--- a/Core/Compression/GzipCompressor.cpp	Thu Aug 13 20:39:30 2015 +0200
+++ b/Core/Compression/GzipCompressor.cpp	Thu Aug 13 21:02:31 2015 +0200
@@ -198,7 +198,7 @@
 
     try
     {
-      uncompressed.resize(uncompressedSize);
+      uncompressed.resize(static_cast<size_t>(uncompressedSize));
     }
     catch (...)
     {
--- a/Core/Compression/ZlibCompressor.cpp	Thu Aug 13 20:39:30 2015 +0200
+++ b/Core/Compression/ZlibCompressor.cpp	Thu Aug 13 21:02:31 2015 +0200
@@ -124,14 +124,14 @@
     
     try
     {
-      uncompressed.resize(uncompressedSize);
+      uncompressed.resize(static_cast<size_t>(uncompressedSize));
     }
     catch (...)
     {
       throw OrthancException(ErrorCode_NotEnoughMemory);
     }
 
-    uLongf tmp = uncompressedSize;
+    uLongf tmp = static_cast<uLongf>(uncompressedSize);
     int error = uncompress
       (reinterpret_cast<uint8_t*>(&uncompressed[0]), 
        &tmp,
--- a/Core/HttpServer/HttpStreamTranscoder.cpp	Thu Aug 13 20:39:30 2015 +0200
+++ b/Core/HttpServer/HttpStreamTranscoder.cpp	Thu Aug 13 21:02:31 2015 +0200
@@ -186,7 +186,7 @@
         throw OrthancException(ErrorCode_CorruptedFile);
       }
 
-      size_t remaining = bytesToSkip_ - skipped_;
+      size_t remaining = static_cast<size_t>(bytesToSkip_ - skipped_);
       size_t s = source_.GetChunkSize();
 
       if (s < remaining)
@@ -242,7 +242,7 @@
     }
     else
     {
-      return source_.GetChunkSize() - currentChunkOffset_;
+      return static_cast<size_t>(source_.GetChunkSize() - currentChunkOffset_);
     }
   }
 }
--- a/Core/Lua/LuaContext.cpp	Thu Aug 13 20:39:30 2015 +0200
+++ b/Core/Lua/LuaContext.cpp	Thu Aug 13 21:02:31 2015 +0200
@@ -176,7 +176,7 @@
     {
       httpClient_.Apply(str);
     }
-    catch (OrthancException& e)
+    catch (OrthancException&)
     {
       return false;
     }
--- a/OrthancServer/LuaScripting.cpp	Thu Aug 13 20:39:30 2015 +0200
+++ b/OrthancServer/LuaScripting.cpp	Thu Aug 13 21:02:31 2015 +0200
@@ -81,7 +81,7 @@
     }
 
     const char* uri = lua_tostring(state, 1);
-    bool builtin = (nArgs == 2 ? lua_toboolean(state, 2) : false);
+    bool builtin = (nArgs == 2 ? lua_toboolean(state, 2) != 0 : false);
 
     std::string result;
     if (HttpToolbox::SimpleGet(result, serverContext->GetHttpHandler().RestrictToOrthancRestApi(builtin), uri))
@@ -124,7 +124,7 @@
     const char* uri = lua_tostring(state, 1);
     size_t bodySize = 0;
     const char* bodyData = lua_tolstring(state, 2, &bodySize);
-    bool builtin = (nArgs == 3 ? lua_toboolean(state, 3) : false);
+    bool builtin = (nArgs == 3 ? lua_toboolean(state, 3) != 0 : false);
 
     std::string result;
     if (isPost ?
@@ -182,7 +182,7 @@
     }
 
     const char* uri = lua_tostring(state, 1);
-    bool builtin = (nArgs == 2 ? lua_toboolean(state, 2) : false);
+    bool builtin = (nArgs == 2 ? lua_toboolean(state, 2) != 0 : false);
 
     if (HttpToolbox::SimpleDelete(serverContext->GetHttpHandler().RestrictToOrthancRestApi(builtin), uri))
     {
--- a/OrthancServer/OrthancInitialization.cpp	Thu Aug 13 20:39:30 2015 +0200
+++ b/OrthancServer/OrthancInitialization.cpp	Thu Aug 13 21:02:31 2015 +0200
@@ -422,7 +422,7 @@
     {
       modality.FromJson(modalities[name]);
     }
-    catch (OrthancException& e)
+    catch (OrthancException&)
     {
       LOG(ERROR) << "Syntax error in the definition of DICOM modality \"" << name 
                  << "\". Please check your configuration file.";
@@ -455,7 +455,7 @@
 
       peer.FromJson(modalities[name]);
     }
-    catch (OrthancException& e)
+    catch (OrthancException&)
     {
       LOG(ERROR) << "Syntax error in the definition of peer \"" << name 
                  << "\". Please check your configuration file.";
--- a/OrthancServer/Scheduler/ServerScheduler.cpp	Thu Aug 13 20:39:30 2015 +0200
+++ b/OrthancServer/Scheduler/ServerScheduler.cpp	Thu Aug 13 21:02:31 2015 +0200
@@ -329,7 +329,7 @@
 
     if (job->second.size_ == 1)
     {
-      return job->second.success_;
+      return static_cast<float>(job->second.success_);
     }
 
     return (static_cast<float>(job->second.success_) / 
--- a/Plugins/Engine/OrthancPluginDatabase.cpp	Thu Aug 13 20:39:30 2015 +0200
+++ b/Plugins/Engine/OrthancPluginDatabase.cpp	Thu Aug 13 21:02:31 2015 +0200
@@ -543,7 +543,7 @@
       throw OrthancException(ErrorCode_Plugin);
     }
 
-    return existing;
+    return (existing != 0);
   }
 
 
@@ -556,7 +556,7 @@
       throw OrthancException(ErrorCode_Plugin);
     }
 
-    return isProtected;
+    return (isProtected != 0);
   }
 
 
--- a/Plugins/Engine/OrthancPlugins.cpp	Thu Aug 13 20:39:30 2015 +0200
+++ b/Plugins/Engine/OrthancPlugins.cpp	Thu Aug 13 21:02:31 2015 +0200
@@ -1191,7 +1191,7 @@
 
         try
         {
-          content.resize(size);
+          content.resize(static_cast<size_t>(size));
         }
         catch (OrthancException&)
         {
@@ -1201,7 +1201,7 @@
 
         if (size > 0)
         {
-          memcpy(&content[0], buffer, size);
+          memcpy(&content[0], buffer, static_cast<size_t>(size));
         }
 
         Free(buffer);
--- a/UnitTestsSources/RestApiTests.cpp	Thu Aug 13 20:39:30 2015 +0200
+++ b/UnitTestsSources/RestApiTests.cpp	Thu Aug 13 21:02:31 2015 +0200
@@ -70,7 +70,7 @@
 }
 
 
-#if UNIT_TESTS_WITH_HTTP_CONNEXIONS == 1
+#if UNIT_TESTS_WITH_HTTP_CONNEXIONS == 1 && ORTHANC_SSL_ENABLED == 1
 
 /**
    The HTTPS CA certificates for BitBucket were extracted as follows:
--- a/UnitTestsSources/StreamTests.cpp	Thu Aug 13 20:39:30 2015 +0200
+++ b/UnitTestsSources/StreamTests.cpp	Thu Aug 13 21:02:31 2015 +0200
@@ -183,7 +183,7 @@
 {
   stream.SetupHttpCompression(allowGzip, allowDeflate);
 
-  result.resize(stream.GetContentLength());
+  result.resize(static_cast<size_t>(stream.GetContentLength()));
 
   size_t pos = 0;
   while (stream.ReadNextChunk())
--- a/UnitTestsSources/VersionsTests.cpp	Thu Aug 13 20:39:30 2015 +0200
+++ b/UnitTestsSources/VersionsTests.cpp	Thu Aug 13 21:02:31 2015 +0200
@@ -42,7 +42,10 @@
 #include <boost/version.hpp>
 #include <sqlite3.h>
 #include <lua.h>
+
+#if ORTHANC_SSL_ENABLED == 1
 #include <openssl/opensslv.h>
+#endif
 
 
 TEST(Versions, Zlib)
@@ -118,7 +121,7 @@
   curl_version_info_data * vinfo = curl_version_info(CURLVERSION_NOW);
 
   // Check that SSL support is enabled when required
-  bool curlSupportsSsl = vinfo->features & CURL_VERSION_SSL;
+  bool curlSupportsSsl = (vinfo->features & CURL_VERSION_SSL) != 0;
 
 #if ORTHANC_SSL_ENABLED == 0
   ASSERT_FALSE(curlSupportsSsl);
@@ -132,10 +135,13 @@
   ASSERT_STREQ("Lua 5.1.5", LUA_RELEASE);
 }
 
+
+#if ORTHANC_SSL_ENABLED == 1
 TEST(Version, OpenSslStatic)
 {
   ASSERT_EQ(0x1000204fL /* openssl-1.0.2d */, OPENSSL_VERSION_NUMBER);
 }
+#endif
 
 
 #include <json/version.h>