Fix multiple missing UTF-8 decoding.
(cherry picked from commit c69e0d16bc
)
This commit is contained in:
parent
9b149d5848
commit
6f81a8ee2c
|
@ -191,7 +191,7 @@ bool ZipArchive::try_open_pack(const String &p_path, bool p_replace_files, uint6
|
|||
f.package = pkg_num;
|
||||
unzGetFilePos(zfile, &f.file_pos);
|
||||
|
||||
String fname = String("res://") + filename_inzip;
|
||||
String fname = String("res://") + String::utf8(filename_inzip);
|
||||
files[fname] = f;
|
||||
|
||||
uint8_t md5[16] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
|
||||
|
|
|
@ -478,7 +478,7 @@ String OS::get_model_name() const {
|
|||
}
|
||||
|
||||
void OS::set_cmdline(const char *p_execpath, const List<String> &p_args) {
|
||||
_execpath = p_execpath;
|
||||
_execpath = String::utf8(p_execpath);
|
||||
_cmdline = p_args;
|
||||
};
|
||||
|
||||
|
|
|
@ -477,8 +477,8 @@ void ResourceCache::dump(const char *p_file, bool p_short) {
|
|||
|
||||
FileAccess *f = nullptr;
|
||||
if (p_file) {
|
||||
f = FileAccess::open(p_file, FileAccess::WRITE);
|
||||
ERR_FAIL_COND_MSG(!f, "Cannot create file at path '" + String(p_file) + "'.");
|
||||
f = FileAccess::open(String::utf8(p_file), FileAccess::WRITE);
|
||||
ERR_FAIL_COND_MSG(!f, "Cannot create file at path '" + String::utf8(p_file) + "'.");
|
||||
}
|
||||
|
||||
const String *K = nullptr;
|
||||
|
|
|
@ -69,7 +69,7 @@
|
|||
<return type="String" />
|
||||
<argument index="0" name="bytes" type="int" default="-1" />
|
||||
<description>
|
||||
Gets a string with byte-length [code]bytes[/code] from the stream. If [code]bytes[/code] is negative (default) the length will be read from the stream using the reverse process of [method put_string].
|
||||
Gets an ASCII string with byte-length [code]bytes[/code] from the stream. If [code]bytes[/code] is negative (default) the length will be read from the stream using the reverse process of [method put_string].
|
||||
</description>
|
||||
</method>
|
||||
<method name="get_u16">
|
||||
|
|
|
@ -283,9 +283,9 @@ Array AudioDriverALSA::get_device_list() {
|
|||
|
||||
if (name != nullptr && !strncmp(name, "plughw", 6)) {
|
||||
if (desc) {
|
||||
list.push_back(String(name) + ";" + String(desc));
|
||||
list.push_back(String::utf8(name) + ";" + String::utf8(desc));
|
||||
} else {
|
||||
list.push_back(String(name));
|
||||
list.push_back(String::utf8(name));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -540,7 +540,7 @@ Array AudioDriverCoreAudio::_get_device_list(bool capture) {
|
|||
ERR_FAIL_NULL_V_MSG(buffer, list, "Out of memory.");
|
||||
if (CFStringGetCString(cfname, buffer, maxSize, kCFStringEncodingUTF8)) {
|
||||
// Append the ID to the name in case we have devices with duplicate name
|
||||
list.push_back(String(buffer) + " (" + itos(audioDevices[i]) + ")");
|
||||
list.push_back(String::utf8(buffer) + " (" + itos(audioDevices[i]) + ")");
|
||||
}
|
||||
|
||||
memfree(buffer);
|
||||
|
@ -597,7 +597,7 @@ void AudioDriverCoreAudio::_set_device(const String &device, bool capture) {
|
|||
char *buffer = (char *)memalloc(maxSize);
|
||||
ERR_FAIL_NULL_MSG(buffer, "Out of memory.");
|
||||
if (CFStringGetCString(cfname, buffer, maxSize, kCFStringEncodingUTF8)) {
|
||||
String name = String(buffer) + " (" + itos(audioDevices[i]) + ")";
|
||||
String name = String::utf8(buffer) + " (" + itos(audioDevices[i]) + ")";
|
||||
if (name == device) {
|
||||
deviceId = audioDevices[i];
|
||||
found = true;
|
||||
|
|
|
@ -231,7 +231,7 @@ void CameraFeedOSX::set_device(AVCaptureDevice *p_device) {
|
|||
|
||||
// get some info
|
||||
NSString *device_name = p_device.localizedName;
|
||||
name = device_name.UTF8String;
|
||||
name = String::utf8(device_name.UTF8String);
|
||||
position = CameraFeed::FEED_UNSPECIFIED;
|
||||
if ([p_device position] == AVCaptureDevicePositionBack) {
|
||||
position = CameraFeed::FEED_BACK;
|
||||
|
|
|
@ -67,7 +67,7 @@ String iOS::get_model() const {
|
|||
NSString *platform = [NSString stringWithCString:model encoding:NSUTF8StringEncoding];
|
||||
free(model);
|
||||
const char *str = [platform UTF8String];
|
||||
return String(str != NULL ? str : "");
|
||||
return String::utf8(str != nullptr ? str : "");
|
||||
}
|
||||
|
||||
String iOS::get_rate_url(int p_app_id) const {
|
||||
|
|
|
@ -158,7 +158,7 @@ void JoypadIPhone::start_processing() {
|
|||
};
|
||||
|
||||
// tell Godot about our new controller
|
||||
OSIPhone::get_singleton()->joy_connection_changed(joy_id, true, [controller.vendorName UTF8String]);
|
||||
OSIPhone::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]];
|
||||
|
|
|
@ -659,7 +659,7 @@ const char *OS_JavaScript::get_audio_driver_name(int p_driver) const {
|
|||
// Clipboard
|
||||
void OS_JavaScript::update_clipboard_callback(const char *p_text) {
|
||||
// Only call set_clipboard from OS (sets local clipboard)
|
||||
get_singleton()->OS::set_clipboard(p_text);
|
||||
get_singleton()->OS::set_clipboard(String::utf8(p_text));
|
||||
}
|
||||
|
||||
void OS_JavaScript::set_clipboard(const String &p_text) {
|
||||
|
|
|
@ -3352,7 +3352,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));
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -3431,7 +3431,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;
|
||||
}
|
||||
|
||||
|
|
|
@ -3871,7 +3871,7 @@ Error OS_X11::move_to_trash(const String &p_path) {
|
|||
if (trash_path == "") {
|
||||
char *dhome = getenv("XDG_DATA_HOME");
|
||||
if (dhome) {
|
||||
trash_path = String(dhome) + "/Trash";
|
||||
trash_path = String::utf8(dhome) + "/Trash";
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3879,7 +3879,7 @@ Error OS_X11::move_to_trash(const String &p_path) {
|
|||
if (trash_path == "") {
|
||||
char *home = getenv("HOME");
|
||||
if (home) {
|
||||
trash_path = String(home) + "/.local/share/Trash";
|
||||
trash_path = String::utf8(home) + "/.local/share/Trash";
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue