changeset 4205:d962a2996637

cppcheck
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 17 Sep 2020 17:58:19 +0200
parents 318c16cfccab
children 171af1567473
files OrthancServer/Resources/RunCppCheck.sh OrthancServer/Sources/OrthancRestApi/OrthancRestModalities.cpp OrthancServer/Sources/OrthancRestApi/OrthancRestResources.cpp OrthancServer/Sources/QueryRetrieveHandler.h OrthancServer/Sources/ServerContext.cpp OrthancServer/Sources/ServerContext.h OrthancServer/Sources/ServerIndex.cpp OrthancServer/Sources/ServerIndex.h OrthancServer/Sources/ServerJobs/ArchiveJob.cpp OrthancServer/Sources/ServerJobs/CleaningInstancesJob.h OrthancServer/Sources/ServerJobs/DicomMoveScuJob.cpp OrthancServer/Sources/ServerJobs/DicomMoveScuJob.h OrthancServer/Sources/ServerJobs/MergeStudyJob.h OrthancServer/Sources/ServerJobs/Operations/DeleteResourceOperation.h OrthancServer/Sources/ServerJobs/Operations/DicomInstanceOperationValue.h OrthancServer/Sources/ServerJobs/Operations/ModifyInstanceOperation.h OrthancServer/Sources/ServerJobs/Operations/StorePeerOperation.h OrthancServer/Sources/ServerJobs/Operations/StoreScuOperation.h OrthancServer/Sources/ServerJobs/Operations/SystemCallOperation.h OrthancServer/Sources/ServerJobs/OrthancJobUnserializer.h OrthancServer/Sources/ServerJobs/OrthancPeerStoreJob.h OrthancServer/Sources/ServerJobs/ResourceModificationJob.cpp OrthancServer/Sources/ServerJobs/ResourceModificationJob.h OrthancServer/Sources/ServerJobs/SplitStudyJob.h OrthancServer/Sources/ServerJobs/StorageCommitmentScpJob.cpp OrthancServer/Sources/SliceOrdering.cpp OrthancServer/Sources/StorageCommitmentReports.h OrthancServer/Sources/main.cpp
diffstat 28 files changed, 152 insertions(+), 142 deletions(-) [+]
line wrap: on
line diff
--- a/OrthancServer/Resources/RunCppCheck.sh	Thu Sep 17 16:18:01 2020 +0200
+++ b/OrthancServer/Resources/RunCppCheck.sh	Thu Sep 17 17:58:19 2020 +0200
@@ -15,10 +15,13 @@
 nullPointer:../../OrthancFramework/UnitTestsSources/RestApiTests.cpp:309
 nullPointerRedundantCheck:../../OrthancFramework/UnitTestsSources/DicomMapTests.cpp
 stlFindInsert:../../OrthancFramework/Sources/DicomFormat/DicomMap.cpp:1070
+stlFindInsert:../../OrthancServer/Sources/ServerIndex.cpp:398
 syntaxError:../../OrthancFramework/Sources/SQLite/FunctionContext.h:50
 syntaxError:../../OrthancFramework/UnitTestsSources/ZipTests.cpp:129
 unreadVariable:../../OrthancFramework/Sources/FileStorage/StorageAccessor.cpp
+unreadVariable:../../OrthancServer/Sources/OrthancRestApi/OrthancRestModalities.cpp:714
 useInitializationList:../../OrthancFramework/Sources/Images/PngReader.cpp:89
+useInitializationList:../../OrthancServer/Sources/ServerJobs/DicomModalityStoreJob.cpp:285
 EOF
 
 ${CPPCHECK} --enable=all --quiet --std=c++11 \
--- a/OrthancServer/Sources/OrthancRestApi/OrthancRestModalities.cpp	Thu Sep 17 16:18:01 2020 +0200
+++ b/OrthancServer/Sources/OrthancRestApi/OrthancRestModalities.cpp	Thu Sep 17 17:58:19 2020 +0200
@@ -329,7 +329,7 @@
 
 
   static void CopyTagIfExists(DicomMap& target,
-                              ParsedDicomFile& source,
+                              const ParsedDicomFile& source,
                               const DicomTag& tag)
   {
     std::string tmp;
@@ -524,7 +524,7 @@
       QueryRetrieveHandler*     handler_;
 
     public:
-      QueryAccessor(RestApiCall& call) :
+      explicit QueryAccessor(RestApiCall& call) :
         context_(OrthancRestApi::GetContext(call)),
         accessor_(context_.GetQueryRetrieveArchive(), call.GetUriComponent("id", "")),
         handler_(NULL)
@@ -1021,7 +1021,7 @@
   
   static void DicomMove(RestApiPostCall& call)
   {
-    ServerContext& context = OrthancRestApi::GetContext(call);
+    const ServerContext& context = OrthancRestApi::GetContext(call);
 
     Json::Value request;
 
--- a/OrthancServer/Sources/OrthancRestApi/OrthancRestResources.cpp	Thu Sep 17 16:18:01 2020 +0200
+++ b/OrthancServer/Sources/OrthancRestApi/OrthancRestResources.cpp	Thu Sep 17 17:58:19 2020 +0200
@@ -409,7 +409,8 @@
                     bool invert) :
         image_(image),
         mode_(mode),
-        invert_(invert)
+        invert_(invert),
+        format_(MimeType_Binary)
       {
       }
 
@@ -443,12 +444,12 @@
       ImageToEncode&  image_;
 
     public:
-      EncodePng(ImageToEncode& image) : image_(image)
+      explicit EncodePng(ImageToEncode& image) : image_(image)
       {
       }
 
       virtual void Handle(const std::string& type,
-                          const std::string& subtype)
+                          const std::string& subtype) ORTHANC_OVERRIDE
       {
         assert(type == "image");
         assert(subtype == "png");
@@ -462,12 +463,12 @@
       ImageToEncode&  image_;
 
     public:
-      EncodePam(ImageToEncode& image) : image_(image)
+      explicit EncodePam(ImageToEncode& image) : image_(image)
       {
       }
 
       virtual void Handle(const std::string& type,
-                          const std::string& subtype)
+                          const std::string& subtype) ORTHANC_OVERRIDE
       {
         assert(type == "image");
         assert(subtype == "x-portable-arbitrarymap");
@@ -507,7 +508,7 @@
       }
 
       virtual void Handle(const std::string& type,
-                          const std::string& subtype)
+                          const std::string& subtype) ORTHANC_OVERRIDE
       {
         assert(type == "image");
         assert(subtype == "jpeg");
@@ -631,7 +632,7 @@
       ImageExtractionMode mode_;
 
     public:
-      GetImageHandler(ImageExtractionMode mode) :
+      explicit GetImageHandler(ImageExtractionMode mode) :
         mode_(mode)
       {
       }
@@ -698,7 +699,7 @@
                                    unsigned int& argWidth,
                                    unsigned int& argHeight,
                                    bool& smooth,
-                                   RestApiGetCall& call)
+                                   const RestApiGetCall& call)
       {
         static const char* ARG_WINDOW_CENTER = "window-center";
         static const char* ARG_WINDOW_WIDTH = "window-width";
@@ -1063,7 +1064,7 @@
 
   // Handling of metadata -----------------------------------------------------
 
-  static void CheckValidResourceType(RestApiCall& call)
+  static void CheckValidResourceType(const RestApiCall& call)
   {
     std::string resourceType = call.GetUriComponent("resourceType", "");
     StringToResourceType(resourceType.c_str());
@@ -1685,13 +1686,13 @@
         isComplete_(false)
       {
       }
-
-      virtual bool IsDicomAsJsonNeeded() const
+      
+      virtual bool IsDicomAsJsonNeeded() const ORTHANC_OVERRIDE
       {
         return false;   // (*)
       }
       
-      virtual void MarkAsComplete()
+      virtual void MarkAsComplete() ORTHANC_OVERRIDE
       {
         isComplete_ = true;  // Unused information as of Orthanc 1.5.0
       }
@@ -1699,7 +1700,7 @@
       virtual void Visit(const std::string& publicId,
                          const std::string& instanceId   /* unused     */,
                          const DicomMap& mainDicomTags   /* unused     */,
-                         const Json::Value* dicomAsJson  /* unused (*) */) 
+                         const Json::Value* dicomAsJson  /* unused (*) */)  ORTHANC_OVERRIDE
       {
         resources_.push_back(publicId);
       }
--- a/OrthancServer/Sources/QueryRetrieveHandler.h	Thu Sep 17 16:18:01 2020 +0200
+++ b/OrthancServer/Sources/QueryRetrieveHandler.h	Thu Sep 17 17:58:19 2020 +0200
@@ -56,7 +56,7 @@
     void Invalidate();
 
   public:
-    QueryRetrieveHandler(ServerContext& context);
+    explicit QueryRetrieveHandler(ServerContext& context);
 
     void SetModality(const std::string& symbolicName);
 
--- a/OrthancServer/Sources/ServerContext.cpp	Thu Sep 17 16:18:01 2020 +0200
+++ b/OrthancServer/Sources/ServerContext.cpp	Thu Sep 17 17:58:19 2020 +0200
@@ -189,10 +189,10 @@
       if (index_.LookupGlobalProperty(serialized, GlobalProperty_JobsRegistry))
       {
         LOG(WARNING) << "Reloading the jobs from the last execution of Orthanc";
-        OrthancJobUnserializer unserializer(*this);
 
         try
         {
+          OrthancJobUnserializer unserializer(*this);
           jobsEngine_.LoadRegistryFromString(unserializer, serialized);
         }
         catch (OrthancException& e)
@@ -1168,8 +1168,9 @@
       Studies  studies_;
       
     public:
-      ModalitiesInStudyVisitor(bool isDicomAsJsonNeeded) :
-        isDicomAsJsonNeeded_(isDicomAsJsonNeeded)
+      explicit ModalitiesInStudyVisitor(bool isDicomAsJsonNeeded) :
+        isDicomAsJsonNeeded_(isDicomAsJsonNeeded),
+        complete_(false)
       {
       }
 
@@ -1184,12 +1185,12 @@
         studies_.clear();
       }
       
-      virtual bool IsDicomAsJsonNeeded() const
+      virtual bool IsDicomAsJsonNeeded() const ORTHANC_OVERRIDE
       {
         return isDicomAsJsonNeeded_;
       }
       
-      virtual void MarkAsComplete()
+      virtual void MarkAsComplete() ORTHANC_OVERRIDE
       {
         complete_ = true;
       }
@@ -1197,7 +1198,7 @@
       virtual void Visit(const std::string& publicId,
                          const std::string& instanceId,
                          const DicomMap& seriesTags,
-                         const Json::Value* dicomAsJson)
+                         const Json::Value* dicomAsJson) ORTHANC_OVERRIDE
       {
         std::string studyInstanceUid;
         if (seriesTags.LookupStringValue(studyInstanceUid, DICOM_TAG_STUDY_INSTANCE_UID, false))
@@ -1226,7 +1227,7 @@
       void Forward(ILookupVisitor& callerVisitor,
                    size_t since,
                    size_t limit) const
-     {
+      {
         size_t index = 0;
         size_t countForwarded = 0;
         
--- a/OrthancServer/Sources/ServerContext.h	Thu Sep 17 16:18:01 2020 +0200
+++ b/OrthancServer/Sources/ServerContext.h	Thu Sep 17 17:58:19 2020 +0200
@@ -103,18 +103,18 @@
 
       virtual void SignalStoredInstance(const std::string& publicId,
                                         const DicomInstanceToStore& instance,
-                                        const Json::Value& simplifiedTags)
+                                        const Json::Value& simplifiedTags) ORTHANC_OVERRIDE
       {
         context_.mainLua_.SignalStoredInstance(publicId, instance, simplifiedTags);
       }
     
-      virtual void SignalChange(const ServerIndexChange& change)
+      virtual void SignalChange(const ServerIndexChange& change) ORTHANC_OVERRIDE
       {
         context_.mainLua_.SignalChange(change);
       }
 
       virtual bool FilterIncomingInstance(const DicomInstanceToStore& instance,
-                                          const Json::Value& simplified)
+                                          const Json::Value& simplified) ORTHANC_OVERRIDE
       {
         return context_.filterLua_.FilterIncomingInstance(instance, simplified);
       }
--- a/OrthancServer/Sources/ServerIndex.cpp	Thu Sep 17 16:18:01 2020 +0200
+++ b/OrthancServer/Sources/ServerIndex.cpp	Thu Sep 17 17:58:19 2020 +0200
@@ -86,8 +86,9 @@
       FileContentType  type_;
 
     public:
-      FileToRemove(const FileInfo& info) : uuid_(info.GetUuid()), 
-                                           type_(info.GetContentType())
+      explicit FileToRemove(const FileInfo& info) :
+        uuid_(info.GetUuid()), 
+        type_(info.GetContentType())
       {
       }
 
@@ -120,8 +121,9 @@
     }
 
   public:
-    Listener(ServerContext& context) : context_(context),
-                                       insideTransaction_(false)      
+    explicit Listener(ServerContext& context) :
+      context_(context),
+      insideTransaction_(false)      
     {
       Reset();
       assert(ResourceType_Patient < ResourceType_Study &&
@@ -242,9 +244,9 @@
     ServerIndex& index_;
     std::unique_ptr<IDatabaseWrapper::ITransaction> transaction_;
     bool isCommitted_;
-
+    
   public:
-    Transaction(ServerIndex& index) : 
+    explicit Transaction(ServerIndex& index) : 
       index_(index),
       isCommitted_(false)
     {
@@ -302,9 +304,9 @@
     UnstableResourcePayload(Orthanc::ResourceType type,
                             const std::string& publicId) : 
       type_(type),
-      publicId_(publicId)
+      publicId_(publicId),
+      time_(boost::posix_time::second_clock::local_time())
     {
-      time_ = boost::posix_time::second_clock::local_time();
     }
 
     unsigned int GetAge() const
@@ -451,13 +453,13 @@
 
     if (listener_->HasRemainingLevel())
     {
-      ResourceType type = listener_->GetRemainingType();
-      const std::string& uuid = listener_->GetRemainingPublicId();
+      ResourceType remainingType = listener_->GetRemainingType();
+      const std::string& remainingUuid = listener_->GetRemainingPublicId();
 
       target["RemainingAncestor"] = Json::Value(Json::objectValue);
-      target["RemainingAncestor"]["Path"] = GetBasePath(type, uuid);
-      target["RemainingAncestor"]["Type"] = EnumerationToString(type);
-      target["RemainingAncestor"]["ID"] = uuid;
+      target["RemainingAncestor"]["Path"] = GetBasePath(remainingType, remainingUuid);
+      target["RemainingAncestor"]["Type"] = EnumerationToString(remainingType);
+      target["RemainingAncestor"]["ID"] = remainingUuid;
     }
     else
     {
@@ -644,11 +646,9 @@
 
     if (db_.LookupGlobalProperty(oldValue, property))
     {
-      uint64_t oldNumber;
-
       try
       {
-        oldNumber = boost::lexical_cast<uint64_t>(oldValue);
+        uint64_t oldNumber = boost::lexical_cast<uint64_t>(oldValue);
         db_.SetGlobalProperty(property, boost::lexical_cast<std::string>(oldNumber + 1));
         return oldNumber + 1;
       }
@@ -2465,7 +2465,7 @@
   }
 
 
-  void ServerIndex::ReconstructInstance(ParsedDicomFile& dicom)
+  void ServerIndex::ReconstructInstance(const ParsedDicomFile& dicom)
   {
     DicomMap summary;
     OrthancConfiguration::DefaultExtractDicomSummary(summary, dicom);
--- a/OrthancServer/Sources/ServerIndex.h	Thu Sep 17 16:18:01 2020 +0200
+++ b/OrthancServer/Sources/ServerIndex.h	Thu Sep 17 17:58:19 2020 +0200
@@ -274,7 +274,7 @@
                       const std::string& publicId,
                       ResourceType parentType);
 
-    void ReconstructInstance(ParsedDicomFile& dicom);
+    void ReconstructInstance(const ParsedDicomFile& dicom);
 
     void ApplyLookupResources(std::vector<std::string>& resourcesId,
                               std::vector<std::string>* instancesId,  // Can be NULL if not needed
--- a/OrthancServer/Sources/ServerJobs/ArchiveJob.cpp	Thu Sep 17 16:18:01 2020 +0200
+++ b/OrthancServer/Sources/ServerJobs/ArchiveJob.cpp	Thu Sep 17 17:58:19 2020 +0200
@@ -240,7 +240,7 @@
 
 
   public:
-    ArchiveIndex(ResourceType level) :
+    explicit ArchiveIndex(ResourceType level) :
       level_(level)
     {
     }
@@ -631,7 +631,7 @@
     }
 
     virtual void Open(ResourceType level,
-                      const std::string& publicId)
+                      const std::string& publicId) ORTHANC_OVERRIDE
     {
       std::string path;
 
@@ -688,13 +688,13 @@
       commands_.AddOpenDirectory(path.c_str());
     }
 
-    virtual void Close()
+    virtual void Close() ORTHANC_OVERRIDE
     {
       commands_.AddCloseDirectory();
     }
 
     virtual void AddInstance(const std::string& instanceId,
-                             const FileInfo& dicom)
+                             const FileInfo& dicom) ORTHANC_OVERRIDE
     {
       char filename[24];
       snprintf(filename, sizeof(filename) - 1, instanceFormat_, counter_);
@@ -722,16 +722,16 @@
     }
 
     virtual void Open(ResourceType level,
-                      const std::string& publicId)
+                      const std::string& publicId) ORTHANC_OVERRIDE
     {
     }
 
-    virtual void Close()
+    virtual void Close() ORTHANC_OVERRIDE
     {
     }
 
     virtual void AddInstance(const std::string& instanceId,
-                             const FileInfo& dicom)
+                             const FileInfo& dicom) ORTHANC_OVERRIDE
     {
       // "DICOM restricts the filenames on DICOM media to 8
       // characters (some systems wrongly use 8.3, but this does not
@@ -976,7 +976,7 @@
       std::unique_ptr<TemporaryFile>   file_;
 
     public:
-      DynamicTemporaryFile(TemporaryFile* f) : file_(f)
+      explicit DynamicTemporaryFile(TemporaryFile* f) : file_(f)
       {
         if (f == NULL)
         {
--- a/OrthancServer/Sources/ServerJobs/CleaningInstancesJob.h	Thu Sep 17 16:18:01 2020 +0200
+++ b/OrthancServer/Sources/ServerJobs/CleaningInstancesJob.h	Thu Sep 17 17:58:19 2020 +0200
@@ -72,8 +72,8 @@
     
     void SetKeepSource(bool keep);
 
-    virtual bool Serialize(Json::Value& target);
+    virtual bool Serialize(Json::Value& target) ORTHANC_OVERRIDE;
 
-    virtual void Start();
+    virtual void Start() ORTHANC_OVERRIDE;
   };
 }
--- a/OrthancServer/Sources/ServerJobs/DicomMoveScuJob.cpp	Thu Sep 17 16:18:01 2020 +0200
+++ b/OrthancServer/Sources/ServerJobs/DicomMoveScuJob.cpp	Thu Sep 17 17:58:19 2020 +0200
@@ -78,12 +78,12 @@
     DicomMoveScuJob&   that_;
 
   public:
-    Unserializer(DicomMoveScuJob&  that) :
+    explicit Unserializer(DicomMoveScuJob&  that) :
       that_(that)
     {
     }
 
-    virtual ICommand* Unserialize(const Json::Value& source) const
+    virtual ICommand* Unserialize(const Json::Value& source) const ORTHANC_OVERRIDE
     {
       DicomMap findAnswer;
       findAnswer.Unserialize(source);
--- a/OrthancServer/Sources/ServerJobs/DicomMoveScuJob.h	Thu Sep 17 16:18:01 2020 +0200
+++ b/OrthancServer/Sources/ServerJobs/DicomMoveScuJob.h	Thu Sep 17 17:58:19 2020 +0200
@@ -59,7 +59,7 @@
     void Retrieve(const DicomMap& findAnswer);
     
   public:
-    DicomMoveScuJob(ServerContext& context) :
+    explicit DicomMoveScuJob(ServerContext& context) :
       context_(context),
       query_(Json::arrayValue)
     {
@@ -91,15 +91,15 @@
     
     void SetTargetAet(const std::string& aet);
 
-    virtual void Stop(JobStopReason reason);
+    virtual void Stop(JobStopReason reason) ORTHANC_OVERRIDE;
 
-    virtual void GetJobType(std::string& target)
+    virtual void GetJobType(std::string& target) ORTHANC_OVERRIDE
     {
       target = "DicomMoveScu";
     }
 
-    virtual void GetPublicContent(Json::Value& value);
+    virtual void GetPublicContent(Json::Value& value) ORTHANC_OVERRIDE;
 
-    virtual bool Serialize(Json::Value& target);
+    virtual bool Serialize(Json::Value& target) ORTHANC_OVERRIDE;
   };
 }
--- a/OrthancServer/Sources/ServerJobs/MergeStudyJob.h	Thu Sep 17 16:18:01 2020 +0200
+++ b/OrthancServer/Sources/ServerJobs/MergeStudyJob.h	Thu Sep 17 17:58:19 2020 +0200
@@ -60,7 +60,7 @@
     void AddSourceStudyInternal(const std::string& study);
 
   protected:
-    virtual bool HandleInstance(const std::string& instance);
+    virtual bool HandleInstance(const std::string& instance) ORTHANC_OVERRIDE;
 
   public:
     MergeStudyJob(ServerContext& context,
@@ -89,17 +89,17 @@
       return origin_;
     }
 
-    virtual void Stop(JobStopReason reason)
+    virtual void Stop(JobStopReason reason) ORTHANC_OVERRIDE
     {
     }
 
-    virtual void GetJobType(std::string& target)
+    virtual void GetJobType(std::string& target) ORTHANC_OVERRIDE
     {
       target = "MergeStudy";
     }
 
-    virtual void GetPublicContent(Json::Value& value);
+    virtual void GetPublicContent(Json::Value& value) ORTHANC_OVERRIDE;
 
-    virtual bool Serialize(Json::Value& target);
+    virtual bool Serialize(Json::Value& target) ORTHANC_OVERRIDE;
   };
 }
--- a/OrthancServer/Sources/ServerJobs/Operations/DeleteResourceOperation.h	Thu Sep 17 16:18:01 2020 +0200
+++ b/OrthancServer/Sources/ServerJobs/Operations/DeleteResourceOperation.h	Thu Sep 17 17:58:19 2020 +0200
@@ -33,6 +33,7 @@
 
 #pragma once
 
+#include "../../../../OrthancFramework/Sources/Compatibility.h"  // For ORTHANC_OVERRIDE
 #include "../../../../OrthancFramework/Sources/JobsEngine/Operations/IJobOperation.h"
 
 namespace Orthanc
@@ -45,15 +46,15 @@
     ServerContext&  context_;
 
   public:
-    DeleteResourceOperation(ServerContext& context) :
-    context_(context)
+    explicit DeleteResourceOperation(ServerContext& context) :
+      context_(context)
     {
     }
 
     virtual void Apply(JobOperationValues& outputs,
-                       const JobOperationValue& input);
+                       const JobOperationValue& input) ORTHANC_OVERRIDE;
 
-    virtual void Serialize(Json::Value& result) const
+    virtual void Serialize(Json::Value& result) const ORTHANC_OVERRIDE
     {
       result = Json::objectValue;
       result["Type"] = "DeleteResource";
--- a/OrthancServer/Sources/ServerJobs/Operations/DicomInstanceOperationValue.h	Thu Sep 17 16:18:01 2020 +0200
+++ b/OrthancServer/Sources/ServerJobs/Operations/DicomInstanceOperationValue.h	Thu Sep 17 17:58:19 2020 +0200
@@ -33,6 +33,7 @@
 
 #pragma once
 
+#include "../../../../OrthancFramework/Sources/Compatibility.h"  // For ORTHANC_OVERRIDE
 #include "../../../../OrthancFramework/Sources/JobsEngine/Operations/JobOperationValue.h"
 
 namespace Orthanc
@@ -66,12 +67,12 @@
 
     void ReadDicom(std::string& dicom) const;
 
-    virtual JobOperationValue* Clone() const
+    virtual JobOperationValue* Clone() const ORTHANC_OVERRIDE
     {
       return new DicomInstanceOperationValue(context_, id_);
     }
 
-    virtual void Serialize(Json::Value& target) const
+    virtual void Serialize(Json::Value& target) const ORTHANC_OVERRIDE
     {
       target = Json::objectValue;
       target["Type"] = "DicomInstance";
--- a/OrthancServer/Sources/ServerJobs/Operations/ModifyInstanceOperation.h	Thu Sep 17 16:18:01 2020 +0200
+++ b/OrthancServer/Sources/ServerJobs/Operations/ModifyInstanceOperation.h	Thu Sep 17 17:58:19 2020 +0200
@@ -67,9 +67,9 @@
     }
 
     virtual void Apply(JobOperationValues& outputs,
-                       const JobOperationValue& input);
+                       const JobOperationValue& input) ORTHANC_OVERRIDE;
 
-    virtual void Serialize(Json::Value& target) const;
+    virtual void Serialize(Json::Value& target) const ORTHANC_OVERRIDE;
   };
 }
 
--- a/OrthancServer/Sources/ServerJobs/Operations/StorePeerOperation.h	Thu Sep 17 16:18:01 2020 +0200
+++ b/OrthancServer/Sources/ServerJobs/Operations/StorePeerOperation.h	Thu Sep 17 17:58:19 2020 +0200
@@ -33,6 +33,7 @@
 
 #pragma once
 
+#include "../../../../OrthancFramework/Sources/Compatibility.h"  // For ORTHANC_OVERRIDE
 #include "../../../../OrthancFramework/Sources/JobsEngine/Operations/IJobOperation.h"
 #include "../../../../OrthancFramework/Sources/WebServiceParameters.h"
 
@@ -44,12 +45,12 @@
     WebServiceParameters peer_;
 
   public:
-    StorePeerOperation(const WebServiceParameters& peer) :
-    peer_(peer)
+    explicit StorePeerOperation(const WebServiceParameters& peer) :
+      peer_(peer)
     {
     }
 
-    StorePeerOperation(const Json::Value& serialized);
+    explicit StorePeerOperation(const Json::Value& serialized);
 
     const WebServiceParameters& GetPeer() const
     {
@@ -57,9 +58,9 @@
     }
 
     virtual void Apply(JobOperationValues& outputs,
-                       const JobOperationValue& input);
+                       const JobOperationValue& input) ORTHANC_OVERRIDE;
 
-    virtual void Serialize(Json::Value& result) const;
+    virtual void Serialize(Json::Value& result) const ORTHANC_OVERRIDE;
   };
 }
 
--- a/OrthancServer/Sources/ServerJobs/Operations/StoreScuOperation.h	Thu Sep 17 16:18:01 2020 +0200
+++ b/OrthancServer/Sources/ServerJobs/Operations/StoreScuOperation.h	Thu Sep 17 17:58:19 2020 +0200
@@ -33,6 +33,7 @@
 
 #pragma once
 
+#include "../../../../OrthancFramework/Sources/Compatibility.h"  // For ORTHANC_OVERRIDE
 #include "../../../../OrthancFramework/Sources/JobsEngine/Operations/IJobOperation.h"
 #include "../../../../OrthancFramework/Sources/DicomNetworking/TimeoutDicomConnectionManager.h"
 
@@ -75,9 +76,9 @@
     }
 
     virtual void Apply(JobOperationValues& outputs,
-                       const JobOperationValue& input);
+                       const JobOperationValue& input) ORTHANC_OVERRIDE;
 
-    virtual void Serialize(Json::Value& result) const;
+    virtual void Serialize(Json::Value& result) const ORTHANC_OVERRIDE;
   };
 }
 
--- a/OrthancServer/Sources/ServerJobs/Operations/SystemCallOperation.h	Thu Sep 17 16:18:01 2020 +0200
+++ b/OrthancServer/Sources/ServerJobs/Operations/SystemCallOperation.h	Thu Sep 17 17:58:19 2020 +0200
@@ -33,6 +33,7 @@
 
 #pragma once
 
+#include "../../../../OrthancFramework/Sources/Compatibility.h"  // For ORTHANC_OVERRIDE
 #include "../../../../OrthancFramework/Sources/JobsEngine/Operations/IJobOperation.h"
 
 #include <string>
@@ -47,12 +48,12 @@
     std::vector<std::string>  postArguments_;
     
   public:
-    SystemCallOperation(const std::string& command) :
+    explicit SystemCallOperation(const std::string& command) :
       command_(command)
     {
     }
 
-    SystemCallOperation(const Json::Value& serialized);
+    explicit SystemCallOperation(const Json::Value& serialized);
 
     SystemCallOperation(const std::string& command,
                         const std::vector<std::string>& preArguments,
@@ -93,9 +94,9 @@
     const std::string& GetPostArgument(size_t i) const;
 
     virtual void Apply(JobOperationValues& outputs,
-                       const JobOperationValue& input);
+                       const JobOperationValue& input) ORTHANC_OVERRIDE;
 
-    virtual void Serialize(Json::Value& result) const;
+    virtual void Serialize(Json::Value& result) const ORTHANC_OVERRIDE;
   };
 }
 
--- a/OrthancServer/Sources/ServerJobs/OrthancJobUnserializer.h	Thu Sep 17 16:18:01 2020 +0200
+++ b/OrthancServer/Sources/ServerJobs/OrthancJobUnserializer.h	Thu Sep 17 17:58:19 2020 +0200
@@ -45,15 +45,15 @@
     ServerContext&  context_;
 
   public:
-    OrthancJobUnserializer(ServerContext& context) :
+    explicit OrthancJobUnserializer(ServerContext& context) :
       context_(context)
     {
     }
 
-    virtual IJob* UnserializeJob(const Json::Value& value);
+    virtual IJob* UnserializeJob(const Json::Value& value) ORTHANC_OVERRIDE;
 
-    virtual IJobOperation* UnserializeOperation(const Json::Value& value);
+    virtual IJobOperation* UnserializeOperation(const Json::Value& value) ORTHANC_OVERRIDE;
 
-    virtual JobOperationValue* UnserializeValue(const Json::Value& value);
+    virtual JobOperationValue* UnserializeValue(const Json::Value& value) ORTHANC_OVERRIDE;
   };
 }
--- a/OrthancServer/Sources/ServerJobs/OrthancPeerStoreJob.h	Thu Sep 17 16:18:01 2020 +0200
+++ b/OrthancServer/Sources/ServerJobs/OrthancPeerStoreJob.h	Thu Sep 17 17:58:19 2020 +0200
@@ -56,12 +56,12 @@
     uint64_t                     size_;
 
   protected:
-    virtual bool HandleInstance(const std::string& instance);
+    virtual bool HandleInstance(const std::string& instance) ORTHANC_OVERRIDE;
     
-    virtual bool HandleTrailingStep();
+    virtual bool HandleTrailingStep() ORTHANC_OVERRIDE;
 
   public:
-    OrthancPeerStoreJob(ServerContext& context) :
+    explicit OrthancPeerStoreJob(ServerContext& context) :
       context_(context),
       transcode_(false),
       transferSyntax_(DicomTransferSyntax_LittleEndianExplicit),  // Dummy value
@@ -100,15 +100,15 @@
 
     void SetCompress(bool compress);
 
-    virtual void Stop(JobStopReason reason);   // For pausing jobs
+    virtual void Stop(JobStopReason reason) ORTHANC_OVERRIDE;   // For pausing jobs
 
-    virtual void GetJobType(std::string& target)
+    virtual void GetJobType(std::string& target) ORTHANC_OVERRIDE
     {
       target = "OrthancPeerStore";
     }
 
-    virtual void GetPublicContent(Json::Value& value);
+    virtual void GetPublicContent(Json::Value& value) ORTHANC_OVERRIDE;
 
-    virtual bool Serialize(Json::Value& target);
+    virtual bool Serialize(Json::Value& target) ORTHANC_OVERRIDE;
   };
 }
--- a/OrthancServer/Sources/ServerJobs/ResourceModificationJob.cpp	Thu Sep 17 16:18:01 2020 +0200
+++ b/OrthancServer/Sources/ServerJobs/ResourceModificationJob.cpp	Thu Sep 17 17:58:19 2020 +0200
@@ -53,7 +53,7 @@
     std::string   patientId_;
 
   public:
-    Output(ResourceType level) :
+    explicit Output(ResourceType level) :
       level_(level),
       isFirst_(true)
     {
--- a/OrthancServer/Sources/ServerJobs/ResourceModificationJob.h	Thu Sep 17 16:18:01 2020 +0200
+++ b/OrthancServer/Sources/ServerJobs/ResourceModificationJob.h	Thu Sep 17 17:58:19 2020 +0200
@@ -54,7 +54,7 @@
     DicomTransferSyntax                 transferSyntax_;
 
   protected:
-    virtual bool HandleInstance(const std::string& instance);
+    virtual bool HandleInstance(const std::string& instance) ORTHANC_OVERRIDE;
     
   public:
     explicit ResourceModificationJob(ServerContext& context);
@@ -95,17 +95,17 @@
 
     void ClearTranscode();
 
-    virtual void Stop(JobStopReason reason)
+    virtual void Stop(JobStopReason reason) ORTHANC_OVERRIDE
     {
     }
 
-    virtual void GetJobType(std::string& target)
+    virtual void GetJobType(std::string& target) ORTHANC_OVERRIDE
     {
       target = "ResourceModification";
     }
 
-    virtual void GetPublicContent(Json::Value& value);
+    virtual void GetPublicContent(Json::Value& value) ORTHANC_OVERRIDE;
     
-    virtual bool Serialize(Json::Value& value);
+    virtual bool Serialize(Json::Value& value) ORTHANC_OVERRIDE;
   };
 }
--- a/OrthancServer/Sources/ServerJobs/SplitStudyJob.h	Thu Sep 17 16:18:01 2020 +0200
+++ b/OrthancServer/Sources/ServerJobs/SplitStudyJob.h	Thu Sep 17 17:58:19 2020 +0200
@@ -62,7 +62,7 @@
     void Setup();
     
   protected:
-    virtual bool HandleInstance(const std::string& instance);
+    virtual bool HandleInstance(const std::string& instance) ORTHANC_OVERRIDE;
 
   public:
     SplitStudyJob(ServerContext& context,
@@ -113,17 +113,17 @@
       return origin_;
     }
 
-    virtual void Stop(JobStopReason reason)
+    virtual void Stop(JobStopReason reason) ORTHANC_OVERRIDE
     {
     }
 
-    virtual void GetJobType(std::string& target)
+    virtual void GetJobType(std::string& target) ORTHANC_OVERRIDE
     {
       target = "SplitStudy";
     }
 
-    virtual void GetPublicContent(Json::Value& value);
+    virtual void GetPublicContent(Json::Value& value) ORTHANC_OVERRIDE;
 
-    virtual bool Serialize(Json::Value& target);
+    virtual bool Serialize(Json::Value& target) ORTHANC_OVERRIDE;
   };
 }
--- a/OrthancServer/Sources/ServerJobs/StorageCommitmentScpJob.cpp	Thu Sep 17 16:18:01 2020 +0200
+++ b/OrthancServer/Sources/ServerJobs/StorageCommitmentScpJob.cpp	Thu Sep 17 17:58:19 2020 +0200
@@ -70,7 +70,7 @@
     StorageCommitmentScpJob&  that_;
 
   public:
-    SetupCommand(StorageCommitmentScpJob& that) :
+    explicit SetupCommand(StorageCommitmentScpJob& that) :
       that_(that)
     {
     }
@@ -155,7 +155,7 @@
     StorageCommitmentScpJob&  that_;
 
   public:
-    AnswerCommand(StorageCommitmentScpJob& that) :
+    explicit AnswerCommand(StorageCommitmentScpJob& that) :
       that_(that)
     {
       if (that_.ready_)
@@ -193,13 +193,13 @@
     StorageCommitmentScpJob&  that_;
 
   public:
-    Unserializer(StorageCommitmentScpJob& that) :
+    explicit Unserializer(StorageCommitmentScpJob& that) :
       that_(that)
     {
       that_.ready_ = false;
     }
 
-    virtual ICommand* Unserialize(const Json::Value& source) const
+    virtual ICommand* Unserialize(const Json::Value& source) const ORTHANC_OVERRIDE
     {
       const std::string type = SerializationToolbox::ReadString(source, TYPE);
 
--- a/OrthancServer/Sources/SliceOrdering.cpp	Thu Sep 17 16:18:01 2020 +0200
+++ b/OrthancServer/Sources/SliceOrdering.cpp	Thu Sep 17 17:58:19 2020 +0200
@@ -272,7 +272,7 @@
     const Vector&  normal_;
 
   public:
-    PositionComparator(const Vector& normal) : normal_(normal)
+    explicit PositionComparator(const Vector& normal) : normal_(normal)
     {
     }
     
--- a/OrthancServer/Sources/StorageCommitmentReports.h	Thu Sep 17 16:18:01 2020 +0200
+++ b/OrthancServer/Sources/StorageCommitmentReports.h	Thu Sep 17 17:58:19 2020 +0200
@@ -37,7 +37,7 @@
 
 namespace Orthanc
 {
-  class StorageCommitmentReports
+  class StorageCommitmentReports : public boost::noncopyable
   {
   public:
     class Report : public boost::noncopyable
@@ -70,7 +70,7 @@
       std::string         remoteAet_;
 
     public:
-      Report(const std::string& remoteAet) :
+      explicit Report(const std::string& remoteAet) :
         isComplete_(false),
         remoteAet_(remoteAet)
       {
@@ -105,7 +105,7 @@
     size_t         maxSize_;
 
   public:
-    StorageCommitmentReports(size_t maxSize) :
+    explicit StorageCommitmentReports(size_t maxSize) :
       maxSize_(maxSize)
     {
     }
--- a/OrthancServer/Sources/main.cpp	Thu Sep 17 16:18:01 2020 +0200
+++ b/OrthancServer/Sources/main.cpp	Thu Sep 17 17:58:19 2020 +0200
@@ -66,7 +66,7 @@
   ServerContext& context_;
 
 public:
-  OrthancStoreRequestHandler(ServerContext& context) :
+  explicit OrthancStoreRequestHandler(ServerContext& context) :
     context_(context)
   {
   }
@@ -77,7 +77,7 @@
                       const Json::Value& dicomJson,
                       const std::string& remoteIp,
                       const std::string& remoteAet,
-                      const std::string& calledAet) 
+                      const std::string& calledAet) ORTHANC_OVERRIDE 
   {
     if (dicomFile.size() > 0)
     {
@@ -102,7 +102,7 @@
   ServerContext& context_;
   
 public:
-  OrthancStorageCommitmentRequestHandler(ServerContext& context) :
+  explicit OrthancStorageCommitmentRequestHandler(ServerContext& context) :
     context_(context)
   {
   }
@@ -112,7 +112,7 @@
                              const std::vector<std::string>& referencedSopInstanceUids,
                              const std::string& remoteIp,
                              const std::string& remoteAet,
-                             const std::string& calledAet)
+                             const std::string& calledAet) ORTHANC_OVERRIDE
   {
     if (referencedSopClassUids.size() != referencedSopInstanceUids.size())
     {
@@ -140,7 +140,7 @@
                             const std::vector<StorageCommitmentFailureReason>& failureReasons,
                             const std::string& remoteIp,
                             const std::string& remoteAet,
-                            const std::string& calledAet)
+                            const std::string& calledAet) ORTHANC_OVERRIDE
   {
     if (successSopClassUids.size() != successSopInstanceUids.size() ||
         failedSopClassUids.size() != failedSopInstanceUids.size() ||
@@ -174,14 +174,14 @@
 {
 public:
   virtual bool IsSameAETitle(const std::string& aet1,
-                             const std::string& aet2) 
+                             const std::string& aet2) ORTHANC_OVERRIDE
   {
     OrthancConfiguration::ReaderLock lock;
     return lock.GetConfiguration().IsSameAETitle(aet1, aet2);
   }
 
   virtual bool LookupAETitle(RemoteModalityParameters& modality,
-                             const std::string& aet) 
+                             const std::string& aet) ORTHANC_OVERRIDE
   {
     OrthancConfiguration::ReaderLock lock;
     return lock.GetConfiguration().LookupDicomModalityUsingAETitle(modality, aet);
@@ -200,16 +200,16 @@
   ServerContext& context_;
 
 public:
-  MyDicomServerFactory(ServerContext& context) : context_(context)
+  explicit MyDicomServerFactory(ServerContext& context) : context_(context)
   {
   }
 
-  virtual IStoreRequestHandler* ConstructStoreRequestHandler()
+  virtual IStoreRequestHandler* ConstructStoreRequestHandler() ORTHANC_OVERRIDE
   {
     return new OrthancStoreRequestHandler(context_);
   }
 
-  virtual IFindRequestHandler* ConstructFindRequestHandler()
+  virtual IFindRequestHandler* ConstructFindRequestHandler() ORTHANC_OVERRIDE
   {
     std::unique_ptr<OrthancFindRequestHandler> result(new OrthancFindRequestHandler(context_));
 
@@ -242,17 +242,17 @@
     return result.release();
   }
 
-  virtual IMoveRequestHandler* ConstructMoveRequestHandler()
+  virtual IMoveRequestHandler* ConstructMoveRequestHandler() ORTHANC_OVERRIDE
   {
     return new OrthancMoveRequestHandler(context_);
   }
   
-  virtual IGetRequestHandler* ConstructGetRequestHandler()
+  virtual IGetRequestHandler* ConstructGetRequestHandler() ORTHANC_OVERRIDE
   {
     return new OrthancGetRequestHandler(context_);
   }
   
-  virtual IStorageCommitmentRequestHandler* ConstructStorageCommitmentRequestHandler()
+  virtual IStorageCommitmentRequestHandler* ConstructStorageCommitmentRequestHandler() ORTHANC_OVERRIDE
   {
     return new OrthancStorageCommitmentRequestHandler(context_);
   }
@@ -272,7 +272,7 @@
   bool            alwaysAllowStore_;
 
 public:
-  OrthancApplicationEntityFilter(ServerContext& context) :
+  explicit OrthancApplicationEntityFilter(ServerContext& context) :
     context_(context)
   {
     OrthancConfiguration::ReaderLock lock;
@@ -282,7 +282,7 @@
 
   virtual bool IsAllowedConnection(const std::string& remoteIp,
                                    const std::string& remoteAet,
-                                   const std::string& calledAet)
+                                   const std::string& calledAet) ORTHANC_OVERRIDE
   {
     LOG(INFO) << "Incoming connection from AET " << remoteAet
               << " on IP " << remoteIp << ", calling AET " << calledAet;
@@ -302,7 +302,7 @@
   virtual bool IsAllowedRequest(const std::string& remoteIp,
                                 const std::string& remoteAet,
                                 const std::string& calledAet,
-                                DicomRequestType type)
+                                DicomRequestType type) ORTHANC_OVERRIDE
   {
     LOG(INFO) << "Incoming " << EnumerationToString(type) << " request from AET "
               << remoteAet << " on IP " << remoteIp << ", calling AET " << calledAet;
@@ -356,7 +356,7 @@
   virtual bool IsAllowedTransferSyntax(const std::string& remoteIp,
                                        const std::string& remoteAet,
                                        const std::string& calledAet,
-                                       TransferSyntax syntax)
+                                       TransferSyntax syntax) ORTHANC_OVERRIDE
   {
     std::string configuration;
 
@@ -422,7 +422,7 @@
 
   virtual bool IsUnknownSopClassAccepted(const std::string& remoteIp,
                                          const std::string& remoteAet,
-                                         const std::string& calledAet)
+                                         const std::string& calledAet) ORTHANC_OVERRIDE
   {
     static const char* configuration = "UnknownSopClassAccepted";
 
@@ -468,7 +468,7 @@
                          const char* ip,
                          const char* username,
                          const IHttpHandler::Arguments& httpHeaders,
-                         const IHttpHandler::GetArguments& getArguments)
+                         const IHttpHandler::GetArguments& getArguments) ORTHANC_OVERRIDE
   {
 #if ORTHANC_ENABLE_PLUGINS == 1
     if (plugins_ != NULL &&
@@ -544,7 +544,7 @@
   virtual void Format(HttpOutput& output,
                       const OrthancException& exception,
                       HttpMethod method,
-                      const char* uri)
+                      const char* uri) ORTHANC_OVERRIDE
   {
     {
       bool isPlugin = false;
@@ -800,15 +800,15 @@
 #if ORTHANC_ENABLE_PLUGINS == 1
 static void LoadPlugins(OrthancPlugins& plugins)
 {
-  std::list<std::string> path;
+  std::list<std::string> pathList;
 
   {
     OrthancConfiguration::ReaderLock lock;
-    lock.GetConfiguration().GetListOfStringsParameter(path, "Plugins");
+    lock.GetConfiguration().GetListOfStringsParameter(pathList, "Plugins");
   }
 
   for (std::list<std::string>::const_iterator
-         it = path.begin(); it != path.end(); ++it)
+         it = pathList.begin(); it != pathList.end(); ++it)
   {
     std::string path;
 
@@ -827,7 +827,7 @@
 
 // Returns "true" if restart is required
 static bool WaitForExit(ServerContext& context,
-                        OrthancRestApi& restApi)
+                        const OrthancRestApi& restApi)
 {
   LOG(WARNING) << "Orthanc has started";
 
@@ -899,7 +899,7 @@
 
 
 static bool StartHttpServer(ServerContext& context,
-                            OrthancRestApi& restApi,
+                            const OrthancRestApi& restApi,
                             OrthancPlugins* plugins)
 {
   bool httpServerEnabled;
@@ -1068,7 +1068,7 @@
 
 
 static bool StartDicomServer(ServerContext& context,
-                             OrthancRestApi& restApi,
+                             const OrthancRestApi& restApi,
                              OrthancPlugins* plugins)
 {
   bool dicomServerEnabled;