summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/core_string_names.cpp47
-rw-r--r--core/dvector.h12
-rw-r--r--core/func_ref.cpp5
-rw-r--r--core/io/file_access_compressed.cpp35
-rw-r--r--core/io/file_access_zip.cpp89
-rw-r--r--core/io/logger.cpp13
-rw-r--r--core/io/marshalls.cpp5
-rw-r--r--core/io/packet_peer.cpp7
-rw-r--r--core/io/packet_peer_udp.cpp13
-rw-r--r--core/io/resource_format_binary.cpp11
-rw-r--r--core/io/stream_peer_tcp.cpp11
-rw-r--r--core/io/tcp_server.cpp5
-rw-r--r--core/math/expression.cpp14
-rw-r--r--core/math/expression.h4
-rw-r--r--core/math/plane.h5
-rw-r--r--core/math/quat.h28
-rw-r--r--core/os/dir_access.cpp6
-rw-r--r--core/reference.cpp4
-rw-r--r--core/variant_parser.h3
19 files changed, 156 insertions, 161 deletions
diff --git a/core/core_string_names.cpp b/core/core_string_names.cpp
index ba596f7f16..8a3fdade64 100644
--- a/core/core_string_names.cpp
+++ b/core/core_string_names.cpp
@@ -47,28 +47,27 @@ CoreStringNames::CoreStringNames() :
#ifdef TOOLS_ENABLED
_sections_unfolded(StaticCString::create("_sections_unfolded")),
#endif
- _custom_features(StaticCString::create("_custom_features")) {
-
- x = StaticCString::create("x");
- y = StaticCString::create("y");
- z = StaticCString::create("z");
- w = StaticCString::create("w");
- r = StaticCString::create("r");
- g = StaticCString::create("g");
- b = StaticCString::create("b");
- a = StaticCString::create("a");
- position = StaticCString::create("position");
- size = StaticCString::create("size");
- end = StaticCString::create("end");
- basis = StaticCString::create("basis");
- origin = StaticCString::create("origin");
- normal = StaticCString::create("normal");
- d = StaticCString::create("d");
- h = StaticCString::create("h");
- s = StaticCString::create("s");
- v = StaticCString::create("v");
- r8 = StaticCString::create("r8");
- g8 = StaticCString::create("g8");
- b8 = StaticCString::create("b8");
- a8 = StaticCString::create("a8");
+ _custom_features(StaticCString::create("_custom_features")),
+ x(StaticCString::create("x")),
+ y(StaticCString::create("y")),
+ z(StaticCString::create("z")),
+ w(StaticCString::create("w")),
+ r(StaticCString::create("r")),
+ g(StaticCString::create("g")),
+ b(StaticCString::create("b")),
+ a(StaticCString::create("a")),
+ position(StaticCString::create("position")),
+ size(StaticCString::create("size")),
+ end(StaticCString::create("end")),
+ basis(StaticCString::create("basis")),
+ origin(StaticCString::create("origin")),
+ normal(StaticCString::create("normal")),
+ d(StaticCString::create("d")),
+ h(StaticCString::create("h")),
+ s(StaticCString::create("s")),
+ v(StaticCString::create("v")),
+ r8(StaticCString::create("r8")),
+ g8(StaticCString::create("g8")),
+ b8(StaticCString::create("b8")),
+ a8(StaticCString::create("a8")) {
}
diff --git a/core/dvector.h b/core/dvector.h
index 2830c57ec0..9760dcbcad 100644
--- a/core/dvector.h
+++ b/core/dvector.h
@@ -56,12 +56,12 @@ struct MemoryPool {
Alloc *free_list;
- Alloc() {
- mem = NULL;
- lock = 0;
- pool_id = POOL_ALLOCATOR_INVALID_ID;
- size = 0;
- free_list = NULL;
+ Alloc() :
+ lock(0),
+ mem(NULL),
+ pool_id(POOL_ALLOCATOR_INVALID_ID),
+ size(0),
+ free_list(NULL) {
}
};
diff --git a/core/func_ref.cpp b/core/func_ref.cpp
index c707f1c4cb..d9d1a2b799 100644
--- a/core/func_ref.cpp
+++ b/core/func_ref.cpp
@@ -69,7 +69,6 @@ void FuncRef::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_function", "name"), &FuncRef::set_function);
}
-FuncRef::FuncRef() {
-
- id = 0;
+FuncRef::FuncRef() :
+ id(0) {
}
diff --git a/core/io/file_access_compressed.cpp b/core/io/file_access_compressed.cpp
index 645d97ae7e..a3633dc1f4 100644
--- a/core/io/file_access_compressed.cpp
+++ b/core/io/file_access_compressed.cpp
@@ -373,24 +373,23 @@ uint64_t FileAccessCompressed::_get_modified_time(const String &p_file) {
return 0;
}
-FileAccessCompressed::FileAccessCompressed() {
-
- f = NULL;
- magic = "GCMP";
- cmode = Compression::MODE_ZSTD;
- writing = false;
- write_ptr = 0;
- write_buffer_size = 0;
- write_max = 0;
- block_size = 0;
- read_eof = false;
- at_end = false;
- read_total = 0;
- read_ptr = NULL;
- read_block = 0;
- read_block_count = 0;
- read_block_size = 0;
- read_pos = 0;
+FileAccessCompressed::FileAccessCompressed() :
+ cmode(Compression::MODE_ZSTD),
+ writing(false),
+ write_ptr(0),
+ write_buffer_size(0),
+ write_max(0),
+ block_size(0),
+ read_eof(false),
+ at_end(false),
+ read_ptr(NULL),
+ read_block(0),
+ read_block_count(0),
+ read_block_size(0),
+ read_pos(0),
+ read_total(0),
+ magic("GCMP"),
+ f(NULL) {
}
FileAccessCompressed::~FileAccessCompressed() {
diff --git a/core/io/file_access_zip.cpp b/core/io/file_access_zip.cpp
index 7b6385c3ff..d99cdf0d86 100644
--- a/core/io/file_access_zip.cpp
+++ b/core/io/file_access_zip.cpp
@@ -43,31 +43,31 @@ static void *godot_open(void *data, const char *p_fname, int mode) {
if (mode & ZLIB_FILEFUNC_MODE_WRITE) {
return NULL;
- };
+ }
FileAccess *f = (FileAccess *)data;
f->open(p_fname, FileAccess::READ);
return f->is_open() ? data : NULL;
-};
+}
static uLong godot_read(void *data, void *fdata, void *buf, uLong size) {
FileAccess *f = (FileAccess *)data;
f->get_buffer((uint8_t *)buf, size);
return size;
-};
+}
static uLong godot_write(voidpf opaque, voidpf stream, const void *buf, uLong size) {
return 0;
-};
+}
static long godot_tell(voidpf opaque, voidpf stream) {
FileAccess *f = (FileAccess *)opaque;
return f->get_position();
-};
+}
static long godot_seek(voidpf opaque, voidpf stream, uLong offset, int origin) {
@@ -84,36 +84,36 @@ static long godot_seek(voidpf opaque, voidpf stream, uLong offset, int origin) {
break;
default:
break;
- };
+ }
f->seek(pos);
return 0;
-};
+}
static int godot_close(voidpf opaque, voidpf stream) {
FileAccess *f = (FileAccess *)opaque;
f->close();
return 0;
-};
+}
static int godot_testerror(voidpf opaque, voidpf stream) {
FileAccess *f = (FileAccess *)opaque;
return f->get_error() != OK ? 1 : 0;
-};
+}
static voidpf godot_alloc(voidpf opaque, uInt items, uInt size) {
return memalloc(items * size);
-};
+}
static void godot_free(voidpf opaque, voidpf address) {
memfree(address);
-};
+}
-}; // extern "C"
+} // extern "C"
void ZipArchive::close_handle(unzFile p_file) const {
@@ -122,7 +122,7 @@ void ZipArchive::close_handle(unzFile p_file) const {
unzCloseCurrentFile(p_file);
unzClose(p_file);
memdelete(f);
-};
+}
unzFile ZipArchive::get_file_handle(String p_file) const {
@@ -155,10 +155,10 @@ unzFile ZipArchive::get_file_handle(String p_file) const {
unzClose(pkg);
ERR_FAIL_V(NULL);
- };
+ }
return pkg;
-};
+}
bool ZipArchive::try_open_pack(const String &p_path) {
@@ -215,36 +215,36 @@ bool ZipArchive::try_open_pack(const String &p_path) {
if ((i + 1) < gi.number_entry) {
unzGoToNextFile(zfile);
- };
- };
+ }
+ }
return true;
-};
+}
bool ZipArchive::file_exists(String p_name) const {
return files.has(p_name);
-};
+}
FileAccess *ZipArchive::get_file(const String &p_path, PackedData::PackedFile *p_file) {
return memnew(FileAccessZip(p_path, *p_file));
-};
+}
ZipArchive *ZipArchive::get_singleton() {
if (instance == NULL) {
instance = memnew(ZipArchive);
- };
+ }
return instance;
-};
+}
ZipArchive::ZipArchive() {
instance = this;
//fa_create_func = FileAccess::get_create_func();
-};
+}
ZipArchive::~ZipArchive() {
@@ -253,10 +253,10 @@ ZipArchive::~ZipArchive() {
FileAccess *f = (FileAccess *)unzGetOpaque(packages[i].zfile);
unzClose(packages[i].zfile);
memdelete(f);
- };
+ }
packages.clear();
-};
+}
Error FileAccessZip::_open(const String &p_path, int p_mode_flags) {
@@ -272,7 +272,7 @@ Error FileAccessZip::_open(const String &p_path, int p_mode_flags) {
ERR_FAIL_COND_V(err != UNZ_OK, FAILED);
return OK;
-};
+}
void FileAccessZip::close() {
@@ -283,50 +283,50 @@ void FileAccessZip::close() {
ERR_FAIL_COND(!arch);
arch->close_handle(zfile);
zfile = NULL;
-};
+}
bool FileAccessZip::is_open() const {
return zfile != NULL;
-};
+}
void FileAccessZip::seek(size_t p_position) {
ERR_FAIL_COND(!zfile);
unzSeekCurrentFile(zfile, p_position);
-};
+}
void FileAccessZip::seek_end(int64_t p_position) {
ERR_FAIL_COND(!zfile);
unzSeekCurrentFile(zfile, get_len() + p_position);
-};
+}
size_t FileAccessZip::get_position() const {
ERR_FAIL_COND_V(!zfile, 0);
return unztell(zfile);
-};
+}
size_t FileAccessZip::get_len() const {
ERR_FAIL_COND_V(!zfile, 0);
return file_info.uncompressed_size;
-};
+}
bool FileAccessZip::eof_reached() const {
ERR_FAIL_COND_V(!zfile, true);
return at_eof;
-};
+}
uint8_t FileAccessZip::get_8() const {
uint8_t ret = 0;
get_buffer(&ret, 1);
return ret;
-};
+}
int FileAccessZip::get_buffer(uint8_t *p_dst, int p_length) const {
@@ -339,20 +339,20 @@ int FileAccessZip::get_buffer(uint8_t *p_dst, int p_length) const {
if (read < p_length)
at_eof = true;
return read;
-};
+}
Error FileAccessZip::get_error() const {
if (!zfile) {
return ERR_UNCONFIGURED;
- };
+ }
if (eof_reached()) {
return ERR_FILE_EOF;
- };
+ }
return OK;
-};
+}
void FileAccessZip::flush() {
@@ -362,22 +362,21 @@ void FileAccessZip::flush() {
void FileAccessZip::store_8(uint8_t p_dest) {
ERR_FAIL();
-};
+}
bool FileAccessZip::file_exists(const String &p_name) {
return false;
-};
-
-FileAccessZip::FileAccessZip(const String &p_path, const PackedData::PackedFile &p_file) {
+}
- zfile = NULL;
+FileAccessZip::FileAccessZip(const String &p_path, const PackedData::PackedFile &p_file) :
+ zfile(NULL) {
_open(p_path, FileAccess::READ);
-};
+}
FileAccessZip::~FileAccessZip() {
close();
-};
+}
#endif
diff --git a/core/io/logger.cpp b/core/io/logger.cpp
index 01755c8ee9..3c4b4a1ac3 100644
--- a/core/io/logger.cpp
+++ b/core/io/logger.cpp
@@ -179,11 +179,10 @@ void RotatedFileLogger::rotate_file() {
file = FileAccess::open(base_path, FileAccess::WRITE);
}
-RotatedFileLogger::RotatedFileLogger(const String &p_base_path, int p_max_files) {
- file = NULL;
- base_path = p_base_path.simplify_path();
- max_files = p_max_files > 0 ? p_max_files : 1;
-
+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(NULL) {
rotate_file();
}
@@ -240,8 +239,8 @@ 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;
+CompositeLogger::CompositeLogger(Vector<Logger *> p_loggers) :
+ loggers(p_loggers) {
}
void CompositeLogger::logv(const char *p_format, va_list p_list, bool p_err) {
diff --git a/core/io/marshalls.cpp b/core/io/marshalls.cpp
index 6338cee39d..c71903c94d 100644
--- a/core/io/marshalls.cpp
+++ b/core/io/marshalls.cpp
@@ -55,9 +55,8 @@ ObjectID EncodedObjectAsID::get_object_id() const {
return id;
}
-EncodedObjectAsID::EncodedObjectAsID() {
-
- id = 0;
+EncodedObjectAsID::EncodedObjectAsID() :
+ id(0) {
}
#define ENCODE_MASK 0xFF
diff --git a/core/io/packet_peer.cpp b/core/io/packet_peer.cpp
index b6dd4eaf6f..aadcca01d5 100644
--- a/core/io/packet_peer.cpp
+++ b/core/io/packet_peer.cpp
@@ -35,10 +35,9 @@
/* helpers / binders */
-PacketPeer::PacketPeer() {
-
- allow_object_decoding = false;
- last_get_error = OK;
+PacketPeer::PacketPeer() :
+ last_get_error(OK),
+ allow_object_decoding(false) {
}
void PacketPeer::set_allow_object_decoding(bool p_enable) {
diff --git a/core/io/packet_peer_udp.cpp b/core/io/packet_peer_udp.cpp
index d33ba6f855..2e916d6a48 100644
--- a/core/io/packet_peer_udp.cpp
+++ b/core/io/packet_peer_udp.cpp
@@ -239,13 +239,12 @@ void PacketPeerUDP::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_dest_address", "host", "port"), &PacketPeerUDP::_set_dest_address);
}
-PacketPeerUDP::PacketPeerUDP() {
-
- _sock = Ref<NetSocket>(NetSocket::create());
- blocking = true;
- packet_port = 0;
- queue_count = 0;
- peer_port = 0;
+PacketPeerUDP::PacketPeerUDP() :
+ packet_port(0),
+ queue_count(0),
+ peer_port(0),
+ blocking(true),
+ _sock(Ref<NetSocket>(NetSocket::create())) {
rb.resize(16);
}
diff --git a/core/io/resource_format_binary.cpp b/core/io/resource_format_binary.cpp
index 6f3a8c3d2e..b91268dab2 100644
--- a/core/io/resource_format_binary.cpp
+++ b/core/io/resource_format_binary.cpp
@@ -970,12 +970,11 @@ String ResourceInteractiveLoaderBinary::recognize(FileAccess *p_f) {
return type;
}
-ResourceInteractiveLoaderBinary::ResourceInteractiveLoaderBinary() {
-
- f = NULL;
- stage = 0;
- error = OK;
- translation_remapped = false;
+ResourceInteractiveLoaderBinary::ResourceInteractiveLoaderBinary() :
+ translation_remapped(false),
+ f(NULL),
+ error(OK),
+ stage(0) {
}
ResourceInteractiveLoaderBinary::~ResourceInteractiveLoaderBinary() {
diff --git a/core/io/stream_peer_tcp.cpp b/core/io/stream_peer_tcp.cpp
index 28561e8cbc..4b86735aa3 100644
--- a/core/io/stream_peer_tcp.cpp
+++ b/core/io/stream_peer_tcp.cpp
@@ -349,12 +349,11 @@ void StreamPeerTCP::_bind_methods() {
BIND_ENUM_CONSTANT(STATUS_ERROR);
}
-StreamPeerTCP::StreamPeerTCP() {
-
- _sock = Ref<NetSocket>(NetSocket::create());
- status = STATUS_NONE;
- peer_host = IP_Address();
- peer_port = 0;
+StreamPeerTCP::StreamPeerTCP() :
+ _sock(Ref<NetSocket>(NetSocket::create())),
+ status(STATUS_NONE),
+ peer_host(IP_Address()),
+ peer_port(0) {
}
StreamPeerTCP::~StreamPeerTCP() {
diff --git a/core/io/tcp_server.cpp b/core/io/tcp_server.cpp
index b8194cb17f..be9176779e 100644
--- a/core/io/tcp_server.cpp
+++ b/core/io/tcp_server.cpp
@@ -116,9 +116,8 @@ void TCP_Server::stop() {
}
}
-TCP_Server::TCP_Server() {
-
- _sock = Ref<NetSocket>(NetSocket::create());
+TCP_Server::TCP_Server() :
+ _sock(Ref<NetSocket>(NetSocket::create())) {
}
TCP_Server::~TCP_Server() {
diff --git a/core/math/expression.cpp b/core/math/expression.cpp
index 0cfb54234c..7f3439e956 100644
--- a/core/math/expression.cpp
+++ b/core/math/expression.cpp
@@ -2157,13 +2157,13 @@ void Expression::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_error_text"), &Expression::get_error_text);
}
-Expression::Expression() {
- output_type = Variant::NIL;
- error_set = true;
- root = NULL;
- nodes = NULL;
- sequenced = false;
- execution_error = false;
+Expression::Expression() :
+ output_type(Variant::NIL),
+ sequenced(false),
+ error_set(true),
+ root(NULL),
+ nodes(NULL),
+ execution_error(false) {
}
Expression::~Expression() {
diff --git a/core/math/expression.h b/core/math/expression.h
index ac2416d0dd..7f81542480 100644
--- a/core/math/expression.h
+++ b/core/math/expression.h
@@ -116,7 +116,9 @@ private:
Variant::Type type;
String name;
- Input() { type = Variant::NIL; }
+ Input() :
+ type(Variant::NIL) {
+ }
};
Vector<Input> inputs;
diff --git a/core/math/plane.h b/core/math/plane.h
index 4eedebb79e..5182dc67dd 100644
--- a/core/math/plane.h
+++ b/core/math/plane.h
@@ -74,10 +74,11 @@ public:
_FORCE_INLINE_ bool operator!=(const Plane &p_plane) const;
operator String() const;
- _FORCE_INLINE_ Plane() { d = 0; }
+ _FORCE_INLINE_ Plane() :
+ d(0) {}
_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){};
+ d(p_d) {}
_FORCE_INLINE_ Plane(const Vector3 &p_normal, real_t p_d);
_FORCE_INLINE_ Plane(const Vector3 &p_point, const Vector3 &p_normal);
diff --git a/core/math/quat.h b/core/math/quat.h
index c4f9b3a732..59a15f460b 100644
--- a/core/math/quat.h
+++ b/core/math/quat.h
@@ -115,20 +115,20 @@ 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) {
- x = p_x;
- y = p_y;
- z = p_z;
- w = p_w;
+ 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),
+ w(p_w) {
}
Quat(const Vector3 &axis, const real_t &angle) { set_axis_angle(axis, angle); }
Quat(const Vector3 &euler) { set_euler(euler); }
- Quat(const Quat &q) {
- x = q.x;
- y = q.y;
- z = q.z;
- w = q.w;
+ Quat(const Quat &q) :
+ x(q.x),
+ y(q.y),
+ z(q.z),
+ w(q.w) {
}
Quat(const Vector3 &v0, const Vector3 &v1) // shortest arc
@@ -153,9 +153,11 @@ public:
}
}
- inline Quat() {
- x = y = z = 0;
- w = 1;
+ inline Quat() :
+ x(0),
+ y(0),
+ z(0),
+ w(1) {
}
};
diff --git a/core/os/dir_access.cpp b/core/os/dir_access.cpp
index ce70b859eb..8f4f2b6920 100644
--- a/core/os/dir_access.cpp
+++ b/core/os/dir_access.cpp
@@ -349,9 +349,9 @@ class DirChanger {
String original_dir;
public:
- DirChanger(DirAccess *p_da, String p_dir) {
- da = p_da;
- original_dir = p_da->get_current_dir();
+ DirChanger(DirAccess *p_da, String p_dir) :
+ da(p_da),
+ original_dir(p_da->get_current_dir()) {
p_da->change_dir(p_dir);
}
diff --git a/core/reference.cpp b/core/reference.cpp
index b79ad0bf3d..6ccc444b93 100644
--- a/core/reference.cpp
+++ b/core/reference.cpp
@@ -139,8 +139,8 @@ void WeakRef::set_ref(const REF &p_ref) {
ref = p_ref.is_valid() ? p_ref->get_instance_id() : 0;
}
-WeakRef::WeakRef() {
- ref = 0;
+WeakRef::WeakRef() :
+ ref(0) {
}
void WeakRef::_bind_methods() {
diff --git a/core/variant_parser.h b/core/variant_parser.h
index 531c1d59cd..e183169ed8 100644
--- a/core/variant_parser.h
+++ b/core/variant_parser.h
@@ -45,7 +45,8 @@ public:
CharType saved;
- Stream() { saved = 0; }
+ Stream() :
+ saved(0) {}
virtual ~Stream() {}
};