From 90859a3f5ff28f18a2dc8eb68cca810cee94815f Mon Sep 17 00:00:00 2001 From: psychon Date: Tue, 31 Mar 2009 07:56:55 +0000 Subject: [PATCH] Small fix for ReadLine() for multi-byte line delimiters (Oh and empty() is better (tm) than size()) git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1460 726aef4b-f618-498e-8847-2d620e286838 --- FileUtils.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/FileUtils.cpp b/FileUtils.cpp index 77e1aeea..0db8961f 100644 --- a/FileUtils.cpp +++ b/FileUtils.cpp @@ -309,8 +309,8 @@ bool CFile::ReadLine(CString& sData, const CString & sDelimiter) { CString::size_type iFind = m_sBuffer.find(sDelimiter); if (iFind != CString::npos) { // We found a line, return it - sData = m_sBuffer.substr(0, (iFind + 1)); - m_sBuffer.erase(0, (iFind + 1)); + sData = m_sBuffer.substr(0, iFind + sDelimiter.length()); + m_sBuffer.erase(0, iFind + sDelimiter.length()); return true; } @@ -323,7 +323,7 @@ bool CFile::ReadLine(CString& sData, const CString & sDelimiter) { // We are at the end of the file or an error happened - if (m_sBuffer.size()) { + if (!m_sBuffer.empty()) { // ..but there is still some partial line in the buffer sData = m_sBuffer; m_sBuffer.clear();