mirror of
https://github.com/AppleWin/AppleWin.git
synced 2025-02-28 19:30:11 +00:00
Fixed hang in GetLinePointers()
This commit is contained in:
parent
afde5ee20b
commit
64c5bcef04
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
// MemoryTextFile _________________________________________________________________________________
|
// MemoryTextFile _________________________________________________________________________________
|
||||||
|
|
||||||
const int EOL_TERM = 0;
|
const int EOL_NULL = 0;
|
||||||
|
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
bool MemoryTextFile_t::Read( char *pFileName )
|
bool MemoryTextFile_t::Read( char *pFileName )
|
||||||
@ -23,7 +23,7 @@ bool MemoryTextFile_t::Read( char *pFileName )
|
|||||||
char *pBuffer = & m_vBuffer.at(0);
|
char *pBuffer = & m_vBuffer.at(0);
|
||||||
fread( (void*)pBuffer, nSize, 1, hFile );
|
fread( (void*)pBuffer, nSize, 1, hFile );
|
||||||
|
|
||||||
m_vBuffer.push_back( EOL_TERM );
|
m_vBuffer.push_back( EOL_NULL );
|
||||||
|
|
||||||
fclose(hFile);
|
fclose(hFile);
|
||||||
|
|
||||||
@ -70,7 +70,7 @@ void MemoryTextFile_t::GetLinePointers()
|
|||||||
|
|
||||||
pEnd = const_cast<char*>( SkipUntilEOL( pBegin ));
|
pEnd = const_cast<char*>( SkipUntilEOL( pBegin ));
|
||||||
|
|
||||||
if (*pEnd != EOL_TERM)
|
if (*pEnd == EOL_NULL)
|
||||||
{
|
{
|
||||||
// Found EOL via null
|
// Found EOL via null
|
||||||
pStartNextLine = pEnd + 1;
|
pStartNextLine = pEnd + 1;
|
||||||
@ -88,7 +88,7 @@ void MemoryTextFile_t::GetLinePointers()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// assert( pEnd != NULL );
|
// assert( pEnd != NULL );
|
||||||
*pEnd = EOL_TERM;
|
*pEnd = EOL_NULL;
|
||||||
}
|
}
|
||||||
pBegin = pStartNextLine;
|
pBegin = pStartNextLine;
|
||||||
}
|
}
|
||||||
@ -104,16 +104,16 @@ void MemoryTextFile_t::PushLine( char *pLine )
|
|||||||
while (pSrc && *pSrc)
|
while (pSrc && *pSrc)
|
||||||
{
|
{
|
||||||
if (*pSrc == CHAR_CR)
|
if (*pSrc == CHAR_CR)
|
||||||
m_vBuffer.push_back( EOL_TERM );
|
m_vBuffer.push_back( EOL_NULL );
|
||||||
else
|
else
|
||||||
if (*pSrc == CHAR_LF)
|
if (*pSrc == CHAR_LF)
|
||||||
m_vBuffer.push_back( EOL_TERM );
|
m_vBuffer.push_back( EOL_NULL );
|
||||||
else
|
else
|
||||||
m_vBuffer.push_back( *pSrc );
|
m_vBuffer.push_back( *pSrc );
|
||||||
|
|
||||||
pSrc++;
|
pSrc++;
|
||||||
}
|
}
|
||||||
m_vBuffer.push_back( EOL_TERM );
|
m_vBuffer.push_back( EOL_NULL );
|
||||||
|
|
||||||
m_bDirty = true;
|
m_bDirty = true;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user