Kaydet (Commit) 5ab0787f authored tarafından Caolán McNamara's avatar Caolán McNamara

cppcheck: prefer prefix variant

üst cea2ae07
...@@ -270,7 +270,7 @@ void SmCursor::InsertNodes(SmNodeList* pNewNodes){ ...@@ -270,7 +270,7 @@ void SmCursor::InsertNodes(SmNodeList* pNewNodes){
SmNodeList::iterator newIt, SmNodeList::iterator newIt,
patchIt = it, // (pointless default value, fixes compiler warnings) patchIt = it, // (pointless default value, fixes compiler warnings)
insIt; insIt;
for(newIt = pNewNodes->begin(); newIt != pNewNodes->end(); newIt++){ for(newIt = pNewNodes->begin(); newIt != pNewNodes->end(); ++newIt){
insIt = pLineList->insert(it, *newIt); insIt = pLineList->insert(it, *newIt);
if(newIt == pNewNodes->begin()) if(newIt == pNewNodes->begin())
patchIt = insIt; patchIt = insIt;
...@@ -293,7 +293,7 @@ void SmCursor::InsertNodes(SmNodeList* pNewNodes){ ...@@ -293,7 +293,7 @@ void SmCursor::InsertNodes(SmNodeList* pNewNodes){
SmNodeList::iterator SmCursor::FindPositionInLineList(SmNodeList* pLineList, SmCaretPos aCaretPos) { SmNodeList::iterator SmCursor::FindPositionInLineList(SmNodeList* pLineList, SmCaretPos aCaretPos) {
//Find iterator for position //Find iterator for position
SmNodeList::iterator it; SmNodeList::iterator it;
for(it = pLineList->begin(); it != pLineList->end(); it++){ for(it = pLineList->begin(); it != pLineList->end(); ++it){
if(*it == aCaretPos.pSelectedNode){ if(*it == aCaretPos.pSelectedNode){
if((*it)->GetType() == NTEXT){ if((*it)->GetType() == NTEXT){
//Split textnode if needed //Split textnode if needed
...@@ -328,9 +328,9 @@ SmCaretPos SmCursor::PatchLineList(SmNodeList* pLineList, SmNodeList::iterator a ...@@ -328,9 +328,9 @@ SmCaretPos SmCursor::PatchLineList(SmNodeList* pLineList, SmNodeList::iterator a
if(aIter != pLineList->end()) if(aIter != pLineList->end())
next = *aIter; next = *aIter;
if(aIter != pLineList->begin()) { if(aIter != pLineList->begin()) {
aIter--; --aIter;
prev = *aIter; prev = *aIter;
aIter++; ++aIter;
} }
//Check if there's textnodes to merge //Check if there's textnodes to merge
...@@ -354,12 +354,12 @@ SmCaretPos SmCursor::PatchLineList(SmNodeList* pLineList, SmNodeList::iterator a ...@@ -354,12 +354,12 @@ SmCaretPos SmCursor::PatchLineList(SmNodeList* pLineList, SmNodeList::iterator a
//Check if there's a SmPlaceNode to remove: //Check if there's a SmPlaceNode to remove:
if(prev && next && prev->GetType() == NPLACE && !SmNodeListParser::IsOperator(next->GetToken())){ if(prev && next && prev->GetType() == NPLACE && !SmNodeListParser::IsOperator(next->GetToken())){
aIter--; --aIter;
aIter = pLineList->erase(aIter); aIter = pLineList->erase(aIter);
delete prev; delete prev;
//Return caret pos infront of aIter //Return caret pos infront of aIter
if(aIter != pLineList->begin()) if(aIter != pLineList->begin())
aIter--; //Thus find node before aIter --aIter; //Thus find node before aIter
if(aIter == pLineList->begin()) if(aIter == pLineList->begin())
return SmCaretPos(); return SmCaretPos();
if((*aIter)->GetType() == NTEXT) if((*aIter)->GetType() == NTEXT)
...@@ -405,7 +405,7 @@ SmNodeList::iterator SmCursor::TakeSelectedNodesFromList(SmNodeList *pLineList, ...@@ -405,7 +405,7 @@ SmNodeList::iterator SmCursor::TakeSelectedNodesFromList(SmNodeList *pLineList,
int start1 = 0, int start1 = 0,
String str = aText.Copy(start1, len1); String str = aText.Copy(start1, len1);
pText->ChangeText(str); pText->ChangeText(str);
it++; ++it;
} else {//Remove it if not needed } else {//Remove it if not needed
it = pLineList->erase(it); it = pLineList->erase(it);
delete pText; delete pText;
...@@ -435,7 +435,7 @@ SmNodeList::iterator SmCursor::TakeSelectedNodesFromList(SmNodeList *pLineList, ...@@ -435,7 +435,7 @@ SmNodeList::iterator SmCursor::TakeSelectedNodesFromList(SmNodeList *pLineList,
delete pNode; delete pNode;
} }
} else } else
it++; ++it;
} }
return retval; return retval;
} }
...@@ -484,15 +484,15 @@ void SmCursor::InsertSubSup(SmSubSup eSubSup) { ...@@ -484,15 +484,15 @@ void SmCursor::InsertSubSup(SmSubSup eSubSup) {
SmNode* pSubject; SmNode* pSubject;
bool bPatchLine = pSelectedNodesList->size() > 0; //If the line should be patched later bool bPatchLine = pSelectedNodesList->size() > 0; //If the line should be patched later
if(it != pLineList->begin()) { if(it != pLineList->begin()) {
it--; --it;
pSubject = *it; pSubject = *it;
it++; ++it;
} else { } else {
//Create a new place node //Create a new place node
pSubject = new SmPlaceNode(); pSubject = new SmPlaceNode();
pSubject->Prepare(pDocShell->GetFormat(), *pDocShell); pSubject->Prepare(pDocShell->GetFormat(), *pDocShell);
it = pLineList->insert(it, pSubject); it = pLineList->insert(it, pSubject);
it++; ++it;
bPatchLine = true; //We've modified the line it should be patched later. bPatchLine = true; //We've modified the line it should be patched later.
} }
...@@ -504,7 +504,7 @@ void SmCursor::InsertSubSup(SmSubSup eSubSup) { ...@@ -504,7 +504,7 @@ void SmCursor::InsertSubSup(SmSubSup eSubSup) {
pSubSup = new SmSubSupNode(token); pSubSup = new SmSubSupNode(token);
pSubSup->SetBody(pSubject); pSubSup->SetBody(pSubject);
*(--it) = pSubSup; *(--it) = pSubSup;
it++; ++it;
}else }else
pSubSup = (SmSubSupNode*)pSubject; pSubSup = (SmSubSupNode*)pSubject;
//pSubject shouldn't be referenced anymore, pSubSup is the SmSubSupNode in pLineList we wish to edit. //pSubject shouldn't be referenced anymore, pSubSup is the SmSubSupNode in pLineList we wish to edit.
...@@ -842,7 +842,7 @@ bool SmCursor::InsertRow() { ...@@ -842,7 +842,7 @@ bool SmCursor::InsertRow() {
//Make sure it is valid again //Make sure it is valid again
it = pLineList->end(); it = pLineList->end();
if(it != pLineList->begin()) if(it != pLineList->begin())
it--; --it;
if(pNewLineList->size() == 0) if(pNewLineList->size() == 0)
pNewLineList->push_front(new SmPlaceNode()); pNewLineList->push_front(new SmPlaceNode());
//Parse new line //Parse new line
...@@ -1210,7 +1210,7 @@ SmNodeList* SmCursor::CloneList(SmNodeList* pList){ ...@@ -1210,7 +1210,7 @@ SmNodeList* SmCursor::CloneList(SmNodeList* pList){
SmNodeList* pClones = new SmNodeList(); SmNodeList* pClones = new SmNodeList();
SmNodeList::iterator it; SmNodeList::iterator it;
for(it = pList->begin(); it != pList->end(); it++){ for(it = pList->begin(); it != pList->end(); ++it){
SmNode *pClone = aCloneFactory.Clone(*it); SmNode *pClone = aCloneFactory.Clone(*it);
pClones->push_back(pClone); pClones->push_back(pClone);
} }
...@@ -1223,7 +1223,7 @@ void SmCursor::SetClipboard(SmNodeList* pList){ ...@@ -1223,7 +1223,7 @@ void SmCursor::SetClipboard(SmNodeList* pList){
if(pClipboard){ if(pClipboard){
//Delete all nodes on the clipboard //Delete all nodes on the clipboard
SmNodeList::iterator it; SmNodeList::iterator it;
for(it = pClipboard->begin(); it != pClipboard->end(); it++) for(it = pClipboard->begin(); it != pClipboard->end(); ++it)
delete (*it); delete (*it);
delete pClipboard; delete pClipboard;
} }
...@@ -1472,7 +1472,7 @@ SmNode* SmNodeListParser::Parse(SmNodeList* list, bool bDeleteErrorNodes){ ...@@ -1472,7 +1472,7 @@ SmNode* SmNodeListParser::Parse(SmNodeList* list, bool bDeleteErrorNodes){
delete *it; delete *it;
it = pList->erase(it); it = pList->erase(it);
}else }else
it++; ++it;
} }
} }
SmNode* retval = Expression(); SmNode* retval = Expression();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment