Codechange: Use null pointer literal instead of the NULL macro
This commit is contained in:

committed by
Michael Lutz

parent
3b4f224c0b
commit
7c8e7c6b6e
@@ -70,9 +70,9 @@
|
||||
|
||||
#include "safeguards.h"
|
||||
|
||||
/* static */ const char *CrashLog::message = NULL;
|
||||
/* static */ char *CrashLog::gamelog_buffer = NULL;
|
||||
/* static */ const char *CrashLog::gamelog_last = NULL;
|
||||
/* static */ const char *CrashLog::message = nullptr;
|
||||
/* static */ char *CrashLog::gamelog_buffer = nullptr;
|
||||
/* static */ const char *CrashLog::gamelog_last = nullptr;
|
||||
|
||||
char *CrashLog::LogCompiler(char *buffer, const char *last) const
|
||||
{
|
||||
@@ -168,18 +168,18 @@ char *CrashLog::LogConfiguration(char *buffer, const char *last) const
|
||||
" Sound driver: %s\n"
|
||||
" Sound set: %s (%u)\n"
|
||||
" Video driver: %s\n\n",
|
||||
BlitterFactory::GetCurrentBlitter() == NULL ? "none" : BlitterFactory::GetCurrentBlitter()->GetName(),
|
||||
BaseGraphics::GetUsedSet() == NULL ? "none" : BaseGraphics::GetUsedSet()->name,
|
||||
BaseGraphics::GetUsedSet() == NULL ? UINT32_MAX : BaseGraphics::GetUsedSet()->version,
|
||||
_current_language == NULL ? "none" : _current_language->file,
|
||||
MusicDriver::GetInstance() == NULL ? "none" : MusicDriver::GetInstance()->GetName(),
|
||||
BaseMusic::GetUsedSet() == NULL ? "none" : BaseMusic::GetUsedSet()->name,
|
||||
BaseMusic::GetUsedSet() == NULL ? UINT32_MAX : BaseMusic::GetUsedSet()->version,
|
||||
BlitterFactory::GetCurrentBlitter() == nullptr ? "none" : BlitterFactory::GetCurrentBlitter()->GetName(),
|
||||
BaseGraphics::GetUsedSet() == nullptr ? "none" : BaseGraphics::GetUsedSet()->name,
|
||||
BaseGraphics::GetUsedSet() == nullptr ? UINT32_MAX : BaseGraphics::GetUsedSet()->version,
|
||||
_current_language == nullptr ? "none" : _current_language->file,
|
||||
MusicDriver::GetInstance() == nullptr ? "none" : MusicDriver::GetInstance()->GetName(),
|
||||
BaseMusic::GetUsedSet() == nullptr ? "none" : BaseMusic::GetUsedSet()->name,
|
||||
BaseMusic::GetUsedSet() == nullptr ? UINT32_MAX : BaseMusic::GetUsedSet()->version,
|
||||
_networking ? (_network_server ? "server" : "client") : "no",
|
||||
SoundDriver::GetInstance() == NULL ? "none" : SoundDriver::GetInstance()->GetName(),
|
||||
BaseSounds::GetUsedSet() == NULL ? "none" : BaseSounds::GetUsedSet()->name,
|
||||
BaseSounds::GetUsedSet() == NULL ? UINT32_MAX : BaseSounds::GetUsedSet()->version,
|
||||
VideoDriver::GetInstance() == NULL ? "none" : VideoDriver::GetInstance()->GetName()
|
||||
SoundDriver::GetInstance() == nullptr ? "none" : SoundDriver::GetInstance()->GetName(),
|
||||
BaseSounds::GetUsedSet() == nullptr ? "none" : BaseSounds::GetUsedSet()->name,
|
||||
BaseSounds::GetUsedSet() == nullptr ? UINT32_MAX : BaseSounds::GetUsedSet()->version,
|
||||
VideoDriver::GetInstance() == nullptr ? "none" : VideoDriver::GetInstance()->GetName()
|
||||
);
|
||||
|
||||
buffer += seprintf(buffer, last,
|
||||
@@ -197,14 +197,14 @@ char *CrashLog::LogConfiguration(char *buffer, const char *last) const
|
||||
buffer += seprintf(buffer, last, "AI Configuration (local: %i) (current: %i):\n", (int)_local_company, (int)_current_company);
|
||||
const Company *c;
|
||||
FOR_ALL_COMPANIES(c) {
|
||||
if (c->ai_info == NULL) {
|
||||
if (c->ai_info == nullptr) {
|
||||
buffer += seprintf(buffer, last, " %2i: Human\n", (int)c->index);
|
||||
} else {
|
||||
buffer += seprintf(buffer, last, " %2i: %s (v%d)\n", (int)c->index, c->ai_info->GetName(), c->ai_info->GetVersion());
|
||||
}
|
||||
}
|
||||
|
||||
if (Game::GetInfo() != NULL) {
|
||||
if (Game::GetInfo() != nullptr) {
|
||||
buffer += seprintf(buffer, last, " GS: %s (v%d)\n", Game::GetInfo()->GetName(), Game::GetInfo()->GetVersion());
|
||||
}
|
||||
buffer += seprintf(buffer, last, "\n");
|
||||
@@ -263,7 +263,7 @@ char *CrashLog::LogLibraries(char *buffer, const char *last) const
|
||||
#endif
|
||||
|
||||
#ifdef WITH_PNG
|
||||
buffer += seprintf(buffer, last, " PNG: %s\n", png_get_libpng_ver(NULL));
|
||||
buffer += seprintf(buffer, last, " PNG: %s\n", png_get_libpng_ver(nullptr));
|
||||
#endif /* WITH_PNG */
|
||||
|
||||
#ifdef WITH_SDL
|
||||
@@ -312,7 +312,7 @@ char *CrashLog::LogRecentNews(char *buffer, const char *last) const
|
||||
{
|
||||
buffer += seprintf(buffer, last, "Recent news messages:\n");
|
||||
|
||||
for (NewsItem *news = _oldest_news; news != NULL; news = news->next) {
|
||||
for (NewsItem *news = _oldest_news; news != nullptr; news = news->next) {
|
||||
YearMonthDay ymd;
|
||||
ConvertDateToYMD(news->date, &ymd);
|
||||
buffer += seprintf(buffer, last, "(%i-%02i-%02i) StringID: %u, Type: %u, Ref1: %u, %u, Ref2: %u, %u\n",
|
||||
@@ -331,7 +331,7 @@ char *CrashLog::LogRecentNews(char *buffer, const char *last) const
|
||||
*/
|
||||
char *CrashLog::FillCrashLog(char *buffer, const char *last) const
|
||||
{
|
||||
time_t cur_time = time(NULL);
|
||||
time_t cur_time = time(nullptr);
|
||||
buffer += seprintf(buffer, last, "*** OpenTTD Crash Report ***\n\n");
|
||||
buffer += seprintf(buffer, last, "Crash at: %s", asctime(gmtime(&cur_time)));
|
||||
|
||||
@@ -369,7 +369,7 @@ bool CrashLog::WriteCrashLog(const char *buffer, char *filename, const char *fil
|
||||
seprintf(filename, filename_last, "%scrash.log", _personal_dir);
|
||||
|
||||
FILE *file = FioFOpenFile(filename, "w", NO_DIRECTORY);
|
||||
if (file == NULL) return false;
|
||||
if (file == nullptr) return false;
|
||||
|
||||
size_t len = strlen(buffer);
|
||||
size_t written = fwrite(buffer, 1, len, file);
|
||||
@@ -396,7 +396,7 @@ bool CrashLog::WriteSavegame(char *filename, const char *filename_last) const
|
||||
{
|
||||
/* If the map array doesn't exist, saving will fail too. If the map got
|
||||
* initialised, there is a big chance the rest is initialised too. */
|
||||
if (_m == NULL) return false;
|
||||
if (_m == nullptr) return false;
|
||||
|
||||
try {
|
||||
GamelogEmergency();
|
||||
@@ -421,7 +421,7 @@ bool CrashLog::WriteSavegame(char *filename, const char *filename_last) const
|
||||
bool CrashLog::WriteScreenshot(char *filename, const char *filename_last) const
|
||||
{
|
||||
/* Don't draw when we have invalid screen size */
|
||||
if (_screen.width < 1 || _screen.height < 1 || _screen.dst_ptr == NULL) return false;
|
||||
if (_screen.width < 1 || _screen.height < 1 || _screen.dst_ptr == nullptr) return false;
|
||||
|
||||
bool res = MakeScreenshot(SC_CRASHLOG, "crash");
|
||||
if (res) strecpy(filename, _full_screenshot_name, filename_last);
|
||||
@@ -504,7 +504,7 @@ bool CrashLog::MakeCrashLog() const
|
||||
*/
|
||||
/* static */ void CrashLog::AfterCrashLogCleanup()
|
||||
{
|
||||
if (MusicDriver::GetInstance() != NULL) MusicDriver::GetInstance()->Stop();
|
||||
if (SoundDriver::GetInstance() != NULL) SoundDriver::GetInstance()->Stop();
|
||||
if (VideoDriver::GetInstance() != NULL) VideoDriver::GetInstance()->Stop();
|
||||
if (MusicDriver::GetInstance() != nullptr) MusicDriver::GetInstance()->Stop();
|
||||
if (SoundDriver::GetInstance() != nullptr) SoundDriver::GetInstance()->Stop();
|
||||
if (VideoDriver::GetInstance() != nullptr) VideoDriver::GetInstance()->Stop();
|
||||
}
|
||||
|
Reference in New Issue
Block a user