Support size-prefixed buffers and add tests for size-prefixed messages (#6232)

This commit is contained in:
Charlie Yin
2020-11-05 11:23:56 -08:00
committed by GitHub
parent fba93e0abb
commit c9b29d0885
15 changed files with 232 additions and 32 deletions

View File

@@ -39,6 +39,13 @@ func GetRootAsTestSimpleTableWithEnum(buf []byte, offset flatbuffers.UOffsetT) *
return x
}
func GetSizePrefixedRootAsTestSimpleTableWithEnum(buf []byte, offset flatbuffers.UOffsetT) *TestSimpleTableWithEnum {
n := flatbuffers.GetUOffsetT(buf[offset+flatbuffers.SizeUint32:])
x := &TestSimpleTableWithEnum{}
x.Init(buf, n+offset+flatbuffers.SizeUint32)
return x
}
func (rcv *TestSimpleTableWithEnum) Init(buf []byte, i flatbuffers.UOffsetT) {
rcv._tab.Bytes = buf
rcv._tab.Pos = i