changeset 5897:2fc5667633e6 find-refactoring

cppcheck
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 03 Dec 2024 14:12:17 +0100
parents 9b039f4b1421
children 76f84b76bc74
files OrthancFramework/Sources/FileStorage/FilesystemStorage.cpp OrthancServer/Plugins/Engine/OrthancPluginDatabaseV4.cpp OrthancServer/Resources/RunCppCheck.sh OrthancServer/Sources/Database/FindResponse.h OrthancServer/Sources/ServerEnumerations.h
diffstat 5 files changed, 17 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/OrthancFramework/Sources/FileStorage/FilesystemStorage.cpp	Tue Dec 03 13:52:04 2024 +0100
+++ b/OrthancFramework/Sources/FileStorage/FilesystemStorage.cpp	Tue Dec 03 14:12:17 2024 +0100
@@ -176,11 +176,11 @@
         LOG(INFO) << "Created attachment \"" << uuid << "\" (" << timer.GetHumanTransferSpeed(true, size) << ")";
         return;
       }
-      catch (OrthancException& ex)
+      catch (OrthancException& e)
       {
         if (retryCount >= maxRetryCount)
         {
-          throw ex;
+          throw;
         }
       }
     }
--- a/OrthancServer/Plugins/Engine/OrthancPluginDatabaseV4.cpp	Tue Dec 03 13:52:04 2024 +0100
+++ b/OrthancServer/Plugins/Engine/OrthancPluginDatabaseV4.cpp	Tue Dec 03 14:12:17 2024 +0100
@@ -1670,9 +1670,9 @@
             target->SetParentIdentifier(source.parent_public_id());
           }
 
-          for (int i = 0; i < source.labels().size(); i++)
+          for (int j = 0; j < source.labels().size(); j++)
           {
-            target->AddLabel(source.labels(i));
+            target->AddLabel(source.labels(j));
           }
 
           if (source.attachments().size() != source.attachments_revisions().size())
@@ -1680,9 +1680,9 @@
             throw OrthancException(ErrorCode_DatabasePlugin);
           }
 
-          for (int i = 0; i < source.attachments().size(); i++)
+          for (int j = 0; j < source.attachments().size(); j++)
           {
-            target->AddAttachment(Convert(source.attachments(i)), source.attachments_revisions(i));
+            target->AddAttachment(Convert(source.attachments(j)), source.attachments_revisions(j));
           }
 
           Convert(*target, ResourceType_Patient, source.patient_content());
@@ -1727,12 +1727,12 @@
               request.IsRetrieveOneInstanceMetadataAndAttachments())
           {
             std::map<MetadataType, std::string> metadata;
-            for (int i = 0; i < source.one_instance_metadata().size(); i++)
+            for (int j = 0; j < source.one_instance_metadata().size(); j++)
             {
-              MetadataType key = static_cast<MetadataType>(source.one_instance_metadata(i).key());
+              MetadataType key = static_cast<MetadataType>(source.one_instance_metadata(j).key());
               if (metadata.find(key) == metadata.end())
               {
-                metadata[key] = source.one_instance_metadata(i).value();
+                metadata[key] = source.one_instance_metadata(j).value();
               }
               else
               {
@@ -1742,9 +1742,9 @@
 
             std::map<FileContentType, FileInfo> attachments;
 
-            for (int i = 0; i < source.one_instance_attachments().size(); i++)
+            for (int j = 0; j < source.one_instance_attachments().size(); j++)
             {
-              FileInfo info(Convert(source.one_instance_attachments(i)));
+              FileInfo info(Convert(source.one_instance_attachments(j)));
               if (attachments.find(info.GetContentType()) == attachments.end())
               {
                 attachments[info.GetContentType()] = info;
--- a/OrthancServer/Resources/RunCppCheck.sh	Tue Dec 03 13:52:04 2024 +0100
+++ b/OrthancServer/Resources/RunCppCheck.sh	Tue Dec 03 14:12:17 2024 +0100
@@ -12,12 +12,12 @@
 constParameter:../../OrthancFramework/Sources/DicomParsing/FromDcmtkBridge.cpp
 knownArgument:../../OrthancFramework/UnitTestsSources/ImageTests.cpp
 knownConditionTrueFalse:../../OrthancServer/Plugins/Engine/OrthancPlugins.cpp
-nullPointer:../../OrthancFramework/UnitTestsSources/RestApiTests.cpp:316
-stlFindInsert:../../OrthancFramework/Sources/DicomFormat/DicomMap.cpp:1477
+nullPointer:../../OrthancFramework/UnitTestsSources/RestApiTests.cpp:321
+stlFindInsert:../../OrthancFramework/Sources/DicomFormat/DicomMap.cpp:1510
 stlFindInsert:../../OrthancFramework/Sources/RestApi/RestApiCallDocumentation.cpp:166
 stlFindInsert:../../OrthancFramework/Sources/RestApi/RestApiCallDocumentation.cpp:74
 stlFindInsert:../../OrthancServer/Sources/Database/MainDicomTagsRegistry.cpp:65
-stlFindInsert:../../OrthancServer/Sources/OrthancWebDav.cpp:480
+stlFindInsert:../../OrthancServer/Sources/OrthancWebDav.cpp:328
 stlFindInsert:../../OrthancServer/Sources/ServerJobs/MergeStudyJob.cpp:41
 stlFindInsert:../../OrthancServer/Sources/ServerJobs/SplitStudyJob.cpp:191
 stlFindInsert:../../OrthancServer/Sources/ServerJobs/ResourceModificationJob.cpp:361
@@ -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:3527
+assertWithSideEffect:../../OrthancServer/Sources/Database/StatelessDatabaseOperations.cpp:3058
 assertWithSideEffect:../../OrthancServer/Sources/ServerJobs/ResourceModificationJob.cpp:286
 assertWithSideEffect:../../OrthancFramework/Sources/DicomNetworking/Internals/CommandDispatcher.cpp:454
 EOF
--- a/OrthancServer/Sources/Database/FindResponse.h	Tue Dec 03 13:52:04 2024 +0100
+++ b/OrthancServer/Sources/Database/FindResponse.h	Tue Dec 03 14:12:17 2024 +0100
@@ -141,7 +141,7 @@
       {
       }
 
-      MetadataContent(const std::string& value) :
+      explicit MetadataContent(const std::string& value) :
         value_(value),
         revision_(0)
       {
--- a/OrthancServer/Sources/ServerEnumerations.h	Tue Dec 03 13:52:04 2024 +0100
+++ b/OrthancServer/Sources/ServerEnumerations.h	Tue Dec 03 14:12:17 2024 +0100
@@ -137,7 +137,7 @@
     ResponseContentFlags_Labels               = (1 << 11),
     ResponseContentFlags_IsStable             = (1 << 12),
 
-    ResponseContentFlags_INTERNAL_CountResources = (1 << 31),
+    ResponseContentFlags_INTERNAL_CountResources = (1 << 30),
     
     // Some predefined combinations
     ResponseContentFlags_ExpandTrue  = (ResponseContentFlags_ID |