diff options
author | dec05eba <dec05eba@protonmail.com> | 2019-01-24 22:15:21 +0100 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2020-08-19 00:14:40 +0200 |
commit | d525a7ac28dd6403e46e8df6fa15b723b8c09503 (patch) | |
tree | 51254e6e94bb099484c2d2c01fa4f397c4e70287 /src/MessageComposer.cpp | |
parent | b629e93b124fcad6635a508e47c7776bb0891d1b (diff) |
Add more tests, add apache license
Diffstat (limited to 'src/MessageComposer.cpp')
-rw-r--r-- | src/MessageComposer.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
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: |