1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-04 12:00:25 +00:00

When calling code has length of string, pass it to parse_utf8

This commit is contained in:
Kiro
2024-11-29 14:35:02 +01:00
parent 0eadbdb5d0
commit 83d4bde0a2
10 changed files with 13 additions and 15 deletions

View File

@@ -179,9 +179,7 @@ Error WindowsUtils::copy_and_rename_pdb(const String &p_dll_path) {
if (new_expected_buffer_size > original_path_size) {
ERR_FAIL_COND_V_MSG(original_path_size < min_base_size + suffix_size, FAILED, vformat("The original PDB path size in bytes is too small: '%s'. Expected size: %d or more bytes, but available %d.", pdb_info.path, min_base_size + suffix_size, original_path_size));
utf8_name.resize(original_path_size - suffix_size + 1); // +1 for the \0
utf8_name[utf8_name.size() - 1] = '\0';
new_pdb_base_name.parse_utf8(utf8_name);
new_pdb_base_name.parse_utf8(utf8_name, original_path_size - suffix_size);
new_pdb_base_name[new_pdb_base_name.length() - 1] = '_'; // Restore the last '_'
WARN_PRINT(vformat("The original path size of '%s' in bytes was too small to fit the new name, so it was shortened to '%s%d.pdb'.", pdb_info.path, new_pdb_base_name, max_pdb_names - 1));
}