# HG changeset patch # User Sebastien Jodogne # Date 1605022871 -3600 # Node ID 5cdc5b98f14d0bb476ec988118ae881ac93c0894 # Parent 754ef576d9453bdcbd51556494bc47514d3f86be cppcheck diff -r 754ef576d945 -r 5cdc5b98f14d Applications/Resources/RunCppCheck.sh --- a/Applications/Resources/RunCppCheck.sh Tue Nov 10 16:26:47 2020 +0100 +++ b/Applications/Resources/RunCppCheck.sh Tue Nov 10 16:41:11 2020 +0100 @@ -29,13 +29,12 @@ cat < /tmp/cppcheck-suppressions.txt stlFindInsert:../../Applications/Samples/WebAssembly/SingleFrameViewer/SingleFrameViewerApplication.h -stlFindInsert:../../Applications/StoneWebViewer/WebAssembly/StoneWebViewer.cpp:685 +stlFindInsert:../../Applications/StoneWebViewer/WebAssembly/StoneWebViewer.cpp:703 unpreciseMathCall:../../OrthancStone/Sources/Scene2D/Internals/CairoFloatTextureRenderer.cpp unpreciseMathCall:../../OrthancStone/Sources/Scene2D/LookupTableTextureSceneLayer.cpp unreadVariable:../../OrthancStone/Sources/Viewport/SdlViewport.cpp:143 unreadVariable:../../OrthancStone/Sources/Viewport/SdlViewport.cpp:197 unusedFunction -useInitializationList:../../OrthancStone/Sources/OpenGL/OpenGLProgram.cpp:36 EOF ${CPPCHECK} --enable=all --quiet --std=c++11 \ @@ -58,7 +57,7 @@ -DORTHANC_ENABLE_OPENGL=1 \ -DORTHANC_ENABLE_PKCS11=0 \ -DORTHANC_ENABLE_PNG=1 \ - -DORTHANC_ENABLE_PUGIXML=0 \ + -DORTHANC_ENABLE_PUGIXML=1 \ -DORTHANC_ENABLE_SDL=1 \ -DORTHANC_ENABLE_SSL=1 \ -DORTHANC_ENABLE_THREADS=1 \ @@ -83,5 +82,6 @@ -i ../../Applications/StoneWebViewer/Plugin/i \ -i ../../Applications/StoneWebViewer/WebAssembly/StoneModule/i \ -i ../../Applications/StoneWebViewer/WebAssembly/i \ + -i ../../Applications/StoneWebViewer/WebAssembly/debug/ \ \ 2>&1 diff -r 754ef576d945 -r 5cdc5b98f14d OrthancStone/Sources/OpenGL/OpenGLProgram.cpp --- a/OrthancStone/Sources/OpenGL/OpenGLProgram.cpp Tue Nov 10 16:26:47 2020 +0100 +++ b/OrthancStone/Sources/OpenGL/OpenGLProgram.cpp Tue Nov 10 16:41:11 2020 +0100 @@ -35,9 +35,9 @@ namespace OpenGL { OpenGLProgram::OpenGLProgram(OpenGL::IOpenGLContext& context) : - context_(context) + context_(context), + program_(glCreateProgram()) { - program_ = glCreateProgram(); ORTHANC_OPENGL_CHECK("glCreateProgram"); if (program_ == 0) diff -r 754ef576d945 -r 5cdc5b98f14d OrthancStone/Sources/OpenGL/OpenGLProgram.h --- a/OrthancStone/Sources/OpenGL/OpenGLProgram.h Tue Nov 10 16:26:47 2020 +0100 +++ b/OrthancStone/Sources/OpenGL/OpenGLProgram.h Tue Nov 10 16:41:11 2020 +0100 @@ -35,6 +35,10 @@ class OpenGLProgram : public boost::noncopyable { + private: + OpenGL::IOpenGLContext& context_; + GLuint program_; + public: // WARNING: A global OpenGL context must be active to create this object! // the context is only passed so that it can be checked for loss @@ -52,10 +56,6 @@ GLint GetUniformLocation(const std::string& name); GLint GetAttributeLocation(const std::string& name); - - private: - GLuint program_; - OpenGL::IOpenGLContext& context_; }; } } diff -r 754ef576d945 -r 5cdc5b98f14d OrthancStone/Sources/Scene2D/GrayscaleWindowingSceneTracker.cpp --- a/OrthancStone/Sources/Scene2D/GrayscaleWindowingSceneTracker.cpp Tue Nov 10 16:26:47 2020 +0100 +++ b/OrthancStone/Sources/Scene2D/GrayscaleWindowingSceneTracker.cpp Tue Nov 10 16:41:11 2020 +0100 @@ -117,24 +117,28 @@ if (canvasWidth > 3 && canvasHeight > 3) { - boost::weak_ptr viewport = viewport_.lock(); - GrayscaleLayerAccessor accessor(viewport, layerIndex_); + boost::shared_ptr locked = viewport_.lock(); + + if (locked) + { + GrayscaleLayerAccessor accessor(locked, layerIndex_); - if (accessor.IsValid()) - { - FloatTextureSceneLayer& layer = accessor.GetLayer(); - - layer.GetWindowing(originalCenter_, originalWidth_); + if (accessor.IsValid()) + { + FloatTextureSceneLayer& layer = accessor.GetLayer(); - float minValue, maxValue; - layer.GetRange(minValue, maxValue); + layer.GetWindowing(originalCenter_, originalWidth_); + + float minValue, maxValue; + layer.GetRange(minValue, maxValue); - normalization_ = (maxValue - minValue) / static_cast(std::min(canvasWidth, canvasHeight) - 1); - active_ = true; - } - else - { - LOG(INFO) << "Cannot create GrayscaleWindowingSceneTracker on a non-float texture"; + normalization_ = (maxValue - minValue) / static_cast(std::min(canvasWidth, canvasHeight) - 1); + active_ = true; + } + else + { + LOG(INFO) << "Cannot create GrayscaleWindowingSceneTracker on a non-float texture"; + } } } } diff -r 754ef576d945 -r 5cdc5b98f14d OrthancStone/Sources/Toolbox/DicomInstanceParameters.cpp --- a/OrthancStone/Sources/Toolbox/DicomInstanceParameters.cpp Tue Nov 10 16:26:47 2020 +0100 +++ b/OrthancStone/Sources/Toolbox/DicomInstanceParameters.cpp Tue Nov 10 16:41:11 2020 +0100 @@ -125,7 +125,14 @@ } // Must be AFTER setting "numberOfFrames_" - ExtractFrameOffsets(frameOffsets_, dicom, numberOfFrames_); + if (numberOfFrames_ > 1) + { + ExtractFrameOffsets(frameOffsets_, dicom, numberOfFrames_); + } + else + { + frameOffsets_.resize(0); + } if (sopClassUid_ == SopClassUid_RTDose) { diff -r 754ef576d945 -r 5cdc5b98f14d OrthancStone/Sources/Toolbox/OsiriX/AngleAnnotation.h --- a/OrthancStone/Sources/Toolbox/OsiriX/AngleAnnotation.h Tue Nov 10 16:26:47 2020 +0100 +++ b/OrthancStone/Sources/Toolbox/OsiriX/AngleAnnotation.h Tue Nov 10 16:41:11 2020 +0100 @@ -39,7 +39,7 @@ Vector b_; public: - AngleAnnotation(const DictionaryValue& dict); + explicit AngleAnnotation(const DictionaryValue& dict); virtual Type GetType() const ORTHANC_OVERRIDE { diff -r 754ef576d945 -r 5cdc5b98f14d OrthancStone/Sources/Toolbox/OsiriX/IntegerValue.h --- a/OrthancStone/Sources/Toolbox/OsiriX/IntegerValue.h Tue Nov 10 16:26:47 2020 +0100 +++ b/OrthancStone/Sources/Toolbox/OsiriX/IntegerValue.h Tue Nov 10 16:41:11 2020 +0100 @@ -39,7 +39,7 @@ int64_t value_; public: - IntegerValue(int64_t value) : + explicit IntegerValue(int64_t value) : value_(value) { } diff -r 754ef576d945 -r 5cdc5b98f14d OrthancStone/Sources/Toolbox/OsiriX/RealValue.h --- a/OrthancStone/Sources/Toolbox/OsiriX/RealValue.h Tue Nov 10 16:26:47 2020 +0100 +++ b/OrthancStone/Sources/Toolbox/OsiriX/RealValue.h Tue Nov 10 16:41:11 2020 +0100 @@ -37,7 +37,7 @@ double value_; public: - RealValue(double value) : + explicit RealValue(double value) : value_(value) { } diff -r 754ef576d945 -r 5cdc5b98f14d OrthancStone/Sources/Toolbox/OsiriX/StringValue.h --- a/OrthancStone/Sources/Toolbox/OsiriX/StringValue.h Tue Nov 10 16:26:47 2020 +0100 +++ b/OrthancStone/Sources/Toolbox/OsiriX/StringValue.h Tue Nov 10 16:41:11 2020 +0100 @@ -40,7 +40,7 @@ std::string value_; public: - StringValue(const std::string& value) : + explicit StringValue(const std::string& value) : value_(value) { } diff -r 754ef576d945 -r 5cdc5b98f14d OrthancStone/Sources/Toolbox/OsiriX/TextAnnotation.h --- a/OrthancStone/Sources/Toolbox/OsiriX/TextAnnotation.h Tue Nov 10 16:26:47 2020 +0100 +++ b/OrthancStone/Sources/Toolbox/OsiriX/TextAnnotation.h Tue Nov 10 16:41:11 2020 +0100 @@ -37,8 +37,8 @@ Vector center_; public: - TextAnnotation(const DictionaryValue& dict); - + explicit TextAnnotation(const DictionaryValue& dict); + virtual Type GetType() const ORTHANC_OVERRIDE { return Type_Text;