diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2020-05-12 17:01:17 +0200 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2020-05-14 10:01:56 +0200 |
commit | 1f6f364a56319eabd02c050746fe7df3f55ffee3 (patch) | |
tree | 8bebdce946466ce8e9476ccd46c9dba62c323938 /platform | |
parent | e7c9d818766a119089873e4941e4865fb36883ec (diff) |
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.
Diffstat (limited to 'platform')
-rw-r--r-- | platform/android/net_socket_android.cpp | 5 | ||||
-rw-r--r-- | platform/android/net_socket_android.h | 6 | ||||
-rw-r--r-- | platform/haiku/key_mapping_haiku.h | 2 | ||||
-rw-r--r-- | platform/iphone/export/export.cpp | 8 | ||||
-rw-r--r-- | platform/iphone/game_center.mm | 2 | ||||
-rw-r--r-- | platform/iphone/icloud.mm | 2 | ||||
-rw-r--r-- | platform/iphone/in_app_store.mm | 2 | ||||
-rw-r--r-- | platform/iphone/ios.mm | 2 | ||||
-rw-r--r-- | platform/iphone/os_iphone.cpp | 6 | ||||
-rw-r--r-- | platform/javascript/http_client.h.inc | 16 | ||||
-rw-r--r-- | platform/javascript/http_client_javascript.cpp | 10 | ||||
-rw-r--r-- | platform/linuxbsd/key_mapping_x11.h | 2 | ||||
-rw-r--r-- | platform/uwp/app.cpp | 10 | ||||
-rw-r--r-- | platform/uwp/app.h | 16 | ||||
-rw-r--r-- | platform/uwp/export/export.cpp | 22 | ||||
-rw-r--r-- | platform/windows/key_mapping_windows.h | 2 |
16 files changed, 41 insertions, 72 deletions
diff --git a/platform/android/net_socket_android.cpp b/platform/android/net_socket_android.cpp index 320bdd3817..dc0154ea01 100644 --- a/platform/android/net_socket_android.cpp +++ b/platform/android/net_socket_android.cpp @@ -72,11 +72,6 @@ void NetSocketAndroid::make_default() { _create = _create_func; } -NetSocketAndroid::NetSocketAndroid() : - wants_broadcast(false), - multicast_groups(0) { -} - NetSocketAndroid::~NetSocketAndroid() { close(); } diff --git a/platform/android/net_socket_android.h b/platform/android/net_socket_android.h index 4fc80d2de1..7d6267e8b3 100644 --- a/platform/android/net_socket_android.h +++ b/platform/android/net_socket_android.h @@ -52,8 +52,8 @@ private: static jmethodID _multicast_lock_acquire; static jmethodID _multicast_lock_release; - bool wants_broadcast; - int multicast_groups; + bool wants_broadcast = false; + int multicast_groups = 0; static void multicast_lock_acquire(); static void multicast_lock_release(); @@ -71,7 +71,7 @@ public: virtual Error join_multicast_group(const IP_Address &p_multi_address, String p_if_name); virtual Error leave_multicast_group(const IP_Address &p_multi_address, String p_if_name); - NetSocketAndroid(); + NetSocketAndroid() {} ~NetSocketAndroid(); }; diff --git a/platform/haiku/key_mapping_haiku.h b/platform/haiku/key_mapping_haiku.h index a0e85e3390..e735108e44 100644 --- a/platform/haiku/key_mapping_haiku.h +++ b/platform/haiku/key_mapping_haiku.h @@ -32,7 +32,7 @@ #define KEY_MAPPING_HAIKU_H class KeyMappingHaiku { - KeyMappingHaiku(){}; + KeyMappingHaiku() {} public: static unsigned int get_keysym(int32 raw_char, int32 key); diff --git a/platform/iphone/export/export.cpp b/platform/iphone/export/export.cpp index 2222a7f552..3904fd6cf9 100644 --- a/platform/iphone/export/export.cpp +++ b/platform/iphone/export/export.cpp @@ -29,6 +29,7 @@ /*************************************************************************/ #include "export.h" + #include "core/io/image_loader.h" #include "core/io/marshalls.h" #include "core/io/resource_saver.h" @@ -74,12 +75,9 @@ class EditorExportPlatformIOS : public EditorExportPlatform { struct ExportArchitecture { String name; - bool is_default; + bool is_default = false; - ExportArchitecture() : - name(""), - is_default(false) { - } + ExportArchitecture() {} ExportArchitecture(String p_name, bool p_is_default) { name = p_name; diff --git a/platform/iphone/game_center.mm b/platform/iphone/game_center.mm index 99d539d4ff..52f025f333 100644 --- a/platform/iphone/game_center.mm +++ b/platform/iphone/game_center.mm @@ -395,6 +395,6 @@ GameCenter::GameCenter() { authenticated = false; }; -GameCenter::~GameCenter(){}; +GameCenter::~GameCenter() {} #endif diff --git a/platform/iphone/icloud.mm b/platform/iphone/icloud.mm index 251f78f2da..1b9b354727 100644 --- a/platform/iphone/icloud.mm +++ b/platform/iphone/icloud.mm @@ -354,6 +354,6 @@ ICloud::ICloud() { }]; } -ICloud::~ICloud(){}; +ICloud::~ICloud() {} #endif diff --git a/platform/iphone/in_app_store.mm b/platform/iphone/in_app_store.mm index a8a887824f..c5a8ed2b2b 100644 --- a/platform/iphone/in_app_store.mm +++ b/platform/iphone/in_app_store.mm @@ -334,6 +334,6 @@ void InAppStore::set_auto_finish_transaction(bool b) { auto_finish_transactions = b; } -InAppStore::~InAppStore(){}; +InAppStore::~InAppStore() {} #endif diff --git a/platform/iphone/ios.mm b/platform/iphone/ios.mm index 2656f125b9..697c9b8a3d 100644 --- a/platform/iphone/ios.mm +++ b/platform/iphone/ios.mm @@ -81,4 +81,4 @@ String iOS::get_rate_url(int p_app_id) const { return ret; }; -iOS::iOS(){}; +iOS::iOS() {} diff --git a/platform/iphone/os_iphone.cpp b/platform/iphone/os_iphone.cpp index 3ef521a61a..9254e660d8 100644 --- a/platform/iphone/os_iphone.cpp +++ b/platform/iphone/os_iphone.cpp @@ -372,8 +372,8 @@ void OSIPhone::finalize() { event_count = 0; }; -void OSIPhone::set_mouse_show(bool p_show){}; -void OSIPhone::set_mouse_grab(bool p_grab){}; +void OSIPhone::set_mouse_show(bool p_show) {} +void OSIPhone::set_mouse_grab(bool p_grab) {} bool OSIPhone::is_mouse_grab_enabled() const { @@ -390,7 +390,7 @@ int OSIPhone::get_mouse_button_state() const { return 0; }; -void OSIPhone::set_window_title(const String &p_title){}; +void OSIPhone::set_window_title(const String &p_title) {} void OSIPhone::alert(const String &p_alert, const String &p_title) { diff --git a/platform/javascript/http_client.h.inc b/platform/javascript/http_client.h.inc index ac275aadbc..4d5ff88bdd 100644 --- a/platform/javascript/http_client.h.inc +++ b/platform/javascript/http_client.h.inc @@ -33,21 +33,21 @@ Error prepare_request(Method p_method, const String &p_url, const Vector<String> &p_headers); int xhr_id; -int read_limit; -int response_read_offset; -Status status; +int read_limit = 4096; +int response_read_offset = 0; +Status status = STATUS_DISCONNECTED; String host; -int port; -bool use_tls; +int port = -1; +bool use_tls = false; String username; String password; -int polled_response_code; +int polled_response_code = 0; String polled_response_header; PackedByteArray polled_response; #ifdef DEBUG_ENABLED -bool has_polled; -uint64_t last_polling_frame; +bool has_polled = false; +uint64_t last_polling_frame = 0; #endif diff --git a/platform/javascript/http_client_javascript.cpp b/platform/javascript/http_client_javascript.cpp index 863c207896..19ce7ef219 100644 --- a/platform/javascript/http_client_javascript.cpp +++ b/platform/javascript/http_client_javascript.cpp @@ -29,6 +29,7 @@ /*************************************************************************/ #include "core/io/http_client.h" + #include "http_request.h" Error HTTPClient::connect_to_host(const String &p_host, int p_port, bool p_ssl, bool p_verify_host) { @@ -281,15 +282,6 @@ Error HTTPClient::poll() { HTTPClient::HTTPClient() { xhr_id = godot_xhr_new(); - read_limit = 4096; - status = STATUS_DISCONNECTED; - port = -1; - use_tls = false; - polled_response_code = 0; -#ifdef DEBUG_ENABLED - has_polled = false; - last_polling_frame = 0; -#endif } HTTPClient::~HTTPClient() { diff --git a/platform/linuxbsd/key_mapping_x11.h b/platform/linuxbsd/key_mapping_x11.h index 10db43bcc4..8f5e01a3c2 100644 --- a/platform/linuxbsd/key_mapping_x11.h +++ b/platform/linuxbsd/key_mapping_x11.h @@ -41,7 +41,7 @@ #include "core/os/keyboard.h" class KeyMappingX11 { - KeyMappingX11(){}; + KeyMappingX11() {} public: static unsigned int get_keycode(KeySym p_keysym); diff --git a/platform/uwp/app.cpp b/platform/uwp/app.cpp index d3870b0b6c..988f958739 100644 --- a/platform/uwp/app.cpp +++ b/platform/uwp/app.cpp @@ -78,16 +78,6 @@ public: return 0; } -App::App() : - mWindowClosed(false), - mWindowVisible(true), - mWindowWidth(0), - mWindowHeight(0), - mEglDisplay(EGL_NO_DISPLAY), - mEglContext(EGL_NO_CONTEXT), - mEglSurface(EGL_NO_SURFACE) { -} - // The first method called when the IFrameworkView is being created. void App::Initialize(CoreApplicationView ^ applicationView) { // Register event handlers for app lifecycle. This example includes Activated, so that we diff --git a/platform/uwp/app.h b/platform/uwp/app.h index b7265ad086..5cffe378b1 100644 --- a/platform/uwp/app.h +++ b/platform/uwp/app.h @@ -45,7 +45,7 @@ namespace GodotUWP ref class App sealed : public Windows::ApplicationModel::Core::IFrameworkView { public: - App(); + App() {} // IFrameworkView Methods. virtual void Initialize(Windows::ApplicationModel::Core::CoreApplicationView^ applicationView); @@ -92,14 +92,14 @@ namespace GodotUWP char** get_command_line(unsigned int* out_argc); - bool mWindowClosed; - bool mWindowVisible; - GLsizei mWindowWidth; - GLsizei mWindowHeight; + bool mWindowClosed = false; + bool mWindowVisible = true; + GLsizei mWindowWidth = 0; + GLsizei mWindowHeight = 0; - EGLDisplay mEglDisplay; - EGLContext mEglContext; - EGLSurface mEglSurface; + EGLDisplay mEglDisplay = EGL_NO_DISPLAY; + EGLContext mEglContext = EGL_NO_CONTEXT; + EGLSurface mEglSurface = EGL_NO_SURFACE; CoreWindow^ window; OS_UWP* os; diff --git a/platform/uwp/export/export.cpp b/platform/uwp/export/export.cpp index bee1ddfc99..50136ccb66 100644 --- a/platform/uwp/export/export.cpp +++ b/platform/uwp/export/export.cpp @@ -115,21 +115,15 @@ class AppxPackager { struct FileMeta { String name; - int lfh_size; - bool compressed; - size_t compressed_size; - size_t uncompressed_size; + int lfh_size = 0; + bool compressed = false; + size_t compressed_size = 0; + size_t uncompressed_size = 0; Vector<BlockHash> hashes; - uLong file_crc32; - ZPOS64_T zip_offset; - - FileMeta() : - lfh_size(0), - compressed(false), - compressed_size(0), - uncompressed_size(0), - file_crc32(0), - zip_offset(0) {} + uLong file_crc32 = 0; + ZPOS64_T zip_offset = 0; + + FileMeta() {} }; String progress_task; diff --git a/platform/windows/key_mapping_windows.h b/platform/windows/key_mapping_windows.h index 3361ad397f..028ca9fd5d 100644 --- a/platform/windows/key_mapping_windows.h +++ b/platform/windows/key_mapping_windows.h @@ -39,7 +39,7 @@ class KeyMappingWindows { - KeyMappingWindows(){}; + KeyMappingWindows() {} public: static unsigned int get_keysym(unsigned int p_code); |