From c69e0d16bc8adbe3d984f4f9953412986ed02791 Mon Sep 17 00:00:00 2001 From: bruvzg <7645683+bruvzg@users.noreply.github.com> Date: Thu, 6 Jan 2022 11:34:10 +0200 Subject: Fix multiple missing UTF-8 decoding. --- platform/iphone/ios.mm | 2 +- platform/iphone/joypad_iphone.mm | 2 +- platform/javascript/display_server_javascript.cpp | 4 ++-- platform/linuxbsd/os_linuxbsd.cpp | 4 ++-- platform/osx/os_osx.mm | 4 ++-- 5 files changed, 8 insertions(+), 8 deletions(-) (limited to 'platform') diff --git a/platform/iphone/ios.mm b/platform/iphone/ios.mm index 91a2e6c228..da21ad0ace 100644 --- a/platform/iphone/ios.mm +++ b/platform/iphone/ios.mm @@ -65,7 +65,7 @@ String iOS::get_model() const { NSString *platform = [NSString stringWithCString:model encoding:NSUTF8StringEncoding]; free(model); const char *str = [platform UTF8String]; - return String(str != nullptr ? str : ""); + return String::utf8(str != nullptr ? str : ""); } String iOS::get_rate_url(int p_app_id) const { diff --git a/platform/iphone/joypad_iphone.mm b/platform/iphone/joypad_iphone.mm index 8c6e546515..2630b42da0 100644 --- a/platform/iphone/joypad_iphone.mm +++ b/platform/iphone/joypad_iphone.mm @@ -159,7 +159,7 @@ void JoypadIPhone::start_processing() { }; // tell Godot about our new controller - Input::get_singleton()->joy_connection_changed(joy_id, true, [controller.vendorName UTF8String]); + Input::get_singleton()->joy_connection_changed(joy_id, true, String::utf8([controller.vendorName UTF8String])); // add it to our dictionary, this will retain our controllers [self.connectedJoypads setObject:controller forKey:[NSNumber numberWithInt:joy_id]]; diff --git a/platform/javascript/display_server_javascript.cpp b/platform/javascript/display_server_javascript.cpp index f0b06d841e..5d960ef80c 100644 --- a/platform/javascript/display_server_javascript.cpp +++ b/platform/javascript/display_server_javascript.cpp @@ -500,7 +500,7 @@ void DisplayServerJavaScript::vk_input_text_callback(const char *p_text, int p_c return; } // Call input_text - Variant event = String(p_text); + Variant event = String::utf8(p_text); Variant *eventp = &event; Variant ret; Callable::CallError ce; @@ -590,7 +590,7 @@ Vector DisplayServerJavaScript::get_rendering_drivers_func() { // Clipboard void DisplayServerJavaScript::update_clipboard_callback(const char *p_text) { - get_singleton()->clipboard = p_text; + get_singleton()->clipboard = String::utf8(p_text); } void DisplayServerJavaScript::clipboard_set(const String &p_text) { diff --git a/platform/linuxbsd/os_linuxbsd.cpp b/platform/linuxbsd/os_linuxbsd.cpp index fe891e1c6a..b5f127bb16 100644 --- a/platform/linuxbsd/os_linuxbsd.cpp +++ b/platform/linuxbsd/os_linuxbsd.cpp @@ -431,7 +431,7 @@ Error OS_LinuxBSD::move_to_trash(const String &p_path) { if (trash_path.is_empty()) { char *dhome = getenv("XDG_DATA_HOME"); if (dhome) { - trash_path = String(dhome) + "/Trash"; + trash_path = String::utf8(dhome) + "/Trash"; } } @@ -439,7 +439,7 @@ Error OS_LinuxBSD::move_to_trash(const String &p_path) { if (trash_path.is_empty()) { char *home = getenv("HOME"); if (home) { - trash_path = String(home) + "/.local/share/Trash"; + trash_path = String::utf8(home) + "/.local/share/Trash"; } } diff --git a/platform/osx/os_osx.mm b/platform/osx/os_osx.mm index e57b503ddc..7d07b0076b 100644 --- a/platform/osx/os_osx.mm +++ b/platform/osx/os_osx.mm @@ -586,7 +586,7 @@ void OS_OSX::run() { quit = true; } } @catch (NSException *exception) { - ERR_PRINT("NSException: " + String([exception reason].UTF8String)); + ERR_PRINT("NSException: " + String::utf8([exception reason].UTF8String)); } }; @@ -602,7 +602,7 @@ Error OS_OSX::move_to_trash(const String &p_path) { NSError *err; if (![fm trashItemAtURL:url resultingItemURL:nil error:&err]) { - ERR_PRINT("trashItemAtURL error: " + String(err.localizedDescription.UTF8String)); + ERR_PRINT("trashItemAtURL error: " + String::utf8(err.localizedDescription.UTF8String)); return FAILED; } -- cgit v1.2.3