Merge pull request #104810 from kiroxas/utf8_cleanup
Replace `append_utfx` with direct `String::utfx`
This commit is contained in:
@@ -744,9 +744,7 @@ String FileAccess::get_pascal_string() {
|
||||
get_buffer((uint8_t *)cs.ptr(), sl);
|
||||
cs[sl] = 0;
|
||||
|
||||
String ret;
|
||||
ret.append_utf8(cs.ptr(), sl);
|
||||
return ret;
|
||||
return String::utf8(cs.ptr(), sl);
|
||||
}
|
||||
|
||||
bool FileAccess::store_line(const String &p_line) {
|
||||
|
||||
@@ -306,9 +306,7 @@ bool PackedSourcePCK::try_open_pack(const String &p_path, bool p_replace_files,
|
||||
f->get_buffer((uint8_t *)cs.ptr(), sl);
|
||||
cs[sl] = 0;
|
||||
|
||||
String path;
|
||||
path.append_utf8(cs.ptr(), sl);
|
||||
|
||||
String path = String::utf8(cs.ptr(), sl);
|
||||
uint64_t ofs = f->get_64();
|
||||
uint64_t size = f->get_64();
|
||||
uint8_t md5[16];
|
||||
|
||||
@@ -483,8 +483,7 @@ Error HTTPClientTCP::poll() {
|
||||
(rs >= 4 && response_str[rs - 4] == '\r' && response_str[rs - 3] == '\n' && response_str[rs - 2] == '\r' && response_str[rs - 1] == '\n')) {
|
||||
// End of response, parse.
|
||||
response_str.push_back(0);
|
||||
String response;
|
||||
response.append_utf8((const char *)response_str.ptr(), response_str.size());
|
||||
String response = String::utf8((const char *)response_str.ptr(), response_str.size());
|
||||
Vector<String> responses = response.split("\n");
|
||||
body_size = -1;
|
||||
chunked = false;
|
||||
|
||||
+1
-3
@@ -647,10 +647,8 @@ bool PList::load_file(const String &p_filename) {
|
||||
Vector<uint8_t> array = FileAccess::get_file_as_bytes(p_filename, &err);
|
||||
ERR_FAIL_COND_V(err != OK, false);
|
||||
|
||||
String ret;
|
||||
ret.append_utf8((const char *)array.ptr(), array.size());
|
||||
String err_str;
|
||||
bool ok = load_string(ret, err_str);
|
||||
bool ok = load_string(String::utf8((const char *)array.ptr(), array.size()), err_str);
|
||||
ERR_FAIL_COND_V_MSG(!ok, false, "PList: " + err_str);
|
||||
|
||||
return true;
|
||||
|
||||
@@ -162,9 +162,7 @@ StringName ResourceLoaderBinary::_get_string() {
|
||||
return StringName();
|
||||
}
|
||||
f->get_buffer((uint8_t *)&str_buf[0], len);
|
||||
String s;
|
||||
s.append_utf8(&str_buf[0], len);
|
||||
return s;
|
||||
return String::utf8(&str_buf[0], len);
|
||||
}
|
||||
|
||||
return string_map[id];
|
||||
@@ -918,9 +916,7 @@ static String get_ustring(Ref<FileAccess> f) {
|
||||
Vector<char> str_buf;
|
||||
str_buf.resize(len);
|
||||
f->get_buffer((uint8_t *)&str_buf[0], len);
|
||||
String s;
|
||||
s.append_utf8(&str_buf[0], len);
|
||||
return s;
|
||||
return String::utf8(&str_buf[0], len);
|
||||
}
|
||||
|
||||
String ResourceLoaderBinary::get_unicode_string() {
|
||||
@@ -932,9 +928,7 @@ String ResourceLoaderBinary::get_unicode_string() {
|
||||
return String();
|
||||
}
|
||||
f->get_buffer((uint8_t *)&str_buf[0], len);
|
||||
String s;
|
||||
s.append_utf8(&str_buf[0], len);
|
||||
return s;
|
||||
return String::utf8(&str_buf[0], len);
|
||||
}
|
||||
|
||||
void ResourceLoaderBinary::get_classes_used(Ref<FileAccess> p_f, HashSet<StringName> *p_classes) {
|
||||
|
||||
@@ -383,9 +383,7 @@ String StreamPeer::get_utf8_string(int p_bytes) {
|
||||
err = get_data(buf.ptrw(), p_bytes);
|
||||
ERR_FAIL_COND_V(err != OK, String());
|
||||
|
||||
String ret;
|
||||
ret.append_utf8((const char *)buf.ptr(), buf.size());
|
||||
return ret;
|
||||
return String::utf8((const char *)buf.ptr(), buf.size());
|
||||
}
|
||||
|
||||
Variant StreamPeer::get_var(bool p_allow_objects) {
|
||||
|
||||
+1
-2
@@ -76,8 +76,7 @@ void *zipio_open(voidpf opaque, const char *p_fname, int mode) {
|
||||
Ref<FileAccess> *fa = reinterpret_cast<Ref<FileAccess> *>(opaque);
|
||||
ERR_FAIL_NULL_V(fa, nullptr);
|
||||
|
||||
String fname;
|
||||
fname.append_utf8(p_fname);
|
||||
String fname = String::utf8(p_fname);
|
||||
|
||||
int file_access_mode = 0;
|
||||
if (mode & ZLIB_FILEFUNC_MODE_READ) {
|
||||
|
||||
Reference in New Issue
Block a user