BUG: Fix error messages and fix remove item to actually remove all instances of the item

This commit is contained in:
Andy Cedilnik 2006-08-22 09:52:53 -04:00
parent 377e4c132f
commit 6f7bb4d826

View File

@ -258,7 +258,7 @@ bool cmListCommand
{ {
if(args.size() < 3) if(args.size() < 3)
{ {
this->SetError("sub-command REMOVE requires at least two arguments."); this->SetError("sub-command REMOVE_ITEM requires at least two arguments.");
return false; return false;
} }
@ -267,6 +267,7 @@ bool cmListCommand
std::vector<std::string> varArgsExpanded; std::vector<std::string> varArgsExpanded;
if ( !this->GetList(varArgsExpanded, listName.c_str()) ) if ( !this->GetList(varArgsExpanded, listName.c_str()) )
{ {
this->SetError("sub-command REMOVE_ITEM requires list to be present.");
return false; return false;
} }
@ -280,9 +281,12 @@ bool cmListCommand
{ {
varArgsExpanded.erase(varArgsExpanded.begin()+kk); varArgsExpanded.erase(varArgsExpanded.begin()+kk);
} }
else
{
kk ++; kk ++;
} }
} }
}
std::string value; std::string value;
for ( cc = 0; cc < varArgsExpanded.size(); cc ++ ) for ( cc = 0; cc < varArgsExpanded.size(); cc ++ )
@ -304,7 +308,7 @@ bool cmListCommand::HandleRemoveAtCommand(
{ {
if(args.size() < 3) if(args.size() < 3)
{ {
this->SetError("sub-command REMOVE_ITEM requires at least " this->SetError("sub-command REMOVE_AT requires at least "
"two arguments."); "two arguments.");
return false; return false;
} }
@ -314,6 +318,7 @@ bool cmListCommand::HandleRemoveAtCommand(
std::vector<std::string> varArgsExpanded; std::vector<std::string> varArgsExpanded;
if ( !this->GetList(varArgsExpanded, listName.c_str()) ) if ( !this->GetList(varArgsExpanded, listName.c_str()) )
{ {
this->SetError("sub-command REMOVE_AT requires list to be present.");
return false; return false;
} }