Merge pull request #4227 from sfc-gh-tclinkenbeard/encapsulate-packetwriter

Encapsulate PacketWriter methods
This commit is contained in:
Andrew Noyes 2021-01-25 15:08:46 -08:00 committed by GitHub
commit 17962712fb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 3 deletions

View File

@ -764,7 +764,7 @@ public:
};
struct PacketWriter {
static const int isDeserializing = 0;
static constexpr int isDeserializing = 0;
static constexpr bool isSerializing = true;
typedef PacketWriter WRITER;
@ -786,9 +786,7 @@ struct PacketWriter {
serializeBytesAcrossBoundary(data, bytes);
}
}
void serializeBytesAcrossBoundary(const void* data, int bytes);
void writeAhead( int bytes, struct SplitBuffer* );
void nextBuffer(size_t size = 0 /* downstream it will default to at least 4k minus some padding */);
PacketBuffer* finish();
int size() const { return length; }
@ -808,6 +806,8 @@ struct PacketWriter {
void setProtocolVersion(ProtocolVersion pv) { m_protocolVersion = pv; }
private:
void serializeBytesAcrossBoundary(const void* data, int bytes);
void nextBuffer(size_t size = 0 /* downstream it will default to at least 4k minus some padding */);
uint8_t* writeBytes(size_t size) {
if (size > buffer->bytes_unwritten()) {
nextBuffer(size);