mirror of
https://github.com/godotengine/godot.git
synced 2025-10-19 16:03:29 +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:
parent
31ded7e126
commit
49403cbfa0
226 changed files with 1051 additions and 1034 deletions
|
@ -755,7 +755,7 @@ Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_a
|
|||
#ifdef DEBUG_ENABLED
|
||||
if (!valid) {
|
||||
String v = index->operator String();
|
||||
if (v != "") {
|
||||
if (!v.is_empty()) {
|
||||
v = "'" + v + "'";
|
||||
} else {
|
||||
v = "of type '" + _get_var_type(index) + "'";
|
||||
|
@ -785,7 +785,7 @@ Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_a
|
|||
#ifdef DEBUG_ENABLED
|
||||
if (!valid) {
|
||||
String v = index->operator String();
|
||||
if (v != "") {
|
||||
if (!v.is_empty()) {
|
||||
v = "'" + v + "'";
|
||||
} else {
|
||||
v = "of type '" + _get_var_type(index) + "'";
|
||||
|
@ -817,7 +817,7 @@ Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_a
|
|||
#ifdef DEBUG_ENABLED
|
||||
if (oob) {
|
||||
String v = index->operator String();
|
||||
if (v != "") {
|
||||
if (!v.is_empty()) {
|
||||
v = "'" + v + "'";
|
||||
} else {
|
||||
v = "of type '" + _get_var_type(index) + "'";
|
||||
|
@ -848,7 +848,7 @@ Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_a
|
|||
#ifdef DEBUG_ENABLED
|
||||
if (!valid) {
|
||||
String v = index->operator String();
|
||||
if (v != "") {
|
||||
if (!v.is_empty()) {
|
||||
v = "'" + v + "'";
|
||||
} else {
|
||||
v = "of type '" + _get_var_type(index) + "'";
|
||||
|
@ -884,7 +884,7 @@ Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_a
|
|||
#ifdef DEBUG_ENABLED
|
||||
if (!valid) {
|
||||
String v = key->operator String();
|
||||
if (v != "") {
|
||||
if (!v.is_empty()) {
|
||||
v = "'" + v + "'";
|
||||
} else {
|
||||
v = "of type '" + _get_var_type(key) + "'";
|
||||
|
@ -917,7 +917,7 @@ Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_a
|
|||
#ifdef DEBUG_ENABLED
|
||||
if (oob) {
|
||||
String v = index->operator String();
|
||||
if (v != "") {
|
||||
if (!v.is_empty()) {
|
||||
v = "'" + v + "'";
|
||||
} else {
|
||||
v = "of type '" + _get_var_type(index) + "'";
|
||||
|
@ -3295,20 +3295,20 @@ Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_a
|
|||
//error
|
||||
// function, file, line, error, explanation
|
||||
String err_file;
|
||||
if (p_instance && ObjectDB::get_instance(p_instance->owner_id) != nullptr && p_instance->script->is_valid() && p_instance->script->path != "") {
|
||||
if (p_instance && ObjectDB::get_instance(p_instance->owner_id) != nullptr && p_instance->script->is_valid() && !p_instance->script->path.is_empty()) {
|
||||
err_file = p_instance->script->path;
|
||||
} else if (script) {
|
||||
err_file = script->path;
|
||||
}
|
||||
if (err_file == "") {
|
||||
if (err_file.is_empty()) {
|
||||
err_file = "<built-in>";
|
||||
}
|
||||
String err_func = name;
|
||||
if (p_instance && ObjectDB::get_instance(p_instance->owner_id) != nullptr && p_instance->script->is_valid() && p_instance->script->name != "") {
|
||||
if (p_instance && ObjectDB::get_instance(p_instance->owner_id) != nullptr && p_instance->script->is_valid() && !p_instance->script->name.is_empty()) {
|
||||
err_func = p_instance->script->name + "." + err_func;
|
||||
}
|
||||
int err_line = line;
|
||||
if (err_text == "") {
|
||||
if (err_text.is_empty()) {
|
||||
err_text = "Internal script error! Opcode: " + itos(last_opcode) + " (please report).";
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue