From 5a79a54fe47f564cadb5b1b24a4de9f270812582 Mon Sep 17 00:00:00 2001 From: yuyi Date: Sun, 26 Jun 2022 22:04:23 +0800 Subject: [PATCH] all: fix all remaining unsafe 0 (#14856) --- examples/term.ui/event_viewer.v | 2 +- examples/term.ui/pong.v | 2 +- examples/term.ui/rectangles.v | 2 +- examples/term.ui/term_drawing.v | 2 +- examples/term.ui/text_editor.v | 4 ++-- examples/term.ui/vyper.v | 2 +- vlib/net/html/tag.v | 2 +- vlib/picohttpparser/response.v | 2 +- vlib/x/ttf/render_bmp.v | 2 +- 9 files changed, 10 insertions(+), 10 deletions(-) diff --git a/examples/term.ui/event_viewer.v b/examples/term.ui/event_viewer.v index 75f9d3933..d7608fead 100644 --- a/examples/term.ui/event_viewer.v +++ b/examples/term.ui/event_viewer.v @@ -2,7 +2,7 @@ import term.ui as tui struct App { mut: - tui &tui.Context = 0 + tui &tui.Context = unsafe { 0 } } fn event(e &tui.Event, x voidptr) { diff --git a/examples/term.ui/pong.v b/examples/term.ui/pong.v index a95a40b5b..dd735e189 100644 --- a/examples/term.ui/pong.v +++ b/examples/term.ui/pong.v @@ -242,7 +242,7 @@ fn (mut b Ball) update(dt f32) { [heap] struct Game { mut: - app &App = 0 + app &App = unsafe { 0 } players []Player ball Ball } diff --git a/examples/term.ui/rectangles.v b/examples/term.ui/rectangles.v index 36c0aa7c6..63c4757f4 100644 --- a/examples/term.ui/rectangles.v +++ b/examples/term.ui/rectangles.v @@ -12,7 +12,7 @@ mut: struct App { mut: - tui &tui.Context = 0 + tui &tui.Context = unsafe { 0 } rects []Rect cur_rect Rect is_drag bool diff --git a/examples/term.ui/term_drawing.v b/examples/term.ui/term_drawing.v index d04904230..aff91a015 100644 --- a/examples/term.ui/term_drawing.v +++ b/examples/term.ui/term_drawing.v @@ -90,7 +90,7 @@ const ( struct App { mut: - ui &ui.Context = 0 + ui &ui.Context = unsafe { 0 } header_text []string mouse_pos Point msg string diff --git a/examples/term.ui/text_editor.v b/examples/term.ui/text_editor.v index fd4dd24e3..50cb14093 100644 --- a/examples/term.ui/text_editor.v +++ b/examples/term.ui/text_editor.v @@ -57,8 +57,8 @@ pub: struct App { mut: - tui &tui.Context = 0 - ed &Buffer = 0 + tui &tui.Context = unsafe { 0 } + ed &Buffer = unsafe { 0 } current_file int files []string status string diff --git a/examples/term.ui/vyper.v b/examples/term.ui/vyper.v index eedcde668..4f09554a2 100644 --- a/examples/term.ui/vyper.v +++ b/examples/term.ui/vyper.v @@ -259,7 +259,7 @@ fn (mut r Rat) randomize() { [heap] struct App { mut: - termui &termui.Context = 0 + termui &termui.Context = unsafe { 0 } snake Snake rat Rat width int diff --git a/vlib/net/html/tag.v b/vlib/net/html/tag.v index 355dfcee4..c66cde03c 100644 --- a/vlib/net/html/tag.v +++ b/vlib/net/html/tag.v @@ -16,7 +16,7 @@ pub mut: children []&Tag attributes map[string]string // attributes will be like map[name]value last_attribute string - parent &Tag = 0 + parent &Tag = unsafe { 0 } position_in_parent int closed bool close_type CloseTagType = .in_name diff --git a/vlib/picohttpparser/response.v b/vlib/picohttpparser/response.v index 2e4907482..e0ff045ba 100644 --- a/vlib/picohttpparser/response.v +++ b/vlib/picohttpparser/response.v @@ -6,7 +6,7 @@ pub: date &u8 = unsafe { 0 } buf_start &u8 = unsafe { 0 } pub mut: - buf &u8 = 0 + buf &u8 = unsafe { 0 } } [inline] diff --git a/vlib/x/ttf/render_bmp.v b/vlib/x/ttf/render_bmp.v index 4ed137bc4..b98fb6cc2 100644 --- a/vlib/x/ttf/render_bmp.v +++ b/vlib/x/ttf/render_bmp.v @@ -19,7 +19,7 @@ import math pub struct BitMap { pub mut: tf &TTF_File - buf &u8 = 0 // pointer to the memory buffer + buf &u8 = unsafe { 0 } // pointer to the memory buffer buf_size int // allocated buf size in bytes width int = 1 // width of the buffer height int = 1 // height of the buffer -- 2.30.2