summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2018-12-16 19:13:35 +0100
committerGitHub <noreply@github.com>2018-12-16 19:13:35 +0100
commit9c7bc127b9f719b4fe6a14dd2c8745fc64cf1b32 (patch)
tree19ef5ec49f3737f9b44485740328d8f1a97085fe /modules
parent169db6abdd9d8973822dc5f2a4ce5bcf00bb3f55 (diff)
parent4e25e5066bfd6a1ea9d5dbfa5db9e25b66b8aa02 (diff)
Merge pull request #24385 from hpvb/reduce-string-coew
Reduce String CoW
Diffstat (limited to 'modules')
-rw-r--r--modules/gdnative/gdnative/string.cpp2
-rw-r--r--modules/gdnative/gdnative_api.json2
-rw-r--r--modules/gdnative/include/gdnative/string.h2
-rw-r--r--modules/mono/mono_gd/gd_mono_marshal.cpp2
4 files changed, 4 insertions, 4 deletions
diff --git a/modules/gdnative/gdnative/string.cpp b/modules/gdnative/gdnative/string.cpp
index 0996633b70..c0c7ab5420 100644
--- a/modules/gdnative/gdnative/string.cpp
+++ b/modules/gdnative/gdnative/string.cpp
@@ -74,7 +74,7 @@ void GDAPI godot_string_new_with_wide_string(godot_string *r_dest, const wchar_t
memnew_placement(dest, String(p_contents, p_size));
}
-wchar_t GDAPI *godot_string_operator_index(godot_string *p_self, const godot_int p_idx) {
+const wchar_t GDAPI *godot_string_operator_index(godot_string *p_self, const godot_int p_idx) {
String *self = (String *)p_self;
return &(self->operator[](p_idx));
}
diff --git a/modules/gdnative/gdnative_api.json b/modules/gdnative/gdnative_api.json
index c5a1fa139e..df7110f075 100644
--- a/modules/gdnative/gdnative_api.json
+++ b/modules/gdnative/gdnative_api.json
@@ -4755,7 +4755,7 @@
},
{
"name": "godot_string_operator_index",
- "return_type": "wchar_t *",
+ "return_type": "const wchar_t *",
"arguments": [
["godot_string *", "p_self"],
["const godot_int", "p_idx"]
diff --git a/modules/gdnative/include/gdnative/string.h b/modules/gdnative/include/gdnative/string.h
index 95ae42a9ec..2ca9fd9e15 100644
--- a/modules/gdnative/include/gdnative/string.h
+++ b/modules/gdnative/include/gdnative/string.h
@@ -79,7 +79,7 @@ void GDAPI godot_string_new(godot_string *r_dest);
void GDAPI godot_string_new_copy(godot_string *r_dest, const godot_string *p_src);
void GDAPI godot_string_new_with_wide_string(godot_string *r_dest, const wchar_t *p_contents, const int p_size);
-wchar_t GDAPI *godot_string_operator_index(godot_string *p_self, const godot_int p_idx);
+const wchar_t GDAPI *godot_string_operator_index(godot_string *p_self, const godot_int p_idx);
wchar_t GDAPI godot_string_operator_index_const(const godot_string *p_self, const godot_int p_idx);
const wchar_t GDAPI *godot_string_wide_str(const godot_string *p_self);
diff --git a/modules/mono/mono_gd/gd_mono_marshal.cpp b/modules/mono/mono_gd/gd_mono_marshal.cpp
index 3f0a5d6e50..b0b2aec667 100644
--- a/modules/mono/mono_gd/gd_mono_marshal.cpp
+++ b/modules/mono/mono_gd/gd_mono_marshal.cpp
@@ -216,7 +216,7 @@ String mono_to_utf16_string(MonoString *p_mono_string) {
ret.set(len, 0);
CharType *src = (CharType *)mono_string_chars(p_mono_string);
- CharType *dst = &(ret.operator[](0));
+ CharType *dst = ret.ptrw();
for (int i = 0; i < len; i++) {
dst[i] = src[i];