Skip to content

Commit

Permalink
New TODO comment style.
Browse files Browse the repository at this point in the history
Qt Creator 2.5 is able to parse those.
  • Loading branch information
debfx committed May 11, 2012
1 parent 8faac07 commit 587a647
Show file tree
Hide file tree
Showing 16 changed files with 38 additions and 38 deletions.
2 changes: 1 addition & 1 deletion src/core/Config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ Config::Config()

userPath += "/keepassx/";
#elif defined(Q_WS_MAC)
// TODO where to store the config on mac?
// TODO: where to store the config on mac?
userPath = homePath;
userPath += "/.keepassx/";
#elif defined(Q_WS_WIN)
Expand Down
4 changes: 2 additions & 2 deletions src/core/Entry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ QImage Entry::icon() const
return databaseIcons()->icon(m_data.iconNumber);
}
else {
// TODO check if database() is 0
// TODO: check if database() is 0
return database()->metadata()->customIcon(m_data.customIcon);
}
}
Expand All @@ -105,7 +105,7 @@ QPixmap Entry::iconPixmap() const
else {
QPixmap pixmap;
if (!QPixmapCache::find(m_pixmapCacheKey, &pixmap)) {
// TODO check if database() is 0
// TODO: check if database() is 0
pixmap = QPixmap::fromImage(database()->metadata()->customIcon(m_data.customIcon));
*const_cast<QPixmapCache::Key*>(&m_pixmapCacheKey) = QPixmapCache::insert(pixmap);
}
Expand Down
4 changes: 2 additions & 2 deletions src/core/Group.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ QImage Group::icon() const
return databaseIcons()->icon(m_iconNumber);
}
else {
// TODO check if m_db is 0
// TODO: check if m_db is 0
return m_db->metadata()->customIcon(m_customIcon);
}
}
Expand All @@ -113,7 +113,7 @@ QPixmap Group::iconPixmap() const
else {
QPixmap pixmap;
if (!QPixmapCache::find(m_pixmapCacheKey, &pixmap)) {
// TODO check if m_db is 0
// TODO: check if m_db is 0
pixmap = QPixmap::fromImage(m_db->metadata()->customIcon(m_customIcon));
*const_cast<QPixmapCache::Key*>(&m_pixmapCacheKey) = QPixmapCache::insert(pixmap);
}
Expand Down
2 changes: 1 addition & 1 deletion src/crypto/CryptoHash.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ CryptoHash::CryptoHash(CryptoHash::Algorithm algo)
}

gcry_error_t error = gcry_md_open(&d->ctx, algoGcrypt, 0);
Q_ASSERT(error == 0); // TODO error handling
Q_ASSERT(error == 0); // TODO: error handling

d->hashLen = gcry_md_get_algo_dlen(algoGcrypt);
}
Expand Down
8 changes: 4 additions & 4 deletions src/crypto/SymmetricCipherGcrypt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ void SymmetricCipherGcrypt::init()
gcry_error_t error;

error = gcry_cipher_open(&m_ctx, m_algo, m_mode, 0);
Q_ASSERT(error == 0); // TODO real error checking
Q_ASSERT(error == 0); // TODO: real error checking

size_t blockSizeT;
error = gcry_cipher_algo_info(m_algo, GCRYCTL_GET_BLKLEN, 0, &blockSizeT);
Expand All @@ -92,7 +92,7 @@ void SymmetricCipherGcrypt::setIv(const QByteArray& iv)

QByteArray SymmetricCipherGcrypt::process(const QByteArray& data)
{
// TODO check block size
// TODO: check block size

QByteArray result;
result.resize(data.size());
Expand All @@ -113,7 +113,7 @@ QByteArray SymmetricCipherGcrypt::process(const QByteArray& data)

void SymmetricCipherGcrypt::processInPlace(QByteArray& data)
{
// TODO check block size
// TODO: check block size

gcry_error_t error;

Expand All @@ -129,7 +129,7 @@ void SymmetricCipherGcrypt::processInPlace(QByteArray& data)

void SymmetricCipherGcrypt::processInPlace(QByteArray& data, quint64 rounds)
{
// TODO check block size
// TODO: check block size

gcry_error_t error;

Expand Down
22 changes: 11 additions & 11 deletions src/format/KeePass1Reader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,49 +111,49 @@ Database* KeePass1Reader::readDatabase(QIODevice* device, const QString& passwor

m_masterSeed = m_device->read(16);
if (m_masterSeed.size() != 16) {
// TODO error
// TODO: error
Q_ASSERT(false);
return 0;
}

m_encryptionIV = m_device->read(16);
if (m_encryptionIV.size() != 16) {
// TODO error
// TODO: error
Q_ASSERT(false);
return 0;
}

quint32 numGroups = Endian::readUInt32(m_device, KeePass1::BYTEORDER, &ok);
if (!ok) {
// TODO error
// TODO: error
Q_ASSERT(false);
return 0;
}

quint32 numEntries = Endian::readUInt32(m_device, KeePass1::BYTEORDER, &ok);
if (!ok) {
// TODO error
// TODO: error
Q_ASSERT(false);
return 0;
}

m_contentHashHeader = m_device->read(32);
if (m_contentHashHeader.size() != 32) {
// TODO error
// TODO: error
Q_ASSERT(false);
return 0;
}

m_transformSeed = m_device->read(32);
if (m_transformSeed.size() != 32) {
// TODO error
// TODO: error
Q_ASSERT(false);
return 0;
}

m_transformRounds = Endian::readUInt32(m_device, KeePass1::BYTEORDER, &ok);
if (!ok) {
// TODO error
// TODO: error
Q_ASSERT(false);
return 0;
}
Expand All @@ -164,7 +164,7 @@ Database* KeePass1Reader::readDatabase(QIODevice* device, const QString& passwor
QScopedPointer<SymmetricCipherStream> cipherStream(testKeys(password, keyfileData, contentPos));

if (!cipherStream) {
// TODO error
// TODO: error
Q_ASSERT(false);
return 0;
}
Expand Down Expand Up @@ -330,7 +330,7 @@ SymmetricCipherStream* KeePass1Reader::testKeys(const QString& password, const Q
cipherStream->reset();
cipherStream->close();
if (!m_device->seek(contentPos)) {
// TODO error
// TODO: error
Q_ASSERT(false);
return 0;
}
Expand Down Expand Up @@ -400,7 +400,7 @@ Group* KeePass1Reader::readGroup(QIODevice* cipherStream)

QByteArray fieldData = cipherStream->read(fieldSize);
if (fieldData.size() != fieldSize) {
// TODO error
// TODO: error
Q_ASSERT(false);
return 0;
}
Expand Down Expand Up @@ -524,7 +524,7 @@ Entry* KeePass1Reader::readEntry(QIODevice* cipherStream)

QByteArray fieldData = cipherStream->read(fieldSize);
if (fieldData.size() != fieldSize) {
// TODO error
// TODO: error
Q_ASSERT(false);
return 0;
}
Expand Down
2 changes: 1 addition & 1 deletion src/format/KeePass2Reader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ Database* KeePass2Reader::readDatabase(QIODevice* device, const CompositeKey& ke
while (readHeaderField() && !hasError()) {
}

// TODO check if all header fields have been parsed
// TODO: check if all header fields have been parsed

m_db->setKey(key, m_transformSeed, false);

Expand Down
2 changes: 1 addition & 1 deletion src/format/KeePass2XmlWriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ void KeePass2XmlWriter::writeIcon(const Uuid& uuid, const QImage& icon)
QByteArray ba;
QBuffer buffer(&ba);
buffer.open(QIODevice::WriteOnly);
// TODO check !icon.save()
// TODO: check !icon.save()
icon.save(&buffer, "PNG");
buffer.close();
writeBinary("Data", ba);
Expand Down
4 changes: 2 additions & 2 deletions src/gui/ChangeMasterKeyWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ void ChangeMasterKeyWidget::clearForms()
m_ui->repeatPasswordEdit->setText("");
m_ui->keyFileGroup->setChecked(false);
m_ui->togglePasswordButton->setChecked(true);
// TODO clear m_ui->keyFileCombo
// TODO: clear m_ui->keyFileCombo

m_ui->enterPasswordEdit->setFocus();
}
Expand Down Expand Up @@ -94,7 +94,7 @@ void ChangeMasterKeyWidget::generateKey()
FileKey fileKey;
QString errorMsg;
if (!fileKey.load(m_ui->keyFileCombo->currentText(), &errorMsg)) {
// TODO error handling
// TODO: error handling
}
m_key.addKey(fileKey);
}
Expand Down
8 changes: 4 additions & 4 deletions src/gui/DatabaseTabWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ void DatabaseTabWidget::openDatabase(const QString& fileName, const QString& pw,
const QString& keyFile)
{
QScopedPointer<QFile> file(new QFile(fileName));
// TODO error handling
// TODO: error handling
if (!file->open(QIODevice::ReadWrite)) {
if (!file->open(QIODevice::ReadOnly)) {
// can't open
Expand Down Expand Up @@ -208,7 +208,7 @@ void DatabaseTabWidget::saveDatabase(Database* db)
{
DatabaseManagerStruct& dbStruct = m_dbList[db];

// TODO ensure that the data is actually written to disk
// TODO: ensure that the data is actually written to disk
if (dbStruct.file) {
dbStruct.file->reset();
m_writer.writeDatabase(dbStruct.file, db);
Expand All @@ -235,12 +235,12 @@ void DatabaseTabWidget::saveDatabaseAs(Database* db)
if (!fileName.isEmpty()) {
QFile* oldFile = dbStruct.file;
QScopedPointer<QFile> file(new QFile(fileName));
// TODO error handling
// TODO: error handling
if (!file->open(QIODevice::ReadWrite)) {
return;
}
dbStruct.file = file.take();
// TODO ensure that the data is actually written to disk
// TODO: ensure that the data is actually written to disk
m_writer.writeDatabase(dbStruct.file, db);
dbStruct.file->flush();
delete oldFile;
Expand Down
4 changes: 2 additions & 2 deletions src/gui/EditEntryWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ void EditEntryWidget::updateCurrentAttribute()

void EditEntryWidget::insertAttachment()
{
// TODO save last used dir
// TODO: save last used dir
QString filename = fileDialog()->getOpenFileName(this, tr("Select file"),
QDesktopServices::storageLocation(QDesktopServices::DocumentsLocation));
if (filename.isEmpty() || !QFile::exists(filename)) {
Expand Down Expand Up @@ -392,7 +392,7 @@ void EditEntryWidget::saveCurrentAttachment()
}

QString filename = m_attachmentsModel->keyByIndex(index);
// TODO save last used dir
// TODO: save last used dir
QDir dir(QDesktopServices::storageLocation(QDesktopServices::DocumentsLocation));
QString savePath = fileDialog()->getSaveFileName(this, tr("Save attachment"),
dir.filePath(filename));
Expand Down
2 changes: 1 addition & 1 deletion src/gui/EntryView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ void EntryView::setModel(QAbstractItemModel* model)

Entry* EntryView::currentEntry()
{
// TODO use selection instead of current?
// TODO: use selection instead of current?
return m_model->entryFromIndex(m_sortModel->mapToSource(currentIndex()));
}

Expand Down
4 changes: 2 additions & 2 deletions src/keys/FileKey.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ bool FileKey::loadXmlMeta(QXmlStreamReader& xmlReader)

while (!xmlReader.error() && xmlReader.readNextStartElement()) {
if (xmlReader.name() == "Version") {
// TODO error message about incompatible key file version
// TODO: error message about incompatible key file version
if (xmlReader.readElementText() == "1.00") {
corectVersion = true;
}
Expand All @@ -208,7 +208,7 @@ QByteArray FileKey::loadXmlKey(QXmlStreamReader& xmlReader)

while (!xmlReader.error() && xmlReader.readNextStartElement()) {
if (xmlReader.name() == "Data") {
// TODO do we need to enforce a specific data.size()?
// TODO: do we need to enforce a specific data.size()?
data = QByteArray::fromBase64(xmlReader.readElementText().toAscii());
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/streams/SymmetricCipherStream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ bool SymmetricCipherStream::writeBlock(bool lastBlock)

if (m_baseDevice->write(m_buffer) != m_buffer.size()) {
m_error = true;
// TODO copy error string
// TODO: copy error string
return false;
}
else {
Expand Down
2 changes: 1 addition & 1 deletion tests/TestCryptoHash.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ void TestCryptoHash::initTestCase()

void TestCryptoHash::test()
{
// TODO move somewhere else
// TODO: move somewhere else
QVERIFY(Crypto::selfTest());

CryptoHash cryptoHash1(CryptoHash::Sha256);
Expand Down
4 changes: 2 additions & 2 deletions tests/TestKeePass2XmlReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ void TestKeePass2XmlReader::testEntry2()
QCOMPARE(entry->uuid().toBase64(), QString("4jbADG37hkiLh2O0qUdaOQ=="));
QCOMPARE(entry->iconNumber(), 0);
QCOMPARE(entry->iconUuid().toBase64(), QString("++vyI+daLk6omox4a6kQGA=="));
// TODO test entry->icon()
// TODO: test entry->icon()
QCOMPARE(entry->foregroundColor(), QColor(255, 0, 0));
QCOMPARE(entry->backgroundColor(), QColor(255, 255, 0));
QCOMPARE(entry->overrideUrl(), QString("http://override.net/"));
Expand All @@ -284,7 +284,7 @@ void TestKeePass2XmlReader::testEntry2()
QVERIFY(attrs.removeOne("Notes"));
QCOMPARE(entry->attributes()->value("Password"), QString("Jer60Hz8o9XHvxBGcRqT"));
QVERIFY(attrs.removeOne("Password"));
QCOMPARE(entry->attributes()->value("Protected String"), QString("y")); // TODO should have a protection attribute
QCOMPARE(entry->attributes()->value("Protected String"), QString("y")); // TODO: should have a protection attribute
QVERIFY(attrs.removeOne("Protected String"));
QCOMPARE(entry->attributes()->value("Title"), QString("Sample Entry 2"));
QVERIFY(attrs.removeOne("Title"));
Expand Down

0 comments on commit 587a647

Please sign in to comment.