diff options
| author | Egor Yusov <egor.yusov@gmail.com> | 2019-05-05 00:20:51 +0000 |
|---|---|---|
| committer | Egor Yusov <egor.yusov@gmail.com> | 2019-05-05 00:20:51 +0000 |
| commit | 4d210f06a2c19f1c8ad2f6879177ff8e52f48224 (patch) | |
| tree | e34681d114226f9b9680b5d7f1b33a9bcf79438c | |
| parent | Updated File2String windows binaries (diff) | |
| download | DiligentCore-4d210f06a2c19f1c8ad2f6879177ff8e52f48224.tar.gz DiligentCore-4d210f06a2c19f1c8ad2f6879177ff8e52f48224.zip | |
Fixed overload of WindowsStoreFile::Read() function
| -rw-r--r-- | Platforms/UWP/src/UWPFileSystem.cpp | 22 |
1 files 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<DWORD>(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<DWORD>(pData->GetSize()), - nullptr, - nullptr - )) + if (!Read(pData->GetDataPtr(), pData->GetSize())) { LOG_ERROR_AND_THROW( "Failed to read data from file" ); } |
