mirror of
https://github.com/vlang/v.git
synced 2025-09-15 15:32:27 +03:00
sync,szip,term,time,x.ttf: prepare for making -W impure-v
the default (#19929)
This commit is contained in:
parent
8267874d14
commit
6cc51f254f
9 changed files with 5 additions and 11 deletions
|
@ -1,6 +0,0 @@
|
||||||
module term
|
|
||||||
|
|
||||||
@[inline]
|
|
||||||
fn getchar() int {
|
|
||||||
return C.getchar()
|
|
||||||
}
|
|
|
@ -2,8 +2,8 @@ module term
|
||||||
|
|
||||||
// utf8_getchar returns an utf8 rune from standard input
|
// utf8_getchar returns an utf8 rune from standard input
|
||||||
pub fn utf8_getchar() ?rune {
|
pub fn utf8_getchar() ?rune {
|
||||||
c := getchar()
|
c := input_character()
|
||||||
if c == C.EOF {
|
if c == -1 {
|
||||||
return none
|
return none
|
||||||
}
|
}
|
||||||
len := utf8_len(u8(~c))
|
len := utf8_len(u8(~c))
|
||||||
|
@ -16,7 +16,7 @@ pub fn utf8_getchar() ?rune {
|
||||||
} else {
|
} else {
|
||||||
mut uc := c & ((1 << (7 - len)) - 1)
|
mut uc := c & ((1 << (7 - len)) - 1)
|
||||||
for i := 0; i + 1 < len; i++ {
|
for i := 0; i + 1 < len; i++ {
|
||||||
c2 := getchar()
|
c2 := input_character()
|
||||||
if c2 != -1 && (c2 >> 6) == 2 {
|
if c2 != -1 && (c2 >> 6) == 2 {
|
||||||
uc <<= 6
|
uc <<= 6
|
||||||
uc |= (c2 & 63)
|
uc |= (c2 & 63)
|
||||||
|
|
|
@ -88,7 +88,7 @@ fn (mut bmp BitMap) format_texture() {
|
||||||
pub fn (mut bmp BitMap) save_as_ppm(file_name string) {
|
pub fn (mut bmp BitMap) save_as_ppm(file_name string) {
|
||||||
tmp_buf := bmp.buf
|
tmp_buf := bmp.buf
|
||||||
mut buf := unsafe { malloc_noscan(bmp.buf_size) }
|
mut buf := unsafe { malloc_noscan(bmp.buf_size) }
|
||||||
unsafe { C.memcpy(buf, tmp_buf, bmp.buf_size) }
|
unsafe { vmemcpy(buf, tmp_buf, bmp.buf_size) }
|
||||||
bmp.buf = buf
|
bmp.buf = buf
|
||||||
|
|
||||||
bmp.format_texture()
|
bmp.format_texture()
|
||||||
|
|
|
@ -54,7 +54,7 @@ pub mut:
|
||||||
pub fn (mut bmp BitMap) clear() {
|
pub fn (mut bmp BitMap) clear() {
|
||||||
mut sz := bmp.width * bmp.height * bmp.bp
|
mut sz := bmp.width * bmp.height * bmp.bp
|
||||||
unsafe {
|
unsafe {
|
||||||
C.memset(bmp.buf, 0x00, sz)
|
vmemset(bmp.buf, 0x00, sz)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue