in GameLiftPlugin/Source/AWSSDK/Include/aws/core/utils/stream/AwsChunkedStream.h [31:62]
size_t BufferedRead(char *dst, size_t amountToRead) {
assert(dst != nullptr);
if (dst == nullptr) {
AWS_LOGSTREAM_ERROR("AwsChunkedStream", "dst is null");
}
// the chunk has ended and cannot be read from
if (m_chunkEnd) {
return 0;
}
// If we've read all of the underlying stream write the checksum trailing header
// the set that the chunked stream is over.
if (m_stream->eof() && !m_stream->bad() && (m_chunkingStream->eof() || m_chunkingStream->peek() == EOF)) {
return writeTrailer(dst, amountToRead);
}
// Try to read in a 64K chunk, if we cant we know the stream is over
size_t bytesRead = 0;
while (m_stream->good() && bytesRead < DataBufferSize) {
m_stream->read(&m_data[bytesRead], DataBufferSize - bytesRead);
bytesRead += static_cast<size_t>(m_stream->gcount());
}
if (bytesRead > 0) {
writeChunk(bytesRead);
}
// Read to destination buffer, return how much was read
m_chunkingStream->read(dst, amountToRead);
return static_cast<size_t>(m_chunkingStream->gcount());
}