summaryrefslogtreecommitdiff
path: root/core/io
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2020-05-12 17:01:17 +0200
committerRémi Verschelde <rverschelde@gmail.com>2020-05-14 10:01:56 +0200
commit1f6f364a56319eabd02c050746fe7df3f55ffee3 (patch)
tree8bebdce946466ce8e9476ccd46c9dba62c323938 /core/io
parente7c9d818766a119089873e4941e4865fb36883ec (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 'core/io')
-rw-r--r--core/io/compression.h2
-rw-r--r--core/io/dtls_server.cpp4
-rw-r--r--core/io/dtls_server.h2
-rw-r--r--core/io/file_access_buffered.cpp8
-rw-r--r--core/io/file_access_buffered.h6
-rw-r--r--core/io/file_access_buffered_fa.h10
-rw-r--r--core/io/file_access_compressed.cpp19
-rw-r--r--core/io/file_access_compressed.h36
-rw-r--r--core/io/file_access_encrypted.cpp9
-rw-r--r--core/io/file_access_encrypted.h12
-rw-r--r--core/io/file_access_memory.cpp5
-rw-r--r--core/io/file_access_memory.h4
-rw-r--r--core/io/file_access_network.cpp12
-rw-r--r--core/io/file_access_network.h30
-rw-r--r--core/io/file_access_pack.cpp7
-rw-r--r--core/io/file_access_pack.h19
-rw-r--r--core/io/file_access_zip.cpp8
-rw-r--r--core/io/file_access_zip.h9
-rw-r--r--core/io/http_client.cpp19
-rw-r--r--core/io/http_client.h32
-rw-r--r--core/io/logger.cpp7
-rw-r--r--core/io/logger.h6
-rw-r--r--core/io/marshalls.cpp3
-rw-r--r--core/io/marshalls.h2
-rw-r--r--core/io/multiplayer_api.cpp6
-rw-r--r--core/io/multiplayer_api.h6
-rw-r--r--core/io/networked_multiplayer_peer.cpp3
-rw-r--r--core/io/networked_multiplayer_peer.h2
-rw-r--r--core/io/packet_peer.cpp5
-rw-r--r--core/io/packet_peer.h6
-rw-r--r--core/io/packet_peer_dtls.cpp3
-rw-r--r--core/io/packet_peer_dtls.h2
-rw-r--r--core/io/packet_peer_udp.cpp6
-rw-r--r--core/io/packet_peer_udp.h12
-rw-r--r--core/io/pck_packer.cpp5
-rw-r--r--core/io/pck_packer.h4
-rw-r--r--core/io/resource_format_binary.cpp13
-rw-r--r--core/io/resource_format_binary.h18
-rw-r--r--core/io/resource_loader.cpp1
-rw-r--r--core/io/stream_peer.cpp5
-rw-r--r--core/io/stream_peer.h8
-rw-r--r--core/io/stream_peer_ssl.cpp4
-rw-r--r--core/io/stream_peer_ssl.h4
-rw-r--r--core/io/stream_peer_tcp.cpp5
-rw-r--r--core/io/stream_peer_tcp.h6
-rw-r--r--core/io/translation_loader_po.cpp3
-rw-r--r--core/io/translation_loader_po.h2
-rw-r--r--core/io/xml_parser.cpp3
-rw-r--r--core/io/xml_parser.h12
49 files changed, 125 insertions, 290 deletions
diff --git a/core/io/compression.h b/core/io/compression.h
index 8354b581fa..3e7c125d8e 100644
--- a/core/io/compression.h
+++ b/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
diff --git a/core/io/dtls_server.cpp b/core/io/dtls_server.cpp
index 5bda06e5b9..7cbf5c618e 100644
--- a/core/io/dtls_server.cpp
+++ b/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() {
-}
diff --git a/core/io/dtls_server.h b/core/io/dtls_server.h
index 7b08138f7f..ae1d3bcd98 100644
--- a/core/io/dtls_server.h
+++ b/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
diff --git a/core/io/file_access_buffered.cpp b/core/io/file_access_buffered.cpp
index ab0fb3943c..2df91a4dd8 100644
--- a/core/io/file_access_buffered.cpp
+++ b/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() {
-}
diff --git a/core/io/file_access_buffered.h b/core/io/file_access_buffered.h
index a6177c20be..2832367a8b 100644
--- a/core/io/file_access_buffered.h
+++ b/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
diff --git a/core/io/file_access_buffered_fa.h b/core/io/file_access_buffered_fa.h
index 6ec77d503b..edb4ff9a9f 100644
--- a/core/io/file_access_buffered_fa.h
+++ b/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
diff --git a/core/io/file_access_compressed.cpp b/core/io/file_access_compressed.cpp
index c76142d22d..f2827b519e 100644
--- a/core/io/file_access_compressed.cpp
+++ b/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)
diff --git a/core/io/file_access_compressed.h b/core/io/file_access_compressed.h
index 0bb311faa8..f192be0883 100644
--- a/core/io/file_access_compressed.h
+++ b/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();
};
diff --git a/core/io/file_access_encrypted.cpp b/core/io/file_access_encrypted.cpp
index a5b3807789..271c34ec4a 100644
--- a/core/io/file_access_encrypted.cpp
+++ b/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)
diff --git a/core/io/file_access_encrypted.h b/core/io/file_access_encrypted.h
index 7a9f4ecdd8..e269c1e30c 100644
--- a/core/io/file_access_encrypted.h
+++ b/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();
};
diff --git a/core/io/file_access_memory.cpp b/core/io/file_access_memory.cpp
index a2379ce88f..a3e04a4538 100644
--- a/core/io/file_access_memory.cpp
+++ b/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;
-}
diff --git a/core/io/file_access_memory.h b/core/io/file_access_memory.h
index 2db14db265..d8be989b20 100644
--- a/core/io/file_access_memory.h
+++ b/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
diff --git a/core/io/file_access_network.cpp b/core/io/file_access_network.cpp
index a3f307393f..00f504c391 100644
--- a/core/io/file_access_network.cpp
+++ b/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() {
diff --git a/core/io/file_access_network.h b/core/io/file_access_network.h
index 7f664b46f7..6cdd6af0b4 100644
--- a/core/io/file_access_network.h
+++ b/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;
diff --git a/core/io/file_access_pack.cpp b/core/io/file_access_pack.cpp
index fd9b83eaf9..d70f2ba445 100644
--- a/core/io/file_access_pack.cpp
+++ b/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() {
}
diff --git a/core/io/file_access_pack.h b/core/io/file_access_pack.h
index 8df6826ac9..aa3a14272b 100644
--- a/core/io/file_access_pack.h
+++ b/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
diff --git a/core/io/file_access_zip.cpp b/core/io/file_access_zip.cpp
index 57de66afaf..9d068fe809 100644
--- a/core/io/file_access_zip.cpp
+++ b/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
diff --git a/core/io/file_access_zip.h b/core/io/file_access_zip.h
index d5ce7d7a8d..17a3d085b6 100644
--- a/core/io/file_access_zip.h
+++ b/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;
diff --git a/core/io/http_client.cpp b/core/io/http_client.cpp
index 56f8f1ff91..672569c5db 100644
--- a/core/io/http_client.cpp
+++ b/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
diff --git a/core/io/http_client.h b/core/io/http_client.h
index 03ba20f8dd..05690534ae 100644
--- a/core/io/http_client.h
+++ b/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);
diff --git a/core/io/logger.cpp b/core/io/logger.cpp
index 02cc78538e..23165b575e 100644
--- a/core/io/logger.cpp
+++ b/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) {
}
diff --git a/core/io/logger.h b/core/io/logger.h
index 7028551185..54f1a42da9 100644
--- a/core/io/logger.h
+++ b/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();
diff --git a/core/io/marshalls.cpp b/core/io/marshalls.cpp
index 81bc45b2f7..abf27954b8 100644
--- a/core/io/marshalls.cpp
+++ b/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)
diff --git a/core/io/marshalls.h b/core/io/marshalls.h
index 650c95364a..1ba786d5d9 100644
--- a/core/io/marshalls.h
+++ b/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);
diff --git a/core/io/multiplayer_api.cpp b/core/io/multiplayer_api.cpp
index 94e2fdb72c..998bcfd3f3 100644
--- a/core/io/multiplayer_api.cpp
+++ b/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();
}
diff --git a/core/io/multiplayer_api.h b/core/io/multiplayer_api.h
index 4eb4a53e99..2603fb1e27 100644
--- a/core/io/multiplayer_api.h
+++ b/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();
diff --git a/core/io/networked_multiplayer_peer.cpp b/core/io/networked_multiplayer_peer.cpp
index b2f810d212..332beb4c8c 100644
--- a/core/io/networked_multiplayer_peer.cpp
+++ b/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() {
-}
diff --git a/core/io/networked_multiplayer_peer.h b/core/io/networked_multiplayer_peer.h
index c1f1924051..8792886ff3 100644
--- a/core/io/networked_multiplayer_peer.h
+++ b/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)
diff --git a/core/io/packet_peer.cpp b/core/io/packet_peer.cpp
index 38abb5c0d6..6d3e1341a7 100644
--- a/core/io/packet_peer.cpp
+++ b/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");
diff --git a/core/io/packet_peer.h b/core/io/packet_peer.h
index 62144259cc..b69efa531f 100644
--- a/core/io/packet_peer.h
+++ b/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() {}
};
diff --git a/core/io/packet_peer_dtls.cpp b/core/io/packet_peer_dtls.cpp
index 6da115eed2..ada3cb10a2 100644
--- a/core/io/packet_peer_dtls.cpp
+++ b/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() {
-}
diff --git a/core/io/packet_peer_dtls.h b/core/io/packet_peer_dtls.h
index 4f9f4535bc..c2ff4e1a7f 100644
--- a/core/io/packet_peer_dtls.h
+++ b/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);
diff --git a/core/io/packet_peer_udp.cpp b/core/io/packet_peer_udp.cpp
index f800ffc3db..8b6bd7ef90 100644
--- a/core/io/packet_peer_udp.cpp
+++ b/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);
}
diff --git a/core/io/packet_peer_udp.h b/core/io/packet_peer_udp.h
index b5a9fc9ec3..23fc5460a6 100644
--- a/core/io/packet_peer_udp.h
+++ b/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();
diff --git a/core/io/pck_packer.cpp b/core/io/pck_packer.cpp
index 5c4b3379ee..124ac30b88 100644
--- a/core/io/pck_packer.cpp
+++ b/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);
diff --git a/core/io/pck_packer.h b/core/io/pck_packer.h
index 6058de8345..2848ac3a65 100644
--- a/core/io/pck_packer.h
+++ b/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();
};
diff --git a/core/io/resource_format_binary.cpp b/core/io/resource_format_binary.cpp
index e0fea143bb..8ce17bcfbe 100644
--- a/core/io/resource_format_binary.cpp
+++ b/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;
}
diff --git a/core/io/resource_format_binary.h b/core/io/resource_format_binary.h
index 3c8d916c0a..57aa086022 100644
--- a/core/io/resource_format_binary.h
+++ b/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();
};
diff --git a/core/io/resource_loader.cpp b/core/io/resource_loader.cpp
index d90802d7e2..dc44be4e0b 100644
--- a/core/io/resource_loader.cpp
+++ b/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"
diff --git a/core/io/stream_peer.cpp b/core/io/stream_peer.cpp
index b28b17aa95..9bbe92096d 100644
--- a/core/io/stream_peer.cpp
+++ b/core/io/stream_peer.cpp
@@ -536,8 +536,3 @@ Ref<StreamPeerBuffer> StreamPeerBuffer::duplicate() const {
spb->data = data;
return spb;
}
-
-StreamPeerBuffer::StreamPeerBuffer() {
-
- pointer = 0;
-}
diff --git a/core/io/stream_peer.h b/core/io/stream_peer.h
index 9358a2c07c..a390fdc325 100644
--- a/core/io/stream_peer.h
+++ b/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
diff --git a/core/io/stream_peer_ssl.cpp b/core/io/stream_peer_ssl.cpp
index d98935f77c..1d86c35578 100644
--- a/core/io/stream_peer_ssl.cpp
+++ b/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;
-}
diff --git a/core/io/stream_peer_ssl.h b/core/io/stream_peer_ssl.h
index de3cb09c60..81b95b856d 100644
--- a/core/io/stream_peer_ssl.h
+++ b/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);
diff --git a/core/io/stream_peer_tcp.cpp b/core/io/stream_peer_tcp.cpp
index f0c5816d73..6218b98758 100644
--- a/core/io/stream_peer_tcp.cpp
+++ b/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() {
diff --git a/core/io/stream_peer_tcp.h b/core/io/stream_peer_tcp.h
index 86df9ab8cf..571f6b7c54 100644
--- a/core/io/stream_peer_tcp.h
+++ b/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();
diff --git a/core/io/translation_loader_po.cpp b/core/io/translation_loader_po.cpp
index bce5361c76..6f79e2554b 100644
--- a/core/io/translation_loader_po.cpp
+++ b/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() {
-}
diff --git a/core/io/translation_loader_po.h b/core/io/translation_loader_po.h
index 137dfd1768..a196a37dc0 100644
--- a/core/io/translation_loader_po.h
+++ b/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
diff --git a/core/io/xml_parser.cpp b/core/io/xml_parser.cpp
index 9613ad3f10..a4b64bf17c 100644
--- a/core/io/xml_parser.cpp
+++ b/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;");
diff --git a/core/io/xml_parser.h b/core/io/xml_parser.h
index 26c3e6802f..42b7d6e0d4 100644
--- a/core/io/xml_parser.h
+++ b/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;