NULL -> nullptr

This commit is contained in:
Thomas Goyne 2012-11-13 08:51:01 -08:00
parent 47c678bd63
commit 06aaaff16b
54 changed files with 112 additions and 112 deletions

View File

@ -107,7 +107,7 @@ wxString AegisubLocale::PickLanguage() {
if (!active_language.empty()) if (!active_language.empty())
style |= wxCANCEL; 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) #if wxCHECK_VERSION(2, 9, 4)
(void **)0, (void **)0,
#else #else

View File

@ -162,7 +162,7 @@ public:
/// @brief Process parameters via callback /// @brief Process parameters via callback
/// @param callback The callback function to call per tag parameter /// @param callback The callback function to call per tag parameter
/// @param userData User data to pass to callback function /// @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 /// Strip all ASS tags from the text
void StripTags(); void StripTags();
/// Strip a specific ASS tag from the text /// Strip a specific ASS tag from the text

View File

@ -64,7 +64,7 @@ public:
static void Unregister(AssExportFilter *filter); static void Unregister(AssExportFilter *filter);
/// Unregister and delete all export filters /// Unregister and delete all export filters
static void Clear(); 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); static AssExportFilter *GetFilter(wxString const& name);
/// Get the list of registered filters /// Get the list of registered filters

View File

@ -114,7 +114,7 @@ public:
wxArrayString GetStyles() const; wxArrayString GetStyles() const;
/// @brief Get a style by name /// @brief Get a style by name
/// @param name Style name /// @param name Style name
/// @return Pointer to style or NULL /// @return Pointer to style or nullptr
AssStyle *GetStyle(wxString const& name); AssStyle *GetStyle(wxString const& name);
void swap(AssFile &) throw(); void swap(AssFile &) throw();

View File

@ -74,7 +74,7 @@ public:
/// Get the style with the given name /// Get the style with the given name
/// @param name Case-insensitive style 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); AssStyle *GetStyle(wxString const& name);
/// Save stored styles to a file /// Save stored styles to a file

View File

@ -90,4 +90,4 @@ void AudioPlayerFactory::RegisterProviders() {
#endif #endif
} }
template<> AudioPlayerFactory::map *FactoryBase<AudioPlayer *(*)(AudioProvider*)>::classes = NULL; template<> AudioPlayerFactory::map *FactoryBase<AudioPlayer *(*)(AudioProvider*)>::classes = nullptr;

View File

@ -60,7 +60,7 @@ DirectSoundPlayer::DirectSoundPlayer(AudioProvider *provider)
{ {
// Initialize the DirectSound object // Initialize the DirectSound object
HRESULT res; 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); if (FAILED(res)) throw agi::AudioPlayerOpenError("Failed initializing DirectSound", 0);
// Set DirectSound parameters // Set DirectSound parameters
@ -91,7 +91,7 @@ DirectSoundPlayer::DirectSoundPlayer(AudioProvider *provider)
// Create the buffer // Create the buffer
IDirectSoundBuffer *buf; 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); if (res != DS_OK) throw agi::AudioPlayerOpenError("Failed creating DirectSound buffer", 0);
// Copy interface to buffer // Copy interface to buffer
@ -108,13 +108,13 @@ DirectSoundPlayer::~DirectSoundPlayer() {
// Unref the DirectSound buffer // Unref the DirectSound buffer
if (buffer) { if (buffer) {
buffer->Release(); buffer->Release();
buffer = NULL; buffer = nullptr;
} }
// Unref the DirectSound object // Unref the DirectSound object
if (directSound) { if (directSound) {
directSound->Release(); directSound->Release();
directSound = NULL; directSound = nullptr;
} }
} }
@ -138,7 +138,7 @@ bool DirectSoundPlayer::FillBuffer(bool fill) {
} }
else { else {
DWORD bufplay; DWORD bufplay;
res = buffer->GetCurrentPosition(&bufplay, NULL); res = buffer->GetCurrentPosition(&bufplay, nullptr);
if (FAILED(res)) return false; if (FAILED(res)) return false;
toWrite = (int)bufplay - (int)offset; toWrite = (int)bufplay - (int)offset;
if (toWrite < 0) toWrite += bufSize; if (toWrite < 0) toWrite += bufSize;
@ -255,7 +255,7 @@ void DirectSoundPlayer::Stop() {
thread->Stop(); thread->Stop();
thread->Wait(); thread->Wait();
} }
thread = NULL; thread = nullptr;
} }
// The thread is now guaranteed dead and there are no concurrency problems to worry about // 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) { DirectSoundPlayerThread::DirectSoundPlayerThread(DirectSoundPlayer *par) : wxThread(wxTHREAD_JOINABLE) {
parent = par; parent = par;
stopnotify = CreateEvent(NULL, true, false, NULL); stopnotify = CreateEvent(nullptr, true, false, nullptr);
} }
/// @brief Thread destructor /// @brief Thread destructor
@ -336,7 +336,7 @@ wxThread::ExitCode DirectSoundPlayerThread::Entry() {
DWORD size1, size2; DWORD size1, size2;
DWORD playpos; DWORD playpos;
HRESULT res; HRESULT res;
res = parent->buffer->GetCurrentPosition(&playpos, NULL); res = parent->buffer->GetCurrentPosition(&playpos, nullptr);
if (FAILED(res)) break; if (FAILED(res)) break;
int toWrite = playpos - parent->offset; int toWrite = playpos - parent->offset;
while (toWrite < 0) toWrite += parent->bufSize; while (toWrite < 0) toWrite += parent->bufSize;

View File

@ -75,7 +75,7 @@ struct COMInitialization {
{ {
if (!inited) if (!inited)
{ {
if (FAILED(CoInitialize(NULL))) if (FAILED(CoInitialize(nullptr)))
throw std::exception(); throw std::exception();
inited = true; inited = true;
} }
@ -290,7 +290,7 @@ void DirectSoundPlayer2Thread::Run()
// Create DirectSound object // Create DirectSound object
COMObjectRetainer<IDirectSound8> ds; COMObjectRetainer<IDirectSound8> ds;
if (FAILED(DirectSoundCreate8(&DSDEVID_DefaultPlayback, &ds.obj, NULL))) if (FAILED(DirectSoundCreate8(&DSDEVID_DefaultPlayback, &ds.obj, nullptr)))
REPORT_ERROR("Cound not create DirectSound object") REPORT_ERROR("Cound not create DirectSound object")

View File

@ -146,7 +146,7 @@ void OSSPlayer::Stop()
} }
// errors can be ignored here // errors can be ignored here
ioctl(dspdev, SNDCTL_DSP_RESET, NULL); ioctl(dspdev, SNDCTL_DSP_RESET, nullptr);
// Reset data // Reset data
playing = false; playing = false;
@ -160,7 +160,7 @@ void OSSPlayer::SetEndPosition(int64_t pos)
end_frame = pos; end_frame = pos;
if (pos <= GetCurrentPosition()) { if (pos <= GetCurrentPosition()) {
ioctl(dspdev, SNDCTL_DSP_RESET, NULL); ioctl(dspdev, SNDCTL_DSP_RESET, nullptr);
if (thread && thread->IsAlive()) if (thread && thread->IsAlive())
thread->Delete(); thread->Delete();
} }

View File

@ -153,7 +153,7 @@ void PortAudioPlayer::OpenStream() {
pa_output_p.channelCount = provider->GetChannels(); pa_output_p.channelCount = provider->GetChannels();
pa_output_p.sampleFormat = paInt16; pa_output_p.sampleFormat = paInt16;
pa_output_p.suggestedLatency = device_info->defaultLowOutputLatency; pa_output_p.suggestedLatency = device_info->defaultLowOutputLatency;
pa_output_p.hostApiSpecificStreamInfo = NULL; pa_output_p.hostApiSpecificStreamInfo = nullptr;
LOG_D("audio/player/portaudio") << "OpenStream:" LOG_D("audio/player/portaudio") << "OpenStream:"
<< " output channels: " << pa_output_p.channelCount << " output channels: " << pa_output_p.channelCount
@ -161,7 +161,7 @@ void PortAudioPlayer::OpenStream() {
<< " sample rate: " << provider->GetSampleRate() << " sample rate: " << provider->GetSampleRate()
<< " sample format: " << pa_output_p.sampleFormat; << " 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) { if (err == paNoError) {
LOG_D("audo/player/portaudio") << "Using device " << pa_output_p.device << " " << device_info->name << " " << Pa_GetHostApiInfo(device_info->hostApi)->name; LOG_D("audo/player/portaudio") << "Using device " << pa_output_p.device << " " << device_info->name << " " << Pa_GetHostApiInfo(device_info->hostApi)->name;

View File

@ -80,7 +80,7 @@ PulseAudioPlayer::PulseAudioPlayer(AudioProvider *provider)
pa_context_set_state_callback(context, (pa_context_notify_cb_t)pa_context_notify, this); pa_context_set_state_callback(context, (pa_context_notify_cb_t)pa_context_notify, this);
// Connect the context // Connect the context
pa_context_connect(context, NULL, PA_CONTEXT_NOAUTOSPAWN, NULL); pa_context_connect(context, nullptr, PA_CONTEXT_NOAUTOSPAWN, nullptr);
// Wait for connection // Wait for connection
while (true) { 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); pa_stream_set_write_callback(stream, (pa_stream_request_cb_t)pa_stream_write, this);
// Connect stream // 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) { if (paerror) {
LOG_E("audio/player/pulse") << "Stream connection failed: " << pa_strerror(paerror) << "(" << 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); 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()) { if (thread->cur_frame >= thread->end_frame + thread->provider->GetSampleRate()) {
// More than a second past end of stream // More than a second past end of stream
thread->is_playing = false; 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); pa_operation_unref(op);
return; return;

View File

@ -221,4 +221,4 @@ void AudioProviderFactory::RegisterProviders() {
#endif #endif
} }
template<> AudioProviderFactory::map *FactoryBase<AudioProvider *(*)(wxString)>::classes = NULL; template<> AudioProviderFactory::map *FactoryBase<AudioProvider *(*)(wxString)>::classes = nullptr;

View File

@ -53,7 +53,7 @@
/// @brief Constructor /// @brief Constructor
/// @param filename The filename to open /// @param filename The filename to open
FFmpegSourceAudioProvider::FFmpegSourceAudioProvider(wxString filename) try FFmpegSourceAudioProvider::FFmpegSourceAudioProvider(wxString filename) try
: AudioSource(NULL, FFMS_DestroyAudioSource) : AudioSource(nullptr, FFMS_DestroyAudioSource)
{ {
ErrInfo.Buffer = FFMSErrMsg; ErrInfo.Buffer = FFMSErrMsg;
ErrInfo.BufferSize = sizeof(FFMSErrMsg); ErrInfo.BufferSize = sizeof(FFMSErrMsg);
@ -99,7 +99,7 @@ void FFmpegSourceAudioProvider::LoadAudio(wxString filename) {
Index(FFMS_ReadIndex(CacheName.utf8_str(), &ErrInfo), FFMS_DestroyIndex); Index(FFMS_ReadIndex(CacheName.utf8_str(), &ErrInfo), FFMS_DestroyIndex);
if (Index && FFMS_IndexBelongsToFile(Index, FileNameShort.utf8_str(), &ErrInfo)) if (Index && FFMS_IndexBelongsToFile(Index, FileNameShort.utf8_str(), &ErrInfo))
Index = NULL; Index = nullptr;
// index valid but track number still not set? // index valid but track number still not set?
if (Index) { if (Index) {
@ -113,7 +113,7 @@ void FFmpegSourceAudioProvider::LoadAudio(wxString filename) {
// but do we have indexing info for the desired audio track? // but do we have indexing info for the desired audio track?
FFMS_Track *TempTrackData = FFMS_GetTrackFromIndex(Index, TrackNumber); FFMS_Track *TempTrackData = FFMS_GetTrackFromIndex(Index, TrackNumber);
if (FFMS_GetNumFrames(TempTrackData) <= 0) if (FFMS_GetNumFrames(TempTrackData) <= 0)
Index = NULL; Index = nullptr;
} }
// no valid index exists and the file only has one audio track, index it // no valid index exists and the file only has one audio track, index it
else if (TrackNumber < 0) else if (TrackNumber < 0)
@ -124,7 +124,7 @@ void FFmpegSourceAudioProvider::LoadAudio(wxString filename) {
FFMS_IndexErrorHandling ErrorHandling = GetErrorHandlingMode(); FFMS_IndexErrorHandling ErrorHandling = GetErrorHandlingMode();
#if FFMS_VERSION >= ((2 << 24) | (17 << 16) | (2 << 8) | 0) #if FFMS_VERSION >= ((2 << 24) | (17 << 16) | (2 << 8) | 0)
if (Index && FFMS_GetErrorHandling(Index) != ErrorHandling) if (Index && FFMS_GetErrorHandling(Index) != ErrorHandling)
Index = NULL; Index = nullptr;
#endif #endif
// moment of truth // moment of truth

View File

@ -257,7 +257,7 @@ namespace Automation4 {
wxString engine_name; wxString engine_name;
wxString filename_pattern; 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 /// format. If the file is in a supported format but is invalid, a
/// script should be returned which returns false from IsLoaded and /// script should be returned which returns false from IsLoaded and
/// an appropriate error message from GetDescription. /// an appropriate error message from GetDescription.

View File

@ -43,8 +43,8 @@
// Allocate storage for and initialise static members // Allocate storage for and initialise static members
namespace { namespace {
int avs_refcount = 0; int avs_refcount = 0;
HINSTANCE hLib = NULL; HINSTANCE hLib = nullptr;
IScriptEnvironment *env = NULL; IScriptEnvironment *env = nullptr;
wxMutex AviSynthMutex; wxMutex AviSynthMutex;
} }

View File

@ -97,7 +97,7 @@ BaseGrid::BaseGrid(wxWindow* parent, agi::Context *context, const wxSize& size,
, active_line(0) , active_line(0)
, batch_level(0) , batch_level(0)
, batch_active_line_changed(false) , 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) , context_menu(0)
, yPos(0) , yPos(0)
, context(context) , 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/Lines", &BaseGrid::UpdateStyle, this);
OPT_SUB("Colour/Subtitle Grid/Selection", &BaseGrid::UpdateStyle, this); OPT_SUB("Colour/Subtitle Grid/Selection", &BaseGrid::UpdateStyle, this);
OPT_SUB("Colour/Subtitle Grid/Standard", &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); Bind(wxEVT_CONTEXT_MENU, &BaseGrid::OnContextMenu, this);
} }
@ -229,7 +229,7 @@ void BaseGrid::UpdateStyle() {
wxClientDC dc(this); wxClientDC dc(this);
dc.SetFont(font); dc.SetFont(font);
int fw,fh; int fw,fh;
dc.GetTextExtent("#TWFfgGhH", &fw, &fh, NULL, NULL, &font); dc.GetTextExtent("#TWFfgGhH", &fw, &fh, nullptr, nullptr, &font);
lineHeight = fh + 4; lineHeight = fh + 4;
} }

View File

@ -48,7 +48,7 @@ public:
// wxMBConv implementation; see strconv.h for usage details // 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 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; 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: protected:
AegisubCSConv(); AegisubCSConv();

View File

@ -98,7 +98,7 @@ public:
/// Get the dialog of the given type /// Get the dialog of the given type
/// @tparam DialogType Type of dialog to get /// @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<class DialogType> template<class DialogType>
DialogType *Get() const { DialogType *Get() const {
DialogMap::const_iterator it = created_dialogs.find(&typeid(DialogType)); DialogMap::const_iterator it = created_dialogs.find(&typeid(DialogType));

View File

@ -265,7 +265,7 @@ void SearchReplaceEngine::ReplaceNext(bool DoReplace) {
int start = curLine; int start = curLine;
int nrows = context->subsGrid->GetRows(); int nrows = context->subsGrid->GetRows();
bool found = false; bool found = false;
wxString *Text = NULL; wxString *Text = nullptr;
size_t tempPos; size_t tempPos;
int regFlags = wxRE_ADVANCED; int regFlags = wxRE_ADVANCED;
if (!matchCase) { if (!matchCase) {
@ -452,7 +452,7 @@ void SearchReplaceEngine::OnDialogOpen() {
} }
void SearchReplaceEngine::OpenDialog (bool replace) { void SearchReplaceEngine::OpenDialog (bool replace) {
static DialogSearchReplace *diag = NULL; static DialogSearchReplace *diag = nullptr;
// already opened // already opened
if (diag) { if (diag) {

View File

@ -135,7 +135,7 @@ DialogShiftTimes::DialogShiftTimes(agi::Context *context)
wxString time_field_vals[] = { _("Start a&nd End times"), _("&Start times only"), _("&End times only") }; 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); 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")); wxButton *clear_button = new wxButton(this, -1, _("&Clear"));
clear_button->Bind(wxEVT_COMMAND_BUTTON_CLICKED, &DialogShiftTimes::OnClear, this); clear_button->Bind(wxEVT_COMMAND_BUTTON_CLICKED, &DialogShiftTimes::OnClear, this);

View File

@ -324,8 +324,8 @@ DialogStyleEditor::DialogStyleEditor(wxWindow *parent, AssStyle *style, agi::Con
MiscBox->Add(MiscBoxBottom, wxSizerFlags().Expand().Center().Border(wxTOP)); MiscBox->Add(MiscBoxBottom, wxSizerFlags().Expand().Center().Border(wxTOP));
// Preview // Preview
SubsPreview = NULL; SubsPreview = nullptr;
PreviewText = NULL; PreviewText = nullptr;
ColourButton *previewButton = 0; ColourButton *previewButton = 0;
if (!SubtitlesProviderFactory::GetClasses().empty()) { if (!SubtitlesProviderFactory::GetClasses().empty()) {
PreviewText = new wxTextCtrl(this, -1, lagi_wxString(OPT_GET("Tool/Style Editor/Preview Text")->GetString())); PreviewText = new wxTextCtrl(this, -1, lagi_wxString(OPT_GET("Tool/Style Editor/Preview Text")->GetString()));

View File

@ -163,7 +163,7 @@ DialogStyleManager::DialogStyleManager(agi::Context *context)
// Catalog // Catalog
wxSizer *CatalogBox = new wxStaticBoxSizer(wxHORIZONTAL,this,_("Catalog of available storages")); 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")); wxButton *CatalogNew = new wxButton(this, -1, _("New"));
CatalogDelete = new wxButton(this, -1, _("Delete")); CatalogDelete = new wxButton(this, -1, _("Delete"));
CatalogBox->Add(CatalogList,1,wxEXPAND | wxRIGHT | wxALIGN_RIGHT,5); 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 &current script ->"), &MoveToLocal, &StorageNew, &StorageEdit, &StorageCopy, &StorageDelete); wxSizer *StorageButtons = make_edit_buttons(this, _("Copy to &current script ->"), &MoveToLocal, &StorageNew, &StorageEdit, &StorageCopy, &StorageDelete);
wxSizer *StorageListSizer = new wxBoxSizer(wxHORIZONTAL); 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(StorageList,1,wxEXPAND | wxRIGHT,0);
StorageListSizer->Add(make_move_buttons(this, &StorageMoveUp, &StorageMoveDown, &StorageMoveTop, &StorageMoveBottom, &StorageSort), wxSizerFlags().Expand()); 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); MoveImportSizer->Add(CurrentImport,1,wxEXPAND,0);
wxSizer *CurrentListSizer = new wxBoxSizer(wxHORIZONTAL); 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(CurrentList,1,wxEXPAND | wxRIGHT,0);
CurrentListSizer->Add(make_move_buttons(this, &CurrentMoveUp, &CurrentMoveDown, &CurrentMoveTop, &CurrentMoveBottom, &CurrentSort), wxSizerFlags().Expand()); CurrentListSizer->Add(make_move_buttons(this, &CurrentMoveUp, &CurrentMoveDown, &CurrentMoveTop, &CurrentMoveBottom, &CurrentSort), wxSizerFlags().Expand());

View File

@ -112,12 +112,12 @@ class DialogStyleManager : public wxDialog {
void MoveStyles(bool storage, int type); void MoveStyles(bool storage, int type);
/// Open the style editor for the given style on the script /// 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 /// @param new_name Default new name for copies
void ShowCurrentEditor(AssStyle *style, wxString const& new_name = ""); void ShowCurrentEditor(AssStyle *style, wxString const& new_name = "");
/// Open the style editor for the given style in the storage /// 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 /// @param new_name Default new name for copies
void ShowStorageEditor(AssStyle *style, wxString const& new_name = ""); void ShowStorageEditor(AssStyle *style, wxString const& new_name = "");

View File

@ -46,7 +46,7 @@
#include "main.h" #include "main.h"
DialogTextImport::DialogTextImport() DialogTextImport::DialogTextImport()
: wxDialog(NULL , -1, _("Text import options")) : wxDialog(nullptr , -1, _("Text import options"))
{ {
// Main controls // Main controls
wxFlexGridSizer *fg = new wxFlexGridSizer(2, 5, 5); wxFlexGridSizer *fg = new wxFlexGridSizer(2, 5, 5);

View File

@ -64,11 +64,11 @@ protected:
} }
static func Find(std::string name) { static func Find(std::string name) {
if (!classes) return NULL; if (!classes) return nullptr;
iterator factory = classes->find(name); iterator factory = classes->find(name);
if (factory != classes->end()) return factory->second.second; if (factory != classes->end()) return factory->second.second;
return NULL; return nullptr;
} }
public: public:
@ -107,7 +107,7 @@ public:
return factory(); return factory();
} }
else { else {
return NULL; return nullptr;
} }
} }
@ -131,7 +131,7 @@ public:
return factory(a1); return factory(a1);
} }
else { else {
return NULL; return nullptr;
} }
} }

View File

@ -67,7 +67,7 @@ FFmpegSourceProvider::FFmpegSourceProvider()
: COMInited(false, deinit_com) : COMInited(false, deinit_com)
{ {
#ifdef WIN32 #ifdef WIN32
HRESULT res = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED); HRESULT res = CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED);
if (SUCCEEDED(res)) if (SUCCEEDED(res))
COMInited = true; COMInited = true;
else if (res != RPC_E_CHANGED_MODE) 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 CacheName The filename of the output index file
/// @param Trackmask A binary mask of the track numbers to index /// @param Trackmask A binary mask of the track numbers to index
/// @param IgnoreDecodeErrors True if audio decoding errors will be tolerated, false otherwise /// @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) { FFMS_Index *FFmpegSourceProvider::DoIndexing(FFMS_Indexer *Indexer, const wxString &CacheName, int Trackmask, FFMS_IndexErrorHandling IndexEH) {
char FFMSErrMsg[1024]; 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); 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)); MsgString.Append("Failed to index: ").Append(wxString(ErrInfo.Buffer, wxConvUTF8));
throw MsgString; throw MsgString;
} }

View File

@ -154,7 +154,7 @@ FontFileLister::CollectionResult FontConfigFontFileLister::GetFontPaths(wxString
if (!FcConfigSubstitute(config, pat, FcMatchPattern)) return ret; if (!FcConfigSubstitute(config, pat, FcMatchPattern)) return ret;
FcResult result; FcResult result;
agi::scoped_holder<FcFontSet*> fsorted(FcFontSort(config, pat, true, NULL, &result), FcFontSetDestroy); agi::scoped_holder<FcFontSet*> fsorted(FcFontSort(config, pat, true, nullptr, &result), FcFontSetDestroy);
agi::scoped_holder<FcFontSet*> ffullname(MatchFullname(family.c_str(), weight, slant), FcFontSetDestroy); agi::scoped_holder<FcFontSet*> ffullname(MatchFullname(family.c_str(), weight, slant), FcFontSetDestroy);
if (!fsorted || !ffullname) return ret; if (!fsorted || !ffullname) return ret;

View File

@ -250,7 +250,7 @@ OpenGLTextTexture::OpenGLTextTexture(OpenGLTextGlyph &glyph) {
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_T,GL_CLAMP); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_T,GL_CLAMP);
// Allocate texture // 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"; if (glGetError()) throw "Internal OpenGL text renderer error: Could not allocate Text Texture";
TryToInsert(glyph); TryToInsert(glyph);

View File

@ -36,9 +36,9 @@ class HotkeyDataViewModel : public wxDataViewModel {
Preferences *parent; Preferences *parent;
bool has_pending_changes; 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; 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); HotkeyModelItem *get(wxDataViewItem const& item);
public: public:
HotkeyDataViewModel(Preferences *parent); HotkeyDataViewModel(Preferences *parent);

View File

@ -87,7 +87,7 @@ namespace config {
// wxWidgets macro // wxWidgets macro
IMPLEMENT_APP(AegisubApp) IMPLEMENT_APP(AegisubApp)
static const char *LastStartupState = NULL; static const char *LastStartupState = nullptr;
#ifdef WITH_STARTUPLOG #ifdef WITH_STARTUPLOG
#define StartupLog(a) MessageBox(0, L ## a, L"Aegisub startup log", 0) #define StartupLog(a) MessageBox(0, L ## a, L"Aegisub startup log", 0)
@ -209,11 +209,11 @@ bool AegisubApp::OnInit() {
#endif #endif
StartupLog("Inside OnInit"); StartupLog("Inside OnInit");
frame = NULL; frame = nullptr;
try { try {
// Initialize randomizer // Initialize randomizer
StartupLog("Initialize random generator"); StartupLog("Initialize random generator");
srand(time(NULL)); srand(time(nullptr));
// locale for loading options // locale for loading options
StartupLog("Set initial locale"); StartupLog("Set initial locale");
@ -336,7 +336,7 @@ static void UnhandledExeception(bool stackWalk) {
#endif #endif
// Inform user of crash. // 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) { else if (LastStartupState) {
#if wxUSE_STACKWALKER == 1 #if wxUSE_STACKWALKER == 1
@ -488,7 +488,7 @@ int AegisubApp::OnRun() {
#ifdef __WXMAC__ #ifdef __WXMAC__
void AegisubApp::MacOpenFile(const wxString &filename) { void AegisubApp::MacOpenFile(const wxString &filename) {
if (frame != NULL && !filename.empty()) { if (frame != nullptr && !filename.empty()) {
frame->LoadSubtitles(filename); frame->LoadSubtitles(filename);
wxFileName filepath(filename); wxFileName filepath(filename);
OPT_SET("Path/Last/Subtitles")->SetString(STD_STR(filepath.GetPath())); OPT_SET("Path/Last/Subtitles")->SetString(STD_STR(filepath.GetPath()));

View File

@ -119,7 +119,7 @@ struct menu_item_cmp {
/// @brief Event dispatcher to update menus on open and handle click events /// @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 /// 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 /// on submenus in many cases, and registering large numbers of wxEVT_UPDATE_UI
/// handlers makes everything involves events unusably slow. /// handlers makes everything involves events unusably slow.
class CommandManager { class CommandManager {

View File

@ -219,7 +219,7 @@ void MatroskaWrapper::GetSubtitles(wxString const& filename, AssFile *target) {
// Progress bar // Progress bar
double totalTime = double(segInfo->Duration) / timecodeScale; 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); }); progress.Run([&](agi::ProgressSink *ps) { read_subtitles(ps, file, &input, srt, totalTime, &parser); });
} }
catch (...) { catch (...) {
@ -352,7 +352,7 @@ MkvStdIO::MkvStdIO(wxString filename)
fp = fopen(fname.GetFullPath().utf8_str(), "rb"); fp = fopen(fname.GetFullPath().utf8_str(), "rb");
#endif #endif
if (fp) { if (fp) {
setvbuf(fp, NULL, _IOFBF, CACHESIZE); setvbuf(fp, nullptr, _IOFBF, CACHESIZE);
} }
else { else {
throw agi::FileNotFoundError(STD_STR(filename)); throw agi::FileNotFoundError(STD_STR(filename));

View File

@ -49,7 +49,7 @@ PluginManager::PluginManager() {
init = false; init = false;
#ifdef WITH_AUTO4_LUA #ifdef WITH_AUTO4_LUA
lua = NULL; lua = nullptr;
#endif #endif
} }

View File

@ -67,7 +67,7 @@ class ColourUpdater {
const char *name; const char *name;
Preferences *parent; Preferences *parent;
public: 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) { void operator()(wxCommandEvent& evt) {
ColourButton *btn = static_cast<ColourButton*>(evt.GetClientData()); ColourButton *btn = static_cast<ColourButton*>(evt.GetClientData());
if (btn) if (btn)

View File

@ -76,7 +76,7 @@ public:
/// @brief Change the active line /// @brief Change the active line
/// @param new_line Subtitle line to become the new 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. /// active line.
/// ///
/// Calling this method should only cause a change notification to be sent if /// 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; virtual void SetActiveLine(ItemDataType new_line) = 0;
/// @brief Obtain the active line /// @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; virtual ItemDataType GetActiveLine() const = 0;
/// @brief Change the selected set /// @brief Change the selected set

View File

@ -44,7 +44,7 @@
agi::SpellChecker *SpellCheckerFactory::GetSpellChecker() { agi::SpellChecker *SpellCheckerFactory::GetSpellChecker() {
std::vector<std::string> list = GetClasses(OPT_GET("Tool/Spell Checker/Backend")->GetString()); std::vector<std::string> list = GetClasses(OPT_GET("Tool/Spell Checker/Backend")->GetString());
if (list.empty()) return NULL; if (list.empty()) return nullptr;
// Get provider // Get provider
wxString error; wxString error;
@ -67,4 +67,4 @@ void SpellCheckerFactory::RegisterProviders() {
#endif #endif
} }
template<> SpellCheckerFactory::map *FactoryBase<agi::SpellChecker *(*)()>::classes = NULL; template<> SpellCheckerFactory::map *FactoryBase<agi::SpellChecker *(*)()>::classes = nullptr;

View File

@ -131,9 +131,9 @@ public:
/// @param mode 0: load 1: save /// @param mode 0: load 1: save
static wxString GetWildcards(int mode); 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); 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); static const SubtitleFormat *GetWriter(wxString const& filename);
/// Initialize subtitle formats /// Initialize subtitle formats
static void LoadFormats(); static void LoadFormats();

View File

@ -170,7 +170,7 @@ void TTXTSubtitleFormat::WriteFile(const AssFile *src, wxString const& filename,
// Create XML structure // Create XML structure
wxXmlDocument doc; 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"); root->AddAttribute("version", "1.1");
doc.SetRoot(root); doc.SetRoot(root);

View File

@ -80,4 +80,4 @@ void SubtitlesProviderFactory::RegisterProviders() {
#endif #endif
} }
template<> SubtitlesProviderFactory::map *FactoryBase<SubtitlesProvider *(*)(std::string)>::classes = NULL; template<> SubtitlesProviderFactory::map *FactoryBase<SubtitlesProvider *(*)(std::string)>::classes = nullptr;

View File

@ -86,7 +86,7 @@ void CSRISubtitlesProvider::LoadSubtitles(AssFile *subs) {
subs->SaveMemory(data); subs->SaveMemory(data);
wxMutexLocker lock(csri_mutex); 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 // Open from disk
else { else {
@ -98,7 +98,7 @@ void CSRISubtitlesProvider::LoadSubtitles(AssFile *subs) {
subs->Save(tempfile, false, false, wxSTRING_ENCODING); subs->Save(tempfile, false, false, wxSTRING_ENCODING);
wxMutexLocker lock(csri_mutex); wxMutexLocker lock(csri_mutex);
instance = csri_open_file(renderer, tempfile.utf8_str(), NULL); instance = csri_open_file(renderer, tempfile.utf8_str(), nullptr);
} }
} }

View File

@ -81,22 +81,22 @@ class FontConfigCacheThread : public wxThread {
ASS_Renderer *ass_renderer; ASS_Renderer *ass_renderer;
FontConfigCacheThread** thisPtr; FontConfigCacheThread** thisPtr;
ExitCode Entry() { ExitCode Entry() {
const char *config_path = NULL; const char *config_path = nullptr;
#ifdef __APPLE__ #ifdef __APPLE__
std::string conf_path = agi::util::OSX_GetBundleResourcesDirectory() + "/etc/fonts/fonts.conf"; std::string conf_path = agi::util::OSX_GetBundleResourcesDirectory() + "/etc/fonts/fonts.conf";
config_path = conf_path.c_str(); config_path = conf_path.c_str();
#endif #endif
if (ass_library) ass_renderer = ass_renderer_init(ass_library); 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); if (ass_library) ass_renderer_done(ass_renderer);
*thisPtr = NULL; *thisPtr = nullptr;
return EXIT_SUCCESS; return EXIT_SUCCESS;
} }
public: public:
FontConfigCacheThread(ASS_Library *ass_library, FontConfigCacheThread **thisPtr) FontConfigCacheThread(ASS_Library *ass_library, FontConfigCacheThread **thisPtr)
: ass_library(ass_library) : ass_library(ass_library)
, ass_renderer(NULL) , ass_renderer(nullptr)
, thisPtr(thisPtr) , thisPtr(thisPtr)
{ {
*thisPtr = this; *thisPtr = this;
@ -104,7 +104,7 @@ public:
Run(); Run();
} }
FontConfigCacheThread(ASS_Renderer *ass_renderer, FontConfigCacheThread **thisPtr) FontConfigCacheThread(ASS_Renderer *ass_renderer, FontConfigCacheThread **thisPtr)
: ass_library(NULL) : ass_library(nullptr)
, ass_renderer(ass_renderer) , ass_renderer(ass_renderer)
, thisPtr(thisPtr) , thisPtr(thisPtr)
{ {
@ -133,7 +133,7 @@ LibassSubtitlesProvider::LibassSubtitlesProvider(std::string) {
wait_for_cache_thread(&cache_worker); wait_for_cache_thread(&cache_worker);
// Initialize renderer // Initialize renderer
ass_track = NULL; ass_track = nullptr;
ass_renderer = ass_renderer_init(ass_library); ass_renderer = ass_renderer_init(ass_library);
if (!ass_renderer) throw "ass_renderer_init failed"; if (!ass_renderer) throw "ass_renderer_init failed";
ass_set_font_scale(ass_renderer, 1.); 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); ass_set_frame_size(ass_renderer, frame.w, frame.h);
// Get frame // 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. // 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. // 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() { void LibassSubtitlesProvider::CacheFonts() {
ass_library = ass_library_init(); 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); new FontConfigCacheThread(ass_library, &cache_worker);
} }
/// DOCME /// DOCME
ASS_Library* LibassSubtitlesProvider::ass_library; ASS_Library* LibassSubtitlesProvider::ass_library;
FontConfigCacheThread* LibassSubtitlesProvider::cache_worker = NULL; FontConfigCacheThread* LibassSubtitlesProvider::cache_worker = nullptr;
#endif // WITH_LIBASS #endif // WITH_LIBASS

View File

@ -239,7 +239,7 @@ VideoProviderErrorEvent::VideoProviderErrorEvent(VideoProviderError const& err)
SetEventType(EVT_VIDEO_ERROR); SetEventType(EVT_VIDEO_ERROR);
} }
SubtitlesProviderErrorEvent::SubtitlesProviderErrorEvent(wxString err) SubtitlesProviderErrorEvent::SubtitlesProviderErrorEvent(wxString err)
: agi::Exception(STD_STR(err), NULL) : agi::Exception(STD_STR(err), nullptr)
{ {
SetEventType(EVT_SUBTITLES_ERROR); SetEventType(EVT_SUBTITLES_ERROR);
} }

View File

@ -315,7 +315,7 @@ class cache_cleaner : public wxThread {
do { do {
wxFileName curfn(directory, curfn_str); wxFileName curfn(directory, curfn_str);
wxDateTime curatime; wxDateTime curatime;
curfn.GetTimes(&curatime, NULL, NULL); curfn.GetTimes(&curatime, nullptr, nullptr);
cachefiles.insert(std::make_pair(curatime.GetTicks(), curfn)); cachefiles.insert(std::make_pair(curatime.GetTicks(), curfn));
total_size += curfn.GetSize().GetValue(); total_size += curfn.GetSize().GetValue();

View File

@ -44,7 +44,7 @@
VariableData::VariableData() { VariableData::VariableData() {
type = VARDATA_NONE; type = VARDATA_NONE;
value = NULL; value = nullptr;
} }
VariableData::~VariableData() { VariableData::~VariableData() {
@ -64,7 +64,7 @@ void VariableData::DeleteValue() {
default: break; default: break;
} }
type = VARDATA_NONE; type = VARDATA_NONE;
value = NULL; value = nullptr;
} }
template<class T> static inline VariableDataType get_type(); template<class T> static inline VariableDataType get_type();

View File

@ -77,7 +77,7 @@ class VideoContext : public wxEvtHandler {
agi::Context *context; 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 /// video is open
VideoProvider *videoProvider; VideoProvider *videoProvider;

View File

@ -83,7 +83,7 @@ struct VideoOutGL::TextureInfo {
/// @param format The texture's format /// @param format The texture's format
/// @return Whether the texture could be created. /// @return Whether the texture could be created.
static bool TestTexture(int width, int height, GLint format) { 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); 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 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) { for (int i = 0; i < textureCount; ++i) {
LOG_I("video/out/gl") << "Using texture size: " << textureSizes[i].first << "x" << textureSizes[i].second; 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(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_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_MAG_FILTER, GL_LINEAR));
CHECK_INIT_ERROR(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP)); CHECK_INIT_ERROR(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP));

View File

@ -58,8 +58,8 @@
/// @brief Constructor /// @brief Constructor
/// @param filename The filename to open /// @param filename The filename to open
FFmpegSourceVideoProvider::FFmpegSourceVideoProvider(wxString filename) try FFmpegSourceVideoProvider::FFmpegSourceVideoProvider(wxString filename) try
: VideoSource(NULL, FFMS_DestroyVideoSource) : VideoSource(nullptr, FFMS_DestroyVideoSource)
, VideoInfo(NULL) , VideoInfo(nullptr)
, Width(-1) , Width(-1)
, Height(-1) , Height(-1)
, FrameNumber(-1) , FrameNumber(-1)
@ -112,7 +112,7 @@ void FFmpegSourceVideoProvider::LoadVideo(wxString filename) {
Index(FFMS_ReadIndex(CacheName.utf8_str(), &ErrInfo), FFMS_DestroyIndex); Index(FFMS_ReadIndex(CacheName.utf8_str(), &ErrInfo), FFMS_DestroyIndex);
if (Index && FFMS_IndexBelongsToFile(Index, FileNameShort.utf8_str(), &ErrInfo)) 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 // 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, // 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) { if (Index && TrackNumber >= 0) {
FFMS_Track *TempTrackData = FFMS_GetTrackFromIndex(Index, TrackNumber); FFMS_Track *TempTrackData = FFMS_GetTrackFromIndex(Index, TrackNumber);
if (FFMS_GetNumFrames(TempTrackData) <= 0) if (FFMS_GetNumFrames(TempTrackData) <= 0)
Index = NULL; Index = nullptr;
} }
// moment of truth // moment of truth
@ -224,10 +224,10 @@ void FFmpegSourceVideoProvider::LoadVideo(wxString filename) {
// get frame info data // get frame info data
FFMS_Track *FrameData = FFMS_GetTrackFromVideo(VideoSource); FFMS_Track *FrameData = FFMS_GetTrackFromVideo(VideoSource);
if (FrameData == NULL) if (FrameData == nullptr)
throw VideoOpenError("failed to get frame data"); throw VideoOpenError("failed to get frame data");
const FFMS_TrackTimeBase *TimeBase = FFMS_GetTimeBase(FrameData); const FFMS_TrackTimeBase *TimeBase = FFMS_GetTimeBase(FrameData);
if (TimeBase == NULL) if (TimeBase == nullptr)
throw VideoOpenError("failed to get track time base"); throw VideoOpenError("failed to get track time base");
const FFMS_FrameInfo *CurFrameData; const FFMS_FrameInfo *CurFrameData;
@ -236,7 +236,7 @@ void FFmpegSourceVideoProvider::LoadVideo(wxString filename) {
std::vector<int> TimecodesVector; std::vector<int> TimecodesVector;
for (int CurFrameNum = 0; CurFrameNum < VideoInfo->NumFrames; CurFrameNum++) { for (int CurFrameNum = 0; CurFrameNum < VideoInfo->NumFrames; CurFrameNum++) {
CurFrameData = FFMS_GetFrameInfo(FrameData, 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))); 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 // decode frame
const FFMS_Frame *SrcFrame = FFMS_GetFrame(VideoSource, FrameNumber, &ErrInfo); 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); throw VideoDecodeError(std::string("Failed to retrieve frame: ") + ErrInfo.Buffer);
} }

View File

@ -118,4 +118,4 @@ void VideoProviderFactory::RegisterProviders() {
Register<YUV4MPEGVideoProvider>("YUV4MPEG", true); Register<YUV4MPEGVideoProvider>("YUV4MPEG", true);
} }
template<> VideoProviderFactory::map *FactoryBase<VideoProvider *(*)(wxString)>::classes = NULL; template<> VideoProviderFactory::map *FactoryBase<VideoProvider *(*)(wxString)>::classes = nullptr;

View File

@ -54,7 +54,7 @@
/// @brief Constructor /// @brief Constructor
/// @param filename The filename to open /// @param filename The filename to open
YUV4MPEGVideoProvider::YUV4MPEGVideoProvider(wxString fname) YUV4MPEGVideoProvider::YUV4MPEGVideoProvider(wxString fname)
: sf(NULL) : sf(nullptr)
, inited(false) , inited(false)
, w (0) , w (0)
, h (0) , h (0)
@ -75,7 +75,7 @@ YUV4MPEGVideoProvider::YUV4MPEGVideoProvider(wxString fname)
sf = fopen(filename.utf8_str(), "rb"); sf = fopen(filename.utf8_str(), "rb");
#endif #endif
if (sf == NULL) throw agi::FileNotFoundError(STD_STR(fname)); if (sf == nullptr) throw agi::FileNotFoundError(STD_STR(fname));
CheckFileFormat(); CheckFileFormat();

View File

@ -57,7 +57,7 @@ VideoSlider::VideoSlider (wxWindow* parent, agi::Context *c)
SetMinSize(wxSize(20, 25)); SetMinSize(wxSize(20, 25));
SetBackgroundStyle(wxBG_STYLE_PAINT); 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->AddSeekListener(&VideoSlider::SetValue, this));
slots.push_back(c->videoController->AddVideoOpenListener(&VideoSlider::VideoOpened, this)); slots.push_back(c->videoController->AddVideoOpenListener(&VideoSlider::VideoOpened, this));
slots.push_back(c->videoController->AddKeyframesListener(&VideoSlider::KeyframesChanged, this)); slots.push_back(c->videoController->AddKeyframesListener(&VideoSlider::KeyframesChanged, this));

View File

@ -64,7 +64,7 @@ public:
DraggableFeatureType type; ///< Shape of feature DraggableFeatureType type; ///< Shape of feature
Vector2D pos; ///< Position of this feature Vector2D pos; ///< Position of this feature
int layer; ///< Layer; Higher = above 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? /// @brief Is the given point over this feature?
/// @param mouse_pos Position of the mouse /// @param mouse_pos Position of the mouse

View File

@ -366,7 +366,7 @@ struct scoped_tag_parse {
~scoped_tag_parse() { diag->ClearBlocks(); } ~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) { static param_vec find_tag(const AssDialogue *line, wxString tag_name) {
for (auto ovr : line->Blocks | agi::of_type<AssDialogueBlockOverride>()) { for (auto ovr : line->Blocks | agi::of_type<AssDialogueBlockOverride>()) {
for (auto tag : ovr->Tags) { for (auto tag : ovr->Tags) {
@ -569,7 +569,7 @@ void VisualToolBase::SetOverride(AssDialogue* line, wxString const& tag, wxStrin
AssDialogueBlock *block = line->Blocks.front(); AssDialogueBlock *block = line->Blocks.front();
// Get current block as plain or override // Get current block as plain or override
assert(dynamic_cast<AssDialogueBlockDrawing*>(block) == NULL); assert(dynamic_cast<AssDialogueBlockDrawing*>(block) == nullptr);
if (dynamic_cast<AssDialogueBlockPlain*>(block)) if (dynamic_cast<AssDialogueBlockPlain*>(block))
line->Text = "{" + insert + "}" + line->Text; line->Text = "{" + insert + "}" + line->Text;

View File

@ -61,7 +61,7 @@ class VisualToolBase {
void OnMouseCaptureLost(wxMouseCaptureLostEvent &); void OnMouseCaptureLost(wxMouseCaptureLostEvent &);
/// @brief Get the dialogue line currently in the edit box /// @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(); AssDialogue *GetActiveDialogueLine();
// SubtitleSelectionListener implementation // SubtitleSelectionListener implementation
@ -100,7 +100,7 @@ protected:
VideoDisplay *parent; VideoDisplay *parent;
bool holding; ///< Is a hold currently in progress? 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? bool dragging; ///< Is a drag currently in progress?
int frame_number; ///< Current frame number int frame_number; ///< Current frame number

View File

@ -41,7 +41,7 @@ class VisualToolDrag : public VisualTool<VisualToolDragDraggableFeature> {
wxToolBar *toolbar; wxToolBar *toolbar;
/// The feature last clicked on for the double-click handler /// The feature last clicked on for the double-click handler
/// Equal to curFeature during drags; possibly different at all other times /// 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 /// longer exists
Feature *primary; Feature *primary;
/// The last announced selection set /// The last announced selection set