nolint:cyclop
(r util.Reader)
| 211 | |
| 212 | //nolint:cyclop |
| 213 | func readPackInfo(r util.Reader) (*packInfo, error) { |
| 214 | p := new(packInfo) |
| 215 | |
| 216 | var err error |
| 217 | |
| 218 | p.position, err = readUint64(r) |
| 219 | if err != nil { |
| 220 | return nil, err |
| 221 | } |
| 222 | |
| 223 | p.streams, err = readUint64Bounded(r, true) |
| 224 | if err != nil { |
| 225 | return nil, err |
| 226 | } |
| 227 | |
| 228 | id, err := r.ReadByte() |
| 229 | if err != nil { |
| 230 | return nil, fmt.Errorf("readPackInfo: ReadByte error: %w", err) |
| 231 | } |
| 232 | |
| 233 | if id == idSize { |
| 234 | if p.size, err = readSizes(r, p.streams); err != nil { |
| 235 | return nil, err |
| 236 | } |
| 237 | |
| 238 | id, err = r.ReadByte() |
| 239 | if err != nil { |
| 240 | return nil, fmt.Errorf("readPackInfo: ReadByte error: %w", err) |
| 241 | } |
| 242 | } |
| 243 | |
| 244 | if id == idCRC { |
| 245 | if p.digest, err = readCRC(r, p.streams); err != nil { |
| 246 | return nil, err |
| 247 | } |
| 248 | |
| 249 | id, err = r.ReadByte() |
| 250 | if err != nil { |
| 251 | return nil, fmt.Errorf("readPackInfo: ReadByte error: %w", err) |
| 252 | } |
| 253 | } |
| 254 | |
| 255 | if id != idEnd { |
| 256 | return nil, errUnexpectedID |
| 257 | } |
| 258 | |
| 259 | return p, nil |
| 260 | } |
| 261 | |
| 262 | //nolint:cyclop |
| 263 | func readCoder(r util.Reader) (*coder, error) { |
no test coverage detected
searching dependent graphs…