# HG changeset patch # User Sebastien Jodogne # Date 1585721953 -7200 # Node ID 952e969a22409c29092b982dfd62227e92d06a18 # Parent 0b8239ce1bec1b474ed38d72fba2c6ddc6e42472 cppcheck diff -r 0b8239ce1bec -r 952e969a2240 CMakeLists.txt --- 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} ) diff -r 0b8239ce1bec -r 952e969a2240 Resources/Orthanc/Plugins/Samples/Common/OrthancPluginCppWrapper.h --- 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(); }; diff -r 0b8239ce1bec -r 952e969a2240 Sources/OnChangeCallback.cpp --- 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); } diff -r 0b8239ce1bec -r 952e969a2240 Sources/PythonFunction.cpp --- 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 result(CallUnchecked(args.GetPyObject())); diff -r 0b8239ce1bec -r 952e969a2240 Sources/PythonFunction.h --- 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() { diff -r 0b8239ce1bec -r 952e969a2240 Sources/PythonLock.cpp --- 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(); }