- TargetMultiMap::const_iterator i = targetMultiMap_.constFind(key);
- if (i != targetMultiMap_.constEnd()) {
- if (debug)
- qDebug() << "DEBUG: A";
- TargetMultiMap::const_iterator j = i;
- do {
- const Target& candidate = j.value();
- if (candidate.priority_ < bestTarget.priority_) {
- if (debug)
- qDebug() << "DEBUG: B";
- bestTarget = candidate;
- bestTargetList.clear();
- bestTargetList.append(candidate);
- numBestTargets = 1;
- } else if (candidate.priority_ == bestTarget.priority_) {
- if (debug)
- qDebug() << "DEBUG: C";
- bestTargetList.append(candidate);
- ++numBestTargets;
- }
- ++j;
- } while (j != targetMultiMap_.constEnd() && j.key() == i.key());
-
- if (debug)
- qDebug() << "DEBUG: D";
+ TargetMultiMap::iterator i = targetMultiMap_.find(key);
+ while (i != targetMultiMap_.end()) {
+ if (i.key() != key)
+ break;
+ const Target& candidate = i.value();
+ if (candidate.priority_ < bestTarget.priority_) {
+ bestTarget = candidate;
+ bestTargetList.clear();
+ bestTargetList.append(candidate);
+ numBestTargets = 1;
+ } else if (candidate.priority_ == bestTarget.priority_) {
+ bestTargetList.append(candidate);
+ ++numBestTargets;
+ }
+ ++i;
+ }
+ if (numBestTargets > 0) {