From 3b3e2374c9e5f73de76b353f3607c52b864d1e69 Mon Sep 17 00:00:00 2001 From: Thaddeus Crews Date: Tue, 12 Mar 2024 09:40:40 -0500 Subject: [PATCH] clang-tidy: Enforce `modernize-use-nullptr` --- .../d3d12/rendering_context_driver_d3d12.h | 2 +- .../d3d12/rendering_device_driver_d3d12.cpp | 2 +- drivers/d3d12/rendering_device_driver_d3d12.h | 2 +- drivers/gles3/rasterizer_canvas_gles3.cpp | 10 +-- drivers/gles3/rasterizer_gles3.cpp | 2 +- drivers/gles3/rasterizer_scene_gles3.cpp | 8 +- drivers/gles3/shader_gles3.cpp | 4 +- drivers/gles3/storage/texture_storage.cpp | 6 +- .../plugins/version_control_editor_plugin.cpp | 2 +- modules/ktx/texture_loader_ktx.cpp | 2 +- modules/mono/editor/hostfxr_resolver.cpp | 2 +- modules/openxr/openxr_api.h | 2 +- modules/text_server_adv/text_server_adv.cpp | 6 +- platform/ios/os_ios.mm | 2 +- .../linuxbsd/wayland/detect_prime_egl.cpp | 2 +- platform/linuxbsd/wayland/wayland_thread.cpp | 8 +- platform/macos/display_server_macos.mm | 2 +- platform/macos/os_macos.mm | 2 +- platform/windows/crash_handler_windows.cpp | 2 +- platform/windows/display_server_windows.cpp | 76 +++++++++---------- .../windows/gl_manager_windows_native.cpp | 20 ++--- platform/windows/os_windows.cpp | 28 +++---- platform/windows/tts_windows.cpp | 4 +- platform/windows/wgl_detect_version.cpp | 2 +- 24 files changed, 98 insertions(+), 100 deletions(-) diff --git a/drivers/d3d12/rendering_context_driver_d3d12.h b/drivers/d3d12/rendering_context_driver_d3d12.h index f74105ed3d8..2e286b69275 100644 --- a/drivers/d3d12/rendering_context_driver_d3d12.h +++ b/drivers/d3d12/rendering_context_driver_d3d12.h @@ -100,7 +100,7 @@ public: // D3D12-only methods. struct Surface { - HWND hwnd = NULL; + HWND hwnd = nullptr; uint32_t width = 0; uint32_t height = 0; DisplayServer::VSyncMode vsync_mode = DisplayServer::VSYNC_ENABLED; diff --git a/drivers/d3d12/rendering_device_driver_d3d12.cpp b/drivers/d3d12/rendering_device_driver_d3d12.cpp index 49ab4f179f7..fc7aa62aae2 100644 --- a/drivers/d3d12/rendering_device_driver_d3d12.cpp +++ b/drivers/d3d12/rendering_device_driver_d3d12.cpp @@ -5999,7 +5999,7 @@ RenderingDeviceDriverD3D12::~RenderingDeviceDriverD3D12() { } bool RenderingDeviceDriverD3D12::is_in_developer_mode() { - HKEY hkey = NULL; + HKEY hkey = nullptr; LSTATUS result = RegOpenKeyExW(HKEY_LOCAL_MACHINE, L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\AppModelUnlock", 0, KEY_READ, &hkey); if (result != ERROR_SUCCESS) { return false; diff --git a/drivers/d3d12/rendering_device_driver_d3d12.h b/drivers/d3d12/rendering_device_driver_d3d12.h index 852cb9db0e6..61da9a51695 100644 --- a/drivers/d3d12/rendering_device_driver_d3d12.h +++ b/drivers/d3d12/rendering_device_driver_d3d12.h @@ -379,7 +379,7 @@ private: struct FenceInfo { ComPtr d3d_fence = nullptr; - HANDLE event_handle = NULL; + HANDLE event_handle = nullptr; UINT64 fence_value = 0; }; diff --git a/drivers/gles3/rasterizer_canvas_gles3.cpp b/drivers/gles3/rasterizer_canvas_gles3.cpp index de990a42223..304dc9e328c 100644 --- a/drivers/gles3/rasterizer_canvas_gles3.cpp +++ b/drivers/gles3/rasterizer_canvas_gles3.cpp @@ -1287,7 +1287,7 @@ void RasterizerCanvasGLES3::_render_batch(Light *p_lights, uint32_t p_index, Ren uint32_t range_start = state.canvas_instance_batches[p_index].start * sizeof(InstanceData); _enable_attributes(range_start, false); - glDrawElementsInstanced(GL_TRIANGLES, 6, GL_UNSIGNED_INT, 0, state.canvas_instance_batches[p_index].instance_count); + glDrawElementsInstanced(GL_TRIANGLES, 6, GL_UNSIGNED_INT, nullptr, state.canvas_instance_batches[p_index].instance_count); glBindVertexArray(0); if (r_render_info) { @@ -1490,7 +1490,7 @@ void RasterizerCanvasGLES3::_render_batch(Light *p_lights, uint32_t p_index, Ren uint32_t vertex_count = mesh_storage->mesh_surface_get_vertices_drawn_count(surface); if (use_index_buffer) { - glDrawElementsInstanced(primitive_gl, vertex_count, mesh_storage->mesh_surface_get_index_type(surface), 0, instance_count); + glDrawElementsInstanced(primitive_gl, vertex_count, mesh_storage->mesh_surface_get_index_type(surface), nullptr, instance_count); } else { glDrawArraysInstanced(primitive_gl, 0, vertex_count, instance_count); } @@ -1701,7 +1701,7 @@ void RasterizerCanvasGLES3::light_update_shadow(RID p_rid, int p_shadow_index, c } glBindVertexArray(co->vertex_array); - glDrawElements(GL_TRIANGLES, 3 * co->line_point_count, GL_UNSIGNED_SHORT, 0); + glDrawElements(GL_TRIANGLES, 3 * co->line_point_count, GL_UNSIGNED_SHORT, nullptr); instance = instance->next; } @@ -1804,7 +1804,7 @@ void RasterizerCanvasGLES3::light_update_directional_shadow(RID p_rid, int p_sha } glBindVertexArray(co->vertex_array); - glDrawElements(GL_TRIANGLES, 3 * co->line_point_count, GL_UNSIGNED_SHORT, 0); + glDrawElements(GL_TRIANGLES, 3 * co->line_point_count, GL_UNSIGNED_SHORT, nullptr); instance = instance->next; } @@ -1923,7 +1923,7 @@ void RasterizerCanvasGLES3::render_sdf(RID p_render_target, LightOccluderInstanc shadow_render.shader.version_set_uniform(CanvasOcclusionShaderGLES3::MODELVIEW2, modelview.columns[0][1], modelview.columns[1][1], 0, modelview.columns[2][1], shadow_render.shader_version, variant); glBindVertexArray(oc->sdf_vertex_array); - glDrawElements(oc->sdf_is_lines ? GL_LINES : GL_TRIANGLES, oc->sdf_index_count, GL_UNSIGNED_INT, 0); + glDrawElements(oc->sdf_is_lines ? GL_LINES : GL_TRIANGLES, oc->sdf_index_count, GL_UNSIGNED_INT, nullptr); instance = instance->next; } diff --git a/drivers/gles3/rasterizer_gles3.cpp b/drivers/gles3/rasterizer_gles3.cpp index 73ee277074c..cee4f93b3d0 100644 --- a/drivers/gles3/rasterizer_gles3.cpp +++ b/drivers/gles3/rasterizer_gles3.cpp @@ -307,7 +307,7 @@ RasterizerGLES3::RasterizerGLES3() { if (callback) { print_line("godot: ENABLING GL DEBUG"); glEnable(_EXT_DEBUG_OUTPUT_SYNCHRONOUS_ARB); - callback((DEBUGPROCARB)_gl_debug_print, NULL); + callback((DEBUGPROCARB)_gl_debug_print, nullptr); glEnable(_EXT_DEBUG_OUTPUT); } } diff --git a/drivers/gles3/rasterizer_scene_gles3.cpp b/drivers/gles3/rasterizer_scene_gles3.cpp index 09edc121123..29cfa251d60 100644 --- a/drivers/gles3/rasterizer_scene_gles3.cpp +++ b/drivers/gles3/rasterizer_scene_gles3.cpp @@ -3462,10 +3462,10 @@ void RasterizerSceneGLES3::_render_list_template(RenderListParameters *p_params, } if (use_wireframe) { - glDrawElementsInstanced(GL_LINES, count, GL_UNSIGNED_INT, 0, inst->instance_count); + glDrawElementsInstanced(GL_LINES, count, GL_UNSIGNED_INT, nullptr, inst->instance_count); } else { if (use_index_buffer) { - glDrawElementsInstanced(primitive_gl, count, mesh_storage->mesh_surface_get_index_type(mesh_surface), 0, inst->instance_count); + glDrawElementsInstanced(primitive_gl, count, mesh_storage->mesh_surface_get_index_type(mesh_surface), nullptr, inst->instance_count); } else { glDrawArraysInstanced(primitive_gl, 0, count, inst->instance_count); } @@ -3473,10 +3473,10 @@ void RasterizerSceneGLES3::_render_list_template(RenderListParameters *p_params, } else { // Using regular Mesh. if (use_wireframe) { - glDrawElements(GL_LINES, count, GL_UNSIGNED_INT, 0); + glDrawElements(GL_LINES, count, GL_UNSIGNED_INT, nullptr); } else { if (use_index_buffer) { - glDrawElements(primitive_gl, count, mesh_storage->mesh_surface_get_index_type(mesh_surface), 0); + glDrawElements(primitive_gl, count, mesh_storage->mesh_surface_get_index_type(mesh_surface), nullptr); } else { glDrawArrays(primitive_gl, 0, count); } diff --git a/drivers/gles3/shader_gles3.cpp b/drivers/gles3/shader_gles3.cpp index 43b146152df..876309d22c5 100644 --- a/drivers/gles3/shader_gles3.cpp +++ b/drivers/gles3/shader_gles3.cpp @@ -540,7 +540,7 @@ bool ShaderGLES3::_load_from_cache(Version *p_version) { return false; #else #if !defined(ANDROID_ENABLED) && !defined(IOS_ENABLED) - if (RasterizerGLES3::is_gles_over_gl() && (glProgramBinary == NULL)) { // ARB_get_program_binary extension not available. + if (RasterizerGLES3::is_gles_over_gl() && (glProgramBinary == nullptr)) { // ARB_get_program_binary extension not available. return false; } #endif @@ -627,7 +627,7 @@ void ShaderGLES3::_save_to_cache(Version *p_version) { #else ERR_FAIL_COND(!shader_cache_dir_valid); #if !defined(ANDROID_ENABLED) && !defined(IOS_ENABLED) - if (RasterizerGLES3::is_gles_over_gl() && (glGetProgramBinary == NULL)) { // ARB_get_program_binary extension not available. + if (RasterizerGLES3::is_gles_over_gl() && (glGetProgramBinary == nullptr)) { // ARB_get_program_binary extension not available. return; } #endif diff --git a/drivers/gles3/storage/texture_storage.cpp b/drivers/gles3/storage/texture_storage.cpp index 5d2bc44377c..a0325358275 100644 --- a/drivers/gles3/storage/texture_storage.cpp +++ b/drivers/gles3/storage/texture_storage.cpp @@ -1067,7 +1067,7 @@ Ref TextureStorage::texture_2d_get(RID p_texture) const { glBindFramebuffer(GL_FRAMEBUFFER, temp_framebuffer); glBindTexture(GL_TEXTURE_2D, temp_color_texture); - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, texture->alloc_width, texture->alloc_height, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL); + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, texture->alloc_width, texture->alloc_height, 0, GL_RGBA, GL_UNSIGNED_BYTE, nullptr); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); @@ -1139,7 +1139,7 @@ Ref TextureStorage::texture_2d_layer_get(RID p_texture, int p_layer) cons glBindFramebuffer(GL_FRAMEBUFFER, temp_framebuffer); glBindTexture(GL_TEXTURE_2D, temp_color_texture); - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, texture->alloc_width, texture->alloc_height, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL); + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, texture->alloc_width, texture->alloc_height, 0, GL_RGBA, GL_UNSIGNED_BYTE, nullptr); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); @@ -1248,7 +1248,7 @@ Vector> TextureStorage::texture_3d_get(RID p_texture) const { glBindFramebuffer(GL_FRAMEBUFFER, temp_framebuffer); glBindTexture(GL_TEXTURE_2D, temp_color_texture); - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, texture->alloc_width, texture->alloc_height, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL); + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, texture->alloc_width, texture->alloc_height, 0, GL_RGBA, GL_UNSIGNED_BYTE, nullptr); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); diff --git a/editor/plugins/version_control_editor_plugin.cpp b/editor/plugins/version_control_editor_plugin.cpp index a54ffd4ee87..9460f9fef2c 100644 --- a/editor/plugins/version_control_editor_plugin.cpp +++ b/editor/plugins/version_control_editor_plugin.cpp @@ -464,7 +464,7 @@ void VersionControlEditorPlugin::_force_push() { void VersionControlEditorPlugin::_update_opened_tabs() { Vector open_scenes = EditorNode::get_editor_data().get_edited_scenes(); for (int i = 0; i < open_scenes.size(); i++) { - if (open_scenes[i].root == NULL) { + if (open_scenes[i].root == nullptr) { continue; } EditorNode::get_singleton()->reload_scene(open_scenes[i].path); diff --git a/modules/ktx/texture_loader_ktx.cpp b/modules/ktx/texture_loader_ktx.cpp index 026c0ce510b..7c73f9cb8a6 100644 --- a/modules/ktx/texture_loader_ktx.cpp +++ b/modules/ktx/texture_loader_ktx.cpp @@ -90,7 +90,7 @@ static Ref load_from_file_access(Ref f, Error *r_error) { ktx_stream.destruct = ktx_destruct; ktx_stream.type = eStreamTypeCustom; ktx_stream.data.custom_ptr.address = &f; - ktx_stream.data.custom_ptr.allocatorAddress = NULL; + ktx_stream.data.custom_ptr.allocatorAddress = nullptr; ktx_stream.data.custom_ptr.size = 0; ktx_stream.readpos = 0; ktx_stream.closeOnDestruct = false; diff --git a/modules/mono/editor/hostfxr_resolver.cpp b/modules/mono/editor/hostfxr_resolver.cpp index 4f15335c1ef..7fa482969e0 100644 --- a/modules/mono/editor/hostfxr_resolver.cpp +++ b/modules/mono/editor/hostfxr_resolver.cpp @@ -239,7 +239,7 @@ bool get_dotnet_self_registered_dir(String &r_dotnet_root) { String sub_key = "SOFTWARE\\dotnet\\Setup\\InstalledVersions\\" + get_dotnet_arch(); Char16String value = String("InstallLocation").utf16(); - HKEY hkey = NULL; + HKEY hkey = nullptr; LSTATUS result = RegOpenKeyExW(HKEY_LOCAL_MACHINE, (LPCWSTR)(sub_key.utf16().get_data()), 0, KEY_READ | KEY_WOW64_32KEY, &hkey); if (result != ERROR_SUCCESS) { return false; diff --git a/modules/openxr/openxr_api.h b/modules/openxr/openxr_api.h index d3e6eb01cee..e1a04a07966 100644 --- a/modules/openxr/openxr_api.h +++ b/modules/openxr/openxr_api.h @@ -118,7 +118,7 @@ private: XrSession session = XR_NULL_HANDLE; XrSessionState session_state = XR_SESSION_STATE_UNKNOWN; bool running = false; - XrFrameState frame_state = { XR_TYPE_FRAME_STATE, NULL, 0, 0, false }; + XrFrameState frame_state = { XR_TYPE_FRAME_STATE, nullptr, 0, 0, false }; double render_target_size_multiplier = 1.0; OpenXRGraphicsExtensionWrapper *graphics_extension = nullptr; diff --git a/modules/text_server_adv/text_server_adv.cpp b/modules/text_server_adv/text_server_adv.cpp index bb198c9c2b5..36dfa55e574 100644 --- a/modules/text_server_adv/text_server_adv.cpp +++ b/modules/text_server_adv/text_server_adv.cpp @@ -6820,13 +6820,13 @@ int64_t TextServerAdvanced::_is_confusable(const String &p_string, const PackedS } for (int i = 0; i < p_dict.size(); i++) { Char16String word = p_dict[i].utf16(); - int32_t len = uspoof_getSkeleton(sc_conf, 0, word.get_data(), -1, NULL, 0, &status); + int32_t len = uspoof_getSkeleton(sc_conf, 0, word.get_data(), -1, nullptr, 0, &status); skeletons.write[i] = (UChar *)memalloc(++len * sizeof(UChar)); status = U_ZERO_ERROR; uspoof_getSkeleton(sc_conf, 0, word.get_data(), -1, skeletons.write[i], len, &status); } - int32_t len = uspoof_getSkeleton(sc_conf, 0, utf16.get_data(), -1, NULL, 0, &status); + int32_t len = uspoof_getSkeleton(sc_conf, 0, utf16.get_data(), -1, nullptr, 0, &status); UChar *skel = (UChar *)memalloc(++len * sizeof(UChar)); status = U_ZERO_ERROR; uspoof_getSkeleton(sc_conf, 0, utf16.get_data(), -1, skel, len, &status); @@ -6867,7 +6867,7 @@ bool TextServerAdvanced::_spoof_check(const String &p_string) const { uspoof_setRestrictionLevel(sc_spoof, USPOOF_MODERATELY_RESTRICTIVE); } - int32_t bitmask = uspoof_check(sc_spoof, utf16.get_data(), -1, NULL, &status); + int32_t bitmask = uspoof_check(sc_spoof, utf16.get_data(), -1, nullptr, &status); ERR_FAIL_COND_V_MSG(U_FAILURE(status), false, u_errorName(status)); return (bitmask != 0); diff --git a/platform/ios/os_ios.mm b/platform/ios/os_ios.mm index 23614af3663..ac13a4d4574 100644 --- a/platform/ios/os_ios.mm +++ b/platform/ios/os_ios.mm @@ -361,7 +361,7 @@ String OS_IOS::get_unique_id() const { String OS_IOS::get_processor_name() const { char buffer[256]; size_t buffer_len = 256; - if (sysctlbyname("machdep.cpu.brand_string", &buffer, &buffer_len, NULL, 0) == 0) { + if (sysctlbyname("machdep.cpu.brand_string", &buffer, &buffer_len, nullptr, 0) == 0) { return String::utf8(buffer, buffer_len); } ERR_FAIL_V_MSG("", String("Couldn't get the CPU model name. Returning an empty string.")); diff --git a/platform/linuxbsd/wayland/detect_prime_egl.cpp b/platform/linuxbsd/wayland/detect_prime_egl.cpp index 4bee32ae3ad..4c97a80039b 100644 --- a/platform/linuxbsd/wayland/detect_prime_egl.cpp +++ b/platform/linuxbsd/wayland/detect_prime_egl.cpp @@ -69,7 +69,7 @@ void DetectPrimeEGL::create_context() { EGLConfig egl_config; EGLContext egl_context = EGL_NO_CONTEXT; - eglInitialize(egl_display, NULL, NULL); + eglInitialize(egl_display, nullptr, nullptr); #if defined(GLAD_ENABLED) if (!gladLoaderLoadEGL(egl_display)) { diff --git a/platform/linuxbsd/wayland/wayland_thread.cpp b/platform/linuxbsd/wayland/wayland_thread.cpp index 0216ad862c9..5040f5dd455 100644 --- a/platform/linuxbsd/wayland/wayland_thread.cpp +++ b/platform/linuxbsd/wayland/wayland_thread.cpp @@ -1724,7 +1724,7 @@ void WaylandThread::_wl_keyboard_on_keymap(void *data, struct wl_keyboard *wl_ke ss->keymap_buffer = nullptr; } - ss->keymap_buffer = (const char *)mmap(NULL, size, PROT_READ, MAP_PRIVATE, fd, 0); + ss->keymap_buffer = (const char *)mmap(nullptr, size, PROT_READ, MAP_PRIVATE, fd, 0); ss->keymap_buffer_size = size; xkb_keymap_unref(ss->xkb_keymap); @@ -2854,7 +2854,7 @@ void WaylandThread::seat_state_lock_pointer(SeatState *p_ss) { ERR_FAIL_NULL(locked_surface); - p_ss->wp_locked_pointer = zwp_pointer_constraints_v1_lock_pointer(registry.wp_pointer_constraints, locked_surface, p_ss->wl_pointer, NULL, ZWP_POINTER_CONSTRAINTS_V1_LIFETIME_PERSISTENT); + p_ss->wp_locked_pointer = zwp_pointer_constraints_v1_lock_pointer(registry.wp_pointer_constraints, locked_surface, p_ss->wl_pointer, nullptr, ZWP_POINTER_CONSTRAINTS_V1_LIFETIME_PERSISTENT); } } @@ -2886,7 +2886,7 @@ void WaylandThread::seat_state_confine_pointer(SeatState *p_ss) { ERR_FAIL_NULL(confined_surface); - p_ss->wp_confined_pointer = zwp_pointer_constraints_v1_confine_pointer(registry.wp_pointer_constraints, confined_surface, p_ss->wl_pointer, NULL, ZWP_POINTER_CONSTRAINTS_V1_LIFETIME_PERSISTENT); + p_ss->wp_confined_pointer = zwp_pointer_constraints_v1_confine_pointer(registry.wp_pointer_constraints, confined_surface, p_ss->wl_pointer, nullptr, ZWP_POINTER_CONSTRAINTS_V1_LIFETIME_PERSISTENT); } } @@ -3660,7 +3660,7 @@ void WaylandThread::cursor_shape_set_custom_image(DisplayServer::CursorShape p_c munmap(cursor.buffer_data, cursor.buffer_data_size); } - cursor.buffer_data = (uint32_t *)mmap(NULL, data_size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); + cursor.buffer_data = (uint32_t *)mmap(nullptr, data_size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); if (cursor.wl_buffer) { // Clean up the old Wayland buffer. diff --git a/platform/macos/display_server_macos.mm b/platform/macos/display_server_macos.mm index 29bc60bd2a1..c52ed00b3d9 100644 --- a/platform/macos/display_server_macos.mm +++ b/platform/macos/display_server_macos.mm @@ -515,7 +515,7 @@ void DisplayServerMacOS::_keyboard_layout_changed(CFNotificationCenterRef center NSImage *DisplayServerMacOS::_convert_to_nsimg(Ref &p_image) const { p_image->convert(Image::FORMAT_RGBA8); NSBitmapImageRep *imgrep = [[NSBitmapImageRep alloc] - initWithBitmapDataPlanes:NULL + initWithBitmapDataPlanes:nullptr pixelsWide:p_image->get_width() pixelsHigh:p_image->get_height() bitsPerSample:8 diff --git a/platform/macos/os_macos.mm b/platform/macos/os_macos.mm index c5c95c9a70a..d9ad8f937a4 100644 --- a/platform/macos/os_macos.mm +++ b/platform/macos/os_macos.mm @@ -70,7 +70,7 @@ void OS_MacOS::initialize() { String OS_MacOS::get_processor_name() const { char buffer[256]; size_t buffer_len = 256; - if (sysctlbyname("machdep.cpu.brand_string", &buffer, &buffer_len, NULL, 0) == 0) { + if (sysctlbyname("machdep.cpu.brand_string", &buffer, &buffer_len, nullptr, 0) == 0) { return String::utf8(buffer, buffer_len); } ERR_FAIL_V_MSG("", String("Couldn't get the CPU model name. Returning an empty string.")); diff --git a/platform/windows/crash_handler_windows.cpp b/platform/windows/crash_handler_windows.cpp index e32fbd47dda..133d36aa0db 100644 --- a/platform/windows/crash_handler_windows.cpp +++ b/platform/windows/crash_handler_windows.cpp @@ -109,7 +109,7 @@ public: ret.module_name = temp; std::vector img(ret.image_name.begin(), ret.image_name.end()); std::vector mod(ret.module_name.begin(), ret.module_name.end()); - SymLoadModule64(process, 0, &img[0], &mod[0], (DWORD64)ret.base_address, ret.load_size); + SymLoadModule64(process, nullptr, &img[0], &mod[0], (DWORD64)ret.base_address, ret.load_size); return ret; } }; diff --git a/platform/windows/display_server_windows.cpp b/platform/windows/display_server_windows.cpp index eff2ec8f968..14718d88385 100644 --- a/platform/windows/display_server_windows.cpp +++ b/platform/windows/display_server_windows.cpp @@ -202,8 +202,8 @@ void DisplayServerWindows::_register_raw_input_devices(WindowID p_target_window) rid[1].hwndTarget = windows[p_target_window].hWnd; } else { // Follow the keyboard focus - rid[0].hwndTarget = 0; - rid[1].hwndTarget = 0; + rid[0].hwndTarget = nullptr; + rid[1].hwndTarget = nullptr; } if (RegisterRawInputDevices(rid, 2, sizeof(rid[0])) == FALSE) { @@ -272,7 +272,7 @@ public: QITABENT(FileDialogEventHandler, IFileDialogEvents), QITABENT(FileDialogEventHandler, IFileDialogControlEvents), #endif - { 0, 0 }, + { nullptr, 0 }, }; return QISearch(this, qit, riid, ppv); } @@ -762,15 +762,15 @@ Ref DisplayServerWindows::clipboard_get_image() const { } } else if (IsClipboardFormatAvailable(CF_DIB)) { HGLOBAL mem = GetClipboardData(CF_DIB); - if (mem != NULL) { + if (mem != nullptr) { BITMAPINFO *ptr = static_cast(GlobalLock(mem)); - if (ptr != NULL) { + if (ptr != nullptr) { BITMAPINFOHEADER *info = &ptr->bmiHeader; void *dib_bits = (void *)(ptr->bmiColors); // Draw DIB image to temporary DC surface and read it back as BGRA8. - HDC dc = GetDC(0); + HDC dc = GetDC(nullptr); if (dc) { HDC hdc = CreateCompatibleDC(dc); if (hdc) { @@ -804,7 +804,7 @@ Ref DisplayServerWindows::clipboard_get_image() const { } DeleteDC(hdc); } - ReleaseDC(NULL, dc); + ReleaseDC(nullptr, dc); } GlobalUnlock(mem); } @@ -868,7 +868,7 @@ int DisplayServerWindows::get_screen_count() const { } int DisplayServerWindows::get_primary_screen() const { - EnumScreenData data = { 0, 0, 0 }; + EnumScreenData data = { 0, 0, nullptr }; EnumDisplayMonitors(nullptr, nullptr, _MonitorEnumProcPrim, (LPARAM)&data); return data.screen; } @@ -1116,16 +1116,16 @@ Color DisplayServerWindows::screen_get_pixel(const Point2i &p_position) const { p.x = pos.x; p.y = pos.y; if (win81p_LogicalToPhysicalPointForPerMonitorDPI) { - win81p_LogicalToPhysicalPointForPerMonitorDPI(0, &p); + win81p_LogicalToPhysicalPointForPerMonitorDPI(nullptr, &p); } - HDC dc = GetDC(0); + HDC dc = GetDC(nullptr); if (dc) { COLORREF col = GetPixel(dc, p.x, p.y); if (col != CLR_INVALID) { - ReleaseDC(NULL, dc); + ReleaseDC(nullptr, dc); return Color(float(col & 0x000000FF) / 255.0f, float((col & 0x0000FF00) >> 8) / 255.0f, float((col & 0x00FF0000) >> 16) / 255.0f, 1.0f); } - ReleaseDC(NULL, dc); + ReleaseDC(nullptr, dc); } return Color(); @@ -1156,12 +1156,12 @@ Ref DisplayServerWindows::screen_get_image(int p_screen) const { p2.x = pos.x + size.x; p2.y = pos.y + size.y; if (win81p_LogicalToPhysicalPointForPerMonitorDPI) { - win81p_LogicalToPhysicalPointForPerMonitorDPI(0, &p1); - win81p_LogicalToPhysicalPointForPerMonitorDPI(0, &p2); + win81p_LogicalToPhysicalPointForPerMonitorDPI(nullptr, &p1); + win81p_LogicalToPhysicalPointForPerMonitorDPI(nullptr, &p2); } Ref img; - HDC dc = GetDC(0); + HDC dc = GetDC(nullptr); if (dc) { HDC hdc = CreateCompatibleDC(dc); int width = p2.x - p1.x; @@ -1194,7 +1194,7 @@ Ref DisplayServerWindows::screen_get_image(int p_screen) const { } DeleteDC(hdc); } - ReleaseDC(NULL, dc); + ReleaseDC(nullptr, dc); } return img; @@ -1420,7 +1420,7 @@ void DisplayServerWindows::delete_sub_window(WindowID p_window) { if ((tablet_get_current_driver() == "wintab") && wintab_available && windows[p_window].wtctx) { wintab_WTClose(windows[p_window].wtctx); - windows[p_window].wtctx = 0; + windows[p_window].wtctx = nullptr; } DestroyWindow(windows[p_window].hWnd); windows.erase(p_window); @@ -1541,7 +1541,7 @@ Size2i DisplayServerWindows::window_get_title_size(const String &p_title, Window return size; } - HDC hdc = GetDCEx(wd.hWnd, NULL, DCX_WINDOW); + HDC hdc = GetDCEx(wd.hWnd, nullptr, DCX_WINDOW); if (hdc) { Char16String s = p_title.utf16(); SIZE text_size; @@ -1559,8 +1559,8 @@ Size2i DisplayServerWindows::window_get_title_size(const String &p_title, Window ClientToScreen(wd.hWnd, (POINT *)&rect.right); if (win81p_PhysicalToLogicalPointForPerMonitorDPI) { - win81p_PhysicalToLogicalPointForPerMonitorDPI(0, (POINT *)&rect.left); - win81p_PhysicalToLogicalPointForPerMonitorDPI(0, (POINT *)&rect.right); + win81p_PhysicalToLogicalPointForPerMonitorDPI(nullptr, (POINT *)&rect.left); + win81p_PhysicalToLogicalPointForPerMonitorDPI(nullptr, (POINT *)&rect.right); } size.x += (rect.right - rect.left); @@ -1991,7 +1991,7 @@ void DisplayServerWindows::window_set_mode(WindowMode p_mode, WindowID p_window) MoveWindow(wd.hWnd, rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, TRUE); if (restore_mouse_trails > 1) { - SystemParametersInfoA(SPI_SETMOUSETRAILS, restore_mouse_trails, 0, 0); + SystemParametersInfoA(SPI_SETMOUSETRAILS, restore_mouse_trails, nullptr, 0); restore_mouse_trails = 0; } } @@ -2048,7 +2048,7 @@ void DisplayServerWindows::window_set_mode(WindowMode p_mode, WindowID p_window) // Save number of trails so we can restore when exiting, then turn off mouse trails SystemParametersInfoA(SPI_GETMOUSETRAILS, 0, &restore_mouse_trails, 0); if (restore_mouse_trails > 1) { - SystemParametersInfoA(SPI_SETMOUSETRAILS, 0, 0, 0); + SystemParametersInfoA(SPI_SETMOUSETRAILS, 0, nullptr, 0); } } } @@ -2303,10 +2303,10 @@ void DisplayServerWindows::window_set_ime_active(const bool p_active, WindowID p if (p_active) { wd.ime_active = true; ImmAssociateContext(wd.hWnd, wd.im_himc); - CreateCaret(wd.hWnd, NULL, 1, 1); + CreateCaret(wd.hWnd, nullptr, 1, 1); window_set_ime_position(wd.im_position, p_window); } else { - ImmAssociateContext(wd.hWnd, (HIMC)0); + ImmAssociateContext(wd.hWnd, (HIMC) nullptr); DestroyCaret(); wd.ime_active = false; } @@ -2321,7 +2321,7 @@ void DisplayServerWindows::window_set_ime_position(const Point2i &p_pos, WindowI wd.im_position = p_pos; HIMC himc = ImmGetContext(wd.hWnd); - if (himc == (HIMC)0) { + if (himc == (HIMC) nullptr) { return; } @@ -5012,7 +5012,7 @@ void DisplayServerWindows::_update_tablet_ctx(const String &p_old_driver, const if ((p_old_driver == "wintab") && wintab_available && wd.wtctx) { wintab_WTEnable(wd.wtctx, false); wintab_WTClose(wd.wtctx); - wd.wtctx = 0; + wd.wtctx = nullptr; } if ((p_new_driver == "wintab") && wintab_available) { wintab_WTInfo(WTI_DEFSYSCTX, 0, &wd.wtlc); @@ -5101,8 +5101,6 @@ DisplayServer::WindowID DisplayServerWindows::_create_window(WindowMode p_mode, dwExStyle, L"Engine", L"", dwStyle, - // (GetSystemMetrics(SM_CXSCREEN) - WindowRect.right) / 2, - // (GetSystemMetrics(SM_CYSCREEN) - WindowRect.bottom) / 2, WindowRect.left, WindowRect.top, WindowRect.right - WindowRect.left, @@ -5220,7 +5218,7 @@ DisplayServer::WindowID DisplayServerWindows::_create_window(WindowMode p_mode, print_verbose("WinTab context creation failed."); } } else { - wd.wtctx = 0; + wd.wtctx = nullptr; } if (p_mode == WINDOW_MODE_MAXIMIZED) { @@ -5266,7 +5264,7 @@ DisplayServer::WindowID DisplayServerWindows::_create_window(WindowMode p_mode, // IME. wd.im_himc = ImmGetContext(wd.hWnd); - ImmAssociateContext(wd.hWnd, (HIMC)0); + ImmAssociateContext(wd.hWnd, (HIMC) nullptr); wd.im_position = Vector2(); @@ -5321,17 +5319,17 @@ Vector2i _get_device_ids(const String &p_device_name) { REFCLSID clsid = CLSID_WbemLocator; // Unmarshaler CLSID REFIID uuid = IID_IWbemLocator; // Interface UUID - IWbemLocator *wbemLocator = NULL; // to get the services - IWbemServices *wbemServices = NULL; // to get the class - IEnumWbemClassObject *iter = NULL; + IWbemLocator *wbemLocator = nullptr; // to get the services + IWbemServices *wbemServices = nullptr; // to get the class + IEnumWbemClassObject *iter = nullptr; IWbemClassObject *pnpSDriverObject[1]; // contains driver name, version, etc. - HRESULT hr = CoCreateInstance(clsid, NULL, CLSCTX_INPROC_SERVER, uuid, (LPVOID *)&wbemLocator); + HRESULT hr = CoCreateInstance(clsid, nullptr, CLSCTX_INPROC_SERVER, uuid, (LPVOID *)&wbemLocator); if (hr != S_OK) { return Vector2i(); } BSTR resource_name = SysAllocString(L"root\\CIMV2"); - hr = wbemLocator->ConnectServer(resource_name, NULL, NULL, NULL, 0, NULL, NULL, &wbemServices); + hr = wbemLocator->ConnectServer(resource_name, nullptr, nullptr, nullptr, 0, nullptr, nullptr, &wbemServices); SysFreeString(resource_name); SAFE_RELEASE(wbemLocator) // from now on, use `wbemServices` @@ -5345,7 +5343,7 @@ Vector2i _get_device_ids(const String &p_device_name) { const String gpu_device_class_query = vformat("SELECT * FROM Win32_PnPSignedDriver WHERE DeviceName = \"%s\"", p_device_name); BSTR query = SysAllocString((const WCHAR *)gpu_device_class_query.utf16().get_data()); BSTR query_lang = SysAllocString(L"WQL"); - hr = wbemServices->ExecQuery(query_lang, query, WBEM_FLAG_RETURN_IMMEDIATELY | WBEM_FLAG_FORWARD_ONLY, NULL, &iter); + hr = wbemServices->ExecQuery(query_lang, query, WBEM_FLAG_RETURN_IMMEDIATELY | WBEM_FLAG_FORWARD_ONLY, nullptr, &iter); SysFreeString(query_lang); SysFreeString(query); if (hr == S_OK) { @@ -5356,7 +5354,7 @@ Vector2i _get_device_ids(const String &p_device_name) { VARIANT did; VariantInit(&did); BSTR object_name = SysAllocString(L"DeviceID"); - hr = pnpSDriverObject[0]->Get(object_name, 0, &did, NULL, NULL); + hr = pnpSDriverObject[0]->Get(object_name, 0, &did, nullptr, nullptr); SysFreeString(object_name); if (hr == S_OK) { String device_id = String(V_BSTR(&did)); @@ -5869,7 +5867,7 @@ DisplayServerWindows::~DisplayServerWindows() { #endif if (wintab_available && windows[MAIN_WINDOW_ID].wtctx) { wintab_WTClose(windows[MAIN_WINDOW_ID].wtctx); - windows[MAIN_WINDOW_ID].wtctx = 0; + windows[MAIN_WINDOW_ID].wtctx = nullptr; } DestroyWindow(windows[MAIN_WINDOW_ID].hWnd); } @@ -5887,7 +5885,7 @@ DisplayServerWindows::~DisplayServerWindows() { #endif if (restore_mouse_trails > 1) { - SystemParametersInfoA(SPI_SETMOUSETRAILS, restore_mouse_trails, 0, 0); + SystemParametersInfoA(SPI_SETMOUSETRAILS, restore_mouse_trails, nullptr, 0); } #ifdef GLES3_ENABLED if (gl_manager_angle) { diff --git a/platform/windows/gl_manager_windows_native.cpp b/platform/windows/gl_manager_windows_native.cpp index 8af32395b7d..da837b3f949 100644 --- a/platform/windows/gl_manager_windows_native.cpp +++ b/platform/windows/gl_manager_windows_native.cpp @@ -107,22 +107,22 @@ static bool nvapi_err_check(const char *msg, int status) { // to avoid stuttering, see https://stackoverflow.com/questions/36959508/nvidia-graphics-driver-causing-noticeable-frame-stuttering/37632948 // also see https://github.com/Ryujinx/Ryujinx/blob/master/src/Ryujinx.Common/GraphicsDriver/NVThreadedOptimization.cs void GLManagerNative_Windows::_nvapi_disable_threaded_optimization() { - HMODULE nvapi = 0; + HMODULE nvapi = nullptr; #ifdef _WIN64 nvapi = LoadLibraryA("nvapi64.dll"); #else nvapi = LoadLibraryA("nvapi.dll"); #endif - if (nvapi == NULL) { + if (nvapi == nullptr) { return; } - void *(__cdecl * NvAPI_QueryInterface)(unsigned int interface_id) = 0; + void *(__cdecl * NvAPI_QueryInterface)(unsigned int interface_id) = nullptr; NvAPI_QueryInterface = (void *(__cdecl *)(unsigned int))(void *)GetProcAddress(nvapi, "nvapi_QueryInterface"); - if (NvAPI_QueryInterface == NULL) { + if (NvAPI_QueryInterface == nullptr) { print_verbose("Error getting NVAPI NvAPI_QueryInterface"); return; } @@ -176,7 +176,7 @@ void GLManagerNative_Windows::_nvapi_disable_threaded_optimization() { Char16String app_executable_name_u16 = app_executable_name.utf16(); Char16String app_friendly_name_u16 = app_friendly_name.utf16(); - NvDRSProfileHandle profile_handle = 0; + NvDRSProfileHandle profile_handle = nullptr; int profile_status = NvAPI_DRS_FindProfileByName(session_handle, (NvU16 *)(app_profile_name_u16.ptrw()), &profile_handle); @@ -195,7 +195,7 @@ void GLManagerNative_Windows::_nvapi_disable_threaded_optimization() { } } - NvDRSProfileHandle app_profile_handle = 0; + NvDRSProfileHandle app_profile_handle = nullptr; NVDRS_APPLICATION_V4 app; app.version = NVDRS_APPLICATION_VER_V4; @@ -362,14 +362,14 @@ Error GLManagerNative_Windows::_create_context(GLWindow &win, GLDisplay &gl_disp if (wglCreateContextAttribsARB == nullptr) //OpenGL 3.0 is not supported { gd_wglDeleteContext(gl_display.hRC); - gl_display.hRC = 0; + gl_display.hRC = nullptr; return ERR_CANT_CREATE; } - HGLRC new_hRC = wglCreateContextAttribsARB(win.hDC, 0, attribs); + HGLRC new_hRC = wglCreateContextAttribsARB(win.hDC, nullptr, attribs); if (!new_hRC) { gd_wglDeleteContext(gl_display.hRC); - gl_display.hRC = 0; + gl_display.hRC = nullptr; return ERR_CANT_CREATE; } @@ -384,7 +384,7 @@ Error GLManagerNative_Windows::_create_context(GLWindow &win, GLDisplay &gl_disp { ERR_PRINT("Could not attach OpenGL context to newly created window with replaced OpenGL context: " + format_error_message(GetLastError())); gd_wglDeleteContext(gl_display.hRC); - gl_display.hRC = 0; + gl_display.hRC = nullptr; return ERR_CANT_CREATE; } diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp index 93d1ffeac1d..152b9ac10fa 100644 --- a/platform/windows/os_windows.cpp +++ b/platform/windows/os_windows.cpp @@ -329,7 +329,7 @@ void debug_dynamic_library_check_dependencies(const String &p_root_path, const S if (import_desc) { for (; import_desc->Name && import_desc->FirstThunk; import_desc++) { char16_t full_name_wc[MAX_PATH]; - const char *name_cs = (const char *)ImageRvaToVa(loaded_image.FileHeader, loaded_image.MappedAddress, import_desc->Name, 0); + const char *name_cs = (const char *)ImageRvaToVa(loaded_image.FileHeader, loaded_image.MappedAddress, import_desc->Name, nullptr); String name = String(name_cs); if (name.begins_with("api-ms-win-")) { r_checked.insert(name); @@ -463,9 +463,9 @@ Vector OS_Windows::get_video_adapter_driver_info() const { REFCLSID clsid = CLSID_WbemLocator; // Unmarshaler CLSID REFIID uuid = IID_IWbemLocator; // Interface UUID - IWbemLocator *wbemLocator = NULL; // to get the services - IWbemServices *wbemServices = NULL; // to get the class - IEnumWbemClassObject *iter = NULL; + IWbemLocator *wbemLocator = nullptr; // to get the services + IWbemServices *wbemServices = nullptr; // to get the class + IEnumWbemClassObject *iter = nullptr; IWbemClassObject *pnpSDriverObject[1]; // contains driver name, version, etc. String driver_name; String driver_version; @@ -475,12 +475,12 @@ Vector OS_Windows::get_video_adapter_driver_info() const { return Vector(); } - HRESULT hr = CoCreateInstance(clsid, NULL, CLSCTX_INPROC_SERVER, uuid, (LPVOID *)&wbemLocator); + HRESULT hr = CoCreateInstance(clsid, nullptr, CLSCTX_INPROC_SERVER, uuid, (LPVOID *)&wbemLocator); if (hr != S_OK) { return Vector(); } BSTR resource_name = SysAllocString(L"root\\CIMV2"); - hr = wbemLocator->ConnectServer(resource_name, NULL, NULL, NULL, 0, NULL, NULL, &wbemServices); + hr = wbemLocator->ConnectServer(resource_name, nullptr, nullptr, nullptr, 0, nullptr, nullptr, &wbemServices); SysFreeString(resource_name); SAFE_RELEASE(wbemLocator) // from now on, use `wbemServices` @@ -492,7 +492,7 @@ Vector OS_Windows::get_video_adapter_driver_info() const { const String gpu_device_class_query = vformat("SELECT * FROM Win32_PnPSignedDriver WHERE DeviceName = \"%s\"", device_name); BSTR query = SysAllocString((const WCHAR *)gpu_device_class_query.utf16().get_data()); BSTR query_lang = SysAllocString(L"WQL"); - hr = wbemServices->ExecQuery(query_lang, query, WBEM_FLAG_RETURN_IMMEDIATELY | WBEM_FLAG_FORWARD_ONLY, NULL, &iter); + hr = wbemServices->ExecQuery(query_lang, query, WBEM_FLAG_RETURN_IMMEDIATELY | WBEM_FLAG_FORWARD_ONLY, nullptr, &iter); SysFreeString(query_lang); SysFreeString(query); if (hr == S_OK) { @@ -504,13 +504,13 @@ Vector OS_Windows::get_video_adapter_driver_info() const { VariantInit(&dn); BSTR object_name = SysAllocString(L"DriverName"); - hr = pnpSDriverObject[0]->Get(object_name, 0, &dn, NULL, NULL); + hr = pnpSDriverObject[0]->Get(object_name, 0, &dn, nullptr, nullptr); SysFreeString(object_name); if (hr == S_OK) { String d_name = String(V_BSTR(&dn)); if (d_name.is_empty()) { object_name = SysAllocString(L"DriverProviderName"); - hr = pnpSDriverObject[0]->Get(object_name, 0, &dn, NULL, NULL); + hr = pnpSDriverObject[0]->Get(object_name, 0, &dn, nullptr, nullptr); SysFreeString(object_name); if (hr == S_OK) { driver_name = String(V_BSTR(&dn)); @@ -520,7 +520,7 @@ Vector OS_Windows::get_video_adapter_driver_info() const { } } else { object_name = SysAllocString(L"DriverProviderName"); - hr = pnpSDriverObject[0]->Get(object_name, 0, &dn, NULL, NULL); + hr = pnpSDriverObject[0]->Get(object_name, 0, &dn, nullptr, nullptr); SysFreeString(object_name); if (hr == S_OK) { driver_name = String(V_BSTR(&dn)); @@ -530,7 +530,7 @@ Vector OS_Windows::get_video_adapter_driver_info() const { VARIANT dv; VariantInit(&dv); object_name = SysAllocString(L"DriverVersion"); - hr = pnpSDriverObject[0]->Get(object_name, 0, &dv, NULL, NULL); + hr = pnpSDriverObject[0]->Get(object_name, 0, &dv, nullptr, nullptr); SysFreeString(object_name); if (hr == S_OK) { driver_version = String(V_BSTR(&dv)); @@ -783,7 +783,7 @@ Error OS_Windows::execute(const String &p_path, const List &p_arguments, DWORD read = 0; for (;;) { // Read StdOut and StdErr from pipe. bytes.resize(bytes_in_buffer + CHUNK_SIZE); - const bool success = ReadFile(pipe[0], bytes.ptr() + bytes_in_buffer, CHUNK_SIZE, &read, NULL); + const bool success = ReadFile(pipe[0], bytes.ptr() + bytes_in_buffer, CHUNK_SIZE, &read, nullptr); if (!success || read == 0) { break; } @@ -873,7 +873,7 @@ Error OS_Windows::kill(const ProcessID &p_pid) { CloseHandle(pi.hThread); } else { HANDLE hProcess = OpenProcess(PROCESS_TERMINATE, false, (DWORD)p_pid); - if (hProcess != NULL) { + if (hProcess != nullptr) { ret = TerminateProcess(hProcess, 0); CloseHandle(hProcess); @@ -1455,7 +1455,7 @@ String OS_Windows::get_processor_name() const { WCHAR buffer[256]; DWORD buffer_len = 256; DWORD vtype = REG_SZ; - if (RegQueryValueExW(hkey, L"ProcessorNameString", NULL, &vtype, (LPBYTE)buffer, &buffer_len) == ERROR_SUCCESS) { + if (RegQueryValueExW(hkey, L"ProcessorNameString", nullptr, &vtype, (LPBYTE)buffer, &buffer_len) == ERROR_SUCCESS) { RegCloseKey(hkey); return String::utf16((const char16_t *)buffer, buffer_len).strip_edges(); } else { diff --git a/platform/windows/tts_windows.cpp b/platform/windows/tts_windows.cpp index 11d63d85eeb..39a8f3e1204 100644 --- a/platform/windows/tts_windows.cpp +++ b/platform/windows/tts_windows.cpp @@ -35,7 +35,7 @@ TTS_Windows *TTS_Windows::singleton = nullptr; void __stdcall TTS_Windows::speech_event_callback(WPARAM wParam, LPARAM lParam) { TTS_Windows *tts = TTS_Windows::get_singleton(); SPEVENT event; - while (tts->synth->GetEvents(1, &event, NULL) == S_OK) { + while (tts->synth->GetEvents(1, &event, nullptr) == S_OK) { uint32_t stream_num = (uint32_t)event.ulStreamNum; if (tts->ids.has(stream_num)) { if (event.eEventId == SPEI_START_INPUT_STREAM) { @@ -82,7 +82,7 @@ void TTS_Windows::_update_tts() { if (SUCCEEDED(hr)) { hr = cpEnum->GetCount(&ulCount); while (SUCCEEDED(hr) && ulCount--) { - wchar_t *w_id = 0L; + wchar_t *w_id = nullptr; hr = cpEnum->Next(1, &cpVoiceToken, nullptr); cpVoiceToken->GetId(&w_id); if (String::utf16((const char16_t *)w_id) == message.voice) { diff --git a/platform/windows/wgl_detect_version.cpp b/platform/windows/wgl_detect_version.cpp index 49da4b58c7a..12dd6f6ee6a 100644 --- a/platform/windows/wgl_detect_version.cpp +++ b/platform/windows/wgl_detect_version.cpp @@ -140,7 +140,7 @@ Dictionary detect_wgl() { PFNWGLCREATECONTEXTATTRIBSARBPROC gd_wglCreateContextAttribsARB = nullptr; gd_wglCreateContextAttribsARB = (PFNWGLCREATECONTEXTATTRIBSARBPROC)gd_wglGetProcAddress("wglCreateContextAttribsARB"); if (gd_wglCreateContextAttribsARB) { - HGLRC new_hRC = gd_wglCreateContextAttribsARB(hDC, 0, attribs); + HGLRC new_hRC = gd_wglCreateContextAttribsARB(hDC, nullptr, attribs); if (new_hRC) { if (gd_wglMakeCurrent(hDC, new_hRC)) { PFNWGLGETSTRINGPROC gd_wglGetString = (PFNWGLGETSTRINGPROC)GetProcAddress(module, "glGetString");