diff --git a/aegisub/src/aegisublocale.cpp b/aegisub/src/aegisublocale.cpp index 2910d96ce..90d162a76 100644 --- a/aegisub/src/aegisublocale.cpp +++ b/aegisub/src/aegisublocale.cpp @@ -107,7 +107,7 @@ wxString AegisubLocale::PickLanguage() { if (!active_language.empty()) style |= wxCANCEL; - wxSingleChoiceDialog dialog(NULL, "Please choose a language:", "Language", langNames, + wxSingleChoiceDialog dialog(nullptr, "Please choose a language:", "Language", langNames, #if wxCHECK_VERSION(2, 9, 4) (void **)0, #else diff --git a/aegisub/src/ass_dialogue.h b/aegisub/src/ass_dialogue.h index b5e8c7866..892c7ce4b 100644 --- a/aegisub/src/ass_dialogue.h +++ b/aegisub/src/ass_dialogue.h @@ -162,7 +162,7 @@ public: /// @brief Process parameters via callback /// @param callback The callback function to call per tag parameter /// @param userData User data to pass to callback function - void ProcessParameters(AssDialogueBlockOverride::ProcessParametersCallback callback,void *userData=NULL); + void ProcessParameters(AssDialogueBlockOverride::ProcessParametersCallback callback,void *userData=nullptr); /// Strip all ASS tags from the text void StripTags(); /// Strip a specific ASS tag from the text diff --git a/aegisub/src/ass_export_filter.h b/aegisub/src/ass_export_filter.h index 32f1df6c0..658df6937 100644 --- a/aegisub/src/ass_export_filter.h +++ b/aegisub/src/ass_export_filter.h @@ -64,7 +64,7 @@ public: static void Unregister(AssExportFilter *filter); /// Unregister and delete all export filters static void Clear(); - /// Get a filter by name or NULL if it doesn't exist + /// Get a filter by name or nullptr if it doesn't exist static AssExportFilter *GetFilter(wxString const& name); /// Get the list of registered filters diff --git a/aegisub/src/ass_file.h b/aegisub/src/ass_file.h index 8d15d41da..a7e4f800d 100644 --- a/aegisub/src/ass_file.h +++ b/aegisub/src/ass_file.h @@ -114,7 +114,7 @@ public: wxArrayString GetStyles() const; /// @brief Get a style by name /// @param name Style name - /// @return Pointer to style or NULL + /// @return Pointer to style or nullptr AssStyle *GetStyle(wxString const& name); void swap(AssFile &) throw(); diff --git a/aegisub/src/ass_style_storage.h b/aegisub/src/ass_style_storage.h index a494dd1ee..bfddea3af 100644 --- a/aegisub/src/ass_style_storage.h +++ b/aegisub/src/ass_style_storage.h @@ -74,7 +74,7 @@ public: /// Get the style with the given name /// @param name Case-insensitive style name - /// @return Style or NULL if the requested style is not found + /// @return Style or nullptr if the requested style is not found AssStyle *GetStyle(wxString const& name); /// Save stored styles to a file diff --git a/aegisub/src/audio_player.cpp b/aegisub/src/audio_player.cpp index a4af83d63..8e2b90eaa 100644 --- a/aegisub/src/audio_player.cpp +++ b/aegisub/src/audio_player.cpp @@ -90,4 +90,4 @@ void AudioPlayerFactory::RegisterProviders() { #endif } -template<> AudioPlayerFactory::map *FactoryBase::classes = NULL; +template<> AudioPlayerFactory::map *FactoryBase::classes = nullptr; diff --git a/aegisub/src/audio_player_dsound.cpp b/aegisub/src/audio_player_dsound.cpp index 454b1f8cd..5eefaedc3 100644 --- a/aegisub/src/audio_player_dsound.cpp +++ b/aegisub/src/audio_player_dsound.cpp @@ -60,7 +60,7 @@ DirectSoundPlayer::DirectSoundPlayer(AudioProvider *provider) { // Initialize the DirectSound object HRESULT res; - res = DirectSoundCreate8(&DSDEVID_DefaultPlayback,&directSound,NULL); // TODO: support selecting audio device + res = DirectSoundCreate8(&DSDEVID_DefaultPlayback,&directSound,nullptr); // TODO: support selecting audio device if (FAILED(res)) throw agi::AudioPlayerOpenError("Failed initializing DirectSound", 0); // Set DirectSound parameters @@ -91,7 +91,7 @@ DirectSoundPlayer::DirectSoundPlayer(AudioProvider *provider) // Create the buffer IDirectSoundBuffer *buf; - res = directSound->CreateSoundBuffer(&desc,&buf,NULL); + res = directSound->CreateSoundBuffer(&desc,&buf,nullptr); if (res != DS_OK) throw agi::AudioPlayerOpenError("Failed creating DirectSound buffer", 0); // Copy interface to buffer @@ -108,13 +108,13 @@ DirectSoundPlayer::~DirectSoundPlayer() { // Unref the DirectSound buffer if (buffer) { buffer->Release(); - buffer = NULL; + buffer = nullptr; } // Unref the DirectSound object if (directSound) { directSound->Release(); - directSound = NULL; + directSound = nullptr; } } @@ -138,7 +138,7 @@ bool DirectSoundPlayer::FillBuffer(bool fill) { } else { DWORD bufplay; - res = buffer->GetCurrentPosition(&bufplay, NULL); + res = buffer->GetCurrentPosition(&bufplay, nullptr); if (FAILED(res)) return false; toWrite = (int)bufplay - (int)offset; if (toWrite < 0) toWrite += bufSize; @@ -255,7 +255,7 @@ void DirectSoundPlayer::Stop() { thread->Stop(); thread->Wait(); } - thread = NULL; + thread = nullptr; } // The thread is now guaranteed dead and there are no concurrency problems to worry about @@ -304,7 +304,7 @@ int64_t DirectSoundPlayer::GetCurrentPosition() { /// DirectSoundPlayerThread::DirectSoundPlayerThread(DirectSoundPlayer *par) : wxThread(wxTHREAD_JOINABLE) { parent = par; - stopnotify = CreateEvent(NULL, true, false, NULL); + stopnotify = CreateEvent(nullptr, true, false, nullptr); } /// @brief Thread destructor @@ -336,7 +336,7 @@ wxThread::ExitCode DirectSoundPlayerThread::Entry() { DWORD size1, size2; DWORD playpos; HRESULT res; - res = parent->buffer->GetCurrentPosition(&playpos, NULL); + res = parent->buffer->GetCurrentPosition(&playpos, nullptr); if (FAILED(res)) break; int toWrite = playpos - parent->offset; while (toWrite < 0) toWrite += parent->bufSize; diff --git a/aegisub/src/audio_player_dsound2.cpp b/aegisub/src/audio_player_dsound2.cpp index 9a7b292e5..136c70dd9 100644 --- a/aegisub/src/audio_player_dsound2.cpp +++ b/aegisub/src/audio_player_dsound2.cpp @@ -75,7 +75,7 @@ struct COMInitialization { { if (!inited) { - if (FAILED(CoInitialize(NULL))) + if (FAILED(CoInitialize(nullptr))) throw std::exception(); inited = true; } @@ -290,7 +290,7 @@ void DirectSoundPlayer2Thread::Run() // Create DirectSound object COMObjectRetainer ds; - if (FAILED(DirectSoundCreate8(&DSDEVID_DefaultPlayback, &ds.obj, NULL))) + if (FAILED(DirectSoundCreate8(&DSDEVID_DefaultPlayback, &ds.obj, nullptr))) REPORT_ERROR("Cound not create DirectSound object") diff --git a/aegisub/src/audio_player_oss.cpp b/aegisub/src/audio_player_oss.cpp index a314d4f09..4f85ad9cf 100644 --- a/aegisub/src/audio_player_oss.cpp +++ b/aegisub/src/audio_player_oss.cpp @@ -146,7 +146,7 @@ void OSSPlayer::Stop() } // errors can be ignored here - ioctl(dspdev, SNDCTL_DSP_RESET, NULL); + ioctl(dspdev, SNDCTL_DSP_RESET, nullptr); // Reset data playing = false; @@ -160,7 +160,7 @@ void OSSPlayer::SetEndPosition(int64_t pos) end_frame = pos; if (pos <= GetCurrentPosition()) { - ioctl(dspdev, SNDCTL_DSP_RESET, NULL); + ioctl(dspdev, SNDCTL_DSP_RESET, nullptr); if (thread && thread->IsAlive()) thread->Delete(); } diff --git a/aegisub/src/audio_player_portaudio.cpp b/aegisub/src/audio_player_portaudio.cpp index edd1c6717..c692cf3e3 100644 --- a/aegisub/src/audio_player_portaudio.cpp +++ b/aegisub/src/audio_player_portaudio.cpp @@ -153,7 +153,7 @@ void PortAudioPlayer::OpenStream() { pa_output_p.channelCount = provider->GetChannels(); pa_output_p.sampleFormat = paInt16; pa_output_p.suggestedLatency = device_info->defaultLowOutputLatency; - pa_output_p.hostApiSpecificStreamInfo = NULL; + pa_output_p.hostApiSpecificStreamInfo = nullptr; LOG_D("audio/player/portaudio") << "OpenStream:" << " output channels: " << pa_output_p.channelCount @@ -161,7 +161,7 @@ void PortAudioPlayer::OpenStream() { << " sample rate: " << provider->GetSampleRate() << " sample format: " << pa_output_p.sampleFormat; - PaError err = Pa_OpenStream(&stream, NULL, &pa_output_p, provider->GetSampleRate(), 0, paPrimeOutputBuffersUsingStreamCallback, paCallback, this); + PaError err = Pa_OpenStream(&stream, nullptr, &pa_output_p, provider->GetSampleRate(), 0, paPrimeOutputBuffersUsingStreamCallback, paCallback, this); if (err == paNoError) { LOG_D("audo/player/portaudio") << "Using device " << pa_output_p.device << " " << device_info->name << " " << Pa_GetHostApiInfo(device_info->hostApi)->name; diff --git a/aegisub/src/audio_player_pulse.cpp b/aegisub/src/audio_player_pulse.cpp index 9b8494bbb..5b8f97eba 100644 --- a/aegisub/src/audio_player_pulse.cpp +++ b/aegisub/src/audio_player_pulse.cpp @@ -80,7 +80,7 @@ PulseAudioPlayer::PulseAudioPlayer(AudioProvider *provider) pa_context_set_state_callback(context, (pa_context_notify_cb_t)pa_context_notify, this); // Connect the context - pa_context_connect(context, NULL, PA_CONTEXT_NOAUTOSPAWN, NULL); + pa_context_connect(context, nullptr, PA_CONTEXT_NOAUTOSPAWN, nullptr); // Wait for connection while (true) { @@ -120,7 +120,7 @@ PulseAudioPlayer::PulseAudioPlayer(AudioProvider *provider) pa_stream_set_write_callback(stream, (pa_stream_request_cb_t)pa_stream_write, this); // Connect stream - paerror = pa_stream_connect_playback(stream, NULL, NULL, (pa_stream_flags_t)(PA_STREAM_INTERPOLATE_TIMING|PA_STREAM_NOT_MONOTONOUS|PA_STREAM_AUTO_TIMING_UPDATE), NULL, NULL); + paerror = pa_stream_connect_playback(stream, nullptr, nullptr, (pa_stream_flags_t)(PA_STREAM_INTERPOLATE_TIMING|PA_STREAM_NOT_MONOTONOUS|PA_STREAM_AUTO_TIMING_UPDATE), nullptr, nullptr); if (paerror) { LOG_E("audio/player/pulse") << "Stream connection failed: " << pa_strerror(paerror) << "(" << paerror << ")"; throw agi::AudioPlayerOpenError(std::string("PulseAudio reported error: ") + pa_strerror(paerror), 0); @@ -269,7 +269,7 @@ void PulseAudioPlayer::pa_stream_write(pa_stream *p, size_t length, PulseAudioPl if (thread->cur_frame >= thread->end_frame + thread->provider->GetSampleRate()) { // More than a second past end of stream thread->is_playing = false; - pa_operation *op = pa_stream_drain(p, NULL, NULL); + pa_operation *op = pa_stream_drain(p, nullptr, nullptr); pa_operation_unref(op); return; diff --git a/aegisub/src/audio_provider.cpp b/aegisub/src/audio_provider.cpp index e5b8eb6fe..820cfd89d 100644 --- a/aegisub/src/audio_provider.cpp +++ b/aegisub/src/audio_provider.cpp @@ -221,4 +221,4 @@ void AudioProviderFactory::RegisterProviders() { #endif } -template<> AudioProviderFactory::map *FactoryBase::classes = NULL; +template<> AudioProviderFactory::map *FactoryBase::classes = nullptr; diff --git a/aegisub/src/audio_provider_ffmpegsource.cpp b/aegisub/src/audio_provider_ffmpegsource.cpp index bbf9ae92b..53a63b13b 100644 --- a/aegisub/src/audio_provider_ffmpegsource.cpp +++ b/aegisub/src/audio_provider_ffmpegsource.cpp @@ -53,7 +53,7 @@ /// @brief Constructor /// @param filename The filename to open FFmpegSourceAudioProvider::FFmpegSourceAudioProvider(wxString filename) try -: AudioSource(NULL, FFMS_DestroyAudioSource) +: AudioSource(nullptr, FFMS_DestroyAudioSource) { ErrInfo.Buffer = FFMSErrMsg; ErrInfo.BufferSize = sizeof(FFMSErrMsg); @@ -99,7 +99,7 @@ void FFmpegSourceAudioProvider::LoadAudio(wxString filename) { Index(FFMS_ReadIndex(CacheName.utf8_str(), &ErrInfo), FFMS_DestroyIndex); if (Index && FFMS_IndexBelongsToFile(Index, FileNameShort.utf8_str(), &ErrInfo)) - Index = NULL; + Index = nullptr; // index valid but track number still not set? if (Index) { @@ -113,7 +113,7 @@ void FFmpegSourceAudioProvider::LoadAudio(wxString filename) { // but do we have indexing info for the desired audio track? FFMS_Track *TempTrackData = FFMS_GetTrackFromIndex(Index, TrackNumber); if (FFMS_GetNumFrames(TempTrackData) <= 0) - Index = NULL; + Index = nullptr; } // no valid index exists and the file only has one audio track, index it else if (TrackNumber < 0) @@ -124,7 +124,7 @@ void FFmpegSourceAudioProvider::LoadAudio(wxString filename) { FFMS_IndexErrorHandling ErrorHandling = GetErrorHandlingMode(); #if FFMS_VERSION >= ((2 << 24) | (17 << 16) | (2 << 8) | 0) if (Index && FFMS_GetErrorHandling(Index) != ErrorHandling) - Index = NULL; + Index = nullptr; #endif // moment of truth diff --git a/aegisub/src/auto4_base.h b/aegisub/src/auto4_base.h index 292348c89..37d3221d3 100644 --- a/aegisub/src/auto4_base.h +++ b/aegisub/src/auto4_base.h @@ -257,7 +257,7 @@ namespace Automation4 { wxString engine_name; wxString filename_pattern; - /// Load a file, or return NULL if the file is not in a supported + /// Load a file, or return nullptr if the file is not in a supported /// format. If the file is in a supported format but is invalid, a /// script should be returned which returns false from IsLoaded and /// an appropriate error message from GetDescription. diff --git a/aegisub/src/avisynth_wrap.cpp b/aegisub/src/avisynth_wrap.cpp index f4b8a3092..7472b43eb 100644 --- a/aegisub/src/avisynth_wrap.cpp +++ b/aegisub/src/avisynth_wrap.cpp @@ -43,8 +43,8 @@ // Allocate storage for and initialise static members namespace { int avs_refcount = 0; - HINSTANCE hLib = NULL; - IScriptEnvironment *env = NULL; + HINSTANCE hLib = nullptr; + IScriptEnvironment *env = nullptr; wxMutex AviSynthMutex; } diff --git a/aegisub/src/base_grid.cpp b/aegisub/src/base_grid.cpp index b8b320864..969871f10 100644 --- a/aegisub/src/base_grid.cpp +++ b/aegisub/src/base_grid.cpp @@ -97,7 +97,7 @@ BaseGrid::BaseGrid(wxWindow* parent, agi::Context *context, const wxSize& size, , active_line(0) , batch_level(0) , batch_active_line_changed(false) -, seek_listener(context->videoController->AddSeekListener(std::bind(&BaseGrid::Refresh, this, false, (wxRect*)NULL))) +, seek_listener(context->videoController->AddSeekListener(std::bind(&BaseGrid::Refresh, this, false, nullptr))) , context_menu(0) , yPos(0) , context(context) @@ -134,7 +134,7 @@ BaseGrid::BaseGrid(wxWindow* parent, agi::Context *context, const wxSize& size, OPT_SUB("Colour/Subtitle Grid/Lines", &BaseGrid::UpdateStyle, this); OPT_SUB("Colour/Subtitle Grid/Selection", &BaseGrid::UpdateStyle, this); OPT_SUB("Colour/Subtitle Grid/Standard", &BaseGrid::UpdateStyle, this); - OPT_SUB("Subtitle/Grid/Hide Overrides", std::bind(&BaseGrid::Refresh, this, false, (wxRect*)NULL)); + OPT_SUB("Subtitle/Grid/Hide Overrides", std::bind(&BaseGrid::Refresh, this, false, nullptr)); Bind(wxEVT_CONTEXT_MENU, &BaseGrid::OnContextMenu, this); } @@ -229,7 +229,7 @@ void BaseGrid::UpdateStyle() { wxClientDC dc(this); dc.SetFont(font); int fw,fh; - dc.GetTextExtent("#TWFfgGhH", &fw, &fh, NULL, NULL, &font); + dc.GetTextExtent("#TWFfgGhH", &fw, &fh, nullptr, nullptr, &font); lineHeight = fh + 4; } diff --git a/aegisub/src/charset_conv.h b/aegisub/src/charset_conv.h index d31229130..879c823b1 100644 --- a/aegisub/src/charset_conv.h +++ b/aegisub/src/charset_conv.h @@ -48,7 +48,7 @@ public: // wxMBConv implementation; see strconv.h for usage details size_t ToWChar(wchar_t *dst, size_t dstLen, const char *src, size_t srcLen = wxNO_LEN) const; size_t FromWChar(char *dst, size_t dstLen, const wchar_t *src, size_t srcLen = wxNO_LEN) const; - wxMBConv *Clone() const { return NULL; }; + wxMBConv *Clone() const { return nullptr; }; protected: AegisubCSConv(); diff --git a/aegisub/src/dialog_manager.h b/aegisub/src/dialog_manager.h index 613ada741..f5d28c2eb 100644 --- a/aegisub/src/dialog_manager.h +++ b/aegisub/src/dialog_manager.h @@ -98,7 +98,7 @@ public: /// Get the dialog of the given type /// @tparam DialogType Type of dialog to get - /// @return A pointer to a DialogType or NULL if no dialog of the given type has been created + /// @return A pointer to a DialogType or nullptr if no dialog of the given type has been created template DialogType *Get() const { DialogMap::const_iterator it = created_dialogs.find(&typeid(DialogType)); diff --git a/aegisub/src/dialog_search_replace.cpp b/aegisub/src/dialog_search_replace.cpp index 52b5482b3..ee21e3dd9 100644 --- a/aegisub/src/dialog_search_replace.cpp +++ b/aegisub/src/dialog_search_replace.cpp @@ -265,7 +265,7 @@ void SearchReplaceEngine::ReplaceNext(bool DoReplace) { int start = curLine; int nrows = context->subsGrid->GetRows(); bool found = false; - wxString *Text = NULL; + wxString *Text = nullptr; size_t tempPos; int regFlags = wxRE_ADVANCED; if (!matchCase) { @@ -452,7 +452,7 @@ void SearchReplaceEngine::OnDialogOpen() { } void SearchReplaceEngine::OpenDialog (bool replace) { - static DialogSearchReplace *diag = NULL; + static DialogSearchReplace *diag = nullptr; // already opened if (diag) { diff --git a/aegisub/src/dialog_shift_times.cpp b/aegisub/src/dialog_shift_times.cpp index e5f0bb236..169c0090b 100644 --- a/aegisub/src/dialog_shift_times.cpp +++ b/aegisub/src/dialog_shift_times.cpp @@ -135,7 +135,7 @@ DialogShiftTimes::DialogShiftTimes(agi::Context *context) wxString time_field_vals[] = { _("Start a&nd End times"), _("&Start times only"), _("&End times only") }; time_fields = new wxRadioBox(this, -1, _("Times"), wxDefaultPosition, wxDefaultSize, 3, time_field_vals, 1); - history_box = new wxListBox(this, -1, wxDefaultPosition, wxSize(350, 100), 0, NULL, wxLB_HSCROLL); + history_box = new wxListBox(this, -1, wxDefaultPosition, wxSize(350, 100), 0, nullptr, wxLB_HSCROLL); wxButton *clear_button = new wxButton(this, -1, _("&Clear")); clear_button->Bind(wxEVT_COMMAND_BUTTON_CLICKED, &DialogShiftTimes::OnClear, this); diff --git a/aegisub/src/dialog_style_editor.cpp b/aegisub/src/dialog_style_editor.cpp index 8f41c95da..7ed155a86 100644 --- a/aegisub/src/dialog_style_editor.cpp +++ b/aegisub/src/dialog_style_editor.cpp @@ -324,8 +324,8 @@ DialogStyleEditor::DialogStyleEditor(wxWindow *parent, AssStyle *style, agi::Con MiscBox->Add(MiscBoxBottom, wxSizerFlags().Expand().Center().Border(wxTOP)); // Preview - SubsPreview = NULL; - PreviewText = NULL; + SubsPreview = nullptr; + PreviewText = nullptr; ColourButton *previewButton = 0; if (!SubtitlesProviderFactory::GetClasses().empty()) { PreviewText = new wxTextCtrl(this, -1, lagi_wxString(OPT_GET("Tool/Style Editor/Preview Text")->GetString())); diff --git a/aegisub/src/dialog_style_manager.cpp b/aegisub/src/dialog_style_manager.cpp index 914c09c2b..7b042bec7 100644 --- a/aegisub/src/dialog_style_manager.cpp +++ b/aegisub/src/dialog_style_manager.cpp @@ -163,7 +163,7 @@ DialogStyleManager::DialogStyleManager(agi::Context *context) // Catalog wxSizer *CatalogBox = new wxStaticBoxSizer(wxHORIZONTAL,this,_("Catalog of available storages")); - CatalogList = new wxComboBox(this,-1, "", wxDefaultPosition, wxSize(-1,-1), 0, NULL, wxCB_READONLY); + CatalogList = new wxComboBox(this,-1, "", wxDefaultPosition, wxSize(-1,-1), 0, nullptr, wxCB_READONLY); wxButton *CatalogNew = new wxButton(this, -1, _("New")); CatalogDelete = new wxButton(this, -1, _("Delete")); CatalogBox->Add(CatalogList,1,wxEXPAND | wxRIGHT | wxALIGN_RIGHT,5); @@ -174,7 +174,7 @@ DialogStyleManager::DialogStyleManager(agi::Context *context) wxSizer *StorageButtons = make_edit_buttons(this, _("Copy to ¤t script ->"), &MoveToLocal, &StorageNew, &StorageEdit, &StorageCopy, &StorageDelete); wxSizer *StorageListSizer = new wxBoxSizer(wxHORIZONTAL); - StorageList = new wxListBox(this, -1, wxDefaultPosition, wxSize(240,250), 0, NULL, wxLB_EXTENDED); + StorageList = new wxListBox(this, -1, wxDefaultPosition, wxSize(240,250), 0, nullptr, wxLB_EXTENDED); StorageListSizer->Add(StorageList,1,wxEXPAND | wxRIGHT,0); StorageListSizer->Add(make_move_buttons(this, &StorageMoveUp, &StorageMoveDown, &StorageMoveTop, &StorageMoveBottom, &StorageSort), wxSizerFlags().Expand()); @@ -192,7 +192,7 @@ DialogStyleManager::DialogStyleManager(agi::Context *context) MoveImportSizer->Add(CurrentImport,1,wxEXPAND,0); wxSizer *CurrentListSizer = new wxBoxSizer(wxHORIZONTAL); - CurrentList = new wxListBox(this, -1, wxDefaultPosition, wxSize(240,250), 0, NULL, wxLB_EXTENDED); + CurrentList = new wxListBox(this, -1, wxDefaultPosition, wxSize(240,250), 0, nullptr, wxLB_EXTENDED); CurrentListSizer->Add(CurrentList,1,wxEXPAND | wxRIGHT,0); CurrentListSizer->Add(make_move_buttons(this, &CurrentMoveUp, &CurrentMoveDown, &CurrentMoveTop, &CurrentMoveBottom, &CurrentSort), wxSizerFlags().Expand()); diff --git a/aegisub/src/dialog_style_manager.h b/aegisub/src/dialog_style_manager.h index 1ef3ca764..b2bdfb96e 100644 --- a/aegisub/src/dialog_style_manager.h +++ b/aegisub/src/dialog_style_manager.h @@ -112,12 +112,12 @@ class DialogStyleManager : public wxDialog { void MoveStyles(bool storage, int type); /// Open the style editor for the given style on the script - /// @param style Style to edit, or NULL for new + /// @param style Style to edit, or nullptr for new /// @param new_name Default new name for copies void ShowCurrentEditor(AssStyle *style, wxString const& new_name = ""); /// Open the style editor for the given style in the storage - /// @param style Style to edit, or NULL for new + /// @param style Style to edit, or nullptr for new /// @param new_name Default new name for copies void ShowStorageEditor(AssStyle *style, wxString const& new_name = ""); diff --git a/aegisub/src/dialog_text_import.cpp b/aegisub/src/dialog_text_import.cpp index cd231ba13..50f69d59e 100644 --- a/aegisub/src/dialog_text_import.cpp +++ b/aegisub/src/dialog_text_import.cpp @@ -46,7 +46,7 @@ #include "main.h" DialogTextImport::DialogTextImport() -: wxDialog(NULL , -1, _("Text import options")) +: wxDialog(nullptr , -1, _("Text import options")) { // Main controls wxFlexGridSizer *fg = new wxFlexGridSizer(2, 5, 5); diff --git a/aegisub/src/factory_manager.h b/aegisub/src/factory_manager.h index 572caac85..76e650946 100644 --- a/aegisub/src/factory_manager.h +++ b/aegisub/src/factory_manager.h @@ -64,11 +64,11 @@ protected: } static func Find(std::string name) { - if (!classes) return NULL; + if (!classes) return nullptr; iterator factory = classes->find(name); if (factory != classes->end()) return factory->second.second; - return NULL; + return nullptr; } public: @@ -107,7 +107,7 @@ public: return factory(); } else { - return NULL; + return nullptr; } } @@ -131,7 +131,7 @@ public: return factory(a1); } else { - return NULL; + return nullptr; } } diff --git a/aegisub/src/ffmpegsource_common.cpp b/aegisub/src/ffmpegsource_common.cpp index e8b5cfc74..4ad7bff00 100644 --- a/aegisub/src/ffmpegsource_common.cpp +++ b/aegisub/src/ffmpegsource_common.cpp @@ -67,7 +67,7 @@ FFmpegSourceProvider::FFmpegSourceProvider() : COMInited(false, deinit_com) { #ifdef WIN32 - HRESULT res = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED); + HRESULT res = CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED); if (SUCCEEDED(res)) COMInited = true; else if (res != RPC_E_CHANGED_MODE) @@ -95,7 +95,7 @@ static int FFMS_CC UpdateIndexingProgress(int64_t Current, int64_t Total, void * /// @param CacheName The filename of the output index file /// @param Trackmask A binary mask of the track numbers to index /// @param IgnoreDecodeErrors True if audio decoding errors will be tolerated, false otherwise -/// @return Returns the index object on success, NULL otherwise +/// @return Returns the index object on success, nullptr otherwise /// FFMS_Index *FFmpegSourceProvider::DoIndexing(FFMS_Indexer *Indexer, const wxString &CacheName, int Trackmask, FFMS_IndexErrorHandling IndexEH) { char FFMSErrMsg[1024]; @@ -115,7 +115,7 @@ FFMS_Index *FFmpegSourceProvider::DoIndexing(FFMS_Indexer *Indexer, const wxStri Index = FFMS_DoIndexing(Indexer, Trackmask, FFMS_TRACKMASK_NONE, nullptr, nullptr, IndexEH, UpdateIndexingProgress, ps, &ErrInfo); }); - if (Index == NULL) { + if (Index == nullptr) { MsgString.Append("Failed to index: ").Append(wxString(ErrInfo.Buffer, wxConvUTF8)); throw MsgString; } diff --git a/aegisub/src/font_file_lister_fontconfig.cpp b/aegisub/src/font_file_lister_fontconfig.cpp index c5a16482a..4515ae0b4 100644 --- a/aegisub/src/font_file_lister_fontconfig.cpp +++ b/aegisub/src/font_file_lister_fontconfig.cpp @@ -154,7 +154,7 @@ FontFileLister::CollectionResult FontConfigFontFileLister::GetFontPaths(wxString if (!FcConfigSubstitute(config, pat, FcMatchPattern)) return ret; FcResult result; - agi::scoped_holder fsorted(FcFontSort(config, pat, true, NULL, &result), FcFontSetDestroy); + agi::scoped_holder fsorted(FcFontSort(config, pat, true, nullptr, &result), FcFontSetDestroy); agi::scoped_holder ffullname(MatchFullname(family.c_str(), weight, slant), FcFontSetDestroy); if (!fsorted || !ffullname) return ret; diff --git a/aegisub/src/gl_text.cpp b/aegisub/src/gl_text.cpp index 7490250c7..5d81c06ff 100644 --- a/aegisub/src/gl_text.cpp +++ b/aegisub/src/gl_text.cpp @@ -250,7 +250,7 @@ OpenGLTextTexture::OpenGLTextTexture(OpenGLTextGlyph &glyph) { glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_T,GL_CLAMP); // Allocate texture - glTexImage2D(GL_TEXTURE_2D,0,GL_RGBA8,width,height,0,GL_ALPHA,GL_UNSIGNED_BYTE,NULL); + glTexImage2D(GL_TEXTURE_2D,0,GL_RGBA8,width,height,0,GL_ALPHA,GL_UNSIGNED_BYTE,nullptr); if (glGetError()) throw "Internal OpenGL text renderer error: Could not allocate Text Texture"; TryToInsert(glyph); diff --git a/aegisub/src/hotkey_data_view_model.h b/aegisub/src/hotkey_data_view_model.h index 60f4279f9..179637d5d 100644 --- a/aegisub/src/hotkey_data_view_model.h +++ b/aegisub/src/hotkey_data_view_model.h @@ -36,9 +36,9 @@ class HotkeyDataViewModel : public wxDataViewModel { Preferences *parent; bool has_pending_changes; - /// Get the real item from the wrapper, or root if it's wrapping NULL + /// Get the real item from the wrapper, or root if it's wrapping nullptr const HotkeyModelItem *get(wxDataViewItem const& item) const; - /// Get the real item from the wrapper, or root if it's wrapping NULL + /// Get the real item from the wrapper, or root if it's wrapping nullptr HotkeyModelItem *get(wxDataViewItem const& item); public: HotkeyDataViewModel(Preferences *parent); diff --git a/aegisub/src/main.cpp b/aegisub/src/main.cpp index 28494b26c..f22e7c46f 100644 --- a/aegisub/src/main.cpp +++ b/aegisub/src/main.cpp @@ -87,7 +87,7 @@ namespace config { // wxWidgets macro IMPLEMENT_APP(AegisubApp) -static const char *LastStartupState = NULL; +static const char *LastStartupState = nullptr; #ifdef WITH_STARTUPLOG #define StartupLog(a) MessageBox(0, L ## a, L"Aegisub startup log", 0) @@ -209,11 +209,11 @@ bool AegisubApp::OnInit() { #endif StartupLog("Inside OnInit"); - frame = NULL; + frame = nullptr; try { // Initialize randomizer StartupLog("Initialize random generator"); - srand(time(NULL)); + srand(time(nullptr)); // locale for loading options StartupLog("Set initial locale"); @@ -336,7 +336,7 @@ static void UnhandledExeception(bool stackWalk) { #endif // Inform user of crash. - wxMessageBox(wxString::Format(exception_message, filename), _("Program error"), wxOK | wxICON_ERROR | wxCENTER, NULL); + wxMessageBox(wxString::Format(exception_message, filename), _("Program error"), wxOK | wxICON_ERROR | wxCENTER, nullptr); } else if (LastStartupState) { #if wxUSE_STACKWALKER == 1 @@ -488,7 +488,7 @@ int AegisubApp::OnRun() { #ifdef __WXMAC__ void AegisubApp::MacOpenFile(const wxString &filename) { - if (frame != NULL && !filename.empty()) { + if (frame != nullptr && !filename.empty()) { frame->LoadSubtitles(filename); wxFileName filepath(filename); OPT_SET("Path/Last/Subtitles")->SetString(STD_STR(filepath.GetPath())); diff --git a/aegisub/src/menu.cpp b/aegisub/src/menu.cpp index 8166257d9..d69fa5e1c 100644 --- a/aegisub/src/menu.cpp +++ b/aegisub/src/menu.cpp @@ -119,7 +119,7 @@ struct menu_item_cmp { /// @brief Event dispatcher to update menus on open and handle click events /// /// Some of what the class does could be dumped off on wx, but wxEVT_MENU_OPEN -/// is super buggy (GetMenu() often returns NULL and it outright doesn't trigger +/// is super buggy (GetMenu() often returns nullptr and it outright doesn't trigger /// on submenus in many cases, and registering large numbers of wxEVT_UPDATE_UI /// handlers makes everything involves events unusably slow. class CommandManager { diff --git a/aegisub/src/mkv_wrap.cpp b/aegisub/src/mkv_wrap.cpp index 2065415d9..cd39901ae 100644 --- a/aegisub/src/mkv_wrap.cpp +++ b/aegisub/src/mkv_wrap.cpp @@ -219,7 +219,7 @@ void MatroskaWrapper::GetSubtitles(wxString const& filename, AssFile *target) { // Progress bar double totalTime = double(segInfo->Duration) / timecodeScale; - DialogProgress progress(NULL, _("Parsing Matroska"), _("Reading subtitles from Matroska file.")); + DialogProgress progress(nullptr, _("Parsing Matroska"), _("Reading subtitles from Matroska file.")); progress.Run([&](agi::ProgressSink *ps) { read_subtitles(ps, file, &input, srt, totalTime, &parser); }); } catch (...) { @@ -352,7 +352,7 @@ MkvStdIO::MkvStdIO(wxString filename) fp = fopen(fname.GetFullPath().utf8_str(), "rb"); #endif if (fp) { - setvbuf(fp, NULL, _IOFBF, CACHESIZE); + setvbuf(fp, nullptr, _IOFBF, CACHESIZE); } else { throw agi::FileNotFoundError(STD_STR(filename)); diff --git a/aegisub/src/plugin_manager.cpp b/aegisub/src/plugin_manager.cpp index fa30ecba9..e5311af1f 100644 --- a/aegisub/src/plugin_manager.cpp +++ b/aegisub/src/plugin_manager.cpp @@ -49,7 +49,7 @@ PluginManager::PluginManager() { init = false; #ifdef WITH_AUTO4_LUA - lua = NULL; + lua = nullptr; #endif } diff --git a/aegisub/src/preferences_base.cpp b/aegisub/src/preferences_base.cpp index 07a3d775f..7bb292ce4 100644 --- a/aegisub/src/preferences_base.cpp +++ b/aegisub/src/preferences_base.cpp @@ -67,7 +67,7 @@ class ColourUpdater { const char *name; Preferences *parent; public: - ColourUpdater(const char *n = "", Preferences *p = NULL) : name(n), parent(p) { } + ColourUpdater(const char *n = "", Preferences *p = nullptr) : name(n), parent(p) { } void operator()(wxCommandEvent& evt) { ColourButton *btn = static_cast(evt.GetClientData()); if (btn) diff --git a/aegisub/src/selection_controller.h b/aegisub/src/selection_controller.h index 916dc9c25..50c7aa798 100644 --- a/aegisub/src/selection_controller.h +++ b/aegisub/src/selection_controller.h @@ -76,7 +76,7 @@ public: /// @brief Change the active line /// @param new_line Subtitle line to become the new active line /// - /// The active line may be changed to NULL, in which case there is no longer an + /// The active line may be changed to nullptr, in which case there is no longer an /// active line. /// /// Calling this method should only cause a change notification to be sent if @@ -86,7 +86,7 @@ public: virtual void SetActiveLine(ItemDataType new_line) = 0; /// @brief Obtain the active line - /// @return The active line or NULL if there is none + /// @return The active line or nullptr if there is none virtual ItemDataType GetActiveLine() const = 0; /// @brief Change the selected set diff --git a/aegisub/src/spellchecker.cpp b/aegisub/src/spellchecker.cpp index bd9055e91..28e4ffbc3 100644 --- a/aegisub/src/spellchecker.cpp +++ b/aegisub/src/spellchecker.cpp @@ -44,7 +44,7 @@ agi::SpellChecker *SpellCheckerFactory::GetSpellChecker() { std::vector list = GetClasses(OPT_GET("Tool/Spell Checker/Backend")->GetString()); - if (list.empty()) return NULL; + if (list.empty()) return nullptr; // Get provider wxString error; @@ -67,4 +67,4 @@ void SpellCheckerFactory::RegisterProviders() { #endif } -template<> SpellCheckerFactory::map *FactoryBase::classes = NULL; +template<> SpellCheckerFactory::map *FactoryBase::classes = nullptr; diff --git a/aegisub/src/subtitle_format.h b/aegisub/src/subtitle_format.h index b35f5f47d..0dc463777 100644 --- a/aegisub/src/subtitle_format.h +++ b/aegisub/src/subtitle_format.h @@ -131,9 +131,9 @@ public: /// @param mode 0: load 1: save static wxString GetWildcards(int mode); - /// Get a subtitle format that can read the given file or NULL if none can + /// Get a subtitle format that can read the given file or nullptr if none can static const SubtitleFormat *GetReader(wxString const& filename); - /// Get a subtitle format that can write the given file or NULL if none can + /// Get a subtitle format that can write the given file or nullptr if none can static const SubtitleFormat *GetWriter(wxString const& filename); /// Initialize subtitle formats static void LoadFormats(); diff --git a/aegisub/src/subtitle_format_ttxt.cpp b/aegisub/src/subtitle_format_ttxt.cpp index 2f0b7141e..5574d836b 100644 --- a/aegisub/src/subtitle_format_ttxt.cpp +++ b/aegisub/src/subtitle_format_ttxt.cpp @@ -170,7 +170,7 @@ void TTXTSubtitleFormat::WriteFile(const AssFile *src, wxString const& filename, // Create XML structure wxXmlDocument doc; - wxXmlNode *root = new wxXmlNode(NULL, wxXML_ELEMENT_NODE, "TextStream"); + wxXmlNode *root = new wxXmlNode(nullptr, wxXML_ELEMENT_NODE, "TextStream"); root->AddAttribute("version", "1.1"); doc.SetRoot(root); diff --git a/aegisub/src/subtitles_provider.cpp b/aegisub/src/subtitles_provider.cpp index ac6d39a61..426209adf 100644 --- a/aegisub/src/subtitles_provider.cpp +++ b/aegisub/src/subtitles_provider.cpp @@ -80,4 +80,4 @@ void SubtitlesProviderFactory::RegisterProviders() { #endif } -template<> SubtitlesProviderFactory::map *FactoryBase::classes = NULL; +template<> SubtitlesProviderFactory::map *FactoryBase::classes = nullptr; diff --git a/aegisub/src/subtitles_provider_csri.cpp b/aegisub/src/subtitles_provider_csri.cpp index d51ce2700..b9b39e8a5 100644 --- a/aegisub/src/subtitles_provider_csri.cpp +++ b/aegisub/src/subtitles_provider_csri.cpp @@ -86,7 +86,7 @@ void CSRISubtitlesProvider::LoadSubtitles(AssFile *subs) { subs->SaveMemory(data); wxMutexLocker lock(csri_mutex); - instance = csri_open_mem(renderer, &data[0], data.size(), NULL); + instance = csri_open_mem(renderer, &data[0], data.size(), nullptr); } // Open from disk else { @@ -98,7 +98,7 @@ void CSRISubtitlesProvider::LoadSubtitles(AssFile *subs) { subs->Save(tempfile, false, false, wxSTRING_ENCODING); wxMutexLocker lock(csri_mutex); - instance = csri_open_file(renderer, tempfile.utf8_str(), NULL); + instance = csri_open_file(renderer, tempfile.utf8_str(), nullptr); } } diff --git a/aegisub/src/subtitles_provider_libass.cpp b/aegisub/src/subtitles_provider_libass.cpp index d4022715c..965ada76f 100644 --- a/aegisub/src/subtitles_provider_libass.cpp +++ b/aegisub/src/subtitles_provider_libass.cpp @@ -81,22 +81,22 @@ class FontConfigCacheThread : public wxThread { ASS_Renderer *ass_renderer; FontConfigCacheThread** thisPtr; ExitCode Entry() { - const char *config_path = NULL; + const char *config_path = nullptr; #ifdef __APPLE__ std::string conf_path = agi::util::OSX_GetBundleResourcesDirectory() + "/etc/fonts/fonts.conf"; config_path = conf_path.c_str(); #endif if (ass_library) ass_renderer = ass_renderer_init(ass_library); - ass_set_fonts(ass_renderer, NULL, "Sans", 1, config_path, true); + ass_set_fonts(ass_renderer, nullptr, "Sans", 1, config_path, true); if (ass_library) ass_renderer_done(ass_renderer); - *thisPtr = NULL; + *thisPtr = nullptr; return EXIT_SUCCESS; } public: FontConfigCacheThread(ASS_Library *ass_library, FontConfigCacheThread **thisPtr) : ass_library(ass_library) - , ass_renderer(NULL) + , ass_renderer(nullptr) , thisPtr(thisPtr) { *thisPtr = this; @@ -104,7 +104,7 @@ public: Run(); } FontConfigCacheThread(ASS_Renderer *ass_renderer, FontConfigCacheThread **thisPtr) - : ass_library(NULL) + : ass_library(nullptr) , ass_renderer(ass_renderer) , thisPtr(thisPtr) { @@ -133,7 +133,7 @@ LibassSubtitlesProvider::LibassSubtitlesProvider(std::string) { wait_for_cache_thread(&cache_worker); // Initialize renderer - ass_track = NULL; + ass_track = nullptr; ass_renderer = ass_renderer_init(ass_library); if (!ass_renderer) throw "ass_renderer_init failed"; ass_set_font_scale(ass_renderer, 1.); @@ -185,7 +185,7 @@ void LibassSubtitlesProvider::DrawSubtitles(AegiVideoFrame &frame,double time) { ass_set_frame_size(ass_renderer, frame.w, frame.h); // Get frame - ASS_Image* img = ass_render_frame(ass_renderer, ass_track, int(time * 1000), NULL); + ASS_Image* img = ass_render_frame(ass_renderer, ass_track, int(time * 1000), nullptr); // libass actually returns several alpha-masked monochrome images. // Here, we loop through their linked list, get the colour of the current, and blend into the frame. @@ -240,12 +240,12 @@ void LibassSubtitlesProvider::DrawSubtitles(AegiVideoFrame &frame,double time) { void LibassSubtitlesProvider::CacheFonts() { ass_library = ass_library_init(); - ass_set_message_cb(ass_library, msg_callback, NULL); + ass_set_message_cb(ass_library, msg_callback, nullptr); new FontConfigCacheThread(ass_library, &cache_worker); } /// DOCME ASS_Library* LibassSubtitlesProvider::ass_library; -FontConfigCacheThread* LibassSubtitlesProvider::cache_worker = NULL; +FontConfigCacheThread* LibassSubtitlesProvider::cache_worker = nullptr; #endif // WITH_LIBASS diff --git a/aegisub/src/threaded_frame_source.cpp b/aegisub/src/threaded_frame_source.cpp index cfcacd32c..c17ff61f1 100644 --- a/aegisub/src/threaded_frame_source.cpp +++ b/aegisub/src/threaded_frame_source.cpp @@ -239,7 +239,7 @@ VideoProviderErrorEvent::VideoProviderErrorEvent(VideoProviderError const& err) SetEventType(EVT_VIDEO_ERROR); } SubtitlesProviderErrorEvent::SubtitlesProviderErrorEvent(wxString err) -: agi::Exception(STD_STR(err), NULL) +: agi::Exception(STD_STR(err), nullptr) { SetEventType(EVT_SUBTITLES_ERROR); } diff --git a/aegisub/src/utils.cpp b/aegisub/src/utils.cpp index 7716c682d..643feb177 100644 --- a/aegisub/src/utils.cpp +++ b/aegisub/src/utils.cpp @@ -315,7 +315,7 @@ class cache_cleaner : public wxThread { do { wxFileName curfn(directory, curfn_str); wxDateTime curatime; - curfn.GetTimes(&curatime, NULL, NULL); + curfn.GetTimes(&curatime, nullptr, nullptr); cachefiles.insert(std::make_pair(curatime.GetTicks(), curfn)); total_size += curfn.GetSize().GetValue(); diff --git a/aegisub/src/variable_data.cpp b/aegisub/src/variable_data.cpp index 9888434d4..05165b989 100644 --- a/aegisub/src/variable_data.cpp +++ b/aegisub/src/variable_data.cpp @@ -44,7 +44,7 @@ VariableData::VariableData() { type = VARDATA_NONE; - value = NULL; + value = nullptr; } VariableData::~VariableData() { @@ -64,7 +64,7 @@ void VariableData::DeleteValue() { default: break; } type = VARDATA_NONE; - value = NULL; + value = nullptr; } template static inline VariableDataType get_type(); diff --git a/aegisub/src/video_context.h b/aegisub/src/video_context.h index 5d056bfc9..e48bd3774 100644 --- a/aegisub/src/video_context.h +++ b/aegisub/src/video_context.h @@ -77,7 +77,7 @@ class VideoContext : public wxEvtHandler { agi::Context *context; - /// The video provider owned by the threaded frame source, or NULL if no + /// The video provider owned by the threaded frame source, or nullptr if no /// video is open VideoProvider *videoProvider; diff --git a/aegisub/src/video_out_gl.cpp b/aegisub/src/video_out_gl.cpp index 04ce41c58..922476e48 100644 --- a/aegisub/src/video_out_gl.cpp +++ b/aegisub/src/video_out_gl.cpp @@ -83,7 +83,7 @@ struct VideoOutGL::TextureInfo { /// @param format The texture's format /// @return Whether the texture could be created. static bool TestTexture(int width, int height, GLint format) { - glTexImage2D(GL_PROXY_TEXTURE_2D, 0, format, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL); + glTexImage2D(GL_PROXY_TEXTURE_2D, 0, format, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, nullptr); glGetTexLevelParameteriv(GL_PROXY_TEXTURE_2D, 0, GL_TEXTURE_INTERNAL_FORMAT, &format); while (glGetError()) { } // Silently swallow all errors as we don't care why it failed if it did @@ -272,7 +272,7 @@ void VideoOutGL::InitTextures(int width, int height, GLenum format, int bpp, boo for (int i = 0; i < textureCount; ++i) { LOG_I("video/out/gl") << "Using texture size: " << textureSizes[i].first << "x" << textureSizes[i].second; CHECK_INIT_ERROR(glBindTexture(GL_TEXTURE_2D, textureIdList[i])); - CHECK_INIT_ERROR(glTexImage2D(GL_TEXTURE_2D, 0, internalFormat, textureSizes[i].first, textureSizes[i].second, 0, format, GL_UNSIGNED_BYTE, NULL)); + CHECK_INIT_ERROR(glTexImage2D(GL_TEXTURE_2D, 0, internalFormat, textureSizes[i].first, textureSizes[i].second, 0, format, GL_UNSIGNED_BYTE, nullptr)); CHECK_INIT_ERROR(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR)); CHECK_INIT_ERROR(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR)); CHECK_INIT_ERROR(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP)); diff --git a/aegisub/src/video_provider_ffmpegsource.cpp b/aegisub/src/video_provider_ffmpegsource.cpp index 7533bc12e..01cb00e89 100644 --- a/aegisub/src/video_provider_ffmpegsource.cpp +++ b/aegisub/src/video_provider_ffmpegsource.cpp @@ -58,8 +58,8 @@ /// @brief Constructor /// @param filename The filename to open FFmpegSourceVideoProvider::FFmpegSourceVideoProvider(wxString filename) try -: VideoSource(NULL, FFMS_DestroyVideoSource) -, VideoInfo(NULL) +: VideoSource(nullptr, FFMS_DestroyVideoSource) +, VideoInfo(nullptr) , Width(-1) , Height(-1) , FrameNumber(-1) @@ -112,7 +112,7 @@ void FFmpegSourceVideoProvider::LoadVideo(wxString filename) { Index(FFMS_ReadIndex(CacheName.utf8_str(), &ErrInfo), FFMS_DestroyIndex); if (Index && FFMS_IndexBelongsToFile(Index, FileNameShort.utf8_str(), &ErrInfo)) - Index = NULL; + Index = nullptr; // time to examine the index and check if the track we want is indexed // technically this isn't really needed since all video tracks should always be indexed, @@ -120,7 +120,7 @@ void FFmpegSourceVideoProvider::LoadVideo(wxString filename) { if (Index && TrackNumber >= 0) { FFMS_Track *TempTrackData = FFMS_GetTrackFromIndex(Index, TrackNumber); if (FFMS_GetNumFrames(TempTrackData) <= 0) - Index = NULL; + Index = nullptr; } // moment of truth @@ -224,10 +224,10 @@ void FFmpegSourceVideoProvider::LoadVideo(wxString filename) { // get frame info data FFMS_Track *FrameData = FFMS_GetTrackFromVideo(VideoSource); - if (FrameData == NULL) + if (FrameData == nullptr) throw VideoOpenError("failed to get frame data"); const FFMS_TrackTimeBase *TimeBase = FFMS_GetTimeBase(FrameData); - if (TimeBase == NULL) + if (TimeBase == nullptr) throw VideoOpenError("failed to get track time base"); const FFMS_FrameInfo *CurFrameData; @@ -236,7 +236,7 @@ void FFmpegSourceVideoProvider::LoadVideo(wxString filename) { std::vector TimecodesVector; for (int CurFrameNum = 0; CurFrameNum < VideoInfo->NumFrames; CurFrameNum++) { CurFrameData = FFMS_GetFrameInfo(FrameData, CurFrameNum); - if (CurFrameData == NULL) { + if (CurFrameData == nullptr) { throw VideoOpenError(STD_STR(wxString::Format("Couldn't get info about frame %d", CurFrameNum))); } @@ -261,7 +261,7 @@ const AegiVideoFrame FFmpegSourceVideoProvider::GetFrame(int n) { // decode frame const FFMS_Frame *SrcFrame = FFMS_GetFrame(VideoSource, FrameNumber, &ErrInfo); - if (SrcFrame == NULL) { + if (SrcFrame == nullptr) { throw VideoDecodeError(std::string("Failed to retrieve frame: ") + ErrInfo.Buffer); } diff --git a/aegisub/src/video_provider_manager.cpp b/aegisub/src/video_provider_manager.cpp index d393165e3..94531ff0f 100644 --- a/aegisub/src/video_provider_manager.cpp +++ b/aegisub/src/video_provider_manager.cpp @@ -118,4 +118,4 @@ void VideoProviderFactory::RegisterProviders() { Register("YUV4MPEG", true); } -template<> VideoProviderFactory::map *FactoryBase::classes = NULL; +template<> VideoProviderFactory::map *FactoryBase::classes = nullptr; diff --git a/aegisub/src/video_provider_yuv4mpeg.cpp b/aegisub/src/video_provider_yuv4mpeg.cpp index 4c78afd3b..51fbbe577 100644 --- a/aegisub/src/video_provider_yuv4mpeg.cpp +++ b/aegisub/src/video_provider_yuv4mpeg.cpp @@ -54,7 +54,7 @@ /// @brief Constructor /// @param filename The filename to open YUV4MPEGVideoProvider::YUV4MPEGVideoProvider(wxString fname) -: sf(NULL) +: sf(nullptr) , inited(false) , w (0) , h (0) @@ -75,7 +75,7 @@ YUV4MPEGVideoProvider::YUV4MPEGVideoProvider(wxString fname) sf = fopen(filename.utf8_str(), "rb"); #endif - if (sf == NULL) throw agi::FileNotFoundError(STD_STR(fname)); + if (sf == nullptr) throw agi::FileNotFoundError(STD_STR(fname)); CheckFileFormat(); diff --git a/aegisub/src/video_slider.cpp b/aegisub/src/video_slider.cpp index 568ceabde..36c6060de 100644 --- a/aegisub/src/video_slider.cpp +++ b/aegisub/src/video_slider.cpp @@ -57,7 +57,7 @@ VideoSlider::VideoSlider (wxWindow* parent, agi::Context *c) SetMinSize(wxSize(20, 25)); SetBackgroundStyle(wxBG_STYLE_PAINT); - slots.push_back(OPT_SUB("Video/Slider/Show Keyframes", &wxWindow::Refresh, this, false, (wxRect*)NULL)); + slots.push_back(OPT_SUB("Video/Slider/Show Keyframes", &wxWindow::Refresh, this, false, nullptr)); slots.push_back(c->videoController->AddSeekListener(&VideoSlider::SetValue, this)); slots.push_back(c->videoController->AddVideoOpenListener(&VideoSlider::VideoOpened, this)); slots.push_back(c->videoController->AddKeyframesListener(&VideoSlider::KeyframesChanged, this)); diff --git a/aegisub/src/visual_feature.h b/aegisub/src/visual_feature.h index 301446909..425c43f26 100644 --- a/aegisub/src/visual_feature.h +++ b/aegisub/src/visual_feature.h @@ -64,7 +64,7 @@ public: DraggableFeatureType type; ///< Shape of feature Vector2D pos; ///< Position of this feature int layer; ///< Layer; Higher = above - AssDialogue* line; ///< The dialogue line this feature is for; may be NULL + AssDialogue* line; ///< The dialogue line this feature is for; may be nullptr /// @brief Is the given point over this feature? /// @param mouse_pos Position of the mouse diff --git a/aegisub/src/visual_tool.cpp b/aegisub/src/visual_tool.cpp index 67c8142d1..8ba5f2d8a 100644 --- a/aegisub/src/visual_tool.cpp +++ b/aegisub/src/visual_tool.cpp @@ -366,7 +366,7 @@ struct scoped_tag_parse { ~scoped_tag_parse() { diag->ClearBlocks(); } }; -// Find a tag's parameters in a line or return NULL if it's not found +// Find a tag's parameters in a line or return nullptr if it's not found static param_vec find_tag(const AssDialogue *line, wxString tag_name) { for (auto ovr : line->Blocks | agi::of_type()) { for (auto tag : ovr->Tags) { @@ -569,7 +569,7 @@ void VisualToolBase::SetOverride(AssDialogue* line, wxString const& tag, wxStrin AssDialogueBlock *block = line->Blocks.front(); // Get current block as plain or override - assert(dynamic_cast(block) == NULL); + assert(dynamic_cast(block) == nullptr); if (dynamic_cast(block)) line->Text = "{" + insert + "}" + line->Text; diff --git a/aegisub/src/visual_tool.h b/aegisub/src/visual_tool.h index ac5126af1..b7d95c56f 100644 --- a/aegisub/src/visual_tool.h +++ b/aegisub/src/visual_tool.h @@ -61,7 +61,7 @@ class VisualToolBase { void OnMouseCaptureLost(wxMouseCaptureLostEvent &); /// @brief Get the dialogue line currently in the edit box - /// @return NULL if the line is not active on the current frame + /// @return nullptr if the line is not active on the current frame AssDialogue *GetActiveDialogueLine(); // SubtitleSelectionListener implementation @@ -100,7 +100,7 @@ protected: VideoDisplay *parent; bool holding; ///< Is a hold currently in progress? - AssDialogue *active_line; ///< Active dialogue line; NULL if it is not visible on the current frame + AssDialogue *active_line; ///< Active dialogue line; nullptr if it is not visible on the current frame bool dragging; ///< Is a drag currently in progress? int frame_number; ///< Current frame number diff --git a/aegisub/src/visual_tool_drag.h b/aegisub/src/visual_tool_drag.h index b99587e7e..6fc4d410a 100644 --- a/aegisub/src/visual_tool_drag.h +++ b/aegisub/src/visual_tool_drag.h @@ -41,7 +41,7 @@ class VisualToolDrag : public VisualTool { wxToolBar *toolbar; /// The feature last clicked on for the double-click handler /// Equal to curFeature during drags; possibly different at all other times - /// NNULL if no features have been clicked on or the last clicked on one no + /// nullptr if no features have been clicked on or the last clicked on one no /// longer exists Feature *primary; /// The last announced selection set