Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
G
golang
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
golang
Commits
68777771
Commit
68777771
authored
Dec 12, 2009
by
Rob Pike
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix bug for large counts: used a one-byte buffer.
R=rsc CC=golang-dev
https://golang.org/cl/174082
parent
222462ed
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
3 deletions
+2
-3
decoder.go
src/pkg/gob/decoder.go
+2
-3
No files found.
src/pkg/gob/decoder.go
View file @
68777771
...
...
@@ -23,7 +23,7 @@ type Decoder struct {
state
*
decodeState
;
// reads data from in-memory buffer
countState
*
decodeState
;
// reads counts from wire
buf
[]
byte
;
oneByte
[]
byte
;
countBuf
[
9
]
byte
;
// counts may be uint64s (unlikely!), require 9 bytes
}
// NewDecoder returns a new decoder that reads from the io.Reader.
...
...
@@ -34,7 +34,6 @@ func NewDecoder(r io.Reader) *Decoder {
dec
.
state
=
newDecodeState
(
nil
);
// buffer set in Decode(); rest is unimportant
dec
.
decoderCache
=
make
(
map
[
reflect
.
Type
]
map
[
typeId
]
**
decEngine
);
dec
.
ignorerCache
=
make
(
map
[
typeId
]
**
decEngine
);
dec
.
oneByte
=
make
([]
byte
,
1
);
return
dec
;
}
...
...
@@ -73,7 +72,7 @@ func (dec *Decoder) Decode(e interface{}) os.Error {
for
{
// Read a count.
var
nbytes
uint64
;
nbytes
,
dec
.
state
.
err
=
decodeUintReader
(
dec
.
r
,
dec
.
oneByte
);
nbytes
,
dec
.
state
.
err
=
decodeUintReader
(
dec
.
r
,
dec
.
countBuf
[
0
:
]
);
if
dec
.
state
.
err
!=
nil
{
break
}
...
...
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