mirror of
https://github.com/godotengine/godot.git
synced 2024-11-21 19:42:43 +00:00
clang-tidy: Enforce modernize-use-nullptr
This commit is contained in:
parent
b18942d429
commit
3b3e2374c9
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -379,7 +379,7 @@ private:
|
||||
|
||||
struct FenceInfo {
|
||||
ComPtr<ID3D12Fence> d3d_fence = nullptr;
|
||||
HANDLE event_handle = NULL;
|
||||
HANDLE event_handle = nullptr;
|
||||
UINT64 fence_value = 0;
|
||||
};
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -1067,7 +1067,7 @@ Ref<Image> 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<Image> 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<Ref<Image>> 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);
|
||||
|
@ -464,7 +464,7 @@ void VersionControlEditorPlugin::_force_push() {
|
||||
void VersionControlEditorPlugin::_update_opened_tabs() {
|
||||
Vector<EditorData::EditedScene> 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);
|
||||
|
@ -90,7 +90,7 @@ static Ref<Image> load_from_file_access(Ref<FileAccess> 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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
@ -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."));
|
||||
|
@ -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)) {
|
||||
|
@ -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.
|
||||
|
@ -515,7 +515,7 @@ void DisplayServerMacOS::_keyboard_layout_changed(CFNotificationCenterRef center
|
||||
NSImage *DisplayServerMacOS::_convert_to_nsimg(Ref<Image> &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
|
||||
|
@ -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."));
|
||||
|
@ -109,7 +109,7 @@ public:
|
||||
ret.module_name = temp;
|
||||
std::vector<char> img(ret.image_name.begin(), ret.image_name.end());
|
||||
std::vector<char> 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;
|
||||
}
|
||||
};
|
||||
|
@ -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<Image> 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<BITMAPINFO *>(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<Image> 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<Image> 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<Image> 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<Image> 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) {
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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<String> 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<String> OS_Windows::get_video_adapter_driver_info() const {
|
||||
return Vector<String>();
|
||||
}
|
||||
|
||||
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<String>();
|
||||
}
|
||||
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<String> 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<String> 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<String> 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<String> 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<String> &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 {
|
||||
|
@ -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) {
|
||||
|
@ -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");
|
||||
|
Loading…
Reference in New Issue
Block a user