diff options
author | ian <ian@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-11-21 07:03:38 +0000 |
---|---|---|
committer | ian <ian@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-11-21 07:03:38 +0000 |
commit | 79a796b7d3db5d100eedfc774954a6b44944363a (patch) | |
tree | 72455aea0286937aa08cc141e5efc800e4626577 /libgo/go/compress | |
parent | 7224cf54b3af2b931fb83af65f9cfab5c1df814a (diff) | |
download | gcc-79a796b7d3db5d100eedfc774954a6b44944363a.tar.gz |
libgo: Update to current version of master library.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@193688 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgo/go/compress')
-rw-r--r-- | libgo/go/compress/bzip2/bit_reader.go | 13 | ||||
-rw-r--r-- | libgo/go/compress/flate/inflate.go | 8 |
2 files changed, 10 insertions, 11 deletions
diff --git a/libgo/go/compress/bzip2/bit_reader.go b/libgo/go/compress/bzip2/bit_reader.go index b35c69a1cca..ab1d6065143 100644 --- a/libgo/go/compress/bzip2/bit_reader.go +++ b/libgo/go/compress/bzip2/bit_reader.go @@ -14,21 +14,16 @@ import ( // because the error handling was verbose. Instead, any error is kept and can // be checked afterwards. type bitReader struct { - r byteReader + r io.ByteReader n uint64 bits uint err error } -// bitReader needs to read bytes from an io.Reader. We attempt to convert the -// given io.Reader to this interface and, if it doesn't already fit, we wrap in -// a bufio.Reader. -type byteReader interface { - ReadByte() (byte, error) -} - +// newBitReader returns a new bitReader reading from r. If r is not +// already an io.ByteReader, it will be converted via a bufio.Reader. func newBitReader(r io.Reader) bitReader { - byter, ok := r.(byteReader) + byter, ok := r.(io.ByteReader) if !ok { byter = bufio.NewReader(r) } diff --git a/libgo/go/compress/flate/inflate.go b/libgo/go/compress/flate/inflate.go index c7ef5ff7e60..c5a54b998fa 100644 --- a/libgo/go/compress/flate/inflate.go +++ b/libgo/go/compress/flate/inflate.go @@ -208,8 +208,8 @@ type decompressor struct { h1, h2 huffmanDecoder // Length arrays used to define Huffman codes. - bits [maxLit + maxDist]int - codebits [numCodes]int + bits *[maxLit + maxDist]int + codebits *[numCodes]int // Output history, buffer. hist *[maxHist]byte @@ -692,6 +692,8 @@ func makeReader(r io.Reader) Reader { // finished reading. func NewReader(r io.Reader) io.ReadCloser { var f decompressor + f.bits = new([maxLit + maxDist]int) + f.codebits = new([numCodes]int) f.r = makeReader(r) f.hist = new([maxHist]byte) f.step = (*decompressor).nextBlock @@ -707,6 +709,8 @@ func NewReaderDict(r io.Reader, dict []byte) io.ReadCloser { var f decompressor f.r = makeReader(r) f.hist = new([maxHist]byte) + f.bits = new([maxLit + maxDist]int) + f.codebits = new([numCodes]int) f.step = (*decompressor).nextBlock f.setDict(dict) return &f |