1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

all: ~500 more byte=>u8

This commit is contained in:
Alexander Medvednikov
2022-04-15 18:25:45 +03:00
parent ae6a25f44e
commit fbb9e65c0f
148 changed files with 544 additions and 494 deletions

View File

@ -18,7 +18,7 @@ pub fn new_builder(initial_size int) Builder {
// write_ptr writes `len` bytes provided byteptr to the accumulated buffer
[unsafe]
pub fn (mut b Builder) write_ptr(ptr &byte, len int) {
pub fn (mut b Builder) write_ptr(ptr &u8, len int) {
if len == 0 {
return
}
@ -51,12 +51,12 @@ pub fn (mut b Builder) write_runes(runes []rune) {
// write_b appends a single `data` byte to the accumulated buffer
[deprecated: 'Use write_u8() instead']
[deprecated_after: '2022-02-11']
pub fn (mut b Builder) write_b(data byte) {
pub fn (mut b Builder) write_b(data u8) {
b << data
}
// write_byte appends a single `data` byte to the accumulated buffer
pub fn (mut b Builder) write_u8(data byte) {
pub fn (mut b Builder) write_u8(data u8) {
b << data
}
@ -81,7 +81,7 @@ pub fn (mut b Builder) drain_builder(mut other Builder, other_new_cap int) {
// byte_at returns a byte, located at a given index `i`.
// Note: it can panic, if there are not enough bytes in the strings builder yet.
[inline]
pub fn (b &Builder) byte_at(n int) byte {
pub fn (b &Builder) byte_at(n int) u8 {
return unsafe { (&[]u8(b))[n] }
}

View File

@ -1,7 +1,7 @@
module strings
// strings.repeat - fill a string with `n` repetitions of the character `c`
pub fn repeat(c byte, n int) string {
pub fn repeat(c u8, n int) string {
if n <= 0 {
return ''
}

View File

@ -1,6 +1,6 @@
module strings
pub fn repeat(c byte, n int) string {
pub fn repeat(c u8, n int) string {
if n <= 0 {
return ''
}

View File

@ -24,7 +24,7 @@ pub fn random(n int) string {
// find_between_pair_byte is the fastest in the find_between_pair_* family of functions.
// Example: assert strings.find_between_pair_u8('(V) (NOT V)',`(`,`)`) == 'V'
// Example: assert strings.find_between_pair_u8('s {X{Y}} s',`{`,`}`) == 'X{Y}'
pub fn find_between_pair_u8(input string, start byte, end byte) string {
pub fn find_between_pair_u8(input string, start u8, end u8) string {
mut marks := 0
mut start_index := -1
for i, b in input {