sync,szip,term,time,x.ttf: prepare for making -W impure-v the default (#19929)

This commit is contained in:
JalonSolov 2023-11-19 11:33:07 -05:00 committed by GitHub
parent 8267874d14
commit 6cc51f254f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 5 additions and 11 deletions

View file

@ -1,6 +0,0 @@
module term
@[inline]
fn getchar() int {
return C.getchar()
}

View file

@ -2,8 +2,8 @@ module term
// utf8_getchar returns an utf8 rune from standard input
pub fn utf8_getchar() ?rune {
c := getchar()
if c == C.EOF {
c := input_character()
if c == -1 {
return none
}
len := utf8_len(u8(~c))
@ -16,7 +16,7 @@ pub fn utf8_getchar() ?rune {
} else {
mut uc := c & ((1 << (7 - len)) - 1)
for i := 0; i + 1 < len; i++ {
c2 := getchar()
c2 := input_character()
if c2 != -1 && (c2 >> 6) == 2 {
uc <<= 6
uc |= (c2 & 63)

View file

@ -88,7 +88,7 @@ fn (mut bmp BitMap) format_texture() {
pub fn (mut bmp BitMap) save_as_ppm(file_name string) {
tmp_buf := bmp.buf
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.format_texture()

View file

@ -54,7 +54,7 @@ pub mut:
pub fn (mut bmp BitMap) clear() {
mut sz := bmp.width * bmp.height * bmp.bp
unsafe {
C.memset(bmp.buf, 0x00, sz)
vmemset(bmp.buf, 0x00, sz)
}
}