Skip to content

Commit

Permalink
Merge pull request #48454 from akien-mga/3.x-style-changes
Browse files Browse the repository at this point in the history
  • Loading branch information
akien-mga authored May 4, 2021
2 parents 2b429b2 + 0c8b5b5 commit 60eb2d8
Show file tree
Hide file tree
Showing 646 changed files with 4,534 additions and 4,490 deletions.
44 changes: 44 additions & 0 deletions .clang-tidy
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
---
Checks: 'clang-diagnostic-*,clang-analyzer-*,-*,modernize-redundant-void-arg,modernize-use-bool-literals,modernize-use-nullptr'
WarningsAsErrors: ''
HeaderFilterRegex: '.*'
AnalyzeTemporaryDtors: false
FormatStyle: none
CheckOptions:
CheckOptions:
- key: cert-dcl16-c.NewSuffixes
value: 'L;LL;LU;LLU'
- key: cert-oop54-cpp.WarnOnlyIfThisHasSuspiciousField
value: '0'
- key: cppcoreguidelines-explicit-virtual-functions.IgnoreDestructors
value: '1'
- key: cppcoreguidelines-non-private-member-variables-in-classes.IgnoreClassesWithAllMemberVariablesBeingPublic
value: '1'
- key: google-readability-function-size.StatementThreshold
value: '800'
- key: google-readability-namespace-comments.ShortNamespaceLines
value: '10'
- key: google-readability-namespace-comments.SpacesBeforeComments
value: '2'
- key: modernize-loop-convert.MaxCopySize
value: '16'
- key: modernize-loop-convert.MinConfidence
value: reasonable
- key: modernize-loop-convert.NamingStyle
value: CamelCase
- key: modernize-pass-by-value.IncludeStyle
value: llvm
- key: modernize-replace-auto-ptr.IncludeStyle
value: llvm
- key: modernize-use-bool-literals.IgnoreMacros
value: '0'
- key: modernize-use-default-member-init.IgnoreMacros
value: '0'
- key: modernize-use-default-member-init.UseAssignment
value: '1'
- key: modernize-use-nullptr.NullMacros
value: 'NULL'
- key: readability-braces-around-statements.ShortStatementLines
value: '0'
...

4 changes: 2 additions & 2 deletions core/array.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ void Array::_unref() const {
if (_p->refcount.unref()) {
memdelete(_p);
}
_p = NULL;
_p = nullptr;
}

Variant &Array::operator[](int p_idx) {
Expand Down Expand Up @@ -419,7 +419,7 @@ const void *Array::id() const {
}

Array::Array(const Array &p_from) {
_p = NULL;
_p = nullptr;
_ref(p_from);
}

Expand Down
32 changes: 16 additions & 16 deletions core/bind/core_bind.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ static const unsigned int MONTH_DAYS_TABLE[2][12] = {
{ 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }
};

_ResourceLoader *_ResourceLoader::singleton = NULL;
_ResourceLoader *_ResourceLoader::singleton = nullptr;

Ref<ResourceInteractiveLoader> _ResourceLoader::load_interactive(const String &p_path, const String &p_type_hint) {
return ResourceLoader::load_interactive(p_path, p_type_hint);
Expand Down Expand Up @@ -152,7 +152,7 @@ PoolVector<String> _ResourceSaver::get_recognized_extensions(const RES &p_resour
return ret;
}

_ResourceSaver *_ResourceSaver::singleton = NULL;
_ResourceSaver *_ResourceSaver::singleton = nullptr;

void _ResourceSaver::_bind_methods() {
ClassDB::bind_method(D_METHOD("save", "path", "resource", "flags"), &_ResourceSaver::save, DEFVAL(0));
Expand Down Expand Up @@ -1147,7 +1147,7 @@ void _OS::set_current_tablet_driver(const String &p_driver) {
OS::get_singleton()->set_current_tablet_driver(p_driver);
}

_OS *_OS::singleton = NULL;
_OS *_OS::singleton = nullptr;

void _OS::_bind_methods() {
//ClassDB::bind_method(D_METHOD("get_mouse_position"),&_OS::get_mouse_position);
Expand Down Expand Up @@ -1462,7 +1462,7 @@ _OS::_OS() {

///////////////////// GEOMETRY

_Geometry *_Geometry::singleton = NULL;
_Geometry *_Geometry::singleton = nullptr;

_Geometry *_Geometry::get_singleton() {
return singleton;
Expand Down Expand Up @@ -1869,10 +1869,10 @@ void _File::flush() {
void _File::close() {
if (f)
memdelete(f);
f = NULL;
f = nullptr;
}
bool _File::is_open() const {
return f != NULL;
return f != nullptr;
}
String _File::get_path() const {
ERR_FAIL_COND_V_MSG(!f, "", "File must be opened before use.");
Expand Down Expand Up @@ -2101,7 +2101,7 @@ bool _File::file_exists(const String &p_name) const {
void _File::store_var(const Variant &p_var, bool p_full_objects) {
ERR_FAIL_COND_MSG(!f, "File must be opened before use.");
int len;
Error err = encode_variant(p_var, NULL, len, p_full_objects);
Error err = encode_variant(p_var, nullptr, len, p_full_objects);
ERR_FAIL_COND_MSG(err != OK, "Error when trying to encode Variant.");

PoolVector<uint8_t> buff;
Expand All @@ -2125,7 +2125,7 @@ Variant _File::get_var(bool p_allow_objects) const {
PoolVector<uint8_t>::Read r = buff.read();

Variant v;
Error err = decode_variant(v, &r[0], len, NULL, p_allow_objects);
Error err = decode_variant(v, &r[0], len, nullptr, p_allow_objects);
ERR_FAIL_COND_V_MSG(err != OK, Variant(), "Error when trying to encode Variant.");

return v;
Expand Down Expand Up @@ -2202,7 +2202,7 @@ void _File::_bind_methods() {
}

_File::_File() {
f = NULL;
f = nullptr;
eswap = false;
}

Expand Down Expand Up @@ -2384,15 +2384,15 @@ _Directory::~_Directory() {
memdelete(d);
}

_Marshalls *_Marshalls::singleton = NULL;
_Marshalls *_Marshalls::singleton = nullptr;

_Marshalls *_Marshalls::get_singleton() {
return singleton;
}

String _Marshalls::variant_to_base64(const Variant &p_var, bool p_full_objects) {
int len;
Error err = encode_variant(p_var, NULL, len, p_full_objects);
Error err = encode_variant(p_var, nullptr, len, p_full_objects);
ERR_FAIL_COND_V_MSG(err != OK, "", "Error when trying to encode Variant.");

PoolVector<uint8_t> buff;
Expand Down Expand Up @@ -2420,7 +2420,7 @@ Variant _Marshalls::base64_to_variant(const String &p_str, bool p_allow_objects)
ERR_FAIL_COND_V(CryptoCore::b64_decode(&w[0], buf.size(), &len, (unsigned char *)cstr.get_data(), strlen) != OK, Variant());

Variant v;
Error err = decode_variant(v, &w[0], len, NULL, p_allow_objects);
Error err = decode_variant(v, &w[0], len, nullptr, p_allow_objects);
ERR_FAIL_COND_V_MSG(err != OK, Variant(), "Error when trying to decode Variant.");

return v;
Expand Down Expand Up @@ -2589,7 +2589,7 @@ Variant _Thread::wait_to_finish() {
thread.wait_to_finish();
Variant r = ret;
target_method = StringName();
target_instance = NULL;
target_instance = nullptr;
userdata = Variant();
active.clear();

Expand All @@ -2607,7 +2607,7 @@ void _Thread::_bind_methods() {
BIND_ENUM_CONSTANT(PRIORITY_HIGH);
}
_Thread::_Thread() {
target_instance = NULL;
target_instance = nullptr;
}

_Thread::~_Thread() {
Expand Down Expand Up @@ -2951,7 +2951,7 @@ void _Engine::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::REAL, "physics_jitter_fix"), "set_physics_jitter_fix", "get_physics_jitter_fix");
}

_Engine *_Engine::singleton = NULL;
_Engine *_Engine::singleton = nullptr;

_Engine::_Engine() {
singleton = this;
Expand Down Expand Up @@ -3027,7 +3027,7 @@ Ref<JSONParseResult> _JSON::parse(const String &p_json) {
return result;
}

_JSON *_JSON::singleton = NULL;
_JSON *_JSON::singleton = nullptr;

_JSON::_JSON() {
singleton = this;
Expand Down
2 changes: 1 addition & 1 deletion core/bind/core_bind.h
Original file line number Diff line number Diff line change
Expand Up @@ -644,7 +644,7 @@ class _Marshalls : public Object {
String base64_to_utf8(const String &p_str);

_Marshalls() { singleton = this; }
~_Marshalls() { singleton = NULL; }
~_Marshalls() { singleton = nullptr; }
};

class _Mutex : public Reference {
Expand Down
Loading

0 comments on commit 60eb2d8

Please sign in to comment.