readListPack returns: list of entry, list of entry size, error
()
| 9 | |
| 10 | // readListPack returns: list of entry, list of entry size, error |
| 11 | func (dec *Decoder) readListPack() ([][]byte, []uint32, error) { |
| 12 | buf, err := dec.readString() |
| 13 | if err != nil { |
| 14 | return nil, nil, err |
| 15 | } |
| 16 | cursor := 0 |
| 17 | size := readListPackLength(buf, &cursor) |
| 18 | entries := make([][]byte, 0, size) |
| 19 | entrySizes := make([]uint32, 0, size) |
| 20 | for i := 0; i < size; i++ { |
| 21 | str, intval, length, err := dec.readListPackEntry(buf, &cursor) |
| 22 | if err != nil { |
| 23 | return nil, nil, err |
| 24 | } |
| 25 | if str == nil { |
| 26 | str = []byte(strconv.FormatInt(intval, 10)) |
| 27 | } |
| 28 | entries = append(entries, str) |
| 29 | entrySizes = append(entrySizes, length) |
| 30 | } |
| 31 | return entries, entrySizes, nil |
| 32 | } |
| 33 | |
| 34 | func readListPackLength(buf []byte, cursor *int) int { |
| 35 | start := *cursor + 4 |
no test coverage detected