From 4e5310cc60dc17e5ef09e57115ca8236544679e4 Mon Sep 17 00:00:00 2001 From: qarmin Date: Wed, 26 Jun 2019 15:08:25 +0200 Subject: Some code changed with Clang-Tidy --- core/io/file_access_network.cpp | 1 - core/io/http_client.cpp | 2 +- core/io/marshalls.cpp | 7 ------- core/io/multiplayer_api.h | 2 +- core/io/pck_packer.cpp | 5 +---- core/io/resource_format_binary.cpp | 4 ++-- core/io/stream_peer_tcp.cpp | 1 - core/io/tcp_server.cpp | 6 +----- 8 files changed, 6 insertions(+), 22 deletions(-) (limited to 'core/io') diff --git a/core/io/file_access_network.cpp b/core/io/file_access_network.cpp index 5dd167c581..d1c7f5c334 100644 --- a/core/io/file_access_network.cpp +++ b/core/io/file_access_network.cpp @@ -435,7 +435,6 @@ int FileAccessNetwork::get_buffer(uint8_t *p_dst, int p_length) const { _queue_page(page + j); } - buff = pages.write[page].buffer.ptrw(); //queue pages buffer_mutex->unlock(); } diff --git a/core/io/http_client.cpp b/core/io/http_client.cpp index 891fb7b0ca..c3626bfe31 100644 --- a/core/io/http_client.cpp +++ b/core/io/http_client.cpp @@ -775,7 +775,7 @@ Dictionary HTTPClient::_get_response_headers_as_dictionary() { get_response_headers(&rh); Dictionary ret; for (const List::Element *E = rh.front(); E; E = E->next()) { - String s = E->get(); + const String &s = E->get(); int sp = s.find(":"); if (sp == -1) continue; diff --git a/core/io/marshalls.cpp b/core/io/marshalls.cpp index 7494603462..6a954a07de 100644 --- a/core/io/marshalls.cpp +++ b/core/io/marshalls.cpp @@ -681,8 +681,6 @@ Error decode_variant(Variant &r_variant, const uint8_t *p_buffer, int p_len, int if (r_len) (*r_len) += adv; - len -= adv; - buf += adv; } r_variant = varray; @@ -719,8 +717,6 @@ Error decode_variant(Variant &r_variant, const uint8_t *p_buffer, int p_len, int if (r_len) (*r_len) += adv; - len -= adv; - buf += adv; } r_variant = varray; @@ -758,8 +754,6 @@ Error decode_variant(Variant &r_variant, const uint8_t *p_buffer, int p_len, int if (r_len) (*r_len) += adv; - len -= adv; - buf += adv; } r_variant = carray; @@ -1092,7 +1086,6 @@ Error encode_variant(const Variant &p_variant, uint8_t *r_buffer, int &r_len, bo if (!obj) { if (buf) { encode_uint32(0, buf); - buf += 4; } r_len += 4; diff --git a/core/io/multiplayer_api.h b/core/io/multiplayer_api.h index 779dd043bd..5258dde5d7 100644 --- a/core/io/multiplayer_api.h +++ b/core/io/multiplayer_api.h @@ -77,7 +77,7 @@ protected: void _process_raw(int p_from, const uint8_t *p_packet, int p_packet_len); void _send_rpc(Node *p_from, int p_to, bool p_unreliable, bool p_set, const StringName &p_name, const Variant **p_arg, int p_argcount); - bool _send_confirm_path(NodePath p_path, PathSentCache *psc, int p_from); + bool _send_confirm_path(NodePath p_path, PathSentCache *psc, int p_target); public: enum NetworkCommands { diff --git a/core/io/pck_packer.cpp b/core/io/pck_packer.cpp index 8920bbfb81..55685a2d9a 100644 --- a/core/io/pck_packer.cpp +++ b/core/io/pck_packer.cpp @@ -109,10 +109,7 @@ Error PCKPacker::add_file(const String &p_file, const String &p_src) { Error PCKPacker::flush(bool p_verbose) { - if (!file) { - ERR_FAIL_COND_V(!file, ERR_INVALID_PARAMETER); - return ERR_INVALID_PARAMETER; - }; + ERR_FAIL_COND_V(!file, ERR_INVALID_PARAMETER); // write the index diff --git a/core/io/resource_format_binary.cpp b/core/io/resource_format_binary.cpp index aef2dcfff3..688dfc21e5 100644 --- a/core/io/resource_format_binary.cpp +++ b/core/io/resource_format_binary.cpp @@ -720,7 +720,7 @@ Error ResourceInteractiveLoaderBinary::poll() { error = ERR_FILE_CORRUPT; memdelete(obj); //bye ERR_EXPLAIN(local_path + ":Resource type in resource field not a resource, type is: " + obj->get_class()); - ERR_FAIL_COND_V(!r, ERR_FILE_CORRUPT); + ERR_FAIL_V(ERR_FILE_CORRUPT); } RES res = RES(r); @@ -1694,7 +1694,7 @@ void ResourceFormatSaverBinaryInstance::_find_resources(const Variant &p_variant int len = varray.size(); for (int i = 0; i < len; i++) { - Variant v = varray.get(i); + const Variant &v = varray.get(i); _find_resources(v); } diff --git a/core/io/stream_peer_tcp.cpp b/core/io/stream_peer_tcp.cpp index 45f3e46e35..bcdae343b8 100644 --- a/core/io/stream_peer_tcp.cpp +++ b/core/io/stream_peer_tcp.cpp @@ -352,7 +352,6 @@ void StreamPeerTCP::_bind_methods() { StreamPeerTCP::StreamPeerTCP() : _sock(Ref(NetSocket::create())), status(STATUS_NONE), - peer_host(IP_Address()), peer_port(0) { } diff --git a/core/io/tcp_server.cpp b/core/io/tcp_server.cpp index 6599c4eb5b..be87f47d50 100644 --- a/core/io/tcp_server.cpp +++ b/core/io/tcp_server.cpp @@ -83,11 +83,7 @@ bool TCP_Server::is_connection_available() const { return false; Error err = _sock->poll(NetSocket::POLL_TYPE_IN, 0); - if (err != OK) { - return false; - } - - return true; + return (err == OK); } Ref TCP_Server::take_connection() { -- cgit v1.2.3