nolint:cyclop,funlen,gocognit,gocyclo
(r util.Reader)
| 771 | |
| 772 | //nolint:cyclop,funlen,gocognit,gocyclo |
| 773 | func readFilesInfo(r util.Reader) (*filesInfo, error) { |
| 774 | f := new(filesInfo) |
| 775 | |
| 776 | files, err := readUint64Bounded(r, true) |
| 777 | if err != nil { |
| 778 | return nil, err |
| 779 | } |
| 780 | |
| 781 | f.file = make([]FileHeader, files) |
| 782 | |
| 783 | var emptyStreams uint64 |
| 784 | |
| 785 | for { |
| 786 | property, err := r.ReadByte() |
| 787 | if err != nil { |
| 788 | return nil, fmt.Errorf("readFilesInfo: ReadByte error: %w", err) |
| 789 | } |
| 790 | |
| 791 | if property == idEnd { |
| 792 | break |
| 793 | } |
| 794 | |
| 795 | length, err := readUint64(r) |
| 796 | if err != nil { |
| 797 | return nil, err |
| 798 | } |
| 799 | |
| 800 | switch property { |
| 801 | case idEmptyStream: |
| 802 | empty, err := readBool(r, files) |
| 803 | if err != nil { |
| 804 | return nil, err |
| 805 | } |
| 806 | |
| 807 | for i := range f.file { |
| 808 | f.file[i].isEmptyStream = empty[i] |
| 809 | |
| 810 | if empty[i] { |
| 811 | emptyStreams++ |
| 812 | } |
| 813 | } |
| 814 | case idEmptyFile: |
| 815 | empty, err := readBool(r, emptyStreams) |
| 816 | if err != nil { |
| 817 | return nil, err |
| 818 | } |
| 819 | |
| 820 | j := 0 |
| 821 | |
| 822 | for i := range f.file { |
| 823 | if f.file[i].isEmptyStream { |
| 824 | f.file[i].isEmptyFile = empty[j] |
| 825 | j++ |
| 826 | } |
| 827 | } |
| 828 | case idCTime: |
| 829 | times, err := readTimes(r, files) |
| 830 | if err != nil { |
no test coverage detected
searching dependent graphs…