mirror of
https://github.com/loot/libloot.git
synced 2026-07-27 14:16:01 -07:00
NULL -> nullptr switch.
This commit is contained in:
+41
-41
@@ -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<loot::Plugin> 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<loot::Plugin> 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<std::string> 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<loot::Message> 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)
|
||||
|
||||
Reference in New Issue
Block a user