[BUG_FIXED] (Author: Dave Brotherstone) Fix UTF-8 EOF detection for PCRE.

git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository/trunk@900 f5eea248-9336-0410-98b8-ebc06183d4e3
This commit is contained in:
Don Ho 2012-04-23 23:43:48 +00:00
parent 1282853ede
commit 71e2f0c9e3
2 changed files with 8 additions and 3 deletions

View File

@ -173,7 +173,7 @@ IF [%BOOSTLIBPATH%] == [] (
GOTO USAGE GOTO USAGE
) )
ECHO # Autogenerated file, run BuildBoost.bat [path_to_boost] to generate > %~dp0%\boostpath.mak ECHO # Autogenerated file, run BuildBoost.bat [path_to_boost] to generate > %WORKPATH%\boostpath.mak
ECHO BOOSTPATH=%BOOSTPATH% >> %WORKPATH%\boostpath.mak ECHO BOOSTPATH=%BOOSTPATH% >> %WORKPATH%\boostpath.mak
ECHO BOOSTLIBPATH=%BOOSTLIBPATH% >> %WORKPATH%\boostpath.mak ECHO BOOSTLIBPATH=%BOOSTLIBPATH% >> %WORKPATH%\boostpath.mak
POPD POPD

View File

@ -94,6 +94,11 @@ public:
else else
{ {
m_pos += m_utf8Length; m_pos += m_utf8Length;
if (m_pos > m_end)
{
m_pos = m_end;
}
m_characterIndex = 0; m_characterIndex = 0;
readCharacter(); readCharacter();
} }
@ -110,7 +115,7 @@ public:
{ {
--m_pos; --m_pos;
// Skip past the UTF-8 extension bytes // Skip past the UTF-8 extension bytes
while (0x80 == (m_doc->CharAt(m_pos) & 0xC0)) while (0x80 == (m_doc->CharAt(m_pos) & 0xC0) && m_pos > 0)
--m_pos; --m_pos;
readCharacter(); readCharacter();
@ -133,7 +138,7 @@ private:
bool ended() const bool ended() const
{ {
return m_pos == m_end; return m_pos >= m_end;
} }
int m_pos; int m_pos;