From 8fcfb3a587c2195ff95e959166aaac9c47d80144 Mon Sep 17 00:00:00 2001 From: John Hood Date: Sun, 20 Nov 2016 00:43:47 -0500 Subject: [PATCH] Fix Coverity "missing move operator" (copy to rvalue). Also makes this bit of code more readable, but the overall handling of Unicode characters in Actions and Transitions is messy, and may get reworked later. --- src/terminal/parserstate.cc | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/terminal/parserstate.cc b/src/terminal/parserstate.cc index d6ac72c..c107680 100644 --- a/src/terminal/parserstate.cc +++ b/src/terminal/parserstate.cc @@ -61,15 +61,16 @@ Transition State::anywhere_rule( wchar_t ch ) const Transition State::input( wchar_t ch ) const { - Transition ret = anywhere_rule( ch ); - if ( !ret.next_state ) { - if ( ch >= 0xA0 ) { - ret = this->input_state_rule( 0x41 ); - } else { - ret = this->input_state_rule( ch ); - } + /* Check for immediate transitions. */ + Transition anywhere = anywhere_rule( ch ); + if ( anywhere.next_state ) { + anywhere.action->char_present = true; + anywhere.action->ch = ch; + return anywhere; } - + /* Normal X.364 state machine. */ + /* Parse high Unicode codepoints like 'A'. */ + Transition ret = this->input_state_rule( ch >= 0xA0 ? 0x41 : ch ); ret.action->char_present = true; ret.action->ch = ch; return ret;