Skip to content

Commit

Permalink
Explicitly return values where it's shadowing the parameter.
Browse files Browse the repository at this point in the history
Bad returns noticed by "Devon H. O'Dell" <devon.odell@gmail.com>.

Resolves Issue 360.

R=rsc, dho, agl, agl1
CC=ukai
https://golang.org/cl/163055
  • Loading branch information
cwedgwood authored and agl committed Dec 1, 2009
1 parent e1c347c commit 4f6dbc6
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/pkg/websocket/websocket.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,14 @@ func (ws *Conn) Read(msg []byte) (n int, err os.Error) {
for {
frameByte, err := ws.buf.ReadByte();
if err != nil {
return
return n, err
}
if (frameByte & 0x80) == 0x80 {
length := 0;
for {
c, err := ws.buf.ReadByte();
if err != nil {
return
return n, err
}
if (c & 0x80) == 0x80 {
length = length*128 + int(c&0x7f)
Expand All @@ -70,18 +70,18 @@ func (ws *Conn) Read(msg []byte) (n int, err os.Error) {
for length > 0 {
_, err := ws.buf.ReadByte();
if err != nil {
return
return n, err
}
length--;
}
} else {
for {
c, err := ws.buf.ReadByte();
if err != nil {
return
return n, err
}
if c == '\xff' {
return
return n, err
}
if frameByte == 0 {
if n+1 <= cap(msg) {
Expand All @@ -91,13 +91,13 @@ func (ws *Conn) Read(msg []byte) (n int, err os.Error) {
n++;
}
if n >= cap(msg) {
err = os.E2BIG;
return;
return n, os.E2BIG
}
}
}
}
return;

panic("unreachable");
}

func (ws *Conn) Write(msg []byte) (n int, err os.Error) {
Expand Down

0 comments on commit 4f6dbc6

Please sign in to comment.