diff --git a/lib/token.cpp b/lib/token.cpp index 20efdae3d..c21d8ee8c 100644 --- a/lib/token.cpp +++ b/lib/token.cpp @@ -220,9 +220,9 @@ std::string Token::strValue() const return ret; } -void Token::deleteNext(unsigned long index) +void Token::deleteNext(int count) { - while (mNext && index) { + while (mNext && count > 0) { Token *n = mNext; // #8154 we are about to be unknown -> destroy the link to us @@ -231,7 +231,7 @@ void Token::deleteNext(unsigned long index) mNext = n->next(); delete n; - --index; + --count; } if (mNext) @@ -240,9 +240,9 @@ void Token::deleteNext(unsigned long index) mTokensFrontBack->back = this; } -void Token::deletePrevious(unsigned long index) +void Token::deletePrevious(int count) { - while (mPrevious && index) { + while (mPrevious && count > 0) { Token *p = mPrevious; // #8154 we are about to be unknown -> destroy the link to us @@ -251,7 +251,7 @@ void Token::deletePrevious(unsigned long index) mPrevious = p->previous(); delete p; - --index; + --count; } if (mPrevious) diff --git a/lib/token.h b/lib/token.h index 2dd3315d5..c934c001b 100644 --- a/lib/token.h +++ b/lib/token.h @@ -185,14 +185,14 @@ public: } /** - * Unlink and delete the next 'index' tokens. + * Unlink and delete the next 'count' tokens. */ - void deleteNext(unsigned long index = 1); + void deleteNext(int count = 1); /** - * Unlink and delete the previous 'index' tokens. + * Unlink and delete the previous 'count' tokens. */ - void deletePrevious(unsigned long index = 1); + void deletePrevious(int count = 1); /** * Swap the contents of this token with the next token.