Mercurial > hg > orthanc
comparison OrthancFramework/Sources/ChunkedBuffer.cpp @ 4148:732ad6c618ba
removing ChunkedBuffer::AddChunkDestructive()
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 18 Aug 2020 16:56:33 +0200 |
parents | bf7b9edf6b81 |
children | b56f3a37a4a1 |
comparison
equal
deleted
inserted
replaced
4147:ecc11c232326 | 4148:732ad6c618ba |
---|---|
64 AddChunk(&chunk[0], chunk.size()); | 64 AddChunk(&chunk[0], chunk.size()); |
65 } | 65 } |
66 } | 66 } |
67 | 67 |
68 | 68 |
69 void ChunkedBuffer::AddChunkDestructive(std::string& chunk) | 69 void ChunkedBuffer::AddChunk(const std::string::const_iterator& begin, |
70 const std::string::const_iterator& end) | |
70 { | 71 { |
71 size_t chunkSize = chunk.size(); | 72 const size_t s = end - begin; |
72 | 73 |
73 if (chunkSize > 0) | 74 if (s > 0) |
74 { | 75 { |
75 chunks_.push_back(new std::string); | 76 AddChunk(&begin[0], s); |
76 chunks_.back()->swap(chunk); | |
77 numBytes_ += chunkSize; | |
78 } | 77 } |
79 } | 78 } |
80 | 79 |
81 | 80 |
82 void ChunkedBuffer::Flatten(std::string& result) | 81 void ChunkedBuffer::Flatten(std::string& result) |
83 { | 82 { |
84 result.resize(numBytes_); | 83 result.resize(numBytes_); |
85 | 84 |