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
e9b40580
Commit
e9b40580
authored
Mar 03, 2009
by
Russ Cox
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix names: s/fd/r/
R=r DELTA=9 (0 added, 0 deleted, 9 changed) OCL=25593 CL=25593
parent
96750f13
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
9 deletions
+9
-9
io.go
src/lib/io/io.go
+9
-9
No files found.
src/lib/io/io.go
View file @
e9b40580
...
...
@@ -58,10 +58,10 @@ func WriteString(w Write, s string) (n int, err *os.Error) {
}
// Read until buffer is full, EOF, or error
func
Readn
(
fd
Read
,
buf
[]
byte
)
(
n
int
,
err
*
os
.
Error
)
{
func
Readn
(
r
Read
,
buf
[]
byte
)
(
n
int
,
err
*
os
.
Error
)
{
n
=
0
;
for
n
<
len
(
buf
)
{
nn
,
e
:=
fd
.
Read
(
buf
[
n
:
len
(
buf
)]);
nn
,
e
:=
r
.
Read
(
buf
[
n
:
len
(
buf
)]);
if
nn
>
0
{
n
+=
nn
}
...
...
@@ -78,20 +78,20 @@ func Readn(fd Read, buf []byte) (n int, err *os.Error) {
// Convert something that implements Read into something
// whose Reads are always Readn
type
fullRead
struct
{
fd
Read
;
r
Read
;
}
func
(
f
d
*
fullRead
)
Read
(
p
[]
byte
)
(
n
int
,
err
*
os
.
Error
)
{
n
,
err
=
Readn
(
f
d
.
fd
,
p
);
func
(
f
r
*
fullRead
)
Read
(
p
[]
byte
)
(
n
int
,
err
*
os
.
Error
)
{
n
,
err
=
Readn
(
f
r
.
r
,
p
);
return
n
,
err
}
func
MakeFullReader
(
fd
Read
)
Read
{
if
fr
,
ok
:=
fd
.
(
*
fullRead
);
ok
{
func
MakeFullReader
(
r
Read
)
Read
{
if
fr
,
ok
:=
r
.
(
*
fullRead
);
ok
{
// already a fullRead
return
fd
return
r
}
return
&
fullRead
(
fd
)
return
&
fullRead
(
r
)
}
// Copies n bytes (or until EOF is reached) from src to dst.
...
...
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