summaryrefslogtreecommitdiff
path: root/libgo/go/compress/zlib
diff options
context:
space:
mode:
authorian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>2011-12-03 02:17:34 +0000
committerian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>2011-12-03 02:17:34 +0000
commit6692ad1d1b2710fc619d04aad2ae0668cc59f4db (patch)
tree7f76eff391f37fe6467ff4ffbc0c582c9959ea30 /libgo/go/compress/zlib
parent96265ae6967d08ca35d36e87b7588c0c9e6e5cca (diff)
downloadgcc-6692ad1d1b2710fc619d04aad2ae0668cc59f4db.tar.gz
libgo: Update to weekly.2011-11-02.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@181964 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgo/go/compress/zlib')
-rw-r--r--libgo/go/compress/zlib/reader.go20
-rw-r--r--libgo/go/compress/zlib/reader_test.go3
-rw-r--r--libgo/go/compress/zlib/writer.go18
3 files changed, 20 insertions, 21 deletions
diff --git a/libgo/go/compress/zlib/reader.go b/libgo/go/compress/zlib/reader.go
index 78dabdf4d8c..50a1e6c357f 100644
--- a/libgo/go/compress/zlib/reader.go
+++ b/libgo/go/compress/zlib/reader.go
@@ -26,36 +26,36 @@ package zlib
import (
"bufio"
"compress/flate"
+ "errors"
"hash"
"hash/adler32"
"io"
- "os"
)
const zlibDeflate = 8
-var ChecksumError = os.NewError("zlib checksum error")
-var HeaderError = os.NewError("invalid zlib header")
-var DictionaryError = os.NewError("invalid zlib dictionary")
+var ChecksumError = errors.New("zlib checksum error")
+var HeaderError = errors.New("invalid zlib header")
+var DictionaryError = errors.New("invalid zlib dictionary")
type reader struct {
r flate.Reader
decompressor io.ReadCloser
digest hash.Hash32
- err os.Error
+ err error
scratch [4]byte
}
// NewReader creates a new io.ReadCloser that satisfies reads by decompressing data read from r.
// The implementation buffers input and may read more data than necessary from r.
// It is the caller's responsibility to call Close on the ReadCloser when done.
-func NewReader(r io.Reader) (io.ReadCloser, os.Error) {
+func NewReader(r io.Reader) (io.ReadCloser, error) {
return NewReaderDict(r, nil)
}
// NewReaderDict is like NewReader but uses a preset dictionary.
// NewReaderDict ignores the dictionary if the compressed data does not refer to it.
-func NewReaderDict(r io.Reader, dict []byte) (io.ReadCloser, os.Error) {
+func NewReaderDict(r io.Reader, dict []byte) (io.ReadCloser, error) {
z := new(reader)
if fr, ok := r.(flate.Reader); ok {
z.r = fr
@@ -87,7 +87,7 @@ func NewReaderDict(r io.Reader, dict []byte) (io.ReadCloser, os.Error) {
return z, nil
}
-func (z *reader) Read(p []byte) (n int, err os.Error) {
+func (z *reader) Read(p []byte) (n int, err error) {
if z.err != nil {
return 0, z.err
}
@@ -97,7 +97,7 @@ func (z *reader) Read(p []byte) (n int, err os.Error) {
n, err = z.decompressor.Read(p)
z.digest.Write(p[0:n])
- if n != 0 || err != os.EOF {
+ if n != 0 || err != io.EOF {
z.err = err
return
}
@@ -117,7 +117,7 @@ func (z *reader) Read(p []byte) (n int, err os.Error) {
}
// Calling Close does not close the wrapped io.Reader originally passed to NewReader.
-func (z *reader) Close() os.Error {
+func (z *reader) Close() error {
if z.err != nil {
return z.err
}
diff --git a/libgo/go/compress/zlib/reader_test.go b/libgo/go/compress/zlib/reader_test.go
index 195db446c9f..d8f9f21478c 100644
--- a/libgo/go/compress/zlib/reader_test.go
+++ b/libgo/go/compress/zlib/reader_test.go
@@ -7,7 +7,6 @@ package zlib
import (
"bytes"
"io"
- "os"
"testing"
)
@@ -16,7 +15,7 @@ type zlibTest struct {
raw string
compressed []byte
dict []byte
- err os.Error
+ err error
}
// Compare-to-golden test data was generated by the ZLIB example program at
diff --git a/libgo/go/compress/zlib/writer.go b/libgo/go/compress/zlib/writer.go
index 8f86e9c4ce3..bbff6375ea1 100644
--- a/libgo/go/compress/zlib/writer.go
+++ b/libgo/go/compress/zlib/writer.go
@@ -6,10 +6,10 @@ package zlib
import (
"compress/flate"
+ "errors"
"hash"
"hash/adler32"
"io"
- "os"
)
// These constants are copied from the flate package, so that code that imports
@@ -27,17 +27,17 @@ type Writer struct {
w io.Writer
compressor *flate.Writer
digest hash.Hash32
- err os.Error
+ err error
scratch [4]byte
}
// NewWriter calls NewWriterLevel with the default compression level.
-func NewWriter(w io.Writer) (*Writer, os.Error) {
+func NewWriter(w io.Writer) (*Writer, error) {
return NewWriterLevel(w, DefaultCompression)
}
// NewWriterLevel calls NewWriterDict with no dictionary.
-func NewWriterLevel(w io.Writer, level int) (*Writer, os.Error) {
+func NewWriterLevel(w io.Writer, level int) (*Writer, error) {
return NewWriterDict(w, level, nil)
}
@@ -46,7 +46,7 @@ func NewWriterLevel(w io.Writer, level int) (*Writer, os.Error) {
// level is the compression level, which can be DefaultCompression, NoCompression,
// or any integer value between BestSpeed and BestCompression (inclusive).
// dict is the preset dictionary to compress with, or nil to use no dictionary.
-func NewWriterDict(w io.Writer, level int, dict []byte) (*Writer, os.Error) {
+func NewWriterDict(w io.Writer, level int, dict []byte) (*Writer, error) {
z := new(Writer)
// ZLIB has a two-byte header (as documented in RFC 1950).
// The first four bits is the CINFO (compression info), which is 7 for the default deflate window size.
@@ -66,7 +66,7 @@ func NewWriterDict(w io.Writer, level int, dict []byte) (*Writer, os.Error) {
case 7, 8, 9:
z.scratch[1] = 3 << 6
default:
- return nil, os.NewError("level out of range")
+ return nil, errors.New("level out of range")
}
if dict != nil {
z.scratch[1] |= 1 << 5
@@ -94,7 +94,7 @@ func NewWriterDict(w io.Writer, level int, dict []byte) (*Writer, os.Error) {
return z, nil
}
-func (z *Writer) Write(p []byte) (n int, err os.Error) {
+func (z *Writer) Write(p []byte) (n int, err error) {
if z.err != nil {
return 0, z.err
}
@@ -111,7 +111,7 @@ func (z *Writer) Write(p []byte) (n int, err os.Error) {
}
// Flush flushes the underlying compressor.
-func (z *Writer) Flush() os.Error {
+func (z *Writer) Flush() error {
if z.err != nil {
return z.err
}
@@ -120,7 +120,7 @@ func (z *Writer) Flush() os.Error {
}
// Calling Close does not close the wrapped io.Writer originally passed to NewWriter.
-func (z *Writer) Close() os.Error {
+func (z *Writer) Close() error {
if z.err != nil {
return z.err
}