mirror of
https://github.com/vlang/v.git
synced 2025-09-13 14:32:26 +03:00
parser: warn when fixed-size ArrayInit doesn't have trailing {}
. (#6137)
This commit is contained in:
parent
a02593204f
commit
bab5c21224
15 changed files with 27 additions and 28 deletions
|
@ -130,7 +130,7 @@ pub fn (ctx &Context) text_width(s string) int {
|
|||
if !ctx.font_inited {
|
||||
return 0
|
||||
}
|
||||
mut buf := [4]f32
|
||||
mut buf := [4]f32{}
|
||||
C.fonsTextBounds(ctx.ft.fons, 0, 0, s.str, 0, buf)
|
||||
return int((buf[2] - buf[0]) / ctx.scale)
|
||||
}
|
||||
|
@ -139,7 +139,7 @@ pub fn (ctx &Context) text_height(s string) int {
|
|||
if !ctx.font_inited {
|
||||
return 0
|
||||
}
|
||||
mut buf := [4]f32
|
||||
mut buf := [4]f32{}
|
||||
C.fonsTextBounds(ctx.ft.fons, 0, 0, s.str, 0, buf)
|
||||
return int((buf[3] - buf[1]) / ctx.scale)
|
||||
}
|
||||
|
@ -148,7 +148,7 @@ pub fn (ctx &Context) text_size(s string) (int, int) {
|
|||
if !ctx.font_inited {
|
||||
return 0,0
|
||||
}
|
||||
mut buf := [4]f32
|
||||
mut buf := [4]f32{}
|
||||
C.fonsTextBounds(ctx.ft.fons, 0, 0, s.str, 0, buf)
|
||||
return int((buf[2] - buf[0]) / ctx.scale), int((buf[3] - buf[1]) / ctx.scale)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue