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

Function readStreamsInfo

types.go:572–622  ·  view source on GitHub ↗

nolint:cyclop

(r util.Reader)

Source from the content-addressed store, hash-verified

570
571//nolint:cyclop
572func readStreamsInfo(r util.Reader) (*streamsInfo, error) {
573 s := new(streamsInfo)
574
575 id, err := r.ReadByte()
576 if err != nil {
577 return nil, fmt.Errorf("readStreamsInfo: ReadByte error: %w", err)
578 }
579
580 if id == idPackInfo {
581 if s.packInfo, err = readPackInfo(r); err != nil {
582 return nil, err
583 }
584
585 id, err = r.ReadByte()
586 if err != nil {
587 return nil, fmt.Errorf("readStreamsInfo: ReadByte error: %w", err)
588 }
589 }
590
591 if id == idUnpackInfo {
592 if s.unpackInfo, err = readUnpackInfo(r); err != nil {
593 return nil, err
594 }
595
596 id, err = r.ReadByte()
597 if err != nil {
598 return nil, fmt.Errorf("readStreamsInfo: ReadByte error: %w", err)
599 }
600 }
601
602 if id == idSubStreamsInfo {
603 if s.unpackInfo == nil {
604 return nil, errMissingUnpackInfo
605 }
606
607 if s.subStreamsInfo, err = readSubStreamsInfo(r, s.unpackInfo.folder); err != nil {
608 return nil, err
609 }
610
611 id, err = r.ReadByte()
612 if err != nil {
613 return nil, fmt.Errorf("readStreamsInfo: ReadByte error: %w", err)
614 }
615 }
616
617 if id != idEnd {
618 return nil, errUnexpectedID
619 }
620
621 return s, nil
622}
623
624func readTimes(r util.Reader, count uint64) ([]time.Time, error) {
625 if err := checkUint64(count, true); err != nil {

Callers 2

readHeaderFunction · 0.85
initMethod · 0.85

Calls 4

readPackInfoFunction · 0.85
readUnpackInfoFunction · 0.85
readSubStreamsInfoFunction · 0.85
ReadByteMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…