Skip to content

Commit 48b650c

Browse files
committed
Merge pull request #89422 from Repiteo/clang-tidy-NULL
clang-tidy: Enforce `modernize-use-nullptr`
2 parents 0478998 + 3b3e237 commit 48b650c

24 files changed

+98
-100
lines changed

drivers/d3d12/rendering_context_driver_d3d12.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ class RenderingContextDriverD3D12 : public RenderingContextDriver {
100100

101101
// D3D12-only methods.
102102
struct Surface {
103-
HWND hwnd = NULL;
103+
HWND hwnd = nullptr;
104104
uint32_t width = 0;
105105
uint32_t height = 0;
106106
DisplayServer::VSyncMode vsync_mode = DisplayServer::VSYNC_ENABLED;

drivers/d3d12/rendering_device_driver_d3d12.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5999,7 +5999,7 @@ RenderingDeviceDriverD3D12::~RenderingDeviceDriverD3D12() {
59995999
}
60006000

60016001
bool RenderingDeviceDriverD3D12::is_in_developer_mode() {
6002-
HKEY hkey = NULL;
6002+
HKEY hkey = nullptr;
60036003
LSTATUS result = RegOpenKeyExW(HKEY_LOCAL_MACHINE, L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\AppModelUnlock", 0, KEY_READ, &hkey);
60046004
if (result != ERROR_SUCCESS) {
60056005
return false;

drivers/d3d12/rendering_device_driver_d3d12.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,7 @@ class RenderingDeviceDriverD3D12 : public RenderingDeviceDriver {
379379

380380
struct FenceInfo {
381381
ComPtr<ID3D12Fence> d3d_fence = nullptr;
382-
HANDLE event_handle = NULL;
382+
HANDLE event_handle = nullptr;
383383
UINT64 fence_value = 0;
384384
};
385385

drivers/gles3/rasterizer_canvas_gles3.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1287,7 +1287,7 @@ void RasterizerCanvasGLES3::_render_batch(Light *p_lights, uint32_t p_index, Ren
12871287
uint32_t range_start = state.canvas_instance_batches[p_index].start * sizeof(InstanceData);
12881288
_enable_attributes(range_start, false);
12891289

1290-
glDrawElementsInstanced(GL_TRIANGLES, 6, GL_UNSIGNED_INT, 0, state.canvas_instance_batches[p_index].instance_count);
1290+
glDrawElementsInstanced(GL_TRIANGLES, 6, GL_UNSIGNED_INT, nullptr, state.canvas_instance_batches[p_index].instance_count);
12911291
glBindVertexArray(0);
12921292

12931293
if (r_render_info) {
@@ -1490,7 +1490,7 @@ void RasterizerCanvasGLES3::_render_batch(Light *p_lights, uint32_t p_index, Ren
14901490
uint32_t vertex_count = mesh_storage->mesh_surface_get_vertices_drawn_count(surface);
14911491

14921492
if (use_index_buffer) {
1493-
glDrawElementsInstanced(primitive_gl, vertex_count, mesh_storage->mesh_surface_get_index_type(surface), 0, instance_count);
1493+
glDrawElementsInstanced(primitive_gl, vertex_count, mesh_storage->mesh_surface_get_index_type(surface), nullptr, instance_count);
14941494
} else {
14951495
glDrawArraysInstanced(primitive_gl, 0, vertex_count, instance_count);
14961496
}
@@ -1701,7 +1701,7 @@ void RasterizerCanvasGLES3::light_update_shadow(RID p_rid, int p_shadow_index, c
17011701
}
17021702

17031703
glBindVertexArray(co->vertex_array);
1704-
glDrawElements(GL_TRIANGLES, 3 * co->line_point_count, GL_UNSIGNED_SHORT, 0);
1704+
glDrawElements(GL_TRIANGLES, 3 * co->line_point_count, GL_UNSIGNED_SHORT, nullptr);
17051705

17061706
instance = instance->next;
17071707
}
@@ -1804,7 +1804,7 @@ void RasterizerCanvasGLES3::light_update_directional_shadow(RID p_rid, int p_sha
18041804
}
18051805

18061806
glBindVertexArray(co->vertex_array);
1807-
glDrawElements(GL_TRIANGLES, 3 * co->line_point_count, GL_UNSIGNED_SHORT, 0);
1807+
glDrawElements(GL_TRIANGLES, 3 * co->line_point_count, GL_UNSIGNED_SHORT, nullptr);
18081808

18091809
instance = instance->next;
18101810
}
@@ -1923,7 +1923,7 @@ void RasterizerCanvasGLES3::render_sdf(RID p_render_target, LightOccluderInstanc
19231923
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);
19241924

19251925
glBindVertexArray(oc->sdf_vertex_array);
1926-
glDrawElements(oc->sdf_is_lines ? GL_LINES : GL_TRIANGLES, oc->sdf_index_count, GL_UNSIGNED_INT, 0);
1926+
glDrawElements(oc->sdf_is_lines ? GL_LINES : GL_TRIANGLES, oc->sdf_index_count, GL_UNSIGNED_INT, nullptr);
19271927

19281928
instance = instance->next;
19291929
}

drivers/gles3/rasterizer_gles3.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ RasterizerGLES3::RasterizerGLES3() {
307307
if (callback) {
308308
print_line("godot: ENABLING GL DEBUG");
309309
glEnable(_EXT_DEBUG_OUTPUT_SYNCHRONOUS_ARB);
310-
callback((DEBUGPROCARB)_gl_debug_print, NULL);
310+
callback((DEBUGPROCARB)_gl_debug_print, nullptr);
311311
glEnable(_EXT_DEBUG_OUTPUT);
312312
}
313313
}

drivers/gles3/rasterizer_scene_gles3.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3462,21 +3462,21 @@ void RasterizerSceneGLES3::_render_list_template(RenderListParameters *p_params,
34623462
}
34633463

34643464
if (use_wireframe) {
3465-
glDrawElementsInstanced(GL_LINES, count, GL_UNSIGNED_INT, 0, inst->instance_count);
3465+
glDrawElementsInstanced(GL_LINES, count, GL_UNSIGNED_INT, nullptr, inst->instance_count);
34663466
} else {
34673467
if (use_index_buffer) {
3468-
glDrawElementsInstanced(primitive_gl, count, mesh_storage->mesh_surface_get_index_type(mesh_surface), 0, inst->instance_count);
3468+
glDrawElementsInstanced(primitive_gl, count, mesh_storage->mesh_surface_get_index_type(mesh_surface), nullptr, inst->instance_count);
34693469
} else {
34703470
glDrawArraysInstanced(primitive_gl, 0, count, inst->instance_count);
34713471
}
34723472
}
34733473
} else {
34743474
// Using regular Mesh.
34753475
if (use_wireframe) {
3476-
glDrawElements(GL_LINES, count, GL_UNSIGNED_INT, 0);
3476+
glDrawElements(GL_LINES, count, GL_UNSIGNED_INT, nullptr);
34773477
} else {
34783478
if (use_index_buffer) {
3479-
glDrawElements(primitive_gl, count, mesh_storage->mesh_surface_get_index_type(mesh_surface), 0);
3479+
glDrawElements(primitive_gl, count, mesh_storage->mesh_surface_get_index_type(mesh_surface), nullptr);
34803480
} else {
34813481
glDrawArrays(primitive_gl, 0, count);
34823482
}

drivers/gles3/shader_gles3.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -540,7 +540,7 @@ bool ShaderGLES3::_load_from_cache(Version *p_version) {
540540
return false;
541541
#else
542542
#if !defined(ANDROID_ENABLED) && !defined(IOS_ENABLED)
543-
if (RasterizerGLES3::is_gles_over_gl() && (glProgramBinary == NULL)) { // ARB_get_program_binary extension not available.
543+
if (RasterizerGLES3::is_gles_over_gl() && (glProgramBinary == nullptr)) { // ARB_get_program_binary extension not available.
544544
return false;
545545
}
546546
#endif
@@ -627,7 +627,7 @@ void ShaderGLES3::_save_to_cache(Version *p_version) {
627627
#else
628628
ERR_FAIL_COND(!shader_cache_dir_valid);
629629
#if !defined(ANDROID_ENABLED) && !defined(IOS_ENABLED)
630-
if (RasterizerGLES3::is_gles_over_gl() && (glGetProgramBinary == NULL)) { // ARB_get_program_binary extension not available.
630+
if (RasterizerGLES3::is_gles_over_gl() && (glGetProgramBinary == nullptr)) { // ARB_get_program_binary extension not available.
631631
return;
632632
}
633633
#endif

drivers/gles3/storage/texture_storage.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1067,7 +1067,7 @@ Ref<Image> TextureStorage::texture_2d_get(RID p_texture) const {
10671067
glBindFramebuffer(GL_FRAMEBUFFER, temp_framebuffer);
10681068

10691069
glBindTexture(GL_TEXTURE_2D, temp_color_texture);
1070-
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, texture->alloc_width, texture->alloc_height, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
1070+
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, texture->alloc_width, texture->alloc_height, 0, GL_RGBA, GL_UNSIGNED_BYTE, nullptr);
10711071

10721072
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
10731073
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
11391139
glBindFramebuffer(GL_FRAMEBUFFER, temp_framebuffer);
11401140

11411141
glBindTexture(GL_TEXTURE_2D, temp_color_texture);
1142-
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, texture->alloc_width, texture->alloc_height, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
1142+
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, texture->alloc_width, texture->alloc_height, 0, GL_RGBA, GL_UNSIGNED_BYTE, nullptr);
11431143

11441144
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
11451145
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 {
12481248
glBindFramebuffer(GL_FRAMEBUFFER, temp_framebuffer);
12491249

12501250
glBindTexture(GL_TEXTURE_2D, temp_color_texture);
1251-
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, texture->alloc_width, texture->alloc_height, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
1251+
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, texture->alloc_width, texture->alloc_height, 0, GL_RGBA, GL_UNSIGNED_BYTE, nullptr);
12521252

12531253
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
12541254
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);

editor/plugins/version_control_editor_plugin.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -464,7 +464,7 @@ void VersionControlEditorPlugin::_force_push() {
464464
void VersionControlEditorPlugin::_update_opened_tabs() {
465465
Vector<EditorData::EditedScene> open_scenes = EditorNode::get_editor_data().get_edited_scenes();
466466
for (int i = 0; i < open_scenes.size(); i++) {
467-
if (open_scenes[i].root == NULL) {
467+
if (open_scenes[i].root == nullptr) {
468468
continue;
469469
}
470470
EditorNode::get_singleton()->reload_scene(open_scenes[i].path);

modules/ktx/texture_loader_ktx.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ static Ref<Image> load_from_file_access(Ref<FileAccess> f, Error *r_error) {
9090
ktx_stream.destruct = ktx_destruct;
9191
ktx_stream.type = eStreamTypeCustom;
9292
ktx_stream.data.custom_ptr.address = &f;
93-
ktx_stream.data.custom_ptr.allocatorAddress = NULL;
93+
ktx_stream.data.custom_ptr.allocatorAddress = nullptr;
9494
ktx_stream.data.custom_ptr.size = 0;
9595
ktx_stream.readpos = 0;
9696
ktx_stream.closeOnDestruct = false;

0 commit comments

Comments
 (0)