summaryrefslogtreecommitdiff
path: root/core/io
diff options
context:
space:
mode:
Diffstat (limited to 'core/io')
-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
9 files changed, 90 insertions, 99 deletions
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() {