# HG changeset patch # User Sebastien Jodogne # Date 1779346789 -7200 # Node ID 460330d630bc91eecffbeda734ea5cdd7bbaf268 # Parent bee76cdf2497a41f586072abdfb6108a4f1eee2a# Parent 13f0f6dda96d348770a3099b71151e24d5a05636 integration mainline->streaming diff -r bee76cdf2497 -r 460330d630bc OrthancFramework/Sources/DicomFormat/DicomImageInformation.cpp --- a/OrthancFramework/Sources/DicomFormat/DicomImageInformation.cpp Thu May 21 08:41:43 2026 +0200 +++ b/OrthancFramework/Sources/DicomFormat/DicomImageInformation.cpp Thu May 21 08:59:49 2026 +0200 @@ -31,6 +31,7 @@ #include "DicomImageInformation.h" #include "../Compatibility.h" +#include "../Constants.h" #include "../Logging.h" #include "../OrthancException.h" #include "../SerializationToolbox.h" @@ -43,8 +44,8 @@ #include static const uint64_t MAX_FRAME_SIZE = (sizeof(void*) == 4 - ? 1ull * 1024ull * 1024ull * 1024ull // 1 GB on 32 bits system - : 4ull * 1024ull * 1024ull * 1024ull); // 4 GB on 64 bits system + ? 1 * Orthanc::GIGABYTE // 1 GB on 32 bits system + : 4 * Orthanc::GIGABYTE); // 4 GB on 64 bits system namespace Orthanc diff -r bee76cdf2497 -r 460330d630bc OrthancFramework/Sources/DicomParsing/Internals/DicomImageDecoder.cpp --- a/OrthancFramework/Sources/DicomParsing/Internals/DicomImageDecoder.cpp Thu May 21 08:41:43 2026 +0200 +++ b/OrthancFramework/Sources/DicomParsing/Internals/DicomImageDecoder.cpp Thu May 21 08:59:49 2026 +0200 @@ -70,13 +70,14 @@ =========================================================================*/ -#include "../../Logging.h" -#include "../../OrthancException.h" +#include "../../Constants.h" +#include "../../DicomFormat/DicomIntegerPixelAccessor.h" #include "../../Images/Image.h" #include "../../Images/ImageProcessing.h" -#include "../../DicomFormat/DicomIntegerPixelAccessor.h" +#include "../../Logging.h" +#include "../../OrthancException.h" +#include "../FromDcmtkBridge.h" #include "../ToDcmtkBridge.h" -#include "../FromDcmtkBridge.h" #if ORTHANC_ENABLE_PNG == 1 # include "../../Images/PngWriter.h" @@ -124,8 +125,8 @@ #endif static const uint64_t MAX_DECODED_FRAME_SIZE = (sizeof(void*) == 4 - ? 1ull * 1024ull * 1024ull * 1024ull // 1 GB on 32 bits system - : 4ull * 1024ull * 1024ull * 1024ull); // 4 GB on 64 bits system + ? 1 * Orthanc::GIGABYTE // 1 GB on 32 bits system + : 4 * Orthanc::GIGABYTE); // 4 GB on 64 bits system namespace Orthanc diff -r bee76cdf2497 -r 460330d630bc OrthancFramework/Sources/DicomParsing/ParsedDicomFile.cpp --- a/OrthancFramework/Sources/DicomParsing/ParsedDicomFile.cpp Thu May 21 08:41:43 2026 +0200 +++ b/OrthancFramework/Sources/DicomParsing/ParsedDicomFile.cpp Thu May 21 08:59:49 2026 +0200 @@ -77,6 +77,7 @@ #include "Internals/DicomImageDecoder.h" #include "ToDcmtkBridge.h" +#include "../Constants.h" #include "../DicomFormat/DicomImageInformation.h" #include "../Images/Image.h" #include "../Images/ImageProcessing.h" @@ -147,8 +148,8 @@ #endif static const uint64_t MAX_OVERLAY_SIZE = (sizeof(void*) == 4 - ? 1ull * 1024ull * 1024ull * 1024ull // 1 GB on 32 bits system - : 4ull * 1024ull * 1024ull * 1024ull); // 4 GB on 64 bits system + ? 1 * Orthanc::GIGABYTE // 1 GB on 32 bits system + : 4 * Orthanc::GIGABYTE); // 4 GB on 64 bits system namespace Orthanc diff -r bee76cdf2497 -r 460330d630bc OrthancFramework/Sources/Images/JpegReader.cpp --- a/OrthancFramework/Sources/Images/JpegReader.cpp Thu May 21 08:41:43 2026 +0200 +++ b/OrthancFramework/Sources/Images/JpegReader.cpp Thu May 21 08:59:49 2026 +0200 @@ -25,17 +25,18 @@ #include "../PrecompiledHeaders.h" #include "JpegReader.h" -#include "JpegErrorManager.h" +#include "../Constants.h" +#include "../Logging.h" #include "../OrthancException.h" -#include "../Logging.h" +#include "JpegErrorManager.h" #if ORTHANC_SANDBOXED == 0 # include "../SystemToolbox.h" #endif static const uint64_t MAX_DECODED_JPEG_IMAGE_SIZE = (sizeof(void*) == 4 - ? 1ull * 1024ull * 1024ull * 1024ull // 1 GB on 32 bits system - : 4ull * 1024ull * 1024ull * 1024ull); // 4 GB on 64 bits system + ? 1 * Orthanc::GIGABYTE // 1 GB on 32 bits system + : 4 * Orthanc::GIGABYTE); // 4 GB on 64 bits system namespace Orthanc { diff -r bee76cdf2497 -r 460330d630bc OrthancFramework/Sources/Images/PamReader.cpp --- a/OrthancFramework/Sources/Images/PamReader.cpp Thu May 21 08:41:43 2026 +0200 +++ b/OrthancFramework/Sources/Images/PamReader.cpp Thu May 21 08:59:49 2026 +0200 @@ -25,6 +25,7 @@ #include "../PrecompiledHeaders.h" #include "PamReader.h" +#include "../Constants.h" #include "../Endianness.h" #include "../Logging.h" #include "../OrthancException.h" @@ -40,8 +41,8 @@ #include static const uint64_t MAX_PAM_IMAGE_BUFFER_SIZE = (sizeof(void*) == 4 - ? 1ull * 1024ull * 1024ull * 1024ull // 1 GB on 32 bits system - : 4ull * 1024ull * 1024ull * 1024ull); // 4 GB on 64 bits system + ? 1 * Orthanc::GIGABYTE // 1 GB on 32 bits system + : 4 * Orthanc::GIGABYTE); // 4 GB on 64 bits system namespace Orthanc diff -r bee76cdf2497 -r 460330d630bc OrthancFramework/Sources/Images/PngReader.cpp --- a/OrthancFramework/Sources/Images/PngReader.cpp Thu May 21 08:41:43 2026 +0200 +++ b/OrthancFramework/Sources/Images/PngReader.cpp Thu May 21 08:59:49 2026 +0200 @@ -25,6 +25,7 @@ #include "../PrecompiledHeaders.h" #include "PngReader.h" +#include "../Constants.h" #include "../OrthancException.h" #include "../Toolbox.h" @@ -39,8 +40,8 @@ static const uint64_t MAX_DECODED_PNG_IMAGE_SIZE = (sizeof(void*) == 4 - ? 1ull * 1024ull * 1024ull * 1024ull // 1 GB on 32 bits system - : 4ull * 1024ull * 1024ull * 1024ull); // 4 GB on 64 bits system + ? 1 * Orthanc::GIGABYTE // 1 GB on 32 bits system + : 4 * Orthanc::GIGABYTE); // 4 GB on 64 bits system namespace Orthanc diff -r bee76cdf2497 -r 460330d630bc OrthancFramework/UnitTestsSources/ToolboxTests.cpp --- a/OrthancFramework/UnitTestsSources/ToolboxTests.cpp Thu May 21 08:41:43 2026 +0200 +++ b/OrthancFramework/UnitTestsSources/ToolboxTests.cpp Thu May 21 08:59:49 2026 +0200 @@ -405,8 +405,8 @@ TEST(Toolbox, GetHumanTransferSpeed) { ASSERT_EQ("8.00Mbps", Toolbox::GetHumanTransferSpeed(false, 1000, 1000000)); - ASSERT_EQ("8.59Gbps", Toolbox::GetHumanTransferSpeed(false, 1024ull*1024*1024, 1000000000)); - ASSERT_EQ("1.00GB in 1.00s = 8.59Gbps", Toolbox::GetHumanTransferSpeed(true, 1024ull*1024*1024, 1000000000)); + ASSERT_EQ("8.59Gbps", Toolbox::GetHumanTransferSpeed(false, KILOBYTE*1024*1024, 1000000000)); + ASSERT_EQ("1.00GB in 1.00s = 8.59Gbps", Toolbox::GetHumanTransferSpeed(true, KILOBYTE*1024*1024, 1000000000)); ASSERT_EQ("976.56KB in 1.00s = 8.00Mbps", Toolbox::GetHumanTransferSpeed(true, 1000ull*1000, 1000000000)); } @@ -483,5 +483,19 @@ { // Make sure that "16 * GIGABYTE" is not casted to a size_t on 32bit architectures ASSERT_EQ(static_cast(16) * GIGABYTE, 16ull * 1024ull * 1024ull * 1024ull); + ASSERT_EQ(GIGABYTE * static_cast(16), 16ull * 1024ull * 1024ull * 1024ull); + ASSERT_EQ(GIGABYTE * 16, 16ull * 1024ull * 1024ull * 1024ull); + ASSERT_EQ(16 * GIGABYTE, 16ull * 1024ull * 1024ull * 1024ull); + + ASSERT_EQ(static_cast(16 * 1024) * MEGABYTE, 16ull * 1024ull * 1024ull * 1024ull); + ASSERT_EQ(MEGABYTE * static_cast(16 * 1024), 16ull * 1024ull * 1024ull * 1024ull); + ASSERT_EQ(static_cast(16 * 1024 * 1024) * KILOBYTE, 16ull * 1024ull * 1024ull * 1024ull); + ASSERT_EQ(KILOBYTE * static_cast(16 * 1024 * 1024), 16ull * 1024ull * 1024ull * 1024ull); + ASSERT_EQ(8, sizeof(static_cast(16) * GIGABYTE)); + ASSERT_EQ(8, sizeof(GIGABYTE * static_cast(16))); + ASSERT_EQ(8, sizeof(static_cast(16 * 1024) * MEGABYTE)); + ASSERT_EQ(8, sizeof(MEGABYTE * static_cast(16 * 1024))); + ASSERT_EQ(8, sizeof(static_cast(16 * 1024 * 1024) * KILOBYTE)); + ASSERT_EQ(8, sizeof(KILOBYTE * static_cast(16 * 1024 * 1024))); } diff -r bee76cdf2497 -r 460330d630bc OrthancServer/Sources/OrthancRestApi/OrthancRestResources.cpp diff -r bee76cdf2497 -r 460330d630bc OrthancServer/Sources/ServerJobs/OrthancPeerStoreJob.cpp diff -r bee76cdf2497 -r 460330d630bc OrthancServer/Sources/main.cpp