From 258202059457e40d848c5635afad3c3f9f912724 Mon Sep 17 00:00:00 2001 From: arch1t3cht Date: Fri, 24 Nov 2023 20:18:54 +0100 Subject: [PATCH] Fix a bunch of compile errors after refactoring --- libaegisub/meson.build | 2 ++ libaegisub/windows/log_win.cpp | 1 - libaegisub/windows/path_win.cpp | 1 - src/audio_player_alsa.cpp | 3 +-- src/audio_player_dsound.cpp | 3 +-- src/audio_player_dsound2.cpp | 5 ++--- src/audio_player_oss.cpp | 5 ++--- src/audio_player_portaudio.cpp | 3 +-- src/audio_player_pulse.cpp | 3 +-- src/audio_provider_avs.cpp | 3 +-- src/dialog_shift_times.cpp | 4 ++-- src/ffmpegsource_common.cpp | 5 ++++- src/ffmpegsource_common.h | 2 +- src/main.cpp | 2 +- src/spellchecker_hunspell.cpp | 2 +- src/spellchecker_hunspell.h | 2 +- src/subtitles_provider_csri.cpp | 3 +-- src/video_provider_avs.cpp | 5 ++--- src/video_provider_ffmpegsource.cpp | 4 ++-- 19 files changed, 26 insertions(+), 32 deletions(-) diff --git a/libaegisub/meson.build b/libaegisub/meson.build index e780a399ca..7689d31aeb 100644 --- a/libaegisub/meson.build +++ b/libaegisub/meson.build @@ -1,5 +1,6 @@ libaegisub_src = [ 'ass/dialogue_parser.cpp', + 'ass/karaoke.cpp', 'ass/time.cpp', 'ass/uuencode.cpp', @@ -34,6 +35,7 @@ libaegisub_src = [ 'common/parser.cpp', 'common/path.cpp', 'common/thesaurus.cpp', + 'common/unicode.cpp', 'common/util.cpp', 'common/vfr.cpp', 'common/ycbcr_conv.cpp', diff --git a/libaegisub/windows/log_win.cpp b/libaegisub/windows/log_win.cpp index 91017a8f52..01120bd237 100644 --- a/libaegisub/windows/log_win.cpp +++ b/libaegisub/windows/log_win.cpp @@ -15,7 +15,6 @@ #include "libaegisub/log.h" #include "libaegisub/charset_conv_win.h" -#include "libaegisub/make_unique.h" #define WIN32_LEAN_AND_MEAN #include diff --git a/libaegisub/windows/path_win.cpp b/libaegisub/windows/path_win.cpp index 387cf1cdd3..22120f3ff4 100644 --- a/libaegisub/windows/path_win.cpp +++ b/libaegisub/windows/path_win.cpp @@ -21,7 +21,6 @@ #include #include -#include #include diff --git a/src/audio_player_alsa.cpp b/src/audio_player_alsa.cpp index 5a17056229..0d5bcc3e23 100644 --- a/src/audio_player_alsa.cpp +++ b/src/audio_player_alsa.cpp @@ -42,7 +42,6 @@ #include #include -#include #include #include @@ -349,7 +348,7 @@ int64_t AlsaPlayer::GetCurrentPosition() std::unique_ptr CreateAlsaPlayer(agi::AudioProvider *provider, wxWindow *) { - return agi::make_unique(provider); + return std::make_unique(provider); } #endif // WITH_ALSA diff --git a/src/audio_player_dsound.cpp b/src/audio_player_dsound.cpp index 01b47b3544..104ff69cf7 100644 --- a/src/audio_player_dsound.cpp +++ b/src/audio_player_dsound.cpp @@ -41,7 +41,6 @@ #include #include -#include #include #include @@ -368,7 +367,7 @@ void DirectSoundPlayerThread::Stop() { } std::unique_ptr CreateDirectSoundPlayer(agi::AudioProvider *provider, wxWindow *parent) { - return agi::make_unique(provider, parent); + return std::make_unique(provider, parent); } #endif // WITH_DIRECTSOUND diff --git a/src/audio_player_dsound2.cpp b/src/audio_player_dsound2.cpp index dd7bf86800..1d2e847a86 100644 --- a/src/audio_player_dsound2.cpp +++ b/src/audio_player_dsound2.cpp @@ -43,7 +43,6 @@ #include #include #include -#include #include #include @@ -814,7 +813,7 @@ DirectSoundPlayer2::DirectSoundPlayer2(agi::AudioProvider *provider, wxWindow *p try { - thread = agi::make_unique(provider, WantedLatency, BufferLength, parent); + thread = std::make_unique(provider, WantedLatency, BufferLength, parent); } catch (const char *msg) { @@ -929,7 +928,7 @@ void DirectSoundPlayer2::SetVolume(double vol) } std::unique_ptr CreateDirectSound2Player(agi::AudioProvider *provider, wxWindow *parent) { - return agi::make_unique(provider, parent); + return std::make_unique(provider, parent); } #endif // WITH_DIRECTSOUND diff --git a/src/audio_player_oss.cpp b/src/audio_player_oss.cpp index 93950baef5..45a345a230 100644 --- a/src/audio_player_oss.cpp +++ b/src/audio_player_oss.cpp @@ -40,7 +40,6 @@ #include #include -#include #include #include @@ -198,7 +197,7 @@ void OSSPlayer::Play(int64_t start, int64_t count) start_frame = cur_frame = start; end_frame = start + count; - thread = agi::make_unique(this); + thread = std::make_unique(this); thread->Create(); thread->Run(); @@ -280,7 +279,7 @@ int64_t OSSPlayer::GetCurrentPosition() } std::unique_ptr CreateOSSPlayer(agi::AudioProvider *provider, wxWindow *) { - return agi::make_unique(provider); + return std::make_unique(provider); } #endif // WITH_OSS diff --git a/src/audio_player_portaudio.cpp b/src/audio_player_portaudio.cpp index 7a5babcdc1..fc161cf32f 100644 --- a/src/audio_player_portaudio.cpp +++ b/src/audio_player_portaudio.cpp @@ -42,7 +42,6 @@ #include #include -#include // Uncomment to enable extremely spammy debug logging //#define PORTAUDIO_DEBUG @@ -280,7 +279,7 @@ bool PortAudioPlayer::IsPlaying() { } std::unique_ptr CreatePortAudioPlayer(agi::AudioProvider *provider, wxWindow *) { - return agi::make_unique(provider); + return std::make_unique(provider); } #endif // WITH_PORTAUDIO diff --git a/src/audio_player_pulse.cpp b/src/audio_player_pulse.cpp index 7174356bdd..9ccf6536ab 100644 --- a/src/audio_player_pulse.cpp +++ b/src/audio_player_pulse.cpp @@ -40,7 +40,6 @@ #include #include -#include #include #include @@ -322,6 +321,6 @@ void PulseAudioPlayer::pa_stream_notify(pa_stream *p, PulseAudioPlayer *thread) } std::unique_ptr CreatePulseAudioPlayer(agi::AudioProvider *provider, wxWindow *) { - return agi::make_unique(provider); + return std::make_unique(provider); } #endif // WITH_LIBPULSE diff --git a/src/audio_provider_avs.cpp b/src/audio_provider_avs.cpp index 70470c4bd4..895e8c0283 100644 --- a/src/audio_provider_avs.cpp +++ b/src/audio_provider_avs.cpp @@ -45,7 +45,6 @@ #include #include #include -#include #include @@ -144,6 +143,6 @@ void AvisynthAudioProvider::FillBuffer(void *buf, int64_t start, int64_t count) } std::unique_ptr CreateAvisynthAudioProvider(std::filesystem::path const& file, agi::BackgroundRunner *) { - return agi::make_unique(file); + return std::make_unique(file); } #endif diff --git a/src/dialog_shift_times.cpp b/src/dialog_shift_times.cpp index 72b73bc9a1..ef0a8585af 100644 --- a/src/dialog_shift_times.cpp +++ b/src/dialog_shift_times.cpp @@ -288,12 +288,12 @@ void DialogShiftTimes::OnHistoryClick(wxCommandEvent &evt) { json::Object& obj = history[entry]; if (obj["is by time"]) { - shift_time->SetTime(agi::Time((std::string_view)obj["amount"])); + shift_time->SetTime(agi::Time((std::string)obj["amount"])); shift_by_time->SetValue(true); OnByTime(evt); } else { - shift_frames->SetValue(to_wx((std::string_view)obj["amount"])); + shift_frames->SetValue(to_wx((std::string)obj["amount"])); if (shift_by_frames->IsEnabled()) { shift_by_frames->SetValue(true); OnByFrames(evt); diff --git a/src/ffmpegsource_common.cpp b/src/ffmpegsource_common.cpp index fa3f49e2fe..abbe57e5d7 100644 --- a/src/ffmpegsource_common.cpp +++ b/src/ffmpegsource_common.cpp @@ -50,6 +50,8 @@ #include #include +#include + FFmpegSourceProvider::FFmpegSourceProvider(agi::BackgroundRunner *br) : br(br) { @@ -187,7 +189,8 @@ std::filesystem::path FFmpegSourceProvider::GetCacheFilename(std::filesystem::pa hash.process_bytes(filename.string().c_str(), filename.string().size()); // Generate the filename - auto result = config::path->Decode(agi::Str("?local/ffms2cache/", std::to_string(hash.checksum()), "_", std::to_string(len), "_", std::to_string(agi::fs::ModifiedTime(filename)), ".ffindex"); + auto modified_time = std::chrono::duration_cast(agi::fs::ModifiedTime(filename).time_since_epoch()).count(); + auto result = config::path->Decode(agi::Str("?local/ffms2cache/", std::to_string(hash.checksum()), "_", std::to_string(len), "_", std::to_string(modified_time), ".ffindex")); // Ensure that folder exists agi::fs::CreateDirectory(result.parent_path()); diff --git a/src/ffmpegsource_common.h b/src/ffmpegsource_common.h index f7d2c1c2f2..2f328cf041 100644 --- a/src/ffmpegsource_common.h +++ b/src/ffmpegsource_common.h @@ -33,11 +33,11 @@ /// #ifdef WITH_FFMS2 +#include #include #include -#include #include namespace agi { class BackgroundRunner; } diff --git a/src/main.cpp b/src/main.cpp index 70d3378d73..9472e4bc3e 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -90,7 +90,7 @@ static const char *LastStartupState = nullptr; #endif void AegisubApp::OnAssertFailure(const wxChar *file, int line, const wxChar *func, const wxChar *cond, const wxChar *msg) { - LOG_A("wx/assert") << file << ":" << line << ":" << func << "() " << cond << ": " << msg; + LOG_A("wx/assert") << wxString(file) << ":" << line << ":" << wxString(func) << "() " << wxString(cond) << ": " << wxString(msg); wxApp::OnAssertFailure(file, line, func, cond, msg); } diff --git a/src/spellchecker_hunspell.cpp b/src/spellchecker_hunspell.cpp index 555ba1198e..93d939d771 100644 --- a/src/spellchecker_hunspell.cpp +++ b/src/spellchecker_hunspell.cpp @@ -62,7 +62,7 @@ void HunspellSpellChecker::AddWord(std::string_view word) { hunspell->add(conv->Convert(word).c_str()); // Add the word - if (customWords.insert(word).second) + if (customWords.insert(std::string(word)).second) WriteUserDictionary(); } diff --git a/src/spellchecker_hunspell.h b/src/spellchecker_hunspell.h index e7626a19e6..10b1a930fa 100644 --- a/src/spellchecker_hunspell.h +++ b/src/spellchecker_hunspell.h @@ -22,9 +22,9 @@ #ifdef WITH_HUNSPELL #include -#include #include +#include #include #include diff --git a/src/subtitles_provider_csri.cpp b/src/subtitles_provider_csri.cpp index 87429e213c..e78f13c880 100644 --- a/src/subtitles_provider_csri.cpp +++ b/src/subtitles_provider_csri.cpp @@ -39,7 +39,6 @@ #include "subtitle_format_ass.h" #include "video_frame.h" -#include #include @@ -122,7 +121,7 @@ std::vector List() { } std::unique_ptr Create(std::string const& name, agi::BackgroundRunner *) { - return agi::make_unique(name); + return std::make_unique(name); } } #endif // WITH_CSRI diff --git a/src/video_provider_avs.cpp b/src/video_provider_avs.cpp index 529b57fdc5..718a189669 100644 --- a/src/video_provider_avs.cpp +++ b/src/video_provider_avs.cpp @@ -38,7 +38,6 @@ #include #include #include -#include #include #include @@ -322,7 +321,7 @@ void AvisynthVideoProvider::GetFrame(int n, VideoFrame &out) { } namespace agi { class BackgroundRunner; } -std::unique_ptr CreateAvisynthVideoProvider(std::filesystem::path const& path, std::string const& colormatrix, agi::BackgroundRunner *) { - return agi::make_unique(path, colormatrix); +std::unique_ptr CreateAvisynthVideoProvider(std::filesystem::path const& path, std::string_view colormatrix, agi::BackgroundRunner *) { + return std::make_unique(path, std::string(colormatrix)); } #endif // HAVE_AVISYNTH diff --git a/src/video_provider_ffmpegsource.cpp b/src/video_provider_ffmpegsource.cpp index 4d747c0621..df8a7e52ba 100644 --- a/src/video_provider_ffmpegsource.cpp +++ b/src/video_provider_ffmpegsource.cpp @@ -372,8 +372,8 @@ void FFmpegSourceVideoProvider::GetFrame(int n, VideoFrame &out) { } } -std::unique_ptr CreateFFmpegSourceVideoProvider(std::filesystem::path const& path, std::string const& colormatrix, agi::BackgroundRunner *br) { - return std::make_unique(path, colormatrix, br); +std::unique_ptr CreateFFmpegSourceVideoProvider(std::filesystem::path const& path, std::string_view colormatrix, agi::BackgroundRunner *br) { + return std::make_unique(path, std::string(colormatrix), br); } #endif /* WITH_FFMS2 */