(ctx *ReadContext, size, elemSize int, value reflect.Value)
| 26 | ) |
| 27 | |
| 28 | func 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 |
no test coverage detected