| // Copyright 2009 The Go Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style |
| // license that can be found in the LICENSE file. |
| // The tar package implements access to tar archives. |
| // It aims to cover most of the variations, including those produced |
| // http://www.freebsd.org/cgi/man.cgi?query=tar&sektion=5 |
| // http://www.gnu.org/software/tar/manual/html_node/Standard.html |
| // A Header represents a single header in a tar archive. |
| // Some fields may not be populated. |
| var zeroBlock = make([]byte, blockSize) |
| // POSIX specifies a sum of the unsigned byte values, but the Sun tar uses signed byte values. |
| // We compute and return both. |
| func checksum(header []byte) (unsigned int64, signed int64) { |
| for i := 0; i < len(header); i++ { |
| // The chksum field (header[148:156]) is special: it should be treated as space bytes. |
| unsigned += int64(header[i]) |
| signed += int64(int8(header[i])) |
| func (sp *slicer) next(n int) (b []byte) { |