2
0
Эх сурвалжийг харах

Port member initialization from constructor to declaration (C++11)

Using `clang-tidy`'s `modernize-use-default-member-init` check and
manual review of the changes, and some extra manual changes that
`clang-tidy` failed to do.

Also went manually through all of `core` to find occurrences that
`clang-tidy` couldn't handle, especially all initializations done
in a constructor without using initializer lists.
Rémi Verschelde 5 жил өмнө
parent
commit
1f6f364a56
100 өөрчлөгдсөн 465 нэмэгдсэн , 1055 устгасан
  1. 42 0
      .clang-tidy
  2. 16 98
      core/bind/core_bind.cpp
  3. 18 19
      core/bind/core_bind.h
  4. 3 7
      core/callable.cpp
  5. 4 4
      core/callable.h
  6. 0 13
      core/class_db.cpp
  7. 10 8
      core/class_db.h
  8. 2 10
      core/color.h
  9. 0 13
      core/command_queue_mt.cpp
  10. 8 8
      core/command_queue_mt.h
  11. 0 3
      core/compressed_translation.cpp
  12. 1 1
      core/compressed_translation.h
  13. 2 8
      core/cowdata.h
  14. 0 3
      core/crypto/crypto.cpp
  15. 3 4
      core/crypto/crypto.h
  16. 0 4
      core/crypto/hashing_context.cpp
  17. 2 2
      core/crypto/hashing_context.h
  18. 8 23
      core/debugger/debugger_marshalls.h
  19. 1 17
      core/engine.cpp
  20. 18 18
      core/engine.h
  21. 4 8
      core/error_macros.h
  22. 0 3
      core/func_ref.cpp
  23. 2 1
      core/func_ref.h
  24. 7 17
      core/hash_map.h
  25. 0 11
      core/image.cpp
  26. 7 7
      core/image.h
  27. 0 10
      core/input/input.cpp
  28. 17 31
      core/input/input.h
  29. 16 104
      core/input/input_event.cpp
  30. 54 55
      core/input/input_event.h
  31. 1 1
      core/io/compression.h
  32. 1 3
      core/io/dtls_server.cpp
  33. 1 1
      core/io/dtls_server.h
  34. 0 8
      core/io/file_access_buffered.cpp
  35. 3 3
      core/io/file_access_buffered.h
  36. 1 9
      core/io/file_access_buffered_fa.h
  37. 0 19
      core/io/file_access_compressed.cpp
  38. 18 18
      core/io/file_access_compressed.h
  39. 0 9
      core/io/file_access_encrypted.cpp
  40. 6 6
      core/io/file_access_encrypted.h
  41. 0 5
      core/io/file_access_memory.cpp
  42. 2 2
      core/io/file_access_memory.h
  43. 0 12
      core/io/file_access_network.cpp
  44. 13 17
      core/io/file_access_network.h
  45. 0 7
      core/io/file_access_pack.cpp
  46. 8 11
      core/io/file_access_pack.h
  47. 2 6
      core/io/file_access_zip.cpp
  48. 3 6
      core/io/file_access_zip.h
  49. 1 18
      core/io/http_client.cpp
  50. 16 16
      core/io/http_client.h
  51. 1 6
      core/io/logger.cpp
  52. 3 3
      core/io/logger.h
  53. 0 3
      core/io/marshalls.cpp
  54. 1 1
      core/io/marshalls.h
  55. 2 4
      core/io/multiplayer_api.cpp
  56. 3 3
      core/io/multiplayer_api.h
  57. 0 3
      core/io/networked_multiplayer_peer.cpp
  58. 1 1
      core/io/networked_multiplayer_peer.h
  59. 0 5
      core/io/packet_peer.cpp
  60. 3 3
      core/io/packet_peer.h
  61. 0 3
      core/io/packet_peer_dtls.cpp
  62. 1 1
      core/io/packet_peer_dtls.h
  63. 0 6
      core/io/packet_peer_udp.cpp
  64. 6 6
      core/io/packet_peer_udp.h
  65. 0 5
      core/io/pck_packer.cpp
  66. 2 2
      core/io/pck_packer.h
  67. 0 13
      core/io/resource_format_binary.cpp
  68. 9 9
      core/io/resource_format_binary.h
  69. 0 1
      core/io/resource_loader.cpp
  70. 0 5
      core/io/stream_peer.cpp
  71. 4 4
      core/io/stream_peer.h
  72. 0 4
      core/io/stream_peer_ssl.cpp
  73. 2 2
      core/io/stream_peer_ssl.h
  74. 1 4
      core/io/stream_peer_tcp.cpp
  75. 3 3
      core/io/stream_peer_tcp.h
  76. 0 3
      core/io/translation_loader_po.cpp
  77. 1 1
      core/io/translation_loader_po.h
  78. 0 3
      core/io/xml_parser.cpp
  79. 6 6
      core/io/xml_parser.h
  80. 7 13
      core/list.h
  81. 10 20
      core/map.h
  82. 0 11
      core/math/a_star.cpp
  83. 12 16
      core/math/a_star.h
  84. 0 31
      core/math/audio_frame.cpp
  85. 4 7
      core/math/delaunay_2d.h
  86. 2 6
      core/math/delaunay_3d.h
  87. 0 31
      core/math/disjoint_set.cpp
  88. 0 11
      core/math/expression.cpp
  89. 13 15
      core/math/expression.h
  90. 6 12
      core/math/geometry.cpp
  91. 17 42
      core/math/octree.h
  92. 2 3
      core/math/plane.h
  93. 4 9
      core/math/quat.h
  94. 4 10
      core/math/quick_hull.h
  95. 0 2
      core/math/random_number_generator.cpp
  96. 1 1
      core/math/random_number_generator.h
  97. 2 1
      core/math/rect2.h
  98. 7 9
      core/math/vector2.h
  99. 2 3
      core/math/vector3.h
  100. 2 2
      core/math/vector3i.h

+ 42 - 0
.clang-tidy

@@ -0,0 +1,42 @@
+---
+Checks:          'clang-diagnostic-*,clang-analyzer-*,-*,modernize-use-default-member-init'
+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-braces-around-statements.ShortStatementLines
+    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-default-member-init.IgnoreMacros
+    value:           '1'
+  - key:             modernize-use-default-member-init.UseAssignment
+    value:           '1'
+  - key:             modernize-use-nullptr.NullMacros
+    value:           'NULL'
+...
+

+ 16 - 98
core/bind/core_bind.cpp

@@ -62,6 +62,8 @@ static const unsigned int MONTH_DAYS_TABLE[2][12] = {
 	{ 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }
 };
 
+////// _ResourceLoader //////
+
 _ResourceLoader *_ResourceLoader::singleton = nullptr;
 
 Error _ResourceLoader::load_threaded_request(const String &p_path, const String &p_type_hint, bool p_use_sub_threads) {
@@ -150,10 +152,7 @@ void _ResourceLoader::_bind_methods() {
 	BIND_ENUM_CONSTANT(THREAD_LOAD_LOADED);
 }
 
-_ResourceLoader::_ResourceLoader() {
-
-	singleton = this;
-}
+////// _ResourceSaver //////
 
 Error _ResourceSaver::save(const String &p_path, const RES &p_resource, SaverFlags p_flags) {
 	ERR_FAIL_COND_V_MSG(p_resource.is_null(), ERR_INVALID_PARAMETER, "Can't save empty resource to path '" + String(p_path) + "'.");
@@ -189,10 +188,7 @@ void _ResourceSaver::_bind_methods() {
 	BIND_ENUM_CONSTANT(FLAG_REPLACE_SUBRESOURCE_PATHS);
 }
 
-_ResourceSaver::_ResourceSaver() {
-
-	singleton = this;
-}
+////// _OS //////
 
 PackedStringArray _OS::get_connected_midi_inputs() {
 	return OS::get_singleton()->get_connected_midi_inputs();
@@ -319,50 +315,6 @@ bool _OS::has_feature(const String &p_feature) const {
 	return OS::get_singleton()->has_feature(p_feature);
 }
 
-/*
-enum Weekday {
-	DAY_SUNDAY,
-	DAY_MONDAY,
-	DAY_TUESDAY,
-	DAY_WEDNESDAY,
-	DAY_THURSDAY,
-	DAY_FRIDAY,
-	DAY_SATURDAY
-};
-
-enum Month {
-	MONTH_JANUARY,
-	MONTH_FEBRUARY,
-	MONTH_MARCH,
-	MONTH_APRIL,
-	MONTH_MAY,
-	MONTH_JUNE,
-	MONTH_JULY,
-	MONTH_AUGUST,
-	MONTH_SEPTEMBER,
-	MONTH_OCTOBER,
-	MONTH_NOVEMBER,
-	MONTH_DECEMBER
-};
-*/
-/*
-struct Date {
-
-	int year;
-	Month month;
-	int day;
-	Weekday weekday;
-	bool dst;
-};
-
-struct Time {
-
-	int hour;
-	int min;
-	int sec;
-};
-*/
-
 uint64_t _OS::get_static_memory_usage() const {
 
 	return OS::get_singleton()->get_static_memory_usage();
@@ -783,6 +735,7 @@ Vector<String> _OS::get_granted_permissions() const {
 String _OS::get_unique_id() const {
 	return OS::get_singleton()->get_unique_id();
 }
+
 _OS *_OS::singleton = nullptr;
 
 void _OS::_bind_methods() {
@@ -839,8 +792,6 @@ void _OS::_bind_methods() {
 
 	ClassDB::bind_method(D_METHOD("is_debug_build"), &_OS::is_debug_build);
 
-	//ClassDB::bind_method(D_METHOD("get_mouse_button_state"),&_OS::get_mouse_button_state);
-
 	ClassDB::bind_method(D_METHOD("dump_memory_to_file", "file"), &_OS::dump_memory_to_file);
 	ClassDB::bind_method(D_METHOD("dump_resources_to_file", "file"), &_OS::dump_resources_to_file);
 	ClassDB::bind_method(D_METHOD("print_resources_in_use", "short"), &_OS::print_resources_in_use, DEFVAL(false));
@@ -914,12 +865,7 @@ void _OS::_bind_methods() {
 	BIND_ENUM_CONSTANT(SYSTEM_DIR_RINGTONES);
 }
 
-_OS::_OS() {
-
-	singleton = this;
-}
-
-///////////////////// GEOMETRY
+////// _Geometry //////
 
 _Geometry *_Geometry::singleton = nullptr;
 
@@ -1296,11 +1242,7 @@ void _Geometry::_bind_methods() {
 	BIND_ENUM_CONSTANT(END_ROUND);
 }
 
-_Geometry::_Geometry() {
-	singleton = this;
-}
-
-///////////////////////// FILE
+////// _File //////
 
 Error _File::open_encrypted(const String &p_path, ModeFlags p_mode_flags, const Vector<uint8_t> &p_key) {
 
@@ -1736,19 +1678,12 @@ void _File::_bind_methods() {
 	BIND_ENUM_CONSTANT(COMPRESSION_GZIP);
 }
 
-_File::_File() {
-
-	f = nullptr;
-	eswap = false;
-}
-
 _File::~_File() {
-
 	if (f)
 		memdelete(f);
 }
 
-///////////////////////////////////////////////////////
+////// _Directory //////
 
 Error _Directory::open(const String &p_path) {
 	Error err;
@@ -1929,16 +1864,16 @@ void _Directory::_bind_methods() {
 }
 
 _Directory::_Directory() {
-
 	d = DirAccess::create(DirAccess::ACCESS_RESOURCES);
 }
 
 _Directory::~_Directory() {
-
 	if (d)
 		memdelete(d);
 }
 
+////// _Marshalls //////
+
 _Marshalls *_Marshalls::singleton = nullptr;
 
 _Marshalls *_Marshalls::get_singleton() {
@@ -2046,7 +1981,7 @@ void _Marshalls::_bind_methods() {
 	ClassDB::bind_method(D_METHOD("base64_to_utf8", "base64_str"), &_Marshalls::base64_to_utf8);
 };
 
-////////////////
+////// _Semaphore //////
 
 void _Semaphore::wait() {
 
@@ -2070,7 +2005,7 @@ void _Semaphore::_bind_methods() {
 	ClassDB::bind_method(D_METHOD("post"), &_Semaphore::post);
 }
 
-///////////////
+////// _Mutex //////
 
 void _Mutex::lock() {
 
@@ -2094,7 +2029,7 @@ void _Mutex::_bind_methods() {
 	ClassDB::bind_method(D_METHOD("unlock"), &_Mutex::unlock);
 }
 
-///////////////
+////// _Thread //////
 
 void _Thread::_start_func(void *ud) {
 
@@ -2204,19 +2139,12 @@ void _Thread::_bind_methods() {
 	BIND_ENUM_CONSTANT(PRIORITY_NORMAL);
 	BIND_ENUM_CONSTANT(PRIORITY_HIGH);
 }
-_Thread::_Thread() {
-
-	active = false;
-	thread = nullptr;
-	target_instance = nullptr;
-}
 
 _Thread::~_Thread() {
-
 	ERR_FAIL_COND_MSG(active, "Reference to a Thread object was lost while the thread is still running...");
 }
 
-/////////////////////////////////////
+////// _ClassDB //////
 
 PackedStringArray _ClassDB::get_class_list() const {
 
@@ -2425,11 +2353,7 @@ void _ClassDB::_bind_methods() {
 	ClassDB::bind_method(D_METHOD("is_class_enabled", "class"), &_ClassDB::is_class_enabled);
 }
 
-_ClassDB::_ClassDB() {
-}
-_ClassDB::~_ClassDB() {
-}
-///////////////////////////////
+////// _Engine //////
 
 void _Engine::set_iterations_per_second(int p_ips) {
 
@@ -2588,9 +2512,7 @@ void _Engine::_bind_methods() {
 
 _Engine *_Engine::singleton = nullptr;
 
-_Engine::_Engine() {
-	singleton = this;
-}
+////// _JSON //////
 
 void JSONParseResult::_bind_methods() {
 	ClassDB::bind_method(D_METHOD("get_error"), &JSONParseResult::get_error);
@@ -2663,7 +2585,3 @@ Ref<JSONParseResult> _JSON::parse(const String &p_json) {
 }
 
 _JSON *_JSON::singleton = nullptr;
-
-_JSON::_JSON() {
-	singleton = this;
-}

+ 18 - 19
core/bind/core_bind.h

@@ -69,7 +69,7 @@ public:
 	bool has_cached(const String &p_path);
 	bool exists(const String &p_path, const String &p_type_hint = "");
 
-	_ResourceLoader();
+	_ResourceLoader() { singleton = this; }
 };
 
 VARIANT_ENUM_CAST(_ResourceLoader::ThreadLoadStatus);
@@ -98,7 +98,7 @@ public:
 	Error save(const String &p_path, const RES &p_resource, SaverFlags p_flags);
 	Vector<String> get_recognized_extensions(const RES &p_resource);
 
-	_ResourceSaver();
+	_ResourceSaver() { singleton = this; }
 };
 
 VARIANT_ENUM_CAST(_ResourceSaver::SaverFlags);
@@ -245,7 +245,7 @@ public:
 
 	static _OS *get_singleton() { return singleton; }
 
-	_OS();
+	_OS() { singleton = this; }
 };
 
 VARIANT_ENUM_CAST(_OS::VideoDriver);
@@ -327,7 +327,7 @@ public:
 
 	Dictionary make_atlas(const Vector<Size2> &p_rects);
 
-	_Geometry();
+	_Geometry() { singleton = this; }
 };
 
 VARIANT_ENUM_CAST(_Geometry::PolyBooleanOperation);
@@ -335,10 +335,10 @@ VARIANT_ENUM_CAST(_Geometry::PolyJoinType);
 VARIANT_ENUM_CAST(_Geometry::PolyEndType);
 
 class _File : public Reference {
-
 	GDCLASS(_File, Reference);
-	FileAccess *f;
-	bool eswap;
+
+	FileAccess *f = nullptr;
+	bool eswap = false;
 
 protected:
 	static void _bind_methods();
@@ -429,7 +429,7 @@ public:
 
 	uint64_t get_modified_time(const String &p_file) const;
 
-	_File();
+	_File() {}
 	virtual ~_File();
 };
 
@@ -538,10 +538,10 @@ class _Thread : public Reference {
 protected:
 	Variant ret;
 	Variant userdata;
-	volatile bool active;
-	Object *target_instance;
+	volatile bool active = false;
+	Object *target_instance = nullptr;
 	StringName target_method;
-	Thread *thread;
+	Thread *thread = nullptr;
 	static void _bind_methods();
 	static void _start_func(void *ud);
 
@@ -559,7 +559,7 @@ public:
 	bool is_active() const;
 	Variant wait_to_finish();
 
-	_Thread();
+	_Thread() {}
 	~_Thread();
 };
 
@@ -600,8 +600,8 @@ public:
 
 	bool is_class_enabled(StringName p_class) const;
 
-	_ClassDB();
-	~_ClassDB();
+	_ClassDB() {}
+	~_ClassDB() {}
 };
 
 class _Engine : public Object {
@@ -649,7 +649,7 @@ public:
 	void set_editor_hint(bool p_enabled);
 	bool is_editor_hint() const;
 
-	_Engine();
+	_Engine() { singleton = this; }
 };
 
 class _JSON;
@@ -661,7 +661,7 @@ class JSONParseResult : public Reference {
 
 	Error error;
 	String error_string;
-	int error_line;
+	int error_line = -1;
 
 	Variant result;
 
@@ -681,8 +681,7 @@ public:
 	void set_result(const Variant &p_result);
 	Variant get_result() const;
 
-	JSONParseResult() :
-			error_line(-1) {}
+	JSONParseResult() {}
 };
 
 class _JSON : public Object {
@@ -698,7 +697,7 @@ public:
 	String print(const Variant &p_value, const String &p_indent = "", bool p_sort_keys = false);
 	Ref<JSONParseResult> parse(const String &p_json);
 
-	_JSON();
+	_JSON() { singleton = this; }
 };
 
 #endif // CORE_BIND_H

+ 3 - 7
core/callable.cpp

@@ -29,6 +29,7 @@
 /*************************************************************************/
 
 #include "callable.h"
+
 #include "core/script_language.h"
 #include "message_queue.h"
 #include "object.h"
@@ -255,12 +256,7 @@ Callable::~Callable() {
 	}
 }
 
-Callable::Callable() {
-	object = 0;
-}
-
 CallableCustom::CallableCustom() {
-	referenced = false;
 	ref_count.init();
 }
 
@@ -349,6 +345,7 @@ Array Signal::get_connections() const {
 	}
 	return arr;
 }
+
 Signal::Signal(const Object *p_object, const StringName &p_name) {
 
 	ERR_FAIL_COND_MSG(p_object == nullptr, "Object argument to Signal constructor must be non-null");
@@ -356,10 +353,9 @@ Signal::Signal(const Object *p_object, const StringName &p_name) {
 	object = p_object->get_instance_id();
 	name = p_name;
 }
+
 Signal::Signal(ObjectID p_object, const StringName &p_name) {
 
 	object = p_object;
 	name = p_name;
 }
-Signal::Signal() {
-}

+ 4 - 4
core/callable.h

@@ -49,7 +49,7 @@ class Callable {
 	//needs to be max 16 bytes in 64 bits
 	StringName method;
 	union {
-		uint64_t object;
+		uint64_t object = 0;
 		CallableCustom *custom;
 	};
 
@@ -100,14 +100,14 @@ public:
 	Callable(ObjectID p_object, const StringName &p_method);
 	Callable(CallableCustom *p_custom);
 	Callable(const Callable &p_callable);
-	Callable();
+	Callable() {}
 	~Callable();
 };
 
 class CallableCustom {
 	friend class Callable;
 	SafeRefCount ref_count;
-	bool referenced;
+	bool referenced = false;
 
 public:
 	typedef bool (*CompareEqualFunc)(const CallableCustom *p_a, const CallableCustom *p_b);
@@ -156,7 +156,7 @@ public:
 	Array get_connections() const;
 	Signal(const Object *p_object, const StringName &p_name);
 	Signal(ObjectID p_object, const StringName &p_name);
-	Signal();
+	Signal() {}
 };
 
 #endif // CALLABLE_H

+ 0 - 13
core/class_db.cpp

@@ -258,19 +258,6 @@ HashMap<StringName, ClassDB::ClassInfo> ClassDB::classes;
 HashMap<StringName, StringName> ClassDB::resource_base_extensions;
 HashMap<StringName, StringName> ClassDB::compat_classes;
 
-ClassDB::ClassInfo::ClassInfo() {
-
-	api = API_NONE;
-	class_ptr = nullptr;
-	creation_func = nullptr;
-	inherits_ptr = nullptr;
-	disabled = false;
-	exposed = false;
-}
-
-ClassDB::ClassInfo::~ClassInfo() {
-}
-
 bool ClassDB::is_parent_class(const StringName &p_class, const StringName &p_inherits) {
 
 	OBJTYPE_RLOCK;

+ 10 - 8
core/class_db.h

@@ -114,9 +114,10 @@ public:
 
 	struct ClassInfo {
 
-		APIType api;
-		ClassInfo *inherits_ptr;
-		void *class_ptr;
+		APIType api = API_NONE;
+		ClassInfo *inherits_ptr = nullptr;
+		void *class_ptr = nullptr;
+
 		HashMap<StringName, MethodBind *> method_map;
 		HashMap<StringName, int> constant_map;
 		HashMap<StringName, List<StringName>> enum_map;
@@ -133,11 +134,12 @@ public:
 
 		StringName inherits;
 		StringName name;
-		bool disabled;
-		bool exposed;
-		Object *(*creation_func)();
-		ClassInfo();
-		~ClassInfo();
+		bool disabled = false;
+		bool exposed = false;
+		Object *(*creation_func)() = nullptr;
+
+		ClassInfo() {}
+		~ClassInfo() {}
 	};
 
 	template <class T>

+ 2 - 10
core/color.h

@@ -44,7 +44,7 @@ struct Color {
 			float b;
 			float a;
 		};
-		float components[4];
+		float components[4] = { 0, 0, 0, 1.0 };
 	};
 
 	bool operator==(const Color &p_color) const { return (r == p_color.r && g == p_color.g && b == p_color.b && a == p_color.a); }
@@ -204,15 +204,7 @@ struct Color {
 	_FORCE_INLINE_ bool operator<(const Color &p_color) const; //used in set keys
 	operator String() const;
 
-	/**
-	 * No construct parameters, r=0, g=0, b=0. a=1
-	 */
-	_FORCE_INLINE_ Color() {
-		r = 0;
-		g = 0;
-		b = 0;
-		a = 1.0;
-	}
+	_FORCE_INLINE_ Color() {}
 
 	/**
 	 * RGB / RGBA construct parameters. Alpha is optional, but defaults to 1.0

+ 0 - 13
core/command_queue_mt.cpp

@@ -100,24 +100,11 @@ tryagain:
 }
 
 CommandQueueMT::CommandQueueMT(bool p_sync) {
-
-	read_ptr = 0;
-	write_ptr = 0;
-	dealloc_ptr = 0;
-	command_mem = (uint8_t *)memalloc(COMMAND_MEM_SIZE);
-
-	for (int i = 0; i < SYNC_SEMAPHORES; i++) {
-
-		sync_sems[i].in_use = false;
-	}
 	if (p_sync)
 		sync = memnew(Semaphore);
-	else
-		sync = nullptr;
 }
 
 CommandQueueMT::~CommandQueueMT() {
-
 	if (sync)
 		memdelete(sync);
 	memfree(command_mem);

+ 8 - 8
core/command_queue_mt.h

@@ -301,14 +301,14 @@ class CommandQueueMT {
 	struct SyncSemaphore {
 
 		Semaphore sem;
-		bool in_use;
+		bool in_use = false;
 	};
 
 	struct CommandBase {
 
 		virtual void call() = 0;
-		virtual void post(){};
-		virtual ~CommandBase(){};
+		virtual void post() {}
+		virtual ~CommandBase() {}
 	};
 
 	struct SyncCommand : public CommandBase {
@@ -339,13 +339,13 @@ class CommandQueueMT {
 		SYNC_SEMAPHORES = 8
 	};
 
-	uint8_t *command_mem;
-	uint32_t read_ptr;
-	uint32_t write_ptr;
-	uint32_t dealloc_ptr;
+	uint8_t *command_mem = (uint8_t *)memalloc(COMMAND_MEM_SIZE);
+	uint32_t read_ptr = 0;
+	uint32_t write_ptr = 0;
+	uint32_t dealloc_ptr = 0;
 	SyncSemaphore sync_sems[SYNC_SEMAPHORES];
 	Mutex mutex;
-	Semaphore *sync;
+	Semaphore *sync = nullptr;
 
 	template <class T>
 	T *allocate() {

+ 0 - 3
core/compressed_translation.cpp

@@ -288,6 +288,3 @@ void PHashTranslation::_bind_methods() {
 
 	ClassDB::bind_method(D_METHOD("generate", "from"), &PHashTranslation::generate);
 }
-
-PHashTranslation::PHashTranslation() {
-}

+ 1 - 1
core/compressed_translation.h

@@ -86,7 +86,7 @@ public:
 	virtual StringName get_message(const StringName &p_src_text) const; //overridable for other implementations
 	void generate(const Ref<Translation> &p_from);
 
-	PHashTranslation();
+	PHashTranslation() {}
 };
 
 #endif // COMPRESSED_TRANSLATION_H

+ 2 - 8
core/cowdata.h

@@ -54,7 +54,7 @@ class CowData {
 	friend class VMap;
 
 private:
-	mutable T *_ptr;
+	mutable T *_ptr = nullptr;
 
 	// internal helpers
 
@@ -183,7 +183,7 @@ public:
 
 	int find(const T &p_val, int p_from = 0) const;
 
-	_FORCE_INLINE_ CowData();
+	_FORCE_INLINE_ CowData() {}
 	_FORCE_INLINE_ ~CowData();
 	_FORCE_INLINE_ CowData(CowData<T> &p_from) { _ref(p_from); };
 };
@@ -366,12 +366,6 @@ void CowData<T>::_ref(const CowData &p_from) {
 	}
 }
 
-template <class T>
-CowData<T>::CowData() {
-
-	_ptr = nullptr;
-}
-
 template <class T>
 CowData<T>::~CowData() {
 

+ 0 - 3
core/crypto/crypto.cpp

@@ -94,9 +94,6 @@ Ref<X509Certificate> Crypto::generate_self_signed_certificate(Ref<CryptoKey> p_k
 	ERR_FAIL_V_MSG(nullptr, "generate_self_signed_certificate is not available when mbedtls module is disabled.");
 }
 
-Crypto::Crypto() {
-}
-
 /// Resource loader/saver
 
 RES ResourceFormatLoaderCrypto::load(const String &p_path, const String &p_original_path, Error *r_error, bool p_use_sub_threads, float *r_progress, bool p_no_cache) {

+ 3 - 4
core/crypto/crypto.h

@@ -31,11 +31,10 @@
 #ifndef CRYPTO_H
 #define CRYPTO_H
 
-#include "core/reference.h"
-#include "core/resource.h"
-
 #include "core/io/resource_loader.h"
 #include "core/io/resource_saver.h"
+#include "core/reference.h"
+#include "core/resource.h"
 
 class CryptoKey : public Resource {
 	GDCLASS(CryptoKey, Resource);
@@ -80,7 +79,7 @@ public:
 	virtual Ref<CryptoKey> generate_rsa(int p_bytes);
 	virtual Ref<X509Certificate> generate_self_signed_certificate(Ref<CryptoKey> p_key, String p_issuer_name, String p_not_before, String p_not_after);
 
-	Crypto();
+	Crypto() {}
 };
 
 class ResourceFormatLoaderCrypto : public ResourceFormatLoader {

+ 0 - 4
core/crypto/hashing_context.cpp

@@ -128,10 +128,6 @@ void HashingContext::_bind_methods() {
 	BIND_ENUM_CONSTANT(HASH_SHA256);
 }
 
-HashingContext::HashingContext() {
-	ctx = nullptr;
-}
-
 HashingContext::~HashingContext() {
 	if (ctx != nullptr)
 		_delete_ctx();

+ 2 - 2
core/crypto/hashing_context.h

@@ -44,7 +44,7 @@ public:
 	};
 
 private:
-	void *ctx;
+	void *ctx = nullptr;
 	HashType type;
 
 protected:
@@ -57,7 +57,7 @@ public:
 	Error update(PackedByteArray p_chunk);
 	PackedByteArray finish();
 
-	HashingContext();
+	HashingContext() {}
 	~HashingContext();
 };
 

+ 8 - 23
core/debugger/debugger_marshalls.h

@@ -42,11 +42,8 @@ struct DebuggerMarshalls {
 		String format;
 		String type;
 		RID id;
-		int vram;
+		int vram = 0;
 		bool operator<(const ResourceInfo &p_img) const { return vram == p_img.vram ? id < p_img.id : vram > p_img.vram; }
-		ResourceInfo() {
-			vram = 0;
-		}
 	};
 
 	struct ResourceUsage {
@@ -119,10 +116,7 @@ struct DebuggerMarshalls {
 	struct ScriptStackVariable {
 		String name;
 		Variant value;
-		int type;
-		ScriptStackVariable() {
-			type = -1;
-		}
+		int type = -1;
 
 		Array serialize(int max_size = 1 << 20); // 1 MiB default.
 		bool deserialize(const Array &p_arr);
@@ -137,27 +131,18 @@ struct DebuggerMarshalls {
 	};
 
 	struct OutputError {
-		int hr;
-		int min;
-		int sec;
-		int msec;
+		int hr = -1;
+		int min = -1;
+		int sec = -1;
+		int msec = -1;
 		String source_file;
 		String source_func;
-		int source_line;
+		int source_line = -1;
 		String error;
 		String error_descr;
-		bool warning;
+		bool warning = false;
 		Vector<ScriptLanguage::StackInfo> callstack;
 
-		OutputError() {
-			hr = -1;
-			min = -1;
-			sec = -1;
-			msec = -1;
-			source_line = -1;
-			warning = false;
-		}
-
 		Array serialize();
 		bool deserialize(const Array &p_arr);
 	};

+ 1 - 17
core/engine.cpp

@@ -217,23 +217,7 @@ Engine *Engine::get_singleton() {
 bool Engine::is_abort_on_gpu_errors_enabled() const {
 	return abort_on_gpu_errors;
 }
-Engine::Engine() {
 
+Engine::Engine() {
 	singleton = this;
-	frames_drawn = 0;
-	ips = 60;
-	physics_jitter_fix = 0.5;
-	_physics_interpolation_fraction = 0.0f;
-	_frame_delay = 0;
-	_fps = 1;
-	_target_fps = 0;
-	_time_scale = 1.0;
-	_pixel_snap = false;
-	_physics_frames = 0;
-	_idle_frames = 0;
-	_in_physics = false;
-	_frame_ticks = 0;
-	_frame_step = 0;
-	editor_hint = false;
-	abort_on_gpu_errors = false;
 }

+ 18 - 18
core/engine.h

@@ -51,28 +51,28 @@ public:
 private:
 	friend class Main;
 
-	uint64_t frames_drawn;
-	uint32_t _frame_delay;
-	uint64_t _frame_ticks;
-	float _frame_step;
-
-	int ips;
-	float physics_jitter_fix;
-	float _fps;
-	int _target_fps;
-	float _time_scale;
-	bool _pixel_snap;
-	uint64_t _physics_frames;
-	float _physics_interpolation_fraction;
-	bool abort_on_gpu_errors;
-
-	uint64_t _idle_frames;
-	bool _in_physics;
+	uint64_t frames_drawn = 0;
+	uint32_t _frame_delay = 0;
+	uint64_t _frame_ticks = 0;
+	float _frame_step = 0;
+
+	int ips = 60;
+	float physics_jitter_fix = 0.5;
+	float _fps = 1;
+	int _target_fps = 0;
+	float _time_scale = 1.0;
+	bool _pixel_snap = false;
+	uint64_t _physics_frames = 0;
+	float _physics_interpolation_fraction = 0.0f;
+	bool abort_on_gpu_errors = false;
+
+	uint64_t _idle_frames = 0;
+	bool _in_physics = false;
 
 	List<Singleton> singletons;
 	Map<StringName, Object *> singleton_ptrs;
 
-	bool editor_hint;
+	bool editor_hint = false;
 
 	static Engine *singleton;
 

+ 4 - 8
core/error_macros.h

@@ -48,16 +48,12 @@ typedef void (*ErrorHandlerFunc)(void *, const char *, const char *, int p_line,
 
 struct ErrorHandlerList {
 
-	ErrorHandlerFunc errfunc;
-	void *userdata;
+	ErrorHandlerFunc errfunc = nullptr;
+	void *userdata = nullptr;
 
-	ErrorHandlerList *next;
+	ErrorHandlerList *next = nullptr;
 
-	ErrorHandlerList() {
-		errfunc = 0;
-		next = 0;
-		userdata = 0;
-	}
+	ErrorHandlerList() {}
 };
 
 void add_error_handler(ErrorHandlerList *p_handler);

+ 0 - 3
core/func_ref.cpp

@@ -94,6 +94,3 @@ void FuncRef::_bind_methods() {
 	ClassDB::bind_method(D_METHOD("set_function", "name"), &FuncRef::set_function);
 	ClassDB::bind_method(D_METHOD("is_valid"), &FuncRef::is_valid);
 }
-
-FuncRef::FuncRef() {
-}

+ 2 - 1
core/func_ref.h

@@ -48,7 +48,8 @@ public:
 	void set_instance(Object *p_obj);
 	void set_function(const StringName &p_func);
 	bool is_valid() const;
-	FuncRef();
+
+	FuncRef() {}
 };
 
 #endif // FUNC_REF_H

+ 7 - 17
core/hash_map.h

@@ -75,8 +75,8 @@ public:
 		friend class HashMap;
 
 		uint32_t hash;
-		Element *next;
-		Element() { next = 0; }
+		Element *next = nullptr;
+		Element() {}
 		Pair pair;
 
 	public:
@@ -94,9 +94,9 @@ public:
 	};
 
 private:
-	Element **hash_table;
-	uint8_t hash_table_power;
-	uint32_t elements;
+	Element **hash_table = nullptr;
+	uint8_t hash_table_power = 0;
+	uint32_t elements = 0;
 
 	void make_hash_table() {
 
@@ -551,12 +551,6 @@ public:
 		copy_from(p_table);
 	}
 
-	HashMap() {
-		hash_table = nullptr;
-		elements = 0;
-		hash_table_power = 0;
-	}
-
 	void get_key_value_ptr_array(const Pair **p_pairs) const {
 		if (unlikely(!hash_table))
 			return;
@@ -584,17 +578,13 @@ public:
 		}
 	}
 
-	HashMap(const HashMap &p_table) {
-
-		hash_table = nullptr;
-		elements = 0;
-		hash_table_power = 0;
+	HashMap() {}
 
+	HashMap(const HashMap &p_table) {
 		copy_from(p_table);
 	}
 
 	~HashMap() {
-
 		clear();
 	}
 };

+ 0 - 11
core/image.cpp

@@ -3671,14 +3671,3 @@ Ref<Resource> Image::duplicate(bool p_subresources) const {
 void Image::set_as_black() {
 	zeromem(data.ptrw(), data.size());
 }
-
-Image::Image() {
-
-	width = 0;
-	height = 0;
-	mipmaps = false;
-	format = FORMAT_L8;
-}
-
-Image::~Image() {
-}

+ 7 - 7
core/image.h

@@ -33,7 +33,6 @@
 
 #include "core/color.h"
 #include "core/math/rect2.h"
-
 #include "core/resource.h"
 
 /**
@@ -172,10 +171,11 @@ private:
 		create(p_width, p_height, p_use_mipmaps, p_format, p_data);
 	}
 
-	Format format;
+	Format format = FORMAT_L8;
 	Vector<uint8_t> data;
-	int width, height;
-	bool mipmaps;
+	int width = 0;
+	int height = 0;
+	bool mipmaps = false;
 
 	void _copy_internals_from(const Image &p_image) {
 		format = p_image.format;
@@ -286,7 +286,7 @@ public:
 	/**
 	 * create an empty image
 	 */
-	Image();
+	Image() {}
 	/**
 	 * create an empty image of a specific size and format
 	 */
@@ -296,6 +296,8 @@ public:
 	 */
 	Image(int p_width, int p_height, bool p_mipmaps, Format p_format, const Vector<uint8_t> &p_data);
 
+	~Image() {}
+
 	enum AlphaMode {
 		ALPHA_NONE,
 		ALPHA_BIT,
@@ -386,8 +388,6 @@ public:
 		mipmaps = p_image->mipmaps;
 		data = p_image->data;
 	}
-
-	~Image();
 };
 
 VARIANT_ENUM_CAST(Image::Format)

+ 0 - 10
core/input/input.cpp

@@ -1433,16 +1433,6 @@ int Input::get_joy_axis_index_from_string(String p_axis) {
 Input::Input() {
 
 	singleton = this;
-	use_accumulated_input = true;
-	mouse_button_mask = 0;
-	mouse_window = 0;
-	emulate_touch_from_mouse = false;
-	emulate_mouse_from_touch = false;
-	mouse_from_touch_index = -1;
-	event_dispatch_function = nullptr;
-	default_shape = CURSOR_ARROW;
-
-	fallback_mapping = -1;
 
 	// Parse default mappings.
 	{

+ 17 - 31
core/input/input.h

@@ -36,7 +36,6 @@
 #include "core/os/thread_safe.h"
 
 class Input : public Object {
-
 	GDCLASS(Input, Object);
 	_THREAD_SAFE_CLASS_
 
@@ -100,7 +99,7 @@ public:
 	typedef void (*EventDispatchFunc)(const Ref<InputEvent> &p_event);
 
 private:
-	int mouse_button_mask;
+	int mouse_button_mask = 0;
 
 	Set<int> keys_pressed;
 	Set<int> joy_buttons_pressed;
@@ -111,7 +110,7 @@ private:
 	Vector3 magnetometer;
 	Vector3 gyroscope;
 	Vector2 mouse_pos;
-	int64_t mouse_window;
+	int64_t mouse_window = 0;
 
 	struct Action {
 		uint64_t physics_frame;
@@ -122,10 +121,11 @@ private:
 
 	Map<StringName, Action> action_state;
 
-	bool emulate_touch_from_mouse;
-	bool emulate_mouse_from_touch;
+	bool emulate_touch_from_mouse = false;
+	bool emulate_mouse_from_touch = false;
+	bool use_accumulated_input = false;
 
-	int mouse_from_touch_index;
+	int mouse_from_touch_index = -1;
 
 	struct SpeedTrack {
 
@@ -144,35 +144,21 @@ private:
 	struct Joypad {
 		StringName name;
 		StringName uid;
-		bool connected;
-		bool last_buttons[JOY_BUTTON_MAX];
-		float last_axis[JOY_AXIS_MAX];
-		float filter;
-		int last_hat;
-		int mapping;
-		int hat_current;
-
-		Joypad() {
-			for (int i = 0; i < JOY_AXIS_MAX; i++) {
-				last_axis[i] = 0.0f;
-			}
-			for (int i = 0; i < JOY_BUTTON_MAX; i++) {
-				last_buttons[i] = false;
-			}
-			connected = false;
-			last_hat = HAT_MASK_CENTER;
-			filter = 0.01f;
-			mapping = -1;
-			hat_current = 0;
-		}
+		bool connected = false;
+		bool last_buttons[JOY_BUTTON_MAX] = { false };
+		float last_axis[JOY_AXIS_MAX] = { 0.0f };
+		float filter = 0.01f;
+		int last_hat = HAT_MASK_CENTER;
+		int mapping = -1;
+		int hat_current = 0;
 	};
 
 	SpeedTrack mouse_speed_track;
 	Map<int, SpeedTrack> touch_speed_track;
 	Map<int, Joypad> joy_names;
-	int fallback_mapping;
+	int fallback_mapping = -1;
 
-	CursorShape default_shape;
+	CursorShape default_shape = CURSOR_ARROW;
 
 	enum JoyType {
 		TYPE_BUTTON,
@@ -243,7 +229,7 @@ private:
 	void _parse_input_event_impl(const Ref<InputEvent> &p_event, bool p_is_emulated);
 
 	List<Ref<InputEvent>> accumulated_events;
-	bool use_accumulated_input;
+
 	friend class DisplayServer;
 
 	static void (*set_mouse_mode_func)(MouseMode);
@@ -253,7 +239,7 @@ private:
 	static CursorShape (*get_current_cursor_shape_func)();
 	static void (*set_custom_mouse_cursor_func)(const RES &, CursorShape, const Vector2 &);
 
-	EventDispatchFunc event_dispatch_function;
+	EventDispatchFunc event_dispatch_function = nullptr;
 
 protected:
 	struct VibrationInfo {

+ 16 - 104
core/input/input_event.cpp

@@ -132,11 +132,7 @@ void InputEvent::_bind_methods() {
 	ADD_PROPERTY(PropertyInfo(Variant::INT, "device"), "set_device", "get_device");
 }
 
-InputEvent::InputEvent() {
-
-	device = 0;
-}
-////////////////
+///////////////////////////////////
 
 void InputEventFromWindow::_bind_methods() {
 
@@ -152,11 +148,7 @@ int64_t InputEventFromWindow::get_window_id() const {
 	return window_id;
 }
 
-InputEventFromWindow::InputEventFromWindow() {
-	window_id = 0;
-}
-
-//////////////////
+///////////////////////////////////
 
 void InputEventWithModifiers::set_shift(bool p_enabled) {
 
@@ -236,15 +228,7 @@ void InputEventWithModifiers::_bind_methods() {
 	ADD_PROPERTY(PropertyInfo(Variant::BOOL, "command"), "set_command", "get_command");
 }
 
-InputEventWithModifiers::InputEventWithModifiers() {
-
-	alt = false;
-	shift = false;
-	control = false;
-	meta = false;
-}
-
-//////////////////////////////////
+///////////////////////////////////
 
 void InputEventKey::set_pressed(bool p_pressed) {
 
@@ -411,16 +395,7 @@ void InputEventKey::_bind_methods() {
 	ADD_PROPERTY(PropertyInfo(Variant::BOOL, "echo"), "set_echo", "is_echo");
 }
 
-InputEventKey::InputEventKey() {
-
-	pressed = false;
-	keycode = 0;
-	physical_keycode = 0;
-	unicode = 0; ///unicode
-	echo = false;
-}
-
-////////////////////////////////////////
+///////////////////////////////////
 
 void InputEventMouse::set_button_mask(int p_mask) {
 
@@ -465,12 +440,7 @@ void InputEventMouse::_bind_methods() {
 	ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "global_position"), "set_global_position", "get_global_position");
 }
 
-InputEventMouse::InputEventMouse() {
-
-	button_mask = 0;
-}
-
-///////////////////////////////////////
+///////////////////////////////////
 
 void InputEventMouseButton::set_factor(float p_factor) {
 
@@ -608,15 +578,7 @@ void InputEventMouseButton::_bind_methods() {
 	ADD_PROPERTY(PropertyInfo(Variant::BOOL, "doubleclick"), "set_doubleclick", "is_doubleclick");
 }
 
-InputEventMouseButton::InputEventMouseButton() {
-
-	factor = 1;
-	button_index = 0;
-	pressed = false;
-	doubleclick = false;
-}
-
-////////////////////////////////////////////
+///////////////////////////////////
 
 void InputEventMouseMotion::set_tilt(const Vector2 &p_tilt) {
 
@@ -773,12 +735,7 @@ void InputEventMouseMotion::_bind_methods() {
 	ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "speed"), "set_speed", "get_speed");
 }
 
-InputEventMouseMotion::InputEventMouseMotion() {
-
-	pressure = 0;
-}
-
-////////////////////////////////////////
+///////////////////////////////////
 
 void InputEventJoypadMotion::set_axis(int p_axis) {
 
@@ -849,12 +806,7 @@ void InputEventJoypadMotion::_bind_methods() {
 	ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "axis_value"), "set_axis_value", "get_axis_value");
 }
 
-InputEventJoypadMotion::InputEventJoypadMotion() {
-
-	axis = 0;
-	axis_value = 0;
-}
-/////////////////////////////////
+///////////////////////////////////
 
 void InputEventJoypadButton::set_button_index(int p_index) {
 
@@ -931,14 +883,7 @@ void InputEventJoypadButton::_bind_methods() {
 	ADD_PROPERTY(PropertyInfo(Variant::BOOL, "pressed"), "set_pressed", "is_pressed");
 }
 
-InputEventJoypadButton::InputEventJoypadButton() {
-
-	button_index = 0;
-	pressure = 0;
-	pressed = false;
-}
-
-//////////////////////////////////////////////
+///////////////////////////////////
 
 void InputEventScreenTouch::set_index(int p_index) {
 
@@ -1001,13 +946,7 @@ void InputEventScreenTouch::_bind_methods() {
 	ADD_PROPERTY(PropertyInfo(Variant::BOOL, "pressed"), "set_pressed", "is_pressed");
 }
 
-InputEventScreenTouch::InputEventScreenTouch() {
-
-	index = 0;
-	pressed = false;
-}
-
-/////////////////////////////
+///////////////////////////////////
 
 void InputEventScreenDrag::set_index(int p_index) {
 
@@ -1088,11 +1027,7 @@ void InputEventScreenDrag::_bind_methods() {
 	ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "speed"), "set_speed", "get_speed");
 }
 
-InputEventScreenDrag::InputEventScreenDrag() {
-
-	index = 0;
-}
-/////////////////////////////
+///////////////////////////////////
 
 void InputEventAction::set_action(const StringName &p_action) {
 
@@ -1171,11 +1106,7 @@ void InputEventAction::_bind_methods() {
 	ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "strength", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_strength", "get_strength");
 }
 
-InputEventAction::InputEventAction() {
-	pressed = false;
-	strength = 1.0f;
-}
-/////////////////////////////
+///////////////////////////////////
 
 void InputEventGesture::set_position(const Vector2 &p_pos) {
 
@@ -1194,7 +1125,8 @@ Vector2 InputEventGesture::get_position() const {
 
 	return pos;
 }
-/////////////////////////////
+
+///////////////////////////////////
 
 void InputEventMagnifyGesture::set_factor(real_t p_factor) {
 
@@ -1235,11 +1167,7 @@ void InputEventMagnifyGesture::_bind_methods() {
 	ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "factor"), "set_factor", "get_factor");
 }
 
-InputEventMagnifyGesture::InputEventMagnifyGesture() {
-
-	factor = 1.0;
-}
-/////////////////////////////
+///////////////////////////////////
 
 void InputEventPanGesture::set_delta(const Vector2 &p_delta) {
 
@@ -1279,11 +1207,7 @@ void InputEventPanGesture::_bind_methods() {
 	ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "delta"), "set_delta", "get_delta");
 }
 
-InputEventPanGesture::InputEventPanGesture() {
-
-	delta = Vector2(0, 0);
-}
-/////////////////////////////
+///////////////////////////////////
 
 void InputEventMIDI::set_channel(const int p_channel) {
 
@@ -1390,15 +1314,3 @@ void InputEventMIDI::_bind_methods() {
 	ADD_PROPERTY(PropertyInfo(Variant::INT, "controller_number"), "set_controller_number", "get_controller_number");
 	ADD_PROPERTY(PropertyInfo(Variant::INT, "controller_value"), "set_controller_value", "get_controller_value");
 }
-
-InputEventMIDI::InputEventMIDI() {
-
-	channel = 0;
-	message = 0;
-	pitch = 0;
-	velocity = 0;
-	instrument = 0;
-	pressure = 0;
-	controller_number = 0;
-	controller_value = 0;
-}

+ 54 - 55
core/input/input_event.h

@@ -157,7 +157,7 @@ enum MidiMessageList {
 class InputEvent : public Resource {
 	GDCLASS(InputEvent, Resource);
 
-	int device;
+	int device = 0;
 
 protected:
 	static void _bind_methods();
@@ -177,7 +177,6 @@ public:
 	// To be removed someday, since they do not make sense for all events
 	virtual bool is_pressed() const;
 	virtual bool is_echo() const;
-	// ...-.
 
 	virtual String as_text() const;
 
@@ -188,14 +187,15 @@ public:
 	virtual bool is_action_type() const;
 
 	virtual bool accumulate(const Ref<InputEvent> &p_event) { return false; }
-	InputEvent();
+
+	InputEvent() {}
 };
 
 class InputEventFromWindow : public InputEvent {
 
 	GDCLASS(InputEventFromWindow, InputEvent);
 
-	int64_t window_id;
+	int64_t window_id = 0;
 
 protected:
 	static void _bind_methods();
@@ -204,28 +204,27 @@ public:
 	void set_window_id(int64_t p_id);
 	int64_t get_window_id() const;
 
-	InputEventFromWindow();
+	InputEventFromWindow() {}
 };
 
 class InputEventWithModifiers : public InputEventFromWindow {
 	GDCLASS(InputEventWithModifiers, InputEventFromWindow);
 
-	bool shift;
-	bool alt;
+	bool shift = false;
+	bool alt = false;
 #ifdef APPLE_STYLE_KEYS
 	union {
 		bool command;
-		bool meta; //< windows/mac key
+		bool meta = false; //< windows/mac key
 	};
 
-	bool control;
+	bool control = false;
 #else
 	union {
 		bool command; //< windows/mac key
-		bool control;
+		bool control = false;
 	};
-	bool meta; //< windows/mac key
-
+	bool meta = false; //< windows/mac key
 #endif
 
 protected:
@@ -249,20 +248,20 @@ public:
 
 	void set_modifiers_from_event(const InputEventWithModifiers *event);
 
-	InputEventWithModifiers();
+	InputEventWithModifiers() {}
 };
 
 class InputEventKey : public InputEventWithModifiers {
 
 	GDCLASS(InputEventKey, InputEventWithModifiers);
 
-	bool pressed; /// otherwise release
+	bool pressed = false; /// otherwise release
 
-	uint32_t keycode; ///< check keyboard.h , KeyCode enum, without modifier masks
-	uint32_t physical_keycode;
-	uint32_t unicode; ///unicode
+	uint32_t keycode = 0; ///< check keyboard.h , KeyCode enum, without modifier masks
+	uint32_t physical_keycode = 0;
+	uint32_t unicode = 0; ///unicode
 
-	bool echo; /// true if this is an echo key
+	bool echo = false; /// true if this is an echo key
 
 protected:
 	static void _bind_methods();
@@ -293,14 +292,14 @@ public:
 
 	virtual String as_text() const;
 
-	InputEventKey();
+	InputEventKey() {}
 };
 
 class InputEventMouse : public InputEventWithModifiers {
 
 	GDCLASS(InputEventMouse, InputEventWithModifiers);
 
-	int button_mask;
+	int button_mask = 0;
 
 	Vector2 pos;
 	Vector2 global_pos;
@@ -318,17 +317,17 @@ public:
 	void set_global_position(const Vector2 &p_global_pos);
 	Vector2 get_global_position() const;
 
-	InputEventMouse();
+	InputEventMouse() {}
 };
 
 class InputEventMouseButton : public InputEventMouse {
 
 	GDCLASS(InputEventMouseButton, InputEventMouse);
 
-	float factor;
-	int button_index;
-	bool pressed; //otherwise released
-	bool doubleclick; //last even less than doubleclick time
+	float factor = 1;
+	int button_index = 0;
+	bool pressed = false; //otherwise released
+	bool doubleclick = false; //last even less than doubleclick time
 
 protected:
 	static void _bind_methods();
@@ -352,7 +351,7 @@ public:
 	virtual bool is_action_type() const { return true; }
 	virtual String as_text() const;
 
-	InputEventMouseButton();
+	InputEventMouseButton() {}
 };
 
 class InputEventMouseMotion : public InputEventMouse {
@@ -360,7 +359,7 @@ class InputEventMouseMotion : public InputEventMouse {
 	GDCLASS(InputEventMouseMotion, InputEventMouse);
 
 	Vector2 tilt;
-	float pressure;
+	float pressure = 0;
 	Vector2 relative;
 	Vector2 speed;
 
@@ -385,14 +384,14 @@ public:
 
 	virtual bool accumulate(const Ref<InputEvent> &p_event);
 
-	InputEventMouseMotion();
+	InputEventMouseMotion() {}
 };
 
 class InputEventJoypadMotion : public InputEvent {
 
 	GDCLASS(InputEventJoypadMotion, InputEvent);
-	int axis; ///< Joypad axis
-	float axis_value; ///< -1 to 1
+	int axis = 0; ///< Joypad axis
+	float axis_value = 0; ///< -1 to 1
 
 protected:
 	static void _bind_methods();
@@ -411,15 +410,15 @@ public:
 	virtual bool is_action_type() const { return true; }
 	virtual String as_text() const;
 
-	InputEventJoypadMotion();
+	InputEventJoypadMotion() {}
 };
 
 class InputEventJoypadButton : public InputEvent {
 	GDCLASS(InputEventJoypadButton, InputEvent);
 
-	int button_index;
-	bool pressed;
-	float pressure; //0 to 1
+	int button_index = 0;
+	bool pressed = false;
+	float pressure = 0; //0 to 1
 protected:
 	static void _bind_methods();
 
@@ -439,14 +438,14 @@ public:
 	virtual bool is_action_type() const { return true; }
 	virtual String as_text() const;
 
-	InputEventJoypadButton();
+	InputEventJoypadButton() {}
 };
 
 class InputEventScreenTouch : public InputEventFromWindow {
 	GDCLASS(InputEventScreenTouch, InputEventFromWindow);
-	int index;
+	int index = 0;
 	Vector2 pos;
-	bool pressed;
+	bool pressed = false;
 
 protected:
 	static void _bind_methods();
@@ -464,13 +463,13 @@ public:
 	virtual Ref<InputEvent> xformed_by(const Transform2D &p_xform, const Vector2 &p_local_ofs = Vector2()) const;
 	virtual String as_text() const;
 
-	InputEventScreenTouch();
+	InputEventScreenTouch() {}
 };
 
 class InputEventScreenDrag : public InputEventFromWindow {
 
 	GDCLASS(InputEventScreenDrag, InputEventFromWindow);
-	int index;
+	int index = 0;
 	Vector2 pos;
 	Vector2 relative;
 	Vector2 speed;
@@ -494,7 +493,7 @@ public:
 	virtual Ref<InputEvent> xformed_by(const Transform2D &p_xform, const Vector2 &p_local_ofs = Vector2()) const;
 	virtual String as_text() const;
 
-	InputEventScreenDrag();
+	InputEventScreenDrag() {}
 };
 
 class InputEventAction : public InputEvent {
@@ -502,8 +501,8 @@ class InputEventAction : public InputEvent {
 	GDCLASS(InputEventAction, InputEvent);
 
 	StringName action;
-	bool pressed;
-	float strength;
+	bool pressed = false;
+	float strength = 1.0f;
 
 protected:
 	static void _bind_methods();
@@ -526,7 +525,7 @@ public:
 	virtual bool is_action_type() const { return true; }
 	virtual String as_text() const;
 
-	InputEventAction();
+	InputEventAction() {}
 };
 
 class InputEventGesture : public InputEventWithModifiers {
@@ -546,7 +545,7 @@ public:
 class InputEventMagnifyGesture : public InputEventGesture {
 
 	GDCLASS(InputEventMagnifyGesture, InputEventGesture);
-	real_t factor;
+	real_t factor = 1.0;
 
 protected:
 	static void _bind_methods();
@@ -558,7 +557,7 @@ public:
 	virtual Ref<InputEvent> xformed_by(const Transform2D &p_xform, const Vector2 &p_local_ofs = Vector2()) const;
 	virtual String as_text() const;
 
-	InputEventMagnifyGesture();
+	InputEventMagnifyGesture() {}
 };
 
 class InputEventPanGesture : public InputEventGesture {
@@ -576,20 +575,20 @@ public:
 	virtual Ref<InputEvent> xformed_by(const Transform2D &p_xform, const Vector2 &p_local_ofs = Vector2()) const;
 	virtual String as_text() const;
 
-	InputEventPanGesture();
+	InputEventPanGesture() {}
 };
 
 class InputEventMIDI : public InputEvent {
 	GDCLASS(InputEventMIDI, InputEvent);
 
-	int channel;
-	int message;
-	int pitch;
-	int velocity;
-	int instrument;
-	int pressure;
-	int controller_number;
-	int controller_value;
+	int channel = 0;
+	int message = 0;
+	int pitch = 0;
+	int velocity = 0;
+	int instrument = 0;
+	int pressure = 0;
+	int controller_number = 0;
+	int controller_value = 0;
 
 protected:
 	static void _bind_methods();
@@ -621,7 +620,7 @@ public:
 
 	virtual String as_text() const;
 
-	InputEventMIDI();
+	InputEventMIDI() {}
 };
 
 #endif // INPUT_EVENT_H

+ 1 - 1
core/io/compression.h

@@ -53,7 +53,7 @@ public:
 	static int get_max_compressed_buffer_size(int p_src_size, Mode p_mode = MODE_ZSTD);
 	static int decompress(uint8_t *p_dst, int p_dst_max_size, const uint8_t *p_src, int p_src_size, Mode p_mode = MODE_ZSTD);
 
-	Compression();
+	Compression() {}
 };
 
 #endif // COMPRESSION_H

+ 1 - 3
core/io/dtls_server.cpp

@@ -29,6 +29,7 @@
 /*************************************************************************/
 
 #include "dtls_server.h"
+
 #include "core/os/file_access.h"
 #include "core/project_settings.h"
 
@@ -49,6 +50,3 @@ void DTLSServer::_bind_methods() {
 	ClassDB::bind_method(D_METHOD("setup", "key", "certificate", "chain"), &DTLSServer::setup, DEFVAL(Ref<X509Certificate>()));
 	ClassDB::bind_method(D_METHOD("take_connection", "udp_peer"), &DTLSServer::take_connection);
 }
-
-DTLSServer::DTLSServer() {
-}

+ 1 - 1
core/io/dtls_server.h

@@ -51,7 +51,7 @@ public:
 	virtual void stop() = 0;
 	virtual Ref<PacketPeerDTLS> take_connection(Ref<PacketPeerUDP> p_peer) = 0;
 
-	DTLSServer();
+	DTLSServer() {}
 };
 
 #endif // DTLS_SERVER_H

+ 0 - 8
core/io/file_access_buffered.cpp

@@ -166,11 +166,3 @@ Error FileAccessBuffered::get_error() const {
 
 	return last_error;
 }
-
-FileAccessBuffered::FileAccessBuffered() {
-
-	cache_size = DEFAULT_CACHE_SIZE;
-}
-
-FileAccessBuffered::~FileAccessBuffered() {
-}

+ 3 - 3
core/io/file_access_buffered.h

@@ -43,7 +43,7 @@ public:
 	};
 
 private:
-	int cache_size;
+	int cache_size = DEFAULT_CACHE_SIZE;
 
 	int cache_data_left() const;
 	mutable Error last_error;
@@ -87,8 +87,8 @@ public:
 
 	virtual Error get_error() const;
 
-	FileAccessBuffered();
-	virtual ~FileAccessBuffered();
+	FileAccessBuffered() {}
+	virtual ~FileAccessBuffered() {}
 };
 
 #endif

+ 1 - 9
core/io/file_access_buffered_fa.h

@@ -132,12 +132,6 @@ public:
 		set_error(OK);
 	};
 
-	/*
-	static void make_default() {
-		FileAccess::create_func = FileAccessBufferedFA<T>::create;
-	};
-	*/
-
 	virtual uint64_t _get_modified_time(const String &p_file) {
 
 		return f._get_modified_time(p_file);
@@ -151,9 +145,7 @@ public:
 		return f._set_unix_permissions(p_file, p_permissions);
 	}
 
-	FileAccessBufferedFA(){
-
-	};
+	FileAccessBufferedFA() {}
 };
 
 #endif // FILE_ACCESS_BUFFERED_FA_H

+ 0 - 19
core/io/file_access_compressed.cpp

@@ -389,25 +389,6 @@ Error FileAccessCompressed::_set_unix_permissions(const String &p_file, uint32_t
 	return FAILED;
 }
 
-FileAccessCompressed::FileAccessCompressed() :
-		cmode(Compression::MODE_ZSTD),
-		writing(false),
-		write_ptr(nullptr),
-		write_buffer_size(0),
-		write_max(0),
-		block_size(0),
-		read_eof(false),
-		at_end(false),
-		read_ptr(nullptr),
-		read_block(0),
-		read_block_count(0),
-		read_block_size(0),
-		read_pos(0),
-		read_total(0),
-		magic("GCMP"),
-		f(nullptr) {
-}
-
 FileAccessCompressed::~FileAccessCompressed() {
 
 	if (f)

+ 18 - 18
core/io/file_access_compressed.h

@@ -36,15 +36,15 @@
 
 class FileAccessCompressed : public FileAccess {
 
-	Compression::Mode cmode;
-	bool writing;
-	uint32_t write_pos;
-	uint8_t *write_ptr;
-	uint32_t write_buffer_size;
-	uint32_t write_max;
-	uint32_t block_size;
-	mutable bool read_eof;
-	mutable bool at_end;
+	Compression::Mode cmode = Compression::MODE_ZSTD;
+	bool writing = false;
+	uint32_t write_pos = 0;
+	uint8_t *write_ptr = nullptr;
+	uint32_t write_buffer_size = 0;
+	uint32_t write_max = 0;
+	uint32_t block_size = 0;
+	mutable bool read_eof = false;
+	mutable bool at_end = false;
 
 	struct ReadBlock {
 		int csize;
@@ -52,17 +52,17 @@ class FileAccessCompressed : public FileAccess {
 	};
 
 	mutable Vector<uint8_t> comp_buffer;
-	uint8_t *read_ptr;
-	mutable int read_block;
-	int read_block_count;
-	mutable int read_block_size;
-	mutable int read_pos;
+	uint8_t *read_ptr = nullptr;
+	mutable int read_block = 0;
+	int read_block_count = 0;
+	mutable int read_block_size = 0;
+	mutable int read_pos = 0;
 	Vector<ReadBlock> read_blocks;
-	uint32_t read_total;
+	uint32_t read_total = 0;
 
-	String magic;
+	String magic = "GCMP";
 	mutable Vector<uint8_t> buffer;
-	FileAccess *f;
+	FileAccess *f = nullptr;
 
 public:
 	void configure(const String &p_magic, Compression::Mode p_mode = Compression::MODE_ZSTD, int p_block_size = 4096);
@@ -94,7 +94,7 @@ public:
 	virtual uint32_t _get_unix_permissions(const String &p_file);
 	virtual Error _set_unix_permissions(const String &p_file, uint32_t p_permissions);
 
-	FileAccessCompressed();
+	FileAccessCompressed() {}
 	virtual ~FileAccessCompressed();
 };
 

+ 0 - 9
core/io/file_access_encrypted.cpp

@@ -317,15 +317,6 @@ Error FileAccessEncrypted::_set_unix_permissions(const String &p_file, uint32_t
 	return ERR_UNAVAILABLE;
 }
 
-FileAccessEncrypted::FileAccessEncrypted() {
-
-	file = nullptr;
-	pos = 0;
-	eofed = false;
-	mode = MODE_MAX;
-	writing = false;
-}
-
 FileAccessEncrypted::~FileAccessEncrypted() {
 
 	if (file)

+ 6 - 6
core/io/file_access_encrypted.h

@@ -42,15 +42,15 @@ public:
 	};
 
 private:
-	Mode mode;
+	Mode mode = MODE_MAX;
 	Vector<uint8_t> key;
-	bool writing;
-	FileAccess *file;
+	bool writing = false;
+	FileAccess *file = nullptr;
 	size_t base;
 	size_t length;
 	Vector<uint8_t> data;
-	mutable int pos;
-	mutable bool eofed;
+	mutable int pos = 0;
+	mutable bool eofed = false;
 
 public:
 	Error open_and_parse(FileAccess *p_base, const Vector<uint8_t> &p_key, Mode p_mode);
@@ -85,7 +85,7 @@ public:
 	virtual uint32_t _get_unix_permissions(const String &p_file);
 	virtual Error _set_unix_permissions(const String &p_file, uint32_t p_permissions);
 
-	FileAccessEncrypted();
+	FileAccessEncrypted() {}
 	~FileAccessEncrypted();
 };
 

+ 0 - 5
core/io/file_access_memory.cpp

@@ -193,8 +193,3 @@ void FileAccessMemory::store_buffer(const uint8_t *p_src, int p_length) {
 	copymem(&data[pos], p_src, write);
 	pos += p_length;
 }
-
-FileAccessMemory::FileAccessMemory() {
-
-	data = nullptr;
-}

+ 2 - 2
core/io/file_access_memory.h

@@ -35,7 +35,7 @@
 
 class FileAccessMemory : public FileAccess {
 
-	uint8_t *data;
+	uint8_t *data = nullptr;
 	int length;
 	mutable int pos;
 
@@ -73,7 +73,7 @@ public:
 	virtual uint32_t _get_unix_permissions(const String &p_file) { return 0; }
 	virtual Error _set_unix_permissions(const String &p_file, uint32_t p_permissions) { return FAILED; }
 
-	FileAccessMemory();
+	FileAccessMemory() {}
 };
 
 #endif // FILE_ACCESS_MEMORY_H

+ 0 - 12
core/io/file_access_network.cpp

@@ -222,17 +222,11 @@ Error FileAccessNetworkClient::connect(const String &p_host, int p_port, const S
 FileAccessNetworkClient *FileAccessNetworkClient::singleton = nullptr;
 
 FileAccessNetworkClient::FileAccessNetworkClient() {
-
-	thread = nullptr;
-	quit = false;
 	singleton = this;
-	last_id = 0;
 	client.instance();
-	lockcount = 0;
 }
 
 FileAccessNetworkClient::~FileAccessNetworkClient() {
-
 	if (thread) {
 		quit = true;
 		sem.post();
@@ -513,9 +507,6 @@ void FileAccessNetwork::configure() {
 
 FileAccessNetwork::FileAccessNetwork() {
 
-	eof_flag = false;
-	opened = false;
-	pos = 0;
 	FileAccessNetworkClient *nc = FileAccessNetworkClient::singleton;
 	nc->lock_mutex();
 	id = nc->last_id++;
@@ -523,9 +514,6 @@ FileAccessNetwork::FileAccessNetwork() {
 	nc->unlock_mutex();
 	page_size = GLOBAL_GET("network/remote_fs/page_size");
 	read_ahead = GLOBAL_GET("network/remote_fs/page_read_ahead");
-	last_activity_val = 0;
-	waiting_on_page = -1;
-	last_page = -1;
 }
 
 FileAccessNetwork::~FileAccessNetwork() {

+ 13 - 17
core/io/file_access_network.h

@@ -50,13 +50,14 @@ class FileAccessNetworkClient {
 	List<BlockRequest> block_requests;
 
 	Semaphore sem;
-	Thread *thread;
-	bool quit;
+	Thread *thread = nullptr;
+	bool quit = false;
 	Mutex mutex;
 	Mutex blockrequest_mutex;
 	Map<int, FileAccessNetwork *> accesses;
 	Ref<StreamPeerTCP> client;
-	int last_id;
+	int last_id = 0;
+	int lockcount = 0;
 
 	Vector<uint8_t> block;
 
@@ -67,7 +68,6 @@ class FileAccessNetworkClient {
 	void put_64(int64_t p_64);
 	int get_32();
 	int64_t get_64();
-	int lockcount;
 	void lock_mutex();
 	void unlock_mutex();
 
@@ -88,27 +88,23 @@ class FileAccessNetwork : public FileAccess {
 	Semaphore sem;
 	Semaphore page_sem;
 	Mutex buffer_mutex;
-	bool opened;
+	bool opened = false;
 	size_t total_size;
-	mutable size_t pos;
+	mutable size_t pos = 0;
 	int id;
-	mutable bool eof_flag;
-	mutable int last_page;
-	mutable uint8_t *last_page_buff;
+	mutable bool eof_flag = false;
+	mutable int last_page = -1;
+	mutable uint8_t *last_page_buff = nullptr;
 
 	int page_size;
 	int read_ahead;
 
-	mutable int waiting_on_page;
-	mutable int last_activity_val;
+	mutable int waiting_on_page = -1;
+
 	struct Page {
-		int activity;
-		bool queued;
+		int activity = 0;
+		bool queued = false;
 		Vector<uint8_t> buffer;
-		Page() {
-			activity = 0;
-			queued = false;
-		}
 	};
 
 	mutable Vector<Page> pages;

+ 0 - 7
core/io/file_access_pack.cpp

@@ -109,8 +109,6 @@ PackedData::PackedData() {
 
 	singleton = this;
 	root = memnew(PackedDir);
-	root->parent = nullptr;
-	disabled = false;
 
 	add_pack_source(memnew(PackedSourcePCK));
 }
@@ -506,10 +504,5 @@ String DirAccessPack::get_filesystem_type() const {
 }
 
 DirAccessPack::DirAccessPack() {
-
 	current = PackedData::get_singleton()->root;
-	cdir = false;
-}
-
-DirAccessPack::~DirAccessPack() {
 }

+ 8 - 11
core/io/file_access_pack.h

@@ -61,15 +61,15 @@ public:
 
 private:
 	struct PackedDir {
-		PackedDir *parent;
+		PackedDir *parent = nullptr;
 		String name;
 		Map<String, PackedDir *> subdirs;
 		Set<String> files;
 	};
 
 	struct PathMD5 {
-		uint64_t a;
-		uint64_t b;
+		uint64_t a = 0;
+		uint64_t b = 0;
 		bool operator<(const PathMD5 &p_md5) const {
 
 			if (p_md5.a == a) {
@@ -83,14 +83,12 @@ private:
 			return a == p_md5.a && b == p_md5.b;
 		};
 
-		PathMD5() {
-			a = b = 0;
-		};
+		PathMD5() {}
 
 		PathMD5(const Vector<uint8_t> p_buf) {
 			a = *((uint64_t *)&p_buf[0]);
 			b = *((uint64_t *)&p_buf[8]);
-		};
+		}
 	};
 
 	Map<PathMD5, PackedFile> files;
@@ -98,10 +96,9 @@ private:
 	Vector<PackSource *> sources;
 
 	PackedDir *root;
-	//Map<String,PackedDir*> dirs;
 
 	static PackedData *singleton;
-	bool disabled;
+	bool disabled = false;
 
 	void _free_packed_dirs(PackedDir *p_dir);
 
@@ -203,7 +200,7 @@ class DirAccessPack : public DirAccess {
 
 	List<String> list_dirs;
 	List<String> list_files;
-	bool cdir;
+	bool cdir = false;
 
 public:
 	virtual Error list_dir_begin();
@@ -231,7 +228,7 @@ public:
 	virtual String get_filesystem_type() const;
 
 	DirAccessPack();
-	~DirAccessPack();
+	~DirAccessPack() {}
 };
 
 #endif // FILE_ACCESS_PACK_H

+ 2 - 6
core/io/file_access_zip.cpp

@@ -241,9 +241,7 @@ ZipArchive *ZipArchive::get_singleton() {
 }
 
 ZipArchive::ZipArchive() {
-
 	instance = this;
-	//fa_create_func = FileAccess::get_create_func();
 }
 
 ZipArchive::~ZipArchive() {
@@ -369,14 +367,12 @@ bool FileAccessZip::file_exists(const String &p_name) {
 	return false;
 }
 
-FileAccessZip::FileAccessZip(const String &p_path, const PackedData::PackedFile &p_file) :
-		zfile(nullptr) {
+FileAccessZip::FileAccessZip(const String &p_path, const PackedData::PackedFile &p_file) {
 	_open(p_path, FileAccess::READ);
 }
 
 FileAccessZip::~FileAccessZip() {
-
 	close();
 }
 
-#endif
+#endif // MINIZIP_ENABLED

+ 3 - 6
core/io/file_access_zip.h

@@ -45,18 +45,15 @@ class ZipArchive : public PackSource {
 public:
 	struct File {
 
-		int package;
+		int package = -1;
 		unz_file_pos file_pos;
-		File() {
-
-			package = -1;
-		};
+		File() {}
 	};
 
 private:
 	struct Package {
 		String filename;
-		unzFile zfile;
+		unzFile zfile = nullptr;
 	};
 	Vector<Package> packages;
 

+ 1 - 18
core/io/http_client.cpp

@@ -729,27 +729,10 @@ int HTTPClient::get_read_chunk_size() const {
 }
 
 HTTPClient::HTTPClient() {
-
 	tcp_connection.instance();
-	resolving = IP::RESOLVER_INVALID_ID;
-	status = STATUS_DISCONNECTED;
-	head_request = false;
-	conn_port = -1;
-	body_size = -1;
-	chunked = false;
-	body_left = 0;
-	read_until_eof = false;
-	chunk_left = 0;
-	chunk_trailer_part = false;
-	response_num = 0;
-	ssl = false;
-	blocking = false;
-	handshaking = false;
-	read_chunk_size = 4096;
 }
 
-HTTPClient::~HTTPClient() {
-}
+HTTPClient::~HTTPClient() {}
 
 #endif // #ifndef JAVASCRIPT_ENABLED
 

+ 16 - 16
core/io/http_client.h

@@ -158,32 +158,32 @@ private:
 	};
 
 #ifndef JAVASCRIPT_ENABLED
-	Status status;
-	IP::ResolverID resolving;
-	int conn_port;
+	Status status = STATUS_DISCONNECTED;
+	IP::ResolverID resolving = IP::RESOLVER_INVALID_ID;
+	int conn_port = -1;
 	String conn_host;
-	bool ssl;
-	bool ssl_verify_host;
-	bool blocking;
-	bool handshaking;
-	bool head_request;
+	bool ssl = false;
+	bool ssl_verify_host = false;
+	bool blocking = false;
+	bool handshaking = false;
+	bool head_request = false;
 
 	Vector<uint8_t> response_str;
 
-	bool chunked;
+	bool chunked = false;
 	Vector<uint8_t> chunk;
-	int chunk_left;
-	bool chunk_trailer_part;
-	int body_size;
-	int body_left;
-	bool read_until_eof;
+	int chunk_left = 0;
+	bool chunk_trailer_part = false;
+	int body_size = -1;
+	int body_left = 0;
+	bool read_until_eof = false;
 
 	Ref<StreamPeerTCP> tcp_connection;
 	Ref<StreamPeer> connection;
 
-	int response_num;
+	int response_num = 0;
 	Vector<String> response_headers;
-	int read_chunk_size;
+	int read_chunk_size = 4096;
 
 	Error _get_http_data(uint8_t *p_buffer, int p_bytes, int &r_received);
 

+ 1 - 6
core/io/logger.cpp

@@ -102,8 +102,6 @@ void Logger::logf_error(const char *p_format, ...) {
 	va_end(argp);
 }
 
-Logger::~Logger() {}
-
 void RotatedFileLogger::close_file() {
 	if (file) {
 		memdelete(file);
@@ -180,8 +178,7 @@ void RotatedFileLogger::rotate_file() {
 
 RotatedFileLogger::RotatedFileLogger(const String &p_base_path, int p_max_files) :
 		base_path(p_base_path.simplify_path()),
-		max_files(p_max_files > 0 ? p_max_files : 1),
-		file(nullptr) {
+		max_files(p_max_files > 0 ? p_max_files : 1) {
 	rotate_file();
 }
 
@@ -236,8 +233,6 @@ void StdLogger::logv(const char *p_format, va_list p_list, bool p_err) {
 	}
 }
 
-StdLogger::~StdLogger() {}
-
 CompositeLogger::CompositeLogger(Vector<Logger *> p_loggers) :
 		loggers(p_loggers) {
 }

+ 3 - 3
core/io/logger.h

@@ -55,7 +55,7 @@ public:
 	void logf(const char *p_format, ...) _PRINTF_FORMAT_ATTRIBUTE_2_3;
 	void logf_error(const char *p_format, ...) _PRINTF_FORMAT_ATTRIBUTE_2_3;
 
-	virtual ~Logger();
+	virtual ~Logger() {}
 };
 
 /**
@@ -65,7 +65,7 @@ class StdLogger : public Logger {
 
 public:
 	virtual void logv(const char *p_format, va_list p_list, bool p_err) _PRINTF_FORMAT_ATTRIBUTE_2_0;
-	virtual ~StdLogger();
+	virtual ~StdLogger() {}
 };
 
 /**
@@ -78,7 +78,7 @@ class RotatedFileLogger : public Logger {
 	String base_path;
 	int max_files;
 
-	FileAccess *file;
+	FileAccess *file = nullptr;
 
 	void rotate_file_without_closing();
 	void close_file();

+ 0 - 3
core/io/marshalls.cpp

@@ -53,9 +53,6 @@ ObjectID EncodedObjectAsID::get_object_id() const {
 	return id;
 }
 
-EncodedObjectAsID::EncodedObjectAsID() {
-}
-
 #define _S(a) ((int32_t)a)
 #define ERR_FAIL_ADD_OF(a, b, err) ERR_FAIL_COND_V(_S(b) < 0 || _S(a) < 0 || _S(a) > INT_MAX - _S(b), err)
 #define ERR_FAIL_MUL_OF(a, b, err) ERR_FAIL_COND_V(_S(a) < 0 || _S(b) <= 0 || _S(a) > INT_MAX / _S(b), err)

+ 1 - 1
core/io/marshalls.h

@@ -197,7 +197,7 @@ public:
 	void set_object_id(ObjectID p_id);
 	ObjectID get_object_id() const;
 
-	EncodedObjectAsID();
+	EncodedObjectAsID() {}
 };
 
 Error decode_variant(Variant &r_variant, const uint8_t *p_buffer, int p_len, int *r_len = nullptr, bool p_allow_objects = false);

+ 2 - 4
core/io/multiplayer_api.cpp

@@ -33,6 +33,7 @@
 #include "core/debugger/engine_debugger.h"
 #include "core/io/marshalls.h"
 #include "scene/main/node.h"
+
 #include <stdint.h>
 
 #define NODE_ID_COMPRESSION_SHIFT 3
@@ -1261,10 +1262,7 @@ void MultiplayerAPI::_bind_methods() {
 	BIND_ENUM_CONSTANT(RPC_MODE_PUPPETSYNC);
 }
 
-MultiplayerAPI::MultiplayerAPI() :
-		allow_object_decoding(false) {
-	rpc_sender_id = 0;
-	root_node = nullptr;
+MultiplayerAPI::MultiplayerAPI() {
 	clear();
 }
 

+ 3 - 3
core/io/multiplayer_api.h

@@ -56,14 +56,14 @@ private:
 	};
 
 	Ref<NetworkedMultiplayerPeer> network_peer;
-	int rpc_sender_id;
+	int rpc_sender_id = 0;
 	Set<int> connected_peers;
 	HashMap<NodePath, PathSentCache> path_send_cache;
 	Map<int, PathGetCache> path_get_cache;
 	int last_send_cache_id;
 	Vector<uint8_t> packet_cache;
-	Node *root_node;
-	bool allow_object_decoding;
+	Node *root_node = nullptr;
+	bool allow_object_decoding = false;
 
 protected:
 	static void _bind_methods();

+ 0 - 3
core/io/networked_multiplayer_peer.cpp

@@ -66,6 +66,3 @@ void NetworkedMultiplayerPeer::_bind_methods() {
 	ADD_SIGNAL(MethodInfo("connection_succeeded"));
 	ADD_SIGNAL(MethodInfo("connection_failed"));
 }
-
-NetworkedMultiplayerPeer::NetworkedMultiplayerPeer() {
-}

+ 1 - 1
core/io/networked_multiplayer_peer.h

@@ -74,7 +74,7 @@ public:
 
 	virtual ConnectionStatus get_connection_status() const = 0;
 
-	NetworkedMultiplayerPeer();
+	NetworkedMultiplayerPeer() {}
 };
 
 VARIANT_ENUM_CAST(NetworkedMultiplayerPeer::TransferMode)

+ 0 - 5
core/io/packet_peer.cpp

@@ -35,11 +35,6 @@
 
 /* helpers / binders */
 
-PacketPeer::PacketPeer() :
-		last_get_error(OK),
-		encode_buffer_max_size(8 * 1024 * 1024) {
-}
-
 void PacketPeer::set_encode_buffer_max_size(int p_max_size) {
 
 	ERR_FAIL_COND_MSG(p_max_size < 1024, "Max encode buffer must be at least 1024 bytes");

+ 3 - 3
core/io/packet_peer.h

@@ -47,9 +47,9 @@ class PacketPeer : public Reference {
 	Vector<uint8_t> _get_packet();
 	Error _get_packet_error() const;
 
-	mutable Error last_get_error;
+	mutable Error last_get_error = OK;
 
-	int encode_buffer_max_size;
+	int encode_buffer_max_size = 8 * 1024 * 1024;
 	Vector<uint8_t> encode_buffer;
 
 public:
@@ -70,7 +70,7 @@ public:
 	void set_encode_buffer_max_size(int p_max_size);
 	int get_encode_buffer_max_size() const;
 
-	PacketPeer();
+	PacketPeer() {}
 	~PacketPeer() {}
 };
 

+ 0 - 3
core/io/packet_peer_dtls.cpp

@@ -57,6 +57,3 @@ void PacketPeerDTLS::_bind_methods() {
 	BIND_ENUM_CONSTANT(STATUS_ERROR);
 	BIND_ENUM_CONSTANT(STATUS_ERROR_HOSTNAME_MISMATCH);
 }
-
-PacketPeerDTLS::PacketPeerDTLS() {
-}

+ 1 - 1
core/io/packet_peer_dtls.h

@@ -60,7 +60,7 @@ public:
 	static PacketPeerDTLS *create();
 	static bool is_available();
 
-	PacketPeerDTLS();
+	PacketPeerDTLS() {}
 };
 
 VARIANT_ENUM_CAST(PacketPeerDTLS::Status);

+ 0 - 6
core/io/packet_peer_udp.cpp

@@ -343,12 +343,6 @@ void PacketPeerUDP::_bind_methods() {
 }
 
 PacketPeerUDP::PacketPeerUDP() :
-		packet_port(0),
-		queue_count(0),
-		peer_port(0),
-		connected(false),
-		blocking(true),
-		broadcast(false),
 		_sock(Ref<NetSocket>(NetSocket::create())) {
 	rb.resize(16);
 }

+ 6 - 6
core/io/packet_peer_udp.h

@@ -47,14 +47,14 @@ protected:
 	uint8_t recv_buffer[PACKET_BUFFER_SIZE];
 	uint8_t packet_buffer[PACKET_BUFFER_SIZE];
 	IP_Address packet_ip;
-	int packet_port;
-	int queue_count;
+	int packet_port = 0;
+	int queue_count = 0;
 
 	IP_Address peer_addr;
-	int peer_port;
-	bool connected;
-	bool blocking;
-	bool broadcast;
+	int peer_port = 0;
+	bool connected = false;
+	bool blocking = true;
+	bool broadcast = false;
 	Ref<NetSocket> _sock;
 
 	static void _bind_methods();

+ 0 - 5
core/io/pck_packer.cpp

@@ -180,11 +180,6 @@ Error PCKPacker::flush(bool p_verbose) {
 	return OK;
 };
 
-PCKPacker::PCKPacker() {
-
-	file = nullptr;
-};
-
 PCKPacker::~PCKPacker() {
 	if (file != nullptr) {
 		memdelete(file);

+ 2 - 2
core/io/pck_packer.h

@@ -39,7 +39,7 @@ class PCKPacker : public Reference {
 
 	GDCLASS(PCKPacker, Reference);
 
-	FileAccess *file;
+	FileAccess *file = nullptr;
 	int alignment;
 
 	static void _bind_methods();
@@ -58,7 +58,7 @@ public:
 	Error add_file(const String &p_file, const String &p_src);
 	Error flush(bool p_verbose = false);
 
-	PCKPacker();
+	PCKPacker() {}
 	~PCKPacker();
 };
 

+ 0 - 13
core/io/resource_format_binary.cpp

@@ -1024,18 +1024,6 @@ String ResourceLoaderBinary::recognize(FileAccess *p_f) {
 	return type;
 }
 
-ResourceLoaderBinary::ResourceLoaderBinary() :
-		translation_remapped(false),
-		ver_format(0),
-		f(nullptr),
-		importmd_ofs(0),
-		error(OK) {
-
-	use_nocache = false;
-	progress = nullptr;
-	use_sub_threads = false;
-}
-
 ResourceLoaderBinary::~ResourceLoaderBinary() {
 
 	if (f)
@@ -2118,6 +2106,5 @@ void ResourceFormatSaverBinary::get_recognized_extensions(const RES &p_resource,
 ResourceFormatSaverBinary *ResourceFormatSaverBinary::singleton = nullptr;
 
 ResourceFormatSaverBinary::ResourceFormatSaverBinary() {
-
 	singleton = this;
 }

+ 9 - 9
core/io/resource_format_binary.h

@@ -37,16 +37,16 @@
 
 class ResourceLoaderBinary {
 
-	bool translation_remapped;
+	bool translation_remapped = false;
 	String local_path;
 	String res_path;
 	String type;
 	Ref<Resource> resource;
-	uint32_t ver_format;
+	uint32_t ver_format = 0;
 
-	FileAccess *f;
+	FileAccess *f = nullptr;
 
-	uint64_t importmd_ofs;
+	uint64_t importmd_ofs = 0;
 
 	Vector<char> str_buf;
 	List<RES> resource_cache;
@@ -61,8 +61,8 @@ class ResourceLoaderBinary {
 		RES cache;
 	};
 
-	bool use_sub_threads;
-	float *progress;
+	bool use_sub_threads = false;
+	float *progress = nullptr;
 	Vector<ExtResource> external_resources;
 
 	struct IntResource {
@@ -77,9 +77,9 @@ class ResourceLoaderBinary {
 	void _advance_padding(uint32_t p_len);
 
 	Map<String, String> remaps;
-	Error error;
+	Error error = OK;
 
-	bool use_nocache;
+	bool use_nocache = false;
 
 	friend class ResourceFormatLoaderBinary;
 
@@ -98,7 +98,7 @@ public:
 	String recognize(FileAccess *p_f);
 	void get_dependencies(FileAccess *p_f, List<String> *p_dependencies, bool p_add_types);
 
-	ResourceLoaderBinary();
+	ResourceLoaderBinary() {}
 	~ResourceLoaderBinary();
 };
 

+ 0 - 1
core/io/resource_loader.cpp

@@ -33,7 +33,6 @@
 #include "core/io/resource_importer.h"
 #include "core/os/file_access.h"
 #include "core/os/os.h"
-#include "core/path_remap.h"
 #include "core/print_string.h"
 #include "core/project_settings.h"
 #include "core/translation.h"

+ 0 - 5
core/io/stream_peer.cpp

@@ -536,8 +536,3 @@ Ref<StreamPeerBuffer> StreamPeerBuffer::duplicate() const {
 	spb->data = data;
 	return spb;
 }
-
-StreamPeerBuffer::StreamPeerBuffer() {
-
-	pointer = 0;
-}

+ 4 - 4
core/io/stream_peer.h

@@ -47,7 +47,7 @@ protected:
 	Array _get_data(int p_bytes);
 	Array _get_partial_data(int p_bytes);
 
-	bool big_endian;
+	bool big_endian = false;
 
 public:
 	virtual Error put_data(const uint8_t *p_data, int p_bytes) = 0; ///< put a whole chunk of data, blocking until it sent
@@ -89,7 +89,7 @@ public:
 	String get_utf8_string(int p_bytes = -1);
 	Variant get_var(bool p_allow_objects = false);
 
-	StreamPeer() { big_endian = false; }
+	StreamPeer() {}
 };
 
 class StreamPeerBuffer : public StreamPeer {
@@ -97,7 +97,7 @@ class StreamPeerBuffer : public StreamPeer {
 	GDCLASS(StreamPeerBuffer, StreamPeer);
 
 	Vector<uint8_t> data;
-	int pointer;
+	int pointer = 0;
 
 protected:
 	static void _bind_methods();
@@ -123,7 +123,7 @@ public:
 
 	Ref<StreamPeerBuffer> duplicate() const;
 
-	StreamPeerBuffer();
+	StreamPeerBuffer() {}
 };
 
 #endif // STREAM_PEER_H

+ 0 - 4
core/io/stream_peer_ssl.cpp

@@ -73,7 +73,3 @@ void StreamPeerSSL::_bind_methods() {
 	BIND_ENUM_CONSTANT(STATUS_ERROR);
 	BIND_ENUM_CONSTANT(STATUS_ERROR_HOSTNAME_MISMATCH);
 }
-
-StreamPeerSSL::StreamPeerSSL() {
-	blocking_handshake = true;
-}

+ 2 - 2
core/io/stream_peer_ssl.h

@@ -43,7 +43,7 @@ protected:
 
 	static bool available;
 
-	bool blocking_handshake;
+	bool blocking_handshake = true;
 
 public:
 	enum Status {
@@ -68,7 +68,7 @@ public:
 
 	static bool is_available();
 
-	StreamPeerSSL();
+	StreamPeerSSL() {}
 };
 
 VARIANT_ENUM_CAST(StreamPeerSSL::Status);

+ 1 - 4
core/io/stream_peer_tcp.cpp

@@ -362,10 +362,7 @@ void StreamPeerTCP::_bind_methods() {
 }
 
 StreamPeerTCP::StreamPeerTCP() :
-		_sock(Ref<NetSocket>(NetSocket::create())),
-		timeout(0),
-		status(STATUS_NONE),
-		peer_port(0) {
+		_sock(Ref<NetSocket>(NetSocket::create())) {
 }
 
 StreamPeerTCP::~StreamPeerTCP() {

+ 3 - 3
core/io/stream_peer_tcp.h

@@ -52,10 +52,10 @@ public:
 
 protected:
 	Ref<NetSocket> _sock;
-	uint64_t timeout;
-	Status status;
+	uint64_t timeout = 0;
+	Status status = STATUS_NONE;
 	IP_Address peer_host;
-	uint16_t peer_port;
+	uint16_t peer_port = 0;
 
 	Error _connect(const String &p_address, int p_port);
 	Error _poll_connection();

+ 0 - 3
core/io/translation_loader_po.cpp

@@ -212,6 +212,3 @@ String TranslationLoaderPO::get_resource_type(const String &p_path) const {
 		return "Translation";
 	return "";
 }
-
-TranslationLoaderPO::TranslationLoaderPO() {
-}

+ 1 - 1
core/io/translation_loader_po.h

@@ -43,7 +43,7 @@ public:
 	virtual bool handles_type(const String &p_type) const;
 	virtual String get_resource_type(const String &p_path) const;
 
-	TranslationLoaderPO();
+	TranslationLoaderPO() {}
 };
 
 #endif // TRANSLATION_LOADER_PO_H

+ 0 - 3
core/io/xml_parser.cpp

@@ -543,9 +543,6 @@ int XMLParser::get_current_line() const {
 }
 
 XMLParser::XMLParser() {
-
-	data = nullptr;
-	close();
 	special_characters.push_back("&amp;");
 	special_characters.push_back("<lt;");
 	special_characters.push_back(">gt;");

+ 6 - 6
core/io/xml_parser.h

@@ -66,15 +66,15 @@ public:
 	};
 
 private:
-	char *data;
-	char *P;
-	uint64_t length;
+	char *data = nullptr;
+	char *P = nullptr;
+	uint64_t length = 0;
 	void unescape(String &p_str);
 	Vector<String> special_characters;
 	String node_name;
-	bool node_empty;
-	NodeType node_type;
-	uint64_t node_offset;
+	bool node_empty = false;
+	NodeType node_type = NODE_NONE;
+	uint64_t node_offset = 0;
 
 	struct Attribute {
 		String name;

+ 7 - 13
core/list.h

@@ -54,9 +54,9 @@ public:
 		friend class List<T, A>;
 
 		T value;
-		Element *next_ptr;
-		Element *prev_ptr;
-		_Data *data;
+		Element *next_ptr = nullptr;
+		Element *prev_ptr = nullptr;
+		_Data *data = nullptr;
 
 	public:
 		/**
@@ -139,11 +139,7 @@ public:
 			data->erase(this);
 		}
 
-		_FORCE_INLINE_ Element() {
-			next_ptr = 0;
-			prev_ptr = 0;
-			data = nullptr;
-		};
+		_FORCE_INLINE_ Element() {}
 	};
 
 private:
@@ -178,7 +174,7 @@ private:
 		}
 	};
 
-	_Data *_data;
+	_Data *_data = nullptr;
 
 public:
 	/**
@@ -687,7 +683,6 @@ public:
 	 */
 	List(const List &p_list) {
 
-		_data = nullptr;
 		const Element *it = p_list.front();
 		while (it) {
 
@@ -696,9 +691,8 @@ public:
 		}
 	}
 
-	List() {
-		_data = nullptr;
-	};
+	List() {}
+
 	~List() {
 		clear();
 		if (_data) {

+ 10 - 20
core/map.h

@@ -51,12 +51,12 @@ public:
 
 	private:
 		friend class Map<K, V, C, A>;
-		int color;
-		Element *right;
-		Element *left;
-		Element *parent;
-		Element *_next;
-		Element *_prev;
+		int color = RED;
+		Element *right = nullptr;
+		Element *left = nullptr;
+		Element *parent = nullptr;
+		Element *_next = nullptr;
+		Element *_prev = nullptr;
 		K _key;
 		V _value;
 		//_Data *data;
@@ -93,22 +93,15 @@ public:
 		const V &get() const {
 			return _value;
 		};
-		Element() {
-			color = RED;
-			right = nullptr;
-			left = nullptr;
-			parent = nullptr;
-			_next = nullptr;
-			_prev = nullptr;
-		};
+		Element() {}
 	};
 
 private:
 	struct _Data {
 
-		Element *_root;
+		Element *_root = nullptr;
 		Element *_nil;
-		int size_cache;
+		int size_cache = 0;
 
 		_FORCE_INLINE_ _Data() {
 #ifdef GLOBALNIL_DISABLED
@@ -118,8 +111,6 @@ private:
 #else
 			_nil = (Element *)&_GlobalNilClass::_nil;
 #endif
-			_root = nullptr;
-			size_cache = 0;
 		}
 
 		void _create_root() {
@@ -673,8 +664,7 @@ public:
 		_copy_from(p_map);
 	}
 
-	_FORCE_INLINE_ Map() {
-	}
+	_FORCE_INLINE_ Map() {}
 
 	~Map() {
 

+ 0 - 11
core/math/a_star.cpp

@@ -585,11 +585,6 @@ void AStar::_bind_methods() {
 	BIND_VMETHOD(MethodInfo(Variant::FLOAT, "_compute_cost", PropertyInfo(Variant::INT, "from_id"), PropertyInfo(Variant::INT, "to_id")));
 }
 
-AStar::AStar() {
-	last_free_id = 0;
-	pass = 1;
-}
-
 AStar::~AStar() {
 	clear();
 }
@@ -910,9 +905,3 @@ void AStar2D::_bind_methods() {
 	BIND_VMETHOD(MethodInfo(Variant::FLOAT, "_estimate_cost", PropertyInfo(Variant::INT, "from_id"), PropertyInfo(Variant::INT, "to_id")));
 	BIND_VMETHOD(MethodInfo(Variant::FLOAT, "_compute_cost", PropertyInfo(Variant::INT, "from_id"), PropertyInfo(Variant::INT, "to_id")));
 }
-
-AStar2D::AStar2D() {
-}
-
-AStar2D::~AStar2D() {
-}

+ 12 - 16
core/math/a_star.h

@@ -47,17 +47,15 @@ class AStar : public Reference {
 
 	struct Point {
 
-		Point() :
-				neighbours(4u),
-				unlinked_neighbours(4u) {}
+		Point() {}
 
 		int id;
 		Vector3 pos;
 		real_t weight_scale;
 		bool enabled;
 
-		OAHashMap<int, Point *> neighbours;
-		OAHashMap<int, Point *> unlinked_neighbours;
+		OAHashMap<int, Point *> neighbours = 4u;
+		OAHashMap<int, Point *> unlinked_neighbours = 4u;
 
 		// Used for pathfinding.
 		Point *prev_point;
@@ -85,7 +83,7 @@ class AStar : public Reference {
 				int32_t u;
 				int32_t v;
 			};
-			uint64_t key;
+			uint64_t key = 0;
 		};
 
 		enum {
@@ -94,13 +92,11 @@ class AStar : public Reference {
 			BACKWARD = 2,
 			BIDIRECTIONAL = FORWARD | BACKWARD
 		};
-		unsigned char direction;
+		unsigned char direction = NONE;
 
 		bool operator<(const Segment &p_s) const { return key < p_s.key; }
-		Segment() {
-			key = 0;
-			direction = NONE;
-		}
+
+		Segment() {}
 		Segment(int p_from, int p_to) {
 			if (p_from < p_to) {
 				u = p_from;
@@ -114,8 +110,8 @@ class AStar : public Reference {
 		}
 	};
 
-	int last_free_id;
-	uint64_t pass;
+	int last_free_id = 0;
+	uint64_t pass = 1;
 
 	OAHashMap<int, Point *> points;
 	Set<Segment> segments;
@@ -159,7 +155,7 @@ public:
 	Vector<Vector3> get_point_path(int p_from_id, int p_to_id);
 	Vector<int> get_id_path(int p_from_id, int p_to_id);
 
-	AStar();
+	AStar() {}
 	~AStar();
 };
 
@@ -206,8 +202,8 @@ public:
 	Vector<Vector2> get_point_path(int p_from_id, int p_to_id);
 	Vector<int> get_id_path(int p_from_id, int p_to_id);
 
-	AStar2D();
-	~AStar2D();
+	AStar2D() {}
+	~AStar2D() {}
 };
 
 #endif // A_STAR_H

+ 0 - 31
core/math/audio_frame.cpp

@@ -1,31 +0,0 @@
-/*************************************************************************/
-/*  audio_frame.cpp                                                      */
-/*************************************************************************/
-/*                       This file is part of:                           */
-/*                           GODOT ENGINE                                */
-/*                      https://godotengine.org                          */
-/*************************************************************************/
-/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur.                 */
-/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md).   */
-/*                                                                       */
-/* Permission is hereby granted, free of charge, to any person obtaining */
-/* a copy of this software and associated documentation files (the       */
-/* "Software"), to deal in the Software without restriction, including   */
-/* without limitation the rights to use, copy, modify, merge, publish,   */
-/* distribute, sublicense, and/or sell copies of the Software, and to    */
-/* permit persons to whom the Software is furnished to do so, subject to */
-/* the following conditions:                                             */
-/*                                                                       */
-/* The above copyright notice and this permission notice shall be        */
-/* included in all copies or substantial portions of the Software.       */
-/*                                                                       */
-/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,       */
-/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF    */
-/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
-/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY  */
-/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,  */
-/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE     */
-/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.                */
-/*************************************************************************/
-
-#include "audio_frame.h"

+ 4 - 7
core/math/delaunay_2d.h

@@ -36,24 +36,21 @@
 class Delaunay2D {
 public:
 	struct Triangle {
-
 		int points[3];
-		bool bad;
-		Triangle() { bad = false; }
+		bool bad = false;
+		Triangle() {}
 		Triangle(int p_a, int p_b, int p_c) {
 			points[0] = p_a;
 			points[1] = p_b;
 			points[2] = p_c;
-			bad = false;
 		}
 	};
 
 	struct Edge {
 		int edge[2];
-		bool bad;
-		Edge() { bad = false; }
+		bool bad = false;
+		Edge() {}
 		Edge(int p_a, int p_b) {
-			bad = false;
 			edge[0] = p_a;
 			edge[1] = p_b;
 		}

+ 2 - 6
core/math/delaunay_3d.h

@@ -45,12 +45,12 @@ class Delaunay3D {
 
 	struct Triangle {
 		uint32_t triangle[3];
-		bool bad;
+		bool bad = false;
 		_FORCE_INLINE_ bool operator==(const Triangle &p_triangle) const {
 			return triangle[0] == p_triangle.triangle[0] && triangle[1] == p_triangle.triangle[1] && triangle[2] == p_triangle.triangle[2];
 		}
 
-		_FORCE_INLINE_ Triangle() { bad = false; }
+		_FORCE_INLINE_ Triangle() {}
 		_FORCE_INLINE_ Triangle(uint32_t p_a, uint32_t p_b, uint32_t p_c) {
 			if (p_a > p_b)
 				SWAP(p_a, p_b);
@@ -59,7 +59,6 @@ class Delaunay3D {
 			if (p_a > p_b)
 				SWAP(p_a, p_b);
 
-			bad = false;
 			triangle[0] = p_a;
 			triangle[1] = p_b;
 			triangle[2] = p_c;
@@ -74,9 +73,6 @@ class Delaunay3D {
 		}
 	};
 
-	struct FPVal {
-	};
-
 	_FORCE_INLINE_ static void circum_sphere_compute(const Vector3 *p_points, Simplex *p_simplex) {
 
 		// the only part in the algorithm where there may be precision errors is this one, so ensure that

+ 0 - 31
core/math/disjoint_set.cpp

@@ -1,31 +0,0 @@
-/*************************************************************************/
-/*  disjoint_set.cpp                                                     */
-/*************************************************************************/
-/*                       This file is part of:                           */
-/*                           GODOT ENGINE                                */
-/*                      https://godotengine.org                          */
-/*************************************************************************/
-/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur.                 */
-/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md).   */
-/*                                                                       */
-/* Permission is hereby granted, free of charge, to any person obtaining */
-/* a copy of this software and associated documentation files (the       */
-/* "Software"), to deal in the Software without restriction, including   */
-/* without limitation the rights to use, copy, modify, merge, publish,   */
-/* distribute, sublicense, and/or sell copies of the Software, and to    */
-/* permit persons to whom the Software is furnished to do so, subject to */
-/* the following conditions:                                             */
-/*                                                                       */
-/* The above copyright notice and this permission notice shall be        */
-/* included in all copies or substantial portions of the Software.       */
-/*                                                                       */
-/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,       */
-/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF    */
-/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
-/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY  */
-/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,  */
-/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE     */
-/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.                */
-/*************************************************************************/
-
-#include "disjoint_set.h"

+ 0 - 11
core/math/expression.cpp

@@ -2298,17 +2298,6 @@ void Expression::_bind_methods() {
 	ClassDB::bind_method(D_METHOD("get_error_text"), &Expression::get_error_text);
 }
 
-Expression::Expression() :
-		output_type(Variant::NIL),
-		sequenced(false),
-		error_set(true),
-		root(nullptr),
-		nodes(nullptr),
-		execution_error(false) {
-	str_ofs = 0;
-	expression_dirty = false;
-}
-
 Expression::~Expression() {
 
 	if (nodes) {

+ 13 - 15
core/math/expression.h

@@ -119,22 +119,20 @@ private:
 
 	struct Input {
 
-		Variant::Type type;
+		Variant::Type type = Variant::NIL;
 		String name;
 
-		Input() :
-				type(Variant::NIL) {
-		}
+		Input() {}
 	};
 
 	Vector<Input> inputs;
-	Variant::Type output_type;
+	Variant::Type output_type = Variant::NIL;
 
 	String expression;
 
-	bool sequenced;
-	int str_ofs;
-	bool expression_dirty;
+	bool sequenced = false;
+	int str_ofs = 0;
+	bool expression_dirty = false;
 
 	bool _compile_expression();
 
@@ -197,7 +195,7 @@ private:
 	Error _get_token(Token &r_token);
 
 	String error_str;
-	bool error_set;
+	bool error_set = true;
 
 	struct ENode {
 
@@ -215,11 +213,11 @@ private:
 			TYPE_CALL
 		};
 
-		ENode *next;
+		ENode *next = nullptr;
 
 		Type type;
 
-		ENode() { next = nullptr; }
+		ENode() {}
 		virtual ~ENode() {
 			if (next) {
 				memdelete(next);
@@ -339,12 +337,12 @@ private:
 		return node;
 	}
 
-	ENode *root;
-	ENode *nodes;
+	ENode *root = nullptr;
+	ENode *nodes = nullptr;
 
 	Vector<String> input_names;
 
-	bool execution_error;
+	bool execution_error = false;
 	bool _execute(const Array &p_inputs, Object *p_instance, Expression::ENode *p_node, Variant &r_ret, String &r_error_str);
 
 protected:
@@ -356,7 +354,7 @@ public:
 	bool has_execute_failed() const;
 	String get_error_text() const;
 
-	Expression();
+	Expression() {}
 	~Expression();
 };
 

+ 6 - 12
core/math/geometry.cpp

@@ -104,25 +104,19 @@ struct _FaceClassify {
 
 	struct _Link {
 
-		int face;
-		int edge;
+		int face = -1;
+		int edge = -1;
 		void clear() {
 			face = -1;
 			edge = -1;
 		}
-		_Link() {
-			face = -1;
-			edge = -1;
-		}
+		_Link() {}
 	};
-	bool valid;
-	int group;
+	bool valid = false;
+	int group = -1;
 	_Link links[3];
 	Face3 face;
-	_FaceClassify() {
-		group = -1;
-		valid = false;
-	};
+	_FaceClassify() {}
 };
 
 static bool _connect_faces(_FaceClassify *p_faces, int len, int p_group) {

+ 17 - 42
core/math/octree.h

@@ -52,7 +52,6 @@ public:
 
 private:
 	enum {
-
 		NEG = 0,
 		POS = 1,
 	};
@@ -106,49 +105,35 @@ private:
 		// cached for FAST plane check
 		AABB aabb;
 
-		uint64_t last_pass;
-		Octant *parent;
-		Octant *children[8];
+		uint64_t last_pass = 0;
+		Octant *parent = nullptr;
+		Octant *children[8] = { nullptr };
 
-		int children_count; // cache for amount of childrens (fast check for removal)
-		int parent_index; // cache for parent index (fast check for removal)
+		int children_count = 0; // cache for amount of childrens (fast check for removal)
+		int parent_index = -1; // cache for parent index (fast check for removal)
 
 		List<Element *, AL> pairable_elements;
 		List<Element *, AL> elements;
 
-		Octant() {
-			children_count = 0;
-			parent_index = -1;
-			last_pass = 0;
-			parent = nullptr;
-			for (int i = 0; i < 8; i++)
-				children[i] = nullptr;
-		}
-
-		~Octant() {
-
-			/*
-			for (int i=0;i<8;i++)
-				memdelete_notnull(children[i]);
-			*/
-		}
+		Octant() {}
+		~Octant() {}
 	};
 
 	struct PairData;
 
 	struct Element {
 
-		Octree *octree;
+		Octree *octree = nullptr;
 
-		T *userdata;
-		int subindex;
-		bool pairable;
-		uint32_t pairable_mask;
-		uint32_t pairable_type;
+		T *userdata = nullptr;
+		int subindex = 0;
+		bool pairable = false;
+		uint32_t pairable_mask = 0;
+		uint32_t pairable_type = 0;
 
-		uint64_t last_pass;
-		OctreeElementID _id;
-		Octant *common_parent;
+		uint64_t last_pass = 0;
+		OctreeElementID _id = 0;
+		Octant *common_parent = nullptr;
 
 		AABB aabb;
 		AABB container_aabb;
@@ -163,17 +148,7 @@ private:
 
 		List<OctantOwner, AL> octant_owners;
 
-		Element() {
-			last_pass = 0;
-			_id = 0;
-			pairable = false;
-			subindex = 0;
-			userdata = 0;
-			octree = 0;
-			pairable_mask = 0;
-			pairable_type = 0;
-			common_parent = nullptr;
-		}
+		Element() {}
 	};
 
 	struct PairData {

+ 2 - 3
core/math/plane.h

@@ -36,7 +36,7 @@
 class Plane {
 public:
 	Vector3 normal;
-	real_t d;
+	real_t d = 0;
 
 	void set_normal(const Vector3 &p_normal);
 	_FORCE_INLINE_ Vector3 get_normal() const { return normal; }; ///Point is coplanar, CMP_EPSILON for precision
@@ -75,8 +75,7 @@ public:
 	_FORCE_INLINE_ bool operator!=(const Plane &p_plane) const;
 	operator String() const;
 
-	_FORCE_INLINE_ Plane() :
-			d(0) {}
+	_FORCE_INLINE_ Plane() {}
 	_FORCE_INLINE_ Plane(real_t p_a, real_t p_b, real_t p_c, real_t p_d) :
 			normal(p_a, p_b, p_c),
 			d(p_d) {}

+ 4 - 9
core/math/quat.h

@@ -40,7 +40,7 @@
 
 class Quat {
 public:
-	real_t x, y, z, w;
+	real_t x = 0, y = 0, z = 0, w = 1;
 
 	_FORCE_INLINE_ real_t length_squared() const;
 	bool is_equal_approx(const Quat &p_quat) const;
@@ -112,7 +112,9 @@ public:
 		z = p_z;
 		w = p_w;
 	}
-	inline Quat(real_t p_x, real_t p_y, real_t p_z, real_t p_w) :
+
+	_FORCE_INLINE_ Quat() {}
+	_FORCE_INLINE_ Quat(real_t p_x, real_t p_y, real_t p_z, real_t p_w) :
 			x(p_x),
 			y(p_y),
 			z(p_z),
@@ -157,13 +159,6 @@ public:
 			w = s * 0.5;
 		}
 	}
-
-	inline Quat() :
-			x(0),
-			y(0),
-			z(0),
-			w(1) {
-	}
 };
 
 real_t Quat::dot(const Quat &q) const {

+ 4 - 10
core/math/quick_hull.h

@@ -75,18 +75,12 @@ public:
 
 private:
 	struct FaceConnect {
-		List<Face>::Element *left, *right;
-		FaceConnect() {
-			left = nullptr;
-			right = nullptr;
-		}
+		List<Face>::Element *left, *right = nullptr;
+		FaceConnect() {}
 	};
 	struct RetFaceConnect {
-		List<Geometry::MeshData::Face>::Element *left, *right;
-		RetFaceConnect() {
-			left = nullptr;
-			right = nullptr;
-		}
+		List<Geometry::MeshData::Face>::Element *left, *right = nullptr;
+		RetFaceConnect() {}
 	};
 
 public:

+ 0 - 2
core/math/random_number_generator.cpp

@@ -30,8 +30,6 @@
 
 #include "random_number_generator.h"
 
-RandomNumberGenerator::RandomNumberGenerator() {}
-
 void RandomNumberGenerator::_bind_methods() {
 	ClassDB::bind_method(D_METHOD("set_seed", "seed"), &RandomNumberGenerator::set_seed);
 	ClassDB::bind_method(D_METHOD("get_seed"), &RandomNumberGenerator::get_seed);

+ 1 - 1
core/math/random_number_generator.h

@@ -65,7 +65,7 @@ public:
 			return ret % (to - from + 1) + from;
 	}
 
-	RandomNumberGenerator();
+	RandomNumberGenerator() {}
 };
 
 #endif // RANDOM_NUMBER_GENERATOR_H

+ 2 - 1
core/math/rect2.h

@@ -393,11 +393,12 @@ struct Rect2i {
 	operator String() const { return String(position) + ", " + String(size); }
 
 	operator Rect2() const { return Rect2(position, size); }
+
+	Rect2i() {}
 	Rect2i(const Rect2 &p_r2) :
 			position(p_r2.position),
 			size(p_r2.size) {
 	}
-	Rect2i() {}
 	Rect2i(int p_x, int p_y, int p_width, int p_height) :
 			position(Point2(p_x, p_y)),
 			size(Size2(p_width, p_height)) {

+ 7 - 9
core/math/vector2.h

@@ -44,11 +44,11 @@ struct Vector2 {
 	};
 
 	union {
-		real_t x;
+		real_t x = 0;
 		real_t width;
 	};
 	union {
-		real_t y;
+		real_t y = 0;
 		real_t height;
 	};
 
@@ -142,11 +142,11 @@ struct Vector2 {
 
 	operator String() const { return String::num(x) + ", " + String::num(y); }
 
+	_FORCE_INLINE_ Vector2() {}
 	_FORCE_INLINE_ Vector2(real_t p_x, real_t p_y) {
 		x = p_x;
 		y = p_y;
 	}
-	_FORCE_INLINE_ Vector2() { x = y = 0; }
 };
 
 _FORCE_INLINE_ Vector2 Vector2::plane_project(real_t p_d, const Vector2 &p_vec) const {
@@ -260,11 +260,11 @@ struct Vector2i {
 	};
 
 	union {
-		int x;
+		int x = 0;
 		int width;
 	};
 	union {
-		int y;
+		int y = 0;
 		int height;
 	};
 
@@ -307,6 +307,8 @@ struct Vector2i {
 	operator String() const { return String::num(x) + ", " + String::num(y); }
 
 	operator Vector2() const { return Vector2(x, y); }
+
+	inline Vector2i() {}
 	inline Vector2i(const Vector2 &p_vec2) {
 		x = (int)p_vec2.x;
 		y = (int)p_vec2.y;
@@ -315,10 +317,6 @@ struct Vector2i {
 		x = p_x;
 		y = p_y;
 	}
-	inline Vector2i() {
-		x = 0;
-		y = 0;
-	}
 };
 
 typedef Vector2i Size2i;

+ 2 - 3
core/math/vector3.h

@@ -52,7 +52,7 @@ struct Vector3 {
 			real_t z;
 		};
 
-		real_t coord[3];
+		real_t coord[3] = { 0 };
 	};
 
 	_FORCE_INLINE_ const real_t &operator[](int p_axis) const {
@@ -152,18 +152,17 @@ struct Vector3 {
 		return Vector3i(x, y, z);
 	}
 
+	_FORCE_INLINE_ Vector3() {}
 	_FORCE_INLINE_ Vector3(const Vector3i &p_ivec) {
 		x = p_ivec.x;
 		y = p_ivec.y;
 		z = p_ivec.z;
 	}
-
 	_FORCE_INLINE_ Vector3(real_t p_x, real_t p_y, real_t p_z) {
 		x = p_x;
 		y = p_y;
 		z = p_z;
 	}
-	_FORCE_INLINE_ Vector3() { x = y = z = 0; }
 };
 
 Vector3 Vector3::cross(const Vector3 &p_b) const {

+ 2 - 2
core/math/vector3i.h

@@ -49,7 +49,7 @@ struct Vector3i {
 			int32_t z;
 		};
 
-		int32_t coord[3];
+		int32_t coord[3] = { 0 };
 	};
 
 	_FORCE_INLINE_ const int32_t &operator[](int p_axis) const {
@@ -100,12 +100,12 @@ struct Vector3i {
 
 	operator String() const;
 
+	_FORCE_INLINE_ Vector3i() {}
 	_FORCE_INLINE_ Vector3i(int32_t p_x, int32_t p_y, int32_t p_z) {
 		x = p_x;
 		y = p_y;
 		z = p_z;
 	}
-	_FORCE_INLINE_ Vector3i() { x = y = z = 0; }
 };
 
 Vector3i Vector3i::abs() const {

Энэ ялгаанд хэт олон файл өөрчлөгдсөн тул зарим файлыг харуулаагүй болно