static uint64_t WriteToBuffer()

in GameLiftPlugin/Source/AWSSDK/Include/aws/core/utils/stream/StreamBufProtectedWriter.h [30:68]


                static uint64_t WriteToBuffer(Aws::IOStream& ioStream, const WriterFunc& writerFunc)
                {
                    uint64_t totalRead = 0;

                    while (true)
                    {
                        StreamBufProtectedWriter* pBufferCasted = static_cast<StreamBufProtectedWriter*>(ioStream.rdbuf());
                        bool bufferPresent = pBufferCasted && pBufferCasted->pptr() && (pBufferCasted->pptr() < pBufferCasted->epptr());
                        uint64_t read = 0;
                        bool success = false;
                        if (bufferPresent)
                        {
                            // have access to underlying put ptr.
                            success = WriteDirectlyToPtr(pBufferCasted, writerFunc, read);
                        }
                        else
                        {
                            // can't access underlying buffer, stream buffer maybe be customized to not use put ptr.
                            // or underlying put buffer is simply not initialized yet.
                            success = WriteWithHelperBuffer(ioStream, writerFunc, read);
                        }
                        totalRead += read;
                        if (!success)
                        {
                            break;
                        }

                        if (pBufferCasted && pBufferCasted->pptr() && (pBufferCasted->pptr() >= pBufferCasted->epptr()))
                        {
                            if(!ForceOverflow(ioStream, writerFunc))
                            {
                                break;
                            } else {
                                totalRead++;
                            }
                        }
                    }
                    return totalRead;
                }