diff options
Diffstat (limited to 'core/io')
-rw-r--r-- | core/io/config_file.cpp | 13 | ||||
-rw-r--r-- | core/io/resource_format_binary.cpp | 19 | ||||
-rw-r--r-- | core/io/stream_peer_ssl.cpp | 1 | ||||
-rw-r--r-- | core/io/stream_peer_ssl.h | 1 |
4 files changed, 20 insertions, 14 deletions
diff --git a/core/io/config_file.cpp b/core/io/config_file.cpp index dd0191f43f..ae421654ca 100644 --- a/core/io/config_file.cpp +++ b/core/io/config_file.cpp @@ -61,19 +61,19 @@ PackedStringArray ConfigFile::_get_section_keys(const String &p_section) const { } void ConfigFile::set_value(const String &p_section, const String &p_key, const Variant &p_value) { - if (p_value.get_type() == Variant::NIL) { - //erase + if (p_value.get_type() == Variant::NIL) { // Erase key. if (!values.has(p_section)) { - return; // ? + return; } + values[p_section].erase(p_key); if (values[p_section].is_empty()) { values.erase(p_section); } - } else { if (!values.has(p_section)) { - values[p_section] = HashMap<String, Variant>(); + // Insert section-less keys at the beginning. + values.insert(p_section, HashMap<String, Variant>(), p_section.is_empty()); } values[p_section][p_key] = p_value; @@ -125,6 +125,9 @@ void ConfigFile::erase_section_key(const String &p_section, const String &p_key) ERR_FAIL_COND_MSG(!values[p_section].has(p_key), vformat("Cannot erase nonexistent key \"%s\" from section \"%s\".", p_key, p_section)); values[p_section].erase(p_key); + if (values[p_section].is_empty()) { + values.erase(p_section); + } } Error ConfigFile::save(const String &p_path) { diff --git a/core/io/resource_format_binary.cpp b/core/io/resource_format_binary.cpp index 24458f20b4..2469e1a4be 100644 --- a/core/io/resource_format_binary.cpp +++ b/core/io/resource_format_binary.cpp @@ -1547,10 +1547,11 @@ void ResourceFormatSaverBinaryInstance::write_variant(Ref<FileAccess> f, const V case Variant::COLOR: { f->store_32(VARIANT_COLOR); Color val = p_property; - f->store_real(val.r); - f->store_real(val.g); - f->store_real(val.b); - f->store_real(val.a); + // Color are always floats + f->store_float(val.r); + f->store_float(val.g); + f->store_float(val.b); + f->store_float(val.a); } break; case Variant::STRING_NAME: { @@ -1685,7 +1686,7 @@ void ResourceFormatSaverBinaryInstance::write_variant(Ref<FileAccess> f, const V f->store_32(len); const float *r = arr.ptr(); for (int i = 0; i < len; i++) { - f->store_real(r[i]); + f->store_float(r[i]); } } break; @@ -1743,10 +1744,10 @@ void ResourceFormatSaverBinaryInstance::write_variant(Ref<FileAccess> f, const V f->store_32(len); const Color *r = arr.ptr(); for (int i = 0; i < len; i++) { - f->store_real(r[i].r); - f->store_real(r[i].g); - f->store_real(r[i].b); - f->store_real(r[i].a); + f->store_float(r[i].r); + f->store_float(r[i].g); + f->store_float(r[i].b); + f->store_float(r[i].a); } } break; diff --git a/core/io/stream_peer_ssl.cpp b/core/io/stream_peer_ssl.cpp index ea8435e587..5b90fb52a6 100644 --- a/core/io/stream_peer_ssl.cpp +++ b/core/io/stream_peer_ssl.cpp @@ -60,6 +60,7 @@ void StreamPeerSSL::_bind_methods() { ClassDB::bind_method(D_METHOD("accept_stream", "stream", "private_key", "certificate", "chain"), &StreamPeerSSL::accept_stream, DEFVAL(Ref<X509Certificate>())); ClassDB::bind_method(D_METHOD("connect_to_stream", "stream", "validate_certs", "for_hostname", "valid_certificate"), &StreamPeerSSL::connect_to_stream, DEFVAL(false), DEFVAL(String()), DEFVAL(Ref<X509Certificate>())); ClassDB::bind_method(D_METHOD("get_status"), &StreamPeerSSL::get_status); + ClassDB::bind_method(D_METHOD("get_stream"), &StreamPeerSSL::get_stream); ClassDB::bind_method(D_METHOD("disconnect_from_stream"), &StreamPeerSSL::disconnect_from_stream); ClassDB::bind_method(D_METHOD("set_blocking_handshake_enabled", "enabled"), &StreamPeerSSL::set_blocking_handshake_enabled); ClassDB::bind_method(D_METHOD("is_blocking_handshake_enabled"), &StreamPeerSSL::is_blocking_handshake_enabled); diff --git a/core/io/stream_peer_ssl.h b/core/io/stream_peer_ssl.h index 15f646d897..fe68667adc 100644 --- a/core/io/stream_peer_ssl.h +++ b/core/io/stream_peer_ssl.h @@ -61,6 +61,7 @@ public: virtual Error accept_stream(Ref<StreamPeer> p_base, Ref<CryptoKey> p_key, Ref<X509Certificate> p_cert, Ref<X509Certificate> p_ca_chain = Ref<X509Certificate>()) = 0; virtual Error connect_to_stream(Ref<StreamPeer> p_base, bool p_validate_certs = false, const String &p_for_hostname = String(), Ref<X509Certificate> p_valid_cert = Ref<X509Certificate>()) = 0; virtual Status get_status() const = 0; + virtual Ref<StreamPeer> get_stream() const = 0; virtual void disconnect_from_stream() = 0; |