Conditions | 7 |
Total Lines | 32 |
Code Lines | 21 |
Lines | 0 |
Ratio | 0 % |
Tests | 16 |
CRAP Score | 7.392 |
Changes | 0 |
1 | package decode |
||
19 | func decodeMapItems(reader io.Reader, v interface{}, size int, wasRead readLen, items int) error { |
||
20 | 1 | readItems := 0 |
|
21 | 1 | readPosition := wasRead |
|
22 | |||
23 | 1 | for readItems < items && readPosition < readLen(size) { |
|
24 | 1 | key, read, err := readMapKey(reader) |
|
25 | 1 | if err != nil { |
|
26 | return err |
||
27 | } |
||
28 | 1 | readPosition += read |
|
29 | |||
30 | 1 | t, read, err := readType(reader) |
|
31 | 1 | if err != nil { |
|
32 | return err |
||
33 | } |
||
34 | 1 | readPosition += read |
|
35 | |||
36 | 1 | val, err := readValue(t, reader) |
|
37 | 1 | if err != nil { |
|
38 | return err |
||
39 | } |
||
40 | 1 | readPosition += readLen(len(val)) |
|
41 | |||
42 | 1 | err = addMapItem(key, t, val, v) |
|
43 | 1 | if err != nil { |
|
44 | return err |
||
45 | } |
||
46 | |||
47 | 1 | readItems++ |
|
48 | } |
||
49 | |||
50 | 1 | return nil |
|
51 | } |
||
62 |