Lines Matching refs:f
32 f *os.File member
44 func (f *File) hasDataDescriptor() bool {
45 return f.Flags&0x8 != 0
50 f, err := os.Open(name)
54 fi, err := f.Stat()
56 f.Close()
60 if err := r.init(f, fi.Size()); err != nil {
61 f.Close()
64 r.f = f
100 f := &File{zip: z, zipr: r, zipsize: size}
101 err = readDirectoryHeader(f, buf)
108 z.File = append(z.File, f)
138 return rc.f.Close()
146 func (f *File) DataOffset() (offset int64, err error) {
147 bodyOffset, err := f.findBodyOffset()
151 return f.headerOffset + bodyOffset, nil
156 func (f *File) Open() (io.ReadCloser, error) {
157 bodyOffset, err := f.findBodyOffset()
161 size := int64(f.CompressedSize64)
162 r := io.NewSectionReader(f.zipr, f.headerOffset+bodyOffset, size)
163 dcomp := f.zip.decompressor(f.Method)
169 if f.hasDataDescriptor() {
170 desr = io.NewSectionReader(f.zipr, f.headerOffset+bodyOffset+size, dataDescriptorLen)
175 f: f,
185 f *File member
201 if r.nread != r.f.UncompressedSize64 {
205 if err1 := readDataDescriptor(r.desr, r.f); err1 != nil {
211 } else if r.hash.Sum32() != r.f.CRC32 {
218 if r.f.CRC32 != 0 && r.hash.Sum32() != r.f.CRC32 {
231 func (f *File) findBodyOffset() (int64, error) {
233 if _, err := f.zipr.ReadAt(buf[:], f.headerOffset); err != nil {
249 func readDirectoryHeader(f *File, r io.Reader) error {
258 f.CreatorVersion = b.uint16()
259 f.ReaderVersion = b.uint16()
260 f.Flags = b.uint16()
261 f.Method = b.uint16()
262 f.ModifiedTime = b.uint16()
263 f.ModifiedDate = b.uint16()
264 f.CRC32 = b.uint32()
265 f.CompressedSize = b.uint32()
266 f.UncompressedSize = b.uint32()
267 f.CompressedSize64 = uint64(f.CompressedSize)
268 f.UncompressedSize64 = uint64(f.UncompressedSize)
273 f.ExternalAttrs = b.uint32()
274 f.headerOffset = int64(b.uint32())
279 f.Name = string(d[:filenameLen])
280 f.Extra = d[filenameLen : filenameLen+extraLen]
281 f.Comment = string(d[filenameLen+extraLen:])
283 needUSize := f.UncompressedSize == ^uint32(0)
284 needCSize := f.CompressedSize == ^uint32(0)
285 needHeaderOffset := f.headerOffset == int64(^uint32(0))
287 if len(f.Extra) > 0 {
291 b := readBuf(f.Extra)
310 f.UncompressedSize64 = eb.uint64()
317 f.CompressedSize64 = eb.uint64()
324 f.headerOffset = int64(eb.uint64())
349 func readDataDescriptor(r io.Reader, f *File) error {
376 if b.uint32() != f.CRC32 {