summaryrefslogtreecommitdiff
path: root/src/pkg/encoding
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2009-11-20 11:45:05 -0800
committerRuss Cox <rsc@golang.org>2009-11-20 11:45:05 -0800
commitc861f30835090bbd6b9b35a80667f26952843767 (patch)
tree645bd57ef3c9326ec02e646a751b9075d12a79e7 /src/pkg/encoding
parent7089e97992d5d6be520dfea787200061992526c8 (diff)
downloadgolang-c861f30835090bbd6b9b35a80667f26952843767.tar.gz
gofmt -r 'α[β:len(α)] -> α[β:]' -w src/cmd src/pkg
R=r, gri CC=golang-dev http://codereview.appspot.com/156115
Diffstat (limited to 'src/pkg/encoding')
-rw-r--r--src/pkg/encoding/ascii85/ascii85.go14
-rw-r--r--src/pkg/encoding/base64/base64.go12
-rw-r--r--src/pkg/encoding/binary/binary.go16
-rw-r--r--src/pkg/encoding/git85/git.go10
-rw-r--r--src/pkg/encoding/pem/pem.go8
5 files changed, 30 insertions, 30 deletions
diff --git a/src/pkg/encoding/ascii85/ascii85.go b/src/pkg/encoding/ascii85/ascii85.go
index ba70f3dea..85f688b2f 100644
--- a/src/pkg/encoding/ascii85/ascii85.go
+++ b/src/pkg/encoding/ascii85/ascii85.go
@@ -57,7 +57,7 @@ func Encode(dst, src []byte) int {
// Special case: zero (!!!!!) shortens to z.
if v == 0 && len(src) >= 4 {
dst[0] = 'z';
- dst = dst[1:len(dst)];
+ dst = dst[1:];
n++;
continue;
}
@@ -74,9 +74,9 @@ func Encode(dst, src []byte) int {
m -= 4 - len(src);
src = nil;
} else {
- src = src[4:len(src)]
+ src = src[4:]
}
- dst = dst[m:len(dst)];
+ dst = dst[m:];
n += m;
}
return n;
@@ -113,7 +113,7 @@ func (e *encoder) Write(p []byte) (n int, err os.Error) {
e.nbuf++;
}
n += i;
- p = p[i:len(p)];
+ p = p[i:];
if e.nbuf < 4 {
return
}
@@ -138,7 +138,7 @@ func (e *encoder) Write(p []byte) (n int, err os.Error) {
}
}
n += nn;
- p = p[nn:len(p)];
+ p = p[nn:];
}
// Trailing fringe.
@@ -268,7 +268,7 @@ func (d *decoder) Read(p []byte) (n int, err os.Error) {
// Copy leftover output from last decode.
if len(d.out) > 0 {
n = copy(p, d.out);
- d.out = d.out[n:len(d.out)];
+ d.out = d.out[n:];
return;
}
@@ -293,7 +293,7 @@ func (d *decoder) Read(p []byte) (n int, err os.Error) {
}
// Read more data.
- nn, d.readErr = d.r.Read(d.buf[d.nbuf:len(d.buf)]);
+ nn, d.readErr = d.r.Read(d.buf[d.nbuf:]);
d.nbuf += nn;
}
panic("unreachable");
diff --git a/src/pkg/encoding/base64/base64.go b/src/pkg/encoding/base64/base64.go
index b149a6715..ddb0e7117 100644
--- a/src/pkg/encoding/base64/base64.go
+++ b/src/pkg/encoding/base64/base64.go
@@ -101,8 +101,8 @@ func (enc *Encoding) Encode(dst, src []byte) {
break;
}
- src = src[3:len(src)];
- dst = dst[4:len(dst)];
+ src = src[3:];
+ dst = dst[4:];
}
}
@@ -128,7 +128,7 @@ func (e *encoder) Write(p []byte) (n int, err os.Error) {
e.nbuf++;
}
n += i;
- p = p[i:len(p)];
+ p = p[i:];
if e.nbuf < 3 {
return
}
@@ -153,7 +153,7 @@ func (e *encoder) Write(p []byte) (n int, err os.Error) {
}
}
n += nn;
- p = p[nn:len(p)];
+ p = p[nn:];
}
// Trailing fringe.
@@ -279,7 +279,7 @@ func (d *decoder) Read(p []byte) (n int, err os.Error) {
// Use leftover decoded output from last read.
if len(d.out) > 0 {
n = copy(p, d.out);
- d.out = d.out[n:len(d.out)];
+ d.out = d.out[n:];
return n, nil;
}
@@ -304,7 +304,7 @@ func (d *decoder) Read(p []byte) (n int, err os.Error) {
nw, d.end, d.err = d.enc.decode(&d.outbuf, d.buf[0:nr]);
d.out = d.outbuf[0:nw];
n = copy(p, d.out);
- d.out = d.out[n:len(d.out)];
+ d.out = d.out[n:];
} else {
n, d.end, d.err = d.enc.decode(p, d.buf[0:nr])
}
diff --git a/src/pkg/encoding/binary/binary.go b/src/pkg/encoding/binary/binary.go
index 92c89cea9..f3cc8584a 100644
--- a/src/pkg/encoding/binary/binary.go
+++ b/src/pkg/encoding/binary/binary.go
@@ -210,46 +210,46 @@ type encoder struct {
func (d *decoder) uint8() uint8 {
x := d.buf[0];
- d.buf = d.buf[1:len(d.buf)];
+ d.buf = d.buf[1:];
return x;
}
func (e *encoder) uint8(x uint8) {
e.buf[0] = x;
- e.buf = e.buf[1:len(e.buf)];
+ e.buf = e.buf[1:];
}
func (d *decoder) uint16() uint16 {
x := d.order.Uint16(d.buf[0:2]);
- d.buf = d.buf[2:len(d.buf)];
+ d.buf = d.buf[2:];
return x;
}
func (e *encoder) uint16(x uint16) {
e.order.PutUint16(e.buf[0:2], x);
- e.buf = e.buf[2:len(e.buf)];
+ e.buf = e.buf[2:];
}
func (d *decoder) uint32() uint32 {
x := d.order.Uint32(d.buf[0:4]);
- d.buf = d.buf[4:len(d.buf)];
+ d.buf = d.buf[4:];
return x;
}
func (e *encoder) uint32(x uint32) {
e.order.PutUint32(e.buf[0:4], x);
- e.buf = e.buf[4:len(e.buf)];
+ e.buf = e.buf[4:];
}
func (d *decoder) uint64() uint64 {
x := d.order.Uint64(d.buf[0:8]);
- d.buf = d.buf[8:len(d.buf)];
+ d.buf = d.buf[8:];
return x;
}
func (e *encoder) uint64(x uint64) {
e.order.PutUint64(e.buf[0:8], x);
- e.buf = e.buf[8:len(e.buf)];
+ e.buf = e.buf[8:];
}
func (d *decoder) int8() int8 { return int8(d.uint8()) }
diff --git a/src/pkg/encoding/git85/git.go b/src/pkg/encoding/git85/git.go
index cbc78fc3c..71130a883 100644
--- a/src/pkg/encoding/git85/git.go
+++ b/src/pkg/encoding/git85/git.go
@@ -74,7 +74,7 @@ func Encode(dst, src []byte) int {
}
dst[ndst] = '\n';
ndst++;
- src = src[n:len(src)];
+ src = src[n:];
}
return ndst;
}
@@ -173,7 +173,7 @@ func (e *encoder) Write(p []byte) (n int, err os.Error) {
e.nbuf++;
}
n += i;
- p = p[i:len(p)];
+ p = p[i:];
if e.nbuf < 52 {
return
}
@@ -197,7 +197,7 @@ func (e *encoder) Write(p []byte) (n int, err os.Error) {
}
}
n += nn;
- p = p[nn:len(p)];
+ p = p[nn:];
}
// Trailing fringe.
@@ -242,7 +242,7 @@ func (d *decoder) Read(p []byte) (n int, err os.Error) {
// Copy leftover output from last decode.
if len(d.out) > 0 {
n = copy(p, d.out);
- d.out = d.out[n:len(d.out)];
+ d.out = d.out[n:];
return;
}
@@ -257,7 +257,7 @@ func (d *decoder) Read(p []byte) (n int, err os.Error) {
// Read and decode more input.
var nn int;
- nn, d.readErr = d.r.Read(d.buf[d.nbuf:len(d.buf)]);
+ nn, d.readErr = d.r.Read(d.buf[d.nbuf:]);
d.nbuf += nn;
// Send complete lines to Decode.
diff --git a/src/pkg/encoding/pem/pem.go b/src/pkg/encoding/pem/pem.go
index 409f07fb0..7828d87c1 100644
--- a/src/pkg/encoding/pem/pem.go
+++ b/src/pkg/encoding/pem/pem.go
@@ -43,7 +43,7 @@ func getLine(data []byte) (line, rest []byte) {
i--
}
}
- return data[0:i], data[j:len(data)];
+ return data[0:i], data[j:];
}
// removeWhitespace returns a copy of its input with all spaces, tab and
@@ -75,7 +75,7 @@ func Decode(data []byte) (p *Block, rest []byte) {
// pemStart begins with a newline. However, at the very beginning of
// the byte array, we'll accept the start string without it.
rest = data;
- if bytes.HasPrefix(data, pemStart[1:len(pemStart)]) {
+ if bytes.HasPrefix(data, pemStart[1:]) {
rest = rest[len(pemStart)-1 : len(data)]
} else if i := bytes.Index(data, pemStart); i >= 0 {
rest = rest[i+len(pemStart) : len(data)]
@@ -108,7 +108,7 @@ func Decode(data []byte) (p *Block, rest []byte) {
}
// TODO(agl): need to cope with values that spread across lines.
- key, val := line[0:i], line[i+1:len(line)];
+ key, val := line[0:i], line[i+1:];
key = bytes.TrimSpace(key);
val = bytes.TrimSpace(val);
p.Headers[string(key)] = string(val);
@@ -128,7 +128,7 @@ func Decode(data []byte) (p *Block, rest []byte) {
}
p.Bytes = p.Bytes[0:n];
- _, rest = getLine(rest[i+len(pemEnd) : len(rest)]);
+ _, rest = getLine(rest[i+len(pemEnd):]);
return;