mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-05 19:11:50 +00:00
Minor refactor
This commit is contained in:
parent
0d36f52bdd
commit
2ad115a2a8
9 changed files with 19 additions and 20 deletions
|
|
@ -3,6 +3,7 @@
|
|||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <cstring>
|
||||
#include <memory>
|
||||
#include <type_traits>
|
||||
|
||||
#ifdef __APPLE__
|
||||
|
|
@ -192,13 +193,12 @@ char* load_wav(const std::string& filename,
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
char* data = new char[size];
|
||||
std::unique_ptr<char[]> data (new char[size]);
|
||||
try {
|
||||
in.read(data, size);
|
||||
return data;
|
||||
in.read(data.get(), size);
|
||||
return data.release();
|
||||
}
|
||||
catch (const std::exception&) {
|
||||
delete[] data;
|
||||
std::cerr << "ERROR: Could not load wav data of \"" << filename << "\"" << std::endl;
|
||||
return nullptr;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue