Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(621)

Issue 76730043: code review 76730043: strconv.CanBackquote: Handle DEL as control character. (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
10 years, 1 month ago by ruiu
Modified:
10 years, 1 month ago
Visibility:
Public.

Description

strconv: fix CanBackquote for DEL CanBackquote is expected to return false if a given string contains control characters other than space and tab. DEL is a control charcater so CanBackquote should return false for it.

Patch Set 1 #

Patch Set 2 : diff -r 32b8c26e4414 https://code.google.com/p/go #

Patch Set 3 : diff -r 32b8c26e4414 https://code.google.com/p/go #

Unified diffs Side-by-side diffs Delta from patch set Stats (+2 lines, -1 line) Patch
M src/pkg/strconv/quote.go View 1 1 chunk +1 line, -1 line 0 comments Download
M src/pkg/strconv/quote_test.go View 1 1 chunk +1 line, -0 lines 0 comments Download

Messages

Total messages: 3
ruiu
Hello golang-codereviews@googlegroups.com, I'd like you to review this change to https://code.google.com/p/go
10 years, 1 month ago (2014-03-17 04:08:20 UTC) #1
bradfitz
Subject of the patch should be just "strconv: xxxx" where xxx starts lowercase. Also don't ...
10 years, 1 month ago (2014-03-17 19:11:19 UTC) #2
bradfitz
10 years, 1 month ago (2014-03-17 19:15:06 UTC) #3
Filed https://code.google.com/p/go/issues/detail?id=7565



On Mon, Mar 17, 2014 at 12:11 PM, Brad Fitzpatrick <bradfitz@golang.org>wrote:

> Subject of the patch should be just "strconv: xxxx" where xxx starts
> lowercase.  Also don't need need trailing period.
>
> "strconv: fix CanBackquote for DEL"
>
> But this function seems wrong for other reasons, for invalid UTF-8:
> http://play.golang.org/p/AzDqsSnT4f
>
>
>
> On Sun, Mar 16, 2014 at 9:08 PM, <ruiu@google.com> wrote:
>
>> Reviewers: golang-codereviews,
>>
>> Message:
>> Hello golang-codereviews@googlegroups.com,
>>
>> I'd like you to review this change to
>> https://code.google.com/p/go
>>
>>
>> Description:
>> strconv.CanBackquote: Handle DEL as control character.
>>
>> CanBackquote is expected to return false if a given string contains
>> control characters other than space and tab. DEL is a control charcater
>> so CanBackquote should return false for it.
>>
>> Please review this at https://codereview.appspot.com/76730043/
>>
>> Affected files (+2, -1 lines):
>>   M src/pkg/strconv/quote.go
>>   M src/pkg/strconv/quote_test.go
>>
>>
>> Index: src/pkg/strconv/quote.go
>> ===================================================================
>> --- a/src/pkg/strconv/quote.go
>> +++ b/src/pkg/strconv/quote.go
>> @@ -144,7 +144,7 @@
>>  // characters other than space and tab.
>>  func CanBackquote(s string) bool {
>>         for i := 0; i < len(s); i++ {
>> -               if (s[i] < ' ' && s[i] != '\t') || s[i] == '`' {
>> +               if (s[i] < ' ' && s[i] != '\t') || s[i] == '`' || s[i] ==
>> '\x7F' {
>>                         return false
>>                 }
>>         }
>> Index: src/pkg/strconv/quote_test.go
>> ===================================================================
>> --- a/src/pkg/strconv/quote_test.go
>> +++ b/src/pkg/strconv/quote_test.go
>> @@ -140,6 +140,7 @@
>>         {string(29), false},
>>         {string(30), false},
>>         {string(31), false},
>> +       {string(127), false}, // DEL
>>         {`' !"#$%&'()*+,-./:;<=>?@[\]^_{|}~`, true},
>>         {`0123456789`, true},
>>         {`ABCDEFGHIJKLMNOPQRSTUVWXYZ`, true},
>>
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "golang-codereviews" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to golang-codereviews+unsubscribe@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b