Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
go
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
go
Commits
22636be8
Commit
22636be8
authored
Feb 11, 2012
by
Nigel Tao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
flate: delete WrongValueError type.
Fixes #2838. R=rsc, r CC=golang-dev
https://golang.org/cl/5651060
parent
0846e275
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
20 additions
and
22 deletions
+20
-22
doc/go1.html
doc/go1.html
+9
-4
doc/go1.tmpl
doc/go1.tmpl
+9
-4
src/pkg/compress/flate/deflate.go
src/pkg/compress/flate/deflate.go
+2
-1
src/pkg/compress/flate/huffman_bit_writer.go
src/pkg/compress/flate/huffman_bit_writer.go
+0
-13
No files found.
doc/go1.html
View file @
22636be8
...
...
@@ -881,10 +881,15 @@ What little code is affected will be caught by the compiler and must be updated
<h3
id=
"bufio"
>
The compress/flate, compress/gzip and compress/zlib packages
</h3>
<p>
In Go 1, the NewWriterXxx functions in compress/flate, compress/gzip and
compress/zlib all return (*Writer, error) if they take a compression level,
and *Writer otherwise. Package gzip's Compressor and Decompressor types have
been renamed to Writer and Reader.
In Go 1, the
<code>
NewWriterXxx
</code>
functions in
<a
href=
"/pkg/compress/flate"
><code>
compress/flate
</code></a>
,
<a
href=
"/pkg/compress/gzip"
><code>
compress/gzip
</code></a>
and
<a
href=
"/pkg/compress/zlib"
><code>
compress/zlib
</code></a>
all return
<code>
(*Writer, error)
</code>
if they take a compression level,
and
<code>
*Writer
</code>
otherwise. Package
<code>
gzip
</code>
's
<code>
Compressor
</code>
and
<code>
Decompressor
</code>
types have been renamed
to
<code>
Writer
</code>
and
<code>
Reader
</code>
. Package
<code>
flate
</code>
's
<code>
WrongValueError
</code>
type has been removed.
</p>
<p>
...
...
doc/go1.tmpl
View file @
22636be8
...
...
@@ -785,10 +785,15 @@ What little code is affected will be caught by the compiler and must be updated
<
h3
id
=
"bufio"
>
The
compress
/
flate
,
compress
/
gzip
and
compress
/
zlib
packages
</
h3
>
<
p
>
In
Go
1
,
the
NewWriterXxx
functions
in
compress
/
flate
,
compress
/
gzip
and
compress
/
zlib
all
return
(*
Writer
,
error
)
if
they
take
a
compression
level
,
and
*
Writer
otherwise
.
Package
gzip
's Compressor and Decompressor types have
been renamed to Writer and Reader.
In
Go
1
,
the
<
code
>
NewWriterXxx
</
code
>
functions
in
<
a
href
=
"/pkg/compress/flate"
><
code
>
compress
/
flate
</
code
></
a
>,
<
a
href
=
"/pkg/compress/gzip"
><
code
>
compress
/
gzip
</
code
></
a
>
and
<
a
href
=
"/pkg/compress/zlib"
><
code
>
compress
/
zlib
</
code
></
a
>
all
return
<
code
>(*
Writer
,
error
)</
code
>
if
they
take
a
compression
level
,
and
<
code
>*
Writer
</
code
>
otherwise
.
Package
<
code
>
gzip
</
code
>
's
<code>Compressor</code> and <code>Decompressor</code> types have been renamed
to <code>Writer</code> and <code>Reader</code>. Package <code>flate</code>'
s
<
code
>
WrongValueError
</
code
>
type
has
been
removed
.
</
p
>
<
p
>
...
...
src/pkg/compress/flate/deflate.go
View file @
22636be8
...
...
@@ -5,6 +5,7 @@
package
flate
import
(
"fmt"
"io"
"math"
)
...
...
@@ -390,7 +391,7 @@ func (d *compressor) init(w io.Writer, level int) (err error) {
d
.
fill
=
(
*
compressor
)
.
fillDeflate
d
.
step
=
(
*
compressor
)
.
deflate
default
:
return
WrongValueError
{
"level"
,
0
,
9
,
int32
(
level
)}
return
fmt
.
Errorf
(
"flate: invalid compression level %d: want value in range [-1, 9]"
,
level
)
}
return
nil
}
...
...
src/pkg/compress/flate/huffman_bit_writer.go
View file @
22636be8
...
...
@@ -7,7 +7,6 @@ package flate
import
(
"io"
"math"
"strconv"
)
const
(
...
...
@@ -85,13 +84,6 @@ type huffmanBitWriter struct {
err
error
}
type
WrongValueError
struct
{
name
string
from
int32
to
int32
value
int32
}
func
newHuffmanBitWriter
(
w
io
.
Writer
)
*
huffmanBitWriter
{
return
&
huffmanBitWriter
{
w
:
w
,
...
...
@@ -105,11 +97,6 @@ func newHuffmanBitWriter(w io.Writer) *huffmanBitWriter {
}
}
func
(
err
WrongValueError
)
Error
()
string
{
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
()
{
if
w
.
err
!=
nil
{
w
.
nbits
=
0
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment