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

all: replace []byte with []u8

This commit is contained in:
Alexander Medvednikov
2022-04-15 15:35:35 +03:00
parent 0527ac633e
commit fb192d949b
164 changed files with 533 additions and 533 deletions

View File

@@ -373,7 +373,7 @@ pub fn (mut a array) delete_last() {
pub fn (a &array) free() {
}
// todo: once (a []byte) will work rewrite this
// todo: once (a []u8) will work rewrite this
pub fn (a array) bytestr() string {
res := ''
#for (let i = 0;i < a.arr.len.valueOf();i++) res.str += String.fromCharCode(a.arr.get(new int(i)))
@@ -487,7 +487,7 @@ pub interface JS.Float64Array {
every(JS.EveryFn) JS.Boolean
}
pub fn uint8_array(arr []byte) JS.Uint8Array {
pub fn uint8_array(arr []u8) JS.Uint8Array {
#let tmp = new Array();
for elem in arr {

View File

@@ -142,7 +142,7 @@ pub fn (x byte) hex() string {
// hex returns a string with the hexadecimal representation
// of the byte elements of the array.
pub fn (b []byte) hex() string {
pub fn (b []u8) hex() string {
mut hex := ''
for i in b {
mut z := i

View File

@@ -85,13 +85,13 @@ pub fn (s string) split(dot string) []string {
return arr
}
pub fn (s string) bytes() []byte {
pub fn (s string) bytes() []u8 {
sep := ''
tmparr := s.str.split(sep.str).map(fn (it JS.Any) JS.Any {
return JS.Any(u8(JS.String(it).charCodeAt(JS.Number(0))))
})
_ := tmparr
mut arr := []byte{}
mut arr := []u8{}
#arr = new array(new array_buffer({arr: tmparr,index_start: new int(0),len: new int(tmparr.length)}))
return arr
@@ -500,7 +500,7 @@ pub fn (s string) strip_margin_custom(del byte) string {
}
// don't know how much space the resulting string will be, but the max it
// can be is this big
mut ret := []byte{}
mut ret := []u8{}
#ret = new array()
mut count := 0