Skip to content

Commit 04095f4

Browse files
committed
ci: fix failing v -W build-tools and v -W build-examples; run vfmt.
1 parent ea3d140 commit 04095f4

File tree

11 files changed

+22
-21
lines changed

11 files changed

+22
-21
lines changed

cmd/tools/vbin2v.v

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -131,11 +131,11 @@ fn main() {
131131
max_bname := context.max_bname_len(file_byte_map.keys())
132132
if context.write_file.len > 0 {
133133
mut out_file := os.create(context.write_file) ?
134-
out_file.write_str(context.header()) ?
134+
out_file.write_string(context.header()) ?
135135
for bname, fbytes in file_byte_map {
136-
out_file.write_str(context.file2v(bname, fbytes, max_bname)) ?
136+
out_file.write_string(context.file2v(bname, fbytes, max_bname)) ?
137137
}
138-
out_file.write_str(context.footer()) ?
138+
out_file.write_string(context.footer()) ?
139139
} else {
140140
print(context.header())
141141
for bname, fbytes in file_byte_map {

cmd/tools/vcreate.v

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ fn (c &Create) write_vmod(new bool) {
7777
cerror(err.msg)
7878
exit(1)
7979
}
80-
vmod.write_str(vmod_content(c)) or { panic(err) }
80+
vmod.write_string(vmod_content(c)) or { panic(err) }
8181
vmod.close()
8282
}
8383

@@ -90,7 +90,7 @@ fn (c &Create) write_main(new bool) {
9090
cerror(err.msg)
9191
exit(2)
9292
}
93-
mainfile.write_str(main_content()) or { panic(err) }
93+
mainfile.write_string(main_content()) or { panic(err) }
9494
mainfile.close()
9595
}
9696

@@ -107,7 +107,7 @@ fn (c &Create) create_git_repo(dir string) {
107107
// We don't really need a .gitignore, it's just a nice-to-have
108108
return
109109
}
110-
fl.write_str(gen_gitignore(c.name)) or { panic(err) }
110+
fl.write_string(gen_gitignore(c.name)) or { panic(err) }
111111
fl.close()
112112
}
113113
}

cmd/tools/vtest-cleancode.v

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ const (
99
vet_folders = [
1010
'vlib/sqlite',
1111
'vlib/v',
12+
'vlib/x/ttf/',
1213
'cmd/v',
1314
'cmd/tools',
1415
'examples/2048',

examples/buf_reader.v

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ fn main() {
77
// Make a new connection
88
mut conn := net.dial_tcp('google.com:80') ?
99
// Simple http HEAD request for a file
10-
conn.write_str('GET /index.html HTTP/1.0\r\n\r\n') ?
10+
conn.write_string('GET /index.html HTTP/1.0\r\n\r\n') ?
1111
// Wrap in a buffered reader
1212
mut r := io.new_buffered_reader(reader: io.make_reader(conn))
1313
for {

examples/net_raw_http.v

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ fn main() {
55
// Make a new connection
66
mut conn := net.dial_tcp('google.com:80') ?
77
defer {
8-
conn.close() or { }
8+
conn.close() or {}
99
}
1010
// Simple http HEAD request for a file
11-
conn.write_str('HEAD /index.html HTTP/1.0\r\n\r\n') ?
11+
conn.write_string('HEAD /index.html HTTP/1.0\r\n\r\n') ?
1212
// Read all the data that is waiting
1313
result := io.read_all(reader: conn) ?
1414
// Cast to string and print result

examples/path_tracing.v

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ fn (image Image) save_as_ppm(file_name string) {
106106
c_r := to_int(unsafe { image.data[i] }.x)
107107
c_g := to_int(unsafe { image.data[i] }.y)
108108
c_b := to_int(unsafe { image.data[i] }.z)
109-
f_out.write_str('$c_r $c_g $c_b ') or { panic(err) }
109+
f_out.write_string('$c_r $c_g $c_b ') or { panic(err) }
110110
}
111111
f_out.close()
112112
}

vlib/x/ttf/common.v

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ fn (mut bmp BitMap) format_texture() {
8787
// write out a .ppm file
8888
pub fn (mut bmp BitMap) save_as_ppm(file_name string) {
8989
tmp_buf := bmp.buf
90-
mut buf := unsafe {malloc(bmp.buf_size)}
90+
mut buf := unsafe { malloc(bmp.buf_size) }
9191
unsafe { C.memcpy(buf, tmp_buf, bmp.buf_size) }
9292
bmp.buf = buf
9393

@@ -103,7 +103,7 @@ pub fn (mut bmp BitMap) save_as_ppm(file_name string) {
103103
c_r := bmp.buf[pos]
104104
c_g := bmp.buf[pos + 1]
105105
c_b := bmp.buf[pos + 2]
106-
f_out.write_str('$c_r $c_g $c_b ') or { panic(err) }
106+
f_out.write_string('$c_r $c_g $c_b ') or { panic(err) }
107107
}
108108
}
109109
f_out.close()

vlib/x/ttf/render_bmp.v

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -800,8 +800,8 @@ pub fn (mut bmp BitMap) draw_glyph(index u16) (int, int) {
800800

801801
// bmp.line(x0, y0, start_point.x, start_point.y, u32(0x00FF0000)
802802
// u32(0xFF000000))
803-
bmp.quadratic(x0, y0, start_point.x, start_point.y, (point.x +
804-
start_point.x) / 2, (point.y + start_point.y) / 2, color)
803+
bmp.quadratic(x0, y0, start_point.x, start_point.y, (point.x + start_point.x) / 2,
804+
(point.y + start_point.y) / 2, color)
805805
}
806806
} else {
807807
// last point not in a curve

vlib/x/ttf/render_sokol_cpu.v

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,10 @@ pub fn (mut tf_skl TTF_render_Sokol) create_text(in_txt string, in_font_size f32
5353
// RAM buffer
5454
if sz > tf_skl.bmp.buf_size {
5555
if sz > 0 {
56-
unsafe {free(tf_skl.bmp.buf)}
56+
unsafe { free(tf_skl.bmp.buf) }
5757
}
5858
dprintln('create_text Alloc: $sz bytes')
59-
tf_skl.bmp.buf = unsafe {malloc(sz)}
59+
tf_skl.bmp.buf = unsafe { malloc(sz) }
6060
tf_skl.bmp.buf_size = sz
6161
}
6262

@@ -91,10 +91,10 @@ pub fn (mut tf_skl TTF_render_Sokol) create_text_block(in_txt string, in_w int,
9191
// RAM buffer
9292
if sz > tf_skl.bmp.buf_size {
9393
if sz > 0 {
94-
unsafe {free(tf_skl.bmp.buf)}
94+
unsafe { free(tf_skl.bmp.buf) }
9595
}
9696
dprintln('Alloc: $sz bytes')
97-
tf_skl.bmp.buf = unsafe {malloc(sz)}
97+
tf_skl.bmp.buf = unsafe { malloc(sz) }
9898
tf_skl.bmp.buf_size = sz
9999
}
100100

vlib/x/ttf/ttf.v

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -519,8 +519,8 @@ fn (mut tf TTF_File) get_fword() i16 {
519519
}
520520

521521
fn (mut tf TTF_File) get_u32() u32 {
522-
x := (u32(tf.buf[tf.pos]) << u32(24)) | (u32(tf.buf[tf.pos +
523-
1]) << u32(16)) | (u32(tf.buf[tf.pos + 2]) << u32(8)) | u32(tf.buf[tf.pos + 3])
522+
x := (u32(tf.buf[tf.pos]) << u32(24)) | (u32(tf.buf[tf.pos + 1]) << u32(16)) | (u32(tf.buf[
523+
tf.pos + 2]) << u32(8)) | u32(tf.buf[tf.pos + 3])
524524
tf.pos += 4
525525
return x
526526
}

0 commit comments

Comments
 (0)