general: Don't use NULL where not appropriate

This commit is contained in:
Sam Edwards 2018-06-03 16:31:01 -06:00
parent d422d74abb
commit 92d2f5e195
6 changed files with 24 additions and 24 deletions

View File

@ -1935,7 +1935,7 @@ fill_d3d_texture_pixels(DXScreenData &scrn, bool compress_texture) {
scaled *= 255; scaled *= 255;
color = D3DCOLOR_RGBA((int)scaled[0], (int)scaled[1], (int)scaled[2], (int)scaled[3]); color = D3DCOLOR_RGBA((int)scaled[0], (int)scaled[1], (int)scaled[2], (int)scaled[3]);
flags = D3DCLEAR_TARGET; flags = D3DCLEAR_TARGET;
if (device -> Clear (NULL, NULL, flags, color, 0.0f, 0) == D3D_OK) { if (device -> Clear (0, NULL, flags, color, 0.0f, 0) == D3D_OK) {
} }
} }

View File

@ -385,7 +385,7 @@ atomic_compare_and_exchange_contents(const Filename &file, string &orig_contents
// First ensure that the file exists to validate its case. // First ensure that the file exists to validate its case.
if (VirtualFileSystem::get_global_ptr()->vfs_case_sensitive) { if (VirtualFileSystem::get_global_ptr()->vfs_case_sensitive) {
if (!has_file(file)) { if (!has_file(file)) {
return NULL; return false;
} }
} }
#endif // WIN32 #endif // WIN32
@ -402,7 +402,7 @@ atomic_read_contents(const Filename &file, string &contents) const {
// First ensure that the file exists to validate its case. // First ensure that the file exists to validate its case.
if (VirtualFileSystem::get_global_ptr()->vfs_case_sensitive) { if (VirtualFileSystem::get_global_ptr()->vfs_case_sensitive) {
if (!has_file(file)) { if (!has_file(file)) {
return NULL; return false;
} }
} }
#endif // WIN32 #endif // WIN32

View File

@ -306,7 +306,7 @@ read_data(unsigned char *data, size_t size, VertexDataSaveBlock *block) {
<< "Error reading " << size << "Error reading " << size
<< " bytes from save file, windows error code 0x" << hex << " bytes from save file, windows error code 0x" << hex
<< error << dec << ".\n"; << error << dec << ".\n";
return NULL; return false;
} }
success = GetOverlappedResult(_handle, &overlapped, &bytes_read, false); success = GetOverlappedResult(_handle, &overlapped, &bytes_read, false);
} }

View File

@ -146,7 +146,7 @@ find_all_microphones_ds() {
format.nBlockAlign = 2 * chan; format.nBlockAlign = 2 * chan;
format.wBitsPerSample = 16; format.wBitsPerSample = 16;
format.cbSize = 0; format.cbSize = 0;
stat = waveInOpen(NULL, i, &format, NULL, NULL, WAVE_FORMAT_QUERY); stat = waveInOpen(NULL, i, &format, 0, 0, WAVE_FORMAT_QUERY);
if (stat == MMSYSERR_NOERROR) { if (stat == MMSYSERR_NOERROR) {
PT(MicrophoneAudioDS) p = new MicrophoneAudioDS(); PT(MicrophoneAudioDS) p = new MicrophoneAudioDS();
ostringstream name; ostringstream name;
@ -248,7 +248,7 @@ open() {
format.cbSize = 0; format.cbSize = 0;
HWAVEIN hwav; HWAVEIN hwav;
MMRESULT stat = waveInOpen(&hwav, _device_id, &format, NULL, NULL, CALLBACK_NULL); MMRESULT stat = waveInOpen(&hwav, _device_id, &format, 0, 0, CALLBACK_NULL);
if (stat != MMSYSERR_NOERROR) { if (stat != MMSYSERR_NOERROR) {
delete_buffers(buffers); delete_buffers(buffers);

View File

@ -594,7 +594,7 @@ make_context(HDC hdc) {
// what kind of OpenGL context we would like. // what kind of OpenGL context we would like.
int attrib_list[32]; int attrib_list[32];
int n = 0; int n = 0;
attrib_list[0] = NULL; attrib_list[0] = 0;
if (gl_version.get_num_words() > 0) { if (gl_version.get_num_words() > 0) {
attrib_list[n++] = WGL_CONTEXT_MAJOR_VERSION_ARB; attrib_list[n++] = WGL_CONTEXT_MAJOR_VERSION_ARB;
@ -612,7 +612,7 @@ make_context(HDC hdc) {
attrib_list[n++] = WGL_CONTEXT_PROFILE_MASK_ARB; attrib_list[n++] = WGL_CONTEXT_PROFILE_MASK_ARB;
attrib_list[n++] = WGL_CONTEXT_CORE_PROFILE_BIT_ARB; attrib_list[n++] = WGL_CONTEXT_CORE_PROFILE_BIT_ARB;
#endif #endif
attrib_list[n] = NULL; attrib_list[n] = 0;
_context = _wglCreateContextAttribsARB(hdc, 0, attrib_list); _context = _wglCreateContextAttribsARB(hdc, 0, attrib_list);
} else { } else {

View File

@ -1870,7 +1870,7 @@ window_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) {
lptstr = (char *) GlobalLock(hglb); lptstr = (char *) GlobalLock(hglb);
if (lptstr != NULL) { if (lptstr != NULL) {
char *pChar; char *pChar;
for (pChar=lptstr; *pChar!=NULL; pChar++) { for (pChar=lptstr; *pChar; pChar++) {
_input_devices[0].keystroke((uchar)*pChar); _input_devices[0].keystroke((uchar)*pChar);
} }
GlobalUnlock(hglb); GlobalUnlock(hglb);
@ -2159,12 +2159,12 @@ update_cursor_window(WinGraphicsWindow *to_window) {
// We are leaving a graphics window; we should restore the Win2000 // We are leaving a graphics window; we should restore the Win2000
// effects. // effects.
if (_got_saved_params) { if (_got_saved_params) {
SystemParametersInfo(SPI_SETMOUSETRAILS, NULL, SystemParametersInfo(SPI_SETMOUSETRAILS, 0,
(PVOID)_saved_mouse_trails, NULL); (PVOID)_saved_mouse_trails, 0);
SystemParametersInfo(SPI_SETCURSORSHADOW, NULL, SystemParametersInfo(SPI_SETCURSORSHADOW, 0,
(PVOID)_saved_cursor_shadow, NULL); (PVOID)_saved_cursor_shadow, 0);
SystemParametersInfo(SPI_SETMOUSEVANISH, NULL, SystemParametersInfo(SPI_SETMOUSEVANISH, 0,
(PVOID)_saved_mouse_vanish, NULL); (PVOID)_saved_mouse_vanish, 0);
_got_saved_params = false; _got_saved_params = false;
} }
@ -2178,17 +2178,17 @@ update_cursor_window(WinGraphicsWindow *to_window) {
// These parameters are only defined for Win2000XP, but they should just // These parameters are only defined for Win2000XP, but they should just
// cause a silent error on earlier OS's, which is OK. // cause a silent error on earlier OS's, which is OK.
if (!_got_saved_params) { if (!_got_saved_params) {
SystemParametersInfo(SPI_GETMOUSETRAILS, NULL, SystemParametersInfo(SPI_GETMOUSETRAILS, 0,
&_saved_mouse_trails, NULL); &_saved_mouse_trails, 0);
SystemParametersInfo(SPI_GETCURSORSHADOW, NULL, SystemParametersInfo(SPI_GETCURSORSHADOW, 0,
&_saved_cursor_shadow, NULL); &_saved_cursor_shadow, 0);
SystemParametersInfo(SPI_GETMOUSEVANISH, NULL, SystemParametersInfo(SPI_GETMOUSEVANISH, 0,
&_saved_mouse_vanish, NULL); &_saved_mouse_vanish, 0);
_got_saved_params = true; _got_saved_params = true;
SystemParametersInfo(SPI_SETMOUSETRAILS, NULL, (PVOID)0, NULL); SystemParametersInfo(SPI_SETMOUSETRAILS, 0, (PVOID)0, 0);
SystemParametersInfo(SPI_SETCURSORSHADOW, NULL, (PVOID)false, NULL); SystemParametersInfo(SPI_SETCURSORSHADOW, 0, (PVOID)false, 0);
SystemParametersInfo(SPI_SETMOUSEVANISH, NULL, (PVOID)false, NULL); SystemParametersInfo(SPI_SETMOUSEVANISH, 0, (PVOID)false, 0);
} }
SetCursor(to_window->_cursor); SetCursor(to_window->_cursor);