Merge: Codechange: Use null pointer literal instead of the NULL macro
This commit is contained in:
@@ -123,7 +123,7 @@ static bool MakeBMPImage(const char *name, ScreenshotCallback *callb, void *user
|
||||
}
|
||||
|
||||
FILE *f = fopen(name, "wb");
|
||||
if (f == NULL) return false;
|
||||
if (f == nullptr) return false;
|
||||
|
||||
/* Each scanline must be aligned on a 32bit boundary */
|
||||
uint bytewidth = Align(w * bpp, 4); // bytes per line in file
|
||||
@@ -271,18 +271,18 @@ static bool MakePNGImage(const char *name, ScreenshotCallback *callb, void *user
|
||||
if (pixelformat != 8 && pixelformat != 32) return false;
|
||||
|
||||
f = fopen(name, "wb");
|
||||
if (f == NULL) return false;
|
||||
if (f == nullptr) return false;
|
||||
|
||||
png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, const_cast<char *>(name), png_my_error, png_my_warning);
|
||||
|
||||
if (png_ptr == NULL) {
|
||||
if (png_ptr == nullptr) {
|
||||
fclose(f);
|
||||
return false;
|
||||
}
|
||||
|
||||
info_ptr = png_create_info_struct(png_ptr);
|
||||
if (info_ptr == NULL) {
|
||||
png_destroy_write_struct(&png_ptr, (png_infopp)NULL);
|
||||
if (info_ptr == nullptr) {
|
||||
png_destroy_write_struct(&png_ptr, (png_infopp)nullptr);
|
||||
fclose(f);
|
||||
return false;
|
||||
}
|
||||
@@ -314,7 +314,7 @@ static bool MakePNGImage(const char *name, ScreenshotCallback *callb, void *user
|
||||
char *p = buf;
|
||||
p += seprintf(p, lastof(buf), "Graphics set: %s (%u)\n", BaseGraphics::GetUsedSet()->name, BaseGraphics::GetUsedSet()->version);
|
||||
p = strecpy(p, "NewGRFs:\n", lastof(buf));
|
||||
for (const GRFConfig *c = _game_mode == GM_MENU ? NULL : _grfconfig; c != NULL; c = c->next) {
|
||||
for (const GRFConfig *c = _game_mode == GM_MENU ? nullptr : _grfconfig; c != nullptr; c = c->next) {
|
||||
p += seprintf(p, lastof(buf), "%08X ", BSWAP32(c->ident.grfid));
|
||||
p = md5sumToString(p, lastof(buf), c->ident.md5sum);
|
||||
p += seprintf(p, lastof(buf), " %s\n", c->filename);
|
||||
@@ -322,7 +322,7 @@ static bool MakePNGImage(const char *name, ScreenshotCallback *callb, void *user
|
||||
p = strecpy(p, "\nCompanies:\n", lastof(buf));
|
||||
const Company *c;
|
||||
FOR_ALL_COMPANIES(c) {
|
||||
if (c->ai_info == NULL) {
|
||||
if (c->ai_info == nullptr) {
|
||||
p += seprintf(p, lastof(buf), "%2i: Human\n", (int)c->index);
|
||||
} else {
|
||||
p += seprintf(p, lastof(buf), "%2i: %s (v%d)\n", (int)c->index, c->ai_info->GetName(), c->ai_info->GetVersion());
|
||||
@@ -450,7 +450,7 @@ static bool MakePCXImage(const char *name, ScreenshotCallback *callb, void *user
|
||||
if (pixelformat != 8 || w == 0) return false;
|
||||
|
||||
f = fopen(name, "wb");
|
||||
if (f == NULL) return false;
|
||||
if (f == nullptr) return false;
|
||||
|
||||
memset(&pcx, 0, sizeof(pcx));
|
||||
|
||||
@@ -704,7 +704,7 @@ static const char *MakeScreenshotName(const char *default_fn, const char *ext, b
|
||||
static bool MakeSmallScreenshot(bool crashlog)
|
||||
{
|
||||
const ScreenshotFormat *sf = _screenshot_formats + _cur_screenshot_format;
|
||||
return sf->proc(MakeScreenshotName(SCREENSHOT_NAME, sf->extension, crashlog), CurrentScreenCallback, NULL, _screen.width, _screen.height,
|
||||
return sf->proc(MakeScreenshotName(SCREENSHOT_NAME, sf->extension, crashlog), CurrentScreenCallback, nullptr, _screen.width, _screen.height,
|
||||
BlitterFactory::GetCurrentBlitter()->GetScreenDepth(), _cur_palette.palette);
|
||||
}
|
||||
|
||||
@@ -746,7 +746,7 @@ void SetupScreenshotViewport(ScreenshotType t, ViewPort *vp)
|
||||
vp->top = 0;
|
||||
vp->width = UnScaleByZoom(vp->virtual_width, vp->zoom);
|
||||
vp->height = UnScaleByZoom(vp->virtual_height, vp->zoom);
|
||||
vp->overlay = NULL;
|
||||
vp->overlay = nullptr;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -803,7 +803,7 @@ bool MakeHeightmapScreenshot(const char *filename)
|
||||
palette[i].b = i;
|
||||
}
|
||||
const ScreenshotFormat *sf = _screenshot_formats + _cur_screenshot_format;
|
||||
return sf->proc(filename, HeightmapCallback, NULL, MapSizeX(), MapSizeY(), 8, palette);
|
||||
return sf->proc(filename, HeightmapCallback, nullptr, MapSizeX(), MapSizeY(), 8, palette);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -838,7 +838,7 @@ bool MakeScreenshot(ScreenshotType t, const char *name)
|
||||
}
|
||||
|
||||
_screenshot_name[0] = '\0';
|
||||
if (name != NULL) strecpy(_screenshot_name, name, lastof(_screenshot_name));
|
||||
if (name != nullptr) strecpy(_screenshot_name, name, lastof(_screenshot_name));
|
||||
|
||||
bool ret;
|
||||
switch (t) {
|
||||
@@ -975,8 +975,8 @@ void SaveMinimap(const char *name)
|
||||
}
|
||||
|
||||
_screenshot_name[0] = '\0';
|
||||
if (name != NULL) strecpy(_screenshot_name, name, lastof(_screenshot_name));
|
||||
if (name != nullptr) strecpy(_screenshot_name, name, lastof(_screenshot_name));
|
||||
|
||||
const ScreenshotFormat *sf = _screenshot_formats + _cur_screenshot_format;
|
||||
sf->proc(MakeScreenshotName("minimap", sf->extension), MinimapOwnerCallback, NULL, MapSizeX(), MapSizeY(), 32, _cur_palette.palette);
|
||||
sf->proc(MakeScreenshotName("minimap", sf->extension), MinimapOwnerCallback, nullptr, MapSizeX(), MapSizeY(), 32, _cur_palette.palette);
|
||||
}
|
||||
|
Reference in New Issue
Block a user