Skip to content

Commit 4804246

Browse files
committed
Address review of Patch Set 4
1 parent 4cf977e commit 4804246

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/encoding/base32/base32.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -373,8 +373,7 @@ func (enc *Encoding) Decode(dst, src []byte) (n int, err error) {
373373
// DecodeString returns the bytes represented by the base32 string s.
374374
func (enc *Encoding) DecodeString(s string) ([]byte, error) {
375375
dbuf := make([]byte, enc.DecodedLen(len(s)))
376-
src := make([]byte, len(s))
377-
copy(src, s)
376+
src := []byte(s)
378377
l := stripNewlines(src)
379378
n, _, err := enc.decode(dbuf, src[:l])
380379
return dbuf[:n], err
@@ -496,9 +495,9 @@ type newlineFilteringReader struct {
496495
// of non-newline characters moved to the beginning of p.
497496
func stripNewlines(p []byte) int {
498497
offset := 0
499-
for i, b := range p[0:len(p)] {
498+
for i, b := range p {
500499
if b != '\r' && b != '\n' {
501-
if i != offset {
500+
if i > offset {
502501
p[offset] = b
503502
}
504503
offset++

0 commit comments

Comments
 (0)