LGTM On Fri, Feb 10, 2012 at 2:06 PM, <r@golang.org> wrote: > Reviewers: golang-dev_googlegroups.com, > ...
13 years, 10 months ago
(2012-02-10 03:07:24 UTC)
#2
LGTM
On Fri, Feb 10, 2012 at 2:06 PM, <r@golang.org> wrote:
> Reviewers: golang-dev_googlegroups.com,
>
> Message:
> Hello golang-dev@googlegroups.com,
>
> I'd like you to review this change to
> https://go.googlecode.com/hg/
>
>
> Description:
> unicode/utf8: document return value for decode errors
> Also replace archaic definition of rune.
>
> Please review this at
http://codereview.appspot.com/**5654048/<http://codereview.appspot.com/5654048/>
>
> Affected files:
> M src/pkg/unicode/utf8/utf8.go
>
>
> Index: src/pkg/unicode/utf8/utf8.go
> ==============================**==============================**=======
> --- a/src/pkg/unicode/utf8/utf8.go
> +++ b/src/pkg/unicode/utf8/utf8.go
> @@ -3,7 +3,7 @@
> // license that can be found in the LICENSE file.
>
> // Package utf8 implements functions and constants to support text
> encoded in
> -// UTF-8. This package calls a Unicode character a rune for brevity.
> +// UTF-8. It includes functions to translate between runes and UTF-8 byte
> sequences.
> package utf8
>
> import "unicode" // only needed for a couple of constants
> @@ -198,19 +198,21 @@
> }
>
> // DecodeRune unpacks the first UTF-8 encoding in p and returns the rune
> and its width in bytes.
> +// If the encoding is invalid, it returns (RuneError, 1), an impossible
> result for correct UTF-8.
> func DecodeRune(p []byte) (r rune, size int) {
> r, size, _ = decodeRuneInternal(p)
> return
> }
>
> // DecodeRuneInString is like DecodeRune but its input is a string.
> +// If the encoding is invalid, it returns (RuneError, 1), an impossible
> result for correct UTF-8.
> func DecodeRuneInString(s string) (r rune, size int) {
> r, size, _ = decodeRuneInStringInternal(s)
> return
> }
>
> -// DecodeLastRune unpacks the last UTF-8 encoding in p
> -// and returns the rune and its width in bytes.
> +// DecodeLastRune unpacks the last UTF-8 encoding in p and returns the
> rune and its width in bytes.
> +// If the encoding is invalid, it returns (RuneError, 1), an impossible
> result for correct UTF-8.
> func DecodeLastRune(p []byte) (r rune, size int) {
> end := len(p)
> if end == 0 {
> @@ -244,6 +246,7 @@
> }
>
> // DecodeLastRuneInString is like DecodeLastRune but its input is a
> string.
> +// If the encoding is invalid, it returns (RuneError, 1), an impossible
> result for correct UTF-8.
> func DecodeLastRuneInString(s string) (r rune, size int) {
> end := len(s)
> if end == 0 {
>
>
>
*** Submitted as http://code.google.com/p/go/source/detail?r=58e600a849f2 *** unicode/utf8: document return value for decode errors Also replace archaic ...
13 years, 10 months ago
(2012-02-10 03:12:23 UTC)
#3
Issue 5654048: code review 5654048: unicode/utf8: document return value for decode errors
(Closed)
Created 13 years, 10 months ago by r
Modified 13 years, 10 months ago
Reviewers:
Base URL:
Comments: 0