# HG changeset patch # User Sebastien Jodogne # Date 1788364613 -7200 # Node ID aef928e35e9dd528d74019c86df1688f186bd2fa # Parent 4c9949987d5f72ecd86f35e278cbb78d72ca58d6 cppcheck diff -r 4c9949987d5f -r aef928e35e9d Applications/ApplicationToolbox.cpp --- 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; diff -r 4c9949987d5f -r aef928e35e9d Framework/Enumerations.cpp --- 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 #include -#define HEADER(s) (const void*) (s), sizeof(s)-1 +#define HEADER(s) reinterpret_cast(s), sizeof(s) - 1 namespace OrthancWSI { diff -r 4c9949987d5f -r aef928e35e9d Framework/Inputs/DecodedPyramidCache.cpp --- 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) { diff -r 4c9949987d5f -r aef928e35e9d Framework/Inputs/DicomPyramid.cpp --- 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(); } diff -r 4c9949987d5f -r aef928e35e9d Framework/Inputs/DicomPyramid.h --- 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(); } diff -r 4c9949987d5f -r aef928e35e9d Framework/Inputs/OnTheFlyPyramid.cpp --- 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_) { diff -r 4c9949987d5f -r aef928e35e9d Framework/Inputs/OnTheFlyPyramid.h --- 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; diff -r 4c9949987d5f -r aef928e35e9d Framework/Inputs/OpenSlideLibrary.cpp --- 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(library_.GetFunction("openslide_close")); + getLevelCount_ = reinterpret_cast(library_.GetFunction("openslide_get_level_count")); + getLevelDimensions_ = reinterpret_cast(library_.GetFunction("openslide_get_level_dimensions")); + getLevelDownsample_ = reinterpret_cast(library_.GetFunction("openslide_get_level_downsample")); + open_ = reinterpret_cast(library_.GetFunction("openslide_open")); + readRegion_ = reinterpret_cast(library_.GetFunction("openslide_read_region")); + getPropertyNames_ = reinterpret_cast(library_.GetFunction("openslide_get_property_names")); + getPropertyValue_ = reinterpret_cast(library_.GetFunction("openslide_get_property_value")); } diff -r 4c9949987d5f -r aef928e35e9d Framework/Inputs/TiledPyramidStatistics.h --- 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 { diff -r 4c9949987d5f -r aef928e35e9d Framework/Jpeg2000Reader.cpp --- 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(buffer)), diff -r 4c9949987d5f -r aef928e35e9d Framework/Jpeg2000Writer.cpp --- 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 diff -r 4c9949987d5f -r aef928e35e9d Framework/Outputs/DicomPyramidWriter.h --- 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; }; diff -r 4c9949987d5f -r aef928e35e9d Framework/Outputs/HierarchicalTiffWriter.cpp --- 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()) { diff -r 4c9949987d5f -r aef928e35e9d Framework/Outputs/HierarchicalTiffWriter.h --- 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; }; diff -r 4c9949987d5f -r aef928e35e9d Framework/Outputs/InMemoryTiledImage.h --- 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 { diff -r 4c9949987d5f -r aef928e35e9d ViewerPlugin/Annotations/AnnotationsWorkspace.h --- 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 { diff -r 4c9949987d5f -r aef928e35e9d ViewerPlugin/Annotations/LayersCollection.h --- 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; diff -r 4c9949987d5f -r aef928e35e9d ViewerPlugin/DicomPyramidCache.cpp --- 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) { diff -r 4c9949987d5f -r aef928e35e9d ViewerPlugin/OrthancPyramidFrameFetcher.cpp --- 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()); diff -r 4c9949987d5f -r aef928e35e9d ViewerPlugin/Plugin.cpp --- 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();