size_t bodyBuffers(bool chunked, list<string> &chunkLines, const iovec* vec, int c, Buffers& buffers) { size_t rsize = 0; for (int i = 0; i < c; ++i) rsize += vec[i].iov_len; if (rsize != 0) { if (chunked) { chunkLines.push_back(hexSize(rsize)); buffers.push_back(toBuffer(chunkLines.back())); buffers.push_back(blanklineBuffer()); buffers.insert(buffers.end(), vec, vec + c); buffers.push_back(blanklineBuffer()); } else { buffers.insert(buffers.end(), vec, vec + c); } } return rsize; }
bool MemoryFileImpl::Write( void const* Src, size_t Size ) { mSize += Size; char const* p = ( char const* )Src; while( Size ) { if( mActBufferId >= mBuffers.size() ) { mBuffers.push_back( Buffer_t() ); } const size_t W = mBuffers[mActBufferId].write( p, Size ); Size -= W; p += W; if( Size ) { mActBufferId++; } } return true; }