Use more make_unqiue

This commit is contained in:
Thomas Goyne 2014-08-30 09:18:52 -07:00
parent 9ebb8d7df1
commit 8567d9a573
3 changed files with 5 additions and 5 deletions

View File

@ -39,7 +39,7 @@ Thesaurus::Thesaurus(agi::fs::path const& dat_path, agi::fs::path const& idx_pat
std::string unused_entry_count; std::string unused_entry_count;
getline(idx, unused_entry_count); getline(idx, unused_entry_count);
conv.reset(new charset::IconvWrapper(encoding_name.c_str(), "utf-8")); conv = make_unique<charset::IconvWrapper>(encoding_name.c_str(), "utf-8");
// Read the list of words and file offsets for those words // Read the list of words and file offsets for those words
for (auto const& line : line_iterator<std::string>(idx, encoding_name)) { for (auto const& line : line_iterator<std::string>(idx, encoding_name)) {

View File

@ -95,7 +95,7 @@ public:
}; };
AssParser::AssParser(AssFile *target, int version) AssParser::AssParser(AssFile *target, int version)
: property_handler(new HeaderToProperty) : property_handler(agi::make_unique<HeaderToProperty>())
, target(target) , target(target)
, version(version) , version(version)
, state(&AssParser::ParseScriptInfoLine) , state(&AssParser::ParseScriptInfoLine)

View File

@ -63,7 +63,7 @@ class OSSPlayer final : public AudioPlayer {
unsigned int rate = 0; unsigned int rate = 0;
/// Worker thread that does the actual writing /// Worker thread that does the actual writing
OSSPlayerThread *thread = nullptr; std::unique_ptr<OSSPlayerThread> thread;
/// Is the player currently playing? /// Is the player currently playing?
volatile bool playing = false; volatile bool playing = false;
@ -198,7 +198,7 @@ void OSSPlayer::Play(int64_t start, int64_t count)
start_frame = cur_frame = start; start_frame = cur_frame = start;
end_frame = start + count; end_frame = start + count;
thread = new OSSPlayerThread(this); thread = agi::make_unique<OSSPlayerThread>(this);
thread->Create(); thread->Create();
thread->Run(); thread->Run();
@ -215,7 +215,7 @@ void OSSPlayer::Stop()
thread->Delete(); thread->Delete();
} }
thread->Wait(); thread->Wait();
delete thread; thread.reset();
} }
// errors can be ignored here // errors can be ignored here