1
0
mirror of https://github.com/golang/go synced 2024-11-23 07:40:04 -07:00

crypto/cipher: don't persist errors in StreamWriter.

I messed this up from the beginning. The receiver isn't a pointer so
setting Err is useless. In order to maintain the API, just remove the
superfluous code.

Fixes #4657.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/7161043
This commit is contained in:
Adam Langley 2013-01-21 11:22:08 -05:00
parent 0a40137bf8
commit 0fb6f5f21b

View File

@ -28,13 +28,10 @@ func (r StreamReader) Read(dst []byte) (n int, err error) {
type StreamWriter struct {
S Stream
W io.Writer
Err error
Err error // unused
}
func (w StreamWriter) Write(src []byte) (n int, err error) {
if w.Err != nil {
return 0, w.Err
}
c := make([]byte, len(src))
w.S.XORKeyStream(c, src)
n, err = w.W.Write(c)
@ -42,7 +39,6 @@ func (w StreamWriter) Write(src []byte) (n int, err error) {
if err == nil { // should never happen
err = io.ErrShortWrite
}
w.Err = err
}
return
}