Mercurial > hg > orthanc
changeset 5280:49477780e25a
cppcheck
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Sat, 15 Apr 2023 13:07:47 +0200 |
parents | b9456dfde58a |
children | 3de0235dedb6 |
files | OrthancServer/Plugins/Samples/Common/OrthancPluginCppWrapper.cpp OrthancServer/Plugins/Samples/DelayedDeletion/LargeDeleteJob.cpp OrthancServer/Plugins/Samples/Housekeeper/Plugin.cpp OrthancServer/Plugins/Samples/ModalityWorklists/Plugin.cpp OrthancServer/Plugins/Samples/MultitenantDicom/MoveRequestHandler.cpp OrthancServer/Plugins/Samples/MultitenantDicom/MultitenantDicomServer.h OrthancServer/Resources/RunCppCheck.sh |
diffstat | 7 files changed, 23 insertions(+), 13 deletions(-) [+] |
line wrap: on
line diff
--- a/OrthancServer/Plugins/Samples/Common/OrthancPluginCppWrapper.cpp Sat Apr 15 10:33:17 2023 +0200 +++ b/OrthancServer/Plugins/Samples/Common/OrthancPluginCppWrapper.cpp Sat Apr 15 13:07:47 2023 +0200 @@ -253,14 +253,15 @@ // helper class to convert std::map of headers to the plugin SDK C structure class PluginHttpHeaders { + private: std::vector<const char*> headersKeys_; std::vector<const char*> headersValues_; + public: - - PluginHttpHeaders(const std::map<std::string, std::string>& httpHeaders) + explicit PluginHttpHeaders(const std::map<std::string, std::string>& httpHeaders) { for (std::map<std::string, std::string>::const_iterator - it = httpHeaders.begin(); it != httpHeaders.end(); it++) + it = httpHeaders.begin(); it != httpHeaders.end(); ++it) { headersKeys_.push_back(it->first.c_str()); headersValues_.push_back(it->second.c_str());
--- a/OrthancServer/Plugins/Samples/DelayedDeletion/LargeDeleteJob.cpp Sat Apr 15 10:33:17 2023 +0200 +++ b/OrthancServer/Plugins/Samples/DelayedDeletion/LargeDeleteJob.cpp Sat Apr 15 13:07:47 2023 +0200 @@ -168,6 +168,7 @@ levels_(levels), posResources_(0), posInstances_(0), + posSeries_(0), posDelete_(0) { if (resources.size() != levels.size())
--- a/OrthancServer/Plugins/Samples/Housekeeper/Plugin.cpp Sat Apr 15 10:33:17 2023 +0200 +++ b/OrthancServer/Plugins/Samples/Housekeeper/Plugin.cpp Sat Apr 15 13:07:47 2023 +0200 @@ -127,7 +127,7 @@ Json::Value::Members names = scheduleConfiguration.getMemberNames(); for (Json::Value::Members::const_iterator it = names.begin(); - it != names.end(); it++) + it != names.end(); ++it) { for (Json::Value::ArrayIndex i = 0; i < scheduleConfiguration[*it].size(); i++) { @@ -144,7 +144,7 @@ } for (std::list<RunningPeriod>::const_iterator it = runningPeriods_.begin(); - it != runningPeriods_.end(); it++) + it != runningPeriods_.end(); ++it) { if (it->isInPeriod()) {
--- a/OrthancServer/Plugins/Samples/ModalityWorklists/Plugin.cpp Sat Apr 15 10:33:17 2023 +0200 +++ b/OrthancServer/Plugins/Samples/ModalityWorklists/Plugin.cpp Sat Apr 15 13:07:47 2023 +0200 @@ -151,11 +151,12 @@ fs::path source(folder_); fs::directory_iterator end; - unsigned int parsedFilesCount = 0; - unsigned int matchedWorklistCount = 0; try { + unsigned int parsedFilesCount = 0; + unsigned int matchedWorklistCount = 0; + for (fs::directory_iterator it(source); it != end; ++it) { fs::file_type type(it->status().type());
--- a/OrthancServer/Plugins/Samples/MultitenantDicom/MoveRequestHandler.cpp Sat Apr 15 10:33:17 2023 +0200 +++ b/OrthancServer/Plugins/Samples/MultitenantDicom/MoveRequestHandler.cpp Sat Apr 15 13:07:47 2023 +0200 @@ -47,12 +47,12 @@ { } - unsigned int GetSubOperationCount() const + virtual unsigned int GetSubOperationCount() const ORTHANC_OVERRIDE { return 1; } - Status DoNext() + virtual Status DoNext() ORTHANC_OVERRIDE { Json::Value answer; @@ -95,15 +95,15 @@ if (OrthancPlugins::RestApiPost(response, "/tools/find", request, false) && response.type() == Json::arrayValue) { - for (Json::Value::ArrayIndex i = 0; i < response.size(); i++) + for (Json::Value::ArrayIndex j = 0; j < response.size(); j++) { - if (response[i].type() != Json::stringValue) + if (response[j].type() != Json::stringValue) { throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError); } else { - publicIds.insert(response[i].asString()); + publicIds.insert(response[j].asString()); } } }
--- a/OrthancServer/Plugins/Samples/MultitenantDicom/MultitenantDicomServer.h Sat Apr 15 10:33:17 2023 +0200 +++ b/OrthancServer/Plugins/Samples/MultitenantDicom/MultitenantDicomServer.h Sat Apr 15 13:07:47 2023 +0200 @@ -61,7 +61,7 @@ std::unique_ptr<Orthanc::DicomServer> server_; public: - MultitenantDicomServer(const Json::Value& serverConfig); + explicit MultitenantDicomServer(const Json::Value& serverConfig); void Start();
--- a/OrthancServer/Resources/RunCppCheck.sh Sat Apr 15 10:33:17 2023 +0200 +++ b/OrthancServer/Resources/RunCppCheck.sh Sat Apr 15 13:07:47 2023 +0200 @@ -88,6 +88,7 @@ -D__cplusplus=201103 \ -D__linux__ \ -UNDEBUG \ + -DHAS_ORTHANC_EXCEPTION=1 \ \ ../../OrthancFramework/Sources \ ../../OrthancFramework/UnitTestsSources \ @@ -95,5 +96,11 @@ ../../OrthancServer/Plugins/Include \ ../../OrthancServer/Sources \ ../../OrthancServer/UnitTestsSources \ + ../../OrthancServer/Plugins/Samples/Common \ + ../../OrthancServer/Plugins/Samples/ConnectivityChecks \ + ../../OrthancServer/Plugins/Samples/DelayedDeletion \ + ../../OrthancServer/Plugins/Samples/Housekeeper \ + ../../OrthancServer/Plugins/Samples/ModalityWorklists \ + ../../OrthancServer/Plugins/Samples/MultitenantDicom \ \ 2>&1