changeset 6428:55e1cbf851ab

cppcheck 2.1
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 18 Nov 2025 14:52:10 +0100
parents 0ccd0688fc99
children 2d5910d39c47
files OrthancFramework/Sources/DicomParsing/ParsedDicomFile.cpp OrthancFramework/Sources/JobsEngine/JobsRegistry.cpp OrthancServer/Resources/RunCppCheck-2.1.sh OrthancServer/Sources/ServerJobs/StorageCommitmentScpJob.cpp
diffstat 4 files changed, 14 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/OrthancFramework/Sources/DicomParsing/ParsedDicomFile.cpp	Tue Nov 18 14:40:16 2025 +0100
+++ b/OrthancFramework/Sources/DicomParsing/ParsedDicomFile.cpp	Tue Nov 18 14:52:10 2025 +0100
@@ -1696,15 +1696,20 @@
   {
     DcmDataset* dcmDataset = GetDcmtkObjectConst().getDataset();
 
-    if (!this->HasTag(DICOM_TAG_PIXEL_DATA) && !DicomImageDecoder::IsPsmctRle1(*dcmDataset))
+    if (dcmDataset == NULL)
     {
-      throw OrthancException(ErrorCode_BadRequest, "Cannot extract a frame from a DIOCM file that does not have pixel data.");
+      throw OrthancException(ErrorCode_InternalError);
+    }
+
+    if (!this->HasTag(DICOM_TAG_PIXEL_DATA) &&
+        !DicomImageDecoder::IsPsmctRle1(*dcmDataset))
+    {
+      throw OrthancException(ErrorCode_BadRequest, "Cannot extract a frame from a DICOM file that does not have pixel data.");
     }
 
     if (pimpl_->frameIndex_.get() == NULL)
     {
-      assert(pimpl_->file_ != NULL && dcmDataset != NULL);
-
+      assert(pimpl_->file_ != NULL);
       pimpl_->frameIndex_.reset(new DicomFrameIndex(*dcmDataset));
     }
 
--- a/OrthancFramework/Sources/JobsEngine/JobsRegistry.cpp	Tue Nov 18 14:40:16 2025 +0100
+++ b/OrthancFramework/Sources/JobsEngine/JobsRegistry.cpp	Tue Nov 18 14:52:10 2025 +0100
@@ -369,7 +369,7 @@
           serialized.isMember(ERROR_PAYLOAD))
       {
         const std::string type = SerializationToolbox::ReadString(serialized, ERROR_PAYLOAD_TYPE);
-        lastStatus_.GetErrorPayload().SetContent(StringToErrorPayloadType(type.c_str()), serialized[ERROR_PAYLOAD]);
+        lastStatus_.GetErrorPayload().SetContent(StringToErrorPayloadType(type), serialized[ERROR_PAYLOAD]);
       }
 
       job_->Start();
--- a/OrthancServer/Resources/RunCppCheck-2.1.sh	Tue Nov 18 14:40:16 2025 +0100
+++ b/OrthancServer/Resources/RunCppCheck-2.1.sh	Tue Nov 18 14:52:10 2025 +0100
@@ -13,7 +13,7 @@
 knownArgument:../../OrthancFramework/UnitTestsSources/ImageTests.cpp
 knownConditionTrueFalse:../../OrthancServer/Plugins/Engine/OrthancPlugins.cpp
 nullPointer:../../OrthancFramework/UnitTestsSources/RestApiTests.cpp:322
-stlFindInsert:../../OrthancFramework/Sources/DicomFormat/DicomMap.cpp:1525
+stlFindInsert:../../OrthancFramework/Sources/DicomFormat/DicomMap.cpp:1535
 stlFindInsert:../../OrthancFramework/Sources/RestApi/RestApiCallDocumentation.cpp:166
 stlFindInsert:../../OrthancFramework/Sources/RestApi/RestApiCallDocumentation.cpp:74
 stlFindInsert:../../OrthancServer/Sources/Database/MainDicomTagsRegistry.cpp:65
@@ -24,7 +24,7 @@
 syntaxError:../../OrthancFramework/Sources/SQLite/FunctionContext.h:53
 syntaxError:../../OrthancFramework/UnitTestsSources/DicomMapTests.cpp:74
 syntaxError:../../OrthancFramework/UnitTestsSources/ZipTests.cpp:133
-syntaxError:../../OrthancServer/UnitTestsSources/UnitTestsMain.cpp:322
+syntaxError:../../OrthancServer/UnitTestsSources/UnitTestsMain.cpp:325
 uninitMemberVar:../../OrthancServer/Sources/ServerJobs/StorageCommitmentScpJob.cpp:417
 unreadVariable:../../OrthancFramework/Sources/FileStorage/StorageAccessor.cpp
 unreadVariable:../../OrthancServer/Sources/OrthancRestApi/OrthancRestModalities.cpp:1173
@@ -36,7 +36,7 @@
 assertWithSideEffect:../../OrthancServer/Plugins/Engine/OrthancPluginDatabase.cpp:1026
 assertWithSideEffect:../../OrthancServer/Sources/Database/Compatibility/DatabaseLookup.cpp:292
 assertWithSideEffect:../../OrthancServer/Sources/Database/Compatibility/DatabaseLookup.cpp:391
-assertWithSideEffect:../../OrthancServer/Sources/Database/StatelessDatabaseOperations.cpp:3066
+assertWithSideEffect:../../OrthancServer/Sources/Database/StatelessDatabaseOperations.cpp:3068
 assertWithSideEffect:../../OrthancServer/Sources/ServerJobs/ResourceModificationJob.cpp:286
 assertWithSideEffect:../../OrthancFramework/Sources/DicomNetworking/Internals/CommandDispatcher.cpp:454
 EOF
--- a/OrthancServer/Sources/ServerJobs/StorageCommitmentScpJob.cpp	Tue Nov 18 14:40:16 2025 +0100
+++ b/OrthancServer/Sources/ServerJobs/StorageCommitmentScpJob.cpp	Tue Nov 18 14:52:10 2025 +0100
@@ -187,7 +187,6 @@
     explicit Unserializer(StorageCommitmentScpJob& that) :
       that_(that)
     {
-      that_.ready_ = false;
     }
 
     virtual ICommand* Unserialize(const Json::Value& source) const ORTHANC_OVERRIDE
@@ -420,9 +419,9 @@
                                                    const Json::Value& serialized) :
     SetOfCommandsJob(new Unserializer(*this), serialized),
     context_(context),
+    ready_(false),
     transactionUid_(SerializationToolbox::ReadString(serialized, TRANSACTION_UID)),
     calledAet_(SerializationToolbox::ReadString(serialized, CALLED_AET))
-    // "ready_" is initialized by the unserializer
   {
     if (serialized.type() != Json::objectValue ||
         !serialized.isMember(REMOTE_MODALITY))