mirror of
https://github.com/znc/znc.git
synced 2026-03-28 17:42:41 +01:00
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
This commit is contained in:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user