aboutsummaryrefslogtreecommitdiff
path: root/libgo/go/encoding/ascii85
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@gcc.gnu.org>2011-12-03 02:17:34 +0000
committerIan Lance Taylor <ian@gcc.gnu.org>2011-12-03 02:17:34 +0000
commit2fd401c8f190f1fe43e51a7f726f6ed6119a1f96 (patch)
tree7f76eff391f37fe6467ff4ffbc0c582c9959ea30 /libgo/go/encoding/ascii85
parent02e9018f1616b23f1276151797216717b3564202 (diff)
downloadgcc-2fd401c8f190f1fe43e51a7f726f6ed6119a1f96.zip
gcc-2fd401c8f190f1fe43e51a7f726f6ed6119a1f96.tar.gz
gcc-2fd401c8f190f1fe43e51a7f726f6ed6119a1f96.tar.bz2
libgo: Update to weekly.2011-11-02.
From-SVN: r181964
Diffstat (limited to 'libgo/go/encoding/ascii85')
-rw-r--r--libgo/go/encoding/ascii85/ascii85.go17
-rw-r--r--libgo/go/encoding/ascii85/ascii85_test.go12
2 files changed, 14 insertions, 15 deletions
diff --git a/libgo/go/encoding/ascii85/ascii85.go b/libgo/go/encoding/ascii85/ascii85.go
index ead0c24..6f592f3 100644
--- a/libgo/go/encoding/ascii85/ascii85.go
+++ b/libgo/go/encoding/ascii85/ascii85.go
@@ -8,7 +8,6 @@ package ascii85
import (
"io"
- "os"
"strconv"
)
@@ -93,14 +92,14 @@ func MaxEncodedLen(n int) int { return (n + 3) / 4 * 5 }
func NewEncoder(w io.Writer) io.WriteCloser { return &encoder{w: w} }
type encoder struct {
- err os.Error
+ err error
w io.Writer
buf [4]byte // buffered data waiting to be encoded
nbuf int // number of bytes in buf
out [1024]byte // output buffer
}
-func (e *encoder) Write(p []byte) (n int, err os.Error) {
+func (e *encoder) Write(p []byte) (n int, err error) {
if e.err != nil {
return 0, e.err
}
@@ -152,7 +151,7 @@ func (e *encoder) Write(p []byte) (n int, err os.Error) {
// Close flushes any pending output from the encoder.
// It is an error to call Write after calling Close.
-func (e *encoder) Close() os.Error {
+func (e *encoder) Close() error {
// If there's anything left in the buffer, flush it out
if e.err == nil && e.nbuf > 0 {
nout := Encode(e.out[0:], e.buf[0:e.nbuf])
@@ -168,7 +167,7 @@ func (e *encoder) Close() os.Error {
type CorruptInputError int64
-func (e CorruptInputError) String() string {
+func (e CorruptInputError) Error() string {
return "illegal ascii85 data at input byte " + strconv.Itoa64(int64(e))
}
@@ -186,7 +185,7 @@ func (e CorruptInputError) String() string {
//
// NewDecoder wraps an io.Reader interface around Decode.
//
-func Decode(dst, src []byte, flush bool) (ndst, nsrc int, err os.Error) {
+func Decode(dst, src []byte, flush bool) (ndst, nsrc int, err error) {
var v uint32
var nb int
for i, b := range src {
@@ -246,8 +245,8 @@ func Decode(dst, src []byte, flush bool) (ndst, nsrc int, err os.Error) {
func NewDecoder(r io.Reader) io.Reader { return &decoder{r: r} }
type decoder struct {
- err os.Error
- readErr os.Error
+ err error
+ readErr error
r io.Reader
end bool // saw end of message
buf [1024]byte // leftover input
@@ -256,7 +255,7 @@ type decoder struct {
outbuf [1024]byte
}
-func (d *decoder) Read(p []byte) (n int, err os.Error) {
+func (d *decoder) Read(p []byte) (n int, err error) {
if len(p) == 0 {
return 0, nil
}
diff --git a/libgo/go/encoding/ascii85/ascii85_test.go b/libgo/go/encoding/ascii85/ascii85_test.go
index fdfeb88..70e67d8 100644
--- a/libgo/go/encoding/ascii85/ascii85_test.go
+++ b/libgo/go/encoding/ascii85/ascii85_test.go
@@ -6,8 +6,8 @@ package ascii85
import (
"bytes"
+ "io"
"io/ioutil"
- "os"
"testing"
)
@@ -83,11 +83,11 @@ func TestEncoderBuffering(t *testing.T) {
end = len(input)
}
n, err := encoder.Write(input[pos:end])
- testEqual(t, "Write(%q) gave error %v, want %v", input[pos:end], err, os.Error(nil))
+ testEqual(t, "Write(%q) gave error %v, want %v", input[pos:end], err, error(nil))
testEqual(t, "Write(%q) gave length %v, want %v", input[pos:end], n, end-pos)
}
err := encoder.Close()
- testEqual(t, "Close gave error %v, want %v", err, os.Error(nil))
+ testEqual(t, "Close gave error %v, want %v", err, error(nil))
testEqual(t, "Encoding/%d of %q = %q, want %q", bs, bigtest.decoded, strip85(bb.String()), strip85(bigtest.encoded))
}
}
@@ -96,7 +96,7 @@ func TestDecode(t *testing.T) {
for _, p := range pairs {
dbuf := make([]byte, 4*len(p.encoded))
ndst, nsrc, err := Decode(dbuf, []byte(p.encoded), true)
- testEqual(t, "Decode(%q) = error %v, want %v", p.encoded, err, os.Error(nil))
+ testEqual(t, "Decode(%q) = error %v, want %v", p.encoded, err, error(nil))
testEqual(t, "Decode(%q) = nsrc %v, want %v", p.encoded, nsrc, len(p.encoded))
testEqual(t, "Decode(%q) = ndst %v, want %v", p.encoded, ndst, len(p.decoded))
testEqual(t, "Decode(%q) = %q, want %q", p.encoded, string(dbuf[0:ndst]), p.decoded)
@@ -113,7 +113,7 @@ func TestDecoder(t *testing.T) {
testEqual(t, "Read from %q = length %v, want %v", p.encoded, len(dbuf), len(p.decoded))
testEqual(t, "Decoding of %q = %q, want %q", p.encoded, string(dbuf), p.decoded)
if err != nil {
- testEqual(t, "Read from %q = %v, want %v", p.encoded, err, os.EOF)
+ testEqual(t, "Read from %q = %v, want %v", p.encoded, err, io.EOF)
}
}
}
@@ -125,7 +125,7 @@ func TestDecoderBuffering(t *testing.T) {
var total int
for total = 0; total < len(bigtest.decoded); {
n, err := decoder.Read(buf[total : total+bs])
- testEqual(t, "Read from %q at pos %d = %d, %v, want _, %v", bigtest.encoded, total, n, err, os.Error(nil))
+ testEqual(t, "Read from %q at pos %d = %d, %v, want _, %v", bigtest.encoded, total, n, err, error(nil))
total += n
}
testEqual(t, "Decoding/%d of %q = %q, want %q", bs, bigtest.encoded, string(buf[0:total]), bigtest.decoded)