Mercurial > hg > orthanc-wsi
changeset 577:aef928e35e9d annotations
cppcheck
| author | Sebastien Jodogne <s.jodogne@gmail.com> |
|---|---|
| date | Wed, 02 Sep 2026 17:56:53 +0200 |
| parents | 4c9949987d5f |
| children | d1a9fb8cc45a |
| files | Applications/ApplicationToolbox.cpp Framework/Enumerations.cpp Framework/Inputs/DecodedPyramidCache.cpp Framework/Inputs/DicomPyramid.cpp Framework/Inputs/DicomPyramid.h Framework/Inputs/OnTheFlyPyramid.cpp Framework/Inputs/OnTheFlyPyramid.h Framework/Inputs/OpenSlideLibrary.cpp Framework/Inputs/TiledPyramidStatistics.h Framework/Jpeg2000Reader.cpp Framework/Jpeg2000Writer.cpp Framework/Outputs/DicomPyramidWriter.h Framework/Outputs/HierarchicalTiffWriter.cpp Framework/Outputs/HierarchicalTiffWriter.h Framework/Outputs/InMemoryTiledImage.h ViewerPlugin/Annotations/AnnotationsWorkspace.h ViewerPlugin/Annotations/LayersCollection.h ViewerPlugin/DicomPyramidCache.cpp ViewerPlugin/OrthancPyramidFrameFetcher.cpp ViewerPlugin/Plugin.cpp |
| diffstat | 20 files changed, 46 insertions(+), 30 deletions(-) [+] |
line wrap: on
line diff
--- a/Applications/ApplicationToolbox.cpp Wed Sep 02 17:26:14 2026 +0200 +++ b/Applications/ApplicationToolbox.cpp Wed Sep 02 17:56:53 2026 +0200 @@ -91,7 +91,7 @@ static void PrintProgress(BagOfTasksProcessor::Handle* handle, - bool* done) + const bool* done) { unsigned int previous = 0;
--- a/Framework/Enumerations.cpp Wed Sep 02 17:26:14 2026 +0200 +++ b/Framework/Enumerations.cpp Wed Sep 02 17:56:53 2026 +0200 @@ -34,7 +34,7 @@ #include <string.h> #include <boost/algorithm/string/predicate.hpp> -#define HEADER(s) (const void*) (s), sizeof(s)-1 +#define HEADER(s) reinterpret_cast<const void*>(s), sizeof(s) - 1 namespace OrthancWSI {
--- a/Framework/Inputs/DecodedPyramidCache.cpp Wed Sep 02 17:26:14 2026 +0200 +++ b/Framework/Inputs/DecodedPyramidCache.cpp Wed Sep 02 17:56:53 2026 +0200 @@ -161,7 +161,15 @@ while (!cache_.IsEmpty()) { CachedPyramid* pyramid = NULL; - cache_.RemoveOldest(pyramid); + + try + { + cache_.RemoveOldest(pyramid); + } + catch (Orthanc::OrthancException&) + { + // Should never happen, don't throw exceptions in destructor + } if (pyramid != NULL) {
--- a/Framework/Inputs/DicomPyramid.cpp Wed Sep 02 17:26:14 2026 +0200 +++ b/Framework/Inputs/DicomPyramid.cpp Wed Sep 02 17:56:53 2026 +0200 @@ -39,8 +39,8 @@ { struct DicomPyramid::Comparator { - bool operator() (DicomPyramidInstance* const& a, - DicomPyramidInstance* const& b) const + bool operator() (const DicomPyramidInstance* const& a, + const DicomPyramidInstance* const& b) const { return a->GetTotalWidth() > b->GetTotalWidth(); }
--- a/Framework/Inputs/DicomPyramid.h Wed Sep 02 17:26:14 2026 +0200 +++ b/Framework/Inputs/DicomPyramid.h Wed Sep 02 17:56:53 2026 +0200 @@ -54,7 +54,7 @@ const std::string& seriesId, bool useCache); - virtual ~DicomPyramid() + virtual ~DicomPyramid() ORTHANC_OVERRIDE { Clear(); }
--- a/Framework/Inputs/OnTheFlyPyramid.cpp Wed Sep 02 17:26:14 2026 +0200 +++ b/Framework/Inputs/OnTheFlyPyramid.cpp Wed Sep 02 17:56:53 2026 +0200 @@ -84,7 +84,7 @@ Orthanc::ImageProcessing::Convert(*baseLevel_, *protection); } - Orthanc::ImageAccessor* current = baseLevel_.get(); + const Orthanc::ImageAccessor* current = baseLevel_.get(); while (current->GetWidth() > tileWidth_ || current->GetHeight() > tileHeight_) {
--- a/Framework/Inputs/OnTheFlyPyramid.h Wed Sep 02 17:26:14 2026 +0200 +++ b/Framework/Inputs/OnTheFlyPyramid.h Wed Sep 02 17:56:53 2026 +0200 @@ -53,7 +53,7 @@ unsigned int tileHeight, bool smooth); - virtual ~OnTheFlyPyramid(); + virtual ~OnTheFlyPyramid() ORTHANC_OVERRIDE; const Orthanc::ImageAccessor& GetLevel(unsigned int level) const;
--- a/Framework/Inputs/OpenSlideLibrary.cpp Wed Sep 02 17:26:14 2026 +0200 +++ b/Framework/Inputs/OpenSlideLibrary.cpp Wed Sep 02 17:56:53 2026 +0200 @@ -39,14 +39,14 @@ OpenSlideLibrary::OpenSlideLibrary(const std::string& path) : library_(path) { - close_ = (FunctionClose) library_.GetFunction("openslide_close"); - getLevelCount_ = (FunctionGetLevelCount) library_.GetFunction("openslide_get_level_count"); - getLevelDimensions_ = (FunctionGetLevelDimensions) library_.GetFunction("openslide_get_level_dimensions"); - getLevelDownsample_ = (FunctionGetLevelDownsample) library_.GetFunction("openslide_get_level_downsample"); - open_ = (FunctionOpen) library_.GetFunction("openslide_open"); - readRegion_ = (FunctionReadRegion) library_.GetFunction("openslide_read_region"); - getPropertyNames_ = (FunctionGetPropertyNames) library_.GetFunction("openslide_get_property_names"); - getPropertyValue_ = (FunctionGetPropertyValue) library_.GetFunction("openslide_get_property_value"); + close_ = reinterpret_cast<FunctionClose>(library_.GetFunction("openslide_close")); + getLevelCount_ = reinterpret_cast<FunctionGetLevelCount>(library_.GetFunction("openslide_get_level_count")); + getLevelDimensions_ = reinterpret_cast<FunctionGetLevelDimensions>(library_.GetFunction("openslide_get_level_dimensions")); + getLevelDownsample_ = reinterpret_cast<FunctionGetLevelDownsample>(library_.GetFunction("openslide_get_level_downsample")); + open_ = reinterpret_cast<FunctionOpen>(library_.GetFunction("openslide_open")); + readRegion_ = reinterpret_cast<FunctionReadRegion>(library_.GetFunction("openslide_read_region")); + getPropertyNames_ = reinterpret_cast<FunctionGetPropertyNames>(library_.GetFunction("openslide_get_property_names")); + getPropertyValue_ = reinterpret_cast<FunctionGetPropertyValue>(library_.GetFunction("openslide_get_property_value")); }
--- a/Framework/Inputs/TiledPyramidStatistics.h Wed Sep 02 17:26:14 2026 +0200 +++ b/Framework/Inputs/TiledPyramidStatistics.h Wed Sep 02 17:56:53 2026 +0200 @@ -40,7 +40,7 @@ public: explicit TiledPyramidStatistics(ITiledPyramid& source); // Takes ownership - virtual ~TiledPyramidStatistics(); + virtual ~TiledPyramidStatistics() ORTHANC_OVERRIDE; virtual unsigned int GetLevelCount() const ORTHANC_OVERRIDE {
--- a/Framework/Jpeg2000Reader.cpp Wed Sep 02 17:26:14 2026 +0200 +++ b/Framework/Jpeg2000Reader.cpp Wed Sep 02 17:56:53 2026 +0200 @@ -243,7 +243,7 @@ #endif public: - OpenJpegInput(OpenJpegDecoder& decoder, + OpenJpegInput(const OpenJpegDecoder& decoder, const void* buffer, size_t size) : buffer_(reinterpret_cast<const uint8_t*>(buffer)),
--- a/Framework/Jpeg2000Writer.cpp Wed Sep 02 17:26:14 2026 +0200 +++ b/Framework/Jpeg2000Writer.cpp Wed Sep 02 17:56:53 2026 +0200 @@ -248,7 +248,7 @@ #endif public: - explicit OpenJpegOutput(OpenJpegEncoder& encoder) : + explicit OpenJpegOutput(const OpenJpegEncoder& encoder) : cio_(NULL) { #if ORTHANC_OPENJPEG_MAJOR_VERSION == 1
--- a/Framework/Outputs/DicomPyramidWriter.h Wed Sep 02 17:26:14 2026 +0200 +++ b/Framework/Outputs/DicomPyramidWriter.h Wed Sep 02 17:56:53 2026 +0200 @@ -79,7 +79,7 @@ const ImagedVolumeParameters& volume, Orthanc::PhotometricInterpretation photometric); - virtual ~DicomPyramidWriter(); + virtual ~DicomPyramidWriter() ORTHANC_OVERRIDE; virtual void Flush() ORTHANC_OVERRIDE; };
--- a/Framework/Outputs/HierarchicalTiffWriter.cpp Wed Sep 02 17:26:14 2026 +0200 +++ b/Framework/Outputs/HierarchicalTiffWriter.cpp Wed Sep 02 17:56:53 2026 +0200 @@ -81,8 +81,8 @@ struct HierarchicalTiffWriter::Comparator { - inline bool operator() (PendingTile* const& a, - PendingTile* const& b) + inline bool operator() (const PendingTile* const& a, + const PendingTile* const& b) { if (a->GetLevel() < b->GetLevel()) {
--- a/Framework/Outputs/HierarchicalTiffWriter.h Wed Sep 02 17:26:14 2026 +0200 +++ b/Framework/Outputs/HierarchicalTiffWriter.h Wed Sep 02 17:56:53 2026 +0200 @@ -86,7 +86,7 @@ unsigned int tileHeight, Orthanc::PhotometricInterpretation photometric); - virtual ~HierarchicalTiffWriter(); + virtual ~HierarchicalTiffWriter() ORTHANC_OVERRIDE; virtual void Flush() ORTHANC_OVERRIDE; };
--- a/Framework/Outputs/InMemoryTiledImage.h Wed Sep 02 17:26:14 2026 +0200 +++ b/Framework/Outputs/InMemoryTiledImage.h Wed Sep 02 17:56:53 2026 +0200 @@ -58,7 +58,7 @@ Orthanc::PhotometricInterpretation photometric, BackgroundColor backgroundColor); - virtual ~InMemoryTiledImage(); + virtual ~InMemoryTiledImage() ORTHANC_OVERRIDE; virtual unsigned int GetLevelCount() const ORTHANC_OVERRIDE {
--- a/ViewerPlugin/Annotations/AnnotationsWorkspace.h Wed Sep 02 17:26:14 2026 +0200 +++ b/ViewerPlugin/Annotations/AnnotationsWorkspace.h Wed Sep 02 17:56:53 2026 +0200 @@ -51,7 +51,7 @@ public: explicit AnnotationsWorkspace(const AnnotationsWorkspaceId& id); - ~AnnotationsWorkspace(); + virtual ~AnnotationsWorkspace() ORTHANC_OVERRIDE; const AnnotationsWorkspaceId& GetId() const {
--- a/ViewerPlugin/Annotations/LayersCollection.h Wed Sep 02 17:26:14 2026 +0200 +++ b/ViewerPlugin/Annotations/LayersCollection.h Wed Sep 02 17:56:53 2026 +0200 @@ -43,7 +43,7 @@ Index index_; public: - ~LayersCollection(); + virtual ~LayersCollection() ORTHANC_OVERRIDE; size_t GetSize() const;
--- a/ViewerPlugin/DicomPyramidCache.cpp Wed Sep 02 17:26:14 2026 +0200 +++ b/ViewerPlugin/DicomPyramidCache.cpp Wed Sep 02 17:56:53 2026 +0200 @@ -139,7 +139,15 @@ while (!cache_.IsEmpty()) { DicomPyramid* pyramid = NULL; - std::string seriesId = cache_.RemoveOldest(pyramid); + + try + { + /* std::string seriesId = */ cache_.RemoveOldest(pyramid); + } + catch (Orthanc::OrthancException&) + { + // Should never happen, don't throw exceptions in destructor + } if (pyramid != NULL) {
--- a/ViewerPlugin/OrthancPyramidFrameFetcher.cpp Wed Sep 02 17:26:14 2026 +0200 +++ b/ViewerPlugin/OrthancPyramidFrameFetcher.cpp Wed Sep 02 17:56:53 2026 +0200 @@ -91,11 +91,11 @@ } - DecodedTiledPyramid* OrthancPyramidFrameFetcher::Fetch(const std::string &instanceId, + DecodedTiledPyramid* OrthancPyramidFrameFetcher::Fetch(const std::string& instanceId, unsigned frameNumber) { OrthancPlugins::MemoryBuffer buffer; - buffer.GetDicomInstance(instanceId.c_str()); + buffer.GetDicomInstance(instanceId); OrthancPlugins::DicomInstance dicom(buffer.GetData(), buffer.GetSize());
--- a/ViewerPlugin/Plugin.cpp Wed Sep 02 17:26:14 2026 +0200 +++ b/ViewerPlugin/Plugin.cpp Wed Sep 02 17:56:53 2026 +0200 @@ -580,10 +580,10 @@ const bool enableIIIF = OrthancWSI::ViewerConfiguration::GetInstance().IsIIIFEnabled(); bool serveMirador = false; bool serveOpenSeadragon = false; - std::string iiifPublicUrl; if (enableIIIF) { + std::string iiifPublicUrl; InitializeIIIF(iiifPublicUrl); serveMirador = OrthancWSI::ViewerConfiguration::GetInstance().IsServeMirador();
