From 92d2f5e195b9b4c21b5cc43d1575c2e9782b089d Mon Sep 17 00:00:00 2001 From: Sam Edwards Date: Sun, 3 Jun 2018 16:31:01 -0600 Subject: [PATCH] general: Don't use NULL where not appropriate --- panda/src/dxgsg9/dxTextureContext9.cxx | 2 +- panda/src/express/virtualFileMountSystem.cxx | 4 +-- panda/src/gobj/vertexDataSaveFile.cxx | 2 +- panda/src/movies/microphoneAudioDS.cxx | 4 +-- .../wgldisplay/wglGraphicsStateGuardian.cxx | 4 +-- panda/src/windisplay/winGraphicsWindow.cxx | 32 +++++++++---------- 6 files changed, 24 insertions(+), 24 deletions(-) diff --git a/panda/src/dxgsg9/dxTextureContext9.cxx b/panda/src/dxgsg9/dxTextureContext9.cxx index c089c26e8a..60f787f298 100644 --- a/panda/src/dxgsg9/dxTextureContext9.cxx +++ b/panda/src/dxgsg9/dxTextureContext9.cxx @@ -1935,7 +1935,7 @@ fill_d3d_texture_pixels(DXScreenData &scrn, bool compress_texture) { scaled *= 255; color = D3DCOLOR_RGBA((int)scaled[0], (int)scaled[1], (int)scaled[2], (int)scaled[3]); 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) { } } diff --git a/panda/src/express/virtualFileMountSystem.cxx b/panda/src/express/virtualFileMountSystem.cxx index ef9c4dcaf5..cc6041b12c 100644 --- a/panda/src/express/virtualFileMountSystem.cxx +++ b/panda/src/express/virtualFileMountSystem.cxx @@ -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. if (VirtualFileSystem::get_global_ptr()->vfs_case_sensitive) { if (!has_file(file)) { - return NULL; + return false; } } #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. if (VirtualFileSystem::get_global_ptr()->vfs_case_sensitive) { if (!has_file(file)) { - return NULL; + return false; } } #endif // WIN32 diff --git a/panda/src/gobj/vertexDataSaveFile.cxx b/panda/src/gobj/vertexDataSaveFile.cxx index e602b51129..7fab0a9110 100644 --- a/panda/src/gobj/vertexDataSaveFile.cxx +++ b/panda/src/gobj/vertexDataSaveFile.cxx @@ -306,7 +306,7 @@ read_data(unsigned char *data, size_t size, VertexDataSaveBlock *block) { << "Error reading " << size << " bytes from save file, windows error code 0x" << hex << error << dec << ".\n"; - return NULL; + return false; } success = GetOverlappedResult(_handle, &overlapped, &bytes_read, false); } diff --git a/panda/src/movies/microphoneAudioDS.cxx b/panda/src/movies/microphoneAudioDS.cxx index 95412fb961..aa32f0c544 100644 --- a/panda/src/movies/microphoneAudioDS.cxx +++ b/panda/src/movies/microphoneAudioDS.cxx @@ -146,7 +146,7 @@ find_all_microphones_ds() { format.nBlockAlign = 2 * chan; format.wBitsPerSample = 16; 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) { PT(MicrophoneAudioDS) p = new MicrophoneAudioDS(); ostringstream name; @@ -248,7 +248,7 @@ open() { format.cbSize = 0; 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) { delete_buffers(buffers); diff --git a/panda/src/wgldisplay/wglGraphicsStateGuardian.cxx b/panda/src/wgldisplay/wglGraphicsStateGuardian.cxx index aca8f44577..c957fa7e9e 100644 --- a/panda/src/wgldisplay/wglGraphicsStateGuardian.cxx +++ b/panda/src/wgldisplay/wglGraphicsStateGuardian.cxx @@ -594,7 +594,7 @@ make_context(HDC hdc) { // what kind of OpenGL context we would like. int attrib_list[32]; int n = 0; - attrib_list[0] = NULL; + attrib_list[0] = 0; if (gl_version.get_num_words() > 0) { 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_CORE_PROFILE_BIT_ARB; #endif - attrib_list[n] = NULL; + attrib_list[n] = 0; _context = _wglCreateContextAttribsARB(hdc, 0, attrib_list); } else { diff --git a/panda/src/windisplay/winGraphicsWindow.cxx b/panda/src/windisplay/winGraphicsWindow.cxx index d215d0e1aa..dac15d8c41 100644 --- a/panda/src/windisplay/winGraphicsWindow.cxx +++ b/panda/src/windisplay/winGraphicsWindow.cxx @@ -1870,7 +1870,7 @@ window_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) { lptstr = (char *) GlobalLock(hglb); if (lptstr != NULL) { char *pChar; - for (pChar=lptstr; *pChar!=NULL; pChar++) { + for (pChar=lptstr; *pChar; pChar++) { _input_devices[0].keystroke((uchar)*pChar); } GlobalUnlock(hglb); @@ -2159,12 +2159,12 @@ update_cursor_window(WinGraphicsWindow *to_window) { // We are leaving a graphics window; we should restore the Win2000 // effects. if (_got_saved_params) { - SystemParametersInfo(SPI_SETMOUSETRAILS, NULL, - (PVOID)_saved_mouse_trails, NULL); - SystemParametersInfo(SPI_SETCURSORSHADOW, NULL, - (PVOID)_saved_cursor_shadow, NULL); - SystemParametersInfo(SPI_SETMOUSEVANISH, NULL, - (PVOID)_saved_mouse_vanish, NULL); + SystemParametersInfo(SPI_SETMOUSETRAILS, 0, + (PVOID)_saved_mouse_trails, 0); + SystemParametersInfo(SPI_SETCURSORSHADOW, 0, + (PVOID)_saved_cursor_shadow, 0); + SystemParametersInfo(SPI_SETMOUSEVANISH, 0, + (PVOID)_saved_mouse_vanish, 0); _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 // cause a silent error on earlier OS's, which is OK. if (!_got_saved_params) { - SystemParametersInfo(SPI_GETMOUSETRAILS, NULL, - &_saved_mouse_trails, NULL); - SystemParametersInfo(SPI_GETCURSORSHADOW, NULL, - &_saved_cursor_shadow, NULL); - SystemParametersInfo(SPI_GETMOUSEVANISH, NULL, - &_saved_mouse_vanish, NULL); + SystemParametersInfo(SPI_GETMOUSETRAILS, 0, + &_saved_mouse_trails, 0); + SystemParametersInfo(SPI_GETCURSORSHADOW, 0, + &_saved_cursor_shadow, 0); + SystemParametersInfo(SPI_GETMOUSEVANISH, 0, + &_saved_mouse_vanish, 0); _got_saved_params = true; - SystemParametersInfo(SPI_SETMOUSETRAILS, NULL, (PVOID)0, NULL); - SystemParametersInfo(SPI_SETCURSORSHADOW, NULL, (PVOID)false, NULL); - SystemParametersInfo(SPI_SETMOUSEVANISH, NULL, (PVOID)false, NULL); + SystemParametersInfo(SPI_SETMOUSETRAILS, 0, (PVOID)0, 0); + SystemParametersInfo(SPI_SETCURSORSHADOW, 0, (PVOID)false, 0); + SystemParametersInfo(SPI_SETMOUSEVANISH, 0, (PVOID)false, 0); } SetCursor(to_window->_cursor);