changeset 1304:7b6925b0890d

cppcheck
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 10 Feb 2015 17:03:17 +0100
parents bba8a47922d1
children 536515f87cb4
files OrthancServer/Scheduler/ServerCommandInstance.cpp OrthancServer/Scheduler/ServerJob.cpp OrthancServer/Scheduler/ServerScheduler.cpp OrthancServer/ServerContext.cpp OrthancServer/ServerIndex.cpp Plugins/Engine/PluginsManager.cpp Plugins/Samples/StorageArea/Plugin.cpp UnitTestsSources/DicomMapTests.cpp UnitTestsSources/MultiThreadingTests.cpp
diffstat 9 files changed, 29 insertions(+), 28 deletions(-) [+]
line wrap: on
line diff
--- a/OrthancServer/Scheduler/ServerCommandInstance.cpp	Tue Feb 10 16:47:24 2015 +0100
+++ b/OrthancServer/Scheduler/ServerCommandInstance.cpp	Tue Feb 10 17:03:17 2015 +0100
@@ -60,10 +60,10 @@
     }
 
     for (std::list<ServerCommandInstance*>::iterator
-           it = next_.begin(); it != next_.end(); it++)
+           it = next_.begin(); it != next_.end(); ++it)
     {
       for (ListOfStrings::const_iterator
-             output = outputs.begin(); output != outputs.end(); output++)
+             output = outputs.begin(); output != outputs.end(); ++output)
       {
         (*it)->AddInput(*output);
       }
--- a/OrthancServer/Scheduler/ServerJob.cpp	Tue Feb 10 16:47:24 2015 +0100
+++ b/OrthancServer/Scheduler/ServerJob.cpp	Tue Feb 10 17:03:17 2015 +0100
@@ -44,18 +44,18 @@
 
     unsigned int count = 0;
     for (std::list<ServerCommandInstance*>::const_iterator
-           it = filters_.begin(); it != filters_.end(); it++)
+           it = filters_.begin(); it != filters_.end(); ++it)
     {
       index[*it] = count++;
     }
 
     for (std::list<ServerCommandInstance*>::const_iterator
-           it = filters_.begin(); it != filters_.end(); it++)
+           it = filters_.begin(); it != filters_.end(); ++it)
     {
       const std::list<ServerCommandInstance*>& nextCommands = (*it)->GetNextCommands();
 
       for (std::list<ServerCommandInstance*>::const_iterator
-             next = nextCommands.begin(); next != nextCommands.end(); next++)
+             next = nextCommands.begin(); next != nextCommands.end(); ++next)
       {
         if (index.find(*next) == index.end() ||
             index[*next] <= index[*it])
@@ -82,7 +82,7 @@
     size_t size = filters_.size();
 
     for (std::list<ServerCommandInstance*>::iterator 
-           it = filters_.begin(); it != filters_.end(); it++)
+           it = filters_.begin(); it != filters_.end(); ++it)
     {
       target.Enqueue(*it);
     }
@@ -94,24 +94,24 @@
   }
 
 
-  ServerJob::ServerJob()
+  ServerJob::ServerJob() :
+    jobId_(Toolbox::GenerateUuid()),
+    submitted_(false),
+    description_("no description")
   {
-    jobId_ = Toolbox::GenerateUuid();      
-    submitted_ = false;
-    description_ = "no description";
   }
 
 
   ServerJob::~ServerJob()
   {
     for (std::list<ServerCommandInstance*>::iterator
-           it = filters_.begin(); it != filters_.end(); it++)
+           it = filters_.begin(); it != filters_.end(); ++it)
     {
       delete *it;
     }
 
     for (std::list<IDynamicObject*>::iterator
-           it = payloads_.begin(); it != payloads_.end(); it++)
+           it = payloads_.begin(); it != payloads_.end(); ++it)
     {
       delete *it;
     }
--- a/OrthancServer/Scheduler/ServerScheduler.cpp	Tue Feb 10 16:47:24 2015 +0100
+++ b/OrthancServer/Scheduler/ServerScheduler.cpp	Tue Feb 10 17:03:17 2015 +0100
@@ -55,7 +55,7 @@
                          const ListOfStrings& inputs)
       {
         for (ListOfStrings::const_iterator 
-               it = inputs.begin(); it != inputs.end(); it++)
+               it = inputs.begin(); it != inputs.end(); ++it)
         {
           target_.push_back(*it);
         }
@@ -232,7 +232,7 @@
     ServerCommandInstance& sink = job.AddCommand(new Sink(outputs));
 
     for (std::list<ServerCommandInstance*>::iterator
-           it = job.filters_.begin(); it != job.filters_.end(); it++)
+           it = job.filters_.begin(); it != job.filters_.end(); ++it)
     {
       if ((*it) != &sink &&
           (*it)->IsConnectedToSink())
@@ -328,7 +328,7 @@
     jobs.clear();
 
     for (Jobs::const_iterator 
-           it = jobs_.begin(); it != jobs_.end(); it++)
+           it = jobs_.begin(); it != jobs_.end(); ++it)
     {
       jobs.push_back(it->first);
     }
--- a/OrthancServer/ServerContext.cpp	Tue Feb 10 16:47:24 2015 +0100
+++ b/OrthancServer/ServerContext.cpp	Tue Feb 10 17:03:17 2015 +0100
@@ -320,7 +320,7 @@
       dicom.GetMetadata().clear();
 
       for (InstanceMetadata::const_iterator it = instanceMetadata.begin();
-           it != instanceMetadata.end(); it++)
+           it != instanceMetadata.end(); ++it)
       {
         dicom.GetMetadata().insert(std::make_pair(std::make_pair(ResourceType_Instance, it->first),
                                                   it->second));
--- a/OrthancServer/ServerIndex.cpp	Tue Feb 10 16:47:24 2015 +0100
+++ b/OrthancServer/ServerIndex.cpp	Tue Feb 10 17:03:17 2015 +0100
@@ -139,7 +139,7 @@
       {
         for (std::list<ServerIndexChange>::const_iterator 
                it = pendingChanges_.begin(); 
-             it != pendingChanges_.end(); it++)
+             it != pendingChanges_.end(); ++it)
         {
           context_.SignalChange(*it);
         }
@@ -1077,7 +1077,7 @@
 
     target = Json::arrayValue;
     for (std::list<std::string>::const_iterator
-           it = lst.begin(); it != lst.end(); it++)
+           it = lst.begin(); it != lst.end(); ++it)
     {
       target.append(*it);
     }
@@ -1093,7 +1093,7 @@
   {
     Json::Value items = Json::arrayValue;
     for (typename std::list<T>::const_iterator
-           it = log.begin(); it != log.end(); it++)
+           it = log.begin(); it != log.end(); ++it)
     {
       Json::Value item;
       it->Format(item);
@@ -2006,7 +2006,7 @@
     db_.ListAvailableMetadata(metadata, id);
 
     for (std::list<MetadataType>::const_iterator
-           it = metadata.begin(); it != metadata.end(); it++)
+           it = metadata.begin(); it != metadata.end(); ++it)
     {
       std::string key = EnumerationToString(*it);
 
--- a/Plugins/Engine/PluginsManager.cpp	Tue Feb 10 16:47:24 2015 +0100
+++ b/Plugins/Engine/PluginsManager.cpp	Tue Feb 10 17:03:17 2015 +0100
@@ -312,7 +312,7 @@
     result.clear();
 
     for (Plugins::const_iterator it = plugins_.begin(); 
-         it != plugins_.end(); it++)
+         it != plugins_.end(); ++it)
     {
       result.push_back(it->first);
     }
--- a/Plugins/Samples/StorageArea/Plugin.cpp	Tue Feb 10 16:47:24 2015 +0100
+++ b/Plugins/Samples/StorageArea/Plugin.cpp	Tue Feb 10 17:03:17 2015 +0100
@@ -96,7 +96,7 @@
   else
   {
     *content = malloc(*size);
-    if (content == NULL ||
+    if (*content == NULL ||
         fread(*content, *size, 1, fp) != 1)
     {
       ok = false;
@@ -121,14 +121,13 @@
 {
   ORTHANC_PLUGINS_API int32_t OrthancPluginInitialize(OrthancPluginContext* c)
   {
-    char info[1024];
-
     context = c;
     OrthancPluginLogWarning(context, "Storage plugin is initializing");
 
     /* Check the version of the Orthanc core */
     if (OrthancPluginCheckVersion(c) == 0)
     {
+      char info[1024];
       sprintf(info, "Your version of Orthanc (%s) must be above %d.%d.%d to run this plugin",
               c->orthancVersion,
               ORTHANC_PLUGINS_MINIMAL_MAJOR_NUMBER,
--- a/UnitTestsSources/DicomMapTests.cpp	Tue Feb 10 16:47:24 2015 +0100
+++ b/UnitTestsSources/DicomMapTests.cpp	Tue Feb 10 17:03:17 2015 +0100
@@ -141,7 +141,7 @@
   DicomMap::GetMainDicomTags(main, level);
   
   // The main dicom tags are a subset of the module
-  for (std::set<DicomTag>::const_iterator it = main.begin(); it != main.end(); it++)
+  for (std::set<DicomTag>::const_iterator it = main.begin(); it != main.end(); ++it)
   {
     bool ok = moduleTags.find(*it) != moduleTags.end();
 
--- a/UnitTestsSources/MultiThreadingTests.cpp	Tue Feb 10 16:47:24 2015 +0100
+++ b/UnitTestsSources/MultiThreadingTests.cpp	Tue Feb 10 17:03:17 2015 +0100
@@ -291,7 +291,7 @@
                      const ListOfStrings& inputs)
   {
     for (ListOfStrings::const_iterator 
-           it = inputs.begin(); it != inputs.end(); it++)
+           it = inputs.begin(); it != inputs.end(); ++it)
     {
       int a = boost::lexical_cast<int>(*it);
       int b = factor_ * a;
@@ -318,8 +318,10 @@
   {
     ListOfStrings l;
     s->GetListOfJobs(l);
-    for (ListOfStrings::iterator i = l.begin(); i != l.end(); i++)
-      printf(">> %s: %0.1f\n", i->c_str(), 100.0f * s->GetProgress(*i));
+    for (ListOfStrings::iterator it = l.begin(); it != l.end(); ++it)
+    {
+      printf(">> %s: %0.1f\n", it->c_str(), 100.0f * s->GetProgress(*it));
+    }
     Toolbox::USleep(10000);
   }
 }