diff options
| author | Brad Fitzpatrick <bradfitz@golang.org> | 2012-01-24 14:19:59 -0800 |
|---|---|---|
| committer | Brad Fitzpatrick <bradfitz@golang.org> | 2012-01-24 14:19:59 -0800 |
| commit | 2c2c20224acb4743a20eb72331413e66ef8f8975 (patch) | |
| tree | 0ce77d5b948f9b8bb194d7eb4fc605082552f1a6 /src/pkg/encoding/binary | |
| parent | fe30ed2dcf2392f50b9305863d73fe2909567b8d (diff) | |
| download | go-2c2c20224acb4743a20eb72331413e66ef8f8975.tar.xz | |
encoding/binary: document that PutVarint, PutUvarint may panic
Fixes #2628
R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/5571058
Diffstat (limited to 'src/pkg/encoding/binary')
| -rw-r--r-- | src/pkg/encoding/binary/varint.go | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/pkg/encoding/binary/varint.go b/src/pkg/encoding/binary/varint.go index 6566ab0600..b756afdd04 100644 --- a/src/pkg/encoding/binary/varint.go +++ b/src/pkg/encoding/binary/varint.go @@ -37,6 +37,7 @@ const ( ) // PutUvarint encodes a uint64 into buf and returns the number of bytes written. +// If the buffer is too small, PutUvarint will panic. func PutUvarint(buf []byte, x uint64) int { i := 0 for x >= 0x80 { @@ -73,6 +74,7 @@ func Uvarint(buf []byte) (uint64, int) { } // PutVarint encodes an int64 into buf and returns the number of bytes written. +// If the buffer is too small, PutVarint will panic. func PutVarint(buf []byte, x int64) int { ux := uint64(x) << 1 if x < 0 { |
