mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-06 23:58:50 +00:00
os2: Resolve temp allocator collisions
This commit is contained in:
@@ -14,7 +14,9 @@ find_data_to_file_info :: proc(base_path: string, d: ^win32.WIN32_FIND_DATAW, al
|
||||
if d.cFileName[0] == '.' && d.cFileName[1] == '.' && d.cFileName[2] == 0 {
|
||||
return
|
||||
}
|
||||
path := concatenate({base_path, `\`, win32_wstring_to_utf8(raw_data(d.cFileName[:]), temp_allocator()) or_else ""}, allocator) or_return
|
||||
|
||||
temp_allocator := get_temp_allocator(TEMP_ALLOCATOR_GUARD({ allocator }))
|
||||
path := concatenate({base_path, `\`, win32_wstring_to_utf8(raw_data(d.cFileName[:]), temp_allocator) or_else ""}, allocator) or_return
|
||||
|
||||
handle := win32.HANDLE(_open_internal(path, {.Read}, 0o666) or_else 0)
|
||||
defer win32.CloseHandle(handle)
|
||||
@@ -49,7 +51,7 @@ Read_Directory_Iterator_Impl :: struct {
|
||||
|
||||
@(require_results)
|
||||
_read_directory_iterator :: proc(it: ^Read_Directory_Iterator) -> (fi: File_Info, index: int, ok: bool) {
|
||||
TEMP_ALLOCATOR_GUARD()
|
||||
temp_allocator := get_temp_allocator(TEMP_ALLOCATOR_GUARD({}))
|
||||
|
||||
for !it.impl.no_more_files {
|
||||
err: Error
|
||||
@@ -116,9 +118,9 @@ _read_directory_iterator_init :: proc(it: ^Read_Directory_Iterator, f: ^File) {
|
||||
wpath = impl.wname[:i]
|
||||
}
|
||||
|
||||
TEMP_ALLOCATOR_GUARD()
|
||||
temp_allocator := get_temp_allocator(TEMP_ALLOCATOR_GUARD({}))
|
||||
|
||||
wpath_search := make([]u16, len(wpath)+3, temp_allocator())
|
||||
wpath_search := make([]u16, len(wpath)+3, temp_allocator)
|
||||
copy(wpath_search, wpath)
|
||||
wpath_search[len(wpath)+0] = '\\'
|
||||
wpath_search[len(wpath)+1] = '*'
|
||||
|
||||
Reference in New Issue
Block a user