From 1f6f364a56319eabd02c050746fe7df3f55ffee3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= Date: Tue, 12 May 2020 17:01:17 +0200 Subject: 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. --- core/os/file_access.h | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'core/os/file_access.h') diff --git a/core/os/file_access.h b/core/os/file_access.h index 0f85c447b6..0ee29abbc9 100644 --- a/core/os/file_access.h +++ b/core/os/file_access.h @@ -53,8 +53,8 @@ public: typedef void (*FileCloseFailNotify)(const String &); typedef FileAccess *(*CreateFunc)(); - bool endian_swap; - bool real_is_double; + bool endian_swap = false; + bool real_is_double = false; virtual uint32_t _get_unix_permissions(const String &p_file) = 0; virtual Error _set_unix_permissions(const String &p_file, uint32_t p_permissions) = 0; @@ -69,7 +69,7 @@ protected: private: static bool backup_save; - AccessType _access_type; + AccessType _access_type = ACCESS_FILESYSTEM; static CreateFunc create_func[ACCESS_MAX]; /** default file access creation function for a platform */ template static FileAccess *_create_builtin() { @@ -176,7 +176,7 @@ public: create_func[p_access] = _create_builtin; } - FileAccess(); + FileAccess() {} virtual ~FileAccess() {} }; @@ -188,8 +188,11 @@ struct FileAccessRef { } operator bool() const { return f != nullptr; } + FileAccess *f; + operator FileAccess *() { return f; } + FileAccessRef(FileAccess *fa) { f = fa; } ~FileAccessRef() { if (f) -- cgit v1.2.3