fix all Foo{!}

pull/2973/head
Alexander Medvednikov 2019-12-04 13:08:28 +03:00
parent e32cbfcca7
commit 40df0644ca
4 changed files with 11 additions and 11 deletions

View File

@ -70,13 +70,13 @@ pub mut:
// fn new_context(width, height int, use_ortho bool, font_size int) *GG { // fn new_context(width, height int, use_ortho bool, font_size int) *GG {
pub fn new_context(cfg Cfg) &GG { pub fn new_context(cfg Cfg) &GG {
mut window := &glfw.Window{!} mut window := &glfw.Window(0)
if cfg.create_window { if cfg.create_window {
if cfg.resizable { if cfg.resizable {
glfw.window_hint(C.GLFW_RESIZABLE, 1) glfw.window_hint(C.GLFW_RESIZABLE, 1)
} else { } else {
glfw.window_hint(C.GLFW_RESIZABLE, 0) glfw.window_hint(C.GLFW_RESIZABLE, 0)
} }
window = glfw.create_window(glfw.WinCfg{ window = glfw.create_window(glfw.WinCfg{
title: cfg.window_title title: cfg.window_title
width: cfg.width width: cfg.width

View File

@ -73,7 +73,7 @@ fn (req &Request) ssl_do(port int, method, host_name, path string) ?Response {
res = C.BIO_set_conn_hostname(web, addr.str) res = C.BIO_set_conn_hostname(web, addr.str)
if res != 1 { if res != 1 {
} }
ssl := &C.SSL{!} ssl := &C.SSL(0)
C.BIO_get_ssl(web, &ssl) C.BIO_get_ssl(web, &ssl)
if isnil(ssl) { if isnil(ssl) {
} }

View File

@ -29,7 +29,7 @@ mut:
ai_socktype int ai_socktype int
ai_flags int ai_flags int
ai_protocol int ai_protocol int
ai_addrlen int ai_addrlen int
ai_addr voidptr ai_addr voidptr
ai_canonname voidptr ai_canonname voidptr
ai_next voidptr ai_next voidptr
@ -174,9 +174,9 @@ pub fn (s Socket) connect(address string, port int) ?int {
hints.ai_canonname = C.NULL hints.ai_canonname = C.NULL
hints.ai_addr = C.NULL hints.ai_addr = C.NULL
hints.ai_next = C.NULL hints.ai_next = C.NULL
info := &C.addrinfo{!}
info := &C.addrinfo(0)
sport := '$port' sport := '$port'
info_res := C.getaddrinfo(address.str, sport.str, &hints, &info) info_res := C.getaddrinfo(address.str, sport.str, &hints, &info)
if info_res != 0 { if info_res != 0 {

View File

@ -19,13 +19,13 @@ pub mut:
} }
pub fn connect(path string) DB { pub fn connect(path string) DB {
db := &C.sqlite3{!} db := &C.sqlite3(0)
C.sqlite3_open(path.str, &db) C.sqlite3_open(path.str, &db)
return DB {conn: db} return DB {conn: db}
} }
pub fn (db DB) q_int(query string) int { pub fn (db DB) q_int(query string) int {
stmt := &C.sqlite3_stmt{!} stmt := &C.sqlite3_stmt(0)
C.sqlite3_prepare_v2(db.conn, query.str, - 1, &stmt, 0) C.sqlite3_prepare_v2(db.conn, query.str, - 1, &stmt, 0)
C.sqlite3_step(stmt) C.sqlite3_step(stmt)
res := C.sqlite3_column_int(stmt, 0) res := C.sqlite3_column_int(stmt, 0)
@ -41,7 +41,7 @@ fn C.sqlite3_prepare_v2()
fn C.sqlite3_finalize() fn C.sqlite3_finalize()
pub fn (db DB) q_string(query string) string { pub fn (db DB) q_string(query string) string {
stmt := &C.sqlite3_stmt{!} stmt := &C.sqlite3_stmt(0)
C.sqlite3_prepare_v2(db.conn, query.str, - 1, &stmt, 0) C.sqlite3_prepare_v2(db.conn, query.str, - 1, &stmt, 0)
C.sqlite3_step(stmt) C.sqlite3_step(stmt)
f := C.sqlite3_column_text(stmt, 0) f := C.sqlite3_column_text(stmt, 0)
@ -53,7 +53,7 @@ pub fn (db DB) q_string(query string) string {
fn C.sqlite3_column_count(voidptr) int fn C.sqlite3_column_count(voidptr) int
pub fn (db DB) exec(query string) []Row { pub fn (db DB) exec(query string) []Row {
stmt := &C.sqlite3_stmt{!} stmt := &C.sqlite3_stmt(0)
C.sqlite3_prepare_v2(db.conn, query.str, - 1, &stmt, 0) C.sqlite3_prepare_v2(db.conn, query.str, - 1, &stmt, 0)
nr_cols := C.sqlite3_column_count(stmt) nr_cols := C.sqlite3_column_count(stmt)
//println('nr cols $nr_cols') //println('nr cols $nr_cols')
@ -62,7 +62,7 @@ pub fn (db DB) exec(query string) []Row {
ret := C.sqlite3_step(stmt) ret := C.sqlite3_step(stmt)
if ret != 0x64 { if ret != 0x64 {
break break
} }
mut row := Row{} mut row := Row{}
for i in 0..nr_cols { for i in 0..nr_cols {
val := tos_clone(C.sqlite3_column_text(stmt, i)) val := tos_clone(C.sqlite3_column_text(stmt, i))