mirror of https://github.com/status-im/nim-eth.git
make some safe cstring conversions explicit (#515)
This commit is contained in:
parent
5c0893bfb6
commit
6e813353eb
|
@ -522,7 +522,7 @@ proc init*(
|
||||||
except OSError, IOError:
|
except OSError, IOError:
|
||||||
return err("sqlite: cannot create database directory")
|
return err("sqlite: cannot create database directory")
|
||||||
|
|
||||||
checkErr sqlite3_open_v2(name, addr env.val, flags.cint, nil)
|
checkErr sqlite3_open_v2(cstring name, addr env.val, flags.cint, nil)
|
||||||
|
|
||||||
template checkWalPragmaResult(journalModePragma: ptr sqlite3_stmt) =
|
template checkWalPragmaResult(journalModePragma: ptr sqlite3_stmt) =
|
||||||
if (let x = sqlite3_step(journalModePragma); x != SQLITE_ROW):
|
if (let x = sqlite3_step(journalModePragma); x != SQLITE_ROW):
|
||||||
|
@ -533,7 +533,7 @@ proc init*(
|
||||||
discard sqlite3_finalize(journalModePragma)
|
discard sqlite3_finalize(journalModePragma)
|
||||||
return err($sqlite3_errstr(x))
|
return err($sqlite3_errstr(x))
|
||||||
|
|
||||||
if (let x = sqlite3_column_text(journalModePragma, 0);
|
if (let x = cstring sqlite3_column_text(journalModePragma, 0);
|
||||||
x != "memory" and x != "wal"):
|
x != "memory" and x != "wal"):
|
||||||
discard sqlite3_finalize(journalModePragma)
|
discard sqlite3_finalize(journalModePragma)
|
||||||
return err("Invalid pragma result: " & $x)
|
return err("Invalid pragma result: " & $x)
|
||||||
|
|
Loading…
Reference in New Issue