From 24fa511f969fcc93c838be44f3cd5cf900519fbf Mon Sep 17 00:00:00 2001 From: WrinklyNinja Date: Sat, 21 Jun 2014 23:45:40 +0100 Subject: [PATCH] NULL -> nullptr switch. --- src/api/api.cpp | 82 ++++++++++++++++++++-------------------- src/backend/game.cpp | 40 ++++++++++---------- src/backend/helpers.cpp | 2 +- src/backend/metadata.cpp | 2 +- src/backend/network.cpp | 14 +++---- src/gui/editor.cpp | 4 +- src/gui/main.cpp | 30 +++++++-------- src/gui/misc.cpp | 12 +++--- src/gui/settings.cpp | 4 +- 9 files changed, 95 insertions(+), 95 deletions(-) diff --git a/src/api/api.cpp b/src/api/api.cpp index 079515f7..d3867559 100644 --- a/src/api/api.cpp +++ b/src/api/api.cpp @@ -90,14 +90,14 @@ const unsigned int loot_needs_cleaning_unknown = 2; struct _loot_db_int { _loot_db_int() - : extTagMap(NULL), - extAddedTagIds(NULL), - extRemovedTagIds(NULL), - extMessageArray(NULL), + : extTagMap(nullptr), + extAddedTagIds(nullptr), + extRemovedTagIds(nullptr), + extMessageArray(nullptr), extMessageArraySize(0) { extMessage.type = loot_message_say; - extMessage.message = NULL; + extMessage.message = nullptr; } ~_loot_db_int() { @@ -105,13 +105,13 @@ struct _loot_db_int { delete [] extRemovedTagIds; delete [] extMessage.message; - if (extTagMap != NULL) { + if (extTagMap != nullptr) { for (size_t i=0; i < bashTagMap.size(); i++) delete [] extTagMap[i]; //Gotta clear those allocated strings. delete [] extTagMap; } - if (extMessageArray != NULL) { + if (extMessageArray != nullptr) { for (size_t i=0; i < extMessageArraySize; i++) delete [] extMessageArray[i].message; //Gotta clear those allocated strings. delete [] extMessageArray; @@ -133,7 +133,7 @@ struct _loot_db_int { size_t extMessageArraySize; }; -char * extMessageStr = NULL; +char * extMessageStr = nullptr; // std::string to null-terminated char string converter. char * ToNewCString(std::string str) { @@ -148,7 +148,7 @@ unsigned int c_error(const loot::error& e) { strcpy(extMessageStr, e.what()); } catch (std::bad_alloc& /*e*/) { - extMessageStr = NULL; + extMessageStr = nullptr; } return e.code(); } @@ -166,7 +166,7 @@ unsigned int c_error(const unsigned int code, const std::string& what) { // warning return code was returned by a function. The string exists // until this function is called again or until CleanUpAPI is called. LOOT_API unsigned int loot_get_error_message (const char ** const message) { - if (message == NULL) + if (message == nullptr) return c_error(loot_error_invalid_args, "Null message pointer passed."); *message = extMessageStr; @@ -177,7 +177,7 @@ LOOT_API unsigned int loot_get_error_message (const char ** const message) { // Frees memory allocated to error string. LOOT_API void loot_cleanup () { delete [] extMessageStr; - extMessageStr = NULL; + extMessageStr = nullptr; } @@ -195,7 +195,7 @@ LOOT_API bool loot_is_compatible (const unsigned int versionMajor, const unsigne // The string exists until this function is called again or until // CleanUpAPI is called. LOOT_API unsigned int loot_get_version (unsigned int * const versionMajor, unsigned int * const versionMinor, unsigned int * const versionPatch) { - if (versionMajor == NULL || versionMinor == NULL || versionPatch == NULL) + if (versionMajor == nullptr || versionMinor == nullptr || versionPatch == nullptr) return c_error(loot_error_invalid_args, "Null pointer passed."); *versionMajor = loot::g_version_major; @@ -215,10 +215,10 @@ LOOT_API unsigned int loot_get_version (unsigned int * const versionMajor, unsig // is the path to that game's Data folder, and is case-sensitive if the // underlying filesystem is case-sensitive. This function also checks that // plugins.txt and loadorder.txt (if they both exist) are in sync. If -// dataPath == NULL then the API will attempt to detect the data path of +// dataPath == nullptr then the API will attempt to detect the data path of // the specified game. LOOT_API unsigned int loot_create_db (loot_db * const db, const unsigned int clientGame, const char * const gamePath) { - if (db == NULL || (clientGame != loot_game_tes4 && clientGame != loot_game_tes5 && clientGame != loot_game_fo3 && clientGame != loot_game_fonv)) + if (db == nullptr || (clientGame != loot_game_tes4 && clientGame != loot_game_tes5 && clientGame != loot_game_fo3 && clientGame != loot_game_fonv)) return c_error(loot_error_invalid_args, "Null pointer passed."); //Set the locale to get encoding conversions working correctly. @@ -231,7 +231,7 @@ LOOT_API unsigned int loot_create_db (loot_db * const db, const unsigned int cli boost::log::core::get()->set_logging_enabled(false); std::string game_path = ""; - if (gamePath != NULL) + if (gamePath != nullptr) game_path = gamePath; loot::Game game; @@ -269,7 +269,7 @@ LOOT_API void loot_destroy_db (loot_db db) { // masterlistPath and userlistPath are files. LOOT_API unsigned int loot_load_lists (loot_db db, const char * const masterlistPath, const char * const userlistPath) { - if (db == NULL || masterlistPath == NULL) + if (db == nullptr || masterlistPath == nullptr) return c_error(loot_error_invalid_args, "Null pointer passed."); std::list temp; @@ -287,7 +287,7 @@ LOOT_API unsigned int loot_load_lists (loot_db db, const char * const masterlist } try { - if (userlistPath != NULL) { + if (userlistPath != nullptr) { if (boost::filesystem::exists(userlistPath)) { if (boost::algorithm::iends_with(userlistPath, ".yaml")) { loot::ifstream in(userlistPath); @@ -306,22 +306,22 @@ LOOT_API unsigned int loot_load_lists (loot_db db, const char * const masterlist delete [] db->extAddedTagIds; delete [] db->extRemovedTagIds; - if (db->extTagMap != NULL) { + if (db->extTagMap != nullptr) { for (size_t i=0; i < db->bashTagMap.size(); i++) delete [] db->extTagMap[i]; //Gotta clear those allocated strings. delete [] db->extTagMap; } - if (db->extMessageArray != NULL) { + if (db->extMessageArray != nullptr) { for (size_t i=0; i < db->extMessageArraySize; i++) delete [] db->extMessageArray[i].message; //Gotta clear those allocated strings. delete [] db->extMessageArray; } - db->extAddedTagIds = NULL; - db->extRemovedTagIds = NULL; - db->extTagMap = NULL; - db->extMessageArray = NULL; + db->extAddedTagIds = nullptr; + db->extRemovedTagIds = nullptr; + db->extTagMap = nullptr; + db->extMessageArray = nullptr; db->rawMetadata = temp; db->metadata = temp; @@ -338,7 +338,7 @@ LOOT_API unsigned int loot_load_lists (loot_db db, const char * const masterlist // ignoring the results of any previous evaluations. Paths are case-sensitive // if the underlying filesystem is case-sensitive. LOOT_API unsigned int loot_eval_lists (loot_db db, const unsigned int language) { - if (db == NULL) + if (db == nullptr) return c_error(loot_error_invalid_args, "Null pointer passed."); std::list temp = db->rawMetadata; @@ -414,20 +414,20 @@ LOOT_API unsigned int loot_eval_lists (loot_db db, const unsigned int language) // and userlist, and the number of tags in the returned array. The array and // its contents are static and should not be freed by the client. LOOT_API unsigned int loot_get_tag_map (loot_db db, char *** const tagMap, size_t * const numTags) { - if (db == NULL || tagMap == NULL || numTags == NULL) + if (db == nullptr || tagMap == nullptr || numTags == nullptr) return c_error(loot_error_invalid_args, "Null pointer passed."); //Clear existing array allocation. - if (db->extTagMap != NULL) { + if (db->extTagMap != nullptr) { for (size_t i=0, max=db->bashTagMap.size(); i < max; ++i) { delete [] db->extTagMap[i]; } delete [] db->extTagMap; - db->extTagMap = NULL; + db->extTagMap = nullptr; } //Initialise output. - *tagMap = NULL; + *tagMap = nullptr; *numTags = 0; std::unordered_set allTags; @@ -477,7 +477,7 @@ LOOT_API unsigned int loot_get_tag_map (loot_db db, char *** const tagMap, size_ // The returned arrays are valid until the db is destroyed or until the Load // function is called. The arrays should not be freed by the client. modName is // case-insensitive. If no Tags are found for an array, the array pointer (*tagIds) -// will be NULL. The userlistModified bool is true if the userlist contains Bash Tag +// will be nullptr. The userlistModified bool is true if the userlist contains Bash Tag // suggestion message additions. LOOT_API unsigned int loot_get_plugin_tags (loot_db db, const char * const plugin, unsigned int ** const tagIds_added, @@ -485,19 +485,19 @@ LOOT_API unsigned int loot_get_plugin_tags (loot_db db, const char * const plugi unsigned int ** const tagIds_removed, size_t * const numTags_removed, bool * const userlistModified) { - if (db == NULL || plugin == NULL || tagIds_added == NULL || numTags_added == NULL || tagIds_removed == NULL || numTags_removed == NULL || userlistModified == NULL) + if (db == nullptr || plugin == nullptr || tagIds_added == nullptr || numTags_added == nullptr || tagIds_removed == nullptr || numTags_removed == nullptr || userlistModified == nullptr) return c_error(loot_error_invalid_args, "Null pointer passed."); //Clear existing array allocations. delete [] db->extAddedTagIds; delete [] db->extRemovedTagIds; - db->extAddedTagIds = NULL; - db->extRemovedTagIds = NULL; + db->extAddedTagIds = nullptr; + db->extRemovedTagIds = nullptr; //Initialise output. - *tagIds_added = NULL; - *tagIds_removed = NULL; + *tagIds_added = nullptr; + *tagIds_removed = nullptr; *userlistModified = false; *numTags_added = 0; *numTags_removed = 0; @@ -571,24 +571,24 @@ LOOT_API unsigned int loot_get_plugin_tags (loot_db db, const char * const plugi // Returns the messages attached to the given plugin. Messages are valid until Load, // loot_destroy_db or loot_get_plugin_messages are next called. plugin is case-insensitive. -// If no messages are attached, *messages will be NULL and numMessages will equal 0. +// If no messages are attached, *messages will be nullptr and numMessages will equal 0. LOOT_API unsigned int loot_get_plugin_messages (loot_db db, const char * const plugin, loot_message ** const messages, size_t * const numMessages) { - if (db == NULL || plugin == NULL || messages == NULL || numMessages == NULL) + if (db == nullptr || plugin == nullptr || messages == nullptr || numMessages == nullptr) return c_error(loot_error_invalid_args, "Null pointer passed."); //Clear existing array allocation. - if (db->extMessageArray != NULL) { + if (db->extMessageArray != nullptr) { for (size_t i=0; i < db->extMessageArraySize; ++i) { delete [] db->extMessageArray[i].message; } delete [] db->extMessageArray; - db->extMessageArray = NULL; + db->extMessageArray = nullptr; } //Initialise output. - *messages = NULL; + *messages = nullptr; *numMessages = 0; std::list pluginMessages; @@ -622,7 +622,7 @@ LOOT_API unsigned int loot_get_plugin_messages (loot_db db, const char * const p } LOOT_API unsigned int loot_get_dirty_info(loot_db db, const char * const plugin, unsigned int * const needsCleaning) { - if (db == NULL || plugin == NULL || needsCleaning == NULL) + if (db == nullptr || plugin == nullptr || needsCleaning == nullptr) return c_error(loot_error_invalid_args, "Null pointer passed."); *needsCleaning = loot_needs_cleaning_unknown; @@ -652,7 +652,7 @@ LOOT_API unsigned int loot_get_dirty_info(loot_db db, const char * const plugin, // conditions, in order to create the Wrye Bash taglist. outputFile is the path to use // for output. If outputFile already exists, it will only be overwritten if overwrite is true. LOOT_API unsigned int loot_write_minimal_list (loot_db db, const char * const outputFile, const bool overwrite) { - if (db == NULL || outputFile == NULL) + if (db == nullptr || outputFile == nullptr) return c_error(loot_error_invalid_args, "Null pointer passed."); if (boost::filesystem::exists(outputFile) && !overwrite) diff --git a/src/backend/game.cpp b/src/backend/game.cpp index 88bfbf76..32bc7774 100644 --- a/src/backend/game.cpp +++ b/src/backend/game.cpp @@ -250,10 +250,10 @@ namespace loot { ret = lo_create_handle(&gh, LIBLO_GAME_FNV, gamePath.string().c_str()); if (ret != LIBLO_OK && ret != LIBLO_WARN_LO_MISMATCH) { - const char * e = NULL; + const char * e = nullptr; string err; lo_get_error_message(&e); - if (e == NULL) { + if (e == nullptr) { BOOST_LOG_TRIVIAL(error) << "libloadorder failed to create a game handle. Details could not be fetched."; err = lc::translate("libloadorder failed to create a game handle. Details could not be fetched.").str(); } @@ -268,11 +268,11 @@ namespace loot { ret = lo_set_game_master(gh, _masterFile.c_str()); if (ret != LIBLO_OK) { - const char * e = NULL; + const char * e = nullptr; string err; lo_get_error_message(&e); lo_destroy_handle(gh); - if (e == NULL) { + if (e == nullptr) { BOOST_LOG_TRIVIAL(error) << "libloadorder failed to initialise game master file support. Details could not be fetched."; err = lc::translate("libloadorder failed to initialise game master file support. Details could not be fetched.").str(); } @@ -285,11 +285,11 @@ namespace loot { } if (lo_get_active_plugins(gh, &pluginArr, &pluginArrSize) != LIBLO_OK) { - const char * e = NULL; + const char * e = nullptr; string err; lo_get_error_message(&e); lo_destroy_handle(gh); - if (e == NULL) { + if (e == nullptr) { BOOST_LOG_TRIVIAL(error) << "libloadorder failed to get the active plugins list. Details could not be fetched."; err = lc::translate("libloadorder failed to get the active plugins list. Details could not be fetched.").str(); } @@ -331,10 +331,10 @@ namespace loot { ret = lo_create_handle(&gh, LIBLO_GAME_FNV, gamePath.string().c_str()); if (ret != LIBLO_OK && ret != LIBLO_WARN_LO_MISMATCH) { - const char * e = NULL; + const char * e = nullptr; string err; lo_get_error_message(&e); - if (e == NULL) { + if (e == nullptr) { BOOST_LOG_TRIVIAL(error) << "libloadorder failed to create a game handle. Details could not be fetched."; err = lc::translate("libloadorder failed to create a game handle. Details could not be fetched.").str(); } @@ -349,11 +349,11 @@ namespace loot { ret = lo_set_game_master(gh, _masterFile.c_str()); if (ret != LIBLO_OK) { - const char * e = NULL; + const char * e = nullptr; string err; lo_get_error_message(&e); lo_destroy_handle(gh); - if (e == NULL) { + if (e == nullptr) { BOOST_LOG_TRIVIAL(error) << "libloadorder failed to initialise game master file support. Details could not be fetched."; err = lc::translate("libloadorder failed to initialise game master file support. Details could not be fetched.").str(); } @@ -366,11 +366,11 @@ namespace loot { } if (lo_get_load_order(gh, &pluginArr, &pluginArrSize) != LIBLO_OK) { - const char * e = NULL; + const char * e = nullptr; string err; lo_get_error_message(&e); lo_destroy_handle(gh); - if (e == NULL) { + if (e == nullptr) { BOOST_LOG_TRIVIAL(error) << "libloadorder failed to set the load order. Details could not be fetched."; err = lc::translate("libloadorder failed to set the load order. Details could not be fetched.").str(); } @@ -393,8 +393,8 @@ namespace loot { void Game::SetLoadOrder(const std::list& loadOrder) const { BOOST_LOG_TRIVIAL(debug) << "Setting load order for game: " << _name; - lo_game_handle gh = NULL; - char ** pluginArr = NULL; + lo_game_handle gh = nullptr; + char ** pluginArr = nullptr; size_t pluginArrSize = 0; int ret; if (Id() == Game::tes4) @@ -407,10 +407,10 @@ namespace loot { ret = lo_create_handle(&gh, LIBLO_GAME_FNV, gamePath.string().c_str()); if (ret != LIBLO_OK && ret != LIBLO_WARN_LO_MISMATCH) { - const char * e = NULL; + const char * e = nullptr; string err; lo_get_error_message(&e); - if (e == NULL) { + if (e == nullptr) { BOOST_LOG_TRIVIAL(error) << "libloadorder failed to create a game handle. Details could not be fetched."; err = lc::translate("libloadorder failed to create a game handle. Details could not be fetched.").str(); } @@ -424,11 +424,11 @@ namespace loot { ret = lo_set_game_master(gh, _masterFile.c_str()); if (ret != LIBLO_OK) { - const char * e = NULL; + const char * e = nullptr; string err; lo_get_error_message(&e); lo_destroy_handle(gh); - if (e == NULL) { + if (e == nullptr) { BOOST_LOG_TRIVIAL(error) << "libloadorder failed to initialise game master file support. Details could not be fetched."; err = lc::translate("libloadorder failed to initialise game master file support. Details could not be fetched.").str(); } @@ -453,11 +453,11 @@ namespace loot { for (size_t i=0; i < pluginArrSize; i++) delete [] pluginArr[i]; delete [] pluginArr; - const char * e = NULL; + const char * e = nullptr; string err; lo_get_error_message(&e); lo_destroy_handle(gh); - if (e == NULL) { + if (e == nullptr) { BOOST_LOG_TRIVIAL(error) << "libloadorder failed to set the load order. Details could not be fetched."; err = lc::translate("libloadorder failed to set the load order. Details could not be fetched.").str(); } diff --git a/src/backend/helpers.cpp b/src/backend/helpers.cpp index 0345bd98..9104ee05 100644 --- a/src/backend/helpers.cpp +++ b/src/backend/helpers.cpp @@ -339,7 +339,7 @@ namespace loot { // read out the version string static const uint32_t BUFSIZE = 32; char buf[BUFSIZE]; - if (NULL != fgets(buf, BUFSIZE, fp)) { + if (nullptr != fgets(buf, BUFSIZE, fp)) { verString = string(buf); } pclose(fp); diff --git a/src/backend/metadata.cpp b/src/backend/metadata.cpp index 4f68c539..817f8cc4 100644 --- a/src/backend/metadata.cpp +++ b/src/backend/metadata.cpp @@ -318,7 +318,7 @@ namespace loot { if (!boost::filesystem::exists(filepath) && boost::filesystem::exists(filepath.string() + ".ghost")) filepath += ".ghost"; - espm::File * file = NULL; + espm::File * file = nullptr; try { if (game.Id() == Game::tes4) file = new espm::tes4::File(filepath, game.espm_settings, false, headerOnly); diff --git a/src/backend/network.cpp b/src/backend/network.cpp index 125b94da..263243ec 100644 --- a/src/backend/network.cpp +++ b/src/backend/network.cpp @@ -43,7 +43,7 @@ namespace loot { struct git_handler { public: - git_handler() : repo(NULL), remote(NULL), cfg(NULL), obj(NULL), commit(NULL), ref(NULL), sig(NULL), blob(NULL) {} + git_handler() : repo(nullptr), remote(nullptr), cfg(nullptr), obj(nullptr), commit(nullptr), ref(nullptr), sig(nullptr), blob(nullptr) {} void free() { git_commit_free(commit); @@ -62,7 +62,7 @@ namespace loot { const git_error * last_error = giterr_last(); std::string error_message; - if (last_error == NULL) + if (last_error == nullptr) error_message = to_string(error_code) + "."; else error_message = to_string(error_code) + "; " + last_error->message; @@ -148,7 +148,7 @@ namespace loot { string revision, date; //Need to get the HEAD object, because the individual file has a different SHA. git_object_free(git.obj); - git.obj = NULL; //Just to be safe. + git.obj = nullptr; //Just to be safe. BOOST_LOG_TRIVIAL(info) << "Getting the Git object for the tree at HEAD."; git.call(git_revparse_single(&git.obj, git.repo, "HEAD")); @@ -239,7 +239,7 @@ namespace loot { //Fetch from remote. BOOST_LOG_TRIVIAL(trace) << "Fetching from remote."; - git.call(git_remote_fetch(git.remote, git.sig, NULL)); + git.call(git_remote_fetch(git.remote, git.sig, nullptr)); const git_transfer_progress * stats = git_remote_stats(git.remote); BOOST_LOG_TRIVIAL(info) << "Received " << stats->indexed_objects << " of " << stats->total_objects << " objects in " << stats->received_bytes << " bytes."; @@ -305,9 +305,9 @@ namespace loot { git_object_free(git.obj); git_reference_free(git.ref); git_commit_free(git.commit); - git.obj = NULL; - git.ref = NULL; - git.commit = NULL; + git.obj = nullptr; + git.ref = nullptr; + git.commit = nullptr; BOOST_LOG_TRIVIAL(debug) << "Testing masterlist parsing."; diff --git a/src/gui/editor.cpp b/src/gui/editor.cpp index e85a6caf..875e5bd0 100644 --- a/src/gui/editor.cpp +++ b/src/gui/editor.cpp @@ -137,7 +137,7 @@ loot::Tag CommonEditor::RowToTag(wxListView * list, long row) const { loot::PluginDirtyInfo CommonEditor::RowToPluginDirtyInfo(wxListView * list, long row) const { string text(list->GetItemText(row, 0).ToUTF8()); - uint32_t crc = strtoul(text.c_str(), NULL, 16); + uint32_t crc = strtoul(text.c_str(), nullptr, 16); return loot::PluginDirtyInfo( crc, atoi(string(list->GetItemText(row, 1).ToUTF8()).c_str()), @@ -241,7 +241,7 @@ MiniEditor::MiniEditor(wxWindow *parent, const wxString& title, const std::list< wxSizer * sizer = CreateSeparatedButtonSizer(wxAPPLY | wxCANCEL); //Now add buttons to window sizer. - if (sizer != NULL) + if (sizer != nullptr) bigBox->Add(sizer, 0, wxEXPAND | wxLEFT | wxBOTTOM | wxRIGHT, 15); //Fill pluginList with the contents of basePlugins. diff --git a/src/gui/main.cpp b/src/gui/main.cpp index 5347184e..66b68efe 100644 --- a/src/gui/main.cpp +++ b/src/gui/main.cpp @@ -198,9 +198,9 @@ bool LOOT::OnInit() { translate("Error: LOOT is already running. This instance will now quit."), translate("LOOT: Error"), wxOK | wxICON_ERROR, - NULL); + nullptr); delete checker; // OnExit() won't be called if we return false - checker = NULL; + checker = nullptr; return false; } @@ -215,7 +215,7 @@ bool LOOT::OnInit() { translate("Error: Could not create local app data LOOT folder."), translate("LOOT: Error"), wxOK | wxICON_ERROR, - NULL); + nullptr); return false; } GenerateDefaultSettingsFile(g_path_settings.string()); @@ -229,7 +229,7 @@ bool LOOT::OnInit() { FromUTF8(format(loc::translate("Error: Settings parsing failed. %1%")) % e.what()), translate("LOOT: Error"), wxOK | wxICON_ERROR, - NULL); + nullptr); return false; } @@ -315,7 +315,7 @@ bool LOOT::OnInit() { translate("Error: Could not apply translation."), translate("LOOT: Error"), wxOK | wxICON_ERROR, - NULL); + nullptr); } } else { wxLoc = new wxLocale(wxLANGUAGE_ENGLISH); @@ -325,7 +325,7 @@ bool LOOT::OnInit() { translate("Error: The selected language is not available on this system."), translate("LOOT: Error"), wxOK | wxICON_ERROR, - NULL); + nullptr); } //Detect installed games. @@ -338,7 +338,7 @@ bool LOOT::OnInit() { FromUTF8(format(loc::translate("Error: Games' settings parsing failed. %1%")) % e.what()), translate("LOOT: Error"), wxOK | wxICON_ERROR, - NULL); + nullptr); return false; } catch (std::exception& e) { @@ -347,7 +347,7 @@ bool LOOT::OnInit() { FromUTF8(format(loc::translate("Error: Game-specific settings could not be initialised. %1%")) % e.what()), translate("LOOT: Error"), wxOK | wxICON_ERROR, - NULL); + nullptr); return false; } @@ -406,7 +406,7 @@ bool LOOT::OnInit() { translate("Error: None of the supported games were detected."), translate("LOOT: Error"), wxOK | wxICON_ERROR, - NULL); + nullptr); return false; } } @@ -424,7 +424,7 @@ bool LOOT::OnInit() { FromUTF8(format(loc::translate("Error: Game-specific settings could not be initialised. %1%")) % e.what()), translate("LOOT: Error"), wxOK | wxICON_ERROR, - NULL); + nullptr); return false; } @@ -439,7 +439,7 @@ bool LOOT::OnInit() { return true; } -Launcher::Launcher(const wxChar *title, YAML::Node& settings, Game * game, vector& games) : wxFrame(NULL, wxID_ANY, title), _game(game), _settings(settings), _games(games) { +Launcher::Launcher(const wxChar *title, YAML::Node& settings, Game * game, vector& games) : wxFrame(nullptr, wxID_ANY, title), _game(game), _settings(settings), _games(games) { //Initialise menu items. wxMenuBar * MenuBar = new wxMenuBar(); @@ -587,7 +587,7 @@ void Launcher::OnGameChange(wxCommandEvent& event) { FromUTF8(format(loc::translate("Error: Game-specific settings could not be initialised. %1%")) % e.what()), translate("LOOT: Error"), wxOK | wxICON_ERROR, - NULL); + nullptr); } SetTitle(FromUTF8("LOOT - " + _game->Name())); if (_game->Id() == loot::Game::tes5) @@ -859,7 +859,7 @@ void Launcher::OnSortPlugins(wxCommandEvent& event) { loot::Sort(graph, plugins); progDia->Destroy(); - progDia = NULL; + progDia = nullptr; BOOST_LOG_TRIVIAL(info) << "Displaying load order preview."; MiniEditor editor(this, translate("LOOT: Calculated Load Order"), plugins, *_game); @@ -952,7 +952,7 @@ void Launcher::OnSortPlugins(wxCommandEvent& event) { messages.push_back(loot::Message(loot::Message::error, (format(loc::translate("Failed to calculate the load order. Details: %1%")) % e.what()).str())); progDia->Destroy(); - progDia = NULL; + progDia = nullptr; } /////////////////////////////////////////////////////// @@ -973,7 +973,7 @@ void Launcher::OnSortPlugins(wxCommandEvent& event) { translate("LOOT: Error"), wxOK | wxICON_ERROR, this); - if (progDia != NULL) + if (progDia != nullptr) progDia->Destroy(); return; } diff --git a/src/gui/misc.cpp b/src/gui/misc.cpp index e898cd08..b0d97998 100644 --- a/src/gui/misc.cpp +++ b/src/gui/misc.cpp @@ -130,7 +130,7 @@ FileEditDialog::FileEditDialog(wxWindow *parent, const wxString& title) : wxDial //Need to add 'OK' and 'Cancel' buttons. wxSizer * sizer = CreateSeparatedButtonSizer(wxOK | wxCANCEL); - if (sizer != NULL) + if (sizer != nullptr) bigBox->Add(sizer, 0, wxEXPAND | wxLEFT | wxBOTTOM | wxRIGHT, 15); SetBackgroundColour(wxColour(255, 255, 255)); @@ -235,7 +235,7 @@ MessageEditDialog::MessageEditDialog(wxWindow *parent, const wxString& title) : //Need to add 'OK' and 'Cancel' buttons. wxSizer * sizer = CreateSeparatedButtonSizer(wxOK | wxCANCEL); - if (sizer != NULL) + if (sizer != nullptr) bigBox->Add(sizer, 0, wxEXPAND | wxLEFT | wxBOTTOM | wxRIGHT, 15); //Set defaults. @@ -312,7 +312,7 @@ void MessageEditDialog::OnEdit(wxCommandEvent& event) { translate("Error: No content row selected."), translate("LOOT: Error"), wxOK | wxICON_ERROR, - NULL); + nullptr); return; } long i = _content->GetFirstSelected(); @@ -327,7 +327,7 @@ void MessageEditDialog::OnRemove(wxCommandEvent& event) { translate("Error: No content row selected."), translate("LOOT: Error"), wxOK | wxICON_ERROR, - NULL); + nullptr); return; } _content->DeleteItem(_content->GetFirstSelected()); @@ -370,7 +370,7 @@ TagEditDialog::TagEditDialog(wxWindow *parent, const wxString& title) : wxDialog //Need to add 'OK' and 'Cancel' buttons. wxSizer * sizer = CreateSeparatedButtonSizer(wxOK | wxCANCEL); - if (sizer != NULL) + if (sizer != nullptr) bigBox->Add(sizer, 0, wxEXPAND | wxLEFT | wxBOTTOM | wxRIGHT, 15); //Set defaults. @@ -444,7 +444,7 @@ DirtInfoEditDialog::DirtInfoEditDialog(wxWindow * parent, const wxString& title) //Need to add 'OK' and 'Cancel' buttons. wxSizer * sizer = CreateSeparatedButtonSizer(wxOK | wxCANCEL); - if (sizer != NULL) + if (sizer != nullptr) bigBox->Add(sizer, 0, wxEXPAND | wxLEFT | wxBOTTOM | wxRIGHT, 15); SetBackgroundColour(wxColour(255, 255, 255)); diff --git a/src/gui/settings.cpp b/src/gui/settings.cpp index 5cdd8ad4..f8378f82 100644 --- a/src/gui/settings.cpp +++ b/src/gui/settings.cpp @@ -130,7 +130,7 @@ SettingsFrame::SettingsFrame(wxWindow *parent, const wxString& title, YAML::Node wxSizer * sizer = CreateSeparatedButtonSizer(wxOK|wxCANCEL); //Now add TabHolder and OK button to window sizer. - if (sizer != NULL) + if (sizer != nullptr) bigBox->Add(sizer, 0, wxEXPAND|wxLEFT|wxBOTTOM|wxRIGHT, 15); //Initialise options with values. For checkboxes, they are off by default. @@ -443,7 +443,7 @@ GameEditDialog::GameEditDialog(wxWindow *parent, const wxString& title) : wxDial //Need to add 'OK' and 'Cancel' buttons. wxSizer * sizer = CreateSeparatedButtonSizer(wxOK|wxCANCEL); - if (sizer != NULL) + if (sizer != nullptr) bigBox->Add(sizer, 0, wxEXPAND|wxLEFT|wxBOTTOM|wxRIGHT, 15); //Set defaults.