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