changeset 4657:e8967149d87a

cppcheck
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 07 May 2021 06:35:13 +0200
parents 82a314325351
children 66f6fd77deaf 38f5fb0885c4
files OrthancFramework/Sources/HttpClient.cpp OrthancFramework/Sources/HttpClient.h OrthancFramework/Sources/HttpServer/CStringMatcher.cpp OrthancFramework/Sources/Images/PngWriter.cpp OrthancServer/Resources/RunCppCheck.sh OrthancServer/Sources/OrthancRestApi/OrthancRestResources.cpp OrthancServer/UnitTestsSources/SizeOfTests.impl.h
diffstat 7 files changed, 21 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/OrthancFramework/Sources/HttpClient.cpp	Thu May 06 18:39:19 2021 +0200
+++ b/OrthancFramework/Sources/HttpClient.cpp	Fri May 07 06:35:13 2021 +0200
@@ -774,6 +774,12 @@
   }
   
 
+  void HttpClient::SetExternalBody(const std::string& data)
+  {
+    SetExternalBody(data.empty() ? NULL : data.c_str(), data.size());
+  }
+
+
   void HttpClient::ClearBody()
   {
     body_.clear();
--- a/OrthancFramework/Sources/HttpClient.h	Thu May 06 18:39:19 2021 +0200
+++ b/OrthancFramework/Sources/HttpClient.h	Fri May 07 06:35:13 2021 +0200
@@ -158,10 +158,7 @@
     void SetExternalBody(const void* data,
                          size_t size);
 
-    void SetExternalBody(const std::string& data)
-    {
-      SetExternalBody(data.empty() ? NULL : data.c_str(), data.size());
-    }
+    void SetExternalBody(const std::string& data);
 
     void ClearBody();
 
--- a/OrthancFramework/Sources/HttpServer/CStringMatcher.cpp	Thu May 06 18:39:19 2021 +0200
+++ b/OrthancFramework/Sources/HttpServer/CStringMatcher.cpp	Fri May 07 06:35:13 2021 +0200
@@ -59,7 +59,9 @@
 
   CStringMatcher::CStringMatcher(const std::string& pattern) :
     pattern_(pattern),
-    valid_(false)
+    valid_(false),
+    matchBegin_(NULL),
+    matchEnd_(NULL)
   {
     // WARNING - Don't use "pattern" (local variable, will be
     // destroyed once exiting the constructor) but "pattern_"
--- a/OrthancFramework/Sources/Images/PngWriter.cpp	Thu May 06 18:39:19 2021 +0200
+++ b/OrthancFramework/Sources/Images/PngWriter.cpp	Fri May 07 06:35:13 2021 +0200
@@ -90,7 +90,9 @@
   public:
     Context() :
       png_(NULL),
-      info_(NULL)
+      info_(NULL),
+      bitDepth_(0),  // Dummy initialization
+      colorType_(0)  // Dummy initialization
     {
       png_ = png_create_write_struct
         (PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); //this, ErrorHandler, WarningHandler);
--- a/OrthancServer/Resources/RunCppCheck.sh	Thu May 06 18:39:19 2021 +0200
+++ b/OrthancServer/Resources/RunCppCheck.sh	Fri May 07 06:35:13 2021 +0200
@@ -12,7 +12,7 @@
 constParameter:../../OrthancFramework/Sources/DicomParsing/FromDcmtkBridge.cpp
 knownArgument:../../OrthancFramework/UnitTestsSources/ImageTests.cpp
 knownConditionTrueFalse:../../OrthancServer/Plugins/Engine/OrthancPlugins.cpp
-nullPointer:../../OrthancFramework/UnitTestsSources/RestApiTests.cpp:319
+nullPointer:../../OrthancFramework/UnitTestsSources/RestApiTests.cpp:320
 nullPointerRedundantCheck:../../OrthancFramework/UnitTestsSources/DicomMapTests.cpp
 stlFindInsert:../../OrthancFramework/Sources/DicomFormat/DicomMap.cpp:1194
 stlFindInsert:../../OrthancFramework/Sources/RestApi/RestApiCallDocumentation.cpp:164
@@ -27,6 +27,7 @@
 unreadVariable:../../OrthancServer/Sources/OrthancRestApi/OrthancRestModalities.cpp:1121
 unusedFunction
 useInitializationList:../../OrthancFramework/Sources/Images/PngReader.cpp:89
+useInitializationList:../../OrthancFramework/Sources/Images/PngWriter.cpp:97
 useInitializationList:../../OrthancServer/Sources/ServerJobs/DicomModalityStoreJob.cpp:285
 EOF
 
--- a/OrthancServer/Sources/OrthancRestApi/OrthancRestResources.cpp	Thu May 06 18:39:19 2021 +0200
+++ b/OrthancServer/Sources/OrthancRestApi/OrthancRestResources.cpp	Fri May 07 06:35:13 2021 +0200
@@ -1450,9 +1450,9 @@
   }
 
 
-  static void SetStringContentETag(RestApiOutput& output,
-                              int64_t revision,
-                              const std::string& value)
+  static void SetStringContentETag(const RestApiOutput& output,
+                                   int64_t revision,
+                                   const std::string& value)
   {
     std::string md5;
     Toolbox::ComputeMD5(md5, value);
@@ -1461,7 +1461,7 @@
   }
   
 
-  static void SetBufferContentETag(RestApiOutput& output,
+  static void SetBufferContentETag(const RestApiOutput& output,
                                    int64_t revision,
                                    const void* data,
                                    size_t size)
@@ -1473,7 +1473,7 @@
   }
   
 
-  static void SetAttachmentETag(RestApiOutput& output,
+  static void SetAttachmentETag(const RestApiOutput& output,
                                 int64_t revision,
                                 const FileInfo& info)
   {
--- a/OrthancServer/UnitTestsSources/SizeOfTests.impl.h	Thu May 06 18:39:19 2021 +0200
+++ b/OrthancServer/UnitTestsSources/SizeOfTests.impl.h	Fri May 07 06:35:13 2021 +0200
@@ -1,4 +1,5 @@
   printf("sizeof(::Orthanc::BufferHttpSender) == %d\n", static_cast<int>(sizeof(::Orthanc::BufferHttpSender)));
+  printf("sizeof(::Orthanc::CStringMatcher) == %d\n", static_cast<int>(sizeof(::Orthanc::CStringMatcher)));
   printf("sizeof(::Orthanc::ChunkedBuffer) == %d\n", static_cast<int>(sizeof(::Orthanc::ChunkedBuffer)));
   printf("sizeof(::Orthanc::DcmtkTranscoder) == %d\n", static_cast<int>(sizeof(::Orthanc::DcmtkTranscoder)));
   printf("sizeof(::Orthanc::DeflateBaseCompressor) == %d\n", static_cast<int>(sizeof(::Orthanc::DeflateBaseCompressor)));