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

fix linux warnings in generated C code

This commit is contained in:
Nicolas Sauzede
2020-03-01 13:26:09 +01:00
committed by GitHub
parent 7a499b3cd3
commit becd87141c
5 changed files with 17 additions and 20 deletions

View File

@ -156,17 +156,14 @@ pub fn (n int) hex() string {
pub fn (n i64) hex() string {
len := if n >= 0 { n.str().len + 3 } else { 19 }
hex := malloc(len)
// QTODO
//count := C.sprintf(charptr(hex), '0x%'C.PRIx64, n)
count := C.sprintf(hex, '0x%x', n)
count := C.sprintf(charptr(hex), '0x%'C.PRIx64, n)
return tos(hex, count)
}
pub fn (n u64) hex() string {
len := if n >= 0 { n.str().len + 3 } else { 19 }
len := if n > 0 { n.str().len + 3 } else { 19 }
hex := malloc(len)
//count := C.sprintf(charptr(hex), '0x%'C.PRIx64, n)
count := C.sprintf((hex), '0x%lx', n)
count := C.sprintf(charptr(hex), '0x%'C.PRIx64, n)
return tos(hex, count)
}