ci: fix failing `v -W build-tools` and `v -W build-examples`; run vfmt.

pull/9370/head
Delyan Angelov 2021-03-19 09:49:26 +02:00
parent ea3d1405ee
commit 04095f4088
No known key found for this signature in database
GPG Key ID: 66886C0F12D595ED
11 changed files with 22 additions and 21 deletions

View File

@ -131,11 +131,11 @@ fn main() {
max_bname := context.max_bname_len(file_byte_map.keys())
if context.write_file.len > 0 {
mut out_file := os.create(context.write_file) ?
out_file.write_str(context.header()) ?
out_file.write_string(context.header()) ?
for bname, fbytes in file_byte_map {
out_file.write_str(context.file2v(bname, fbytes, max_bname)) ?
out_file.write_string(context.file2v(bname, fbytes, max_bname)) ?
}
out_file.write_str(context.footer()) ?
out_file.write_string(context.footer()) ?
} else {
print(context.header())
for bname, fbytes in file_byte_map {

View File

@ -77,7 +77,7 @@ fn (c &Create) write_vmod(new bool) {
cerror(err.msg)
exit(1)
}
vmod.write_str(vmod_content(c)) or { panic(err) }
vmod.write_string(vmod_content(c)) or { panic(err) }
vmod.close()
}
@ -90,7 +90,7 @@ fn (c &Create) write_main(new bool) {
cerror(err.msg)
exit(2)
}
mainfile.write_str(main_content()) or { panic(err) }
mainfile.write_string(main_content()) or { panic(err) }
mainfile.close()
}
@ -107,7 +107,7 @@ fn (c &Create) create_git_repo(dir string) {
// We don't really need a .gitignore, it's just a nice-to-have
return
}
fl.write_str(gen_gitignore(c.name)) or { panic(err) }
fl.write_string(gen_gitignore(c.name)) or { panic(err) }
fl.close()
}
}

View File

@ -9,6 +9,7 @@ const (
vet_folders = [
'vlib/sqlite',
'vlib/v',
'vlib/x/ttf/',
'cmd/v',
'cmd/tools',
'examples/2048',

View File

@ -7,7 +7,7 @@ fn main() {
// Make a new connection
mut conn := net.dial_tcp('google.com:80') ?
// Simple http HEAD request for a file
conn.write_str('GET /index.html HTTP/1.0\r\n\r\n') ?
conn.write_string('GET /index.html HTTP/1.0\r\n\r\n') ?
// Wrap in a buffered reader
mut r := io.new_buffered_reader(reader: io.make_reader(conn))
for {

View File

@ -5,10 +5,10 @@ fn main() {
// Make a new connection
mut conn := net.dial_tcp('google.com:80') ?
defer {
conn.close() or { }
conn.close() or {}
}
// Simple http HEAD request for a file
conn.write_str('HEAD /index.html HTTP/1.0\r\n\r\n') ?
conn.write_string('HEAD /index.html HTTP/1.0\r\n\r\n') ?
// Read all the data that is waiting
result := io.read_all(reader: conn) ?
// Cast to string and print result

View File

@ -106,7 +106,7 @@ fn (image Image) save_as_ppm(file_name string) {
c_r := to_int(unsafe { image.data[i] }.x)
c_g := to_int(unsafe { image.data[i] }.y)
c_b := to_int(unsafe { image.data[i] }.z)
f_out.write_str('$c_r $c_g $c_b ') or { panic(err) }
f_out.write_string('$c_r $c_g $c_b ') or { panic(err) }
}
f_out.close()
}

View File

@ -87,7 +87,7 @@ fn (mut bmp BitMap) format_texture() {
// write out a .ppm file
pub fn (mut bmp BitMap) save_as_ppm(file_name string) {
tmp_buf := bmp.buf
mut buf := unsafe {malloc(bmp.buf_size)}
mut buf := unsafe { malloc(bmp.buf_size) }
unsafe { C.memcpy(buf, tmp_buf, bmp.buf_size) }
bmp.buf = buf
@ -103,7 +103,7 @@ pub fn (mut bmp BitMap) save_as_ppm(file_name string) {
c_r := bmp.buf[pos]
c_g := bmp.buf[pos + 1]
c_b := bmp.buf[pos + 2]
f_out.write_str('$c_r $c_g $c_b ') or { panic(err) }
f_out.write_string('$c_r $c_g $c_b ') or { panic(err) }
}
}
f_out.close()

View File

@ -800,8 +800,8 @@ pub fn (mut bmp BitMap) draw_glyph(index u16) (int, int) {
// bmp.line(x0, y0, start_point.x, start_point.y, u32(0x00FF0000)
// u32(0xFF000000))
bmp.quadratic(x0, y0, start_point.x, start_point.y, (point.x +
start_point.x) / 2, (point.y + start_point.y) / 2, color)
bmp.quadratic(x0, y0, start_point.x, start_point.y, (point.x + start_point.x) / 2,
(point.y + start_point.y) / 2, color)
}
} else {
// last point not in a curve

View File

@ -53,10 +53,10 @@ pub fn (mut tf_skl TTF_render_Sokol) create_text(in_txt string, in_font_size f32
// RAM buffer
if sz > tf_skl.bmp.buf_size {
if sz > 0 {
unsafe {free(tf_skl.bmp.buf)}
unsafe { free(tf_skl.bmp.buf) }
}
dprintln('create_text Alloc: $sz bytes')
tf_skl.bmp.buf = unsafe {malloc(sz)}
tf_skl.bmp.buf = unsafe { malloc(sz) }
tf_skl.bmp.buf_size = sz
}
@ -91,10 +91,10 @@ pub fn (mut tf_skl TTF_render_Sokol) create_text_block(in_txt string, in_w int,
// RAM buffer
if sz > tf_skl.bmp.buf_size {
if sz > 0 {
unsafe {free(tf_skl.bmp.buf)}
unsafe { free(tf_skl.bmp.buf) }
}
dprintln('Alloc: $sz bytes')
tf_skl.bmp.buf = unsafe {malloc(sz)}
tf_skl.bmp.buf = unsafe { malloc(sz) }
tf_skl.bmp.buf_size = sz
}

View File

@ -519,8 +519,8 @@ fn (mut tf TTF_File) get_fword() i16 {
}
fn (mut tf TTF_File) get_u32() u32 {
x := (u32(tf.buf[tf.pos]) << u32(24)) | (u32(tf.buf[tf.pos +
1]) << u32(16)) | (u32(tf.buf[tf.pos + 2]) << u32(8)) | u32(tf.buf[tf.pos + 3])
x := (u32(tf.buf[tf.pos]) << u32(24)) | (u32(tf.buf[tf.pos + 1]) << u32(16)) | (u32(tf.buf[
tf.pos + 2]) << u32(8)) | u32(tf.buf[tf.pos + 3])
tf.pos += 4
return x
}

View File

@ -183,7 +183,7 @@ fn test_main() {
mut bmp := ttf.BitMap{
tf: &tf
buf: malloc(sz)
buf: unsafe { malloc(sz) }
buf_size: sz
scale: scale
width: w