# HG changeset patch # User Benjamin Golinvaux # Date 1558074978 -7200 # Node ID 596cfabd72c5dc9851572b00cbb1ec216fbcfc11 # Parent 05881bf99c83bac2f9c6b1b95add0ce12e30787d Fixed a couple of truncation warnings diff -r 05881bf99c83 -r 596cfabd72c5 Core/Compression/GzipCompressor.cpp --- a/Core/Compression/GzipCompressor.cpp Thu May 16 12:31:47 2019 +0200 +++ b/Core/Compression/GzipCompressor.cpp Fri May 17 08:36:18 2019 +0200 @@ -91,7 +91,9 @@ const void* uncompressed, size_t uncompressedSize) { - uLongf compressedSize = compressBound(uncompressedSize) + 1024 /* security margin */; + uLongf compressedSize = compressBound(static_cast(uncompressedSize)) + + 1024 /* security margin */; + if (compressedSize == 0) { compressedSize = 1; diff -r 05881bf99c83 -r 596cfabd72c5 Core/Compression/ZlibCompressor.cpp --- a/Core/Compression/ZlibCompressor.cpp Thu May 16 12:31:47 2019 +0200 +++ b/Core/Compression/ZlibCompressor.cpp Fri May 17 08:36:18 2019 +0200 @@ -53,7 +53,8 @@ return; } - uLongf compressedSize = compressBound(uncompressedSize) + 1024 /* security margin */; + uLongf compressedSize = compressBound(static_cast(uncompressedSize)) + + 1024 /* security margin */; if (compressedSize == 0) { compressedSize = 1; @@ -74,7 +75,7 @@ int error = compress2(target, &compressedSize, const_cast(static_cast(uncompressed)), - uncompressedSize, + static_cast(uncompressedSize), GetCompressionLevel()); if (error != Z_OK) @@ -137,7 +138,7 @@ (reinterpret_cast(&uncompressed[0]), &tmp, reinterpret_cast(compressed) + sizeof(uint64_t), - compressedSize - sizeof(uint64_t)); + static_cast(compressedSize - sizeof(uint64_t))); if (error != Z_OK) { diff -r 05881bf99c83 -r 596cfabd72c5 Core/Images/JpegReader.cpp --- a/Core/Images/JpegReader.cpp Thu May 16 12:31:47 2019 +0200 +++ b/Core/Images/JpegReader.cpp Fri May 17 08:36:18 2019 +0200 @@ -161,12 +161,15 @@ { jpeg_destroy_decompress(&cinfo); throw OrthancException(ErrorCode_InternalError, - "Error during JPEG decoding: " + jerr.GetMessage()); + "Error during JPEG decoding: " + jerr.GetMessage()); } // Below this line, we are under the scope of a "setjmp" jpeg_create_decompress(&cinfo); - jpeg_mem_src(&cinfo, const_cast(reinterpret_cast(buffer)), size); + jpeg_mem_src(&cinfo, + const_cast( + reinterpret_cast(buffer)), + static_cast(size)); try { diff -r 05881bf99c83 -r 596cfabd72c5 Core/MetricsRegistry.cpp --- a/Core/MetricsRegistry.cpp Thu May 16 12:31:47 2019 +0200 +++ b/Core/MetricsRegistry.cpp Fri May 17 08:36:18 2019 +0200 @@ -322,7 +322,8 @@ if (active_) { boost::posix_time::time_duration diff = GetNow() - start_; - registry_.SetValue(name_, diff.total_milliseconds(), type_); + registry_.SetValue( + name_, static_cast(diff.total_milliseconds()), type_); } } }