Skip to content

Commit

Permalink
encoding.utf8: remove const unicode_con_table_up_to_low table (#9672)
Browse files Browse the repository at this point in the history
  • Loading branch information
penguindark committed Apr 11, 2021
1 parent acb58d4 commit cca06fc
Show file tree
Hide file tree
Showing 5 changed files with 955 additions and 1,540 deletions.
1 change: 1 addition & 0 deletions cmd/tools/vtest-cleancode.v
Expand Up @@ -43,6 +43,7 @@ const (
'vlib/builtin/',
'vlib/cli/',
'vlib/dl/',
'vlib/encoding/utf8/',
'vlib/flag/',
'vlib/gg/',
'vlib/math/bits/bits.v',
Expand Down
2 changes: 1 addition & 1 deletion vlib/encoding/utf8/east_asian/east_asian_width.v
Expand Up @@ -37,7 +37,7 @@ pub fn east_asian_width_property_at(s string, index int) EastAsianWidthProperty
mut left, mut right := 0, east_asian.east_asian_width_data.len - 1
for left <= right {
middle := left + ((right - left) / 2)
entry := east_asian_width_data[middle]
entry := east_asian.east_asian_width_data[middle]
if codepoint < entry.point {
right = middle - 1
continue
Expand Down
4 changes: 2 additions & 2 deletions vlib/encoding/utf8/utf8.v
Expand Up @@ -11,10 +11,10 @@ pub fn validate_str(str string) bool {
return validate(str.str, str.len)
}

pub fn validate(data byteptr, len int) bool {
pub fn validate(data &byte, len int) bool {
mut state := Utf8State{}
for i := 0; i < len; i++ {
s := unsafe {data[i]}
s := unsafe { data[i] }
if s == 0 {
break
}
Expand Down

0 comments on commit cca06fc

Please sign in to comment.