diff --git a/alib2cli/src/lexer/CharSequenceBase.h b/alib2cli/src/lexer/CharSequenceBase.h index 6ea9ed496d42f6cc4d6a3dc8c9f785c6868482eb..8ec74b42bf931dc1ab83f57119d50e8ecc4b50f4 100644 --- a/alib2cli/src/lexer/CharSequenceBase.h +++ b/alib2cli/src/lexer/CharSequenceBase.h @@ -6,13 +6,14 @@ namespace cli { class CharSequenceBase { + std::string putbackBuffer; + protected: const char * linePtr; bool endOfTransmition = false; bool endOfSequence = false; virtual void fetch ( bool readNextLine ) = 0; - std::string putbackBuffer; public: CharSequenceBase ( ) = default; @@ -40,7 +41,7 @@ public: if ( ! putbackBuffer.empty ( ) ) { putbackBuffer.pop_back ( ); } else { - if ( * linePtr ) + if ( * linePtr != 0 ) ++ linePtr; if ( * linePtr == '\0' ) fetch ( readNextLine ); diff --git a/aql2/src/prompt/ReadlineCharSequence.h b/aql2/src/prompt/ReadlineCharSequence.h index d234211824566173343f572666cfaaf2d7512792..a7fd8c914a2cd52c9123d4c3d6a4fe853b91a532 100644 --- a/aql2/src/prompt/ReadlineCharSequence.h +++ b/aql2/src/prompt/ReadlineCharSequence.h @@ -23,13 +23,13 @@ class ReadlineCharSequence final : public cli::CharSequenceBase { bool forceReadLine = false; void fetch ( bool readNextLine ) override { - if ( readNextLine == false && forceReadLine == false ) { + if ( ! readNextLine && ! forceReadLine ) { this->endOfSequence = true; return; } char * read = ::readline ( first ? "> ": "+ " ); - if ( ! read ) { + if ( read == nullptr ) { this->endOfTransmition = true; return; } diff --git a/aql2/src/prompt/ReadlinePromptHistory.h b/aql2/src/prompt/ReadlinePromptHistory.h index 4e37c808076f04bcd346e2f325c07599edfabc57..fd7533488d8f5a5780a5a3b8e148e38bcd636bd1 100644 --- a/aql2/src/prompt/ReadlinePromptHistory.h +++ b/aql2/src/prompt/ReadlinePromptHistory.h @@ -66,7 +66,7 @@ class ReadlinePromptHistory { static void history_transform ( Callable callable ) { HIST_ENTRY ** history = history_list ( ); if ( history ) { - unsigned i = 0; + int i = 0; while ( * history ) { char * tmp = callable ( ( * history )->line ); replace_history_entry ( i, tmp, ( * history )->data );