MCPcopy Create free account
hub / github.com/bodgit/sevenzip / readFolder

Function readFolder

types.go:314–388  ·  view source on GitHub ↗

nolint:cyclop,funlen

(r util.Reader)

Source from the content-addressed store, hash-verified

312
313//nolint:cyclop,funlen
314func 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 {

Callers 1

readUnpackInfoFunction · 0.85

Calls 5

readUint64BoundedFunction · 0.85
readCoderFunction · 0.85
checkUint64Function · 0.85
readUint64Function · 0.85
findInBindPairMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…