diff options
| author | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> | 2018-06-15 10:46:15 +0000 |
|---|---|---|
| committer | Marc Jeanmougin <marcjeanmougin@free.fr> | 2018-06-18 12:27:01 +0000 |
| commit | f4349fb3e45bd44cef0e2b69af4c9b4cf35dcf43 (patch) | |
| tree | 7c6044fd3a17a2665841959dac9b3b2110b27924 /src/shortcuts.cpp | |
| parent | Run clang-tidy’s modernize-use-override pass. (diff) | |
| download | inkscape-f4349fb3e45bd44cef0e2b69af4c9b4cf35dcf43.tar.gz inkscape-f4349fb3e45bd44cef0e2b69af4c9b4cf35dcf43.zip | |
Run clang-tidy’s modernize-use-nullptr pass.
This replaces all NULL or 0 with nullptr when assigned to or returned as
a pointer.
Diffstat (limited to 'src/shortcuts.cpp')
| -rw-r--r-- | src/shortcuts.cpp | 44 |
1 files changed, 22 insertions, 22 deletions
diff --git a/src/shortcuts.cpp b/src/shortcuts.cpp index 5c2aa3e39..2f83133dc 100644 --- a/src/shortcuts.cpp +++ b/src/shortcuts.cpp @@ -66,16 +66,16 @@ sp_shortcut_invoke(unsigned int shortcut, Inkscape::UI::View::View *view) if (verb) { SPAction *action = verb->get_action(Inkscape::ActionContext(view)); if (action) { - sp_action_perform(action, NULL); + sp_action_perform(action, nullptr); return true; } } return false; } -static std::map<unsigned int, Inkscape::Verb * > *verbs = NULL; -static std::map<Inkscape::Verb *, unsigned int> *primary_shortcuts = NULL; -static std::map<Inkscape::Verb *, unsigned int> *user_shortcuts = NULL; +static std::map<unsigned int, Inkscape::Verb * > *verbs = nullptr; +static std::map<Inkscape::Verb *, unsigned int> *primary_shortcuts = nullptr; +static std::map<Inkscape::Verb *, unsigned int> *user_shortcuts = nullptr; void sp_shortcut_init() { @@ -254,7 +254,7 @@ void sp_shortcuts_delete_all_from_file() { char const *filename = get_path(USER, KEYS, "default.xml"); - XML::Document *doc=sp_repr_read_file(filename, NULL); + XML::Document *doc=sp_repr_read_file(filename, nullptr); if (!doc) { g_warning("Unable to read keys file %s", filename); return; @@ -278,7 +278,7 @@ void sp_shortcuts_delete_all_from_file() { } - sp_repr_save_file(doc, filename, NULL); + sp_repr_save_file(doc, filename, nullptr); GC::release(doc); } @@ -290,10 +290,10 @@ Inkscape::XML::Document *sp_shortcut_create_template_file(char const *filename) "<keys name=\"My custom shortcuts\">" "</keys>"; - Inkscape::XML::Document *doc = sp_repr_read_mem(buffer, strlen(buffer), NULL); - sp_repr_save_file(doc, filename, NULL); + Inkscape::XML::Document *doc = sp_repr_read_mem(buffer, strlen(buffer), nullptr); + sp_repr_save_file(doc, filename, nullptr); - return sp_repr_read_file(filename, NULL); + return sp_repr_read_file(filename, nullptr); } /* @@ -311,7 +311,7 @@ void sp_shortcut_get_file_names(std::vector<Glib::ustring> *names, std::vector<G for(auto &filename: filenames) { Glib::ustring label = Glib::path_get_basename(filename); - XML::Document *doc = sp_repr_read_file(filename.c_str(), NULL); + XML::Document *doc = sp_repr_read_file(filename.c_str(), nullptr); if (!doc) { g_warning("Unable to read keyboard shortcut file %s", filename.c_str()); continue; @@ -456,14 +456,14 @@ bool sp_shortcut_file_import() { void sp_shortcut_file_import_do(char const *importname) { - XML::Document *doc=sp_repr_read_file(importname, NULL); + XML::Document *doc=sp_repr_read_file(importname, nullptr); if (!doc) { g_warning("Unable to read keyboard shortcut file %s", importname); return; } char const *filename = get_path(USER, KEYS, "default.xml"); - sp_repr_save_file(doc, filename, NULL); + sp_repr_save_file(doc, filename, nullptr); GC::release(doc); @@ -474,13 +474,13 @@ void sp_shortcut_file_export_do(char const *exportname) { char const *filename = get_path(USER, KEYS, "default.xml"); - XML::Document *doc=sp_repr_read_file(filename, NULL); + XML::Document *doc=sp_repr_read_file(filename, nullptr); if (!doc) { g_warning("Unable to read keyboard shortcut file %s", filename); return; } - sp_repr_save_file(doc, exportname, NULL); + sp_repr_save_file(doc, exportname, nullptr); GC::release(doc); } @@ -498,7 +498,7 @@ void sp_shortcut_delete_from_file(char const * /*action*/, unsigned int const sh char const *filename = get_path(USER, KEYS, "default.xml"); - XML::Document *doc=sp_repr_read_file(filename, NULL); + XML::Document *doc=sp_repr_read_file(filename, nullptr); if (!doc) { g_warning("Unable to read keyboard shortcut file %s", filename); return; @@ -556,7 +556,7 @@ void sp_shortcut_delete_from_file(char const * /*action*/, unsigned int const sh iter = iter->next(); } - sp_repr_save_file(doc, filename, NULL); + sp_repr_save_file(doc, filename, nullptr); GC::release(doc); @@ -566,7 +566,7 @@ void sp_shortcut_add_to_file(char const *action, unsigned int const shortcut) { char const *filename = get_path(USER, KEYS, "default.xml"); - XML::Document *doc=sp_repr_read_file(filename, NULL); + XML::Document *doc=sp_repr_read_file(filename, nullptr); if (!doc) { g_warning("Unable to read keyboard shortcut file %s, creating ....", filename); doc = sp_shortcut_create_template_file(filename); @@ -611,13 +611,13 @@ void sp_shortcut_add_to_file(char const *action, unsigned int const shortcut) { doc->root()->appendChild(newnode); } - sp_repr_save_file(doc, filename, NULL); + sp_repr_save_file(doc, filename, nullptr); GC::release(doc); } static void read_shortcuts_file(char const *filename, bool const is_user_set) { - XML::Document *doc=sp_repr_read_file(filename, NULL); + XML::Document *doc=sp_repr_read_file(filename, nullptr); if (!doc) { g_warning("Unable to read keys file %s", filename); return; @@ -730,7 +730,7 @@ sp_shortcut_unset(unsigned int const shortcut) /* Maintain the invariant that sp_shortcut_get_primary(v) returns either 0 or a valid shortcut for v. */ if (verb) { - (*verbs)[shortcut] = 0; + (*verbs)[shortcut] = nullptr; unsigned int const old_primary = (*primary_shortcuts)[verb]; if (old_primary == shortcut) { @@ -743,7 +743,7 @@ sp_shortcut_unset(unsigned int const shortcut) GtkAccelGroup * sp_shortcut_get_accel_group() { - static GtkAccelGroup *accel_group = NULL; + static GtkAccelGroup *accel_group = nullptr; if (!accel_group) { accel_group = gtk_accel_group_new (); @@ -872,7 +872,7 @@ gchar *sp_shortcut_get_label(unsigned int shortcut) * g_object_new(GTK_TYPE_ACCEL_LABEL, NULL) followed by * gtk_label_set_text_with_mnemonic(lbl, str). */ - gchar *result = 0; + gchar *result = nullptr; if (shortcut != GDK_KEY_VoidSymbol) { result = gtk_accelerator_get_label( sp_shortcut_get_key(shortcut), |
