Mercurial > hg > orthanc
changeset 4200:7112a8af0b63
cppcheck
line wrap: on
line diff
--- a/OrthancFramework/Sources/DicomNetworking/Internals/FindScp.cpp Wed Sep 16 20:28:20 2020 +0200 +++ b/OrthancFramework/Sources/DicomNetworking/Internals/FindScp.cpp Wed Sep 16 20:53:31 2020 +0200 @@ -137,14 +137,22 @@ const std::string* remoteAet_; const std::string* calledAet_; - FindScpData() : answers_(false) + FindScpData() : + modalities_(NULL), + findHandler_(NULL), + worklistHandler_(NULL), + answers_(false), + lastRequest_(NULL), + remoteIp_(NULL), + remoteAet_(NULL), + calledAet_(NULL) { } }; - static void FixWorklistQuery(ParsedDicomFile& query) + static void FixWorklistQuery(const ParsedDicomFile& query) { // TODO: Check out // WlmDataSourceFileSystem::HandleExistentButEmptyDescriptionAndCodeSequenceAttributes()"
--- a/OrthancFramework/Sources/DicomNetworking/Internals/GetScp.cpp Wed Sep 16 20:28:20 2020 +0200 +++ b/OrthancFramework/Sources/DicomNetworking/Internals/GetScp.cpp Wed Sep 16 20:53:31 2020 +0200 @@ -100,11 +100,12 @@ std::string calledAet_; int timeout_; - GetScpData() + GetScpData() : + handler_(NULL), + lastRequest_(NULL), + assoc_(NULL), + timeout_(0) { - handler_ = NULL; - lastRequest_ = NULL; - assoc_ = NULL; }; }; @@ -248,9 +249,9 @@ T_DIMSE_Message * msg, T_ASC_PresentationContextID presID, IGetRequestHandler& handler, - std::string remoteIp, - std::string remoteAet, - std::string calledAet, + const std::string& remoteIp, + const std::string& remoteAet, + const std::string& calledAet, int timeout) { GetScpData data;
--- a/OrthancFramework/Sources/DicomNetworking/Internals/GetScp.h Wed Sep 16 20:28:20 2020 +0200 +++ b/OrthancFramework/Sources/DicomNetworking/Internals/GetScp.h Wed Sep 16 20:53:31 2020 +0200 @@ -32,9 +32,9 @@ T_DIMSE_Message * msg, T_ASC_PresentationContextID presID, IGetRequestHandler& handler, - std::string remoteIp, - std::string remoteAet, - std::string calledAet, + const std::string& remoteIp, + const std::string& remoteAet, + const std::string& calledAet, int timeout); } }
--- a/OrthancFramework/Sources/DicomParsing/DcmtkTranscoder.cpp Wed Sep 16 20:28:20 2020 +0200 +++ b/OrthancFramework/Sources/DicomParsing/DcmtkTranscoder.cpp Wed Sep 16 20:53:31 2020 +0200 @@ -53,7 +53,7 @@ void DcmtkTranscoder::SetLossyQuality(unsigned int quality) { - if (quality <= 0 || + if (quality == 0 || quality > 100) { throw OrthancException( @@ -89,8 +89,6 @@ uint16_t bitsStored; bool hasBitsStored = GetBitsStored(bitsStored, *dicom.getDataset()); - std::string sourceSopInstanceUid = IDicomTranscoder::GetSopInstanceUid(dicom); - if (allowedSyntaxes.find(syntax) != allowedSyntaxes.end()) { // No transcoding is needed
--- a/OrthancFramework/Sources/DicomParsing/DicomDirWriter.cpp Wed Sep 16 20:28:20 2020 +0200 +++ b/OrthancFramework/Sources/DicomParsing/DicomDirWriter.cpp Wed Sep 16 20:53:31 2020 +0200 @@ -396,7 +396,7 @@ bool CreateResource(DcmDirectoryRecord*& target, ResourceType level, - ParsedDicomFile& dicom, + const ParsedDicomFile& dicom, const char* filename, const char* path) {
--- a/OrthancFramework/Sources/DicomParsing/DicomModification.cpp Wed Sep 16 20:28:20 2020 +0200 +++ b/OrthancFramework/Sources/DicomParsing/DicomModification.cpp Wed Sep 16 20:53:31 2020 +0200 @@ -64,8 +64,8 @@ public: - RelationshipsVisitor(DicomModification& that) : - that_(that) + explicit RelationshipsVisitor(DicomModification& that) : + that_(that) { } @@ -1401,32 +1401,32 @@ for (UidMap::const_iterator it = uidMap_.begin(); it != uidMap_.end(); ++it) { - Json::Value* tmp = NULL; + Json::Value* tmp2 = NULL; switch (it->first.first) { case ResourceType_Patient: - tmp = &mapPatients; + tmp2 = &mapPatients; break; case ResourceType_Study: - tmp = &mapStudies; + tmp2 = &mapStudies; break; case ResourceType_Series: - tmp = &mapSeries; + tmp2 = &mapSeries; break; case ResourceType_Instance: - tmp = &mapInstances; + tmp2 = &mapInstances; break; default: throw OrthancException(ErrorCode_InternalError); } - assert(tmp != NULL); - (*tmp) [it->first.second] = it->second; + assert(tmp2 != NULL); + (*tmp2) [it->first.second] = it->second; } }
--- a/OrthancFramework/Sources/DicomParsing/DicomModification.h Wed Sep 16 20:28:20 2020 +0200 +++ b/OrthancFramework/Sources/DicomParsing/DicomModification.h Wed Sep 16 20:53:31 2020 +0200 @@ -110,7 +110,7 @@ public: DicomModification(); - DicomModification(const Json::Value& serialized); + explicit DicomModification(const Json::Value& serialized); ~DicomModification();
--- a/OrthancFramework/Sources/DicomParsing/DicomWebJsonVisitor.cpp Wed Sep 16 20:28:20 2020 +0200 +++ b/OrthancFramework/Sources/DicomParsing/DicomWebJsonVisitor.cpp Wed Sep 16 20:53:31 2020 +0200 @@ -561,7 +561,7 @@ { case ValueRepresentation_PersonName: { - Json::Value value = Json::objectValue; + Json::Value tmp = Json::objectValue; if (!tokens[i].empty()) { std::vector<std::string> components; @@ -569,21 +569,21 @@ if (components.size() >= 1) { - value[KEY_ALPHABETIC] = components[0]; + tmp[KEY_ALPHABETIC] = components[0]; } if (components.size() >= 2) { - value[KEY_IDEOGRAPHIC] = components[1]; + tmp[KEY_IDEOGRAPHIC] = components[1]; } if (components.size() >= 3) { - value[KEY_PHONETIC] = components[2]; + tmp[KEY_PHONETIC] = components[2]; } } - node[KEY_VALUE].append(value); + node[KEY_VALUE].append(tmp); break; } @@ -604,8 +604,8 @@ } else { - int64_t value = boost::lexical_cast<int64_t>(t); - node[KEY_VALUE].append(FormatInteger(value)); + int64_t tmp = boost::lexical_cast<int64_t>(t); + node[KEY_VALUE].append(FormatInteger(tmp)); } break; @@ -620,8 +620,8 @@ } else { - double value = boost::lexical_cast<double>(t); - node[KEY_VALUE].append(FormatDouble(value)); + double tmp = boost::lexical_cast<double>(t); + node[KEY_VALUE].append(FormatDouble(tmp)); } break;
--- a/OrthancFramework/Sources/DicomParsing/FromDcmtkBridge.cpp Wed Sep 16 20:28:20 2020 +0200 +++ b/OrthancFramework/Sources/DicomParsing/FromDcmtkBridge.cpp Wed Sep 16 20:53:31 2020 +0200 @@ -1889,9 +1889,8 @@ if (tag != DICOM_TAG_SPECIFIC_CHARACTER_SET) { std::unique_ptr<DcmElement> element(FromDcmtkBridge::FromJson(tag, value, decodeDataUriScheme, encoding, privateCreator)); - const DcmTagKey& tag = element->getTag(); - - result->findAndDeleteElement(tag); + + result->findAndDeleteElement(element->getTag()); DcmElement* tmp = element.release(); if (!result->insert(tmp, false, false).good())
--- a/OrthancFramework/Sources/DicomParsing/IDicomTranscoder.cpp Wed Sep 16 20:28:20 2020 +0200 +++ b/OrthancFramework/Sources/DicomParsing/IDicomTranscoder.cpp Wed Sep 16 20:53:31 2020 +0200 @@ -227,7 +227,9 @@ IDicomTranscoder::DicomImage::DicomImage() : - isExternalBuffer_(false) + isExternalBuffer_(false), + externalBuffer_(NULL), + externalSize_(0) { }
--- a/OrthancFramework/Sources/DicomParsing/Internals/DicomFrameIndex.cpp Wed Sep 16 20:28:20 2020 +0200 +++ b/OrthancFramework/Sources/DicomParsing/Internals/DicomFrameIndex.cpp Wed Sep 16 20:53:31 2020 +0200 @@ -190,7 +190,7 @@ virtual void GetRawFrame(std::string& frame, - unsigned int index) const + unsigned int index) const ORTHANC_OVERRIDE { if (index >= startFragment_.size()) { @@ -267,7 +267,7 @@ } virtual void GetRawFrame(std::string& frame, - unsigned int index) const + unsigned int index) const ORTHANC_OVERRIDE { frame.resize(frameSize_); if (frameSize_ > 0) @@ -298,7 +298,7 @@ } virtual void GetRawFrame(std::string& frame, - unsigned int index) const + unsigned int index) const ORTHANC_OVERRIDE { frame.resize(frameSize_); if (frameSize_ > 0)
--- a/OrthancFramework/Sources/DicomParsing/Internals/DicomFrameIndex.h Wed Sep 16 20:28:20 2020 +0200 +++ b/OrthancFramework/Sources/DicomParsing/Internals/DicomFrameIndex.h Wed Sep 16 20:53:31 2020 +0200 @@ -56,7 +56,7 @@ unsigned int countFrames_; public: - DicomFrameIndex(DcmDataset& dicom); + explicit DicomFrameIndex(DcmDataset& dicom); unsigned int GetFramesCount() const {
--- a/OrthancFramework/Sources/DicomParsing/Internals/DicomImageDecoder.cpp Wed Sep 16 20:28:20 2020 +0200 +++ b/OrthancFramework/Sources/DicomParsing/Internals/DicomImageDecoder.cpp Wed Sep 16 20:53:31 2020 +0200 @@ -346,7 +346,7 @@ template <typename PixelType> - static void CopyPixels(ImageAccessor& target, + static void CopyPixels(const ImageAccessor& target, const DicomIntegerPixelAccessor& source) { // WARNING - "::min()" should be replaced by "::lowest()" if @@ -652,7 +652,7 @@ } - ImageAccessor* DicomImageDecoder::Decode(ParsedDicomFile& dicom, + ImageAccessor* DicomImageDecoder::Decode(const ParsedDicomFile& dicom, unsigned int frame) { if (dicom.GetDcmtkObject().getDataset() == NULL)
--- a/OrthancFramework/Sources/DicomParsing/Internals/DicomImageDecoder.h Wed Sep 16 20:28:20 2020 +0200 +++ b/OrthancFramework/Sources/DicomParsing/Internals/DicomImageDecoder.h Wed Sep 16 20:53:31 2020 +0200 @@ -90,7 +90,7 @@ static bool DecodePsmctRle1(std::string& output, DcmDataset& dataset); - static ImageAccessor *Decode(ParsedDicomFile& dicom, + static ImageAccessor *Decode(const ParsedDicomFile& dicom, unsigned int frame); static ImageAccessor *Decode(DcmDataset& dataset,
--- a/OrthancFramework/Sources/DicomParsing/ParsedDicomDir.cpp Wed Sep 16 20:28:20 2020 +0200 +++ b/OrthancFramework/Sources/DicomParsing/ParsedDicomDir.cpp Wed Sep 16 20:53:31 2020 +0200 @@ -65,7 +65,7 @@ } - ParsedDicomDir::ParsedDicomDir(const std::string content) + ParsedDicomDir::ParsedDicomDir(const std::string& content) { ParsedDicomFile dicom(content);
--- a/OrthancFramework/Sources/DicomParsing/ParsedDicomDir.h Wed Sep 16 20:28:20 2020 +0200 +++ b/OrthancFramework/Sources/DicomParsing/ParsedDicomDir.h Wed Sep 16 20:53:31 2020 +0200 @@ -46,7 +46,7 @@ unsigned int offset) const; public: - ParsedDicomDir(const std::string content); + explicit ParsedDicomDir(const std::string& content); ~ParsedDicomDir() {
--- a/OrthancFramework/Sources/DicomParsing/ParsedDicomFile.cpp Wed Sep 16 20:28:20 2020 +0200 +++ b/OrthancFramework/Sources/DicomParsing/ParsedDicomFile.cpp Wed Sep 16 20:53:31 2020 +0200 @@ -1103,7 +1103,7 @@ } - ParsedDicomFile::ParsedDicomFile(ParsedDicomFile& other, + ParsedDicomFile::ParsedDicomFile(const ParsedDicomFile& other, bool keepSopInstanceUid) : pimpl_(new PImpl) {
--- a/OrthancFramework/Sources/DicomParsing/ParsedDicomFile.h Wed Sep 16 20:28:20 2020 +0200 +++ b/OrthancFramework/Sources/DicomParsing/ParsedDicomFile.h Wed Sep 16 20:53:31 2020 +0200 @@ -76,7 +76,7 @@ struct PImpl; boost::shared_ptr<PImpl> pimpl_; - ParsedDicomFile(ParsedDicomFile& other, + ParsedDicomFile(const ParsedDicomFile& other, bool keepSopInstanceUid); void CreateFromDicomMap(const DicomMap& source, @@ -95,7 +95,7 @@ bool EmbedContentInternal(const std::string& dataUriScheme); - ParsedDicomFile(DcmFileFormat* dicom); // This takes ownership (no clone) + explicit ParsedDicomFile(DcmFileFormat* dicom); // This takes ownership (no clone) public: explicit ParsedDicomFile(bool createIdentifiers); // Create a minimal DICOM instance
--- a/OrthancFramework/Sources/FileStorage/FilesystemStorage.h Wed Sep 16 20:28:20 2020 +0200 +++ b/OrthancFramework/Sources/FileStorage/FilesystemStorage.h Wed Sep 16 20:53:31 2020 +0200 @@ -71,14 +71,14 @@ virtual void Create(const std::string& uuid, const void* content, size_t size, - FileContentType type); + FileContentType type) ORTHANC_OVERRIDE; virtual void Read(std::string& content, const std::string& uuid, - FileContentType type); + FileContentType type) ORTHANC_OVERRIDE; virtual void Remove(const std::string& uuid, - FileContentType type); + FileContentType type) ORTHANC_OVERRIDE; void ListAllFiles(std::set<std::string>& result) const;
--- a/OrthancFramework/Sources/FileStorage/MemoryStorageArea.h Wed Sep 16 20:28:20 2020 +0200 +++ b/OrthancFramework/Sources/FileStorage/MemoryStorageArea.h Wed Sep 16 20:53:31 2020 +0200 @@ -43,13 +43,13 @@ virtual void Create(const std::string& uuid, const void* content, size_t size, - FileContentType type); + FileContentType type) ORTHANC_OVERRIDE; virtual void Read(std::string& content, const std::string& uuid, - FileContentType type); + FileContentType type) ORTHANC_OVERRIDE; virtual void Remove(const std::string& uuid, - FileContentType type); + FileContentType type) ORTHANC_OVERRIDE; }; }
--- a/OrthancFramework/Sources/FileStorage/StorageAccessor.h Wed Sep 16 20:28:20 2020 +0200 +++ b/OrthancFramework/Sources/FileStorage/StorageAccessor.h Wed Sep 16 20:53:31 2020 +0200 @@ -75,7 +75,7 @@ #endif public: - StorageAccessor(IStorageArea& area) : + explicit StorageAccessor(IStorageArea& area) : area_(area), metrics_(NULL) {
--- a/OrthancFramework/Sources/HttpServer/BufferHttpSender.h Wed Sep 16 20:28:20 2020 +0200 +++ b/OrthancFramework/Sources/HttpServer/BufferHttpSender.h Wed Sep 16 20:53:31 2020 +0200 @@ -58,15 +58,15 @@ * Implementation of the IHttpStreamAnswer interface. **/ - virtual uint64_t GetContentLength() + virtual uint64_t GetContentLength() ORTHANC_OVERRIDE { return buffer_.size(); } - virtual bool ReadNextChunk(); + virtual bool ReadNextChunk() ORTHANC_OVERRIDE; - virtual const char* GetChunkContent(); + virtual const char* GetChunkContent() ORTHANC_OVERRIDE; - virtual size_t GetChunkSize(); + virtual size_t GetChunkSize() ORTHANC_OVERRIDE; }; }
--- a/OrthancFramework/Sources/Images/JpegWriter.h Wed Sep 16 20:28:20 2020 +0200 +++ b/OrthancFramework/Sources/Images/JpegWriter.h Wed Sep 16 20:53:31 2020 +0200 @@ -43,7 +43,7 @@ unsigned int height, unsigned int pitch, PixelFormat format, - const void* buffer); + const void* buffer) ORTHANC_OVERRIDE; #endif virtual void WriteToMemoryInternal(std::string& jpeg, @@ -51,7 +51,7 @@ unsigned int height, unsigned int pitch, PixelFormat format, - const void* buffer); + const void* buffer) ORTHANC_OVERRIDE; private: uint8_t quality_;
--- a/OrthancFramework/Sources/Images/PamWriter.h Wed Sep 16 20:28:20 2020 +0200 +++ b/OrthancFramework/Sources/Images/PamWriter.h Wed Sep 16 20:53:31 2020 +0200 @@ -35,6 +35,6 @@ unsigned int height, unsigned int pitch, PixelFormat format, - const void* buffer); + const void* buffer) ORTHANC_OVERRIDE; }; }
--- a/OrthancFramework/Sources/Images/PngWriter.h Wed Sep 16 20:28:20 2020 +0200 +++ b/OrthancFramework/Sources/Images/PngWriter.h Wed Sep 16 20:53:31 2020 +0200 @@ -45,7 +45,7 @@ unsigned int height, unsigned int pitch, PixelFormat format, - const void* buffer); + const void* buffer) ORTHANC_OVERRIDE; #endif virtual void WriteToMemoryInternal(std::string& png, @@ -53,7 +53,7 @@ unsigned int height, unsigned int pitch, PixelFormat format, - const void* buffer); + const void* buffer) ORTHANC_OVERRIDE; private: struct PImpl;
--- a/OrthancFramework/Sources/MetricsRegistry.h Wed Sep 16 20:28:20 2020 +0200 +++ b/OrthancFramework/Sources/MetricsRegistry.h Wed Sep 16 20:53:31 2020 +0200 @@ -130,7 +130,7 @@ SharedMetrics& metrics_; public: - ActiveCounter(SharedMetrics& metrics) : + explicit ActiveCounter(SharedMetrics& metrics) : metrics_(metrics) { metrics_.Add(1);