Mercurial > hg > orthanc-python
changeset 13:952e969a2240
cppcheck
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 01 Apr 2020 08:19:13 +0200 |
parents | 0b8239ce1bec |
children | 13589c36243d c4c3590e2024 |
files | CMakeLists.txt Resources/Orthanc/Plugins/Samples/Common/OrthancPluginCppWrapper.h Sources/OnChangeCallback.cpp Sources/PythonFunction.cpp Sources/PythonFunction.h Sources/PythonLock.cpp |
diffstat | 6 files changed, 14 insertions(+), 15 deletions(-) [+] |
line wrap: on
line diff
--- a/CMakeLists.txt Tue Mar 31 18:18:58 2020 +0200 +++ b/CMakeLists.txt Wed Apr 01 08:19:13 2020 +0200 @@ -48,7 +48,6 @@ ) include_directories( - ${ORTHANC_ROOT}/Plugins/Include ${ORTHANC_ROOT}/Plugins/Samples/Common ${PYTHON_INCLUDE_DIRS} )
--- a/Resources/Orthanc/Plugins/Samples/Common/OrthancPluginCppWrapper.h Tue Mar 31 18:18:58 2020 +0200 +++ b/Resources/Orthanc/Plugins/Samples/Common/OrthancPluginCppWrapper.h Wed Apr 01 08:19:13 2020 +0200 @@ -303,7 +303,7 @@ public: OrthancConfiguration(); - OrthancConfiguration(bool load); + explicit OrthancConfiguration(bool load); const Json::Value& GetJson() const { @@ -369,7 +369,7 @@ public: OrthancImage(); - OrthancImage(OrthancPluginImage* image); + explicit OrthancImage(OrthancPluginImage* image); OrthancImage(OrthancPluginPixelFormat format, uint32_t width, @@ -435,15 +435,15 @@ uint32_t size); public: - FindMatcher(const OrthancPluginWorklistQuery* worklist); + explicit FindMatcher(const OrthancPluginWorklistQuery* worklist); - FindMatcher(const void* query, - uint32_t size) + FindMatcher(const void* query, + uint32_t size) { SetupDicom(query, size); } - FindMatcher(const MemoryBuffer& dicom) + explicit FindMatcher(const MemoryBuffer& dicom) { SetupDicom(dicom.GetData(), dicom.GetSize()); } @@ -810,7 +810,7 @@ boost::posix_time::ptime start_; public: - MetricsTimer(const char* name); + explicit MetricsTimer(const char* name); ~MetricsTimer(); };
--- a/Sources/OnChangeCallback.cpp Tue Mar 31 18:18:58 2020 +0200 +++ b/Sources/OnChangeCallback.cpp Wed Apr 01 08:19:13 2020 +0200 @@ -98,7 +98,7 @@ PendingChange* Dequeue(unsigned int millisecondsTimeout) { - if (millisecondsTimeout <= 0) + if (millisecondsTimeout == 0) { ORTHANC_PLUGINS_THROW_EXCEPTION(ParameterOutOfRange); }
--- a/Sources/PythonFunction.cpp Tue Mar 31 18:18:58 2020 +0200 +++ b/Sources/PythonFunction.cpp Wed Apr 01 08:19:13 2020 +0200 @@ -39,7 +39,7 @@ PythonFunction::PythonFunction(PythonLock& lock, - PythonModule& module, + const PythonModule& module, const std::string& name) : lock_(lock) { @@ -78,7 +78,7 @@ } -PythonObject* PythonFunction::Call(PythonObject& args) +PythonObject* PythonFunction::Call(const PythonObject& args) { std::unique_ptr<PythonObject> result(CallUnchecked(args.GetPyObject()));
--- a/Sources/PythonFunction.h Tue Mar 31 18:18:58 2020 +0200 +++ b/Sources/PythonFunction.h Wed Apr 01 08:19:13 2020 +0200 @@ -38,7 +38,7 @@ public: PythonFunction(PythonLock& lock, - PythonModule& module, + const PythonModule& module, const std::string& name); bool IsValid() const @@ -48,7 +48,7 @@ PythonObject* Call(); - PythonObject* Call(PythonObject& args); + PythonObject* Call(const PythonObject& args); void CallVoid() {
--- a/Sources/PythonLock.cpp Tue Mar 31 18:18:58 2020 +0200 +++ b/Sources/PythonLock.cpp Wed Apr 01 08:19:13 2020 +0200 @@ -47,10 +47,10 @@ #endif -PythonLock::PythonLock() +PythonLock::PythonLock() : + gstate_(PyGILState_Ensure()) { //OrthancPlugins::LogInfo("Python lock (GIL) acquired"); - gstate_ = PyGILState_Ensure(); }