Lines Matching refs:b
190 func (r *checksumReader) Read(b []byte) (n int, err error) {
194 n, err = r.rc.Read(b)
195 r.hash.Write(b[:n])
236 b := readBuf(buf[:])
237 if sig := b.uint32(); sig != fileHeaderSignature {
240 b = b[22:] // skip over most of the header
241 filenameLen := int(b.uint16())
242 extraLen := int(b.uint16())
254 b := readBuf(buf[:])
255 if sig := b.uint32(); sig != directoryHeaderSignature {
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()
269 filenameLen := int(b.uint16())
270 extraLen := int(b.uint16())
271 commentLen := int(b.uint16())
272 b = b[4:] // skipped start disk number and internal attributes (2x uint16)
273 f.ExternalAttrs = b.uint32()
274 f.headerOffset = int64(b.uint32())
291 b := readBuf(f.Extra)
292 for len(b) >= 4 { // need at least tag and size
293 tag := b.uint16()
294 size := b.uint16()
295 if int(size) > len(b) {
303 eb := readBuf(b[:size])
328 b = b[size:]
375 b := readBuf(buf[:12])
376 if b.uint32() != f.CRC32 {
412 b := readBuf(buf[4:]) // skip signature
414 diskNbr: uint32(b.uint16()),
415 dirDiskNbr: uint32(b.uint16()),
416 dirRecordsThisDisk: uint64(b.uint16()),
417 directoryRecords: uint64(b.uint16()),
418 directorySize: uint64(b.uint32()),
419 directoryOffset: uint64(b.uint32()),
420 commentLen: b.uint16(),
423 if l > len(b) {
426 d.comment = string(b[:l])
457 b := readBuf(buf)
458 if sig := b.uint32(); sig != directory64LocSignature {
461 if b.uint32() != 0 { // number of the disk with the start of the zip64 end of central directory
464 p := b.uint64() // relative offset of the zip64 end of central directory record
465 if b.uint32() != 1 { // total number of disks
479 b := readBuf(buf)
480 if sig := b.uint32(); sig != directory64EndSignature {
484 b = b[12:] // skip dir size, version and version needed (uint64 + 2x uint16)
485 d.diskNbr = b.uint32() // number of this disk
486 d.dirDiskNbr = b.uint32() // number of the disk with the start of the central directory
487 d.dirRecordsThisDisk = b.uint64() // total number of entries in the central directory on this disk
488 d.directoryRecords = b.uint64() // total number of entries in the central directory
489 d.directorySize = b.uint64() // size of the central directory
490 …d.directoryOffset = b.uint64() // offset of start of central directory with respect to the star…
495 func findSignatureInBlock(b []byte) int {
496 for i := len(b) - directoryEndLen; i >= 0; i-- {
498 if b[i] == 'P' && b[i+1] == 'K' && b[i+2] == 0x05 && b[i+3] == 0x06 {
500 n := int(b[i+directoryEndLen-2]) | int(b[i+directoryEndLen-1])<<8
501 if n+directoryEndLen+i <= len(b) {
511 func (b *readBuf) uint16() uint16 {
512 v := binary.LittleEndian.Uint16(*b)
513 *b = (*b)[2:]
517 func (b *readBuf) uint32() uint32 {
518 v := binary.LittleEndian.Uint32(*b)
519 *b = (*b)[4:]
523 func (b *readBuf) uint64() uint64 {
524 v := binary.LittleEndian.Uint64(*b)
525 *b = (*b)[8:]