mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
examples: fix compilation with -prod
This commit is contained in:
@@ -56,7 +56,7 @@ pub fn (mut bmp BitMap) draw_text_block(text string, block Text_block) {
|
||||
|
||||
for txt in text.split_into_lines() {
|
||||
bmp.space_cw = old_space_cw
|
||||
mut w, mut h := bmp.get_bbox(txt)
|
||||
mut w, _ := bmp.get_bbox(txt)
|
||||
if w <= block.w || block.cut_lines == false {
|
||||
// println("Solid block!")
|
||||
left_offset := int((block.w - w) * offset_flag)
|
||||
@@ -83,13 +83,13 @@ pub fn (mut bmp BitMap) draw_text_block(text string, block Text_block) {
|
||||
}
|
||||
|
||||
bmp.space_cw = old_space_cw
|
||||
w, h = bmp.get_bbox(tmp_str)
|
||||
w, _ = bmp.get_bbox(tmp_str)
|
||||
if w <= block.w {
|
||||
mut left_offset := int((block.w - w) * offset_flag)
|
||||
if bmp.justify && (f32(w) / f32(block.w)) >= bmp.justify_fill_ratio {
|
||||
// println("cut phase!")
|
||||
bmp.space_cw = 0.0
|
||||
w, h = bmp.get_bbox(tmp_str)
|
||||
w, _ = bmp.get_bbox(tmp_str)
|
||||
left_offset = int((block.w - w) * offset_flag)
|
||||
bmp.space_cw = bmp.get_justify_space_cw(tmp_str, w, block.w, space_cw)
|
||||
} else {
|
||||
|
||||
@@ -334,14 +334,14 @@ pub fn (mut ws Client) close(code int, message string) ? {
|
||||
ws.reset_state()
|
||||
}
|
||||
ws.set_state(.closing)
|
||||
mut code32 := 0
|
||||
// mut code32 := 0
|
||||
if code > 0 {
|
||||
code_ := C.htons(code)
|
||||
message_len := message.len + 2
|
||||
mut close_frame := []byte{len: message_len}
|
||||
close_frame[0] = byte(code_ & 0xFF)
|
||||
close_frame[1] = byte(code_ >> 8)
|
||||
code32 = (close_frame[0] << 8) + close_frame[1]
|
||||
// code32 = (close_frame[0] << 8) + close_frame[1]
|
||||
for i in 0 .. message.len {
|
||||
close_frame[i + 2] = message[i]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user