xenia-base: Use unique_ptr constructor rather than make_unique to support GCC 4.8.4

This commit is contained in:
Dr. Chat 2017-05-12 10:17:56 -05:00
parent 56d727a024
commit af493ffbc7
3 changed files with 7 additions and 4 deletions

View File

@ -33,7 +33,8 @@ class MappedMemory {
virtual ~MappedMemory() = default; virtual ~MappedMemory() = default;
std::unique_ptr<MappedMemory> Slice(Mode mode, size_t offset, size_t length) { std::unique_ptr<MappedMemory> Slice(Mode mode, size_t offset, size_t length) {
return std::make_unique<MappedMemory>(path_, mode, data() + offset, length); return std::unique_ptr<MappedMemory>(
new MappedMemory(path_, mode, data() + offset, length));
} }
uint8_t* data() const { return reinterpret_cast<uint8_t*>(data_); } uint8_t* data() const { return reinterpret_cast<uint8_t*>(data_); }

View File

@ -50,7 +50,8 @@ std::unique_ptr<MappedMemory> MappedMemory::Open(const std::wstring& path,
break; break;
} }
auto mm = std::make_unique<PosixMappedMemory>(path, mode); auto mm =
std::unique_ptr<PosixMappedMemory>(new PosixMappedMemory(path, mode));
mm->file_handle = fopen(xe::to_string(path).c_str(), mode_str); mm->file_handle = fopen(xe::to_string(path).c_str(), mode_str);
if (!mm->file_handle) { if (!mm->file_handle) {

View File

@ -112,7 +112,8 @@ struct ThreadStartData {
std::function<void()> start_routine; std::function<void()> start_routine;
}; };
void* ThreadStartRoutine(void* parameter) { void* ThreadStartRoutine(void* parameter) {
current_thread_ = std::make_unique<PosixThread>(::pthread_self()); current_thread_ =
std::unique_ptr<PosixThread>(new PosixThread(::pthread_self()));
auto start_data = reinterpret_cast<ThreadStartData*>(parameter); auto start_data = reinterpret_cast<ThreadStartData*>(parameter);
start_data->start_routine(); start_data->start_routine();
@ -137,7 +138,7 @@ std::unique_ptr<Thread> Thread::Create(CreationParameters params,
return nullptr; return nullptr;
} }
return std::make_unique<PosixThread>(handle); return std::unique_ptr<PosixThread>(new PosixThread(handle));
} }
} // namespace threading } // namespace threading