From c6c4eef4e49bb4de90845408af9f642a1a4e224b Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Fri, 17 Aug 2012 16:34:36 +0300 Subject: Improve size calculations. --- src/chatlogger.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/chatlogger.cpp') diff --git a/src/chatlogger.cpp b/src/chatlogger.cpp index 4c4f2ce83..95cf15363 100644 --- a/src/chatlogger.cpp +++ b/src/chatlogger.cpp @@ -200,11 +200,16 @@ void ChatLogger::loadLast(std::string name, std::list &list, return; char line[710]; + unsigned sz = list.size(); while (logFile.getline(line, 700)) { list.push_back(line); - if (list.size() > n) + sz ++; + if (sz > n) + { list.pop_front(); + sz --; + } } if (logFile.is_open()) -- cgit v1.2.3-70-g09d2