summaryrefslogtreecommitdiff
path: root/libgo/go/compress
diff options
context:
space:
mode:
Diffstat (limited to 'libgo/go/compress')
-rw-r--r--libgo/go/compress/bzip2/bit_reader.go2
-rw-r--r--libgo/go/compress/flate/deflate_test.go60
-rw-r--r--libgo/go/compress/flate/flate_test.go12
-rw-r--r--libgo/go/compress/flate/huffman_bit_writer.go4
-rw-r--r--libgo/go/compress/flate/inflate.go6
5 files changed, 42 insertions, 42 deletions
diff --git a/libgo/go/compress/bzip2/bit_reader.go b/libgo/go/compress/bzip2/bit_reader.go
index b2c13e50ca4..b35c69a1cca 100644
--- a/libgo/go/compress/bzip2/bit_reader.go
+++ b/libgo/go/compress/bzip2/bit_reader.go
@@ -20,7 +20,7 @@ type bitReader struct {
err error
}
-// bitReader needs to read bytes from an io.Reader. We attempt to cast the
+// 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 {
diff --git a/libgo/go/compress/flate/deflate_test.go b/libgo/go/compress/flate/deflate_test.go
index db2d71d7350..b4876b0f8b3 100644
--- a/libgo/go/compress/flate/deflate_test.go
+++ b/libgo/go/compress/flate/deflate_test.go
@@ -30,44 +30,44 @@ type reverseBitsTest struct {
}
var deflateTests = []*deflateTest{
- &deflateTest{[]byte{}, 0, []byte{1, 0, 0, 255, 255}},
- &deflateTest{[]byte{0x11}, -1, []byte{18, 4, 4, 0, 0, 255, 255}},
- &deflateTest{[]byte{0x11}, DefaultCompression, []byte{18, 4, 4, 0, 0, 255, 255}},
- &deflateTest{[]byte{0x11}, 4, []byte{18, 4, 4, 0, 0, 255, 255}},
-
- &deflateTest{[]byte{0x11}, 0, []byte{0, 1, 0, 254, 255, 17, 1, 0, 0, 255, 255}},
- &deflateTest{[]byte{0x11, 0x12}, 0, []byte{0, 2, 0, 253, 255, 17, 18, 1, 0, 0, 255, 255}},
- &deflateTest{[]byte{0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11}, 0,
+ {[]byte{}, 0, []byte{1, 0, 0, 255, 255}},
+ {[]byte{0x11}, -1, []byte{18, 4, 4, 0, 0, 255, 255}},
+ {[]byte{0x11}, DefaultCompression, []byte{18, 4, 4, 0, 0, 255, 255}},
+ {[]byte{0x11}, 4, []byte{18, 4, 4, 0, 0, 255, 255}},
+
+ {[]byte{0x11}, 0, []byte{0, 1, 0, 254, 255, 17, 1, 0, 0, 255, 255}},
+ {[]byte{0x11, 0x12}, 0, []byte{0, 2, 0, 253, 255, 17, 18, 1, 0, 0, 255, 255}},
+ {[]byte{0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11}, 0,
[]byte{0, 8, 0, 247, 255, 17, 17, 17, 17, 17, 17, 17, 17, 1, 0, 0, 255, 255},
},
- &deflateTest{[]byte{}, 1, []byte{1, 0, 0, 255, 255}},
- &deflateTest{[]byte{0x11}, 1, []byte{18, 4, 4, 0, 0, 255, 255}},
- &deflateTest{[]byte{0x11, 0x12}, 1, []byte{18, 20, 2, 4, 0, 0, 255, 255}},
- &deflateTest{[]byte{0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11}, 1, []byte{18, 132, 2, 64, 0, 0, 0, 255, 255}},
- &deflateTest{[]byte{}, 9, []byte{1, 0, 0, 255, 255}},
- &deflateTest{[]byte{0x11}, 9, []byte{18, 4, 4, 0, 0, 255, 255}},
- &deflateTest{[]byte{0x11, 0x12}, 9, []byte{18, 20, 2, 4, 0, 0, 255, 255}},
- &deflateTest{[]byte{0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11}, 9, []byte{18, 132, 2, 64, 0, 0, 0, 255, 255}},
+ {[]byte{}, 1, []byte{1, 0, 0, 255, 255}},
+ {[]byte{0x11}, 1, []byte{18, 4, 4, 0, 0, 255, 255}},
+ {[]byte{0x11, 0x12}, 1, []byte{18, 20, 2, 4, 0, 0, 255, 255}},
+ {[]byte{0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11}, 1, []byte{18, 132, 2, 64, 0, 0, 0, 255, 255}},
+ {[]byte{}, 9, []byte{1, 0, 0, 255, 255}},
+ {[]byte{0x11}, 9, []byte{18, 4, 4, 0, 0, 255, 255}},
+ {[]byte{0x11, 0x12}, 9, []byte{18, 20, 2, 4, 0, 0, 255, 255}},
+ {[]byte{0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11}, 9, []byte{18, 132, 2, 64, 0, 0, 0, 255, 255}},
}
var deflateInflateTests = []*deflateInflateTest{
- &deflateInflateTest{[]byte{}},
- &deflateInflateTest{[]byte{0x11}},
- &deflateInflateTest{[]byte{0x11, 0x12}},
- &deflateInflateTest{[]byte{0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11}},
- &deflateInflateTest{[]byte{0x11, 0x10, 0x13, 0x41, 0x21, 0x21, 0x41, 0x13, 0x87, 0x78, 0x13}},
- &deflateInflateTest{largeDataChunk()},
+ {[]byte{}},
+ {[]byte{0x11}},
+ {[]byte{0x11, 0x12}},
+ {[]byte{0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11}},
+ {[]byte{0x11, 0x10, 0x13, 0x41, 0x21, 0x21, 0x41, 0x13, 0x87, 0x78, 0x13}},
+ {largeDataChunk()},
}
var reverseBitsTests = []*reverseBitsTest{
- &reverseBitsTest{1, 1, 1},
- &reverseBitsTest{1, 2, 2},
- &reverseBitsTest{1, 3, 4},
- &reverseBitsTest{1, 4, 8},
- &reverseBitsTest{1, 5, 16},
- &reverseBitsTest{17, 5, 17},
- &reverseBitsTest{257, 9, 257},
- &reverseBitsTest{29, 5, 23},
+ {1, 1, 1},
+ {1, 2, 2},
+ {1, 3, 4},
+ {1, 4, 8},
+ {1, 5, 16},
+ {17, 5, 17},
+ {257, 9, 257},
+ {29, 5, 23},
}
func largeDataChunk() []byte {
diff --git a/libgo/go/compress/flate/flate_test.go b/libgo/go/compress/flate/flate_test.go
index bfd3b8381d0..94efc90acfa 100644
--- a/libgo/go/compress/flate/flate_test.go
+++ b/libgo/go/compress/flate/flate_test.go
@@ -52,7 +52,7 @@ type InitDecoderTest struct {
var initDecoderTests = []*InitDecoderTest{
// Example from Connell 1973,
- &InitDecoderTest{
+ {
[]int{3, 5, 2, 4, 3, 5, 5, 4, 4, 3, 4, 5},
huffmanDecoder{
2, 5,
@@ -68,7 +68,7 @@ var initDecoderTests = []*InitDecoderTest{
},
// Example from RFC 1951 section 3.2.2
- &InitDecoderTest{
+ {
[]int{2, 1, 3, 3},
huffmanDecoder{
1, 3,
@@ -80,7 +80,7 @@ var initDecoderTests = []*InitDecoderTest{
},
// Second example from RFC 1951 section 3.2.2
- &InitDecoderTest{
+ {
[]int{3, 3, 3, 3, 3, 2, 4, 4},
huffmanDecoder{
2, 4,
@@ -92,21 +92,21 @@ var initDecoderTests = []*InitDecoderTest{
},
// Static Huffman codes (RFC 1951 section 3.2.6)
- &InitDecoderTest{
+ {
fixedHuffmanBits[0:],
fixedHuffmanDecoder,
true,
},
// Illegal input.
- &InitDecoderTest{
+ {
[]int{},
huffmanDecoder{},
false,
},
// Illegal input.
- &InitDecoderTest{
+ {
[]int{0, 0, 0, 0, 0, 0, 0},
huffmanDecoder{},
false,
diff --git a/libgo/go/compress/flate/huffman_bit_writer.go b/libgo/go/compress/flate/huffman_bit_writer.go
index efd99c6b954..8d0b4f9c1e8 100644
--- a/libgo/go/compress/flate/huffman_bit_writer.go
+++ b/libgo/go/compress/flate/huffman_bit_writer.go
@@ -106,8 +106,8 @@ func newHuffmanBitWriter(w io.Writer) *huffmanBitWriter {
}
func (err WrongValueError) Error() string {
- return "huffmanBitWriter: " + err.name + " should belong to [" + strconv.Itoa64(int64(err.from)) + ";" +
- strconv.Itoa64(int64(err.to)) + "] but actual value is " + strconv.Itoa64(int64(err.value))
+ return "huffmanBitWriter: " + err.name + " should belong to [" + strconv.FormatInt(int64(err.from), 10) + ";" +
+ strconv.FormatInt(int64(err.to), 10) + "] but actual value is " + strconv.FormatInt(int64(err.value), 10)
}
func (w *huffmanBitWriter) flushBits() {
diff --git a/libgo/go/compress/flate/inflate.go b/libgo/go/compress/flate/inflate.go
index 3f0c94864a4..3f2042bfe92 100644
--- a/libgo/go/compress/flate/inflate.go
+++ b/libgo/go/compress/flate/inflate.go
@@ -25,7 +25,7 @@ const (
type CorruptInputError int64
func (e CorruptInputError) Error() string {
- return "flate: corrupt input before offset " + strconv.Itoa64(int64(e))
+ return "flate: corrupt input before offset " + strconv.FormatInt(int64(e), 10)
}
// An InternalError reports an error in the flate code itself.
@@ -40,7 +40,7 @@ type ReadError struct {
}
func (e *ReadError) Error() string {
- return "flate: read error at offset " + strconv.Itoa64(e.Offset) + ": " + e.Err.Error()
+ return "flate: read error at offset " + strconv.FormatInt(e.Offset, 10) + ": " + e.Err.Error()
}
// A WriteError reports an error encountered while writing output.
@@ -50,7 +50,7 @@ type WriteError struct {
}
func (e *WriteError) Error() string {
- return "flate: write error at offset " + strconv.Itoa64(e.Offset) + ": " + e.Err.Error()
+ return "flate: write error at offset " + strconv.FormatInt(e.Offset, 10) + ": " + e.Err.Error()
}
// Huffman decoder is based on