changeset 5702:359a8adb3802 find-refactoring

cppcheck
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 12 Jul 2024 15:17:26 +0200
parents 388aef262b1b
children 12cb6b5c43f0
files OrthancServer/Resources/RunCppCheck.sh OrthancServer/Sources/Database/FindResponse.cpp OrthancServer/Sources/Database/OrthancIdentifiers.cpp OrthancServer/Sources/Database/OrthancIdentifiers.h OrthancServer/Sources/OrthancFindRequestHandler.cpp OrthancServer/Sources/OrthancWebDav.cpp OrthancServer/Sources/ResourceFinder.cpp OrthancServer/Sources/Search/DatabaseConstraint.cpp
diffstat 8 files changed, 12 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/OrthancServer/Resources/RunCppCheck.sh	Fri Jul 12 15:08:43 2024 +0200
+++ b/OrthancServer/Resources/RunCppCheck.sh	Fri Jul 12 15:17:26 2024 +0200
@@ -17,7 +17,7 @@
 stlFindInsert:../../OrthancFramework/Sources/RestApi/RestApiCallDocumentation.cpp:166
 stlFindInsert:../../OrthancFramework/Sources/RestApi/RestApiCallDocumentation.cpp:74
 stlFindInsert:../../OrthancServer/Sources/Database/StatelessDatabaseOperations.cpp:374
-stlFindInsert:../../OrthancServer/Sources/OrthancWebDav.cpp:378
+stlFindInsert:../../OrthancServer/Sources/OrthancWebDav.cpp:480
 stlFindInsert:../../OrthancServer/Sources/ServerJobs/MergeStudyJob.cpp:41
 stlFindInsert:../../OrthancServer/Sources/ServerJobs/SplitStudyJob.cpp:191
 stlFindInsert:../../OrthancServer/Sources/ServerJobs/ResourceModificationJob.cpp:361
@@ -34,8 +34,8 @@
 useInitializationList:../../OrthancServer/Sources/ServerJobs/DicomModalityStoreJob.cpp:275
 assertWithSideEffect:../../OrthancServer/Plugins/Engine/OrthancPluginDatabase.cpp:277
 assertWithSideEffect:../../OrthancServer/Plugins/Engine/OrthancPluginDatabase.cpp:1026
-assertWithSideEffect:../../OrthancServer/Sources/Database/Compatibility/DatabaseLookup.cpp:290
-assertWithSideEffect:../../OrthancServer/Sources/Database/Compatibility/DatabaseLookup.cpp:389
+assertWithSideEffect:../../OrthancServer/Sources/Database/Compatibility/DatabaseLookup.cpp:292
+assertWithSideEffect:../../OrthancServer/Sources/Database/Compatibility/DatabaseLookup.cpp:391
 assertWithSideEffect:../../OrthancServer/Sources/Database/StatelessDatabaseOperations.cpp:3663
 assertWithSideEffect:../../OrthancServer/Sources/ServerJobs/ResourceModificationJob.cpp:286
 assertWithSideEffect:../../OrthancFramework/Sources/DicomNetworking/Internals/CommandDispatcher.cpp:454
--- a/OrthancServer/Sources/Database/FindResponse.cpp	Fri Jul 12 15:08:43 2024 +0200
+++ b/OrthancServer/Sources/Database/FindResponse.cpp	Fri Jul 12 15:17:26 2024 +0200
@@ -600,7 +600,7 @@
           DebugDicomMap(target[level]["MainDicomTags"], m);
         }
 
-        if (request.GetParentSpecification(levels[i]).IsRetrieveMainDicomTags())
+        if (request.GetParentSpecification(levels[i]).IsRetrieveMetadata())
         {
           DebugMetadata(target[level]["Metadata"], GetMetadata(levels[i]));
         }
--- a/OrthancServer/Sources/Database/OrthancIdentifiers.cpp	Fri Jul 12 15:08:43 2024 +0200
+++ b/OrthancServer/Sources/Database/OrthancIdentifiers.cpp	Fri Jul 12 15:17:26 2024 +0200
@@ -194,7 +194,7 @@
 
 
   void OrthancIdentifiers::SetLevel(ResourceType level,
-                                    const std::string id)
+                                    const std::string& id)
   {
     switch (level)
     {
--- a/OrthancServer/Sources/Database/OrthancIdentifiers.h	Fri Jul 12 15:08:43 2024 +0200
+++ b/OrthancServer/Sources/Database/OrthancIdentifiers.h	Fri Jul 12 15:17:26 2024 +0200
@@ -86,7 +86,7 @@
     ResourceType DetectLevel() const;
 
     void SetLevel(ResourceType level,
-                  const std::string id);
+                  const std::string& id);
 
     std::string GetLevel(ResourceType level) const;
   };
--- a/OrthancServer/Sources/OrthancFindRequestHandler.cpp	Fri Jul 12 15:08:43 2024 +0200
+++ b/OrthancServer/Sources/OrthancFindRequestHandler.cpp	Fri Jul 12 15:17:26 2024 +0200
@@ -392,7 +392,6 @@
           }
           else
           {
-            const DicomTag& tag = queryAsArray_.GetElement(i).GetTag();
             const DicomValue* value = resourceTags.TestAndGetValue(tag);
 
             if (value == NULL ||
--- a/OrthancServer/Sources/OrthancWebDav.cpp	Fri Jul 12 15:08:43 2024 +0200
+++ b/OrthancServer/Sources/OrthancWebDav.cpp	Fri Jul 12 15:17:26 2024 +0200
@@ -186,7 +186,7 @@
     Collection&  target_;
 
   public:
-    DicomIdentifiersVisitorV2(Collection& target) :
+    explicit DicomIdentifiersVisitorV2(Collection& target) :
       isComplete_(false),
       target_(target)
     {
--- a/OrthancServer/Sources/ResourceFinder.cpp	Fri Jul 12 15:08:43 2024 +0200
+++ b/OrthancServer/Sources/ResourceFinder.cpp	Fri Jul 12 15:17:26 2024 +0200
@@ -301,11 +301,11 @@
         static const char* const INDEX_IN_SERIES = "IndexInSeries";
 
         std::string s;
-        uint32_t index;
+        uint32_t indexInSeries;
         if (resource.LookupMetadata(s, ResourceType_Instance, MetadataType_Instance_IndexInSeries) &&
-            SerializationToolbox::ParseUnsignedInteger32(index, s))
+            SerializationToolbox::ParseUnsignedInteger32(indexInSeries, s))
         {
-          target[INDEX_IN_SERIES] = index;
+          target[INDEX_IN_SERIES] = indexInSeries;
         }
         else
         {
--- a/OrthancServer/Sources/Search/DatabaseConstraint.cpp	Fri Jul 12 15:08:43 2024 +0200
+++ b/OrthancServer/Sources/Search/DatabaseConstraint.cpp	Fri Jul 12 15:17:26 2024 +0200
@@ -320,7 +320,7 @@
         {
           s += " in [ ";
           bool first = true;
-          for (size_t i = 0; i < constraint.GetValuesCount(); i++)
+          for (size_t j = 0; j < constraint.GetValuesCount(); j++)
           {
             if (first)
             {
@@ -330,7 +330,7 @@
             {
               s += ", ";
             }
-            s += constraint.GetValue(i);
+            s += constraint.GetValue(j);
           }
           s += "]";
           break;