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

Function readTimes

types.go:624–667  ·  view source on GitHub ↗
(r util.Reader, count uint64)

Source from the content-addressed store, hash-verified

622}
623
624func readTimes(r util.Reader, count uint64) ([]time.Time, error) {
625 if err := checkUint64(count, true); err != nil {
626 return nil, err
627 }
628
629 defined, err := readOptionalBool(r, count)
630 if err != nil {
631 return nil, err
632 }
633
634 external, err := r.ReadByte()
635 if err != nil {
636 return nil, fmt.Errorf("readTimes: ReadByte error: %w", err)
637 }
638
639 if external > 0 {
640 /*
641 _, err := readUint64(r)
642 if err != nil {
643 return nil, err
644 }
645 */
646 // TODO Apparently we seek to this read offset and read the
647 // folder information from there. Not clear if the offset is
648 // absolute for the whole file, or relative to some known
649 // position in the file. Cowardly waiting for an example
650 return nil, errors.New("sevenzip: TODO readTimes external") //nolint:err113
651 }
652
653 times := make([]time.Time, count)
654
655 for i := range defined {
656 if defined[i] {
657 var ft windows.Filetime
658 if err := binary.Read(r, binary.LittleEndian, &ft); err != nil {
659 return nil, fmt.Errorf("readTimes: Read error: %w", err)
660 }
661
662 times[i] = time.Unix(0, ft.Nanoseconds()).UTC()
663 }
664 }
665
666 return times, nil
667}
668
669func splitNull(data []byte, atEOF bool) (advance int, token []byte, err error) {
670 if atEOF && len(data) == 0 {

Callers 1

readFilesInfoFunction · 0.85

Calls 4

checkUint64Function · 0.85
readOptionalBoolFunction · 0.85
ReadByteMethod · 0.45
ReadMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…