changeset 4985:c767035fff77

cppcheck
author Alain Mazy <am@osimis.io>
date Mon, 25 Apr 2022 19:17:28 +0200
parents c8cdf5163cd2
children a25e74fad379
files OrthancFramework/Sources/DicomFormat/DicomInstanceHasher.cpp OrthancFramework/Sources/DicomFormat/DicomInstanceHasher.h OrthancServer/Resources/RunCppCheck.sh
diffstat 3 files changed, 18 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/OrthancFramework/Sources/DicomFormat/DicomInstanceHasher.cpp	Mon Apr 25 18:54:45 2022 +0200
+++ b/OrthancFramework/Sources/DicomFormat/DicomInstanceHasher.cpp	Mon Apr 25 19:17:28 2022 +0200
@@ -85,7 +85,7 @@
     return instanceUid_;
   }
 
-  const std::string& DicomInstanceHasher::HashPatient()
+  const std::string& DicomInstanceHasher::HashPatient() const
   {
     if (patientHash_.size() == 0)
     {
@@ -95,7 +95,7 @@
     return patientHash_;
   }
 
-  const std::string& DicomInstanceHasher::HashStudy()
+  const std::string& DicomInstanceHasher::HashStudy() const
   {
     if (studyHash_.size() == 0)
     {
@@ -105,7 +105,7 @@
     return studyHash_;
   }
 
-  const std::string& DicomInstanceHasher::HashSeries()
+  const std::string& DicomInstanceHasher::HashSeries() const
   {
     if (seriesHash_.size() == 0)
     {
@@ -115,7 +115,7 @@
     return seriesHash_;
   }
 
-  const std::string& DicomInstanceHasher::HashInstance()
+  const std::string& DicomInstanceHasher::HashInstance() const
   {
     if (instanceHash_.size() == 0)
     {
--- a/OrthancFramework/Sources/DicomFormat/DicomInstanceHasher.h	Mon Apr 25 18:54:45 2022 +0200
+++ b/OrthancFramework/Sources/DicomFormat/DicomInstanceHasher.h	Mon Apr 25 19:17:28 2022 +0200
@@ -45,10 +45,10 @@
     std::string seriesUid_;
     std::string instanceUid_;
 
-    std::string patientHash_;
-    std::string studyHash_;
-    std::string seriesHash_;
-    std::string instanceHash_;
+    mutable std::string patientHash_;
+    mutable std::string studyHash_;
+    mutable std::string seriesHash_;
+    mutable std::string instanceHash_;
 
     void Setup(const std::string& patientId,
                const std::string& studyUid,
@@ -71,12 +71,12 @@
 
     const std::string& GetInstanceUid() const;
 
-    const std::string& HashPatient();
+    const std::string& HashPatient() const;
 
-    const std::string& HashStudy();
+    const std::string& HashStudy() const;
 
-    const std::string& HashSeries();
+    const std::string& HashSeries() const;
 
-    const std::string& HashInstance();
+    const std::string& HashInstance() const;
   };
 }
--- a/OrthancServer/Resources/RunCppCheck.sh	Mon Apr 25 18:54:45 2022 +0200
+++ b/OrthancServer/Resources/RunCppCheck.sh	Mon Apr 25 19:17:28 2022 +0200
@@ -31,6 +31,12 @@
 useInitializationList:../../OrthancFramework/Sources/Images/PngReader.cpp:90
 useInitializationList:../../OrthancFramework/Sources/Images/PngWriter.cpp:98
 useInitializationList:../../OrthancServer/Sources/ServerJobs/DicomModalityStoreJob.cpp:274
+assertWithSideEffect:../../OrthancServer/Plugins/Engine/OrthancPluginDatabase.cpp:276
+assertWithSideEffect:../../OrthancServer/Plugins/Engine/OrthancPluginDatabase.cpp:1018
+assertWithSideEffect:../../OrthancServer/Sources/Database/Compatibility/DatabaseLookup.cpp:289
+assertWithSideEffect:../../OrthancServer/Sources/Database/Compatibility/DatabaseLookup.cpp:388
+assertWithSideEffect:../../OrthancServer/Sources/Database/StatelessDatabaseOperations.cpp:3381
+assertWithSideEffect:../../OrthancServer/Sources/ServerJobs/ResourceModificationJob.cpp:241
 EOF
 
 ${CPPCHECK} --enable=all --quiet --std=c++11 \