Przeglądaj źródła

size() <= 0 and size() < 1.

Yufeng Ying 4 miesięcy temu
rodzic
commit
7a1a970c25

+ 2 - 2
core/debugger/remote_debugger.cpp

@@ -533,7 +533,7 @@ void RemoteDebugger::debug(bool p_can_continue, bool p_is_error_breakpoint) {
 				ERR_FAIL_COND(data.is_empty());
 				script_debugger->set_skip_breakpoints(data[0]);
 			} else if (command == "set_ignore_error_breaks") {
-				ERR_FAIL_COND(data.size() < 1);
+				ERR_FAIL_COND(data.is_empty());
 				script_debugger->set_ignore_error_breaks(data[0]);
 			} else if (command == "evaluate") {
 				String expression_str = data[0];
@@ -675,7 +675,7 @@ Error RemoteDebugger::_core_capture(const String &p_cmd, const Array &p_data, bo
 		ERR_FAIL_COND_V(p_data.is_empty(), ERR_INVALID_DATA);
 		script_debugger->set_skip_breakpoints(p_data[0]);
 	} else if (p_cmd == "set_ignore_error_breaks") {
-		ERR_FAIL_COND_V(p_data.size() < 1, ERR_INVALID_DATA);
+		ERR_FAIL_COND_V(p_data.is_empty(), ERR_INVALID_DATA);
 		script_debugger->set_ignore_error_breaks(p_data[0]);
 	} else if (p_cmd == "break") {
 		script_debugger->debug(script_debugger->get_break_language());

+ 1 - 1
core/os/keyboard.cpp

@@ -410,7 +410,7 @@ String keycode_get_string(Key p_code) {
 Key find_keycode(const String &p_codestr) {
 	Key keycode = Key::NONE;
 	Vector<String> code_parts = p_codestr.split("+");
-	if (code_parts.size() < 1) {
+	if (code_parts.is_empty()) {
 		return keycode;
 	}
 

+ 2 - 2
editor/code_editor.cpp

@@ -1730,7 +1730,7 @@ void CodeTextEditor::toggle_bookmark() {
 
 void CodeTextEditor::goto_next_bookmark() {
 	PackedInt32Array bmarks = text_editor->get_bookmarked_lines();
-	if (bmarks.size() <= 0) {
+	if (bmarks.is_empty()) {
 		return;
 	}
 
@@ -1746,7 +1746,7 @@ void CodeTextEditor::goto_next_bookmark() {
 
 void CodeTextEditor::goto_prev_bookmark() {
 	PackedInt32Array bmarks = text_editor->get_bookmarked_lines();
-	if (bmarks.size() <= 0) {
+	if (bmarks.is_empty()) {
 		return;
 	}
 

+ 1 - 1
editor/plugins/canvas_item_editor_plugin.cpp

@@ -6063,7 +6063,7 @@ bool CanvasItemEditorViewport::_create_instance(Node *p_parent, const String &p_
 }
 
 void CanvasItemEditorViewport::_perform_drop_data() {
-	ERR_FAIL_COND(selected_files.size() <= 0);
+	ERR_FAIL_COND(selected_files.is_empty());
 
 	_remove_preview();
 

+ 2 - 2
editor/plugins/script_text_editor.cpp

@@ -1696,7 +1696,7 @@ void ScriptTextEditor::_edit_option(int p_op) {
 		} break;
 		case DEBUG_GOTO_NEXT_BREAKPOINT: {
 			PackedInt32Array bpoints = tx->get_breakpointed_lines();
-			if (bpoints.size() <= 0) {
+			if (bpoints.is_empty()) {
 				return;
 			}
 
@@ -1711,7 +1711,7 @@ void ScriptTextEditor::_edit_option(int p_op) {
 		} break;
 		case DEBUG_GOTO_PREV_BREAKPOINT: {
 			PackedInt32Array bpoints = tx->get_breakpointed_lines();
-			if (bpoints.size() <= 0) {
+			if (bpoints.is_empty()) {
 				return;
 			}
 

+ 1 - 1
editor/plugins/tiles/tile_set_scenes_collection_source_editor.cpp

@@ -302,7 +302,7 @@ void TileSetScenesCollectionSourceEditor::_update_tile_inspector() {
 
 void TileSetScenesCollectionSourceEditor::_update_action_buttons() {
 	Vector<int> selected_indices = scene_tiles_list->get_selected_items();
-	scene_tile_delete_button->set_disabled(selected_indices.size() <= 0 || read_only);
+	scene_tile_delete_button->set_disabled(selected_indices.is_empty() || read_only);
 }
 
 void TileSetScenesCollectionSourceEditor::_update_scenes_list() {

+ 1 - 1
modules/gdscript/gdscript_analyzer.cpp

@@ -2157,7 +2157,7 @@ void GDScriptAnalyzer::resolve_for(GDScriptParser::ForNode *p_for) {
 			GDScriptParser::IdentifierNode *callee = static_cast<GDScriptParser::IdentifierNode *>(call->callee);
 			if (callee->name == "range") {
 				list_resolved = true;
-				if (call->arguments.size() < 1) {
+				if (call->arguments.is_empty()) {
 					push_error(R"*(Invalid call for "range()" function. Expected at least 1 argument, none given.)*", call->callee);
 				} else if (call->arguments.size() > 3) {
 					push_error(vformat(R"*(Invalid call for "range()" function. Expected at most 3 arguments, %d given.)*", call->arguments.size()), call->callee);

+ 2 - 2
modules/mono/editor/bindings_generator.cpp

@@ -249,7 +249,7 @@ String BindingsGenerator::bbcode_to_text(const String &p_bbcode, const TypeInter
 
 			const Vector<String> link_target_parts = link_target.split(".");
 
-			if (link_target_parts.size() <= 0 || link_target_parts.size() > 2) {
+			if (link_target_parts.is_empty() || link_target_parts.size() > 2) {
 				ERR_PRINT("Invalid reference format: '" + tag + "'.");
 
 				output.append(tag);
@@ -561,7 +561,7 @@ String BindingsGenerator::bbcode_to_xml(const String &p_bbcode, const TypeInterf
 
 			const Vector<String> link_target_parts = link_target.split(".");
 
-			if (link_target_parts.size() <= 0 || link_target_parts.size() > 2) {
+			if (link_target_parts.is_empty() || link_target_parts.size() > 2) {
 				ERR_PRINT("Invalid reference format: '" + tag + "'.");
 
 				xml_output.append("<c>");

+ 1 - 1
scene/gui/item_list.cpp

@@ -429,7 +429,7 @@ void ItemList::deselect(int p_idx) {
 }
 
 void ItemList::deselect_all() {
-	if (items.size() < 1) {
+	if (items.is_empty()) {
 		return;
 	}
 

+ 1 - 1
scene/gui/rich_text_label.cpp

@@ -5532,7 +5532,7 @@ void RichTextLabel::append_text(const String &p_bbcode) {
 
 		} else {
 			Vector<String> &expr = split_tag_block;
-			if (expr.size() < 1) {
+			if (expr.is_empty()) {
 				add_text("[");
 				pos = brk_pos + 1;
 			} else {

+ 1 - 1
scene/resources/2d/skeleton/skeleton_modification_2d_physicalbones.cpp

@@ -238,7 +238,7 @@ void SkeletonModification2DPhysicalBones::_update_simulation_state() {
 	}
 	_simulation_state_dirty = false;
 
-	if (_simulation_state_dirty_names.size() <= 0) {
+	if (_simulation_state_dirty_names.is_empty()) {
 		for (int i = 0; i < physical_bone_chain.size(); i++) {
 			PhysicalBone2D *physical_bone = Object::cast_to<PhysicalBone2D>(stack->skeleton->get_node(physical_bone_chain[i].physical_bone_node));
 			if (!physical_bone) {

+ 1 - 1
scene/resources/3d/primitive_meshes.cpp

@@ -2972,7 +2972,7 @@ void TextMesh::_generate_glyph_mesh_data(const GlyphMeshKey &p_key, const Glyph
 	PackedInt32Array contours = d["contours"];
 	bool orientation = d["orientation"];
 
-	if (points.size() < 3 || contours.size() < 1) {
+	if (points.size() < 3 || contours.is_empty()) {
 		return; // No full contours, only glyph control points (or nothing), ignore.
 	}