Merge pull request #56549 from bruvzg/utf8_fixes
This commit is contained in:
commit
84d82030c3
13 changed files with 22 additions and 22 deletions
|
@ -189,7 +189,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 };
|
||||
|
|
|
@ -520,8 +520,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;
|
||||
|
|
|
@ -346,7 +346,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;
|
||||
}
|
||||
|
||||
|
|
|
@ -70,7 +70,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;
|
||||
|
|
|
@ -362,16 +362,16 @@ void GDScriptTest::error_handler(void *p_this, const char *p_function, const cha
|
|||
}
|
||||
|
||||
builder.append("\n>> on function: ");
|
||||
builder.append(p_function);
|
||||
builder.append(String::utf8(p_function));
|
||||
builder.append("()\n>> ");
|
||||
builder.append(String(p_file).trim_prefix(self->base_dir));
|
||||
builder.append(String::utf8(p_file).trim_prefix(self->base_dir));
|
||||
builder.append("\n>> ");
|
||||
builder.append(itos(p_line));
|
||||
builder.append("\n>> ");
|
||||
builder.append(p_error);
|
||||
builder.append(String::utf8(p_error));
|
||||
if (strlen(p_explanation) > 0) {
|
||||
builder.append("\n>> ");
|
||||
builder.append(p_explanation);
|
||||
builder.append(String::utf8(p_explanation));
|
||||
}
|
||||
builder.append("\n");
|
||||
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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]];
|
||||
|
|
|
@ -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<String> 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) {
|
||||
|
|
|
@ -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";
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue