changeset 4223:3d6f14a05db1

cppcheck
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 30 Sep 2020 16:25:48 +0200
parents 7461f98c23a0
children 38d446c9ee1d
files OrthancFramework/Sources/DicomFormat/DicomStreamReader.h OrthancFramework/Sources/DicomFormat/StreamBlockReader.h OrthancFramework/Sources/SystemToolbox.cpp OrthancFramework/UnitTestsSources/DicomMapTests.cpp OrthancServer/Plugins/Engine/OrthancPlugins.cpp OrthancServer/Resources/RunCppCheck.sh OrthancServer/Sources/ServerJobs/ResourceModificationJob.cpp
diffstat 7 files changed, 13 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/OrthancFramework/Sources/DicomFormat/DicomStreamReader.h	Wed Sep 30 15:53:17 2020 +0200
+++ b/OrthancFramework/Sources/DicomFormat/DicomStreamReader.h	Wed Sep 30 16:25:48 2020 +0200
@@ -104,7 +104,7 @@
                             const std::string& block);
     
   public:
-    DicomStreamReader(std::istream& stream);
+    explicit DicomStreamReader(std::istream& stream);
 
     /**
      * Consume all the available bytes from the input stream, until
--- a/OrthancFramework/Sources/DicomFormat/StreamBlockReader.h	Wed Sep 30 15:53:17 2020 +0200
+++ b/OrthancFramework/Sources/DicomFormat/StreamBlockReader.h	Wed Sep 30 16:25:48 2020 +0200
@@ -43,7 +43,7 @@
     uint64_t       processedBytes_;
 
   public:
-    StreamBlockReader(std::istream& stream);
+    explicit StreamBlockReader(std::istream& stream);
 
     /**
      * Schedule the size of the next block to be extracted from the
--- a/OrthancFramework/Sources/SystemToolbox.cpp	Wed Sep 30 15:53:17 2020 +0200
+++ b/OrthancFramework/Sources/SystemToolbox.cpp	Wed Sep 30 16:25:48 2020 +0200
@@ -308,7 +308,7 @@
       // https://stackoverflow.com/a/23826489/881731
       f.flush();
 
-      bool success = false;
+      bool success;
 
       /**
        * "f->handle()" corresponds to "FILE*" (aka "HANDLE") on
--- a/OrthancFramework/UnitTestsSources/DicomMapTests.cpp	Wed Sep 30 15:53:17 2020 +0200
+++ b/OrthancFramework/UnitTestsSources/DicomMapTests.cpp	Wed Sep 30 16:25:48 2020 +0200
@@ -885,12 +885,12 @@
 
   r.Consume(visitor);
 
-  printf(">> %d\n", r.GetProcessedBytes());
+  printf(">> %d\n", static_cast<int>(r.GetProcessedBytes()));
 }
 
 TEST(DicomStreamReader, DISABLED_Tutu2)
 {
-  static const std::string PATH = "/home/jodogne/Subversion/orthanc-tests/Database/TransferSyntaxes/";
+  //static const std::string PATH = "/home/jodogne/Subversion/orthanc-tests/Database/TransferSyntaxes/";
 
   //const std::string path = PATH + "1.2.840.10008.1.2.4.50.dcm";
   //const std::string path = PATH + "1.2.840.10008.1.2.2.dcm";
@@ -903,7 +903,7 @@
 
   r.Consume(visitor);
 
-  printf(">> %d\n", r.GetProcessedBytes());
+  printf(">> %d\n", static_cast<int>(r.GetProcessedBytes()));
 }
 
 
@@ -1011,5 +1011,5 @@
     printf("[%s]\n", it->c_str());
   }
 
-  printf("\n== SUCCESSES: %d ==\n\n", success);
+  printf("\n== SUCCESSES: %u ==\n\n", success);
 }
--- a/OrthancServer/Plugins/Engine/OrthancPlugins.cpp	Wed Sep 30 15:53:17 2020 +0200
+++ b/OrthancServer/Plugins/Engine/OrthancPlugins.cpp	Wed Sep 30 16:25:48 2020 +0200
@@ -730,7 +730,7 @@
       boost::regex                      regex_;
 
     public:
-      explicit ChunkedRestCallback(_OrthancPluginChunkedRestCallback parameters) :
+      explicit ChunkedRestCallback(const _OrthancPluginChunkedRestCallback& parameters) :
         parameters_(parameters),
         regex_(parameters.pathRegularExpression)
       {
@@ -759,7 +759,7 @@
         void*    handler_;
 
       public:
-        Handler(_OrthancPluginRegisterStorageCommitmentScpCallback  parameters,
+        Handler(const _OrthancPluginRegisterStorageCommitmentScpCallback& parameters,
                 void* handler) :
           parameters_(parameters),
           handler_(handler)
@@ -800,7 +800,7 @@
       _OrthancPluginRegisterStorageCommitmentScpCallback  parameters_;
 
     public:
-      explicit StorageCommitmentScp(_OrthancPluginRegisterStorageCommitmentScpCallback parameters) :
+      explicit StorageCommitmentScp(const _OrthancPluginRegisterStorageCommitmentScpCallback& parameters) :
         parameters_(parameters)
       {
       }
--- a/OrthancServer/Resources/RunCppCheck.sh	Wed Sep 30 15:53:17 2020 +0200
+++ b/OrthancServer/Resources/RunCppCheck.sh	Wed Sep 30 16:25:48 2020 +0200
@@ -14,7 +14,7 @@
 knownConditionTrueFalse:../../OrthancServer/Plugins/Engine/OrthancPlugins.cpp
 nullPointer:../../OrthancFramework/UnitTestsSources/RestApiTests.cpp:309
 nullPointerRedundantCheck:../../OrthancFramework/UnitTestsSources/DicomMapTests.cpp
-stlFindInsert:../../OrthancFramework/Sources/DicomFormat/DicomMap.cpp:1070
+stlFindInsert:../../OrthancFramework/Sources/DicomFormat/DicomMap.cpp:1103
 stlFindInsert:../../OrthancServer/Sources/ServerIndex.cpp:400
 syntaxError:../../OrthancFramework/Sources/SQLite/FunctionContext.h:50
 syntaxError:../../OrthancFramework/UnitTestsSources/ZipTests.cpp:129
--- a/OrthancServer/Sources/ServerJobs/ResourceModificationJob.cpp	Wed Sep 30 15:53:17 2020 +0200
+++ b/OrthancServer/Sources/ServerJobs/ResourceModificationJob.cpp	Wed Sep 30 16:25:48 2020 +0200
@@ -414,7 +414,8 @@
 
   ResourceModificationJob::ResourceModificationJob(ServerContext& context,
                                                    const Json::Value& serialized) :
-    CleaningInstancesJob(context, serialized, true /* by default, keep source */)
+    CleaningInstancesJob(context, serialized, true /* by default, keep source */),
+    transferSyntax_(DicomTransferSyntax_LittleEndianExplicit)  // dummy initialization
   {
     assert(serialized.type() == Json::objectValue);