nolint:cyclop,funlen
(r util.Reader)
| 312 | |
| 313 | //nolint:cyclop,funlen |
| 314 | func readFolder(r util.Reader) (*folder, error) { |
| 315 | f := new(folder) |
| 316 | |
| 317 | coders, err := readUint64Bounded(r, true) |
| 318 | if err != nil { |
| 319 | return nil, err |
| 320 | } |
| 321 | |
| 322 | f.coder = make([]*coder, 0, min(coders, 16)) |
| 323 | |
| 324 | for range coders { |
| 325 | coder, err := readCoder(r) |
| 326 | if err != nil { |
| 327 | return nil, err |
| 328 | } |
| 329 | |
| 330 | f.coder = append(f.coder, coder) |
| 331 | |
| 332 | f.in += coder.in |
| 333 | f.out += coder.out |
| 334 | } |
| 335 | |
| 336 | if err := checkUint64(f.in, true); err != nil { |
| 337 | return nil, err |
| 338 | } |
| 339 | |
| 340 | if err := checkUint64(f.out, true); err != nil { |
| 341 | return nil, err |
| 342 | } |
| 343 | |
| 344 | if f.in < f.out { |
| 345 | return nil, errInvalidBindPair |
| 346 | } |
| 347 | |
| 348 | bindPairs := f.out - 1 |
| 349 | |
| 350 | f.bindPair = make([]*bindPair, 0, min(bindPairs, 16)) |
| 351 | |
| 352 | for range bindPairs { |
| 353 | in, err := readUint64Bounded(r, false) |
| 354 | if err != nil { |
| 355 | return nil, err |
| 356 | } |
| 357 | |
| 358 | out, err := readUint64Bounded(r, false) |
| 359 | if err != nil { |
| 360 | return nil, err |
| 361 | } |
| 362 | |
| 363 | f.bindPair = append(f.bindPair, &bindPair{ |
| 364 | in: in, |
| 365 | out: out, |
| 366 | }) |
| 367 | } |
| 368 | |
| 369 | f.packedStreams = f.in - bindPairs |
| 370 | |
| 371 | if f.packedStreams == 1 { |
no test coverage detected
searching dependent graphs…