Filesystem stuff on Windows
Minor image acquire/present refactor Unsigned integer limits Fixed typo in arena push/push copy macro
This commit is contained in:
@@ -1,3 +1,19 @@
|
||||
// Windows utilities
|
||||
|
||||
internal Str8 Win32_WideStr(M_Arena *arena, Str8 v) {
|
||||
Str8 result = { 0 };
|
||||
|
||||
S32 nchars = MultiByteToWideChar(CP_UTF8, 0, (LPCCH) v.data, (int) v.count, 0, 0) + 1;
|
||||
U64 nbytes = nchars << 1;
|
||||
|
||||
result.count = nbytes - 2; // -2 because we don't include the null-terminator in the count
|
||||
result.data = M_ArenaPush(arena, U8, .count = nbytes);
|
||||
|
||||
MultiByteToWideChar(CP_UTF8, 0, (LPCCH) v.data, (int) v.count, (LPWSTR) result.data, nchars);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
// Virtual memory
|
||||
|
||||
U64 VM_PageSize() {
|
||||
@@ -36,3 +52,4 @@ void VM_Release(void *base, U64 size) {
|
||||
VirtualFree(base, 0, MEM_RELEASE);
|
||||
}
|
||||
|
||||
#include "filesystem.c"
|
||||
|
||||
Reference in New Issue
Block a user