ci: fix failing `v -W build-tools` and `v -W build-examples`; run vfmt.
parent
ea3d1405ee
commit
04095f4088
|
@ -131,11 +131,11 @@ fn main() {
|
||||||
max_bname := context.max_bname_len(file_byte_map.keys())
|
max_bname := context.max_bname_len(file_byte_map.keys())
|
||||||
if context.write_file.len > 0 {
|
if context.write_file.len > 0 {
|
||||||
mut out_file := os.create(context.write_file) ?
|
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 {
|
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 {
|
} else {
|
||||||
print(context.header())
|
print(context.header())
|
||||||
for bname, fbytes in file_byte_map {
|
for bname, fbytes in file_byte_map {
|
||||||
|
|
|
@ -77,7 +77,7 @@ fn (c &Create) write_vmod(new bool) {
|
||||||
cerror(err.msg)
|
cerror(err.msg)
|
||||||
exit(1)
|
exit(1)
|
||||||
}
|
}
|
||||||
vmod.write_str(vmod_content(c)) or { panic(err) }
|
vmod.write_string(vmod_content(c)) or { panic(err) }
|
||||||
vmod.close()
|
vmod.close()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -90,7 +90,7 @@ fn (c &Create) write_main(new bool) {
|
||||||
cerror(err.msg)
|
cerror(err.msg)
|
||||||
exit(2)
|
exit(2)
|
||||||
}
|
}
|
||||||
mainfile.write_str(main_content()) or { panic(err) }
|
mainfile.write_string(main_content()) or { panic(err) }
|
||||||
mainfile.close()
|
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
|
// We don't really need a .gitignore, it's just a nice-to-have
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
fl.write_str(gen_gitignore(c.name)) or { panic(err) }
|
fl.write_string(gen_gitignore(c.name)) or { panic(err) }
|
||||||
fl.close()
|
fl.close()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,7 @@ const (
|
||||||
vet_folders = [
|
vet_folders = [
|
||||||
'vlib/sqlite',
|
'vlib/sqlite',
|
||||||
'vlib/v',
|
'vlib/v',
|
||||||
|
'vlib/x/ttf/',
|
||||||
'cmd/v',
|
'cmd/v',
|
||||||
'cmd/tools',
|
'cmd/tools',
|
||||||
'examples/2048',
|
'examples/2048',
|
||||||
|
|
|
@ -7,7 +7,7 @@ fn main() {
|
||||||
// Make a new connection
|
// Make a new connection
|
||||||
mut conn := net.dial_tcp('google.com:80') ?
|
mut conn := net.dial_tcp('google.com:80') ?
|
||||||
// Simple http HEAD request for a file
|
// 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
|
// Wrap in a buffered reader
|
||||||
mut r := io.new_buffered_reader(reader: io.make_reader(conn))
|
mut r := io.new_buffered_reader(reader: io.make_reader(conn))
|
||||||
for {
|
for {
|
||||||
|
|
|
@ -8,7 +8,7 @@ fn main() {
|
||||||
conn.close() or {}
|
conn.close() or {}
|
||||||
}
|
}
|
||||||
// Simple http HEAD request for a file
|
// 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
|
// Read all the data that is waiting
|
||||||
result := io.read_all(reader: conn) ?
|
result := io.read_all(reader: conn) ?
|
||||||
// Cast to string and print result
|
// Cast to string and print result
|
||||||
|
|
|
@ -106,7 +106,7 @@ fn (image Image) save_as_ppm(file_name string) {
|
||||||
c_r := to_int(unsafe { image.data[i] }.x)
|
c_r := to_int(unsafe { image.data[i] }.x)
|
||||||
c_g := to_int(unsafe { image.data[i] }.y)
|
c_g := to_int(unsafe { image.data[i] }.y)
|
||||||
c_b := to_int(unsafe { image.data[i] }.z)
|
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()
|
f_out.close()
|
||||||
}
|
}
|
||||||
|
|
|
@ -103,7 +103,7 @@ pub fn (mut bmp BitMap) save_as_ppm(file_name string) {
|
||||||
c_r := bmp.buf[pos]
|
c_r := bmp.buf[pos]
|
||||||
c_g := bmp.buf[pos + 1]
|
c_g := bmp.buf[pos + 1]
|
||||||
c_b := bmp.buf[pos + 2]
|
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()
|
f_out.close()
|
||||||
|
|
|
@ -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)
|
// bmp.line(x0, y0, start_point.x, start_point.y, u32(0x00FF0000)
|
||||||
// u32(0xFF000000))
|
// u32(0xFF000000))
|
||||||
bmp.quadratic(x0, y0, start_point.x, start_point.y, (point.x +
|
bmp.quadratic(x0, y0, start_point.x, start_point.y, (point.x + start_point.x) / 2,
|
||||||
start_point.x) / 2, (point.y + start_point.y) / 2, color)
|
(point.y + start_point.y) / 2, color)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// last point not in a curve
|
// last point not in a curve
|
||||||
|
|
|
@ -519,8 +519,8 @@ fn (mut tf TTF_File) get_fword() i16 {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn (mut tf TTF_File) get_u32() u32 {
|
fn (mut tf TTF_File) get_u32() u32 {
|
||||||
x := (u32(tf.buf[tf.pos]) << u32(24)) | (u32(tf.buf[tf.pos +
|
x := (u32(tf.buf[tf.pos]) << u32(24)) | (u32(tf.buf[tf.pos + 1]) << u32(16)) | (u32(tf.buf[
|
||||||
1]) << u32(16)) | (u32(tf.buf[tf.pos + 2]) << u32(8)) | u32(tf.buf[tf.pos + 3])
|
tf.pos + 2]) << u32(8)) | u32(tf.buf[tf.pos + 3])
|
||||||
tf.pos += 4
|
tf.pos += 4
|
||||||
return x
|
return x
|
||||||
}
|
}
|
||||||
|
|
|
@ -183,7 +183,7 @@ fn test_main() {
|
||||||
|
|
||||||
mut bmp := ttf.BitMap{
|
mut bmp := ttf.BitMap{
|
||||||
tf: &tf
|
tf: &tf
|
||||||
buf: malloc(sz)
|
buf: unsafe { malloc(sz) }
|
||||||
buf_size: sz
|
buf_size: sz
|
||||||
scale: scale
|
scale: scale
|
||||||
width: w
|
width: w
|
||||||
|
|
Loading…
Reference in New Issue