changeset 6380:002e1521458f

cppcheck: constVariableReference
author Alain Mazy <am@orthanc.team>
date Mon, 10 Nov 2025 18:08:25 +0100
parents de5d2b6cdda8
children 6000d19f10b1
files OrthancFramework/Sources/JobsEngine/JobsRegistry.cpp OrthancServer/Plugins/Engine/OrthancPlugins.cpp OrthancServer/Sources/OrthancWebDav.cpp OrthancServer/Sources/ServerContext.cpp OrthancServer/Sources/ServerJobs/ResourceModificationJob.cpp
diffstat 5 files changed, 8 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/OrthancFramework/Sources/JobsEngine/JobsRegistry.cpp	Mon Nov 10 18:07:57 2025 +0100
+++ b/OrthancFramework/Sources/JobsEngine/JobsRegistry.cpp	Mon Nov 10 18:08:25 2025 +0100
@@ -1597,7 +1597,7 @@
     for (JobsIndex::const_iterator it = jobsIndex_.begin();
          it != jobsIndex_.end(); ++it)
     {
-      JobHandler& job = *it->second;
+      const JobHandler& job = *it->second;
 
       switch (job.GetState())
       {
--- a/OrthancServer/Plugins/Engine/OrthancPlugins.cpp	Mon Nov 10 18:07:57 2025 +0100
+++ b/OrthancServer/Plugins/Engine/OrthancPlugins.cpp	Mon Nov 10 18:08:25 2025 +0100
@@ -5888,7 +5888,7 @@
       case _OrthancPluginService_KeysValuesIteratorGetKey:
       {
         const _OrthancPluginKeysValuesIteratorGetKey& p = *reinterpret_cast<const _OrthancPluginKeysValuesIteratorGetKey*>(parameters);
-        StatelessDatabaseOperations::KeysValuesIterator& iterator = *reinterpret_cast<StatelessDatabaseOperations::KeysValuesIterator*>(p.iterator);
+        const StatelessDatabaseOperations::KeysValuesIterator& iterator = *reinterpret_cast<const StatelessDatabaseOperations::KeysValuesIterator*>(p.iterator);
         *p.target = iterator.GetKey().c_str();
         return true;
       }
@@ -5896,7 +5896,7 @@
       case _OrthancPluginService_KeysValuesIteratorGetValue:
       {
         const _OrthancPluginKeysValuesIteratorGetValue& p = *reinterpret_cast<const _OrthancPluginKeysValuesIteratorGetValue*>(parameters);
-        StatelessDatabaseOperations::KeysValuesIterator& iterator = *reinterpret_cast<StatelessDatabaseOperations::KeysValuesIterator*>(p.iterator);
+        const StatelessDatabaseOperations::KeysValuesIterator& iterator = *reinterpret_cast<const StatelessDatabaseOperations::KeysValuesIterator*>(p.iterator);
         CopyToMemoryBuffer(p.target, iterator.GetValue());
         return true;
       }
--- a/OrthancServer/Sources/OrthancWebDav.cpp	Mon Nov 10 18:07:57 2025 +0100
+++ b/OrthancServer/Sources/OrthancWebDav.cpp	Mon Nov 10 18:08:25 2025 +0100
@@ -1256,7 +1256,7 @@
             success = true;
           }
         }
-        catch (OrthancException& e)
+        catch (const OrthancException&)
         {
         }
       }
--- a/OrthancServer/Sources/ServerContext.cpp	Mon Nov 10 18:07:57 2025 +0100
+++ b/OrthancServer/Sources/ServerContext.cpp	Mon Nov 10 18:08:25 2025 +0100
@@ -1885,7 +1885,7 @@
           return decoded.release();
         }
       }
-      catch (OrthancException& e)
+      catch (const OrthancException&)
       { // ignore, we'll try other alternatives
       }
     }
@@ -1898,7 +1898,7 @@
       {
         decoded.reset(GetPlugins().Decode(buffer, size, frameIndex));
       }
-      catch (OrthancException& e)
+      catch (const OrthancException&)
       {
       }
       
--- a/OrthancServer/Sources/ServerJobs/ResourceModificationJob.cpp	Mon Nov 10 18:07:57 2025 +0100
+++ b/OrthancServer/Sources/ServerJobs/ResourceModificationJob.cpp	Mon Nov 10 18:08:25 2025 +0100
@@ -185,7 +185,7 @@
       for (std::set<std::string>::const_iterator it = instancesToReconstruct_.begin(); it != instancesToReconstruct_.end(); ++it)
       {
         ServerContext::DicomCacheLocker locker(GetContext(), *it);
-        ParsedDicomFile& modifiedDicom = locker.GetDicom();
+        const ParsedDicomFile& modifiedDicom = locker.GetDicom();
 
         GetContext().GetIndex().ReconstructInstance(modifiedDicom, false, ResourceType_Instance /* dummy */);
       }
@@ -219,7 +219,7 @@
     try
     {
       ServerContext::DicomCacheLocker locker(GetContext(), instance);
-      ParsedDicomFile& original = locker.GetDicom();
+      const ParsedDicomFile& original = locker.GetDicom();
 
       originalHasher.reset(new DicomInstanceHasher(original.GetHasher()));
       modified.reset(original.Clone(true));