Cleanup: use nullptr instead of 0 or NULL

pull/332/head
Rubidium 3 years ago committed by rubidium42
parent a9774f3e34
commit f904aef176

@ -309,7 +309,7 @@ struct MainWindow : Window
case GHK_REFRESH_SCREEN: MarkWholeScreenDirty(); break; case GHK_REFRESH_SCREEN: MarkWholeScreenDirty(); break;
case GHK_CRASH: // Crash the game case GHK_CRASH: // Crash the game
*(volatile byte *)0 = 0; *(volatile byte *)nullptr = 0;
break; break;
case GHK_MONEY: // Gimme money case GHK_MONEY: // Gimme money

@ -268,7 +268,7 @@ bool TCPConnecter::CheckActivity()
timeval tv; timeval tv;
tv.tv_usec = 0; tv.tv_usec = 0;
tv.tv_sec = 0; tv.tv_sec = 0;
int n = select(FD_SETSIZE, NULL, &write_fd, NULL, &tv); int n = select(FD_SETSIZE, nullptr, &write_fd, nullptr, &tv);
/* select() failed; hopefully next try it doesn't. */ /* select() failed; hopefully next try it doesn't. */
if (n < 0) { if (n < 0) {
/* select() normally never fails; so hopefully it works next try! */ /* select() normally never fails; so hopefully it works next try! */

@ -179,7 +179,7 @@ void NetworkSyncCommandQueue(NetworkClientSocket *cs)
{ {
for (CommandPacket *p = _local_execution_queue.Peek(); p != nullptr; p = p->next) { for (CommandPacket *p = _local_execution_queue.Peek(); p != nullptr; p = p->next) {
CommandPacket c = *p; CommandPacket c = *p;
c.callback = 0; c.callback = nullptr;
cs->outgoing_queue.Append(&c); cs->outgoing_queue.Append(&c);
} }
} }

@ -309,7 +309,7 @@ bool Convert8bitBooleanCallback(const struct GRFFile *grffile, uint16 cbid, uint
*/ */
template <size_t Tcnt> template <size_t Tcnt>
struct GRFFilePropsBase { struct GRFFilePropsBase {
GRFFilePropsBase() : local_id(0), grffile(0) GRFFilePropsBase() : local_id(0), grffile(nullptr)
{ {
/* The lack of some compilers to provide default constructors complying to the specs /* The lack of some compilers to provide default constructors complying to the specs
* requires us to zero the stuff ourself. */ * requires us to zero the stuff ourself. */

@ -51,10 +51,10 @@ FT_Error GetFontByFaceName(const char *font_name, FT_Face *face)
/* Resolve the name and populate the information structure */ /* Resolve the name and populate the information structure */
pat = FcNameParse((FcChar8 *)font_family); pat = FcNameParse((FcChar8 *)font_family);
if (font_style != nullptr) FcPatternAddString(pat, FC_STYLE, (FcChar8 *)font_style); if (font_style != nullptr) FcPatternAddString(pat, FC_STYLE, (FcChar8 *)font_style);
FcConfigSubstitute(0, pat, FcMatchPattern); FcConfigSubstitute(nullptr, pat, FcMatchPattern);
FcDefaultSubstitute(pat); FcDefaultSubstitute(pat);
fs = FcFontSetCreate(); fs = FcFontSetCreate();
match = FcFontMatch(0, pat, &result); match = FcFontMatch(nullptr, pat, &result);
if (fs != nullptr && match != nullptr) { if (fs != nullptr && match != nullptr) {
int i; int i;

@ -277,7 +277,7 @@ bool GetClipboardContents(char *buffer, const char *last)
} }
char *clip = SDL_GetClipboardText(); char *clip = SDL_GetClipboardText();
if (clip != NULL) { if (clip != nullptr) {
strecpy(buffer, clip, last); strecpy(buffer, clip, last);
SDL_free(clip); SDL_free(clip);
return true; return true;

@ -1309,7 +1309,7 @@ void OpenGLBackend::RenderOglSprite(OpenGLSprite *gl_sprite, PaletteID pal, int
_glPixelStorei(GL_UNPACK_ROW_LENGTH, 0); _glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
_glBufferSubData(GL_PIXEL_UNPACK_BUFFER, 0, 256, GetNonSprite(GB(pal, 0, PALETTE_WIDTH), ST_RECOLOUR) + 1); _glBufferSubData(GL_PIXEL_UNPACK_BUFFER, 0, 256, GetNonSprite(GB(pal, 0, PALETTE_WIDTH), ST_RECOLOUR) + 1);
_glTexSubImage1D(GL_TEXTURE_1D, 0, 0, 256, GL_RED, GL_UNSIGNED_BYTE, 0); _glTexSubImage1D(GL_TEXTURE_1D, 0, 0, 256, GL_RED, GL_UNSIGNED_BYTE, nullptr);
_glBindBuffer(GL_PIXEL_UNPACK_BUFFER, 0); _glBindBuffer(GL_PIXEL_UNPACK_BUFFER, 0);

@ -593,7 +593,7 @@ void VideoDriver_SDL_Base::Stop()
void VideoDriver_SDL_Base::InputLoop() void VideoDriver_SDL_Base::InputLoop()
{ {
uint32 mod = SDL_GetModState(); uint32 mod = SDL_GetModState();
const Uint8 *keys = SDL_GetKeyboardState(NULL); const Uint8 *keys = SDL_GetKeyboardState(nullptr);
bool old_ctrl_pressed = _ctrl_pressed; bool old_ctrl_pressed = _ctrl_pressed;

Loading…
Cancel
Save