🎨 modernize-use-nullptr
This commit is contained in:
parent
b31061ff83
commit
bb4e1960e7
77 changed files with 1828 additions and 1828 deletions
|
|
@ -18,11 +18,11 @@ namespace devilution {
|
|||
|
||||
namespace {
|
||||
|
||||
std::string *basePath = NULL;
|
||||
std::string *prefPath = NULL;
|
||||
std::string *configPath = NULL;
|
||||
std::string *ttfPath = NULL;
|
||||
std::string *ttfName = NULL;
|
||||
std::string *basePath = nullptr;
|
||||
std::string *prefPath = nullptr;
|
||||
std::string *configPath = nullptr;
|
||||
std::string *ttfPath = nullptr;
|
||||
std::string *ttfName = nullptr;
|
||||
|
||||
void AddTrailingSlash(std::string *path)
|
||||
{
|
||||
|
|
@ -37,8 +37,8 @@ void AddTrailingSlash(std::string *path)
|
|||
|
||||
std::string *FromSDL(char *s)
|
||||
{
|
||||
std::string *result = new std::string(s != NULL ? s : "");
|
||||
if (s != NULL) {
|
||||
std::string *result = new std::string(s != nullptr ? s : "");
|
||||
if (s != nullptr) {
|
||||
SDL_free(s);
|
||||
} else {
|
||||
SDL_Log("%s", SDL_GetError());
|
||||
|
|
@ -55,7 +55,7 @@ const std::string &GetBasePath()
|
|||
if (basePath == NULL)
|
||||
basePath = new std::string(GetPrefPath());
|
||||
#else
|
||||
if (basePath == NULL)
|
||||
if (basePath == nullptr)
|
||||
basePath = FromSDL(SDL_GetBasePath());
|
||||
#endif
|
||||
return *basePath;
|
||||
|
|
@ -63,35 +63,35 @@ const std::string &GetBasePath()
|
|||
|
||||
const std::string &GetPrefPath()
|
||||
{
|
||||
if (prefPath == NULL)
|
||||
if (prefPath == nullptr)
|
||||
prefPath = FromSDL(SDL_GetPrefPath("diasurgical", "devilution"));
|
||||
return *prefPath;
|
||||
}
|
||||
|
||||
const std::string &GetConfigPath()
|
||||
{
|
||||
if (configPath == NULL)
|
||||
if (configPath == nullptr)
|
||||
configPath = FromSDL(SDL_GetPrefPath("diasurgical", "devilution"));
|
||||
return *configPath;
|
||||
}
|
||||
|
||||
const std::string &GetTtfPath()
|
||||
{
|
||||
if (ttfPath == NULL)
|
||||
if (ttfPath == nullptr)
|
||||
ttfPath = new std::string(TTF_FONT_DIR);
|
||||
return *ttfPath;
|
||||
}
|
||||
|
||||
const std::string &GetTtfName()
|
||||
{
|
||||
if (ttfName == NULL)
|
||||
if (ttfName == nullptr)
|
||||
ttfName = new std::string(TTF_FONT_NAME);
|
||||
return *ttfName;
|
||||
}
|
||||
|
||||
void SetBasePath(const char *path)
|
||||
{
|
||||
if (basePath == NULL)
|
||||
if (basePath == nullptr)
|
||||
basePath = new std::string;
|
||||
*basePath = path;
|
||||
AddTrailingSlash(basePath);
|
||||
|
|
@ -99,7 +99,7 @@ void SetBasePath(const char *path)
|
|||
|
||||
void SetPrefPath(const char *path)
|
||||
{
|
||||
if (prefPath == NULL)
|
||||
if (prefPath == nullptr)
|
||||
prefPath = new std::string;
|
||||
*prefPath = path;
|
||||
AddTrailingSlash(prefPath);
|
||||
|
|
@ -107,7 +107,7 @@ void SetPrefPath(const char *path)
|
|||
|
||||
void SetConfigPath(const char *path)
|
||||
{
|
||||
if (configPath == NULL)
|
||||
if (configPath == nullptr)
|
||||
configPath = new std::string;
|
||||
*configPath = path;
|
||||
AddTrailingSlash(configPath);
|
||||
|
|
@ -115,7 +115,7 @@ void SetConfigPath(const char *path)
|
|||
|
||||
void SetTtfPath(const char *path)
|
||||
{
|
||||
if (ttfPath == NULL)
|
||||
if (ttfPath == nullptr)
|
||||
ttfPath = new std::string;
|
||||
*ttfPath = path;
|
||||
AddTrailingSlash(ttfPath);
|
||||
|
|
@ -123,7 +123,7 @@ void SetTtfPath(const char *path)
|
|||
|
||||
void SetTtfName(const char *path)
|
||||
{
|
||||
if (ttfName == NULL)
|
||||
if (ttfName == nullptr)
|
||||
ttfName = new std::string;
|
||||
*ttfName = path;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue