1
0
mirror of https://github.com/golang/go synced 2024-11-20 05:54:43 -07:00

Explicitly return values where it's shadowing the parameter.

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
This commit is contained in:
Christopher Wedgwood 2009-12-01 15:54:49 -08:00 committed by Adam Langley
parent e1c347ca59
commit 4f6dbc6901

View File

@ -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)
@ -70,7 +70,7 @@ 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--;
}
@ -78,10 +78,10 @@ func (ws *Conn) Read(msg []byte) (n int, err os.Error) {
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) {
@ -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) {