# HG changeset patch # User Sebastien Jodogne # Date 1748593804 -7200 # Node ID 66609557a7ee888fd8c007b19b31c13805360923 # Parent 9d94f67447531079a247621576385e2b1b78e4da cppcheck and safeguard for 32bit architectures diff -r 9d94f6744753 -r 66609557a7ee OrthancFramework/Sources/DicomFormat/DicomImageInformation.cpp --- a/OrthancFramework/Sources/DicomFormat/DicomImageInformation.cpp Tue May 20 10:28:02 2025 +0200 +++ b/OrthancFramework/Sources/DicomFormat/DicomImageInformation.cpp Fri May 30 10:30:04 2025 +0200 @@ -566,7 +566,7 @@ { // Check out "../../../OrthancServer/Resources/ImplementationNotes/windowing.py" - float windowWidth = std::abs(window.GetWidth()); + double windowWidth = std::abs(window.GetWidth()); // Avoid divisions by zero static const double MIN = 0.0001; diff -r 9d94f6744753 -r 66609557a7ee OrthancFramework/Sources/DicomFormat/DicomStreamReader.cpp --- a/OrthancFramework/Sources/DicomFormat/DicomStreamReader.cpp Tue May 20 10:28:02 2025 +0200 +++ b/OrthancFramework/Sources/DicomFormat/DicomStreamReader.cpp Fri May 30 10:30:04 2025 +0200 @@ -672,7 +672,7 @@ reader.Consume(visitor); isLittleEndian = reader.IsLittleEndian(); } - catch (OrthancException& e) + catch (OrthancException&) { // Invalid DICOM file return false; diff -r 9d94f6744753 -r 66609557a7ee OrthancFramework/Sources/FileStorage/FilesystemStorage.cpp --- a/OrthancFramework/Sources/FileStorage/FilesystemStorage.cpp Tue May 20 10:28:02 2025 +0200 +++ b/OrthancFramework/Sources/FileStorage/FilesystemStorage.cpp Fri May 30 10:30:04 2025 +0200 @@ -176,7 +176,7 @@ LOG(INFO) << "Created attachment \"" << uuid << "\" (" << timer.GetHumanTransferSpeed(true, size) << ")"; return; } - catch (OrthancException& e) + catch (OrthancException&) { if (retryCount >= maxRetryCount) { diff -r 9d94f6744753 -r 66609557a7ee OrthancFramework/Sources/FileStorage/MemoryStorageArea.cpp --- a/OrthancFramework/Sources/FileStorage/MemoryStorageArea.cpp Tue May 20 10:28:02 2025 +0200 +++ b/OrthancFramework/Sources/FileStorage/MemoryStorageArea.cpp Fri May 30 10:30:04 2025 +0200 @@ -113,6 +113,12 @@ } else { + const uint64_t size = end - start; + if (static_cast(static_cast(size)) != size) + { + throw OrthancException(ErrorCode_InternalError, "Buffer larger than 4GB, which is too large for Orthanc running in 32bits"); + } + Mutex::ScopedLock lock(mutex_); Content::const_iterator found = content_.find(uuid); @@ -132,7 +138,7 @@ else { std::string range; - range.resize(end - start); + range.resize(static_cast(size)); assert(!range.empty()); memcpy(&range[0], &found->second[start], range.size()); diff -r 9d94f6744753 -r 66609557a7ee OrthancFramework/Sources/HttpServer/HttpContentNegociation.h --- a/OrthancFramework/Sources/HttpServer/HttpContentNegociation.h Tue May 20 10:28:02 2025 +0200 +++ b/OrthancFramework/Sources/HttpServer/HttpContentNegociation.h Fri May 30 10:30:04 2025 +0200 @@ -75,7 +75,7 @@ }; - struct Reference; + class Reference; typedef std::vector Tokens; typedef std::list Handlers; diff -r 9d94f6744753 -r 66609557a7ee OrthancFramework/Sources/MallocMemoryBuffer.cpp --- a/OrthancFramework/Sources/MallocMemoryBuffer.cpp Tue May 20 10:28:02 2025 +0200 +++ b/OrthancFramework/Sources/MallocMemoryBuffer.cpp Fri May 30 10:30:04 2025 +0200 @@ -76,7 +76,7 @@ } buffer_ = buffer; - size_ = size; + size_ = static_cast(size); free_ = freeFunction; if (size_ != 0 && diff -r 9d94f6744753 -r 66609557a7ee OrthancFramework/Sources/SerializationToolbox.cpp --- a/OrthancFramework/Sources/SerializationToolbox.cpp Tue May 20 10:28:02 2025 +0200 +++ b/OrthancFramework/Sources/SerializationToolbox.cpp Fri May 30 10:30:04 2025 +0200 @@ -188,10 +188,11 @@ { ReadArrayOfStrings(target, arr); } - catch (OrthancException& ex) - { // more detailed error + catch (OrthancException&) + { + // more detailed error throw OrthancException(ErrorCode_BadFileFormat, - "List of strings expected in field: " + field); + "List of strings expected in field: " + field); } }