mirror of
https://github.com/Redot-Engine/redot-engine.git
synced 2025-12-06 07:17:42 -05:00
Rename String::resize to resize_uninitialized, to better communicate to callers that new characters must be initialized.
This commit is contained in:
@@ -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());
|
||||
|
||||
|
||||
@@ -85,7 +85,7 @@ String FileAccessWindows::fix_path(const String &p_path) const {
|
||||
if (r_path.is_relative_path()) {
|
||||
Char16String current_dir_name;
|
||||
size_t str_len = GetCurrentDirectoryW(0, nullptr);
|
||||
current_dir_name.resize(str_len + 1);
|
||||
current_dir_name.resize_uninitialized(str_len + 1);
|
||||
GetCurrentDirectoryW(current_dir_name.size(), (LPWSTR)current_dir_name.ptrw());
|
||||
r_path = String::utf16((const char16_t *)current_dir_name.get_data()).trim_prefix(R"(\\?\)").replace_char('\\', '/').path_join(r_path);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user