Mercurial > hg > orthanc
diff OrthancServer/Sources/ServerContext.cpp @ 4900:ea5f1c6ed07e
fix cache of storage area
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Sun, 20 Feb 2022 16:29:33 +0100 |
parents | 6eff25f70121 |
children | c1b19f95e166 |
line wrap: on
line diff
--- a/OrthancServer/Sources/ServerContext.cpp Sun Feb 20 12:00:14 2022 +0100 +++ b/OrthancServer/Sources/ServerContext.cpp Sun Feb 20 16:29:33 2022 +0100 @@ -953,23 +953,17 @@ * "true". **/ - std::unique_ptr<IMemoryBuffer> dicom; + std::string dicom; + { StorageAccessor accessor(area_, storageCache_, GetMetricsRegistry()); - dicom.reset(accessor.ReadStartRange(attachment.GetUuid(), FileContentType_Dicom, pixelDataOffset, FileContentType_DicomUntilPixelData)); - } - - if (dicom.get() == NULL) - { - throw OrthancException(ErrorCode_InternalError); + accessor.ReadStartRange(dicom, attachment.GetUuid(), FileContentType_Dicom, pixelDataOffset); } - else - { - assert(dicom->GetSize() == pixelDataOffset); - ParsedDicomFile parsed(dicom->GetData(), dicom->GetSize()); - OrthancConfiguration::DefaultDicomDatasetToJson(result, parsed, ignoreTagLength); - InjectEmptyPixelData(result); - } + + assert(dicom.size() == pixelDataOffset); + ParsedDicomFile parsed(dicom); + OrthancConfiguration::DefaultDicomDatasetToJson(result, parsed, ignoreTagLength); + InjectEmptyPixelData(result); } else if (ignoreTagLength.empty() && index_.LookupAttachment(attachment, revision, instancePublicId, FileContentType_DicomAsJson)) @@ -1093,9 +1087,9 @@ StorageAccessor accessor(area_, storageCache_, GetMetricsRegistry()); - std::unique_ptr<IMemoryBuffer> buffer( - accessor.ReadStartRange(attachment.GetUuid(), attachment.GetContentType(), pixelDataOffset, FileContentType_DicomUntilPixelData)); - buffer->MoveToString(dicom); + accessor.ReadStartRange(dicom, attachment.GetUuid(), attachment.GetContentType(), pixelDataOffset); + assert(dicom.size() == pixelDataOffset); + return true; // Success } catch (boost::bad_lexical_cast&)