sources/network/rconsession.cpp

changeset 137
485cb6d6b98c
parent 115
bb7ef7c33dad
child 138
c909c38ca886
--- a/sources/network/rconsession.cpp	Fri May 15 22:46:53 2015 +0300
+++ b/sources/network/rconsession.cpp	Wed Jul 20 14:48:47 2016 +0300
@@ -200,9 +200,10 @@
 			case SVRC_TABCOMPLETE:
 				{
 					StringList completes;
+					completes.resize(packet.read_byte());
 
-					for (signed int i = packet.read_byte(); i > 0; --i)
-						completes << packet.read_string();
+					for (String& completion : completes)
+						completion = packet.read_string();
 
 					if (completes.size() == 1)
 					{
@@ -212,9 +213,9 @@
 					{
 						m_interface->print ("Completions for '%s':\n", m_lastTabComplete.chars());
 
-						for (int i = 0; i < completes.size(); i += 8)
+						for (int i : range(0, completes.size(), 8))
 						{
-							Range<int> spliceRange (i, min (i + 8, completes.size() - 1));
+							Range<int> spliceRange (i, min (i + 8, completes.size()));
 							StringList splice (completes.splice (spliceRange));
 							m_interface->print ("- %s\n", splice.join (", ").chars());
 						}

mercurial