GC'ed wide strings for windows
This commit is contained in:
parent
a23d418d78
commit
baf89e3d66
7 changed files with 155 additions and 297 deletions
|
|
@ -168,18 +168,14 @@ when defined(windows) and not defined(useWinAnsi):
|
|||
importc: "_wfreopen", nodecl.}
|
||||
|
||||
proc fopen(filename, mode: CString): pointer =
|
||||
var f = allocWideCString(filename)
|
||||
var m = allocWideCString(mode)
|
||||
var f = newWideCString(filename)
|
||||
var m = newWideCString(mode)
|
||||
result = wfopen(f, m)
|
||||
dealloc m
|
||||
dealloc f
|
||||
|
||||
proc freopen(filename, mode: cstring, stream: TFile): TFile =
|
||||
var f = allocWideCString(filename)
|
||||
var m = allocWideCString(mode)
|
||||
var f = newWideCString(filename)
|
||||
var m = newWideCString(mode)
|
||||
result = wfreopen(f, m, stream)
|
||||
dealloc m
|
||||
dealloc f
|
||||
|
||||
else:
|
||||
proc fopen(filename, mode: CString): pointer {.importc: "fopen", noDecl.}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue