changeset 6382:a6cac4870a06

cppcheck: constParameterReference
author Alain Mazy <am@orthanc.team>
date Mon, 10 Nov 2025 18:26:07 +0100
parents 6000d19f10b1
children 6e68099c2031
files OrthancFramework/Sources/DicomFormat/DicomStreamReader.cpp OrthancFramework/Sources/DicomFormat/DicomStreamReader.h OrthancFramework/Sources/JobsEngine/JobsRegistry.cpp OrthancFramework/Sources/JobsEngine/JobsRegistry.h OrthancFramework/Sources/RestApi/RestApiHierarchy.cpp OrthancFramework/Sources/RestApi/RestApiHierarchy.h OrthancServer/Sources/LuaScripting.cpp OrthancServer/Sources/OrthancFindRequestHandler.cpp OrthancServer/Sources/OrthancFindRequestHandler.h OrthancServer/Sources/OrthancRestApi/OrthancRestAnonymizeModify.cpp OrthancServer/Sources/OrthancRestApi/OrthancRestApi.cpp OrthancServer/Sources/OrthancRestApi/OrthancRestApi.h OrthancServer/Sources/ServerJobs/ArchiveJob.cpp
diffstat 13 files changed, 20 insertions(+), 23 deletions(-) [+]
line wrap: on
line diff
--- a/OrthancFramework/Sources/DicomFormat/DicomStreamReader.cpp	Mon Nov 10 18:11:42 2025 +0100
+++ b/OrthancFramework/Sources/DicomFormat/DicomStreamReader.cpp	Mon Nov 10 18:26:07 2025 +0100
@@ -156,7 +156,7 @@
   }
 
 
-  void DicomStreamReader::HandlePreamble(IVisitor& visitor,
+  void DicomStreamReader::HandlePreamble(const IVisitor& visitor,
                                          const std::string& block)
   {
     assert(block.size() == 144u);
--- a/OrthancFramework/Sources/DicomFormat/DicomStreamReader.h	Mon Nov 10 18:11:42 2025 +0100
+++ b/OrthancFramework/Sources/DicomFormat/DicomStreamReader.h	Mon Nov 10 18:26:07 2025 +0100
@@ -89,7 +89,7 @@
     
     bool IsLittleEndian() const;
     
-    void HandlePreamble(IVisitor& visitor,
+    void HandlePreamble(const IVisitor& visitor,
                         const std::string& block);
     
     void HandleMetaHeader(IVisitor& visitor,
--- a/OrthancFramework/Sources/JobsEngine/JobsRegistry.cpp	Mon Nov 10 18:11:42 2025 +0100
+++ b/OrthancFramework/Sources/JobsEngine/JobsRegistry.cpp	Mon Nov 10 18:26:07 2025 +0100
@@ -375,8 +375,8 @@
   };
 
 
-  bool JobsRegistry::PriorityComparator::operator() (JobHandler* const& a,
-                                                     JobHandler* const& b) const
+  bool JobsRegistry::PriorityComparator::operator() (const JobHandler* const& a,
+                                                     const JobHandler* const& b) const
   {
     return a->GetPriority() < b->GetPriority();
   }
@@ -404,7 +404,7 @@
     return false;
   }
 
-  bool JobsRegistry::IsCompletedJob(JobHandler& job) const
+  bool JobsRegistry::IsCompletedJob(const JobHandler& job) const
   {
     for (CompletedJobs::const_iterator it = completedJobs_.begin();
          it != completedJobs_.end(); ++it)
--- a/OrthancFramework/Sources/JobsEngine/JobsRegistry.h	Mon Nov 10 18:11:42 2025 +0100
+++ b/OrthancFramework/Sources/JobsEngine/JobsRegistry.h	Mon Nov 10 18:26:07 2025 +0100
@@ -73,8 +73,8 @@
 
     struct PriorityComparator
     {
-      bool operator() (JobHandler* const& a,
-                       JobHandler* const& b) const;
+      bool operator() (const JobHandler* const& a,
+                       const JobHandler* const& b) const;
     };
 
     typedef std::map<std::string, JobHandler*>              JobsIndex;
@@ -100,7 +100,7 @@
 #ifndef NDEBUG
     bool IsPendingJob(const JobHandler& job) const;
 
-    bool IsCompletedJob(JobHandler& job) const;
+    bool IsCompletedJob(const JobHandler& job) const;
 
     bool IsRetryJob(JobHandler& job) const;
 #endif
--- a/OrthancFramework/Sources/RestApi/RestApiHierarchy.cpp	Mon Nov 10 18:11:42 2025 +0100
+++ b/OrthancFramework/Sources/RestApi/RestApiHierarchy.cpp	Mon Nov 10 18:26:07 2025 +0100
@@ -169,9 +169,9 @@
   }
 
 
-  void RestApiHierarchy::DeleteChildren(Children& children)
+  void RestApiHierarchy::DeleteChildren(const Children& children)
   {
-    for (Children::iterator it = children.begin();
+    for (Children::const_iterator it = children.begin();
          it != children.end(); ++it)
     {
       delete it->second;
--- a/OrthancFramework/Sources/RestApi/RestApiHierarchy.h	Mon Nov 10 18:11:42 2025 +0100
+++ b/OrthancFramework/Sources/RestApi/RestApiHierarchy.h	Mon Nov 10 18:26:07 2025 +0100
@@ -97,7 +97,7 @@
     static RestApiHierarchy& AddChild(Children& children,
                                       const std::string& name);
 
-    static void DeleteChildren(Children& children);
+    static void DeleteChildren(const Children& children);
 
     template <typename Handler>
     void RegisterInternal(const RestApiPath& path,
--- a/OrthancServer/Sources/LuaScripting.cpp	Mon Nov 10 18:11:42 2025 +0100
+++ b/OrthancServer/Sources/LuaScripting.cpp	Mon Nov 10 18:26:07 2025 +0100
@@ -1034,7 +1034,7 @@
     return true;
   }
 
-  bool LuaScripting::FilterIncomingCStoreInstance(uint16_t& dimseStatus,
+  bool LuaScripting::FilterIncomingCStoreInstance(uint16_t& /*dimseStatus*/,
                                                   const DicomInstanceToStore& instance,
                                                   const Json::Value& simplified)
   {
--- a/OrthancServer/Sources/OrthancFindRequestHandler.cpp	Mon Nov 10 18:11:42 2025 +0100
+++ b/OrthancServer/Sources/OrthancFindRequestHandler.cpp	Mon Nov 10 18:26:07 2025 +0100
@@ -82,8 +82,7 @@
   }
 
 
-  bool OrthancFindRequestHandler::FilterQueryTag(std::string& value /* can be modified */,
-                                                 ResourceType level,
+  bool OrthancFindRequestHandler::FilterQueryTag(ResourceType level,
                                                  const DicomTag& tag,
                                                  ModalityManufacturer manufacturer)
   {
@@ -417,7 +416,7 @@
         continue;
       }
 
-      if (FilterQueryTag(value, level, tag, manufacturer))
+      if (FilterQueryTag(level, tag, manufacturer))
       {
         ValueRepresentation vr = FromDcmtkBridge::LookupValueRepresentation(tag);
 
--- a/OrthancServer/Sources/OrthancFindRequestHandler.h	Mon Nov 10 18:11:42 2025 +0100
+++ b/OrthancServer/Sources/OrthancFindRequestHandler.h	Mon Nov 10 18:26:07 2025 +0100
@@ -40,8 +40,7 @@
     bool HasReachedLimit(const DicomFindAnswers& answers,
                          ResourceType level) const;
 
-    bool FilterQueryTag(std::string& value /* can be modified */,
-                        ResourceType level,
+    bool FilterQueryTag(ResourceType level,
                         const DicomTag& tag,
                         ModalityManufacturer manufacturer);
 
--- a/OrthancServer/Sources/OrthancRestApi/OrthancRestAnonymizeModify.cpp	Mon Nov 10 18:11:42 2025 +0100
+++ b/OrthancServer/Sources/OrthancRestApi/OrthancRestAnonymizeModify.cpp	Mon Nov 10 18:26:07 2025 +0100
@@ -627,7 +627,7 @@
 
 
   static void CreateDicomV1(ParsedDicomFile& dicom,
-                            RestApiPostCall& call,
+                            const RestApiPostCall& call,
                             const Json::Value& request)
   {
     // curl http://localhost:8042/tools/create-dicom -X POST -d '{"PatientName":"Hello^World"}'
--- a/OrthancServer/Sources/OrthancRestApi/OrthancRestApi.cpp	Mon Nov 10 18:11:42 2025 +0100
+++ b/OrthancServer/Sources/OrthancRestApi/OrthancRestApi.cpp	Mon Nov 10 18:26:07 2025 +0100
@@ -72,7 +72,7 @@
 
 
   void OrthancRestApi::AnswerStoredInstance(RestApiPostCall& call,
-                                            DicomInstanceToStore& instance,
+                                            const DicomInstanceToStore& instance,
                                             StoreStatus status,
                                             const std::string& instanceId) const
   {
@@ -189,7 +189,7 @@
           try
           {
             std::string publicId;
-            
+
             ServerContext::StoreResult result = context.Store(publicId, *toStore, StoreInstanceMode_Default);
 
             Json::Value info;
--- a/OrthancServer/Sources/OrthancRestApi/OrthancRestApi.h	Mon Nov 10 18:11:42 2025 +0100
+++ b/OrthancServer/Sources/OrthancRestApi/OrthancRestApi.h	Mon Nov 10 18:26:07 2025 +0100
@@ -103,7 +103,7 @@
     // WARNING: "instanceId" can be different from
     // "instance.GetHasher().HashInstance()" if transcoding is enabled
     void AnswerStoredInstance(RestApiPostCall& call,
-                              DicomInstanceToStore& instance,
+                              const DicomInstanceToStore& instance,
                               StoreStatus status,
                               const std::string& instanceId) const;
 
--- a/OrthancServer/Sources/ServerJobs/ArchiveJob.cpp	Mon Nov 10 18:11:42 2025 +0100
+++ b/OrthancServer/Sources/ServerJobs/ArchiveJob.cpp	Mon Nov 10 18:26:07 2025 +0100
@@ -781,7 +781,6 @@
       }
         
       void Apply(HierarchicalZipWriter& writer,
-                 ServerContext& context,
                  InstanceLoader& instanceLoader,
                  DicomDirWriter* dicomDir,
                  const std::string& dicomDirFolder,
@@ -857,7 +856,7 @@
         throw OrthancException(ErrorCode_ParameterOutOfRange);
       }
 
-      commands_[index]->Apply(writer, context, instanceLoader, dicomDir, dicomDirFolder, transcode, transferSyntax);
+      commands_[index]->Apply(writer, instanceLoader, dicomDir, dicomDirFolder, transcode, transferSyntax);
     }
       
   public: