Mercurial > hg > orthanc
diff OrthancServer/Sources/ServerContext.cpp @ 4519:a3c6678aa7b1
cppcheck
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Mon, 22 Feb 2021 16:51:23 +0100 |
parents | 5b929e6b3c36 |
children | f75c63aa9de0 |
line wrap: on
line diff
--- a/OrthancServer/Sources/ServerContext.cpp Mon Feb 22 16:32:11 2021 +0100 +++ b/OrthancServer/Sources/ServerContext.cpp Mon Feb 22 16:51:23 2021 +0100 @@ -586,7 +586,7 @@ FileInfo dicomUntilPixelData; if (hasPixelDataOffset && (!area_.HasReadRange() || - compression != CompressionType_None)) + compressionEnabled_)) { dicomUntilPixelData = accessor.Write(dicom.GetBufferData(), pixelDataOffset, FileContentType_DicomUntilPixelData, compression, storeMD5_); @@ -856,7 +856,7 @@ **/ bool hasPixelDataOffset; - uint64_t pixelDataOffset; + uint64_t pixelDataOffset = 0; // dummy initialization { std::string s; @@ -902,9 +902,11 @@ * "true". **/ - StorageAccessor accessor(area_, GetMetricsRegistry()); - std::unique_ptr<IMemoryBuffer> dicom( - area_.ReadRange(attachment.GetUuid(), FileContentType_Dicom, 0, pixelDataOffset)); + std::unique_ptr<IMemoryBuffer> dicom; + { + MetricsRegistry::Timer timer(GetMetricsRegistry(), "orthanc_storage_read_range_duration_ms"); + dicom.reset(area_.ReadRange(attachment.GetUuid(), FileContentType_Dicom, 0, pixelDataOffset)); + } if (dicom.get() == NULL) { @@ -973,7 +975,7 @@ boost::lexical_cast<std::string>(pixelDataOffset)); if (!area_.HasReadRange() || - compressionEnabled_ != CompressionType_None) + compressionEnabled_) { AddAttachment(instancePublicId, FileContentType_DicomUntilPixelData, dicom.empty() ? NULL: dicom.c_str(), pixelDataOffset);