summaryrefslogtreecommitdiff
path: root/src/pkg/archive
diff options
context:
space:
mode:
authorRob Pike <r@golang.org>2009-11-18 15:24:24 -0800
committerRob Pike <r@golang.org>2009-11-18 15:24:24 -0800
commit391051631f6118f60751735160d4f5a4b41ba5db (patch)
treea54bad89b8447ed713d40539471ce8d1b9f811ff /src/pkg/archive
parente97248aec165fe74b5b765813d8d8f9e44790910 (diff)
downloadgolang-391051631f6118f60751735160d4f5a4b41ba5db.tar.gz
remove bytes.Copy
replace all calls with calls to copy use copy in regexp and bytes.Buffer R=rsc CC=golang-dev http://codereview.appspot.com/157073
Diffstat (limited to 'src/pkg/archive')
-rw-r--r--src/pkg/archive/tar/writer.go33
1 files changed, 16 insertions, 17 deletions
diff --git a/src/pkg/archive/tar/writer.go b/src/pkg/archive/tar/writer.go
index 3410aa86b..2c207d618 100644
--- a/src/pkg/archive/tar/writer.go
+++ b/src/pkg/archive/tar/writer.go
@@ -8,7 +8,6 @@ package tar
// - catch more errors (no first header, write after close, etc.)
import (
- "bytes";
"io";
"os";
"strconv";
@@ -124,25 +123,25 @@ func (tw *Writer) WriteHeader(hdr *Header) os.Error {
s := slicer(header);
// TODO(dsymonds): handle names longer than 100 chars
- bytes.Copy(s.next(100), strings.Bytes(hdr.Name));
-
- tw.octal(s.next(8), hdr.Mode); // 100:108
- tw.numeric(s.next(8), hdr.Uid); // 108:116
- tw.numeric(s.next(8), hdr.Gid); // 116:124
- tw.numeric(s.next(12), hdr.Size); // 124:136
- tw.numeric(s.next(12), hdr.Mtime); // 136:148
- s.next(8); // chksum (148:156)
- s.next(1)[0] = hdr.Typeflag; // 156:157
- s.next(100); // linkname (157:257)
- bytes.Copy(s.next(8), strings.Bytes("ustar\x0000")); // 257:265
- tw.cString(s.next(32), hdr.Uname); // 265:297
- tw.cString(s.next(32), hdr.Gname); // 297:329
- tw.numeric(s.next(8), hdr.Devmajor); // 329:337
- tw.numeric(s.next(8), hdr.Devminor); // 337:345
+ copy(s.next(100), strings.Bytes(hdr.Name));
+
+ tw.octal(s.next(8), hdr.Mode); // 100:108
+ tw.numeric(s.next(8), hdr.Uid); // 108:116
+ tw.numeric(s.next(8), hdr.Gid); // 116:124
+ tw.numeric(s.next(12), hdr.Size); // 124:136
+ tw.numeric(s.next(12), hdr.Mtime); // 136:148
+ s.next(8); // chksum (148:156)
+ s.next(1)[0] = hdr.Typeflag; // 156:157
+ s.next(100); // linkname (157:257)
+ copy(s.next(8), strings.Bytes("ustar\x0000")); // 257:265
+ tw.cString(s.next(32), hdr.Uname); // 265:297
+ tw.cString(s.next(32), hdr.Gname); // 297:329
+ tw.numeric(s.next(8), hdr.Devmajor); // 329:337
+ tw.numeric(s.next(8), hdr.Devminor); // 337:345
// Use the GNU magic instead of POSIX magic if we used any GNU extensions.
if tw.usedBinary {
- bytes.Copy(header[257:265], strings.Bytes("ustar \x00"))
+ copy(header[257:265], strings.Bytes("ustar \x00"))
}
// The chksum field is terminated by a NUL and a space.