changeset 6773:f26e2a26060f

clang-tidy (cont)
author Alain Mazy <am@orthanc.team>
date Tue, 12 May 2026 14:39:52 +0200
parents eabb2b485437
children 283317a0effa
files OrthancFramework/Sources/Cache/MemoryObjectCache.cpp OrthancFramework/Sources/Cache/MemoryStringCache.cpp OrthancFramework/Sources/ChunkedBuffer.cpp OrthancFramework/Sources/Compression/GzipCompressor.cpp OrthancFramework/Sources/Compression/ZipReader.cpp OrthancFramework/Sources/Compression/ZipWriter.cpp OrthancFramework/Sources/DicomFormat/DicomIntegerPixelAccessor.cpp OrthancFramework/Sources/DicomNetworking/Internals/DicomTls.cpp OrthancFramework/Sources/DicomParsing/FromDcmtkBridge.cpp OrthancFramework/Sources/DicomParsing/ParsedDicomFile.cpp OrthancFramework/Sources/HttpServer/FilesystemHttpSender.cpp OrthancFramework/Sources/HttpServer/HttpServer.cpp OrthancFramework/Sources/HttpServer/MultipartStreamReader.cpp OrthancFramework/Sources/Images/Font.cpp OrthancFramework/Sources/Images/ImageAccessor.cpp OrthancFramework/Sources/Images/ImageProcessing.cpp OrthancFramework/Sources/Images/PngWriter.cpp OrthancFramework/Sources/JobsEngine/SetOfCommandsJob.cpp OrthancFramework/Sources/SystemToolbox.cpp OrthancFramework/UnitTestsSources/FromDcmtkTests.cpp OrthancFramework/UnitTestsSources/ImageProcessingTests.cpp OrthancFramework/UnitTestsSources/RestApiTests.cpp OrthancFramework/UnitTestsSources/ZipTests.cpp OrthancServer/Plugins/Engine/OrthancPluginDatabaseV3.cpp OrthancServer/Resources/orthanc.clang-tidy OrthancServer/Sources/Database/Compatibility/GenericFind.cpp OrthancServer/Sources/OrthancRestApi/OrthancRestResources.cpp OrthancServer/Sources/OrthancRestApi/OrthancRestSystem.cpp OrthancServer/Sources/Search/DatabaseLookup.cpp OrthancServer/Sources/ServerContext.cpp OrthancServer/Sources/ServerJobs/OrthancPeerStoreJob.cpp OrthancServer/UnitTestsSources/UnitTestsMain.cpp
diffstat 32 files changed, 46 insertions(+), 45 deletions(-) [+]
line wrap: on
line diff
--- a/OrthancFramework/Sources/Cache/MemoryObjectCache.cpp	Mon May 11 19:41:52 2026 +0200
+++ b/OrthancFramework/Sources/Cache/MemoryObjectCache.cpp	Tue May 12 14:39:52 2026 +0200
@@ -90,7 +90,7 @@
 
   MemoryObjectCache::MemoryObjectCache() :
     currentSize_(0),
-    maxSize_(100 * 1024 * 1024)  // 100 MB
+    maxSize_(static_cast<size_t>(100) * 1024 * 1024)  // 100 MB
   {
   }
 
--- a/OrthancFramework/Sources/Cache/MemoryStringCache.cpp	Mon May 11 19:41:52 2026 +0200
+++ b/OrthancFramework/Sources/Cache/MemoryStringCache.cpp	Tue May 12 14:39:52 2026 +0200
@@ -113,7 +113,7 @@
 
   MemoryStringCache::MemoryStringCache() :
     currentSize_(0),
-    maxSize_(100 * 1024 * 1024)  // 100 MB
+    maxSize_(static_cast<size_t>(100) * 1024 * 1024)  // 100 MB
   {
   }
 
--- a/OrthancFramework/Sources/ChunkedBuffer.cpp	Mon May 11 19:41:52 2026 +0200
+++ b/OrthancFramework/Sources/ChunkedBuffer.cpp	Tue May 12 14:39:52 2026 +0200
@@ -92,7 +92,7 @@
     numBytes_(0),
     pendingPos_(0)
   {
-    pendingBuffer_.resize(16 * 1024);  // Default size of the pending buffer: 16KB
+    pendingBuffer_.resize(static_cast<size_t>(16) * 1024);  // Default size of the pending buffer: 16KB
   }
 
 
--- a/OrthancFramework/Sources/Compression/GzipCompressor.cpp	Mon May 11 19:41:52 2026 +0200
+++ b/OrthancFramework/Sources/Compression/GzipCompressor.cpp	Tue May 12 14:39:52 2026 +0200
@@ -258,7 +258,7 @@
       GzipRaii raii(stream);
 
       std::string chunk;
-      chunk.resize(10 * 1024 * 1024); // Read by chunks of 10MB
+      chunk.resize(static_cast<size_t>(10) * 1024 * 1024); // Read by chunks of 10MB
 
       int ret = Z_OK;
 
--- a/OrthancFramework/Sources/Compression/ZipReader.cpp	Mon May 11 19:41:52 2026 +0200
+++ b/OrthancFramework/Sources/Compression/ZipReader.cpp	Tue May 12 14:39:52 2026 +0200
@@ -348,7 +348,7 @@
     ChunkedBuffer buffer;
 
     std::string chunk;
-    chunk.resize(10 * 1024 * 1024); // Read by chunks of 10MB
+    chunk.resize(static_cast<size_t>(10) * 1024 * 1024); // Read by chunks of 10MB
 
     for (;;)
     {
--- a/OrthancFramework/Sources/Compression/ZipWriter.cpp	Mon May 11 19:41:52 2026 +0200
+++ b/OrthancFramework/Sources/Compression/ZipWriter.cpp	Tue May 12 14:39:52 2026 +0200
@@ -62,9 +62,9 @@
   ptime midnight(today);
 
   time_duration sinceMidnight = now - midnight;
-  zfi.tmz_date.tm_sec = static_cast<unsigned int>(sinceMidnight.seconds());  // seconds after the minute - [0,59]
-  zfi.tmz_date.tm_min = static_cast<unsigned int>(sinceMidnight.minutes());  // minutes after the hour - [0,59]
-  zfi.tmz_date.tm_hour = static_cast<unsigned int>(sinceMidnight.hours());  // hours since midnight - [0,23]
+  zfi.tmz_date.tm_sec = static_cast<int>(sinceMidnight.seconds());  // seconds after the minute - [0,59]
+  zfi.tmz_date.tm_min = static_cast<int>(sinceMidnight.minutes());  // minutes after the hour - [0,59]
+  zfi.tmz_date.tm_hour = static_cast<int>(sinceMidnight.hours());  // hours since midnight - [0,23]
 
   // http://www.boost.org/doc/libs/1_35_0/doc/html/boost/gregorian/greg_day.html
   zfi.tmz_date.tm_mday = today.day();  // day of the month - [1,31]
--- a/OrthancFramework/Sources/DicomFormat/DicomIntegerPixelAccessor.cpp	Mon May 11 19:41:52 2026 +0200
+++ b/OrthancFramework/Sources/DicomFormat/DicomIntegerPixelAccessor.cpp	Tue May 12 14:39:52 2026 +0200
@@ -185,7 +185,7 @@
          * ..., G1, G2, G3, ..., B1, B2, B3, etc.
          **/
         assert(frameOffset_ % information_.GetChannelCount() == 0);
-        pixel += channel * frameOffset_ / information_.GetChannelCount() + x * information_.GetBytesPerValue();
+        pixel += static_cast<size_t>(channel) * frameOffset_ / information_.GetChannelCount() + static_cast<size_t>(x) * information_.GetBytesPerValue();
       }
       else
       {
@@ -195,7 +195,7 @@
          * means the order of the pixel values sent shall be R1, G1, B1,
          * R2, G2, B2, ..., etc.
          **/
-        pixel += channel * information_.GetBytesPerValue() + x * information_.GetChannelCount() * information_.GetBytesPerValue();
+        pixel += static_cast<size_t>(channel) * information_.GetBytesPerValue() + static_cast<size_t>(x) * information_.GetChannelCount() * information_.GetBytesPerValue();
       }
 
       uint32_t v;
--- a/OrthancFramework/Sources/DicomNetworking/Internals/DicomTls.cpp	Mon May 11 19:41:52 2026 +0200
+++ b/OrthancFramework/Sources/DicomNetworking/Internals/DicomTls.cpp	Tue May 12 14:39:52 2026 +0200
@@ -25,7 +25,7 @@
 #include "../../PrecompiledHeaders.h"
 #include "DicomTls.h"
 
-
+// NOLINTBEGIN(bugprone-reserved-identifier)
 // This must be *before* the inclusion of "Logging.h"
 #if defined(__ORTHANC_FILE__)
 // Prevents the system-wide DCMTK library from leaking the
@@ -33,7 +33,7 @@
 #  undef __FILE__
 #  define __FILE__ __ORTHANC_FILE__
 #endif
-
+// NOLINTEND(bugprone-reserved-identifier)
 
 #include "../../Logging.h"
 #include "../../OrthancException.h"
--- a/OrthancFramework/Sources/DicomParsing/FromDcmtkBridge.cpp	Mon May 11 19:41:52 2026 +0200
+++ b/OrthancFramework/Sources/DicomParsing/FromDcmtkBridge.cpp	Tue May 12 14:39:52 2026 +0200
@@ -233,7 +233,7 @@
         {
           // since we cannot report "unlimited", let's claim that we can still write 10MB.
           // Note that offile_off_t is a signed type.
-          return 10 * 1024 * 1024;
+          return static_cast<offile_off_t>(10) * 1024 * 1024;
         }
 
         offile_off_t write(const void *buf,
--- a/OrthancFramework/Sources/DicomParsing/ParsedDicomFile.cpp	Mon May 11 19:41:52 2026 +0200
+++ b/OrthancFramework/Sources/DicomParsing/ParsedDicomFile.cpp	Tue May 12 14:39:52 2026 +0200
@@ -239,7 +239,7 @@
         offset_(0),
         chunkSize_(0)
       {
-        static const size_t CHUNK_SIZE = 64 * 1024;  // Use chunks of max 64KB
+        static const size_t CHUNK_SIZE = static_cast<size_t>(64) * 1024;  // Use chunks of max 64KB
         chunk_.resize(CHUNK_SIZE);
       }
 
--- a/OrthancFramework/Sources/HttpServer/FilesystemHttpSender.cpp	Mon May 11 19:41:52 2026 +0200
+++ b/OrthancFramework/Sources/HttpServer/FilesystemHttpSender.cpp	Tue May 12 14:39:52 2026 +0200
@@ -27,7 +27,7 @@
 #include "../OrthancException.h"
 #include "../SystemToolbox.h"
 
-static const size_t  CHUNK_SIZE = 64 * 1024;   // Use 64KB chunks
+static const size_t CHUNK_SIZE = static_cast<size_t>(64) * 1024;   // Use 64KB chunks
 
 namespace Orthanc
 {
--- a/OrthancFramework/Sources/HttpServer/HttpServer.cpp	Mon May 11 19:41:52 2026 +0200
+++ b/OrthancFramework/Sources/HttpServer/HttpServer.cpp	Tue May 12 14:39:52 2026 +0200
@@ -510,7 +510,7 @@
     FileBuffer buffer;
 
     uint64_t readSoFar = 0;
-    std::string tmp(1024 * 1024, 0);
+    std::string tmp(static_cast<size_t>(1024) * 1024, 0);
 
     for (;;)
     {
@@ -550,7 +550,7 @@
                                                   bool hasMaxBodySize,
                                                   size_t maxBodySize)
   {
-    static const size_t MAXIMUM_BODY_SIZE_IN_MEMORY = 100 * 1024 * 1024;  // 100MB
+    static const size_t MAXIMUM_BODY_SIZE_IN_MEMORY = static_cast<size_t>(100) * 1024 * 1024;  // 100MB
 
     assert(!hasMaxBodySize || maxBodySize > 0);
 
@@ -685,7 +685,7 @@
     else
     {
       // No Content-Length: This is a chunked transfer. Stream the HTTP connection.
-      std::string tmp(1024 * 1024, 0);
+      std::string tmp(static_cast<size_t>(1024) * 1024, 0);
       
       for (;;)
       {
--- a/OrthancFramework/Sources/HttpServer/MultipartStreamReader.cpp	Mon May 11 19:41:52 2026 +0200
+++ b/OrthancFramework/Sources/HttpServer/MultipartStreamReader.cpp	Tue May 12 14:39:52 2026 +0200
@@ -246,7 +246,7 @@
     handler_(NULL),
     headersMatcher_("\r\n\r\n"),
     boundaryMatcher_("--" + boundary),
-    blockSize_(10 * 1024 * 1024)
+    blockSize_(static_cast<size_t>(10) * 1024 * 1024)
   {
   }
 
--- a/OrthancFramework/Sources/Images/Font.cpp	Mon May 11 19:41:52 2026 +0200
+++ b/OrthancFramework/Sources/Images/Font.cpp	Tue May 12 14:39:52 2026 +0200
@@ -194,7 +194,7 @@
 
     for (unsigned int cy = top; cy < height; cy++)
     {
-      uint8_t* p = reinterpret_cast<uint8_t*>(target.GetRow(y + cy)) + (x + left) * bpp;
+      uint8_t* p = reinterpret_cast<uint8_t*>(target.GetRow(y + cy)) + static_cast<size_t>(x + left) * bpp;
       unsigned int pos = cy * character.width_ + left;
 
       switch (target.GetFormat())
--- a/OrthancFramework/Sources/Images/ImageAccessor.cpp	Mon May 11 19:41:52 2026 +0200
+++ b/OrthancFramework/Sources/Images/ImageAccessor.cpp	Tue May 12 14:39:52 2026 +0200
@@ -56,7 +56,7 @@
         s = "; ";
       }
 
-      s.reserve(width * 8);
+      s.reserve(static_cast<size_t>(width) * 8);
 
       for (unsigned int x = 0; x < width; x++, p++)
       {
@@ -85,7 +85,7 @@
       const uint8_t* p = reinterpret_cast<const uint8_t*>(source.GetConstRow(y));
       
       std::string s;
-      s.reserve(width * 3 * 8);
+      s.reserve(static_cast<size_t>(width) * 3 * 8);
       
       for (unsigned int x = 0; x < 3 * width; x++, p++)
       {
--- a/OrthancFramework/Sources/Images/ImageProcessing.cpp	Mon May 11 19:41:52 2026 +0200
+++ b/OrthancFramework/Sources/Images/ImageProcessing.cpp	Tue May 12 14:39:52 2026 +0200
@@ -213,7 +213,7 @@
   static void MemsetZeroInternal(ImageAccessor& image)
   {
     const unsigned int height = image.GetHeight();
-    const size_t lineSize = image.GetBytesPerPixel() * image.GetWidth();
+    const size_t lineSize = static_cast<size_t>(image.GetBytesPerPixel()) * image.GetWidth();
     const size_t pitch = image.GetPitch();
 
     uint8_t *p = reinterpret_cast<uint8_t*>(image.GetBuffer());
--- a/OrthancFramework/Sources/Images/PngWriter.cpp	Mon May 11 19:41:52 2026 +0200
+++ b/OrthancFramework/Sources/Images/PngWriter.cpp	Tue May 12 14:39:52 2026 +0200
@@ -141,7 +141,7 @@
       rows_.resize(height);
       for (unsigned int y = 0; y < height; y++)
       {
-        rows_[y] = const_cast<uint8_t*>(reinterpret_cast<const uint8_t*>(buffer)) + y * pitch;
+        rows_[y] = const_cast<uint8_t*>(reinterpret_cast<const uint8_t*>(buffer)) + static_cast<size_t>(y) * pitch;
       }
 
       switch (format)
--- a/OrthancFramework/Sources/JobsEngine/SetOfCommandsJob.cpp	Mon May 11 19:41:52 2026 +0200
+++ b/OrthancFramework/Sources/JobsEngine/SetOfCommandsJob.cpp	Tue May 12 14:39:52 2026 +0200
@@ -304,8 +304,8 @@
         {
           commands_[i] = unserializer->Unserialize(tmp[i]);
         }
-        catch (OrthancException&)
-        {
+        catch (OrthancException&) // NOLINT(bugprone-empty-catch)
+        { // ignore the command if it cannot be unserialized
         }
 
         if (commands_[i] == NULL)
--- a/OrthancFramework/Sources/SystemToolbox.cpp	Mon May 11 19:41:52 2026 +0200
+++ b/OrthancFramework/Sources/SystemToolbox.cpp	Tue May 12 14:39:52 2026 +0200
@@ -169,7 +169,7 @@
     barrierEvent_ = ServerBarrierEvent_Stop;
     while (!(*stopFlag || finish_))
     {
-      SystemToolbox::USleep(100 * 1000);
+      SystemToolbox::USleep(100ull * 1000ull);
     }
 
 #if defined(_WIN32)
--- a/OrthancFramework/UnitTestsSources/FromDcmtkTests.cpp	Mon May 11 19:41:52 2026 +0200
+++ b/OrthancFramework/UnitTestsSources/FromDcmtkTests.cpp	Tue May 12 14:39:52 2026 +0200
@@ -986,7 +986,7 @@
     {
       const void* a = image.GetConstRow(y);
       const void* b = decoded->GetConstRow(y);
-      ASSERT_EQ(0, memcmp(a, b, 3 * 384));
+      ASSERT_EQ(0, memcmp(a, b, static_cast<size_t>(3) * 384));
     }
   }
 }
--- a/OrthancFramework/UnitTestsSources/ImageProcessingTests.cpp	Mon May 11 19:41:52 2026 +0200
+++ b/OrthancFramework/UnitTestsSources/ImageProcessingTests.cpp	Tue May 12 14:39:52 2026 +0200
@@ -301,7 +301,7 @@
 {
   ImageAccessor& image = this->GetImage();
   
-  memset(image.GetBuffer(), 128, image.GetHeight() * image.GetWidth());
+  memset(image.GetBuffer(), 128, static_cast<size_t>(image.GetHeight()) * image.GetWidth());
 
   switch (image.GetFormat())
   {
@@ -338,7 +338,7 @@
 {
   ImageAccessor& image = this->GetImage();
   
-  memset(image.GetBuffer(), 128, image.GetHeight() * image.GetWidth());
+  memset(image.GetBuffer(), 128, static_cast<size_t>(image.GetHeight()) * image.GetWidth());
 
   float c = 0.0f;
   for (unsigned int y = 0; y < image.GetHeight(); y++)
--- a/OrthancFramework/UnitTestsSources/RestApiTests.cpp	Mon May 11 19:41:52 2026 +0200
+++ b/OrthancFramework/UnitTestsSources/RestApiTests.cpp	Tue May 12 14:39:52 2026 +0200
@@ -1165,7 +1165,7 @@
 
 TEST(ChunkedBuffer, DISABLED_Large)
 {
-  const size_t LARGE = 60 * 1024 * 1024;
+  const size_t LARGE = static_cast<size_t>(60) * 1024 * 1024;
   
   ChunkedBuffer b;
   for (size_t i = 0; i < LARGE; i++)
@@ -1342,7 +1342,7 @@
   w.SetUrl("http://localhost:5000");
 
   // This is slow in Orthanc <= 1.5.8 (issue 156)
-  TotoBody body(600 * 1024 * 1024, 6 * 1024 * 1024 - 17);
+  TotoBody body(static_cast<size_t>(600) * 1024 * 1024, static_cast<size_t>(6) * 1024 * 1024 - 17);
   
   HttpClient c(w, "toto");
   c.SetMethod(HttpMethod_Post);
@@ -1370,7 +1370,7 @@
   w.SetUrl("http://localhost:5000");
 
   // This crashes Orthanc 1.6.0 to 1.7.2 
-  TotoBody body(32 * 1024, 1);  
+  TotoBody body(static_cast<size_t>(32) * 1024, static_cast<size_t>(1));  
   
   HttpClient c(w, "toto");
   c.SetMethod(HttpMethod_Post);
--- a/OrthancFramework/UnitTestsSources/ZipTests.cpp	Mon May 11 19:41:52 2026 +0200
+++ b/OrthancFramework/UnitTestsSources/ZipTests.cpp	Tue May 12 14:39:52 2026 +0200
@@ -236,7 +236,7 @@
   std::string memory;
 
   std::string large;
-  large.resize(4 * 65536);
+  large.resize(static_cast<size_t>(4) * 65536);
   for (size_t i = 0; i < large.size(); i++)
   {
     large[i] = static_cast<char>(rand() % 256);
--- a/OrthancServer/Plugins/Engine/OrthancPluginDatabaseV3.cpp	Mon May 11 19:41:52 2026 +0200
+++ b/OrthancServer/Plugins/Engine/OrthancPluginDatabaseV3.cpp	Tue May 12 14:39:52 2026 +0200
@@ -36,13 +36,15 @@
 
 #include <cassert>
 
-
+// NOLINTBEGIN(bugprone-macro-parentheses)
 #define CHECK_FUNCTION_EXISTS(backend, func)                            \
   if (backend.func == NULL)                                             \
   {                                                                     \
     throw OrthancException(                                             \
       ErrorCode_DatabasePlugin, "Missing primitive: " #func "()");      \
   }
+// NOLINTEND(bugprone-macro-parentheses)
+
 
 namespace Orthanc
 {
--- a/OrthancServer/Resources/orthanc.clang-tidy	Mon May 11 19:41:52 2026 +0200
+++ b/OrthancServer/Resources/orthanc.clang-tidy	Tue May 12 14:39:52 2026 +0200
@@ -12,7 +12,6 @@
   -bugprone-easily-swappable-parameters,
   -bugprone-branch-clone,
   -bugprone-suspicious-include,
-  -bugprone-implicit-widening-of-multiplication-result,
   -bugprone-exception-escape,
   -performance-*,
   -readability-*,
--- a/OrthancServer/Sources/Database/Compatibility/GenericFind.cpp	Mon May 11 19:41:52 2026 +0200
+++ b/OrthancServer/Sources/Database/Compatibility/GenericFind.cpp	Tue May 12 14:39:52 2026 +0200
@@ -133,7 +133,7 @@
         }
         else if (request.GetLimitsCount() != 0)
         {
-          compatibilityTransaction_.GetAllPublicIdsCompatibility(identifiers, request.GetLevel(), request.GetLimitsSince(), request.GetLimitsCount());
+          compatibilityTransaction_.GetAllPublicIdsCompatibility(identifiers, request.GetLevel(), static_cast<int64_t>(request.GetLimitsSince()), request.GetLimitsCount());
         }
         else
         {
--- a/OrthancServer/Sources/OrthancRestApi/OrthancRestResources.cpp	Mon May 11 19:41:52 2026 +0200
+++ b/OrthancServer/Sources/OrthancRestApi/OrthancRestResources.cpp	Tue May 12 14:39:52 2026 +0200
@@ -1683,7 +1683,7 @@
       return;
     }
 
-    static const uint64_t MEGA_BYTES = 1024 * 1024;
+    static const uint64_t MEGA_BYTES = 1024ull * 1024ull;
 
     std::string publicId = call.GetUriComponent("id", "");
 
--- a/OrthancServer/Sources/OrthancRestApi/OrthancRestSystem.cpp	Mon May 11 19:41:52 2026 +0200
+++ b/OrthancServer/Sources/OrthancRestApi/OrthancRestSystem.cpp	Tue May 12 14:39:52 2026 +0200
@@ -241,7 +241,7 @@
       return;
     }
 
-    static const uint64_t MEGA_BYTES = 1024 * 1024;
+    static const uint64_t MEGA_BYTES = 1024ull * 1024ull;
 
     uint64_t diskSize, uncompressedSize, countPatients, countStudies, countSeries, countInstances;
     OrthancRestApi::GetIndex(call).GetGlobalStatistics(diskSize, uncompressedSize, countPatients, 
--- a/OrthancServer/Sources/Search/DatabaseLookup.cpp	Mon May 11 19:41:52 2026 +0200
+++ b/OrthancServer/Sources/Search/DatabaseLookup.cpp	Tue May 12 14:39:52 2026 +0200
@@ -361,7 +361,7 @@
       if (constraints_[i]->GetTag() == tag)
       {
         delete constraints_[i];
-        constraints_.erase(constraints_.begin() + i);
+        constraints_.erase(constraints_.begin() + static_cast<std::vector<DicomTagConstraint*>::difference_type>(i));
       }
     }
   }
--- a/OrthancServer/Sources/ServerContext.cpp	Mon May 11 19:41:52 2026 +0200
+++ b/OrthancServer/Sources/ServerContext.cpp	Tue May 12 14:39:52 2026 +0200
@@ -64,7 +64,7 @@
 #  include <malloc.h>
 #endif
 
-static size_t DICOM_CACHE_SIZE = 128 * 1024 * 1024;  // 128 MB
+static size_t DICOM_CACHE_SIZE = static_cast<size_t>(128) * 1024 * 1024;  // 128 MB
 
 
 /**
@@ -133,7 +133,7 @@
         // (see OrthancServer/Resources/ImplementationNotes/memory_consumption.txt)
         {
           MetricsRegistry::Timer timer(that->GetMetricsRegistry(), "orthanc_memory_trimming_duration_ms");
-          malloc_trim(128*1024);
+          malloc_trim(static_cast<size_t>(128) * 1024);
         }
         lastExecution = boost::posix_time::second_clock::universal_time();
       }
@@ -1547,7 +1547,7 @@
 
       // Release the throttle if loading "small" DICOM files (under
       // 50MB, which is an arbitrary value)
-      if (buffer_.size() < 50 * 1024 * 1024)
+      if (buffer_.size() < static_cast<size_t>(50) * 1024 * 1024)
       {
         largeDicomLocker_.reset(NULL);
       }
--- a/OrthancServer/Sources/ServerJobs/OrthancPeerStoreJob.cpp	Mon May 11 19:41:52 2026 +0200
+++ b/OrthancServer/Sources/ServerJobs/OrthancPeerStoreJob.cpp	Tue May 12 14:39:52 2026 +0200
@@ -241,7 +241,7 @@
       value["Transcode"] = GetTransferSyntaxUid(transferSyntax_);
     }
 
-    static const uint64_t MEGA_BYTES = 1024 * 1024;
+    static const uint64_t MEGA_BYTES = 1024ull * 1024ull;
     value["Size"] = boost::lexical_cast<std::string>(size_);
     value["SizeMB"] = static_cast<unsigned int>(size_ / MEGA_BYTES);
   }
--- a/OrthancServer/UnitTestsSources/UnitTestsMain.cpp	Mon May 11 19:41:52 2026 +0200
+++ b/OrthancServer/UnitTestsSources/UnitTestsMain.cpp	Tue May 12 14:39:52 2026 +0200
@@ -131,7 +131,7 @@
 TEST(FontRegistry, Basic)
 {
   Orthanc::Image s(Orthanc::PixelFormat_RGB24, 640, 480, false);
-  memset(s.GetBuffer(), 0, s.GetPitch() * s.GetHeight());
+  memset(s.GetBuffer(), 0, static_cast<size_t>(s.GetPitch()) * s.GetHeight());
 
   {
     Orthanc::OrthancConfiguration::ReaderLock lock;