MCPcopy Create free account
hub / github.com/apache/fory / checkWireArraySize

Function checkWireArraySize

go/fory/array_primitive.go:28–45  ·  view source on GitHub ↗
(ctx *ReadContext, size, elemSize int, value reflect.Value)

Source from the content-addressed store, hash-verified

26)
27
28func checkWireArraySize(ctx *ReadContext, size, elemSize int, value reflect.Value) (int, bool) {
29 if ctx.HasError() {
30 return 0, false
31 }
32 if size%elemSize != 0 {
33 ctx.SetError(DeserializationErrorf("array byte length %d is not aligned to element size %d", size, elemSize))
34 return 0, false
35 }
36 length := size / elemSize
37 if length != value.Type().Len() {
38 ctx.SetError(DeserializationErrorf("array length %d does not match type %v", length, value.Type()))
39 return 0, false
40 }
41 if !ctx.Buffer().CheckReadable(size, ctx.Err()) {
42 return 0, false
43 }
44 return length, true
45}
46
47// ============================================================================
48// boolArraySerializer - optimized [N]bool serialization

Callers 13

ReadDataMethod · 0.85
ReadDataMethod · 0.85
ReadDataMethod · 0.85
ReadDataMethod · 0.85
ReadDataMethod · 0.85
ReadDataMethod · 0.85
ReadDataMethod · 0.85
ReadDataMethod · 0.85
ReadDataMethod · 0.85
ReadDataMethod · 0.85
ReadDataMethod · 0.85
ReadDataMethod · 0.85

Calls 8

DeserializationErrorfFunction · 0.85
LenMethod · 0.80
CheckReadableMethod · 0.80
HasErrorMethod · 0.45
SetErrorMethod · 0.45
TypeMethod · 0.45
BufferMethod · 0.45
ErrMethod · 0.45

Tested by

no test coverage detected