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
57665533
Commit
57665533
authored
Jun 23, 2009
by
Rob Pike
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix io.Bytebuffer.Read for new EOF semantics
R=rsc DELTA=7 (5 added, 0 deleted, 2 changed) OCL=30657 CL=30659
parent
28ba9777
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
2 deletions
+7
-2
bytebuffer.go
src/pkg/io/bytebuffer.go
+7
-2
No files found.
src/pkg/io/bytebuffer.go
View file @
57665533
...
...
@@ -87,8 +87,13 @@ func (b *ByteBuffer) WriteByte(c byte) os.Error {
}
// Read reads the next len(p) bytes from the buffer or until the buffer
// is drained. The return value n is the number of bytes read; err is always nil.
// is drained. The return value n is the number of bytes read. If the
// buffer has no data to return, err is os.EOF even if len(p) is zero;
// otherwise it is nil.
func
(
b
*
ByteBuffer
)
Read
(
p
[]
byte
)
(
n
int
,
err
os
.
Error
)
{
if
b
.
off
>=
len
(
b
.
buf
)
{
return
0
,
os
.
EOF
}
m
:=
b
.
Len
();
n
=
len
(
p
);
...
...
@@ -99,7 +104,7 @@ func (b *ByteBuffer) Read(p []byte) (n int, err os.Error) {
bytecopy
(
p
,
0
,
b
.
buf
,
b
.
off
,
n
);
b
.
off
+=
n
;
return
n
,
nil
return
n
,
err
}
// ReadByte reads and returns the next byte from the buffer.
...
...
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