diff --git a/compiler/table.v b/compiler/table.v index fa8bdd35ec..2211f10324 100644 --- a/compiler/table.v +++ b/compiler/table.v @@ -210,6 +210,7 @@ fn new_table(obfuscate bool) &Table { t.register_type('size_t') t.register_type_with_parent('i8', 'int') t.register_type_with_parent('byte', 'int') + t.register_type_with_parent('char', 'int') // for C functinos only, to avoid warnings t.register_type_with_parent('i16', 'int') t.register_type_with_parent('u16', 'u32') t.register_type_with_parent('u32', 'int') diff --git a/vlib/builtin/array.v b/vlib/builtin/array.v index 133e1ce0a3..834cb3c8b0 100644 --- a/vlib/builtin/array.v +++ b/vlib/builtin/array.v @@ -276,7 +276,7 @@ pub fn (b []byte) hex() string { mut hex := malloc(b.len*2+1) mut ptr := &hex[0] for i := 0; i < b.len ; i++ { - ptr += C.sprintf(ptr, '%02x', b[i]) + ptr += C.sprintf(*char(ptr), '%02x', b[i]) } return string(hex) } diff --git a/vlib/builtin/string.v b/vlib/builtin/string.v index 08c63f9601..76e2a48f16 100644 --- a/vlib/builtin/string.v +++ b/vlib/builtin/string.v @@ -128,28 +128,28 @@ pub fn (s string) replace(rep, with string) string { } pub fn (s string) int() int { - return C.atoi(s.str) + return C.atoi(*char(s.str)) } pub fn (s string) i64() i64 { - return C.atoll(s.str) + return C.atoll(*char(s.str)) } pub fn (s string) f32() f32 { - return C.atof(s.str) + return C.atof(*char(s.str)) } pub fn (s string) f64() f64 { - return C.atof(s.str) + return C.atof(*char(s.str)) } pub fn (s string) u32() u32 { - return C.strtoul(s.str, 0, 0) + return C.strtoul(*char(s.str), 0, 0) } pub fn (s string) u64() u64 { - return C.strtoull(s.str, 0, 0) + return C.strtoull(*char(s.str), 0, 0) //return C.atoll(s.str) // temporary fix for tcc on windows. }