diff options
author | ridiculousfish <corydoras@ridiculousfish.com> | 2013-12-08 18:16:55 -0800 |
---|---|---|
committer | ridiculousfish <corydoras@ridiculousfish.com> | 2013-12-08 18:16:55 -0800 |
commit | 5769fa6aed981e02d9e0f9f7c83f77e677f8c84f (patch) | |
tree | 0dfaa7f3195314d01fbc5518f7dab52cfa32a878 /tokenizer.cpp | |
parent | 925fe65dd8d51f481217ef1c11647a39ddf56351 (diff) |
Fix for off-by-one error in tokenizer error message reporting
Diffstat (limited to 'tokenizer.cpp')
-rw-r--r-- | tokenizer.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/tokenizer.cpp b/tokenizer.cpp index 7d911d30..113f8926 100644 --- a/tokenizer.cpp +++ b/tokenizer.cpp @@ -64,7 +64,6 @@ static const wchar_t *tok_desc[] = { N_(L"Tokenizer not yet initialized"), N_(L"Tokenizer error"), - N_(L"Invalid token"), N_(L"String"), N_(L"Pipe"), N_(L"End of command"), @@ -77,6 +76,8 @@ static const wchar_t *tok_desc[] = N_(L"Comment") }; + + /** Set the latest tokens string to be the specified error message */ @@ -559,7 +560,7 @@ static bool my_iswspace(wchar_t c) const wchar_t *tok_get_desc(int type) { - if (type < 0 || (size_t)type >= sizeof(tok_desc)) + if (type < 0 || (size_t)type >= (sizeof tok_desc / sizeof *tok_desc)) { return _(L"Invalid token type"); } |