mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-21 00:17:32 +00:00
[C#] Fix truncated ArraySegment<byte> if elementSize != 1 (#6462)
* WIP: Fix returned truncated ArraySegment<byte> if elementSize is not byte * Fix * Regenerated test code
This commit is contained in:
@@ -112,7 +112,7 @@ namespace FlatBuffers
|
||||
// Get the data of a vector whoses offset is stored at "offset" in this object as an
|
||||
// ArraySegment<byte>. If the vector is not present in the ByteBuffer,
|
||||
// then a null value will be returned.
|
||||
public ArraySegment<byte>? __vector_as_arraysegment(int offset)
|
||||
public ArraySegment<byte>? __vector_as_arraysegment(int offset, int elementSize)
|
||||
{
|
||||
var o = this.__offset(offset);
|
||||
if (0 == o)
|
||||
@@ -122,7 +122,7 @@ namespace FlatBuffers
|
||||
|
||||
var pos = this.__vector(o);
|
||||
var len = this.__vector_len(o);
|
||||
return bb.ToArraySegment(pos, len);
|
||||
return bb.ToArraySegment(pos, len * elementSize);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user