summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.clang-tidy2
-rw-r--r--core/callable.h2
-rw-r--r--core/cowdata.h2
-rw-r--r--core/hash_map.h8
-rw-r--r--core/io/file_access_buffered.h2
-rw-r--r--core/list.h12
-rw-r--r--core/math/face3.h4
-rw-r--r--core/math/geometry.h8
-rw-r--r--core/math/plane.h2
-rw-r--r--core/os/memory.h4
-rw-r--r--core/string_name.h2
-rw-r--r--editor/shader_globals_editor.cpp2
-rw-r--r--main/tests/test_shader_lang.cpp2
-rw-r--r--modules/gdscript/gdscript_function.cpp2
-rw-r--r--modules/mono/csharp_script.cpp2
-rw-r--r--modules/mono/editor/godotsharp_export.cpp2
-rw-r--r--modules/websocket/editor_debugger_server_websocket.cpp2
-rw-r--r--modules/websocket/remote_debugger_peer_websocket.cpp4
-rw-r--r--scene/gui/tree.h2
-rw-r--r--scene/main/shader_globals_override.cpp2
-rw-r--r--servers/rendering/rasterizer_rd/rasterizer_storage_rd.cpp6
21 files changed, 37 insertions, 37 deletions
diff --git a/.clang-tidy b/.clang-tidy
index 6e7b1ba39c..e99b105335 100644
--- a/.clang-tidy
+++ b/.clang-tidy
@@ -1,5 +1,5 @@
---
-Checks: 'clang-diagnostic-*,clang-analyzer-*,-*,modernize-use-default-member-init'
+Checks: 'clang-diagnostic-*,clang-analyzer-*,-*,modernize-use-default-member-init,modernize-use-nullptr'
WarningsAsErrors: ''
HeaderFilterRegex: '.*'
AnalyzeTemporaryDtors: false
diff --git a/core/callable.h b/core/callable.h
index 5fa1ebf1d1..1f6ff48d4f 100644
--- a/core/callable.h
+++ b/core/callable.h
@@ -75,7 +75,7 @@ public:
return method == StringName() && object == 0;
}
_FORCE_INLINE_ bool is_custom() const {
- return method == StringName() && custom != 0;
+ return method == StringName() && custom != nullptr;
}
_FORCE_INLINE_ bool is_standard() const {
return method != StringName();
diff --git a/core/cowdata.h b/core/cowdata.h
index e9cfa2925a..b63a407511 100644
--- a/core/cowdata.h
+++ b/core/cowdata.h
@@ -132,7 +132,7 @@ public:
}
_FORCE_INLINE_ void clear() { resize(0); }
- _FORCE_INLINE_ bool empty() const { return _ptr == 0; }
+ _FORCE_INLINE_ bool empty() const { return _ptr == nullptr; }
_FORCE_INLINE_ void set(int p_index, const T &p_elem) {
diff --git a/core/hash_map.h b/core/hash_map.h
index 4a3bee04c5..cfc0f87010 100644
--- a/core/hash_map.h
+++ b/core/hash_map.h
@@ -107,7 +107,7 @@ private:
hash_table_power = MIN_HASH_TABLE_POWER;
elements = 0;
for (int i = 0; i < (1 << MIN_HASH_TABLE_POWER); i++)
- hash_table[i] = 0;
+ hash_table[i] = nullptr;
}
void erase_hash_table() {
@@ -115,7 +115,7 @@ private:
ERR_FAIL_COND_MSG(elements, "Cannot erase hash table if there are still elements inside.");
memdelete_arr(hash_table);
- hash_table = 0;
+ hash_table = nullptr;
hash_table_power = 0;
elements = 0;
}
@@ -155,7 +155,7 @@ private:
for (int i = 0; i < (1 << new_hash_table_power); i++) {
- new_hash_table[i] = 0;
+ new_hash_table[i] = nullptr;
}
if (hash_table) {
@@ -541,7 +541,7 @@ public:
memdelete_arr(hash_table);
}
- hash_table = 0;
+ hash_table = nullptr;
hash_table_power = 0;
elements = 0;
}
diff --git a/core/io/file_access_buffered.h b/core/io/file_access_buffered.h
index 2832367a8b..f473886330 100644
--- a/core/io/file_access_buffered.h
+++ b/core/io/file_access_buffered.h
@@ -66,7 +66,7 @@ protected:
int offset;
} cache;
- virtual int read_data_block(int p_offset, int p_size, uint8_t *p_dest = 0) const = 0;
+ virtual int read_data_block(int p_offset, int p_size, uint8_t *p_dest = nullptr) const = 0;
void set_cache_size(int p_size);
int get_cache_size();
diff --git a/core/list.h b/core/list.h
index eb74fa7917..7fbf3e50fc 100644
--- a/core/list.h
+++ b/core/list.h
@@ -182,14 +182,14 @@ public:
*/
_FORCE_INLINE_ const Element *front() const {
- return _data ? _data->first : 0;
+ return _data ? _data->first : nullptr;
};
/**
* return an iterator to the beginning of the list.
*/
_FORCE_INLINE_ Element *front() {
- return _data ? _data->first : 0;
+ return _data ? _data->first : nullptr;
};
/**
@@ -197,7 +197,7 @@ public:
*/
_FORCE_INLINE_ const Element *back() const {
- return _data ? _data->last : 0;
+ return _data ? _data->last : nullptr;
};
/**
@@ -205,7 +205,7 @@ public:
*/
_FORCE_INLINE_ Element *back() {
- return _data ? _data->last : 0;
+ return _data ? _data->last : nullptr;
};
/**
@@ -225,7 +225,7 @@ public:
n->value = (T &)value;
n->prev_ptr = _data->last;
- n->next_ptr = 0;
+ n->next_ptr = nullptr;
n->data = _data;
if (_data->last) {
@@ -264,7 +264,7 @@ public:
Element *n = memnew_allocator(Element, A);
n->value = (T &)value;
- n->prev_ptr = 0;
+ n->prev_ptr = nullptr;
n->next_ptr = _data->first;
n->data = _data;
diff --git a/core/math/face3.h b/core/math/face3.h
index f4b8721caa..da269028f5 100644
--- a/core/math/face3.h
+++ b/core/math/face3.h
@@ -69,8 +69,8 @@ public:
Vector3 get_median_point() const;
Vector3 get_closest_point_to(const Vector3 &p_point) const;
- bool intersects_ray(const Vector3 &p_from, const Vector3 &p_dir, Vector3 *p_intersection = 0) const;
- bool intersects_segment(const Vector3 &p_from, const Vector3 &p_dir, Vector3 *p_intersection = 0) const;
+ bool intersects_ray(const Vector3 &p_from, const Vector3 &p_dir, Vector3 *p_intersection = nullptr) const;
+ bool intersects_segment(const Vector3 &p_from, const Vector3 &p_dir, Vector3 *p_intersection = nullptr) const;
ClockDirection get_clock_dir() const; ///< todo, test if this is returning the proper clockwisity
diff --git a/core/math/geometry.h b/core/math/geometry.h
index 45c8558fac..b90cae3786 100644
--- a/core/math/geometry.h
+++ b/core/math/geometry.h
@@ -190,7 +190,7 @@ public:
return dP.length(); // Return the closest distance.
}
- static inline bool ray_intersects_triangle(const Vector3 &p_from, const Vector3 &p_dir, const Vector3 &p_v0, const Vector3 &p_v1, const Vector3 &p_v2, Vector3 *r_res = 0) {
+ static inline bool ray_intersects_triangle(const Vector3 &p_from, const Vector3 &p_dir, const Vector3 &p_v0, const Vector3 &p_v1, const Vector3 &p_v2, Vector3 *r_res = nullptr) {
Vector3 e1 = p_v1 - p_v0;
Vector3 e2 = p_v2 - p_v0;
Vector3 h = p_dir.cross(e2);
@@ -225,7 +225,7 @@ public:
return false;
}
- static inline bool segment_intersects_triangle(const Vector3 &p_from, const Vector3 &p_to, const Vector3 &p_v0, const Vector3 &p_v1, const Vector3 &p_v2, Vector3 *r_res = 0) {
+ static inline bool segment_intersects_triangle(const Vector3 &p_from, const Vector3 &p_to, const Vector3 &p_v0, const Vector3 &p_v1, const Vector3 &p_v2, Vector3 *r_res = nullptr) {
Vector3 rel = p_to - p_from;
Vector3 e1 = p_v1 - p_v0;
@@ -262,7 +262,7 @@ public:
return false;
}
- static inline bool segment_intersects_sphere(const Vector3 &p_from, const Vector3 &p_to, const Vector3 &p_sphere_pos, real_t p_sphere_radius, Vector3 *r_res = 0, Vector3 *r_norm = 0) {
+ static inline bool segment_intersects_sphere(const Vector3 &p_from, const Vector3 &p_to, const Vector3 &p_sphere_pos, real_t p_sphere_radius, Vector3 *r_res = nullptr, Vector3 *r_norm = nullptr) {
Vector3 sphere_pos = p_sphere_pos - p_from;
Vector3 rel = (p_to - p_from);
@@ -298,7 +298,7 @@ public:
return true;
}
- static inline bool segment_intersects_cylinder(const Vector3 &p_from, const Vector3 &p_to, real_t p_height, real_t p_radius, Vector3 *r_res = 0, Vector3 *r_norm = 0) {
+ static inline bool segment_intersects_cylinder(const Vector3 &p_from, const Vector3 &p_to, real_t p_height, real_t p_radius, Vector3 *r_res = nullptr, Vector3 *r_norm = nullptr) {
Vector3 rel = (p_to - p_from);
real_t rel_l = rel.length();
diff --git a/core/math/plane.h b/core/math/plane.h
index f91f816556..f4f205465f 100644
--- a/core/math/plane.h
+++ b/core/math/plane.h
@@ -56,7 +56,7 @@ public:
/* intersections */
- bool intersect_3(const Plane &p_plane1, const Plane &p_plane2, Vector3 *r_result = 0) const;
+ bool intersect_3(const Plane &p_plane1, const Plane &p_plane2, Vector3 *r_result = nullptr) const;
bool intersects_ray(const Vector3 &p_from, const Vector3 &p_dir, Vector3 *p_intersection) const;
bool intersects_segment(const Vector3 &p_begin, const Vector3 &p_end, Vector3 *p_intersection) const;
diff --git a/core/os/memory.h b/core/os/memory.h
index 0588e47289..03c6a80e89 100644
--- a/core/os/memory.h
+++ b/core/os/memory.h
@@ -142,13 +142,13 @@ template <typename T>
T *memnew_arr_template(size_t p_elements, const char *p_descr = "") {
if (p_elements == 0)
- return 0;
+ return nullptr;
/** overloading operator new[] cannot be done , because it may not return the real allocated address (it may pad the 'element count' before the actual array). Because of that, it must be done by hand. This is the
same strategy used by std::vector, and the Vector class, so it should be safe.*/
size_t len = sizeof(T) * p_elements;
uint64_t *mem = (uint64_t *)Memory::alloc_static(len, true);
- T *failptr = 0; //get rid of a warning
+ T *failptr = nullptr; //get rid of a warning
ERR_FAIL_COND_V(!mem, failptr);
*(mem - 1) = p_elements;
diff --git a/core/string_name.h b/core/string_name.h
index 5f69f3a235..762eb43610 100644
--- a/core/string_name.h
+++ b/core/string_name.h
@@ -85,7 +85,7 @@ class StringName {
StringName(_Data *p_data) { _data = p_data; }
public:
- operator const void *() const { return (_data && (_data->cname || !_data->name.empty())) ? (void *)1 : 0; }
+ operator const void *() const { return (_data && (_data->cname || !_data->name.empty())) ? (void *)1 : nullptr; }
bool operator==(const String &p_name) const;
bool operator==(const char *p_name) const;
diff --git a/editor/shader_globals_editor.cpp b/editor/shader_globals_editor.cpp
index 6bf9c5ffae..a013ba2ad3 100644
--- a/editor/shader_globals_editor.cpp
+++ b/editor/shader_globals_editor.cpp
@@ -477,6 +477,6 @@ ShaderGlobalsEditor::ShaderGlobalsEditor() {
interface->connect("var_changed", Callable(this, "_changed"));
}
ShaderGlobalsEditor::~ShaderGlobalsEditor() {
- inspector->edit(NULL);
+ inspector->edit(nullptr);
memdelete(interface);
}
diff --git a/main/tests/test_shader_lang.cpp b/main/tests/test_shader_lang.cpp
index b7967238a2..abcf30c97f 100644
--- a/main/tests/test_shader_lang.cpp
+++ b/main/tests/test_shader_lang.cpp
@@ -363,7 +363,7 @@ MainLoop *test() {
Set<String> types;
types.insert("spatial");
- Error err = sl.compile(code, dt, rm, types, NULL);
+ Error err = sl.compile(code, dt, rm, types, nullptr);
if (err) {
diff --git a/modules/gdscript/gdscript_function.cpp b/modules/gdscript/gdscript_function.cpp
index df0fac956c..4e31ffe2a4 100644
--- a/modules/gdscript/gdscript_function.cpp
+++ b/modules/gdscript/gdscript_function.cpp
@@ -1289,7 +1289,7 @@ Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_a
gdfs->state.instance = p_instance;
p_instance->pending_func_states.add(&gdfs->instances_list);
} else {
- gdfs->state.instance = NULL;
+ gdfs->state.instance = nullptr;
}
}
#ifdef DEBUG_ENABLED
diff --git a/modules/mono/csharp_script.cpp b/modules/mono/csharp_script.cpp
index 7d00d2d314..43c86d3e28 100644
--- a/modules/mono/csharp_script.cpp
+++ b/modules/mono/csharp_script.cpp
@@ -295,7 +295,7 @@ void CSharpLanguage::get_reserved_words(List<String> *p_words) const {
"when",
"where",
"yield",
- 0
+ nullptr
};
const char **w = _reserved_words;
diff --git a/modules/mono/editor/godotsharp_export.cpp b/modules/mono/editor/godotsharp_export.cpp
index d6a271f1d9..1cdb08d50e 100644
--- a/modules/mono/editor/godotsharp_export.cpp
+++ b/modules/mono/editor/godotsharp_export.cpp
@@ -78,7 +78,7 @@ Error get_assembly_dependencies(GDMonoAssembly *p_assembly, const Vector<String>
if (r_assembly_dependencies.has(ref_name))
continue;
- GDMonoAssembly *ref_assembly = NULL;
+ GDMonoAssembly *ref_assembly = nullptr;
{
MonoAssemblyName *ref_aname = mono_assembly_name_new("A"); // We can't allocate an empty MonoAssemblyName, hence "A"
diff --git a/modules/websocket/editor_debugger_server_websocket.cpp b/modules/websocket/editor_debugger_server_websocket.cpp
index cc8507227e..0cf78eaa9e 100644
--- a/modules/websocket/editor_debugger_server_websocket.cpp
+++ b/modules/websocket/editor_debugger_server_websocket.cpp
@@ -87,6 +87,6 @@ EditorDebuggerServerWebSocket::~EditorDebuggerServerWebSocket() {
}
EditorDebuggerServer *EditorDebuggerServerWebSocket::create(const String &p_protocol) {
- ERR_FAIL_COND_V(p_protocol != "ws://", NULL);
+ ERR_FAIL_COND_V(p_protocol != "ws://", nullptr);
return memnew(EditorDebuggerServerWebSocket);
}
diff --git a/modules/websocket/remote_debugger_peer_websocket.cpp b/modules/websocket/remote_debugger_peer_websocket.cpp
index f132b58e05..d156a39f53 100644
--- a/modules/websocket/remote_debugger_peer_websocket.cpp
+++ b/modules/websocket/remote_debugger_peer_websocket.cpp
@@ -123,12 +123,12 @@ RemoteDebuggerPeerWebSocket::RemoteDebuggerPeerWebSocket(Ref<WebSocketPeer> p_pe
}
RemoteDebuggerPeer *RemoteDebuggerPeerWebSocket::create(const String &p_uri) {
- ERR_FAIL_COND_V(!p_uri.begins_with("ws://") && !p_uri.begins_with("wss://"), NULL);
+ ERR_FAIL_COND_V(!p_uri.begins_with("ws://") && !p_uri.begins_with("wss://"), nullptr);
RemoteDebuggerPeerWebSocket *peer = memnew(RemoteDebuggerPeerWebSocket);
Error err = peer->connect_to_host(p_uri);
if (err != OK) {
memdelete(peer);
- return NULL;
+ return nullptr;
}
return peer;
}
diff --git a/scene/gui/tree.h b/scene/gui/tree.h
index 87c2588a12..3c67a79558 100644
--- a/scene/gui/tree.h
+++ b/scene/gui/tree.h
@@ -544,7 +544,7 @@ public:
void clear();
- TreeItem *create_item(TreeItem *p_parent = 0, int p_idx = -1);
+ TreeItem *create_item(TreeItem *p_parent = nullptr, int p_idx = -1);
TreeItem *get_root();
TreeItem *get_last_item();
diff --git a/scene/main/shader_globals_override.cpp b/scene/main/shader_globals_override.cpp
index 823892a86a..272cea8f2b 100644
--- a/scene/main/shader_globals_override.cpp
+++ b/scene/main/shader_globals_override.cpp
@@ -206,7 +206,7 @@ void ShaderGlobalsOverride::_get_property_list(List<PropertyInfo> *p_list) const
Override o;
o.in_use = false;
Callable::CallError ce;
- o.override = Variant::construct(pinfo.type, NULL, 0, ce);
+ o.override = Variant::construct(pinfo.type, nullptr, 0, ce);
overrides[variables[i]] = o;
}
diff --git a/servers/rendering/rasterizer_rd/rasterizer_storage_rd.cpp b/servers/rendering/rasterizer_rd/rasterizer_storage_rd.cpp
index 0203293a76..8a2073dc43 100644
--- a/servers/rendering/rasterizer_rd/rasterizer_storage_rd.cpp
+++ b/servers/rendering/rasterizer_rd/rasterizer_storage_rd.cpp
@@ -4896,7 +4896,7 @@ void RasterizerStorageRD::_update_decal_atlas() {
Vector<DecalAtlas::SortItem> itemsv;
itemsv.resize(decal_atlas.textures.size());
int base_size = 8;
- const RID *K = NULL;
+ const RID *K = nullptr;
int idx = 0;
while ((K = decal_atlas.textures.next(K))) {
@@ -5050,7 +5050,7 @@ void RasterizerStorageRD::_update_decal_atlas() {
RD::DrawListID draw_list = RD::get_singleton()->draw_list_begin(mm.fb, RD::INITIAL_ACTION_CLEAR, RD::FINAL_ACTION_READ, RD::INITIAL_ACTION_DROP, RD::FINAL_ACTION_DISCARD, cc);
- const RID *K = NULL;
+ const RID *K = nullptr;
while ((K = decal_atlas.textures.next(K))) {
DecalAtlas::Texture *t = decal_atlas.textures.getptr(*K);
Texture *src_tex = texture_owner.getornull(*K);
@@ -5459,7 +5459,7 @@ Vector<StringName> RasterizerStorageRD::global_variable_get_list() const {
ERR_FAIL_V_MSG(Vector<StringName>(), "This function should never be used outside the editor, it can severely damage performance.");
}
- const StringName *K = NULL;
+ const StringName *K = nullptr;
Vector<StringName> names;
while ((K = global_variables.variables.next(K))) {
names.push_back(*K);