Mercurial > hg > orthanc-dicomweb
changeset 496:9ff78e5e9dce
sync
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 05 May 2021 09:55:53 +0200 |
parents | 3b230ae7b71f |
children | a17b1848aff6 |
files | Resources/Orthanc/Plugins/OrthancPluginCppWrapper.cpp |
diffstat | 1 files changed, 16 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/Resources/Orthanc/Plugins/OrthancPluginCppWrapper.cpp Mon May 03 18:56:25 2021 +0200 +++ b/Resources/Orthanc/Plugins/OrthancPluginCppWrapper.cpp Wed May 05 09:55:53 2021 +0200 @@ -2726,10 +2726,18 @@ delete *it; } + size_ = 0; content_.clear(); } - void Flatten(std::string& target) const + /** + * Since Orthanc 1.9.3, this function also clears the content of + * the ChunkedBuffer in order to mimic the behavior of the + * original class "Orthanc::ChunkedBuffer". This prevents the + * forgetting of calling "Clear()" in order to reduce memory + * consumption. + **/ + void Flatten(std::string& target) { target.resize(size_); @@ -2745,10 +2753,14 @@ memcpy(&target[pos], (*it)->c_str(), s); pos += s; } + + delete *it; } - assert(size_ == 0 || - pos == target.size()); + assert(pos == target.size()); + + size_ = 0; + content_.clear(); } void AddChunk(const void* data, @@ -2779,7 +2791,7 @@ return headers_; } - const ChunkedBuffer& GetBody() const + ChunkedBuffer& GetBody() { return body_; }