Fixed a off-by-one error.

This commit is contained in:
Olivier Teulière 2008-07-28 18:37:09 +00:00
parent 2b161abd2c
commit cad582d912
3 changed files with 3 additions and 3 deletions

View file

@ -515,7 +515,7 @@ static void initLetterLists(const Dictionary &iDic,
memset(&iList, 0, sizeof(iList));
// Prepare the space for 5 items
iList.symbl.assign(5, 0);
iList.letters.assign(5, vector<bool>(DIC_LETTERS, false));
iList.letters.assign(5, vector<bool>(DIC_LETTERS + 1, false));
iList.symbl[0] = RE_ALL_MATCH; // All letters
iList.symbl[1] = RE_VOWL_MATCH; // Vowels

View file

@ -149,7 +149,7 @@ void evaluate(const Header &iHeader, iter_t const& i, stack<Node*> &evalStack,
// j is the index of the new list we create
size_t j = iList.symbl.size();
iList.symbl.push_back(RE_ALL_MATCH + j);
iList.letters.push_back(vector<bool>(DIC_LETTERS, false));
iList.letters.push_back(vector<bool>(DIC_LETTERS + 1, false));
for (itLetter = letters.begin(); itLetter != letters.end(); ++itLetter)
{
bool contains = (choiceLetters.find(*itLetter) != string::npos);

View file

@ -138,7 +138,7 @@ struct searchRegExpLists
vector<char> symbl;
/**
* 0 or 1 if letter is present in the list.
* The inner vector should have a length of DIC_LETTERS (it is a bitmask)
* The inner vector should have a length of DIC_LETTERS+1 (it is a bitmask)
*/
vector<vector<bool> > letters;
};