Change while loops

This commit is contained in:
luiscuenca 2019-05-01 12:42:41 -07:00
parent 73454b06a2
commit 6e2ac14c23
No known key found for this signature in database
GPG key ID: 2387ECD129A6961D

View file

@ -1439,22 +1439,18 @@ QStringList Avatar::getJointNames() const {
withValidJointIndicesCache([&]() {
// find out how large the vector needs to be
int maxJointIndex = -1;
QHash<QString, int>::const_iterator k = _modelJointIndicesCache.constBegin();
while (k != _modelJointIndicesCache.constEnd()) {
for (auto k = _modelJointIndicesCache.constBegin(); k != _modelJointIndicesCache.constEnd(); k++) {
int index = k.value();
if (index > maxJointIndex) {
maxJointIndex = index;
}
++k;
}
// iterate through the hash and put joint names
// into the vector at their indices
QVector<QString> resultVector(maxJointIndex+1);
QHash<QString, int>::const_iterator i = _modelJointIndicesCache.constBegin();
while (i != _modelJointIndicesCache.constEnd()) {
for (auto i = _modelJointIndicesCache.constBegin(); i != _modelJointIndicesCache.constEnd(); i++) {
int index = i.value();
resultVector[index] = i.key();
++i;
}
// convert to QList and drop out blanks
result = resultVector.toList();