changeset 1847:559956d5ceb2

cppcheck
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 30 Nov 2015 15:34:14 +0100
parents 3dcf5c0734c9
children e39716f71d67
files Core/MultiThreading/RunnableWorkersPool.cpp OrthancServer/DatabaseWrapper.cpp OrthancServer/DicomProtocol/DicomFindAnswers.cpp OrthancServer/DicomProtocol/DicomServer.h OrthancServer/OrthancRestApi/OrthancRestArchive.cpp OrthancServer/OrthancRestApi/OrthancRestResources.cpp OrthancServer/ServerToolbox.cpp Plugins/Engine/OrthancPlugins.cpp Plugins/Samples/DatabasePlugin/Database.cpp
diffstat 9 files changed, 28 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/Core/MultiThreading/RunnableWorkersPool.cpp	Mon Nov 30 14:51:43 2015 +0100
+++ b/Core/MultiThreading/RunnableWorkersPool.cpp	Mon Nov 30 15:34:14 2015 +0100
@@ -105,7 +105,7 @@
   {
     pimpl_->continue_ = true;
 
-    if (countWorkers <= 0)
+    if (countWorkers == 0)
     {
       throw OrthancException(ErrorCode_ParameterOutOfRange);
     }
--- a/OrthancServer/DatabaseWrapper.cpp	Mon Nov 30 14:51:43 2015 +0100
+++ b/OrthancServer/DatabaseWrapper.cpp	Mon Nov 30 15:34:14 2015 +0100
@@ -256,12 +256,20 @@
   }
 
     
-  DatabaseWrapper::DatabaseWrapper(const std::string& path) : listener_(NULL), base_(db_)
+  DatabaseWrapper::DatabaseWrapper(const std::string& path) : 
+    listener_(NULL), 
+    base_(db_),
+    signalRemainingAncestor_(NULL),
+    version_(0)
   {
     db_.Open(path);
   }
 
-  DatabaseWrapper::DatabaseWrapper() : listener_(NULL), base_(db_)
+  DatabaseWrapper::DatabaseWrapper() : 
+    listener_(NULL), 
+    base_(db_),
+    signalRemainingAncestor_(NULL),
+    version_(0)
   {
     db_.OpenInMemory();
   }
--- a/OrthancServer/DicomProtocol/DicomFindAnswers.cpp	Mon Nov 30 14:51:43 2015 +0100
+++ b/OrthancServer/DicomProtocol/DicomFindAnswers.cpp	Mon Nov 30 15:34:14 2015 +0100
@@ -39,11 +39,12 @@
 
 #include <memory>
 #include <dcmtk/dcmdata/dcfilefo.h>
+#include <boost/noncopyable.hpp>
 
 
 namespace Orthanc
 {
-  class DicomFindAnswers::Answer
+  class DicomFindAnswers::Answer : public boost::noncopyable
   {
   private:
     ParsedDicomFile* dicom_;
--- a/OrthancServer/DicomProtocol/DicomServer.h	Mon Nov 30 14:51:43 2015 +0100
+++ b/OrthancServer/DicomProtocol/DicomServer.h	Mon Nov 30 15:34:14 2015 +0100
@@ -54,7 +54,6 @@
     std::string aet_;
     uint16_t port_;
     bool continue_;
-    bool started_;
     uint32_t clientTimeout_;
     IFindRequestHandlerFactory* findRequestHandlerFactory_;
     IMoveRequestHandlerFactory* moveRequestHandlerFactory_;
--- a/OrthancServer/OrthancRestApi/OrthancRestArchive.cpp	Mon Nov 30 14:51:43 2015 +0100
+++ b/OrthancServer/OrthancRestApi/OrthancRestArchive.cpp	Mon Nov 30 15:34:14 2015 +0100
@@ -451,8 +451,10 @@
       ArchiveWriterVisitor(HierarchicalZipWriter& writer,
                            ServerContext& context) :
         writer_(writer),
-        context_(context)
+        context_(context),
+        countInstances_(0)
       {
+        snprintf(instanceFormat_, sizeof(instanceFormat_) - 1, "%%08d.dcm");
       }
 
       virtual void Open(ResourceType level,
--- a/OrthancServer/OrthancRestApi/OrthancRestResources.cpp	Mon Nov 30 14:51:43 2015 +0100
+++ b/OrthancServer/OrthancRestApi/OrthancRestResources.cpp	Mon Nov 30 15:34:14 2015 +0100
@@ -359,7 +359,7 @@
         try
         {
           quality_ = boost::lexical_cast<unsigned int>(v);
-          ok = (quality_ >= 0 && quality_ <= 100);
+          ok = (quality_ >= 1 && quality_ <= 100);
         }
         catch (boost::bad_lexical_cast&)
         {
@@ -1097,11 +1097,13 @@
       size_t limit = 0;
       if (request.isMember("Limit"))
       {
-        limit = request["CaseSensitive"].asInt();
-        if (limit < 0)
+        int tmp = request["CaseSensitive"].asInt();
+        if (tmp < 0)
         {
           throw OrthancException(ErrorCode_ParameterOutOfRange);
         }
+
+        limit = static_cast<size_t>(tmp);
       }
 
       std::string level = request["Level"].asString();
--- a/OrthancServer/ServerToolbox.cpp	Mon Nov 30 14:51:43 2015 +0100
+++ b/OrthancServer/ServerToolbox.cpp	Mon Nov 30 15:34:14 2015 +0100
@@ -297,7 +297,7 @@
       database.GetAllPublicIds(resources, level);
 
       for (std::list<std::string>::const_iterator
-             it = resources.begin(); it != resources.end(); it++)
+             it = resources.begin(); it != resources.end(); ++it)
       {
         // Locate the resource and one of its child instances
         int64_t resource, instance;
--- a/Plugins/Engine/OrthancPlugins.cpp	Mon Nov 30 14:51:43 2015 +0100
+++ b/Plugins/Engine/OrthancPlugins.cpp	Mon Nov 30 15:34:14 2015 +0100
@@ -1608,8 +1608,7 @@
       return true;
     }
 
-
-    std::auto_ptr<boost::recursive_mutex::scoped_lock> lock;   // (*)
+    boost::recursive_mutex::scoped_lock lock(pimpl_->invokeServiceMutex_);   // (*)
 
     switch (service)
     {
--- a/Plugins/Samples/DatabasePlugin/Database.cpp	Mon Nov 30 14:51:43 2015 +0100
+++ b/Plugins/Samples/DatabasePlugin/Database.cpp	Mon Nov 30 15:34:14 2015 +0100
@@ -123,7 +123,8 @@
 
 public:
   SignalRemainingAncestor() : 
-    hasRemainingAncestor_(false)
+    hasRemainingAncestor_(false),
+    remainingType_(OrthancPluginResourceType_Instance)  // Some dummy value
   {
   }
 
@@ -175,7 +176,8 @@
 
 Database::Database(const std::string& path) : 
   path_(path),
-  base_(db_)
+  base_(db_),
+  signalRemainingAncestor_(NULL)
 {
 }
 
@@ -381,7 +383,7 @@
                         const std::list<I>& source)
 {
   for (typename std::list<I>::const_iterator 
-         it = source.begin(); it != source.end(); it++)
+         it = source.begin(); it != source.end(); ++it)
   {
     target.push_back(*it);
   }