Fix for UTF-8 roundtrip verification bug.

The problem was that the round-trip verification code copies the
current state, which may contain intermediate Parser state for
multibyte characters and ANSI escape sequences.  It then applies diffs
to that copy, which may appear as badly formed input.

Also removes some dead, never-used code.
This commit is contained in:
John Hood
2015-10-19 02:03:35 -04:00
parent e4a99256cb
commit 0b51260540
5 changed files with 18 additions and 14 deletions
+6 -7
View File
@@ -60,12 +60,11 @@ namespace Parser {
void input( wchar_t ch, Actions &actions );
bool operator==( const Parser &x ) const
void reset_input( void )
{
return state == x.state;
state = &family.s_Ground;
}
bool is_grounded( void ) const { return state == &family.s_Ground; }
};
static const size_t BUF_SIZE = 8;
@@ -82,12 +81,12 @@ namespace Parser {
void input( char c, Actions &actions );
bool operator==( const UTF8Parser &x ) const
void reset_input( void )
{
return parser == x.parser;
parser.reset_input();
buf[0] = '\0';
buf_len = 0;
}
bool is_grounded( void ) const { return parser.is_grounded(); }
};
}
+3 -2
View File
@@ -662,8 +662,9 @@ bool Cell::compare( const Cell &other ) const
if ( !contents_match( other ) ) {
ret = true;
fprintf( stderr, "Contents: %lc vs. %lc\n",
debug_contents(), other.debug_contents() );
fprintf( stderr, "Contents: %lc (%ld) vs. %lc (%ld)\n",
debug_contents(), contents.size(),
other.debug_contents(), other.contents.size() );
}
if ( fallback != other.fallback ) {