forked from mia/Aegisub
Use more make_unique
Shuts up a bunch of Coverity false-positives and might fix a true positive or two.
This commit is contained in:
parent
da5445a09f
commit
01a38a5e86
12 changed files with 25 additions and 15 deletions
|
@ -39,6 +39,7 @@
|
||||||
|
|
||||||
#include <libaegisub/of_type_adaptor.h>
|
#include <libaegisub/of_type_adaptor.h>
|
||||||
#include <libaegisub/split.h>
|
#include <libaegisub/split.h>
|
||||||
|
#include <libaegisub/util.h>
|
||||||
|
|
||||||
#include <boost/algorithm/string/predicate.hpp>
|
#include <boost/algorithm/string/predicate.hpp>
|
||||||
#include <boost/algorithm/string/join.hpp>
|
#include <boost/algorithm/string/join.hpp>
|
||||||
|
|
|
@ -555,10 +555,10 @@ AudioDisplay::AudioDisplay(wxWindow *parent, AudioController *controller, agi::C
|
||||||
: wxWindow(parent, -1, wxDefaultPosition, wxDefaultSize, wxWANTS_CHARS|wxBORDER_SIMPLE)
|
: wxWindow(parent, -1, wxDefaultPosition, wxDefaultSize, wxWANTS_CHARS|wxBORDER_SIMPLE)
|
||||||
, audio_open_connection(controller->AddAudioOpenListener(&AudioDisplay::OnAudioOpen, this))
|
, audio_open_connection(controller->AddAudioOpenListener(&AudioDisplay::OnAudioOpen, this))
|
||||||
, context(context)
|
, context(context)
|
||||||
, audio_renderer(new AudioRenderer)
|
, audio_renderer(agi::util::make_unique<AudioRenderer>())
|
||||||
, controller(controller)
|
, controller(controller)
|
||||||
, scrollbar(new AudioDisplayScrollbar(this))
|
, scrollbar(agi::util::make_unique<AudioDisplayScrollbar>(this))
|
||||||
, timeline(new AudioDisplayTimeline(this))
|
, timeline(agi::util::make_unique<AudioDisplayTimeline>(this))
|
||||||
, dragged_object(0)
|
, dragged_object(0)
|
||||||
, scroll_left(0)
|
, scroll_left(0)
|
||||||
, pixel_audio_width(0)
|
, pixel_audio_width(0)
|
||||||
|
|
|
@ -37,6 +37,8 @@
|
||||||
#include "selection_controller.h"
|
#include "selection_controller.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
|
|
||||||
|
#include <libaegisub/util.h>
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <boost/locale/boundary.hpp>
|
#include <boost/locale/boundary.hpp>
|
||||||
#include <numeric>
|
#include <numeric>
|
||||||
|
@ -67,7 +69,7 @@ AudioKaraoke::AudioKaraoke(wxWindow *parent, agi::Context *c)
|
||||||
, audio_closed(c->audioController->AddAudioCloseListener(&AudioKaraoke::OnAudioClosed, this))
|
, audio_closed(c->audioController->AddAudioCloseListener(&AudioKaraoke::OnAudioClosed, this))
|
||||||
, active_line_changed(c->selectionController->AddActiveLineListener(&AudioKaraoke::OnActiveLineChanged, this))
|
, active_line_changed(c->selectionController->AddActiveLineListener(&AudioKaraoke::OnActiveLineChanged, this))
|
||||||
, active_line(nullptr)
|
, active_line(nullptr)
|
||||||
, kara(new AssKaraoke)
|
, kara(agi::util::make_unique<AssKaraoke>())
|
||||||
, scroll_x(0)
|
, scroll_x(0)
|
||||||
, scroll_dir(0)
|
, scroll_dir(0)
|
||||||
, char_height(0)
|
, char_height(0)
|
||||||
|
|
|
@ -50,7 +50,7 @@ AudioMarkerProviderKeyframes::AudioMarkerProviderKeyframes(agi::Context *c, cons
|
||||||
, timecode_slot(vc->AddTimecodesListener(&AudioMarkerProviderKeyframes::Update, this))
|
, timecode_slot(vc->AddTimecodesListener(&AudioMarkerProviderKeyframes::Update, this))
|
||||||
, enabled_slot(OPT_SUB(opt_name, &AudioMarkerProviderKeyframes::Update, this))
|
, enabled_slot(OPT_SUB(opt_name, &AudioMarkerProviderKeyframes::Update, this))
|
||||||
, enabled_opt(OPT_GET(opt_name))
|
, enabled_opt(OPT_GET(opt_name))
|
||||||
, style(new Pen("Colour/Audio Display/Keyframe"))
|
, style(agi::util::make_unique<Pen>("Colour/Audio Display/Keyframe"))
|
||||||
{
|
{
|
||||||
Update();
|
Update();
|
||||||
}
|
}
|
||||||
|
@ -139,7 +139,7 @@ void VideoPositionMarkerProvider::GetMarkers(const TimeRange &range, AudioMarker
|
||||||
}
|
}
|
||||||
|
|
||||||
SecondsMarkerProvider::SecondsMarkerProvider()
|
SecondsMarkerProvider::SecondsMarkerProvider()
|
||||||
: pen(new Pen("Colour/Audio Display/Seconds Line", 1, wxPENSTYLE_DOT))
|
: pen(agi::util::make_unique<Pen>("Colour/Audio Display/Seconds Line", 1, wxPENSTYLE_DOT))
|
||||||
, enabled(OPT_GET("Audio/Display/Draw/Seconds"))
|
, enabled(OPT_GET("Audio/Display/Draw/Seconds"))
|
||||||
, enabled_opt_changed(OPT_SUB("Audio/Display/Draw/Seconds", &SecondsMarkerProvider::EnabledOptChanged, this))
|
, enabled_opt_changed(OPT_SUB("Audio/Display/Draw/Seconds", &SecondsMarkerProvider::EnabledOptChanged, this))
|
||||||
{
|
{
|
||||||
|
|
|
@ -365,7 +365,7 @@ do_setup:
|
||||||
|
|
||||||
AlsaPlayer::AlsaPlayer(AudioProvider *provider)
|
AlsaPlayer::AlsaPlayer(AudioProvider *provider)
|
||||||
: AudioPlayer(provider)
|
: AudioPlayer(provider)
|
||||||
, ps(new PlaybackState)
|
, ps(agi::util::make_unique<PlaybackState>())
|
||||||
{
|
{
|
||||||
ps->provider = provider;
|
ps->provider = provider;
|
||||||
|
|
||||||
|
|
|
@ -46,6 +46,7 @@
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
|
|
||||||
#include <libaegisub/charset_conv.h>
|
#include <libaegisub/charset_conv.h>
|
||||||
|
#include <libaegisub/util.h>
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <boost/filesystem/path.hpp>
|
#include <boost/filesystem/path.hpp>
|
||||||
|
@ -77,7 +78,7 @@ static void swap(wxCheckListBox *list, int idx, int sel_dir) {
|
||||||
DialogExport::DialogExport(agi::Context *c)
|
DialogExport::DialogExport(agi::Context *c)
|
||||||
: wxDialog(c->parent, -1, _("Export"), wxDefaultPosition, wxSize(200, 100), wxCAPTION | wxCLOSE_BOX)
|
: wxDialog(c->parent, -1, _("Export"), wxDefaultPosition, wxSize(200, 100), wxCAPTION | wxCLOSE_BOX)
|
||||||
, c(c)
|
, c(c)
|
||||||
, exporter(new AssExporter(c))
|
, exporter(agi::util::make_unique<AssExporter>(c))
|
||||||
{
|
{
|
||||||
SetIcon(GETICON(export_menu_16));
|
SetIcon(GETICON(export_menu_16));
|
||||||
SetExtraStyle(wxWS_EX_VALIDATE_RECURSIVELY);
|
SetExtraStyle(wxWS_EX_VALIDATE_RECURSIVELY);
|
||||||
|
|
|
@ -30,6 +30,8 @@
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
#include "validators.h"
|
#include "validators.h"
|
||||||
|
|
||||||
|
#include <libaegisub/util.h>
|
||||||
|
|
||||||
#include <functional>
|
#include <functional>
|
||||||
|
|
||||||
#include <wx/button.h>
|
#include <wx/button.h>
|
||||||
|
@ -45,7 +47,7 @@
|
||||||
DialogSearchReplace::DialogSearchReplace(agi::Context* c, bool replace)
|
DialogSearchReplace::DialogSearchReplace(agi::Context* c, bool replace)
|
||||||
: wxDialog(c->parent, -1, replace ? _("Replace") : _("Find"))
|
: wxDialog(c->parent, -1, replace ? _("Replace") : _("Find"))
|
||||||
, c(c)
|
, c(c)
|
||||||
, settings(new SearchReplaceSettings)
|
, settings(agi::util::make_unique<SearchReplaceSettings>())
|
||||||
, has_replace(replace)
|
, has_replace(replace)
|
||||||
{
|
{
|
||||||
auto recent_find(lagi_MRU_wxAS("Find"));
|
auto recent_find(lagi_MRU_wxAS("Find"));
|
||||||
|
|
|
@ -40,6 +40,7 @@
|
||||||
#include <libaegisub/log.h>
|
#include <libaegisub/log.h>
|
||||||
#include <libaegisub/of_type_adaptor.h>
|
#include <libaegisub/of_type_adaptor.h>
|
||||||
#include <libaegisub/path.h>
|
#include <libaegisub/path.h>
|
||||||
|
#include <libaegisub/util.h>
|
||||||
|
|
||||||
#include <libaegisub/cajun/elements.h>
|
#include <libaegisub/cajun/elements.h>
|
||||||
#include <libaegisub/cajun/reader.h>
|
#include <libaegisub/cajun/reader.h>
|
||||||
|
@ -100,7 +101,7 @@ DialogShiftTimes::DialogShiftTimes(agi::Context *context)
|
||||||
: wxDialog(context->parent, -1, _("Shift Times"))
|
: wxDialog(context->parent, -1, _("Shift Times"))
|
||||||
, context(context)
|
, context(context)
|
||||||
, history_filename(config::path->Decode("?user/shift_history.json"))
|
, history_filename(config::path->Decode("?user/shift_history.json"))
|
||||||
, history(new json::Array)
|
, history(agi::util::make_unique<json::Array>())
|
||||||
, timecodes_loaded_slot(context->videoController->AddTimecodesListener(&DialogShiftTimes::OnTimecodesLoaded, this))
|
, timecodes_loaded_slot(context->videoController->AddTimecodesListener(&DialogShiftTimes::OnTimecodesLoaded, this))
|
||||||
, selected_set_changed_slot(context->selectionController->AddSelectionListener(&DialogShiftTimes::OnSelectedSetChanged, this))
|
, selected_set_changed_slot(context->selectionController->AddSelectionListener(&DialogShiftTimes::OnSelectedSetChanged, this))
|
||||||
{
|
{
|
||||||
|
|
|
@ -182,7 +182,7 @@ public:
|
||||||
|
|
||||||
FrameMain::FrameMain()
|
FrameMain::FrameMain()
|
||||||
: wxFrame(nullptr, -1, "", wxDefaultPosition, wxSize(920,700), wxDEFAULT_FRAME_STYLE | wxCLIP_CHILDREN)
|
: wxFrame(nullptr, -1, "", wxDefaultPosition, wxSize(920,700), wxDEFAULT_FRAME_STYLE | wxCLIP_CHILDREN)
|
||||||
, context(new agi::Context)
|
, context(agi::util::make_unique<agi::Context>())
|
||||||
, showVideo(true)
|
, showVideo(true)
|
||||||
, showAudio(true)
|
, showAudio(true)
|
||||||
, blockVideoLoad(false)
|
, blockVideoLoad(false)
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
|
|
||||||
#include <libaegisub/exception.h>
|
#include <libaegisub/exception.h>
|
||||||
#include <libaegisub/hotkey.h>
|
#include <libaegisub/hotkey.h>
|
||||||
|
#include <libaegisub/util.h>
|
||||||
|
|
||||||
#include "command/command.h"
|
#include "command/command.h"
|
||||||
#include "command/icon.h"
|
#include "command/icon.h"
|
||||||
|
@ -258,7 +259,7 @@ public:
|
||||||
|
|
||||||
|
|
||||||
HotkeyDataViewModel::HotkeyDataViewModel(Preferences *parent)
|
HotkeyDataViewModel::HotkeyDataViewModel(Preferences *parent)
|
||||||
: root(new HotkeyModelRoot(this))
|
: root(agi::util::make_unique<HotkeyModelRoot>(this))
|
||||||
, parent(parent)
|
, parent(parent)
|
||||||
, has_pending_changes(false)
|
, has_pending_changes(false)
|
||||||
{
|
{
|
||||||
|
|
|
@ -50,6 +50,7 @@
|
||||||
#include <libaegisub/ass/dialogue_parser.h>
|
#include <libaegisub/ass/dialogue_parser.h>
|
||||||
#include <libaegisub/calltip_provider.h>
|
#include <libaegisub/calltip_provider.h>
|
||||||
#include <libaegisub/spellchecker.h>
|
#include <libaegisub/spellchecker.h>
|
||||||
|
#include <libaegisub/util.h>
|
||||||
|
|
||||||
#include <boost/algorithm/string/predicate.hpp>
|
#include <boost/algorithm/string/predicate.hpp>
|
||||||
#include <boost/algorithm/string/replace.hpp>
|
#include <boost/algorithm/string/replace.hpp>
|
||||||
|
@ -257,7 +258,7 @@ void SubsTextEditCtrl::UpdateCallTip() {
|
||||||
cursor_pos = pos;
|
cursor_pos = pos;
|
||||||
|
|
||||||
if (!calltip_provider)
|
if (!calltip_provider)
|
||||||
calltip_provider.reset(new agi::CalltipProvider);
|
calltip_provider = agi::util::make_unique<agi::CalltipProvider>();
|
||||||
|
|
||||||
agi::Calltip new_calltip = calltip_provider->GetCalltip(tokenized_line, line_text, pos);
|
agi::Calltip new_calltip = calltip_provider->GetCalltip(tokenized_line, line_text, pos);
|
||||||
|
|
||||||
|
@ -384,7 +385,7 @@ void SubsTextEditCtrl::AddThesaurusEntries(wxMenu &menu) {
|
||||||
if (currentWord.empty()) return;
|
if (currentWord.empty()) return;
|
||||||
|
|
||||||
if (!thesaurus)
|
if (!thesaurus)
|
||||||
thesaurus.reset(new Thesaurus);
|
thesaurus = agi::util::make_unique<Thesaurus>();
|
||||||
|
|
||||||
std::vector<Thesaurus::Entry> results;
|
std::vector<Thesaurus::Entry> results;
|
||||||
thesaurus->Lookup(currentWord, &results);
|
thesaurus->Lookup(currentWord, &results);
|
||||||
|
|
|
@ -27,12 +27,13 @@
|
||||||
#include "video_display.h"
|
#include "video_display.h"
|
||||||
|
|
||||||
#include <libaegisub/color.h>
|
#include <libaegisub/color.h>
|
||||||
|
#include <libaegisub/util.h>
|
||||||
|
|
||||||
#include <boost/format.hpp>
|
#include <boost/format.hpp>
|
||||||
|
|
||||||
VisualToolCross::VisualToolCross(VideoDisplay *parent, agi::Context *context)
|
VisualToolCross::VisualToolCross(VideoDisplay *parent, agi::Context *context)
|
||||||
: VisualTool<VisualDraggableFeature>(parent, context)
|
: VisualTool<VisualDraggableFeature>(parent, context)
|
||||||
, gl_text(new OpenGLText)
|
, gl_text(agi::util::make_unique<OpenGLText>())
|
||||||
{
|
{
|
||||||
parent->SetCursor(wxCursor(wxCURSOR_BLANK));
|
parent->SetCursor(wxCursor(wxCURSOR_BLANK));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue