Skip to content

Commit ea7b497

Browse files
committedApr 2, 2020
Replace more occurrences of NULL with nullptr
1 parent 058a0af commit ea7b497

File tree

13 files changed

+18
-65
lines changed

13 files changed

+18
-65
lines changed
 

‎core/input/input_builders.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ def make_default_controller_mappings(target, source, env):
7373
g.write('\t"{}",\n'.format(mapping))
7474
g.write("#endif\n")
7575

76-
g.write("\tNULL\n};\n")
76+
g.write("\tnullptr\n};\n")
7777
g.close()
7878

7979

‎editor/editor_builders.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ def make_translations_header(target, source, env, category):
115115
g.write(
116116
'\t{{ "{}", {}, {}, _{}_translation_{}_compressed }},\n'.format(x[0], str(x[1]), str(x[2]), category, x[0])
117117
)
118-
g.write("\t{NULL, 0, 0, NULL}\n")
118+
g.write("\t{nullptr, 0, 0, nullptr}\n")
119119
g.write("};\n")
120120

121121
g.write("#endif")

‎gles_builders.py

+7-7
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,7 @@ def build_legacygl_header(filename, include, class_suffix, output_attribs, gles2
395395
enum_vals.append(c)
396396
enum_constants.append(x[i])
397397

398-
strs += "NULL}"
398+
strs += "nullptr}"
399399

400400
fd.write(
401401
"\t\t\t{(uint64_t(1<<" + str(bits) + ")-1)<<" + str(bitofs) + "," + str(bitofs) + "," + strs + "},\n"
@@ -422,7 +422,7 @@ def build_legacygl_header(filename, include, class_suffix, output_attribs, gles2
422422
conditionals_found.append(x)
423423
fd.write("\t\t};\n\n")
424424
else:
425-
fd.write("\t\tstatic const char **_conditional_strings=NULL;\n")
425+
fd.write("\t\tstatic const char **_conditional_strings=nullptr;\n")
426426

427427
if header_data.uniforms:
428428

@@ -432,7 +432,7 @@ def build_legacygl_header(filename, include, class_suffix, output_attribs, gles2
432432
fd.write('\t\t\t"' + x + '",\n')
433433
fd.write("\t\t};\n\n")
434434
else:
435-
fd.write("\t\tstatic const char **_uniform_strings=NULL;\n")
435+
fd.write("\t\tstatic const char **_uniform_strings=nullptr;\n")
436436

437437
if output_attribs:
438438
if header_data.attributes:
@@ -442,7 +442,7 @@ def build_legacygl_header(filename, include, class_suffix, output_attribs, gles2
442442
fd.write('\t\t\t{"' + x[0] + '",' + x[1] + "},\n")
443443
fd.write("\t\t};\n\n")
444444
else:
445-
fd.write("\t\tstatic AttributePair *_attribute_pairs=NULL;\n")
445+
fd.write("\t\tstatic AttributePair *_attribute_pairs=nullptr;\n")
446446

447447
feedback_count = 0
448448

@@ -464,15 +464,15 @@ def build_legacygl_header(filename, include, class_suffix, output_attribs, gles2
464464
if gles2:
465465
pass
466466
else:
467-
fd.write("\t\tstatic const Feedback* _feedbacks=NULL;\n")
467+
fd.write("\t\tstatic const Feedback* _feedbacks=nullptr;\n")
468468

469469
if header_data.texunits:
470470
fd.write("\t\tstatic TexUnitPair _texunit_pairs[]={\n")
471471
for x in header_data.texunits:
472472
fd.write('\t\t\t{"' + x[0] + '",' + x[1] + "},\n")
473473
fd.write("\t\t};\n\n")
474474
else:
475-
fd.write("\t\tstatic TexUnitPair *_texunit_pairs=NULL;\n")
475+
fd.write("\t\tstatic TexUnitPair *_texunit_pairs=nullptr;\n")
476476

477477
if not gles2 and header_data.ubos:
478478
fd.write("\t\tstatic UBOPair _ubo_pairs[]={\n")
@@ -483,7 +483,7 @@ def build_legacygl_header(filename, include, class_suffix, output_attribs, gles2
483483
if gles2:
484484
pass
485485
else:
486-
fd.write("\t\tstatic UBOPair *_ubo_pairs=NULL;\n")
486+
fd.write("\t\tstatic UBOPair *_ubo_pairs=nullptr;\n")
487487

488488
fd.write("\t\tstatic const char _vertex_code[]={\n")
489489
for x in header_data.vertex_lines:

‎modules/gdnative/gdnative_builders.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ def get_extension_struct_definition(name, ext, include_version=True):
163163
"\t{" + str(ext["version"]["major"]) + ", " + str(ext["version"]["minor"]) + "},",
164164
"\t"
165165
+ (
166-
"NULL"
166+
"nullptr"
167167
if not ext["next"]
168168
else ("(const godot_gdnative_api_struct *)&" + get_extension_struct_instance_name(name, ext["next"]))
169169
)
@@ -191,7 +191,7 @@ def get_core_struct_definition(core):
191191
"\t{" + str(core["version"]["major"]) + ", " + str(core["version"]["minor"]) + "},",
192192
"\t"
193193
+ (
194-
"NULL"
194+
"nullptr"
195195
if not core["next"]
196196
else (
197197
"(const godot_gdnative_api_struct *)& api_{0}_{1}".format(

‎modules/gdscript/language_server/lsp.hpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ struct LocationLink {
156156
* Used as the underlined span for mouse interaction. Defaults to the word range at
157157
* the mouse position.
158158
*/
159-
Range *originSelectionRange = NULL;
159+
Range *originSelectionRange = nullptr;
160160

161161
/**
162162
* The target resource identifier of this link.
@@ -1686,8 +1686,8 @@ struct InitializeResult {
16861686
struct GodotNativeClassInfo {
16871687

16881688
String name;
1689-
const DocData::ClassDoc *class_doc = NULL;
1690-
const ClassDB::ClassInfo *class_info = NULL;
1689+
const DocData::ClassDoc *class_doc = nullptr;
1690+
const ClassDB::ClassInfo *class_info = nullptr;
16911691

16921692
Dictionary to_json() {
16931693
Dictionary dict;

‎modules/mono/editor/bindings_generator.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -2187,7 +2187,7 @@ Error BindingsGenerator::_generate_glue_method(const BindingsGenerator::TypeInte
21872187
}
21882188

21892189
p_output.append(CS_PARAM_METHODBIND "->call(" CS_PARAM_INSTANCE ", ");
2190-
p_output.append(p_imethod.arguments.size() ? C_LOCAL_PTRCALL_ARGS ".ptr()" : "NULL");
2190+
p_output.append(p_imethod.arguments.size() ? C_LOCAL_PTRCALL_ARGS ".ptr()" : "nullptr");
21912191
p_output.append(", total_length, vcall_error);\n");
21922192

21932193
if (!ret_void) {

‎platform/windows/display_server_windows.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -1364,7 +1364,7 @@ void DisplayServerWindows::cursor_set_custom_image(const RES &p_cursor, CursorSh
13641364

13651365
GetMaskBitmaps(bitmap, clrTransparent, hAndMask, hXorMask);
13661366

1367-
if (NULL == hAndMask || nullptr == hXorMask) {
1367+
if (nullptr == hAndMask || nullptr == hXorMask) {
13681368
memfree(buffer);
13691369
DeleteObject(bitmap);
13701370
return;
@@ -2445,7 +2445,7 @@ LRESULT DisplayServerWindows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA
24452445

24462446
case WM_ENTERSIZEMOVE: {
24472447
InputFilter::get_singleton()->release_pressed_events();
2448-
move_timer_id = SetTimer(windows[window_id].hWnd, 1, USER_TIMER_MINIMUM, (TIMERPROC)NULL);
2448+
move_timer_id = SetTimer(windows[window_id].hWnd, 1, USER_TIMER_MINIMUM, (TIMERPROC) nullptr);
24492449
} break;
24502450
case WM_EXITSIZEMOVE: {
24512451
KillTimer(windows[window_id].hWnd, move_timer_id);

‎platform/windows/godot_windows.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ int _main() {
176176

177177
wc_argv = CommandLineToArgvW(GetCommandLineW(), &argc);
178178

179-
if (NULL == wc_argv) {
179+
if (nullptr == wc_argv) {
180180
wprintf(L"CommandLineToArgvW failed\n");
181181
return 0;
182182
}

‎scene/3d/camera_3d.cpp

-17
Original file line numberDiff line numberDiff line change
@@ -413,23 +413,6 @@ Vector3 Camera3D::project_position(const Point2 &p_point, float p_z_depth) const
413413
return get_camera_transform().xform(p);
414414
}
415415

416-
/*
417-
void Camera::_camera_make_current(Node *p_camera) {
418-
419-
420-
if (p_camera==this) {
421-
RenderingServer::get_singleton()->viewport_attach_camera(viewport_id,camera);
422-
active=true;
423-
} else {
424-
if (active && p_camera==NULL) {
425-
//detech camera because no one else will claim it
426-
RenderingServer::get_singleton()->viewport_attach_camera(viewport_id,RID());
427-
}
428-
active=false;
429-
}
430-
}
431-
*/
432-
433416
void Camera3D::set_environment(const Ref<Environment> &p_environment) {
434417

435418
environment = p_environment;

‎scene/animation/animation_player.cpp

-13
Original file line numberDiff line numberDiff line change
@@ -1242,19 +1242,6 @@ void AnimationPlayer::play(const StringName &p_name, float p_custom_blend, float
12421242
bool AnimationPlayer::is_playing() const {
12431243

12441244
return playing;
1245-
/*
1246-
if (playback.current.from==NULL)
1247-
return false;
1248-
1249-
float len=playback.current.from->animation->get_length();
1250-
float pos = playback.current.pos;
1251-
bool loop=playback.current.from->animation->has_loop();
1252-
if (!loop && pos >= len) {
1253-
return false;
1254-
};
1255-
1256-
return true;
1257-
*/
12581245
}
12591246

12601247
void AnimationPlayer::set_current_animation(const String &p_anim) {

‎scene/gui/control.cpp

-6
Original file line numberDiff line numberDiff line change
@@ -561,12 +561,6 @@ void Control::_notification(int p_notification) {
561561

562562
data.parent = nullptr;
563563
data.parent_canvas_item = nullptr;
564-
/*
565-
if (data.theme_owner && data.theme.is_null()) {
566-
data.theme_owner=NULL;
567-
notification(NOTIFICATION_THEME_CHANGED);
568-
}
569-
*/
570564

571565
} break;
572566
case NOTIFICATION_MOVED_IN_PARENT: {

‎scene/main/canvas_item.cpp

-1
Original file line numberDiff line numberDiff line change
@@ -1469,7 +1469,6 @@ CanvasItem::CanvasItem() :
14691469
drawing = false;
14701470
behind = false;
14711471
block_transform_notify = false;
1472-
//viewport=NULL;
14731472
canvas_layer = nullptr;
14741473
use_parent_material = false;
14751474
global_invalid = true;

‎scene/main/viewport.cpp

-10
Original file line numberDiff line numberDiff line change
@@ -2506,16 +2506,6 @@ void Viewport::_gui_hid_control(Control *p_control) {
25062506
_drop_mouse_focus();
25072507
}
25082508

2509-
/* ???
2510-
if (data.window==p_control) {
2511-
window->drag_data=Variant();
2512-
if (window->drag_preview) {
2513-
memdelete( window->drag_preview);
2514-
window->drag_preview=NULL;
2515-
}
2516-
}
2517-
*/
2518-
25192509
if (gui.key_focus == p_control)
25202510
_gui_remove_focus();
25212511
if (gui.mouse_over == p_control)

0 commit comments

Comments
 (0)
Please sign in to comment.