mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-02-08 18:58:29 -05:00
Add braces around single line statements
* Ran clang-tidy with "readability-braces-around-statements" to find missing braces around statements.
This commit is contained in:
parent
c427000184
commit
c663b5d5fc
@ -67,15 +67,17 @@ bool CsvParser::parse(QFile* device)
|
|||||||
appendStatusMsg(QObject::tr("NULL device"), true);
|
appendStatusMsg(QObject::tr("NULL device"), true);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!readFile(device))
|
if (!readFile(device)) {
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
return parseFile();
|
return parseFile();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CsvParser::readFile(QFile* device)
|
bool CsvParser::readFile(QFile* device)
|
||||||
{
|
{
|
||||||
if (device->isOpen())
|
if (device->isOpen()) {
|
||||||
device->close();
|
device->close();
|
||||||
|
}
|
||||||
|
|
||||||
device->open(QIODevice::ReadOnly);
|
device->open(QIODevice::ReadOnly);
|
||||||
if (!Tools::readAllFromDevice(device, m_array)) {
|
if (!Tools::readAllFromDevice(device, m_array)) {
|
||||||
@ -86,8 +88,9 @@ bool CsvParser::readFile(QFile* device)
|
|||||||
|
|
||||||
m_array.replace("\r\n", "\n");
|
m_array.replace("\r\n", "\n");
|
||||||
m_array.replace("\r", "\n");
|
m_array.replace("\r", "\n");
|
||||||
if (0 == m_array.size())
|
if (0 == m_array.size()) {
|
||||||
appendStatusMsg(QObject::tr("file empty").append("\n"));
|
appendStatusMsg(QObject::tr("file empty").append("\n"));
|
||||||
|
}
|
||||||
m_isFileLoaded = true;
|
m_isFileLoaded = true;
|
||||||
}
|
}
|
||||||
return m_isFileLoaded;
|
return m_isFileLoaded;
|
||||||
@ -124,8 +127,9 @@ bool CsvParser::parseFile()
|
|||||||
{
|
{
|
||||||
parseRecord();
|
parseRecord();
|
||||||
while (!m_isEof) {
|
while (!m_isEof) {
|
||||||
if (!skipEndline())
|
if (!skipEndline()) {
|
||||||
appendStatusMsg(QObject::tr("malformed string"), true);
|
appendStatusMsg(QObject::tr("malformed string"), true);
|
||||||
|
}
|
||||||
m_currRow++;
|
m_currRow++;
|
||||||
m_currCol = 1;
|
m_currCol = 1;
|
||||||
parseRecord();
|
parseRecord();
|
||||||
@ -146,15 +150,17 @@ void CsvParser::parseRecord()
|
|||||||
getChar(m_ch);
|
getChar(m_ch);
|
||||||
} while (isSeparator(m_ch) && !m_isEof);
|
} while (isSeparator(m_ch) && !m_isEof);
|
||||||
|
|
||||||
if (!m_isEof)
|
if (!m_isEof) {
|
||||||
ungetChar();
|
ungetChar();
|
||||||
|
}
|
||||||
if (isEmptyRow(row)) {
|
if (isEmptyRow(row)) {
|
||||||
row.clear();
|
row.clear();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
m_table.push_back(row);
|
m_table.push_back(row);
|
||||||
if (m_maxCols < row.size())
|
if (m_maxCols < row.size()) {
|
||||||
m_maxCols = row.size();
|
m_maxCols = row.size();
|
||||||
|
}
|
||||||
m_currCol++;
|
m_currCol++;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -163,11 +169,12 @@ void CsvParser::parseField(CsvRow& row)
|
|||||||
QString field;
|
QString field;
|
||||||
peek(m_ch);
|
peek(m_ch);
|
||||||
if (!isTerminator(m_ch)) {
|
if (!isTerminator(m_ch)) {
|
||||||
if (isQualifier(m_ch))
|
if (isQualifier(m_ch)) {
|
||||||
parseQuoted(field);
|
parseQuoted(field);
|
||||||
else
|
} else {
|
||||||
parseSimple(field);
|
parseSimple(field);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
row.push_back(field);
|
row.push_back(field);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -179,9 +186,10 @@ void CsvParser::parseSimple(QString& s)
|
|||||||
s.append(c);
|
s.append(c);
|
||||||
getChar(c);
|
getChar(c);
|
||||||
}
|
}
|
||||||
if (!m_isEof)
|
if (!m_isEof) {
|
||||||
ungetChar();
|
ungetChar();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void CsvParser::parseQuoted(QString& s)
|
void CsvParser::parseQuoted(QString& s)
|
||||||
{
|
{
|
||||||
@ -189,18 +197,21 @@ void CsvParser::parseQuoted(QString& s)
|
|||||||
getChar(m_ch);
|
getChar(m_ch);
|
||||||
parseEscaped(s);
|
parseEscaped(s);
|
||||||
// getChar(m_ch);
|
// getChar(m_ch);
|
||||||
if (!isQualifier(m_ch))
|
if (!isQualifier(m_ch)) {
|
||||||
appendStatusMsg(QObject::tr("missing closing quote"), true);
|
appendStatusMsg(QObject::tr("missing closing quote"), true);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void CsvParser::parseEscaped(QString& s)
|
void CsvParser::parseEscaped(QString& s)
|
||||||
{
|
{
|
||||||
parseEscapedText(s);
|
parseEscapedText(s);
|
||||||
while (processEscapeMark(s, m_ch))
|
while (processEscapeMark(s, m_ch)) {
|
||||||
parseEscapedText(s);
|
parseEscapedText(s);
|
||||||
if (!m_isEof)
|
}
|
||||||
|
if (!m_isEof) {
|
||||||
ungetChar();
|
ungetChar();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void CsvParser::parseEscapedText(QString& s)
|
void CsvParser::parseEscapedText(QString& s)
|
||||||
{
|
{
|
||||||
@ -233,8 +244,9 @@ bool CsvParser::processEscapeMark(QString& s, QChar c)
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// double quote syntax, e.g. ""
|
// double quote syntax, e.g. ""
|
||||||
if (!isQualifier(c))
|
if (!isQualifier(c)) {
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
peek(c2);
|
peek(c2);
|
||||||
if (!m_isEof) { // not EOF, can read one char
|
if (!m_isEof) { // not EOF, can read one char
|
||||||
if (isQualifier(c2)) {
|
if (isQualifier(c2)) {
|
||||||
@ -294,17 +306,19 @@ void CsvParser::ungetChar()
|
|||||||
void CsvParser::peek(QChar& c)
|
void CsvParser::peek(QChar& c)
|
||||||
{
|
{
|
||||||
getChar(c);
|
getChar(c);
|
||||||
if (!m_isEof)
|
if (!m_isEof) {
|
||||||
ungetChar();
|
ungetChar();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool CsvParser::isQualifier(const QChar& c) const
|
bool CsvParser::isQualifier(const QChar& c) const
|
||||||
{
|
{
|
||||||
if (true == m_isBackslashSyntax && (c != m_qualifier))
|
if (true == m_isBackslashSyntax && (c != m_qualifier)) {
|
||||||
return (c == '\\');
|
return (c == '\\');
|
||||||
else
|
} else {
|
||||||
return (c == m_qualifier);
|
return (c == m_qualifier);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool CsvParser::isComment()
|
bool CsvParser::isComment()
|
||||||
{
|
{
|
||||||
@ -312,12 +326,13 @@ bool CsvParser::isComment()
|
|||||||
QChar c2;
|
QChar c2;
|
||||||
qint64 pos = m_ts.pos();
|
qint64 pos = m_ts.pos();
|
||||||
|
|
||||||
do
|
do {
|
||||||
getChar(c2);
|
getChar(c2);
|
||||||
while ((isSpace(c2) || isTab(c2)) && (!m_isEof));
|
} while ((isSpace(c2) || isTab(c2)) && (!m_isEof));
|
||||||
|
|
||||||
if (c2 == m_comment)
|
if (c2 == m_comment) {
|
||||||
result = true;
|
result = true;
|
||||||
|
}
|
||||||
m_ts.seek(pos);
|
m_ts.seek(pos);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -330,9 +345,11 @@ bool CsvParser::isText(QChar c) const
|
|||||||
bool CsvParser::isEmptyRow(const CsvRow& row) const
|
bool CsvParser::isEmptyRow(const CsvRow& row) const
|
||||||
{
|
{
|
||||||
CsvRow::const_iterator it = row.constBegin();
|
CsvRow::const_iterator it = row.constBegin();
|
||||||
for (; it != row.constEnd(); ++it)
|
for (; it != row.constEnd(); ++it) {
|
||||||
if (((*it) != "\n") && ((*it) != ""))
|
if (((*it) != "\n") && ((*it) != "")) {
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -779,8 +779,9 @@ Entry* Entry::clone(CloneFlags flags) const
|
|||||||
entry->m_data.timeInfo.setLocationChanged(now);
|
entry->m_data.timeInfo.setLocationChanged(now);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (flags & CloneRenameTitle)
|
if (flags & CloneRenameTitle) {
|
||||||
entry->setTitle(tr("%1 - Clone").arg(entry->title()));
|
entry->setTitle(tr("%1 - Clone").arg(entry->title()));
|
||||||
|
}
|
||||||
|
|
||||||
entry->setUpdateTimeinfo(true);
|
entry->setUpdateTimeinfo(true);
|
||||||
|
|
||||||
@ -1075,8 +1076,9 @@ QString Entry::resolvePlaceholder(const QString& placeholder) const
|
|||||||
|
|
||||||
QString Entry::resolveUrlPlaceholder(const QString& str, Entry::PlaceholderType placeholderType) const
|
QString Entry::resolveUrlPlaceholder(const QString& str, Entry::PlaceholderType placeholderType) const
|
||||||
{
|
{
|
||||||
if (str.isEmpty())
|
if (str.isEmpty()) {
|
||||||
return QString();
|
return QString();
|
||||||
|
}
|
||||||
|
|
||||||
const QUrl qurl(str);
|
const QUrl qurl(str);
|
||||||
switch (placeholderType) {
|
switch (placeholderType) {
|
||||||
|
@ -113,8 +113,9 @@ namespace Tools
|
|||||||
extensions += "\n- " + QObject::tr("Secret Service Integration");
|
extensions += "\n- " + QObject::tr("Secret Service Integration");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (extensions.isEmpty())
|
if (extensions.isEmpty()) {
|
||||||
extensions = " " + QObject::tr("None");
|
extensions = " " + QObject::tr("None");
|
||||||
|
}
|
||||||
|
|
||||||
debugInfo.append(QObject::tr("Enabled extensions:").append(extensions).append("\n"));
|
debugInfo.append(QObject::tr("Enabled extensions:").append(extensions).append("\n"));
|
||||||
return debugInfo;
|
return debugInfo;
|
||||||
|
@ -28,8 +28,9 @@ namespace
|
|||||||
{
|
{
|
||||||
QString PixmapToHTML(const QPixmap& pixmap)
|
QString PixmapToHTML(const QPixmap& pixmap)
|
||||||
{
|
{
|
||||||
if (pixmap.isNull())
|
if (pixmap.isNull()) {
|
||||||
return "";
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
// Based on https://stackoverflow.com/a/6621278
|
// Based on https://stackoverflow.com/a/6621278
|
||||||
QByteArray a;
|
QByteArray a;
|
||||||
|
@ -65,8 +65,9 @@ QStringList FileDialog::getOpenFileNames(QWidget* parent,
|
|||||||
const auto& workingDir = dir.isEmpty() ? config()->get("LastDir").toString() : dir;
|
const auto& workingDir = dir.isEmpty() ? config()->get("LastDir").toString() : dir;
|
||||||
auto results = QFileDialog::getOpenFileNames(parent, caption, workingDir, filter, selectedFilter, options);
|
auto results = QFileDialog::getOpenFileNames(parent, caption, workingDir, filter, selectedFilter, options);
|
||||||
|
|
||||||
for (auto& path : results)
|
for (auto& path : results) {
|
||||||
path = QDir::toNativeSeparators(path);
|
path = QDir::toNativeSeparators(path);
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef Q_OS_MACOS
|
#ifdef Q_OS_MACOS
|
||||||
// on Mac OS X the focus is lost after closing the native dialog
|
// on Mac OS X the focus is lost after closing the native dialog
|
||||||
|
@ -294,28 +294,31 @@ void CsvImportWidget::setRootGroup()
|
|||||||
|
|
||||||
for (int r = 0; r < m_parserModel->rowCount(); ++r) {
|
for (int r = 0; r < m_parserModel->rowCount(); ++r) {
|
||||||
// use validity of second column as a GO/NOGO for all others fields
|
// use validity of second column as a GO/NOGO for all others fields
|
||||||
if (not m_parserModel->data(m_parserModel->index(r, 1)).isValid())
|
if (not m_parserModel->data(m_parserModel->index(r, 1)).isValid()) {
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
groupLabel = m_parserModel->data(m_parserModel->index(r, 0)).toString();
|
groupLabel = m_parserModel->data(m_parserModel->index(r, 0)).toString();
|
||||||
// check if group name is either "root", "" (empty) or some other label
|
// check if group name is either "root", "" (empty) or some other label
|
||||||
groupList = groupLabel.split("/", QString::SkipEmptyParts);
|
groupList = groupLabel.split("/", QString::SkipEmptyParts);
|
||||||
if (groupList.isEmpty())
|
if (groupList.isEmpty()) {
|
||||||
is_empty = true;
|
is_empty = true;
|
||||||
else if (not groupList.first().compare("Root", Qt::CaseSensitive))
|
} else if (not groupList.first().compare("Root", Qt::CaseSensitive)) {
|
||||||
is_root = true;
|
is_root = true;
|
||||||
else if (not groupLabel.compare(""))
|
} else if (not groupLabel.compare("")) {
|
||||||
is_empty = true;
|
is_empty = true;
|
||||||
else
|
} else {
|
||||||
is_label = true;
|
is_label = true;
|
||||||
|
}
|
||||||
|
|
||||||
groupList.clear();
|
groupList.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((is_empty and is_root) or (is_label and not is_empty and is_root))
|
if ((is_empty and is_root) or (is_label and not is_empty and is_root)) {
|
||||||
m_db->rootGroup()->setName("CSV IMPORTED");
|
m_db->rootGroup()->setName("CSV IMPORTED");
|
||||||
else
|
} else {
|
||||||
m_db->rootGroup()->setName("Root");
|
m_db->rootGroup()->setName("Root");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Group* CsvImportWidget::splitGroups(const QString& label)
|
Group* CsvImportWidget::splitGroups(const QString& label)
|
||||||
{
|
{
|
||||||
|
@ -55,8 +55,9 @@ bool CsvParserModel::parse()
|
|||||||
QFile csv(m_filename);
|
QFile csv(m_filename);
|
||||||
r = CsvParser::parse(&csv);
|
r = CsvParser::parse(&csv);
|
||||||
}
|
}
|
||||||
for (int i = 0; i < columnCount(); ++i)
|
for (int i = 0; i < columnCount(); ++i) {
|
||||||
m_columnMap.insert(i, 0);
|
m_columnMap.insert(i, 0);
|
||||||
|
}
|
||||||
addEmptyColumn();
|
addEmptyColumn();
|
||||||
endResetModel();
|
endResetModel();
|
||||||
return r;
|
return r;
|
||||||
@ -73,13 +74,15 @@ void CsvParserModel::addEmptyColumn()
|
|||||||
|
|
||||||
void CsvParserModel::mapColumns(int csvColumn, int dbColumn)
|
void CsvParserModel::mapColumns(int csvColumn, int dbColumn)
|
||||||
{
|
{
|
||||||
if ((csvColumn < 0) || (dbColumn < 0))
|
if ((csvColumn < 0) || (dbColumn < 0)) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
beginResetModel();
|
beginResetModel();
|
||||||
if (csvColumn >= getCsvCols())
|
if (csvColumn >= getCsvCols()) {
|
||||||
m_columnMap[dbColumn] = 0; // map to the empty column
|
m_columnMap[dbColumn] = 0; // map to the empty column
|
||||||
else
|
} else {
|
||||||
m_columnMap[dbColumn] = csvColumn;
|
m_columnMap[dbColumn] = csvColumn;
|
||||||
|
}
|
||||||
endResetModel();
|
endResetModel();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -99,15 +102,17 @@ void CsvParserModel::setHeaderLabels(const QStringList& labels)
|
|||||||
|
|
||||||
int CsvParserModel::rowCount(const QModelIndex& parent) const
|
int CsvParserModel::rowCount(const QModelIndex& parent) const
|
||||||
{
|
{
|
||||||
if (parent.isValid())
|
if (parent.isValid()) {
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
return getCsvRows();
|
return getCsvRows();
|
||||||
}
|
}
|
||||||
|
|
||||||
int CsvParserModel::columnCount(const QModelIndex& parent) const
|
int CsvParserModel::columnCount(const QModelIndex& parent) const
|
||||||
{
|
{
|
||||||
if (parent.isValid())
|
if (parent.isValid()) {
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
return m_columnHeader.size();
|
return m_columnHeader.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -116,8 +121,9 @@ QVariant CsvParserModel::data(const QModelIndex& index, int role) const
|
|||||||
if ((index.column() >= m_columnHeader.size()) || (index.row() + m_skipped >= rowCount()) || !index.isValid()) {
|
if ((index.column() >= m_columnHeader.size()) || (index.row() + m_skipped >= rowCount()) || !index.isValid()) {
|
||||||
return QVariant();
|
return QVariant();
|
||||||
}
|
}
|
||||||
if (role == Qt::DisplayRole)
|
if (role == Qt::DisplayRole) {
|
||||||
return m_table.at(index.row() + m_skipped).at(m_columnMap[index.column()]);
|
return m_table.at(index.row() + m_skipped).at(m_columnMap[index.column()]);
|
||||||
|
}
|
||||||
return QVariant();
|
return QVariant();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -125,12 +131,14 @@ QVariant CsvParserModel::headerData(int section, Qt::Orientation orientation, in
|
|||||||
{
|
{
|
||||||
if (role == Qt::DisplayRole) {
|
if (role == Qt::DisplayRole) {
|
||||||
if (orientation == Qt::Horizontal) {
|
if (orientation == Qt::Horizontal) {
|
||||||
if ((section < 0) || (section >= m_columnHeader.size()))
|
if ((section < 0) || (section >= m_columnHeader.size())) {
|
||||||
return QVariant();
|
return QVariant();
|
||||||
|
}
|
||||||
return m_columnHeader.at(section);
|
return m_columnHeader.at(section);
|
||||||
} else if (orientation == Qt::Vertical) {
|
} else if (orientation == Qt::Vertical) {
|
||||||
if (section + m_skipped >= rowCount())
|
if (section + m_skipped >= rowCount()) {
|
||||||
return QVariant();
|
return QVariant();
|
||||||
|
}
|
||||||
return QString::number(section + 1);
|
return QString::number(section + 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -155,11 +155,12 @@ void GroupView::syncExpandedState(const QModelIndex& parent, int start, int end)
|
|||||||
|
|
||||||
void GroupView::setCurrentGroup(Group* group)
|
void GroupView::setCurrentGroup(Group* group)
|
||||||
{
|
{
|
||||||
if (group == nullptr)
|
if (group == nullptr) {
|
||||||
setCurrentIndex(QModelIndex());
|
setCurrentIndex(QModelIndex());
|
||||||
else
|
} else {
|
||||||
setCurrentIndex(m_model->index(group));
|
setCurrentIndex(m_model->index(group));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void GroupView::modelReset()
|
void GroupView::modelReset()
|
||||||
{
|
{
|
||||||
|
@ -56,8 +56,9 @@ QString ElidedLabel::url() const
|
|||||||
|
|
||||||
void ElidedLabel::setElideMode(Qt::TextElideMode elideMode)
|
void ElidedLabel::setElideMode(Qt::TextElideMode elideMode)
|
||||||
{
|
{
|
||||||
if (m_elideMode == elideMode)
|
if (m_elideMode == elideMode) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (m_elideMode != Qt::ElideNone) {
|
if (m_elideMode != Qt::ElideNone) {
|
||||||
setWordWrap(false);
|
setWordWrap(false);
|
||||||
@ -69,8 +70,9 @@ void ElidedLabel::setElideMode(Qt::TextElideMode elideMode)
|
|||||||
|
|
||||||
void ElidedLabel::setRawText(const QString& elidedText)
|
void ElidedLabel::setRawText(const QString& elidedText)
|
||||||
{
|
{
|
||||||
if (m_rawText == elidedText)
|
if (m_rawText == elidedText) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
m_rawText = elidedText;
|
m_rawText = elidedText;
|
||||||
emit rawTextChanged(m_rawText);
|
emit rawTextChanged(m_rawText);
|
||||||
@ -78,8 +80,9 @@ void ElidedLabel::setRawText(const QString& elidedText)
|
|||||||
|
|
||||||
void ElidedLabel::setUrl(const QString& url)
|
void ElidedLabel::setUrl(const QString& url)
|
||||||
{
|
{
|
||||||
if (m_url == url)
|
if (m_url == url) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
m_url = url;
|
m_url = url;
|
||||||
emit urlChanged(m_url);
|
emit urlChanged(m_url);
|
||||||
|
@ -30,8 +30,9 @@ void TestCsvParser::initTestCase()
|
|||||||
void TestCsvParser::init()
|
void TestCsvParser::init()
|
||||||
{
|
{
|
||||||
file.reset(new QTemporaryFile());
|
file.reset(new QTemporaryFile());
|
||||||
if (not file->open())
|
if (not file->open()) {
|
||||||
QFAIL("Cannot open file!");
|
QFAIL("Cannot open file!");
|
||||||
|
}
|
||||||
parser->setBackslashSyntax(false);
|
parser->setBackslashSyntax(false);
|
||||||
parser->setComment('#');
|
parser->setComment('#');
|
||||||
parser->setFieldSeparator(',');
|
parser->setFieldSeparator(',');
|
||||||
|
@ -289,14 +289,16 @@ void TestSymmetricCipher::testTwofish256CbcEncryption()
|
|||||||
QCOMPARE(cipher.blockSize(), 16);
|
QCOMPARE(cipher.blockSize(), 16);
|
||||||
for (int j = 0; j < 5000; ++j) {
|
for (int j = 0; j < 5000; ++j) {
|
||||||
ctCur = cipher.process(ptNext, &ok);
|
ctCur = cipher.process(ptNext, &ok);
|
||||||
if (!ok)
|
if (!ok) {
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
ptNext = ctPrev;
|
ptNext = ctPrev;
|
||||||
ctPrev = ctCur;
|
ctPrev = ctCur;
|
||||||
|
|
||||||
ctCur = cipher.process(ptNext, &ok);
|
ctCur = cipher.process(ptNext, &ok);
|
||||||
if (!ok)
|
if (!ok) {
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
ptNext = ctPrev;
|
ptNext = ctPrev;
|
||||||
ctPrev = ctCur;
|
ctPrev = ctCur;
|
||||||
}
|
}
|
||||||
@ -342,13 +344,15 @@ void TestSymmetricCipher::testTwofish256CbcDecryption()
|
|||||||
QCOMPARE(cipher.blockSize(), 16);
|
QCOMPARE(cipher.blockSize(), 16);
|
||||||
for (int j = 0; j < 5000; ++j) {
|
for (int j = 0; j < 5000; ++j) {
|
||||||
ptCur = cipher.process(ctNext, &ok);
|
ptCur = cipher.process(ctNext, &ok);
|
||||||
if (!ok)
|
if (!ok) {
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
ctNext = ptCur;
|
ctNext = ptCur;
|
||||||
|
|
||||||
ptCur = cipher.process(ctNext, &ok);
|
ptCur = cipher.process(ctNext, &ok);
|
||||||
if (!ok)
|
if (!ok) {
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
ctNext = ptCur;
|
ctNext = ptCur;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -84,13 +84,15 @@ void TestYubiKeyChalResp::ykDetected(int slot, bool blocking)
|
|||||||
{
|
{
|
||||||
Q_UNUSED(blocking);
|
Q_UNUSED(blocking);
|
||||||
|
|
||||||
if (slot > 0)
|
if (slot > 0) {
|
||||||
m_detected++;
|
m_detected++;
|
||||||
|
}
|
||||||
|
|
||||||
/* Key used for later testing */
|
/* Key used for later testing */
|
||||||
if (!m_key)
|
if (!m_key) {
|
||||||
m_key.reset(new YkChallengeResponseKey(slot, blocking));
|
m_key.reset(new YkChallengeResponseKey(slot, blocking));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void TestYubiKeyChalResp::deinit()
|
void TestYubiKeyChalResp::deinit()
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user