mirror of
https://github.com/godotengine/godot.git
synced 2025-11-01 22:21:18 +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
|
|
@ -155,7 +155,7 @@ Error DirAccessWindows::change_dir(String p_dir) {
|
|||
|
||||
Char16String real_current_dir_name;
|
||||
size_t str_len = GetCurrentDirectoryW(0, nullptr);
|
||||
real_current_dir_name.resize(str_len + 1);
|
||||
real_current_dir_name.resize_uninitialized(str_len + 1);
|
||||
GetCurrentDirectoryW(real_current_dir_name.size(), (LPWSTR)real_current_dir_name.ptrw());
|
||||
String prev_dir = String::utf16((const char16_t *)real_current_dir_name.get_data());
|
||||
|
||||
|
|
@ -165,7 +165,7 @@ Error DirAccessWindows::change_dir(String p_dir) {
|
|||
String base = _get_root_path();
|
||||
if (!base.is_empty()) {
|
||||
str_len = GetCurrentDirectoryW(0, nullptr);
|
||||
real_current_dir_name.resize(str_len + 1);
|
||||
real_current_dir_name.resize_uninitialized(str_len + 1);
|
||||
GetCurrentDirectoryW(real_current_dir_name.size(), (LPWSTR)real_current_dir_name.ptrw());
|
||||
String new_dir = String::utf16((const char16_t *)real_current_dir_name.get_data()).trim_prefix(R"(\\?\)").replace_char('\\', '/');
|
||||
if (!new_dir.begins_with(base)) {
|
||||
|
|
@ -175,7 +175,7 @@ Error DirAccessWindows::change_dir(String p_dir) {
|
|||
|
||||
if (worked) {
|
||||
str_len = GetCurrentDirectoryW(0, nullptr);
|
||||
real_current_dir_name.resize(str_len + 1);
|
||||
real_current_dir_name.resize_uninitialized(str_len + 1);
|
||||
GetCurrentDirectoryW(real_current_dir_name.size(), (LPWSTR)real_current_dir_name.ptrw());
|
||||
current_dir = String::utf16((const char16_t *)real_current_dir_name.get_data());
|
||||
}
|
||||
|
|
@ -447,7 +447,7 @@ String DirAccessWindows::read_link(String p_file) {
|
|||
return f;
|
||||
}
|
||||
Char16String cs;
|
||||
cs.resize(ret + 1);
|
||||
cs.resize_uninitialized(ret + 1);
|
||||
GetFinalPathNameByHandleW(hfile, (LPWSTR)cs.ptrw(), ret, VOLUME_NAME_DOS | FILE_NAME_NORMALIZED);
|
||||
CloseHandle(hfile);
|
||||
|
||||
|
|
@ -475,7 +475,7 @@ DirAccessWindows::DirAccessWindows() {
|
|||
|
||||
Char16String real_current_dir_name;
|
||||
size_t str_len = GetCurrentDirectoryW(0, nullptr);
|
||||
real_current_dir_name.resize(str_len + 1);
|
||||
real_current_dir_name.resize_uninitialized(str_len + 1);
|
||||
GetCurrentDirectoryW(real_current_dir_name.size(), (LPWSTR)real_current_dir_name.ptrw());
|
||||
current_dir = String::utf16((const char16_t *)real_current_dir_name.get_data());
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue