Replace append_utfx with direct String::utfx

This commit is contained in:
Kiro
2025-03-30 19:56:38 +02:00
parent ba3482926d
commit 23129a66ed
30 changed files with 49 additions and 123 deletions

View File

@ -736,9 +736,8 @@ void EditorExportPlatformMacOS::_make_icon(const Ref<EditorExportPreset> &p_pres
}
void EditorExportPlatformMacOS::_fix_privacy_manifest(const Ref<EditorExportPreset> &p_preset, Vector<uint8_t> &plist) {
String str;
String str = String::utf8((const char *)plist.ptr(), plist.size());
String strnew;
str.append_utf8((const char *)plist.ptr(), plist.size());
Vector<String> lines = str.split("\n");
for (int i = 0; i < lines.size(); i++) {
if (lines[i].find("$priv_collection") != -1) {
@ -815,9 +814,8 @@ void EditorExportPlatformMacOS::_fix_privacy_manifest(const Ref<EditorExportPres
}
void EditorExportPlatformMacOS::_fix_plist(const Ref<EditorExportPreset> &p_preset, Vector<uint8_t> &plist, const String &p_binary) {
String str;
String str = String::utf8((const char *)plist.ptr(), plist.size());
String strnew;
str.append_utf8((const char *)plist.ptr(), plist.size());
Vector<String> lines = str.split("\n");
for (int i = 0; i < lines.size(); i++) {
if (lines[i].contains("$binary")) {

View File

@ -270,8 +270,7 @@
text.resize([characters length] + 1);
[characters getCharacters:(unichar *)text.ptrw() range:NSMakeRange(0, [characters length])];
String u32text;
u32text.append_utf16(text.ptr(), text.length());
String u32text = String::utf16(text.ptr(), text.length());
for (int i = 0; i < u32text.length(); i++) {
const char32_t codepoint = u32text[i];
@ -652,8 +651,7 @@
text.resize([characters length] + 1);
[characters getCharacters:(unichar *)text.ptrw() range:NSMakeRange(0, [characters length])];
String u32text;
u32text.append_utf16(text.ptr(), text.length());
String u32text = String::utf16(text.ptr(), text.length());
DisplayServerMacOS::KeyEvent ke;
ke.window_id = window_id;

View File

@ -110,8 +110,7 @@ Vector<String> OS_MacOS::get_granted_permissions() const {
BOOL isStale = NO;
NSURL *url = [NSURL URLByResolvingBookmarkData:bookmark options:NSURLBookmarkResolutionWithSecurityScope relativeToURL:nil bookmarkDataIsStale:&isStale error:&error];
if (!error && !isStale) {
String url_string;
url_string.append_utf8([[url path] UTF8String]);
String url_string = String::utf8([[url path] UTF8String]);
ret.push_back(url_string);
}
}
@ -651,10 +650,7 @@ String OS_MacOS::get_executable_path() const {
if (ret <= 0) {
return OS::get_executable_path();
} else {
String path;
path.append_utf8(pathbuf);
return path;
return String::utf8(pathbuf);
}
}
@ -724,8 +720,7 @@ Error OS_MacOS::create_instance(const List<String> &p_arguments, ProcessID *r_ch
// If executable is bundled, always execute editor instances as an app bundle to ensure app window is registered and activated correctly.
NSString *nsappname = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleName"];
if (nsappname != nil) {
String path;
path.append_utf8([[[NSBundle mainBundle] bundlePath] UTF8String]);
String path = String::utf8([[[NSBundle mainBundle] bundlePath] UTF8String]);
return create_process(path, p_arguments, r_child_id, false);
} else {
return create_process(get_executable_path(), p_arguments, r_child_id, false);