[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [kmbox] /: GIT_SILENT: coding style (silent)
From: Montel Laurent <null () kde ! org>
Date: 2017-10-31 21:32:43
Message-ID: E1e9e9L-0007WU-K0 () code ! kde ! org
[Download RAW message or body]
Git commit 34b9df2b03fe97d1c54143531448a139254a2e98 by Montel Laurent.
Committed on 31/10/2017 at 21:32.
Pushed by mlaurent into branch 'master'.
GIT_SILENT: coding style
M +2 -4 autotests/mboxbenchmark.cpp
M +7 -7 autotests/mboxtest.cpp
M +10 -10 src/mbox.cpp
M +1 -5 src/mbox.h
M +9 -5 src/mbox_p.cpp
M +11 -15 src/mbox_p.h
M +2 -2 src/mboxentry.cpp
M +1 -3 src/mboxentry.h
M +1 -4 src/mboxentry_p.h
https://commits.kde.org/kmbox/34b9df2b03fe97d1c54143531448a139254a2e98
diff --git a/autotests/mboxbenchmark.cpp b/autotests/mboxbenchmark.cpp
index 515f74c..138aab3 100644
--- a/autotests/mboxbenchmark.cpp
+++ b/autotests/mboxbenchmark.cpp
@@ -68,8 +68,7 @@ void MBoxBenchmark::testNoLockPerformance()
mbox2.setLockType(MBox::None);
mbox2.setUnlockTimeout(5000);
mbox2.load(fileName());
- foreach (const MBoxEntry &entry, mbox2.entries())
- {
+ foreach (const MBoxEntry &entry, mbox2.entries()) {
mbox2.readMessage(entry);
}
}
@@ -96,8 +95,7 @@ void MBoxBenchmark::testProcfileLockPerformance()
mbox2.load(fileName());
mbox2.setUnlockTimeout(5000); // Keep the mbox locked for five seconds.
- foreach (const MBoxEntry &entry, mbox2.entries())
- {
+ foreach (const MBoxEntry &entry, mbox2.entries()) {
mbox2.readMessage(entry);
}
}
diff --git a/autotests/mboxtest.cpp b/autotests/mboxtest.cpp
index 7d25808..28caf44 100644
--- a/autotests/mboxtest.cpp
+++ b/autotests/mboxtest.cpp
@@ -319,30 +319,30 @@ void MboxTest::testEntries()
mbox1.appendMessage(mMail1);
MBoxEntry::List infos = mbox1.entries();
- QCOMPARE(infos.size() , 3);
+ QCOMPARE(infos.size(), 3);
MBoxEntry::List deletedEntries;
deletedEntries << infos.at(0);
MBoxEntry::List infos2 = mbox1.entries(deletedEntries);
- QCOMPARE(infos2.size() , 2);
+ QCOMPARE(infos2.size(), 2);
QVERIFY(infos2.first() != infos.first());
QVERIFY(infos2.last() != infos.first());
deletedEntries << infos.at(1);
infos2 = mbox1.entries(deletedEntries);
- QCOMPARE(infos2.size() , 1);
+ QCOMPARE(infos2.size(), 1);
QVERIFY(infos2.first() != infos.at(0));
QVERIFY(infos2.first() != infos.at(1));
deletedEntries << infos.at(2);
infos2 = mbox1.entries(deletedEntries);
- QCOMPARE(infos2.size() , 0);
+ QCOMPARE(infos2.size(), 0);
QVERIFY(!deletedEntries.contains(MBoxEntry(10))); // some random offset
infos2 = mbox1.entries(MBoxEntry::List() << MBoxEntry(10));
- QCOMPARE(infos2.size() , 3);
+ QCOMPARE(infos2.size(), 3);
QCOMPARE(infos2.at(0), infos.at(0));
QCOMPARE(infos2.at(1), infos.at(1));
QCOMPARE(infos2.at(2), infos.at(2));
@@ -523,8 +523,8 @@ void ThreadFillsMBox::run()
file.open(QIODevice::WriteOnly | QIODevice::Append);
QByteArray message = KMime::CRLFtoLF(sEntry1);
- file.write(QByteArray("From test@local.local ") +
- QDateTime::currentDateTime().toString(Qt::ISODate).toUtf8() + "\n");
+ file.write(QByteArray("From test@local.local ")
+ +QDateTime::currentDateTime().toString(Qt::ISODate).toUtf8() + "\n");
file.write(message);
file.write("\n\n");
file.close();
diff --git a/src/mbox.cpp b/src/mbox.cpp
index a4a3233..1a68161 100644
--- a/src/mbox.cpp
+++ b/src/mbox.cpp
@@ -169,9 +169,8 @@ bool MBox::load(const QString &fileName)
// if atEnd, use mail only if there was a separator line at all,
// otherwise it's not a valid mbox
- if (d->isMBoxSeparator(line) ||
- (d->mMboxFile.atEnd() && (prevSeparator.size() != 0))) {
-
+ if (d->isMBoxSeparator(line)
+ || (d->mMboxFile.atEnd() && (prevSeparator.size() != 0))) {
// if we are the at the file end, update pos to not forget the last line
if (d->mMboxFile.atEnd()) {
pos = d->mMboxFile.pos();
@@ -239,8 +238,8 @@ bool MBox::lock()
if (!d->mLockFileName.isEmpty()) {
args << QString::fromLocal8Bit(QFile::encodeName(d->mLockFileName));
} else {
- args << QString::fromLocal8Bit(QFile::encodeName(d->mMboxFile.fileName() \
+
- QLatin1String(".lock")));
+ args << QString::fromLocal8Bit(QFile::encodeName(d->mMboxFile.fileName()
+ \
+QLatin1String(".lock"))); }
rc = QProcess::execute(QStringLiteral("lockfile"), args);
@@ -313,7 +312,7 @@ static bool lessThanByOffset(const MBoxEntry &left, const \
MBoxEntry &right)
bool MBox::purge(const MBoxEntry::List &deletedEntries, QList<MBoxEntry::Pair> \
*movedEntries) {
- if ( d->mMboxFile.fileName().isEmpty() || d->mReadOnly ) {
+ if (d->mMboxFile.fileName().isEmpty() || d->mReadOnly) {
return false; // No file loaded yet or it's readOnly
}
@@ -359,9 +358,9 @@ bool MBox::purge(const MBoxEntry::List &deletedEntries, \
QList<MBoxEntry::Pair> * if (deletedEntries.contains(entry) && \
!writeOffSetInitialized) { writeOffset = entry.messageOffset();
writeOffSetInitialized = true;
- } else if (writeOffSetInitialized &&
- writeOffset < entry.messageOffset() &&
- !deletedEntries.contains(entry)) {
+ } else if (writeOffSetInitialized
+ && writeOffset < entry.messageOffset()
+ && !deletedEntries.contains(entry)) {
// The current message doesn't have to be deleted, but must be moved.
// First determine the size of the entry that must be moved.
quint64 entrySize = 0;
@@ -593,8 +592,9 @@ bool MBox::save(const QString &fileName)
return true;
}
- if ( d->mReadOnly )
+ if (d->mReadOnly) {
return false;
+ }
if (d->mAppendedEntries.isEmpty()) {
return true; // Nothing to do.
diff --git a/src/mbox.h b/src/mbox.h
index 2132138..fbc5093 100644
--- a/src/mbox.h
+++ b/src/mbox.h
@@ -25,9 +25,7 @@
#include <kmime/kmime_message.h>
-namespace KMBox
-{
-
+namespace KMBox {
class MBoxPrivate;
/**
@@ -257,7 +255,6 @@ public:
*/
bool isReadOnly() const;
-
private:
//@cond PRIVATE
Q_DISABLE_COPY(MBox)
@@ -265,7 +262,6 @@ private:
MBoxPrivate *const d;
//@endcond
};
-
}
#endif // KMBOX_MBOX_H
diff --git a/src/mbox_p.cpp b/src/mbox_p.cpp
index 4f8bd59..b47002a 100644
--- a/src/mbox_p.cpp
+++ b/src/mbox_p.cpp
@@ -26,8 +26,12 @@
using namespace KMBox;
MBoxPrivate::MBoxPrivate(MBox *mbox)
- : mInitialMboxFileSize(0), mMBox(mbox),
- mSeparatorMatcher(QStringLiteral("^From .*[0-9][0-9]:[0-9][0-9]")), \
mLockType(MBox::None), mFileLocked(false), mReadOnly(false) + : \
mInitialMboxFileSize(0) + , mMBox(mbox)
+ , mSeparatorMatcher(QStringLiteral("^From .*[0-9][0-9]:[0-9][0-9]"))
+ , mLockType(MBox::None)
+ , mFileLocked(false)
+ , mReadOnly(false)
{
connect(&mUnlockTimer, &QTimer::timeout, this, &MBoxPrivate::unlockMBox);
}
@@ -47,11 +51,11 @@ bool MBoxPrivate::open()
QIODevice::OpenMode mode = mReadOnly ? QIODevice::ReadOnly : \
QIODevice::ReadWrite;
- if ( !mMboxFile.open( mode ) ) { // messages file
+ if (!mMboxFile.open(mode)) { // messages file
// failed to open readWrite -> try to open readOnly
- if ( !mMboxFile.open( QIODevice::ReadOnly ) ) {
+ if (!mMboxFile.open(QIODevice::ReadOnly)) {
qCDebug(KMBOX_LOG) << "Cannot open mbox file `" << mMboxFile.fileName() \
<< "' FileError:"
- << mMboxFile.errorString();
+ << mMboxFile.errorString();
return false;
} else {
mReadOnly = true;
diff --git a/src/mbox_p.h b/src/mbox_p.h
index 434ee17..e2a5d85 100644
--- a/src/mbox_p.h
+++ b/src/mbox_p.h
@@ -26,9 +26,7 @@
#include <QObject>
#include <QTimer>
-namespace KMBox
-{
-
+namespace KMBox {
class MBoxPrivate : public QObject
{
Q_OBJECT
@@ -52,18 +50,17 @@ public Q_SLOTS:
void unlockMBox();
public:
- QByteArray mAppendedEntries;
+ QByteArray mAppendedEntries;
MBoxEntry::List mEntries;
- quint64 mInitialMboxFileSize = 0;
- QString mLockFileName;
- MBox *mMBox = nullptr;
- QFile mMboxFile;
- QTimer mUnlockTimer;
- QRegExp mSeparatorMatcher;
- MBox::LockType mLockType;
- bool mFileLocked = false;
- bool mReadOnly = false;
-
+ quint64 mInitialMboxFileSize = 0;
+ QString mLockFileName;
+ MBox *mMBox = nullptr;
+ QFile mMboxFile;
+ QTimer mUnlockTimer;
+ QRegExp mSeparatorMatcher;
+ MBox::LockType mLockType;
+ bool mFileLocked = false;
+ bool mReadOnly = false;
public: /// Static helper methods
static QByteArray escapeFrom(const QByteArray &msg);
@@ -78,7 +75,6 @@ public: /// Static helper methods
*/
static void unescapeFrom(char *msg, size_t size);
};
-
}
#endif // KMBOX_MBOX_P_H
diff --git a/src/mboxentry.cpp b/src/mboxentry.cpp
index b1bbd66..6c6381e 100644
--- a/src/mboxentry.cpp
+++ b/src/mboxentry.cpp
@@ -54,7 +54,7 @@ MBoxEntry &MBoxEntry::operator=(const MBoxEntry &other)
bool MBoxEntry::operator==(const MBoxEntry &other) const
{
- return (d->mOffset == other.d->mOffset);
+ return d->mOffset == other.d->mOffset;
}
bool MBoxEntry::operator!=(const MBoxEntry &other) const
@@ -64,7 +64,7 @@ bool MBoxEntry::operator!=(const MBoxEntry &other) const
bool MBoxEntry::isValid() const
{
- return ((d->mOffset != 0) && (d->mMessageSize != 0));
+ return (d->mOffset != 0) && (d->mMessageSize != 0);
}
quint64 MBoxEntry::messageOffset() const
diff --git a/src/mboxentry.h b/src/mboxentry.h
index 1b8c7d4..d516191 100644
--- a/src/mboxentry.h
+++ b/src/mboxentry.h
@@ -27,8 +27,7 @@
#include <QPair>
#include <QSharedDataPointer>
-namespace KMBox
-{
+namespace KMBox {
class MBoxEntryPrivate;
/**
* @short A class that encapsulates an entry of a MBox.
@@ -116,7 +115,6 @@ private:
QSharedDataPointer<MBoxEntryPrivate> d;
//@endcond
};
-
}
Q_DECLARE_TYPEINFO(KMBox::MBoxEntry, Q_MOVABLE_TYPE);
diff --git a/src/mboxentry_p.h b/src/mboxentry_p.h
index 17eca68..a064bfb 100644
--- a/src/mboxentry_p.h
+++ b/src/mboxentry_p.h
@@ -22,9 +22,7 @@
#include <QSharedData>
-namespace KMBox
-{
-
+namespace KMBox {
class MBoxEntryPrivate : public QSharedData
{
public:
@@ -44,7 +42,6 @@ public:
quint64 mMessageSize = 0;
quint64 mSeparatorSize = 0;
};
-
}
#endif // KMBOX_MBOXENTRY_P_H
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic