diff --git a/src/config.cc b/src/config.cc index 2941f38..74c2a67 100644 --- a/src/config.cc +++ b/src/config.cc @@ -28,7 +28,7 @@ Config::Config() { #ifdef _WIN32 auto env_MSYSTEM_PREFIX=std::getenv("MSYSTEM_PREFIX"); - if(env_MSYSTEM_PREFIX!=NULL) + if(env_MSYSTEM_PREFIX!=nullptr) terminal.msys2_mingw_path=boost::filesystem::path(env_MSYSTEM_PREFIX); #endif } diff --git a/src/debug_lldb.cc b/src/debug_lldb.cc index 57d269e..36f683e 100644 --- a/src/debug_lldb.cc +++ b/src/debug_lldb.cc @@ -80,7 +80,7 @@ void Debug::LLDB::start(const std::string &command, const boost::filesystem::pat const char *argv[arguments.size()+1]; for(size_t c=0;cCreateTarget(executable.c_str()); if(!target.IsValid()) { @@ -310,11 +310,11 @@ std::vector Debug::LLDB::get_backtrace() { backtrace_frame.index=c_f; - if(frame.GetFunctionName()!=NULL) + if(frame.GetFunctionName()!=nullptr) backtrace_frame.function_name=frame.GetFunctionName(); auto module_filename=frame.GetModule().GetFileSpec().GetFilename(); - if(module_filename!=NULL) { + if(module_filename!=nullptr) { backtrace_frame.module_filename=module_filename; } @@ -351,7 +351,7 @@ std::vector Debug::LLDB::get_variables() { Debug::LLDB::Variable variable; variable.thread_index_id=thread.GetIndexID(); variable.frame_index=c_f; - if(value.GetName()!=NULL) + if(value.GetName()!=nullptr) variable.name=value.GetName(); value.GetDescription(stream); variable.value=stream.GetData(); @@ -417,7 +417,7 @@ std::string Debug::LLDB::get_value(const std::string &variable, const boost::fil lldb::SBStream stream; auto value=values.GetValueAtIndex(value_index); - if(value.GetName()!=NULL && value.GetName()==variable) { + if(value.GetName()!=nullptr && value.GetName()==variable) { auto declaration=value.GetDeclaration(); if(declaration.IsValid()) { if(declaration.GetLine()==line_nr && (declaration.GetColumn()==0 || declaration.GetColumn()==line_index)) { diff --git a/src/dialogs.cc b/src/dialogs.cc index 39122b6..1baba08 100644 --- a/src/dialogs.cc +++ b/src/dialogs.cc @@ -24,8 +24,8 @@ Dialog::Message::Message(const std::string &text): Gtk::MessageDialog(text, fals show_now(); - while(g_main_context_pending(NULL)) - g_main_context_iteration(NULL, false); + while(g_main_context_pending(nullptr)) + g_main_context_iteration(nullptr, false); } bool Dialog::Message::on_delete_event(GdkEventAny *event) { diff --git a/src/git.cc b/src/git.cc index a996a8c..6d0666e 100644 --- a/src/git.cc +++ b/src/git.cc @@ -8,7 +8,7 @@ std::mutex Git::repositories_mutex; std::string Git::Error::message() noexcept { const git_error *last_error = giterr_last(); - if(last_error==NULL) + if(last_error==nullptr) return std::string(); else return last_error->message; @@ -49,9 +49,9 @@ Git::Repository::Diff::Lines Git::Repository::Diff::get_lines(const std::string Error error; std::lock_guard lock(mutex); #if LIBGIT2_SOVERSION>=23 - error.code=git_diff_blob_to_buffer(blob.get(), NULL, buffer.c_str(), buffer.size(), NULL, &options, NULL, NULL, hunk_cb, NULL, &lines); + error.code=git_diff_blob_to_buffer(blob.get(), nullptr, buffer.c_str(), buffer.size(), nullptr, &options, nullptr, nullptr, hunk_cb, nullptr, &lines); #else - error.code=git_diff_blob_to_buffer(blob.get(), NULL, buffer.c_str(), buffer.size(), NULL, &options, NULL, hunk_cb, NULL, &lines); + error.code=git_diff_blob_to_buffer(blob.get(), nullptr, buffer.c_str(), buffer.size(), nullptr, &options, nullptr, hunk_cb, nullptr, &lines); #endif if(error) throw std::runtime_error(error.message()); @@ -77,9 +77,9 @@ std::string Git::Repository::Diff::get_details(const std::string &buffer, int li Error error; std::lock_guard lock(mutex); #if LIBGIT2_SOVERSION>=23 - error.code=git_diff_blob_to_buffer(blob.get(), NULL, buffer.c_str(), buffer.size(), NULL, &options, NULL, NULL, NULL, line_cb, &details); + error.code=git_diff_blob_to_buffer(blob.get(), nullptr, buffer.c_str(), buffer.size(), nullptr, &options, nullptr, nullptr, nullptr, line_cb, &details); #else - error.code=git_diff_blob_to_buffer(blob.get(), NULL, buffer.c_str(), buffer.size(), NULL, &options, NULL, NULL, line_cb, &details); + error.code=git_diff_blob_to_buffer(blob.get(), nullptr, buffer.c_str(), buffer.size(), nullptr, &options, nullptr, nullptr, line_cb, &details); #endif if(error) throw std::runtime_error(error.message()); @@ -92,7 +92,7 @@ Git::Repository::Repository(const boost::filesystem::path &path) { Error error; std::lock_guard lock(mutex); auto path_str=path.generic_string(); - error.code = git_repository_open_ext(&repository_ptr, path_str.c_str(), 0, NULL); + error.code = git_repository_open_ext(&repository_ptr, path_str.c_str(), 0, nullptr); if(error) throw std::runtime_error(error.message()); } @@ -235,7 +235,7 @@ boost::filesystem::path Git::Repository::get_root_path(const boost::filesystem:: Error error; std::lock_guard lock(mutex); auto path_str=path.generic_string(); - error.code = git_repository_discover(&root, path_str.c_str(), 0, NULL); + error.code = git_repository_discover(&root, path_str.c_str(), 0, nullptr); if(error) throw std::runtime_error(error.message()); } diff --git a/src/notebook.cc b/src/notebook.cc index 7ce9208..912eae3 100644 --- a/src/notebook.cc +++ b/src/notebook.cc @@ -159,8 +159,8 @@ void Notebook::open(const boost::filesystem::path &file_path, size_t notebook_in source_views.emplace_back(new Source::GenericView(file_path, language)); source_views.back()->scroll_to_cursor_delayed=[this](Source::View* view, bool center, bool show_tooltips) { - while(g_main_context_pending(NULL)) - g_main_context_iteration(NULL, false); + while(g_main_context_pending(nullptr)) + g_main_context_iteration(nullptr, false); if(get_current_view()==view) { if(center) view->scroll_to(view->get_buffer()->get_insert(), 0.0, 1.0, 0.5); diff --git a/src/project.cc b/src/project.cc index b3b6a99..4decbd7 100644 --- a/src/project.cc +++ b/src/project.cc @@ -592,8 +592,8 @@ void Project::Markdown::compile_and_run() { #ifdef __linux uri="file://"+uri; #endif - GError* error=NULL; - gtk_show_uri(NULL, uri.c_str(), GDK_CURRENT_TIME, &error); + GError* error=nullptr; + gtk_show_uri(nullptr, uri.c_str(), GDK_CURRENT_TIME, &error); g_clear_error(&error); #endif } @@ -625,8 +625,8 @@ void Project::HTML::compile_and_run() { #ifdef __linux uri="file://"+uri; #endif - GError* error=NULL; - gtk_show_uri(NULL, uri.c_str(), GDK_CURRENT_TIME, &error); + GError* error=nullptr; + gtk_show_uri(nullptr, uri.c_str(), GDK_CURRENT_TIME, &error); g_clear_error(&error); #endif } diff --git a/src/selectiondialog.cc b/src/selectiondialog.cc index 5bfd1f2..a4d6735 100644 --- a/src/selectiondialog.cc +++ b/src/selectiondialog.cc @@ -122,8 +122,8 @@ void SelectionDialogBase::show() { cursor_changed(); } else if(list_view_text.get_model()->children().begin()!=list_view_text.get_selection()->get_selected()) { - while(g_main_context_pending(NULL)) - g_main_context_iteration(NULL, false); + while(g_main_context_pending(nullptr)) + g_main_context_iteration(nullptr, false); list_view_text.scroll_to_row(list_view_text.get_model()->get_path(list_view_text.get_selection()->get_selected()), 0.5); } } diff --git a/src/source.cc b/src/source.cc index 68d431e..e10a105 100644 --- a/src/source.cc +++ b/src/source.cc @@ -30,7 +30,7 @@ namespace sigc { Glib::RefPtr Source::guess_language(const boost::filesystem::path &file_path) { auto language_manager=Gsv::LanguageManager::get_default(); bool result_uncertain = false; - auto content_type = Gio::content_type_guess(file_path.string(), NULL, 0, result_uncertain); + auto content_type = Gio::content_type_guess(file_path.string(), nullptr, 0, result_uncertain); if(result_uncertain) { content_type.clear(); } @@ -380,7 +380,7 @@ void Source::View::configure() { diagnostic_tag_underline->property_underline()=Pango::Underline::UNDERLINE_ERROR; auto tag_class=G_OBJECT_GET_CLASS(diagnostic_tag_underline->gobj()); //For older GTK+ 3 versions: auto param_spec=g_object_class_find_property(tag_class, "underline-rgba"); - if(param_spec!=NULL) { + if(param_spec!=nullptr) { diagnostic_tag_underline->set_property("underline-rgba", Gdk::RGBA(warning_property)); } } @@ -509,7 +509,7 @@ void Source::View::search_highlight(const std::string &text, bool case_sensitive gtk_source_search_settings_set_case_sensitive(search_settings, case_sensitive); gtk_source_search_settings_set_regex_enabled(search_settings, regex); gtk_source_search_settings_set_search_text(search_settings, text.c_str()); - search_occurrences_updated(NULL, NULL, this); + search_occurrences_updated(nullptr, nullptr, this); } void Source::View::search_forward() { @@ -541,7 +541,7 @@ void Source::View::replace_forward(const std::string &replacement) { Gtk::TextIter match_start, match_end; if(gtk_source_search_context_forward(search_context, start.gobj(), match_start.gobj(), match_end.gobj())) { auto offset=match_start.get_offset(); - gtk_source_search_context_replace(search_context, match_start.gobj(), match_end.gobj(), replacement.c_str(), replacement.size(), NULL); + gtk_source_search_context_replace(search_context, match_start.gobj(), match_end.gobj(), replacement.c_str(), replacement.size(), nullptr); Glib::ustring replacement_ustring=replacement; get_buffer()->select_range(get_buffer()->get_iter_at_offset(offset), get_buffer()->get_iter_at_offset(offset+replacement_ustring.size())); @@ -556,7 +556,7 @@ void Source::View::replace_backward(const std::string &replacement) { Gtk::TextIter match_start, match_end; if(gtk_source_search_context_backward(search_context, start.gobj(), match_start.gobj(), match_end.gobj())) { auto offset=match_start.get_offset(); - gtk_source_search_context_replace(search_context, match_start.gobj(), match_end.gobj(), replacement.c_str(), replacement.size(), NULL); + gtk_source_search_context_replace(search_context, match_start.gobj(), match_end.gobj(), replacement.c_str(), replacement.size(), nullptr); get_buffer()->select_range(get_buffer()->get_iter_at_offset(offset), get_buffer()->get_iter_at_offset(offset+replacement.size())); scroll_to(get_buffer()->get_insert()); @@ -564,7 +564,7 @@ void Source::View::replace_backward(const std::string &replacement) { } void Source::View::replace_all(const std::string &replacement) { - gtk_source_search_context_replace_all(search_context, replacement.c_str(), replacement.size(), NULL); + gtk_source_search_context_replace_all(search_context, replacement.c_str(), replacement.size(), nullptr); } void Source::View::paste() { diff --git a/src/source_clang.cc b/src/source_clang.cc index 305d58f..8de43a8 100644 --- a/src/source_clang.cc +++ b/src/source_clang.cc @@ -756,7 +756,7 @@ void Source::ClangViewAutocomplete::autocomplete() { std::vector Source::ClangViewAutocomplete::autocomplete_get_suggestions(const std::string &buffer, int line_number, int column) { std::vector suggestions; auto results=clang_tu->get_code_completions(buffer, line_number, column); - if(results.cx_results==NULL) { + if(results.cx_results==nullptr) { auto expected=ParseState::PROCESSING; parse_state.compare_exchange_strong(expected, ParseState::RESTARTING); return suggestions; @@ -1321,8 +1321,8 @@ void Source::ClangViewRefactor::wait_parsing(const std::vector &v } if(message) { for(;;) { - while(g_main_context_pending(NULL)) - g_main_context_iteration(NULL, false); + while(g_main_context_pending(nullptr)) + g_main_context_iteration(nullptr, false); bool all_parsed=true; for(auto &clang_view: clang_views) { if(!clang_view->parsed) { diff --git a/src/source_spellcheck.cc b/src/source_spellcheck.cc index b5052b2..639b366 100644 --- a/src/source_spellcheck.cc +++ b/src/source_spellcheck.cc @@ -16,12 +16,12 @@ namespace sigc { #endif } -AspellConfig* Source::SpellCheckView::spellcheck_config=NULL; +AspellConfig* Source::SpellCheckView::spellcheck_config=nullptr; Source::SpellCheckView::SpellCheckView() : Gsv::View() { - if(spellcheck_config==NULL) + if(spellcheck_config==nullptr) spellcheck_config=new_aspell_config(); - spellcheck_checker=NULL; + spellcheck_checker=nullptr; auto tag=get_buffer()->create_tag("spellcheck_error"); tag->property_underline()=Pango::Underline::UNDERLINE_ERROR; @@ -41,7 +41,7 @@ Source::SpellCheckView::SpellCheckView() : Gsv::View() { }); get_buffer()->signal_changed().connect([this](){ - if(spellcheck_checker==NULL) + if(spellcheck_checker==nullptr) return; delayed_spellcheck_suggestions_connection.disconnect(); @@ -131,7 +131,7 @@ Source::SpellCheckView::SpellCheckView() : Gsv::View() { }); get_buffer()->signal_mark_set().connect([this](const Gtk::TextBuffer::iterator& iter, const Glib::RefPtr& mark) { - if(spellcheck_checker==NULL) + if(spellcheck_checker==nullptr) return; if(mark->get_name()=="insert") { @@ -191,7 +191,7 @@ Source::SpellCheckView::~SpellCheckView() { delayed_spellcheck_suggestions_connection.disconnect(); delayed_spellcheck_error_clear.disconnect(); - if(spellcheck_checker!=NULL) + if(spellcheck_checker!=nullptr) delete_aspell_speller(spellcheck_checker);//asd } @@ -201,9 +201,9 @@ void Source::SpellCheckView::configure() { aspell_config_replace(spellcheck_config, "encoding", "utf-8"); } spellcheck_possible_err=new_aspell_speller(spellcheck_config); - if(spellcheck_checker!=NULL) + if(spellcheck_checker!=nullptr) delete_aspell_speller(spellcheck_checker); - spellcheck_checker=NULL; + spellcheck_checker=nullptr; if (aspell_error_number(spellcheck_possible_err) != 0) std::cerr << "Spell check error: " << aspell_error_message(spellcheck_possible_err) << std::endl; else @@ -218,7 +218,7 @@ void Source::SpellCheckView::hide_dialogs() { } void Source::SpellCheckView::spellcheck(const Gtk::TextIter& start, const Gtk::TextIter& end) { - if(spellcheck_checker==NULL) + if(spellcheck_checker==nullptr) return; auto iter=start; while(iter && iter Source::SpellCheckView::spellcheck_get_suggestions(cons std::vector words; const char *word; - while ((word = aspell_string_enumeration_next(elements))!= NULL) { + while ((word = aspell_string_enumeration_next(elements))!= nullptr) { words.emplace_back(word); } delete_aspell_string_enumeration(elements); diff --git a/src/terminal.cc b/src/terminal.cc index 1e60ac9..45675b4 100644 --- a/src/terminal.cc +++ b/src/terminal.cc @@ -334,8 +334,8 @@ void Terminal::clear() { for(auto &in_progress: in_progresses) in_progress->stop=true; } - while(g_main_context_pending(NULL)) - g_main_context_iteration(NULL, false); + while(g_main_context_pending(nullptr)) + g_main_context_iteration(nullptr, false); get_buffer()->set_text(""); } diff --git a/src/window.cc b/src/window.cc index f150c9d..ae1fa87 100644 --- a/src/window.cc +++ b/src/window.cc @@ -513,8 +513,8 @@ void Window::set_menu_actions() { #ifdef __APPLE__ Terminal::get().process("open \""+uri+"\""); #else - GError* error=NULL; - gtk_show_uri(NULL, uri.c_str(), GDK_CURRENT_TIME, &error); + GError* error=nullptr; + gtk_show_uri(nullptr, uri.c_str(), GDK_CURRENT_TIME, &error); g_clear_error(&error); #endif }