mirror of
https://github.com/godotengine/godot.git
synced 2025-10-19 16:03:29 +00:00
Rename String::resize
to resize_uninitialized
, to better communicate to callers that new characters must be initialized.
This commit is contained in:
parent
51b0379e55
commit
b13a0e1834
26 changed files with 103 additions and 98 deletions
|
@ -123,7 +123,7 @@ StringBuffer<SHORT_BUFFER_SIZE> &StringBuffer<SHORT_BUFFER_SIZE>::reserve(int p_
|
|||
}
|
||||
|
||||
bool need_copy = string_length > 0 && buffer.is_empty();
|
||||
buffer.resize(next_power_of_2((uint32_t)p_size));
|
||||
buffer.resize_uninitialized(next_power_of_2((uint32_t)p_size));
|
||||
if (need_copy) {
|
||||
memcpy(buffer.ptrw(), short_buffer, string_length * sizeof(char32_t));
|
||||
}
|
||||
|
@ -142,7 +142,7 @@ String StringBuffer<SHORT_BUFFER_SIZE>::as_string() {
|
|||
if (buffer.is_empty()) {
|
||||
return String(short_buffer);
|
||||
} else {
|
||||
buffer.resize(string_length + 1);
|
||||
buffer.resize_uninitialized(string_length + 1);
|
||||
return buffer;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue