From 4d210f06a2c19f1c8ad2f6879177ff8e52f48224 Mon Sep 17 00:00:00 2001 From: Egor Yusov Date: Sat, 4 May 2019 17:20:51 -0700 Subject: Fixed overload of WindowsStoreFile::Read() function --- Platforms/UWP/src/UWPFileSystem.cpp | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/Platforms/UWP/src/UWPFileSystem.cpp b/Platforms/UWP/src/UWPFileSystem.cpp index 55bf4d20..b6e9e9f0 100644 --- a/Platforms/UWP/src/UWPFileSystem.cpp +++ b/Platforms/UWP/src/UWPFileSystem.cpp @@ -115,9 +115,19 @@ WindowsStoreFile::~WindowsStoreFile() bool WindowsStoreFile::Read( void *Data, size_t BufferSize ) { - UNSUPPORTED( "Not implemented" ); + DWORD BytesRead = 0; + if (!ReadFile( + m_FileHandle->FH.Get(), + Data, + static_cast(BufferSize), + &BytesRead, + nullptr + )) + { + return false; + } - return false; + return BytesRead == BufferSize; } size_t WindowsStoreFile::GetSize() @@ -145,13 +155,7 @@ void WindowsStoreFile::Read( Diligent::IDataBlob *pData ) { pData->Resize( GetSize() ); - if (!ReadFile( - m_FileHandle->FH.Get(), - pData->GetDataPtr(), - static_cast(pData->GetSize()), - nullptr, - nullptr - )) + if (!Read(pData->GetDataPtr(), pData->GetSize())) { LOG_ERROR_AND_THROW( "Failed to read data from file" ); } -- cgit v1.2.3