From 0b8280d4fcbf3a65997c3cc86cf14f5f7c44b7fe Mon Sep 17 00:00:00 2001 From: Stefan Boberg Date: Thu, 13 May 2021 12:01:18 +0200 Subject: Made SharedBuffer/UniqueBuffer share guts with IoBuffer This enables way more efficient marshaling of compact binary objects and attachments --- zencore/compactbinarypackage.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'zencore/compactbinarypackage.cpp') diff --git a/zencore/compactbinarypackage.cpp b/zencore/compactbinarypackage.cpp index 9eb67ac93..f84137ff6 100644 --- a/zencore/compactbinarypackage.cpp +++ b/zencore/compactbinarypackage.cpp @@ -145,7 +145,7 @@ CbAttachment::Load(BinaryReader& Reader, BufferAllocator Allocator) std::vector HashBuffer; CbField HashField = LoadCompactBinary(Reader, [&HashBuffer](uint64_t Size) -> UniqueBuffer { HashBuffer.resize(Size); - return UniqueBuffer::MakeView(HashBuffer.data(), Size); + return UniqueBuffer::MakeMutableView(HashBuffer.data(), Size); }); Hash = HashField.AsAttachment(); ZEN_ASSERT(!HashField.HasError(), "Attachments must be a non-empty binary value with a content hash."); @@ -351,7 +351,7 @@ CbPackage::Load(BinaryReader& Reader, BufferAllocator Allocator, AttachmentResol const auto StackAllocator = [&Allocator, &StackBuffer](uint64_t Size) -> UniqueBuffer { if (Size <= sizeof(StackBuffer)) { - return UniqueBuffer::MakeView(StackBuffer, Size); + return UniqueBuffer::MakeMutableView(StackBuffer, Size); } return Allocator(Size); -- cgit v1.2.3