From d525a7ac28dd6403e46e8df6fa15b723b8c09503 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Thu, 24 Jan 2019 22:15:21 +0100 Subject: Add more tests, add apache license --- src/MessageComposer.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/MessageComposer.cpp') diff --git a/src/MessageComposer.cpp b/src/MessageComposer.cpp index 56ff925..3ff0d76 100644 --- a/src/MessageComposer.cpp +++ b/src/MessageComposer.cpp @@ -33,7 +33,6 @@ namespace dchat EnclosedType parseEnclosedData(char endSymbol) { - ++index; bool foundEndOfType = false; while(index < length) @@ -47,7 +46,7 @@ namespace dchat } } - if(!foundEndOfType || index == length) + if(!foundEndOfType) return EnclosedType::TEXT; return EnclosedType::DATA; @@ -62,6 +61,7 @@ namespace dchat if(c == '[') { usize start = index; + ++index; if(parseEnclosedData(']') == EnclosedType::TEXT) { identifierRange.start = start; @@ -69,8 +69,7 @@ namespace dchat return Token::TEXT; } - c = getChar(); - if(c != '(') + if(index == length || getChar() != '(') { identifierRange.start = start; identifierRange.end = index; @@ -81,6 +80,7 @@ namespace dchat typeRange.end = index - 1; typeDataRange.start = index + 1; + ++index; switch(parseEnclosedData(')')) { case EnclosedType::TEXT: -- cgit v1.2.3