summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRubidium <rubidium@openttd.org>2021-06-16 21:12:08 +0200
committerrubidium42 <rubidium42@users.noreply.github.com>2021-06-17 16:18:30 +0200
commitf904aef176b7bde38f27cc9b4f23c55dc13d2ce5 (patch)
tree2ea8cfd92faf9786275824cf1a5c5be927283601 /src
parenta9774f3e341812d43427b9e0166b0def08202477 (diff)
downloadopenttd-f904aef176b7bde38f27cc9b4f23c55dc13d2ce5.tar.xz
Cleanup: use nullptr instead of 0 or NULL
Diffstat (limited to 'src')
-rw-r--r--src/main_gui.cpp2
-rw-r--r--src/network/core/tcp_connect.cpp2
-rw-r--r--src/network/network_command.cpp2
-rw-r--r--src/newgrf_commons.h2
-rw-r--r--src/os/unix/font_unix.cpp4
-rw-r--r--src/os/unix/unix.cpp2
-rw-r--r--src/video/opengl.cpp2
-rw-r--r--src/video/sdl2_v.cpp2
8 files changed, 9 insertions, 9 deletions
diff --git a/src/main_gui.cpp b/src/main_gui.cpp
index 559040f37..79960d51b 100644
--- a/src/main_gui.cpp
+++ b/src/main_gui.cpp
@@ -309,7 +309,7 @@ struct MainWindow : Window
case GHK_REFRESH_SCREEN: MarkWholeScreenDirty(); break;
case GHK_CRASH: // Crash the game
- *(volatile byte *)0 = 0;
+ *(volatile byte *)nullptr = 0;
break;
case GHK_MONEY: // Gimme money
diff --git a/src/network/core/tcp_connect.cpp b/src/network/core/tcp_connect.cpp
index f251f0288..c4f5415b0 100644
--- a/src/network/core/tcp_connect.cpp
+++ b/src/network/core/tcp_connect.cpp
@@ -268,7 +268,7 @@ bool TCPConnecter::CheckActivity()
timeval tv;
tv.tv_usec = 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. */
if (n < 0) {
/* select() normally never fails; so hopefully it works next try! */
diff --git a/src/network/network_command.cpp b/src/network/network_command.cpp
index 1a9849a34..6d03aaaa1 100644
--- a/src/network/network_command.cpp
+++ b/src/network/network_command.cpp
@@ -179,7 +179,7 @@ void NetworkSyncCommandQueue(NetworkClientSocket *cs)
{
for (CommandPacket *p = _local_execution_queue.Peek(); p != nullptr; p = p->next) {
CommandPacket c = *p;
- c.callback = 0;
+ c.callback = nullptr;
cs->outgoing_queue.Append(&c);
}
}
diff --git a/src/newgrf_commons.h b/src/newgrf_commons.h
index ed18aaa9e..ff241369a 100644
--- a/src/newgrf_commons.h
+++ b/src/newgrf_commons.h
@@ -309,7 +309,7 @@ bool Convert8bitBooleanCallback(const struct GRFFile *grffile, uint16 cbid, uint
*/
template <size_t Tcnt>
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
* requires us to zero the stuff ourself. */
diff --git a/src/os/unix/font_unix.cpp b/src/os/unix/font_unix.cpp
index f8cf96a48..246d65e63 100644
--- a/src/os/unix/font_unix.cpp
+++ b/src/os/unix/font_unix.cpp
@@ -51,10 +51,10 @@ FT_Error GetFontByFaceName(const char *font_name, FT_Face *face)
/* Resolve the name and populate the information structure */
pat = FcNameParse((FcChar8 *)font_family);
if (font_style != nullptr) FcPatternAddString(pat, FC_STYLE, (FcChar8 *)font_style);
- FcConfigSubstitute(0, pat, FcMatchPattern);
+ FcConfigSubstitute(nullptr, pat, FcMatchPattern);
FcDefaultSubstitute(pat);
fs = FcFontSetCreate();
- match = FcFontMatch(0, pat, &result);
+ match = FcFontMatch(nullptr, pat, &result);
if (fs != nullptr && match != nullptr) {
int i;
diff --git a/src/os/unix/unix.cpp b/src/os/unix/unix.cpp
index f696f817f..95d6fa1fa 100644
--- a/src/os/unix/unix.cpp
+++ b/src/os/unix/unix.cpp
@@ -277,7 +277,7 @@ bool GetClipboardContents(char *buffer, const char *last)
}
char *clip = SDL_GetClipboardText();
- if (clip != NULL) {
+ if (clip != nullptr) {
strecpy(buffer, clip, last);
SDL_free(clip);
return true;
diff --git a/src/video/opengl.cpp b/src/video/opengl.cpp
index 576bdd78b..2014d1cf9 100644
--- a/src/video/opengl.cpp
+++ b/src/video/opengl.cpp
@@ -1309,7 +1309,7 @@ void OpenGLBackend::RenderOglSprite(OpenGLSprite *gl_sprite, PaletteID pal, int
_glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
_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);
diff --git a/src/video/sdl2_v.cpp b/src/video/sdl2_v.cpp
index 66bea5d8c..98c04fd85 100644
--- a/src/video/sdl2_v.cpp
+++ b/src/video/sdl2_v.cpp
@@ -593,7 +593,7 @@ void VideoDriver_SDL_Base::Stop()
void VideoDriver_SDL_Base::InputLoop()
{
uint32 mod = SDL_GetModState();
- const Uint8 *keys = SDL_GetKeyboardState(NULL);
+ const Uint8 *keys = SDL_GetKeyboardState(nullptr);
bool old_ctrl_pressed = _ctrl_pressed;