Improve code style.
This commit is contained in:
@@ -53,7 +53,7 @@ QByteArray KeePass2RandomStream::process(const QByteArray& data)
|
||||
QByteArray result;
|
||||
result.resize(data.size());
|
||||
|
||||
for (int i=0; i<data.size(); i++) {
|
||||
for (int i = 0; i < data.size(); i++) {
|
||||
result[i] = data[i] ^ randomData[i];
|
||||
}
|
||||
|
||||
@@ -64,7 +64,7 @@ void KeePass2RandomStream::processInPlace(QByteArray& data)
|
||||
{
|
||||
QByteArray randomData = randomBytes(data.size());
|
||||
|
||||
for (int i=0; i<data.size(); i++) {
|
||||
for (int i = 0; i < data.size(); i++) {
|
||||
data[i] = data[i] ^ randomData[i];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -79,7 +79,8 @@ Database* KeePass2Reader::readDatabase(QIODevice* device, const CompositeKey& ke
|
||||
hash.addData(m_db->transformedMasterKey());
|
||||
QByteArray finalKey = hash.result();
|
||||
|
||||
SymmetricCipherStream cipherStream(device, SymmetricCipher::Aes256, SymmetricCipher::Cbc, SymmetricCipher::Decrypt, finalKey, m_encryptionIV);
|
||||
SymmetricCipherStream cipherStream(device, SymmetricCipher::Aes256, SymmetricCipher::Cbc,
|
||||
SymmetricCipher::Decrypt, finalKey, m_encryptionIV);
|
||||
cipherStream.open(QIODevice::ReadOnly);
|
||||
|
||||
QByteArray realStart = cipherStream.read(32);
|
||||
|
||||
@@ -62,17 +62,24 @@ void KeePass2Writer::writeDatabase(QIODevice* device, Database* db)
|
||||
CHECK_RETURN(writeData(Endian::int32ToBytes(KeePass2::FILE_VERSION, KeePass2::BYTEORDER)));
|
||||
|
||||
CHECK_RETURN(writeHeaderField(KeePass2::CipherID, db->cipher().toByteArray()));
|
||||
CHECK_RETURN(writeHeaderField(KeePass2::CompressionFlags, Endian::int32ToBytes(db->compressionAlgo(), KeePass2::BYTEORDER)));
|
||||
CHECK_RETURN(writeHeaderField(KeePass2::CompressionFlags,
|
||||
Endian::int32ToBytes(db->compressionAlgo(),
|
||||
KeePass2::BYTEORDER)));
|
||||
CHECK_RETURN(writeHeaderField(KeePass2::MasterSeed, masterSeed));
|
||||
CHECK_RETURN(writeHeaderField(KeePass2::TransformSeed, db->transformSeed()));
|
||||
CHECK_RETURN(writeHeaderField(KeePass2::TransformRounds, Endian::int64ToBytes(db->transformRounds(), KeePass2::BYTEORDER)));
|
||||
CHECK_RETURN(writeHeaderField(KeePass2::TransformRounds,
|
||||
Endian::int64ToBytes(db->transformRounds(),
|
||||
KeePass2::BYTEORDER)));
|
||||
CHECK_RETURN(writeHeaderField(KeePass2::EncryptionIV, encryptionIV));
|
||||
CHECK_RETURN(writeHeaderField(KeePass2::ProtectedStreamKey, protectedStreamKey));
|
||||
CHECK_RETURN(writeHeaderField(KeePass2::StreamStartBytes, startBytes));
|
||||
CHECK_RETURN(writeHeaderField(KeePass2::InnerRandomStreamID, Endian::int32ToBytes(KeePass2::Salsa20, KeePass2::BYTEORDER)));
|
||||
CHECK_RETURN(writeHeaderField(KeePass2::InnerRandomStreamID,
|
||||
Endian::int32ToBytes(KeePass2::Salsa20,
|
||||
KeePass2::BYTEORDER)));
|
||||
CHECK_RETURN(writeHeaderField(KeePass2::EndOfHeader, endOfHeader));
|
||||
|
||||
SymmetricCipherStream cipherStream(device, SymmetricCipher::Aes256, SymmetricCipher::Cbc, SymmetricCipher::Encrypt, finalKey, encryptionIV);
|
||||
SymmetricCipherStream cipherStream(device, SymmetricCipher::Aes256, SymmetricCipher::Cbc,
|
||||
SymmetricCipher::Encrypt, finalKey, encryptionIV);
|
||||
cipherStream.open(QIODevice::WriteOnly);
|
||||
m_device = &cipherStream;
|
||||
CHECK_RETURN(writeData(startBytes));
|
||||
|
||||
@@ -376,7 +376,6 @@ Group* KeePass2XmlReader::parseGroup()
|
||||
else {
|
||||
raiseError(3);
|
||||
}
|
||||
|
||||
}
|
||||
else if (m_xml.name() == "EnableSearching") {
|
||||
QString str = readString();
|
||||
@@ -733,7 +732,7 @@ QColor KeePass2XmlReader::readColor()
|
||||
}
|
||||
|
||||
QColor color;
|
||||
for (int i=0; i<= 2; i++) {
|
||||
for (int i = 0; i <= 2; i++) {
|
||||
QString rgbPartStr = colorStr.mid(1 + 2*i, 2);
|
||||
bool ok;
|
||||
int rgbPart = rgbPartStr.toInt(&ok, 16);
|
||||
|
||||
Reference in New Issue
Block a user