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())
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

View file

@ -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

View file

@ -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

View file

@ -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();

View file

@ -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

View file

@ -90,4 +90,4 @@ void AudioPlayerFactory::RegisterProviders() {
#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
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;

View file

@ -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<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")

View file

@ -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();
}

View file

@ -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;

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);
// 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;

View file

@ -221,4 +221,4 @@ void AudioProviderFactory::RegisterProviders() {
#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
/// @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

View file

@ -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.

View file

@ -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;
}

View file

@ -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;
}

View file

@ -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();

View file

@ -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<class DialogType>
DialogType *Get() const {
DialogMap::const_iterator it = created_dialogs.find(&typeid(DialogType));

View file

@ -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) {

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") };
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);

View file

@ -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()));

View file

@ -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 &current 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());

View file

@ -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 = "");

View file

@ -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);

View file

@ -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;
}
}

View file

@ -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;
}

View file

@ -154,7 +154,7 @@ FontFileLister::CollectionResult FontConfigFontFileLister::GetFontPaths(wxString
if (!FcConfigSubstitute(config, pat, FcMatchPattern)) return ret;
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);
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);
// 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);

View file

@ -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);

View file

@ -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()));

View file

@ -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 {

View file

@ -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));

View file

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

View file

@ -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<ColourButton*>(evt.GetClientData());
if (btn)

View file

@ -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

View file

@ -44,7 +44,7 @@
agi::SpellChecker *SpellCheckerFactory::GetSpellChecker() {
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
wxString error;
@ -67,4 +67,4 @@ void SpellCheckerFactory::RegisterProviders() {
#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
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();

View file

@ -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);

View file

@ -80,4 +80,4 @@ void SubtitlesProviderFactory::RegisterProviders() {
#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);
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);
}
}

View file

@ -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

View file

@ -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);
}

View file

@ -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();

View file

@ -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<class T> static inline VariableDataType get_type();

View file

@ -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;

View file

@ -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));

View file

@ -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<int> 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);
}

View file

@ -118,4 +118,4 @@ void VideoProviderFactory::RegisterProviders() {
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
/// @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();

View file

@ -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));

View file

@ -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

View file

@ -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<AssDialogueBlockOverride>()) {
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<AssDialogueBlockDrawing*>(block) == NULL);
assert(dynamic_cast<AssDialogueBlockDrawing*>(block) == nullptr);
if (dynamic_cast<AssDialogueBlockPlain*>(block))
line->Text = "{" + insert + "}" + line->Text;

View file

@ -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

View file

@ -41,7 +41,7 @@ class VisualToolDrag : public VisualTool<VisualToolDragDraggableFeature> {
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