# HG changeset patch # User Sebastien Jodogne # Date 1614009083 -3600 # Node ID a3c6678aa7b194aacc347d68eae13eaaae069594 # Parent cb8fcecf1b02bff621d0a43f03efbbf89ec7cfd7 cppcheck diff -r cb8fcecf1b02 -r a3c6678aa7b1 OrthancFramework/Sources/DicomParsing/MemoryBufferTranscoder.cpp --- a/OrthancFramework/Sources/DicomParsing/MemoryBufferTranscoder.cpp Mon Feb 22 16:32:11 2021 +0100 +++ b/OrthancFramework/Sources/DicomParsing/MemoryBufferTranscoder.cpp Mon Feb 22 16:51:23 2021 +0100 @@ -41,7 +41,6 @@ // Debug mode ParsedDicomFile parsed(transcoded); - std::string s; DicomTransferSyntax a, b; if (!const_cast(parsed).LookupTransferSyntax(b) || !FromDcmtkBridge::LookupOrthancTransferSyntax(a, parsed.GetDcmtkObject()) || diff -r cb8fcecf1b02 -r a3c6678aa7b1 OrthancFramework/Sources/FileStorage/FileInfo.cpp --- a/OrthancFramework/Sources/FileStorage/FileInfo.cpp Mon Feb 22 16:32:11 2021 +0100 +++ b/OrthancFramework/Sources/FileStorage/FileInfo.cpp Mon Feb 22 16:51:23 2021 +0100 @@ -27,6 +27,16 @@ namespace Orthanc { + FileInfo::FileInfo() : + valid_(false), + contentType_(FileContentType_Unknown), + uncompressedSize_(0), + compressionType_(CompressionType_None), + compressedSize_(0) + { + } + + FileInfo::FileInfo(const std::string& uuid, FileContentType contentType, uint64_t size, diff -r cb8fcecf1b02 -r a3c6678aa7b1 OrthancFramework/Sources/FileStorage/FileInfo.h --- a/OrthancFramework/Sources/FileStorage/FileInfo.h Mon Feb 22 16:32:11 2021 +0100 +++ b/OrthancFramework/Sources/FileStorage/FileInfo.h Mon Feb 22 16:51:23 2021 +0100 @@ -42,10 +42,7 @@ std::string compressedMD5_; public: - FileInfo() : - valid_(false) - { - } + FileInfo(); /** * Constructor for an uncompressed attachment. diff -r cb8fcecf1b02 -r a3c6678aa7b1 OrthancFramework/UnitTestsSources/FromDcmtkTests.cpp --- a/OrthancFramework/UnitTestsSources/FromDcmtkTests.cpp Mon Feb 22 16:32:11 2021 +0100 +++ b/OrthancFramework/UnitTestsSources/FromDcmtkTests.cpp Mon Feb 22 16:51:23 2021 +0100 @@ -1310,7 +1310,6 @@ { DicomMap summary; f.ExtractDicomSummary(summary, 256); - std::string s; ASSERT_EQ("1314310016", summary.GetStringValue(DicomTag(0x0010, 0x9431), "nope", false)); } diff -r cb8fcecf1b02 -r a3c6678aa7b1 OrthancServer/Resources/RunCppCheck.sh --- a/OrthancServer/Resources/RunCppCheck.sh Mon Feb 22 16:32:11 2021 +0100 +++ b/OrthancServer/Resources/RunCppCheck.sh Mon Feb 22 16:51:23 2021 +0100 @@ -14,17 +14,17 @@ knownConditionTrueFalse:../../OrthancServer/Plugins/Engine/OrthancPlugins.cpp nullPointer:../../OrthancFramework/UnitTestsSources/RestApiTests.cpp:319 nullPointerRedundantCheck:../../OrthancFramework/UnitTestsSources/DicomMapTests.cpp -stlFindInsert:../../OrthancFramework/Sources/DicomFormat/DicomMap.cpp:1163 +stlFindInsert:../../OrthancFramework/Sources/DicomFormat/DicomMap.cpp:1194 stlFindInsert:../../OrthancFramework/Sources/RestApi/RestApiCallDocumentation.cpp:164 stlFindInsert:../../OrthancFramework/Sources/RestApi/RestApiCallDocumentation.cpp:72 stlFindInsert:../../OrthancServer/Sources/OrthancWebDav.cpp:385 stlFindInsert:../../OrthancServer/Sources/ServerIndex.cpp:400 syntaxError:../../OrthancFramework/Sources/SQLite/FunctionContext.h:50 syntaxError:../../OrthancFramework/UnitTestsSources/ZipTests.cpp:130 -syntaxError:../../OrthancServer/UnitTestsSources/UnitTestsMain.cpp:319 +syntaxError:../../OrthancServer/UnitTestsSources/UnitTestsMain.cpp:321 uninitMemberVar:../../OrthancServer/Sources/ServerJobs/StorageCommitmentScpJob.cpp:427 unreadVariable:../../OrthancFramework/Sources/FileStorage/StorageAccessor.cpp -unreadVariable:../../OrthancServer/Sources/OrthancRestApi/OrthancRestModalities.cpp:1108 +unreadVariable:../../OrthancServer/Sources/OrthancRestApi/OrthancRestModalities.cpp:1121 unusedFunction useInitializationList:../../OrthancFramework/Sources/Images/PngReader.cpp:89 useInitializationList:../../OrthancServer/Sources/ServerJobs/DicomModalityStoreJob.cpp:285 diff -r cb8fcecf1b02 -r a3c6678aa7b1 OrthancServer/Sources/DicomInstanceToStore.cpp --- a/OrthancServer/Sources/DicomInstanceToStore.cpp Mon Feb 22 16:32:11 2021 +0100 +++ b/OrthancServer/Sources/DicomInstanceToStore.cpp Mon Feb 22 16:51:23 2021 +0100 @@ -102,7 +102,7 @@ } public: - FromParsedDicomFile(ParsedDicomFile& parsed) : + explicit FromParsedDicomFile(ParsedDicomFile& parsed) : parsed_(parsed) { } @@ -151,7 +151,7 @@ } public: - FromDcmDataset(DcmDataset& dataset) : + explicit FromDcmDataset(DcmDataset& dataset) : dataset_(dataset) { } diff -r cb8fcecf1b02 -r a3c6678aa7b1 OrthancServer/Sources/OrthancRestApi/OrthancRestApi.cpp --- a/OrthancServer/Sources/OrthancRestApi/OrthancRestApi.cpp Mon Feb 22 16:32:11 2021 +0100 +++ b/OrthancServer/Sources/OrthancRestApi/OrthancRestApi.cpp Mon Feb 22 16:51:23 2021 +0100 @@ -64,7 +64,7 @@ static void SetupResourceAnswer(Json::Value& result, - DicomInstanceToStore& instance, + const DicomInstanceToStore& instance, StoreStatus status, const std::string& instanceId) { diff -r cb8fcecf1b02 -r a3c6678aa7b1 OrthancServer/Sources/ServerContext.cpp --- a/OrthancServer/Sources/ServerContext.cpp Mon Feb 22 16:32:11 2021 +0100 +++ b/OrthancServer/Sources/ServerContext.cpp Mon Feb 22 16:51:23 2021 +0100 @@ -586,7 +586,7 @@ FileInfo dicomUntilPixelData; if (hasPixelDataOffset && (!area_.HasReadRange() || - compression != CompressionType_None)) + compressionEnabled_)) { dicomUntilPixelData = accessor.Write(dicom.GetBufferData(), pixelDataOffset, FileContentType_DicomUntilPixelData, compression, storeMD5_); @@ -856,7 +856,7 @@ **/ bool hasPixelDataOffset; - uint64_t pixelDataOffset; + uint64_t pixelDataOffset = 0; // dummy initialization { std::string s; @@ -902,9 +902,11 @@ * "true". **/ - StorageAccessor accessor(area_, GetMetricsRegistry()); - std::unique_ptr dicom( - area_.ReadRange(attachment.GetUuid(), FileContentType_Dicom, 0, pixelDataOffset)); + std::unique_ptr dicom; + { + MetricsRegistry::Timer timer(GetMetricsRegistry(), "orthanc_storage_read_range_duration_ms"); + dicom.reset(area_.ReadRange(attachment.GetUuid(), FileContentType_Dicom, 0, pixelDataOffset)); + } if (dicom.get() == NULL) { @@ -973,7 +975,7 @@ boost::lexical_cast(pixelDataOffset)); if (!area_.HasReadRange() || - compressionEnabled_ != CompressionType_None) + compressionEnabled_) { AddAttachment(instancePublicId, FileContentType_DicomUntilPixelData, dicom.empty() ? NULL: dicom.c_str(), pixelDataOffset);