From fedc5f8e6f38c3326fe257009736233d79e1fd2e Mon Sep 17 00:00:00 2001 From: LunaTheFoxgirl Date: Sun, 15 Dec 2024 21:37:37 +0100 Subject: [PATCH] More env fixes for Win32 --- source/numem/env.d | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/numem/env.d b/source/numem/env.d index e60aa86..b97e595 100644 --- a/source/numem/env.d +++ b/source/numem/env.d @@ -71,14 +71,14 @@ nstring nuGetEnvironmentVariable(nstring key) @nogc { // Try getting the size of the env var. // if this fails, the env var is probably empty. - uint bufSize = GetEnvironmentVariableW(utf16k.ptr, null, 0); + uint bufSize = GetEnvironmentVariableW(cast(wchar*)utf16k.ptr, null, 0); if (bufSize == 0) return nstring.init; // Windows includes the null terminator, but n*string does too // so to not have 2 null terminators, subtract 1. nwstring envstr = nwstring(bufSize-1); - bufSize = GetEnvironmentVariableW(cast(wchar*)utf16k.ptr, cast(wchar*)envstr.ptr, envstr.length+1); + bufSize = GetEnvironmentVariableW(cast(wchar*)utf16k.ptr, cast(wchar*)envstr.ptr, cast(uint)envstr.length+1); nogc_delete(utf16k); return envstr.toUTF8;