added delimiter support and fixed an eof bug

git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@781 726aef4b-f618-498e-8847-2d620e286838
This commit is contained in:
imaginos
2006-09-23 14:05:18 +00:00
parent 58e261a90d
commit c2b8b7c685
2 changed files with 10 additions and 4 deletions

View File

@@ -239,7 +239,7 @@ int CFile::Read(char *pszBuffer, int iBytes) {
return read(m_iFD, pszBuffer, iBytes);
}
bool CFile::ReadLine(CString& sData) {
bool CFile::ReadLine(CString& sData, const CString & sDelimiter) {
char buff[64];
sData.clear();
@@ -250,7 +250,7 @@ bool CFile::ReadLine(CString& sData) {
bool bEOF = false;
while(true) {
CString::size_type iFind = m_sBuffer.find("\n");
CString::size_type iFind = m_sBuffer.find(sDelimiter);
if (iFind != CString::npos) {
sData = m_sBuffer.substr(0, (iFind + 1));
m_sBuffer.erase(0, (iFind + 1));
@@ -280,11 +280,17 @@ bool CFile::ReadLine(CString& sData) {
}
}
CString::size_type iFind = m_sBuffer.find("\n");
CString::size_type iFind = m_sBuffer.find(sDelimiter);
if (iFind != CString::npos) {
return true;
}
if( bEOF ) {
sData = m_sBuffer;
m_sBuffer.clear();
break;
}
return !bEOF;
}