Skip to content

Commit

Permalink
Fix bug in CDataParser::GetLine()
Browse files Browse the repository at this point in the history
We should terminate lines and an end of line marker or any character less than a tab.
  • Loading branch information
SammyB428 committed Jul 8, 2022
1 parent 21b9df5 commit 1709964
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions INCLUDE/CDataParser.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
** Author: Samuel R. Blackburn
** Internet: [email protected]
**
** Copyright, 1995-2019, Samuel R. Blackburn
** Copyright, 1995-2022, Samuel R. Blackburn
**
** "You can get credit for something or get it done, but not both."
** Dr. Richard Garwin
Expand Down Expand Up @@ -1650,7 +1650,7 @@ class CDataParser

uint32_t line_character{ 0 };

while (line_count < number_of_lines )
while (line_count < number_of_lines)
{
if (GetNextCharacter(parse_point, line_character) == false)
{
Expand All @@ -1667,7 +1667,7 @@ class CDataParser
line_count++;
}
}
else if (line_character == LINE_FEED)
else if (line_character == LINE_FEED or line_character < TAB_CHARACTER)
{
line_count++;
}
Expand Down Expand Up @@ -1704,6 +1704,10 @@ class CDataParser
{
return( true );
}
else if ( line_character < TAB_CHARACTER )
{
return(true);
}

line.push_back( static_cast<wchar_t>(line_character) );
}
Expand Down Expand Up @@ -1741,7 +1745,7 @@ class CDataParser

return(true);
}
else if (line_character == LINE_FEED or line_character == 0x00)
else if (line_character == LINE_FEED or line_character < TAB_CHARACTER)
{
return(true);
}
Expand Down Expand Up @@ -1783,10 +1787,14 @@ class CDataParser

return( true );
}
else if ( line_character == LINE_FEED or line_character == 0x00 )
else if ( line_character == LINE_FEED )
{
return( true );
}
else if ( line_character < TAB_CHARACTER )
{
return(true);
}

length++;
}
Expand Down

0 comments on commit 1709964

Please sign in to comment.