1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-07 12:30:27 +00:00

Replace String comparisons with "", String() to is_empty()

Also:
- Adds two stress tests to test_string.h
- Changes to .empty() on std::strings
This commit is contained in:
Nathan Franke
2021-12-09 03:42:46 -06:00
parent 31ded7e126
commit 49403cbfa0
226 changed files with 1051 additions and 1034 deletions

View File

@@ -198,7 +198,7 @@ String OS_Android::get_resource_dir() const {
String OS_Android::get_locale() const {
String locale = godot_io_java->get_locale();
if (locale != "") {
if (!locale.is_empty()) {
return locale;
}
@@ -207,7 +207,7 @@ String OS_Android::get_locale() const {
String OS_Android::get_model_name() const {
String model = godot_io_java->get_model();
if (model != "")
if (!model.is_empty())
return model;
return OS_Unix::get_model_name();
@@ -218,11 +218,11 @@ String OS_Android::get_data_path() const {
}
String OS_Android::get_user_data_dir() const {
if (data_dir_cache != String())
if (!data_dir_cache.is_empty())
return data_dir_cache;
String data_dir = godot_io_java->get_user_data_dir();
if (data_dir != "") {
if (!data_dir.is_empty()) {
data_dir_cache = _remove_symlink(data_dir);
return data_dir_cache;
}
@@ -230,11 +230,11 @@ String OS_Android::get_user_data_dir() const {
}
String OS_Android::get_cache_path() const {
if (cache_dir_cache != String())
if (!cache_dir_cache.is_empty())
return cache_dir_cache;
String cache_dir = godot_io_java->get_cache_dir();
if (cache_dir != "") {
if (!cache_dir.is_empty()) {
cache_dir_cache = _remove_symlink(cache_dir);
return cache_dir_cache;
}
@@ -243,7 +243,7 @@ String OS_Android::get_cache_path() const {
String OS_Android::get_unique_id() const {
String unique_id = godot_io_java->get_unique_id();
if (unique_id != "")
if (!unique_id.is_empty())
return unique_id;
return OS::get_unique_id();