clang-tidy: use auto

Signed-off-by: Rosen Penev <rosenp@gmail.com>
This commit is contained in:
Rosen Penev 2022-04-11 17:06:50 -07:00 committed by Jonathan White
parent f3f1520f81
commit 7e1d980d08
32 changed files with 224 additions and 223 deletions

View file

@ -432,13 +432,13 @@ Group* KeePass1Reader::readGroup(QIODevice* cipherStream)
bool reachedEnd = false;
do {
quint16 fieldType = Endian::readSizedInt<quint16>(cipherStream, KeePass1::BYTEORDER, &ok);
auto fieldType = Endian::readSizedInt<quint16>(cipherStream, KeePass1::BYTEORDER, &ok);
if (!ok) {
raiseError(tr("Invalid group field type number"));
return nullptr;
}
int fieldSize = static_cast<int>(Endian::readSizedInt<quint32>(cipherStream, KeePass1::BYTEORDER, &ok));
auto fieldSize = static_cast<int>(Endian::readSizedInt<quint32>(cipherStream, KeePass1::BYTEORDER, &ok));
if (!ok) {
raiseError(tr("Invalid group field size"));
return nullptr;
@ -513,7 +513,7 @@ Group* KeePass1Reader::readGroup(QIODevice* cipherStream)
raiseError(tr("Incorrect group icon field size"));
return nullptr;
}
quint32 iconNumber = Endian::bytesToSizedInt<quint32>(fieldData, KeePass1::BYTEORDER);
auto iconNumber = Endian::bytesToSizedInt<quint32>(fieldData, KeePass1::BYTEORDER);
group->setIcon(iconNumber);
break;
}
@ -564,13 +564,13 @@ Entry* KeePass1Reader::readEntry(QIODevice* cipherStream)
bool reachedEnd = false;
do {
quint16 fieldType = Endian::readSizedInt<quint16>(cipherStream, KeePass1::BYTEORDER, &ok);
auto fieldType = Endian::readSizedInt<quint16>(cipherStream, KeePass1::BYTEORDER, &ok);
if (!ok) {
raiseError(tr("Missing entry field type number"));
return nullptr;
}
int fieldSize = static_cast<int>(Endian::readSizedInt<quint32>(cipherStream, KeePass1::BYTEORDER, &ok));
auto fieldSize = static_cast<int>(Endian::readSizedInt<quint32>(cipherStream, KeePass1::BYTEORDER, &ok));
if (!ok) {
raiseError(tr("Invalid entry field size"));
return nullptr;
@ -598,7 +598,7 @@ Entry* KeePass1Reader::readEntry(QIODevice* cipherStream)
raiseError(tr("Invalid entry group id field size"));
return nullptr;
}
quint32 groupId = Endian::bytesToSizedInt<quint32>(fieldData, KeePass1::BYTEORDER);
auto groupId = Endian::bytesToSizedInt<quint32>(fieldData, KeePass1::BYTEORDER);
m_entryGroupIds.insert(entry.data(), groupId);
break;
}
@ -607,7 +607,7 @@ Entry* KeePass1Reader::readEntry(QIODevice* cipherStream)
raiseError(tr("Invalid entry icon field size"));
return nullptr;
}
quint32 iconNumber = Endian::bytesToSizedInt<quint32>(fieldData, KeePass1::BYTEORDER);
auto iconNumber = Endian::bytesToSizedInt<quint32>(fieldData, KeePass1::BYTEORDER);
entry->setIcon(iconNumber);
break;
}
@ -806,7 +806,7 @@ bool KeePass1Reader::parseGroupTreeState(const QByteArray& data)
}
int pos = 0;
quint32 num = Endian::bytesToSizedInt<quint32>(data.mid(pos, 4), KeePass1::BYTEORDER);
auto num = Endian::bytesToSizedInt<quint32>(data.mid(pos, 4), KeePass1::BYTEORDER);
pos += 4;
if (static_cast<quint32>(data.size() - 4) != (num * 5)) {
@ -814,7 +814,7 @@ bool KeePass1Reader::parseGroupTreeState(const QByteArray& data)
}
for (quint32 i = 0; i < num; i++) {
quint32 groupId = Endian::bytesToSizedInt<quint32>(data.mid(pos, 4), KeePass1::BYTEORDER);
auto groupId = Endian::bytesToSizedInt<quint32>(data.mid(pos, 4), KeePass1::BYTEORDER);
pos += 4;
bool expanded = data.at(pos);
@ -836,13 +836,13 @@ bool KeePass1Reader::parseCustomIcons4(const QByteArray& data)
int pos = 0;
quint32 numIcons = Endian::bytesToSizedInt<quint32>(data.mid(pos, 4), KeePass1::BYTEORDER);
auto numIcons = Endian::bytesToSizedInt<quint32>(data.mid(pos, 4), KeePass1::BYTEORDER);
pos += 4;
quint32 numEntries = Endian::bytesToSizedInt<quint32>(data.mid(pos, 4), KeePass1::BYTEORDER);
auto numEntries = Endian::bytesToSizedInt<quint32>(data.mid(pos, 4), KeePass1::BYTEORDER);
pos += 4;
quint32 numGroups = Endian::bytesToSizedInt<quint32>(data.mid(pos, 4), KeePass1::BYTEORDER);
auto numGroups = Endian::bytesToSizedInt<quint32>(data.mid(pos, 4), KeePass1::BYTEORDER);
pos += 4;
QList<QUuid> iconUuids;
@ -851,7 +851,7 @@ bool KeePass1Reader::parseCustomIcons4(const QByteArray& data)
if (data.size() < (pos + 4)) {
return false;
}
quint32 iconSize = Endian::bytesToSizedInt<quint32>(data.mid(pos, 4), KeePass1::BYTEORDER);
auto iconSize = Endian::bytesToSizedInt<quint32>(data.mid(pos, 4), KeePass1::BYTEORDER);
pos += 4;
if (static_cast<quint32>(data.size()) < (pos + iconSize)) {
@ -873,7 +873,7 @@ bool KeePass1Reader::parseCustomIcons4(const QByteArray& data)
QByteArray entryUuid = data.mid(pos, 16);
pos += 16;
quint32 iconId = Endian::bytesToSizedInt<quint32>(data.mid(pos, 4), KeePass1::BYTEORDER);
auto iconId = Endian::bytesToSizedInt<quint32>(data.mid(pos, 4), KeePass1::BYTEORDER);
pos += 4;
if (m_entryUuids.contains(entryUuid) && (iconId < static_cast<quint32>(iconUuids.size()))) {
@ -886,10 +886,10 @@ bool KeePass1Reader::parseCustomIcons4(const QByteArray& data)
}
for (quint32 i = 0; i < numGroups; i++) {
quint32 groupId = Endian::bytesToSizedInt<quint32>(data.mid(pos, 4), KeePass1::BYTEORDER);
auto groupId = Endian::bytesToSizedInt<quint32>(data.mid(pos, 4), KeePass1::BYTEORDER);
pos += 4;
quint32 iconId = Endian::bytesToSizedInt<quint32>(data.mid(pos, 4), KeePass1::BYTEORDER);
auto iconId = Endian::bytesToSizedInt<quint32>(data.mid(pos, 4), KeePass1::BYTEORDER);
pos += 4;
if (m_groupIds.contains(groupId) && (iconId < static_cast<quint32>(iconUuids.size()))) {