From 339f332892fd09bba7218846a141c250ff4f429e Mon Sep 17 00:00:00 2001 From: Vinzenz Feenstra Date: Mon, 17 Feb 2014 21:46:25 +0100 Subject: Fix for Issue #108 Entering a somethign in the 'Path field' triggers the `_path_changed` signal being triggered. This in turn calls Globals::localize_path(const String& p_path) with the currently entered string. localize_path then is replacing backslashes with slashes and calls afterwards `String::simplify_path` String::simplify_path is checking wheter a string starts with: - res:// - local:// - user:// If any of those is true it removes this section. However, if any of the first letters of those are matching begins_with returns true, which is wrong. It should only return true if the whole string is matched at the beginning. This caused the whole desaster and lead localize_path into an endless loop because out of `u` suddenly became user:// which it then tried again to localize and so on. This fix, fixes the root of the problem which is begins_with which should not return true if not the whole search string was matched. Signed-off-by: Vinzenz Feenstra --- core/ustring.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'core') diff --git a/core/ustring.cpp b/core/ustring.cpp index 336d8eea0a..b0f06c6ab6 100644 --- a/core/ustring.cpp +++ b/core/ustring.cpp @@ -2518,7 +2518,7 @@ bool String::begins_with(const char* p_string) const { } - return true; + return *p_string == 0; } -- cgit v1.2.3 From b6583909a9783dd5fc9595ba56f5d9f7557898b0 Mon Sep 17 00:00:00 2001 From: Terseus Date: Tue, 18 Feb 2014 21:37:58 +0100 Subject: Fix #113 editor_settings.xml corruption In the `parse_tag` method of the `class ResourceInteractiveLoaderXML`, the class responsible of loading the editor_settings.xml file, the properties' values are loaded directly into an `String` object but the file contents are always UTF-8, which leads to garbage in the XML file when saved. This patch reads the properties' values in a `CharString` and translate them to UTF-8. --- core/io/resource_format_xml.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'core') diff --git a/core/io/resource_format_xml.cpp b/core/io/resource_format_xml.cpp index f175c73e98..20a42f25df 100644 --- a/core/io/resource_format_xml.cpp +++ b/core/io/resource_format_xml.cpp @@ -97,16 +97,17 @@ ResourceInteractiveLoaderXML::Tag* ResourceInteractiveLoaderXML::parse_tag(bool if (!complete) { String name; - String value; + CharString r_value; bool reading_value=false; while(!f->eof_reached()) { CharType c=get_char(); if (c=='>') { - if (value.length()) { + if (r_value.size()) { - tag.args[name]=value; + r_value.push_back(0); + tag.args[name].parse_utf8(r_value.get_data()); } break; @@ -115,17 +116,18 @@ ResourceInteractiveLoaderXML::Tag* ResourceInteractiveLoaderXML::parse_tag(bool if (!reading_value && name.length()) { reading_value=true; - } else if (reading_value && value.length()) { + } else if (reading_value && r_value.size()) { - tag.args[name]=value; + r_value.push_back(0); + tag.args[name].parse_utf8(r_value.get_data()); name=""; - value=""; + r_value.clear(); reading_value=false; } } else if (reading_value) { - value+=c; + r_value.push_back(c); } else { name+=c; -- cgit v1.2.3