bool SgmlFile::ReadLine(HANDLE hFile, CString &csLine, UINT nCodepage) { bool bSuccess = true; if (hFile == INVALID_HANDLE_VALUE || hFile == NULL) bSuccess = false; // The buffer is empty or all bytes are read if (bSuccess && (m_iBytesInBuffer == 0 || m_iBufferPointer == m_iBytesInBuffer)) { bool bSomethingRead = ReadNextBuffer(hFile, m_aBuffer, 4096, &m_iBytesInBuffer); m_iBufferPointer = 0; if (!bSomethingRead) bSuccess = false; } CArray<BYTE, BYTE> aLineBytes; aLineBytes.SetSize(0, 500); bool bBreakFound = false; while (bSuccess && !bBreakFound) { bSuccess = GetNextLineFromBuffer(m_aBuffer, aLineBytes, m_iBufferPointer, m_iBytesInBuffer, bBreakFound); // The end of the line is not in the current buffer // read next buffer if (!bBreakFound) { bool bSomethingRead = ReadNextBuffer(hFile, m_aBuffer, 4096, &m_iBytesInBuffer); m_iBufferPointer = 0; if (!bSomethingRead) bSuccess = false; } } if (!bBreakFound) bSuccess = false; if (bSuccess) bSuccess = ConvertBufferToString(aLineBytes, csLine, nCodepage); return bSuccess; }
TInt CPlayAudioFile::FillThisHwBuffer(CMMFBuffer& aHwDataBuffer) { iParent->SetVerdict(_L("FillThisHwBuffer")); ReadNextBuffer(aHwDataBuffer); return KErrNone; }