# HG changeset patch # User Sebastien Jodogne # Date 1775583136 -7200 # Node ID a08fcc590d61ba169de7e4c7eca189dc4599a5fc # Parent 9544238ce850e2307dcf1d61cb9f87c550275792 cppcheck diff -r 9544238ce850 -r a08fcc590d61 Aws/AwsS3StoragePlugin.cpp --- a/Aws/AwsS3StoragePlugin.cpp Wed Jan 28 08:22:01 2026 +0100 +++ b/Aws/AwsS3StoragePlugin.cpp Tue Apr 07 19:32:16 2026 +0200 @@ -77,7 +77,7 @@ Aws::S3::Model::StorageClass storageClass, const std::map& tags); - virtual ~AwsS3StoragePlugin(); + virtual ~AwsS3StoragePlugin() ORTHANC_OVERRIDE; virtual IWriter* GetWriterForObject(const char* uuid, OrthancPluginContentType type, bool encryptionEnabled) ORTHANC_OVERRIDE; virtual IReader* GetReaderForObject(const char* uuid, OrthancPluginContentType type, bool encryptionEnabled) ORTHANC_OVERRIDE; @@ -136,10 +136,6 @@ { } - virtual ~DirectWriter() - { - } - virtual void Write(const char* data, size_t size) ORTHANC_OVERRIDE { Aws::S3::Model::PutObjectRequest putObjectRequest; @@ -190,16 +186,11 @@ { } - virtual ~DirectReader() - { - - } - virtual size_t GetSize() ORTHANC_OVERRIDE { std::string firstExceptionMessage; - for (auto& path: paths_) + for (const std::string& path: paths_) { try { @@ -263,7 +254,7 @@ { std::string firstExceptionMessage; - for (auto& path: paths_) + for (const std::string& path: paths_) { try { @@ -341,10 +332,6 @@ { } - virtual ~TransferWriter() - { - } - virtual void Write(const char* data, size_t size) ORTHANC_OVERRIDE { boost::interprocess::bufferstream buffer(const_cast(static_cast(data)), static_cast(size)); @@ -374,11 +361,6 @@ { } - virtual ~TransferReader() - { - - } - virtual void ReadWhole(char* data, size_t size) ORTHANC_OVERRIDE { std::string firstExceptionMessage; @@ -454,8 +436,6 @@ class AwsOrthancLogger : public Aws::Utils::Logging::LogSystemInterface { public: - virtual ~AwsOrthancLogger() {} - /** * Gets the currently configured log level for this logger. */ @@ -794,7 +774,7 @@ } // DeleteObject succeeds even if the file does not exist -> we need to try to delete every path - for (auto& path: paths) + for (const std::string& path: paths) { Aws::S3::Model::DeleteObjectRequest deleteObjectRequest; deleteObjectRequest.SetBucket(bucketName_.c_str()); diff -r 9544238ce850 -r a08fcc590d61 Common/EncryptionHelpers.cpp --- a/Common/EncryptionHelpers.cpp Wed Jan 28 08:22:01 2026 +0100 +++ b/Common/EncryptionHelpers.cpp Tue Apr 07 19:32:16 2026 +0200 @@ -251,7 +251,7 @@ ) // StreamTransformationFilter ); // StringSource - output.Assign((const byte*)outputString.data(), outputString.size()); + output.Assign(reinterpret_cast(outputString.data()), outputString.size()); } catch (CryptoPP::Exception& e) { @@ -303,13 +303,13 @@ // defines two channels: "" (empty) and "AAD" // channel "" is encrypted and authenticated // channel "AAD" is authenticated - ef.ChannelPut("AAD", (const byte*)prefix.data(), prefix.size()); + ef.ChannelPut("AAD", reinterpret_cast(prefix.data()), prefix.size()); ef.ChannelMessageEnd("AAD"); // Authenticated data *must* be pushed before // Confidential/Authenticated data. Otherwise // we must catch the BadState exception - ef.ChannelPut("", (const byte*)data, size); + ef.ChannelPut("", reinterpret_cast(data), size); ef.ChannelMessageEnd(""); } catch(CryptoPP::Exception& e) @@ -354,9 +354,9 @@ AuthenticatedDecryptionFilter::THROW_EXCEPTION, INTEGRITY_CHECK_TAG_SIZE); // The order of the following calls are important - df.ChannelPut("", (const byte*)mac.data(), mac.size()); - df.ChannelPut("AAD", (const byte*)prefix.data(), prefix.size()); - df.ChannelPut("", (const byte*)(data) + prefixSize, size - INTEGRITY_CHECK_TAG_SIZE - prefixSize); + df.ChannelPut("", reinterpret_cast(mac.data()), mac.size()); + df.ChannelPut("AAD", reinterpret_cast(prefix.data()), prefix.size()); + df.ChannelPut("", reinterpret_cast(data) + prefixSize, size - INTEGRITY_CHECK_TAG_SIZE - prefixSize); // If the object throws, it will most likely occur // during ChannelMessageEnd() @@ -381,7 +381,7 @@ { assert(n == size - OVERHEAD_SIZE); - df.Get((byte*)output, n); + df.Get(reinterpret_cast(output), n); } } catch (CryptoPP::Exception& ex) diff -r 9544238ce850 -r a08fcc590d61 Common/EncryptionHelpers.h --- a/Common/EncryptionHelpers.h Wed Jan 28 08:22:01 2026 +0100 +++ b/Common/EncryptionHelpers.h Tue Apr 07 19:32:16 2026 +0200 @@ -66,7 +66,7 @@ // since the memory used during encryption/decryption can grow up to a bit more than 2 times the input, // we want to limit the number of threads doing concurrent processing according to the available memory // instead of the number of concurrent threads - EncryptionHelpers(size_t maxConcurrentInputSize = 1024*1024*1024); + explicit EncryptionHelpers(size_t maxConcurrentInputSize = 1024*1024*1024); void SetCurrentMasterKey(uint32_t id, const std::string& path); @@ -92,11 +92,11 @@ void EncryptInternal(std::string& output, const char* data, size_t size, const CryptoPP::SecByteBlock& masterKey); - void DecryptInternal(char* output, const char* data, size_t size, const CryptoPP::SecByteBlock& masterKey); + static void DecryptInternal(char* output, const char* data, size_t size, const CryptoPP::SecByteBlock& masterKey); - void EncryptPrefixSecBlock(std::string& output, const CryptoPP::SecByteBlock& input, const CryptoPP::SecByteBlock& masterKey); + static void EncryptPrefixSecBlock(std::string& output, const CryptoPP::SecByteBlock& input, const CryptoPP::SecByteBlock& masterKey); - void DecryptPrefixSecBlock(CryptoPP::SecByteBlock& output, const std::string& input, const CryptoPP::SecByteBlock& masterKey); + static void DecryptPrefixSecBlock(CryptoPP::SecByteBlock& output, const std::string& input, const CryptoPP::SecByteBlock& masterKey); std::string GetMasterKeyIdentifier(const CryptoPP::SecByteBlock& masterKey); diff -r 9544238ce850 -r a08fcc590d61 Common/FileSystemStorage.h --- a/Common/FileSystemStorage.h Wed Jan 28 08:22:01 2026 +0100 +++ b/Common/FileSystemStorage.h Tue Apr 07 19:32:16 2026 +0200 @@ -40,7 +40,6 @@ fsync_(fsync) {} - virtual ~FileSystemWriter() {} virtual void Write(const char* data, size_t size) ORTHANC_OVERRIDE; }; @@ -52,7 +51,6 @@ : path_(path) {} - virtual ~FileSystemReader() {} virtual size_t GetSize() ORTHANC_OVERRIDE; virtual void ReadWhole(char* data, size_t size) ORTHANC_OVERRIDE; virtual void ReadRange(char* data, size_t size, size_t fromOffset) ORTHANC_OVERRIDE; diff -r 9544238ce850 -r a08fcc590d61 Common/StoragePlugin.cpp --- a/Common/StoragePlugin.cpp Wed Jan 28 08:22:01 2026 +0100 +++ b/Common/StoragePlugin.cpp Tue Apr 07 19:32:16 2026 +0200 @@ -40,9 +40,9 @@ #include #include -#include "../Common/EncryptionHelpers.h" -#include "../Common/EncryptionConfigurator.h" -#include "../Common/FileSystemStorage.h" +#include "EncryptionHelpers.h" +#include "EncryptionConfigurator.h" +#include "FileSystemStorage.h" #include #include @@ -117,7 +117,7 @@ try { - crypto->Encrypt(encryptedFile, (const char*)content, size); + crypto->Encrypt(encryptedFile, reinterpret_cast(content), size); } catch (EncryptionException& ex) {