summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2020-04-02 14:41:58 +0200
committerRémi Verschelde <rverschelde@gmail.com>2020-04-02 14:56:01 +0200
commitea7b497065a615b6fd4e165b331f50613a63a329 (patch)
treebe20ea6b308f2a989a76042ae4b7448711891f84
parent058a0afdeca83145d58a95c426dd01216c397ea9 (diff)
Replace more occurrences of NULL with nullptr
-rw-r--r--core/input/input_builders.py2
-rw-r--r--editor/editor_builders.py2
-rw-r--r--gles_builders.py14
-rw-r--r--modules/gdnative/gdnative_builders.py4
-rw-r--r--modules/gdscript/language_server/lsp.hpp6
-rw-r--r--modules/mono/editor/bindings_generator.cpp2
-rw-r--r--platform/windows/display_server_windows.cpp4
-rw-r--r--platform/windows/godot_windows.cpp2
-rw-r--r--scene/3d/camera_3d.cpp17
-rw-r--r--scene/animation/animation_player.cpp13
-rw-r--r--scene/gui/control.cpp6
-rw-r--r--scene/main/canvas_item.cpp1
-rw-r--r--scene/main/viewport.cpp10
13 files changed, 18 insertions, 65 deletions
diff --git a/core/input/input_builders.py b/core/input/input_builders.py
index 6184c5debb..53b90f2073 100644
--- a/core/input/input_builders.py
+++ b/core/input/input_builders.py
@@ -73,7 +73,7 @@ def make_default_controller_mappings(target, source, env):
g.write('\t"{}",\n'.format(mapping))
g.write("#endif\n")
- g.write("\tNULL\n};\n")
+ g.write("\tnullptr\n};\n")
g.close()
diff --git a/editor/editor_builders.py b/editor/editor_builders.py
index 0c9cf91b2f..ea32e24f6e 100644
--- a/editor/editor_builders.py
+++ b/editor/editor_builders.py
@@ -115,7 +115,7 @@ def make_translations_header(target, source, env, category):
g.write(
'\t{{ "{}", {}, {}, _{}_translation_{}_compressed }},\n'.format(x[0], str(x[1]), str(x[2]), category, x[0])
)
- g.write("\t{NULL, 0, 0, NULL}\n")
+ g.write("\t{nullptr, 0, 0, nullptr}\n")
g.write("};\n")
g.write("#endif")
diff --git a/gles_builders.py b/gles_builders.py
index e8928728fa..6ff2f4248b 100644
--- a/gles_builders.py
+++ b/gles_builders.py
@@ -395,7 +395,7 @@ def build_legacygl_header(filename, include, class_suffix, output_attribs, gles2
enum_vals.append(c)
enum_constants.append(x[i])
- strs += "NULL}"
+ strs += "nullptr}"
fd.write(
"\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
conditionals_found.append(x)
fd.write("\t\t};\n\n")
else:
- fd.write("\t\tstatic const char **_conditional_strings=NULL;\n")
+ fd.write("\t\tstatic const char **_conditional_strings=nullptr;\n")
if header_data.uniforms:
@@ -432,7 +432,7 @@ def build_legacygl_header(filename, include, class_suffix, output_attribs, gles2
fd.write('\t\t\t"' + x + '",\n')
fd.write("\t\t};\n\n")
else:
- fd.write("\t\tstatic const char **_uniform_strings=NULL;\n")
+ fd.write("\t\tstatic const char **_uniform_strings=nullptr;\n")
if output_attribs:
if header_data.attributes:
@@ -442,7 +442,7 @@ def build_legacygl_header(filename, include, class_suffix, output_attribs, gles2
fd.write('\t\t\t{"' + x[0] + '",' + x[1] + "},\n")
fd.write("\t\t};\n\n")
else:
- fd.write("\t\tstatic AttributePair *_attribute_pairs=NULL;\n")
+ fd.write("\t\tstatic AttributePair *_attribute_pairs=nullptr;\n")
feedback_count = 0
@@ -464,7 +464,7 @@ def build_legacygl_header(filename, include, class_suffix, output_attribs, gles2
if gles2:
pass
else:
- fd.write("\t\tstatic const Feedback* _feedbacks=NULL;\n")
+ fd.write("\t\tstatic const Feedback* _feedbacks=nullptr;\n")
if header_data.texunits:
fd.write("\t\tstatic TexUnitPair _texunit_pairs[]={\n")
@@ -472,7 +472,7 @@ def build_legacygl_header(filename, include, class_suffix, output_attribs, gles2
fd.write('\t\t\t{"' + x[0] + '",' + x[1] + "},\n")
fd.write("\t\t};\n\n")
else:
- fd.write("\t\tstatic TexUnitPair *_texunit_pairs=NULL;\n")
+ fd.write("\t\tstatic TexUnitPair *_texunit_pairs=nullptr;\n")
if not gles2 and header_data.ubos:
fd.write("\t\tstatic UBOPair _ubo_pairs[]={\n")
@@ -483,7 +483,7 @@ def build_legacygl_header(filename, include, class_suffix, output_attribs, gles2
if gles2:
pass
else:
- fd.write("\t\tstatic UBOPair *_ubo_pairs=NULL;\n")
+ fd.write("\t\tstatic UBOPair *_ubo_pairs=nullptr;\n")
fd.write("\t\tstatic const char _vertex_code[]={\n")
for x in header_data.vertex_lines:
diff --git a/modules/gdnative/gdnative_builders.py b/modules/gdnative/gdnative_builders.py
index d0094fb869..2d84f93d87 100644
--- a/modules/gdnative/gdnative_builders.py
+++ b/modules/gdnative/gdnative_builders.py
@@ -163,7 +163,7 @@ def _build_gdnative_api_struct_source(api):
"\t{" + str(ext["version"]["major"]) + ", " + str(ext["version"]["minor"]) + "},",
"\t"
+ (
- "NULL"
+ "nullptr"
if not ext["next"]
else ("(const godot_gdnative_api_struct *)&" + get_extension_struct_instance_name(name, ext["next"]))
)
@@ -191,7 +191,7 @@ def _build_gdnative_api_struct_source(api):
"\t{" + str(core["version"]["major"]) + ", " + str(core["version"]["minor"]) + "},",
"\t"
+ (
- "NULL"
+ "nullptr"
if not core["next"]
else (
"(const godot_gdnative_api_struct *)& api_{0}_{1}".format(
diff --git a/modules/gdscript/language_server/lsp.hpp b/modules/gdscript/language_server/lsp.hpp
index 914c9742e1..124fcbfed8 100644
--- a/modules/gdscript/language_server/lsp.hpp
+++ b/modules/gdscript/language_server/lsp.hpp
@@ -156,7 +156,7 @@ struct LocationLink {
* Used as the underlined span for mouse interaction. Defaults to the word range at
* the mouse position.
*/
- Range *originSelectionRange = NULL;
+ Range *originSelectionRange = nullptr;
/**
* The target resource identifier of this link.
@@ -1686,8 +1686,8 @@ struct InitializeResult {
struct GodotNativeClassInfo {
String name;
- const DocData::ClassDoc *class_doc = NULL;
- const ClassDB::ClassInfo *class_info = NULL;
+ const DocData::ClassDoc *class_doc = nullptr;
+ const ClassDB::ClassInfo *class_info = nullptr;
Dictionary to_json() {
Dictionary dict;
diff --git a/modules/mono/editor/bindings_generator.cpp b/modules/mono/editor/bindings_generator.cpp
index 6cd10a94f9..438bec993c 100644
--- a/modules/mono/editor/bindings_generator.cpp
+++ b/modules/mono/editor/bindings_generator.cpp
@@ -2187,7 +2187,7 @@ Error BindingsGenerator::_generate_glue_method(const BindingsGenerator::TypeInte
}
p_output.append(CS_PARAM_METHODBIND "->call(" CS_PARAM_INSTANCE ", ");
- p_output.append(p_imethod.arguments.size() ? C_LOCAL_PTRCALL_ARGS ".ptr()" : "NULL");
+ p_output.append(p_imethod.arguments.size() ? C_LOCAL_PTRCALL_ARGS ".ptr()" : "nullptr");
p_output.append(", total_length, vcall_error);\n");
if (!ret_void) {
diff --git a/platform/windows/display_server_windows.cpp b/platform/windows/display_server_windows.cpp
index 01a99df6b4..c637d3588a 100644
--- a/platform/windows/display_server_windows.cpp
+++ b/platform/windows/display_server_windows.cpp
@@ -1364,7 +1364,7 @@ void DisplayServerWindows::cursor_set_custom_image(const RES &p_cursor, CursorSh
GetMaskBitmaps(bitmap, clrTransparent, hAndMask, hXorMask);
- if (NULL == hAndMask || nullptr == hXorMask) {
+ if (nullptr == hAndMask || nullptr == hXorMask) {
memfree(buffer);
DeleteObject(bitmap);
return;
@@ -2445,7 +2445,7 @@ LRESULT DisplayServerWindows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA
case WM_ENTERSIZEMOVE: {
InputFilter::get_singleton()->release_pressed_events();
- move_timer_id = SetTimer(windows[window_id].hWnd, 1, USER_TIMER_MINIMUM, (TIMERPROC)NULL);
+ move_timer_id = SetTimer(windows[window_id].hWnd, 1, USER_TIMER_MINIMUM, (TIMERPROC) nullptr);
} break;
case WM_EXITSIZEMOVE: {
KillTimer(windows[window_id].hWnd, move_timer_id);
diff --git a/platform/windows/godot_windows.cpp b/platform/windows/godot_windows.cpp
index 28884f70d2..2aa928c2a7 100644
--- a/platform/windows/godot_windows.cpp
+++ b/platform/windows/godot_windows.cpp
@@ -176,7 +176,7 @@ int _main() {
wc_argv = CommandLineToArgvW(GetCommandLineW(), &argc);
- if (NULL == wc_argv) {
+ if (nullptr == wc_argv) {
wprintf(L"CommandLineToArgvW failed\n");
return 0;
}
diff --git a/scene/3d/camera_3d.cpp b/scene/3d/camera_3d.cpp
index 30ab4d463b..706c49b43b 100644
--- a/scene/3d/camera_3d.cpp
+++ b/scene/3d/camera_3d.cpp
@@ -413,23 +413,6 @@ Vector3 Camera3D::project_position(const Point2 &p_point, float p_z_depth) const
return get_camera_transform().xform(p);
}
-/*
-void Camera::_camera_make_current(Node *p_camera) {
-
-
- if (p_camera==this) {
- RenderingServer::get_singleton()->viewport_attach_camera(viewport_id,camera);
- active=true;
- } else {
- if (active && p_camera==NULL) {
- //detech camera because no one else will claim it
- RenderingServer::get_singleton()->viewport_attach_camera(viewport_id,RID());
- }
- active=false;
- }
-}
-*/
-
void Camera3D::set_environment(const Ref<Environment> &p_environment) {
environment = p_environment;
diff --git a/scene/animation/animation_player.cpp b/scene/animation/animation_player.cpp
index 00f0dce0d6..b657833a3b 100644
--- a/scene/animation/animation_player.cpp
+++ b/scene/animation/animation_player.cpp
@@ -1242,19 +1242,6 @@ void AnimationPlayer::play(const StringName &p_name, float p_custom_blend, float
bool AnimationPlayer::is_playing() const {
return playing;
- /*
- if (playback.current.from==NULL)
- return false;
-
- float len=playback.current.from->animation->get_length();
- float pos = playback.current.pos;
- bool loop=playback.current.from->animation->has_loop();
- if (!loop && pos >= len) {
- return false;
- };
-
- return true;
- */
}
void AnimationPlayer::set_current_animation(const String &p_anim) {
diff --git a/scene/gui/control.cpp b/scene/gui/control.cpp
index de6233f359..775f863a4f 100644
--- a/scene/gui/control.cpp
+++ b/scene/gui/control.cpp
@@ -561,12 +561,6 @@ void Control::_notification(int p_notification) {
data.parent = nullptr;
data.parent_canvas_item = nullptr;
- /*
- if (data.theme_owner && data.theme.is_null()) {
- data.theme_owner=NULL;
- notification(NOTIFICATION_THEME_CHANGED);
- }
- */
} break;
case NOTIFICATION_MOVED_IN_PARENT: {
diff --git a/scene/main/canvas_item.cpp b/scene/main/canvas_item.cpp
index 6fb5cbacbd..2eacad68c3 100644
--- a/scene/main/canvas_item.cpp
+++ b/scene/main/canvas_item.cpp
@@ -1469,7 +1469,6 @@ CanvasItem::CanvasItem() :
drawing = false;
behind = false;
block_transform_notify = false;
- //viewport=NULL;
canvas_layer = nullptr;
use_parent_material = false;
global_invalid = true;
diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp
index 7b860df352..5fcd4bf009 100644
--- a/scene/main/viewport.cpp
+++ b/scene/main/viewport.cpp
@@ -2506,16 +2506,6 @@ void Viewport::_gui_hid_control(Control *p_control) {
_drop_mouse_focus();
}
- /* ???
- if (data.window==p_control) {
- window->drag_data=Variant();
- if (window->drag_preview) {
- memdelete( window->drag_preview);
- window->drag_preview=NULL;
- }
- }
- */
-
if (gui.key_focus == p_control)
_gui_remove_focus();
if (gui.mouse_over == p_control)