Whitespace cleanup in corelib/ mimetypes, plugin and thread

Done with selective application of clang-format

Change-Id: Iee6bf2426de81356b6d480629ba972f980b6d93d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Allan Sandfeld Jensen 2020-10-20 11:03:48 +02:00
parent 3e09ac369d
commit 1be271713e
28 changed files with 80 additions and 85 deletions

View File

@ -174,7 +174,8 @@ bool QMimeTypeParserBase::parseNumber(QStringView n, int *target, QString *error
} }
#ifndef QT_NO_XMLSTREAMREADER #ifndef QT_NO_XMLSTREAMREADER
struct CreateMagicMatchRuleResult { struct CreateMagicMatchRuleResult
{
QString errorMessage; // must be first QString errorMessage; // must be first
QMimeMagicRule rule; QMimeMagicRule rule;

View File

@ -45,7 +45,6 @@
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
struct Q_CORE_EXPORT QFactoryInterface struct Q_CORE_EXPORT QFactoryInterface
{ {
virtual ~QFactoryInterface(); virtual ~QFactoryInterface();

View File

@ -889,7 +889,6 @@ QLibrary::QLibrary(const QString& fileName, QObject *parent) : QObject(parent)
setFileName(fileName); setFileName(fileName);
} }
/*! /*!
Constructs a library object with the given \a parent that will Constructs a library object with the given \a parent that will
load the library specified by \a fileName and major version number \a verNum. load the library specified by \a fileName and major version number \a verNum.
@ -935,7 +934,6 @@ QLibrary::~QLibrary()
d->release(); d->release();
} }
/*! /*!
\property QLibrary::fileName \property QLibrary::fileName
\brief the file name of the library \brief the file name of the library

View File

@ -92,6 +92,7 @@ public:
void setLoadHints(LoadHints hints); void setLoadHints(LoadHints hints);
LoadHints loadHints() const; LoadHints loadHints() const;
private: private:
enum LoadStatusTag { enum LoadStatusTag {
NotLoaded, NotLoaded,

View File

@ -211,7 +211,6 @@ bool QPluginLoader::load()
return d->loadPlugin(); return d->loadPlugin();
} }
/*! /*!
Unloads the plugin and returns \c true if the plugin could be Unloads the plugin and returns \c true if the plugin could be
unloaded; otherwise returns \c false. unloaded; otherwise returns \c false.

View File

@ -118,7 +118,6 @@ HINSTANCE QSystemLibrary::load(const wchar_t *libraryName, bool onlySystemDirect
return inst; return inst;
} }
return 0; return 0;
} }
QT_END_NAMESPACE QT_END_NAMESPACE

View File

@ -213,7 +213,6 @@ public:
return QUuid::createUuidV5(ns, baseData.toUtf8()); return QUuid::createUuidV5(ns, baseData.toUtf8());
} }
QUuid::Variant variant() const noexcept; QUuid::Variant variant() const noexcept;
QUuid::Version version() const noexcept; QUuid::Version version() const noexcept;

View File

@ -90,7 +90,8 @@ public:
QAtomicInt refCount; QAtomicInt refCount;
int id; int id;
bool ref() { bool ref()
{
Q_ASSERT(refCount.loadRelaxed() >= 0); Q_ASSERT(refCount.loadRelaxed() >= 0);
int c; int c;
do { do {
@ -101,7 +102,8 @@ public:
Q_ASSERT(refCount.loadRelaxed() >= 0); Q_ASSERT(refCount.loadRelaxed() >= 0);
return true; return true;
} }
void deref() { void deref()
{
Q_ASSERT(refCount.loadRelaxed() >= 0); Q_ASSERT(refCount.loadRelaxed() >= 0);
if (!refCount.deref()) if (!refCount.deref())
release(); release();

View File

@ -109,7 +109,8 @@ public:
inline QPostEventList() : QList<QPostEvent>(), recursion(0), startOffset(0), insertionOffset(0) { } inline QPostEventList() : QList<QPostEvent>(), recursion(0), startOffset(0), insertionOffset(0) { }
void addEvent(const QPostEvent &ev) { void addEvent(const QPostEvent &ev)
{
int priority = ev.priority; int priority = ev.priority;
if (isEmpty() || if (isEmpty() ||
constLast().priority >= priority || constLast().priority >= priority ||
@ -125,6 +126,7 @@ public:
insert(at, ev); insert(at, ev);
} }
} }
private: private:
//hides because they do not keep that list sorted. addEvent must be used //hides because they do not keep that list sorted. addEvent must be used
using QList<QPostEvent>::append; using QList<QPostEvent>::append;

View File

@ -51,7 +51,6 @@ QT_REQUIRE_CONFIG(thread);
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
class QThreadPoolPrivate; class QThreadPoolPrivate;
class Q_CORE_EXPORT QThreadPool : public QObject class Q_CORE_EXPORT QThreadPool : public QObject
{ {

View File

@ -65,47 +65,44 @@ QT_BEGIN_NAMESPACE
class QDeadlineTimer; class QDeadlineTimer;
class QueuePage { class QueuePage
{
public: public:
enum { enum {
MaxPageSize = 256 MaxPageSize = 256
}; };
QueuePage(QRunnable *runnable, int pri) QueuePage(QRunnable *runnable, int pri) : m_priority(pri) { push(runnable); }
: m_priority(pri)
bool isFull() { return m_lastIndex >= MaxPageSize - 1; }
bool isFinished() { return m_firstIndex > m_lastIndex; }
void push(QRunnable *runnable)
{ {
push(runnable);
}
bool isFull() {
return m_lastIndex >= MaxPageSize - 1;
}
bool isFinished() {
return m_firstIndex > m_lastIndex;
}
void push(QRunnable *runnable) {
Q_ASSERT(runnable != nullptr); Q_ASSERT(runnable != nullptr);
Q_ASSERT(!isFull()); Q_ASSERT(!isFull());
m_lastIndex += 1; m_lastIndex += 1;
m_entries[m_lastIndex] = runnable; m_entries[m_lastIndex] = runnable;
} }
void skipToNextOrEnd() { void skipToNextOrEnd()
{
while (!isFinished() && m_entries[m_firstIndex] == nullptr) { while (!isFinished() && m_entries[m_firstIndex] == nullptr) {
m_firstIndex += 1; m_firstIndex += 1;
} }
} }
QRunnable *first() { QRunnable *first()
{
Q_ASSERT(!isFinished()); Q_ASSERT(!isFinished());
QRunnable *runnable = m_entries[m_firstIndex]; QRunnable *runnable = m_entries[m_firstIndex];
Q_ASSERT(runnable); Q_ASSERT(runnable);
return runnable; return runnable;
} }
QRunnable *pop() { QRunnable *pop()
{
Q_ASSERT(!isFinished()); Q_ASSERT(!isFinished());
QRunnable *runnable = first(); QRunnable *runnable = first();
Q_ASSERT(runnable); Q_ASSERT(runnable);
@ -120,7 +117,8 @@ public:
return runnable; return runnable;
} }
bool tryTake(QRunnable *runnable) { bool tryTake(QRunnable *runnable)
{
Q_ASSERT(!isFinished()); Q_ASSERT(!isFinished());
for (int i = m_firstIndex; i <= m_lastIndex; i++) { for (int i = m_firstIndex; i <= m_lastIndex; i++) {
if (m_entries[i] == runnable) { if (m_entries[i] == runnable) {
@ -135,9 +133,7 @@ public:
return false; return false;
} }
int priority() const { int priority() const { return m_priority; }
return m_priority;
}
private: private:
int m_priority = 0; int m_priority = 0;

View File

@ -60,8 +60,7 @@
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
namespace QtPrivate namespace QtPrivate {
{
#if defined(Q_OS_INTEGRITY) #if defined(Q_OS_INTEGRITY)
@ -70,6 +69,7 @@ class condition_variable;
class mutex : private QMutex class mutex : private QMutex
{ {
friend class QtPrivate::condition_variable; friend class QtPrivate::condition_variable;
public: public:
// all special member functions are ok! // all special member functions are ok!
// do not expose the (QMutex::Recursive) ctor // do not expose the (QMutex::Recursive) ctor

View File

@ -114,7 +114,8 @@ void qt_abstime_for_timeout(timespec *ts, QDeadlineTimer deadline)
#endif #endif
} }
class QWaitConditionPrivate { class QWaitConditionPrivate
{
public: public:
pthread_mutex_t mutex; pthread_mutex_t mutex;
pthread_cond_t cond; pthread_cond_t cond;
@ -169,7 +170,6 @@ public:
} }
}; };
QWaitCondition::QWaitCondition() QWaitCondition::QWaitCondition()
{ {
d = new QWaitConditionPrivate; d = new QWaitConditionPrivate;
@ -178,7 +178,6 @@ QWaitCondition::QWaitCondition()
d->waiters = d->wakeups = 0; d->waiters = d->wakeups = 0;
} }
QWaitCondition::~QWaitCondition() QWaitCondition::~QWaitCondition()
{ {
report_error(pthread_cond_destroy(&d->cond), "QWaitCondition", "cv destroy"); report_error(pthread_cond_destroy(&d->cond), "QWaitCondition", "cv destroy");

View File

@ -109,7 +109,8 @@ bool QWaitConditionPrivate::wait(QWaitConditionEvent *wce, unsigned long time)
// wait for the event // wait for the event
bool ret = false; bool ret = false;
switch (WaitForSingleObjectEx(wce->event, time, FALSE)) { switch (WaitForSingleObjectEx(wce->event, time, FALSE)) {
default: break; default:
break;
case WAIT_OBJECT_0: case WAIT_OBJECT_0:
ret = true; ret = true;