| Conditions | 6 |
| Total Lines | 25 |
| Code Lines | 16 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 14 |
| CRAP Score | 6.0106 |
| Changes | 0 | ||
| 1 | package decode |
||
| 19 | func decodeListItems(reader io.Reader, v interface{}, size int, wasRead readLen, items int) error { |
||
| 20 | 1 | rItems := 0 |
|
| 21 | 1 | readPosition := wasRead |
|
| 22 | |||
| 23 | 1 | for rItems < items && readPosition < readLen(size) { |
|
| 24 | 1 | btype, rlen, err := readType(reader) |
|
| 25 | 1 | if err != nil { |
|
| 26 | 1 | return err |
|
| 27 | } |
||
| 28 | |||
| 29 | 1 | bval, err := readValue(btype, reader) |
|
| 30 | 1 | if err != nil { |
|
| 31 | return err |
||
| 32 | } |
||
| 33 | |||
| 34 | 1 | err = addSliceItem(btype, bval, v) |
|
| 35 | 1 | if err != nil { |
|
| 36 | 1 | return err |
|
| 37 | } |
||
| 38 | |||
| 39 | 1 | rItems++ |
|
| 40 | 1 | readPosition += readLen(len(bval)) + rlen |
|
| 41 | } |
||
| 42 | |||
| 43 | 1 | return nil |
|
| 44 | } |
||
| 45 |