diff --git a/libretro-common/vfs/vfs_implementation_uwp.cpp b/libretro-common/vfs/vfs_implementation_uwp.cpp index b78d4b96ed..86435ee14c 100644 --- a/libretro-common/vfs/vfs_implementation_uwp.cpp +++ b/libretro-common/vfs/vfs_implementation_uwp.cpp @@ -119,35 +119,38 @@ namespace { /* Damn you, UWP, why no functions for that either */ template - concurrency::task GetItemFromPathAsync(Platform::String^ path) + static concurrency::task GetItemFromPathAsync(Platform::String^ path) { static_assert(false, "StorageFile and StorageFolder only"); } + template<> - concurrency::task GetItemFromPathAsync(Platform::String^ path) + static concurrency::task GetItemFromPathAsync(Platform::String^ path) { return concurrency::create_task(StorageFile::GetFileFromPathAsync(path)); } template<> - concurrency::task GetItemFromPathAsync(Platform::String^ path) + static concurrency::task GetItemFromPathAsync(Platform::String^ path) { return concurrency::create_task(StorageFolder::GetFolderFromPathAsync(path)); } template - concurrency::task GetItemInFolderFromPathAsync(StorageFolder^ folder, Platform::String^ path) + static concurrency::task GetItemInFolderFromPathAsync(StorageFolder^ folder, Platform::String^ path) { static_assert(false, "StorageFile and StorageFolder only"); } + template<> - concurrency::task GetItemInFolderFromPathAsync(StorageFolder^ folder, Platform::String^ path) + static concurrency::task GetItemInFolderFromPathAsync(StorageFolder^ folder, Platform::String^ path) { if (path->IsEmpty()) retro_assert(false); /* Attempt to read a folder as a file - this really should have been caught earlier */ return concurrency::create_task(folder->GetFileAsync(path)); } + template<> - concurrency::task GetItemInFolderFromPathAsync(StorageFolder^ folder, Platform::String^ path) + static concurrency::task GetItemInFolderFromPathAsync(StorageFolder^ folder, Platform::String^ path) { if (path->IsEmpty()) return concurrency::create_task(concurrency::create_async([folder]() { return folder; })); @@ -242,8 +245,7 @@ namespace else { /* No final slash - probably a file (since RetroArch usually slash-terminates dirs), but there is still a chance it's a directory */ - IStorageItem^ item; - item = RunAsyncAndCatchErrors([=]() { + IStorageItem ^item = RunAsyncAndCatchErrors([=]() { return concurrency::create_task(LocateStorageItem(path)); }, nullptr); if (!item) @@ -420,9 +422,10 @@ public: HRESULT __stdcall RuntimeClassInitialize(byte *buffer, uint32_t capacity, uint32_t length) { - m_buffer = buffer; + m_buffer = buffer; m_capacity = capacity; - m_length = length; + m_length = length; + return S_OK; } @@ -465,7 +468,7 @@ IBuffer^ CreateNativeBuffer(void* buf, uint32_t capacity, uint32_t length) Microsoft::WRL::ComPtr nativeBuffer; Microsoft::WRL::Details::MakeAndInitialize(&nativeBuffer, (byte *)buf, capacity, length); auto iinspectable = (IInspectable *)reinterpret_cast(nativeBuffer.Get()); - IBuffer ^buffer = reinterpret_cast(iinspectable); + IBuffer ^buffer = reinterpret_cast(iinspectable); return buffer; } @@ -535,6 +538,7 @@ int retro_vfs_file_rename_impl(const char *old_path, const char *new_path) { wchar_t *old_path_wide = NULL; wchar_t *new_dir_path_wide = NULL; + wchar_t *new_file_name_wide = NULL; char *new_dir_path = NULL; char *new_file_name = NULL; @@ -555,7 +559,7 @@ int retro_vfs_file_rename_impl(const char *old_path, const char *new_path) new_file_name = (char*)malloc(PATH_MAX_LENGTH * sizeof(char)); fill_pathname_base(new_file_name, new_path, PATH_MAX_LENGTH); - wchar_t *new_file_name_wide = utf8_to_utf16_string_alloc(new_file_name); + new_file_name_wide = utf8_to_utf16_string_alloc(new_file_name); Platform::String^ new_file_name_str = ref new Platform::String(new_file_name_wide); free(new_file_name_wide); free(new_file_name);