review fixes
This commit is contained in:
@@ -7,9 +7,9 @@
|
||||
#include "Utils.hpp"
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#include <Windows.h>
|
||||
#include <Windows.h>
|
||||
#else
|
||||
#include <pthread.h>
|
||||
#include <pthread.h>
|
||||
#endif
|
||||
#include <fstream>
|
||||
#include <string>
|
||||
@@ -57,7 +57,7 @@ namespace OpenVulkano
|
||||
#ifdef _MSC_VER
|
||||
return (uint64_t)::GetThreadId(::GetCurrentThread());
|
||||
#else
|
||||
return (uint64_t)pthread_self();
|
||||
return (uint64_t) pthread_self();
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -69,8 +69,16 @@ namespace OpenVulkano
|
||||
if (emptyOnMissing) return {};
|
||||
throw std::runtime_error("Failed to open file '" + filePath + "'!");
|
||||
}
|
||||
size_t fileSize = static_cast<size_t>(file.tellg());
|
||||
if (nullTerminateString) fileSize++;
|
||||
const size_t fileSize = static_cast<size_t>(file.tellg());
|
||||
if (nullTerminateString)
|
||||
{
|
||||
Array<char> data(fileSize + 1);
|
||||
file.seekg(0);
|
||||
file.read(data.Data(), fileSize);
|
||||
data[fileSize] = '\0';
|
||||
file.close();
|
||||
return data;
|
||||
}
|
||||
|
||||
Array<char> data(fileSize);
|
||||
file.seekg(0);
|
||||
|
||||
Reference in New Issue
Block a user