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:
parent
3e09ac369d
commit
1be271713e
@ -131,7 +131,7 @@ QMimeTypeParserBase::ParseState QMimeTypeParserBase::nextState(ParseState curren
|
||||
case ParseMagicMatchRule:
|
||||
if (startElement == QLatin1String(mimeTypeTagC)) // Sequence of <mime-type>
|
||||
return ParseMimeType;
|
||||
if (startElement == QLatin1String(commentTagC ))
|
||||
if (startElement == QLatin1String(commentTagC))
|
||||
return ParseComment;
|
||||
if (startElement == QLatin1String(genericIconTagC))
|
||||
return ParseGenericIcon;
|
||||
@ -174,7 +174,8 @@ bool QMimeTypeParserBase::parseNumber(QStringView n, int *target, QString *error
|
||||
}
|
||||
|
||||
#ifndef QT_NO_XMLSTREAMREADER
|
||||
struct CreateMagicMatchRuleResult {
|
||||
struct CreateMagicMatchRuleResult
|
||||
{
|
||||
QString errorMessage; // must be first
|
||||
QMimeMagicRule rule;
|
||||
|
||||
|
@ -69,7 +69,7 @@ int QElfParser::parse(const char *dataStart, ulong fdlen, const QString &library
|
||||
qDebug() << "QElfParser::parse " << library;
|
||||
#endif
|
||||
|
||||
if (fdlen < 64){
|
||||
if (fdlen < 64) {
|
||||
if (lib)
|
||||
lib->errorString = QLibrary::tr("'%1' is not an ELF object (%2)").arg(library, QLibrary::tr("file too small"));
|
||||
return NotElf;
|
||||
@ -129,7 +129,7 @@ int QElfParser::parse(const char *dataStart, ulong fdlen, const QString &library
|
||||
|
||||
qelfhalf_t e_shentsize = read<qelfhalf_t> (data);
|
||||
|
||||
if (e_shentsize % 4){
|
||||
if (e_shentsize % 4) {
|
||||
if (lib)
|
||||
lib->errorString = QLibrary::tr("'%1' is an invalid ELF object (%2)").arg(library, QLibrary::tr("unexpected e_shentsize"));
|
||||
return Corrupt;
|
||||
|
@ -56,7 +56,7 @@
|
||||
|
||||
QT_REQUIRE_CONFIG(library);
|
||||
|
||||
#if defined (Q_OF_ELF) && defined(Q_CC_GNU)
|
||||
#if defined(Q_OF_ELF) && defined(Q_CC_GNU)
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
@ -72,7 +72,7 @@ class QElfParser
|
||||
{
|
||||
public:
|
||||
enum { QtMetaDataSection, NoQtSection, NotElf, Corrupt };
|
||||
enum {ElfLittleEndian = 0, ElfBigEndian = 1};
|
||||
enum { ElfLittleEndian = 0, ElfBigEndian = 1 };
|
||||
|
||||
struct ElfSectionHeader
|
||||
{
|
||||
|
@ -45,7 +45,6 @@
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
|
||||
struct Q_CORE_EXPORT QFactoryInterface
|
||||
{
|
||||
virtual ~QFactoryInterface();
|
||||
|
@ -141,7 +141,7 @@ class QFactoryLoaderPrivate : public QObjectPrivate
|
||||
{
|
||||
Q_DECLARE_PUBLIC(QFactoryLoader)
|
||||
public:
|
||||
QFactoryLoaderPrivate(){}
|
||||
QFactoryLoaderPrivate() { }
|
||||
QByteArray iid;
|
||||
#if QT_CONFIG(library)
|
||||
~QFactoryLoaderPrivate();
|
||||
|
@ -286,7 +286,7 @@ static bool findPatternUnloaded(const QString &library, QLibraryPrivate *lib)
|
||||
pos += rel;
|
||||
hasMetaData = true;
|
||||
}
|
||||
#elif defined (Q_OF_MACH_O)
|
||||
#elif defined(Q_OF_MACH_O)
|
||||
{
|
||||
QString errorString;
|
||||
int r = QMachOParser::parse(filedata, fdlen, library, &errorString, &pos, &fdlen);
|
||||
@ -382,7 +382,7 @@ private:
|
||||
static inline QLibraryStore *instance();
|
||||
|
||||
// all members and instance() are protected by qt_library_mutex
|
||||
typedef QMap<QString, QLibraryPrivate*> LibraryMap;
|
||||
typedef QMap<QString, QLibraryPrivate *> LibraryMap;
|
||||
LibraryMap libraryMap;
|
||||
};
|
||||
|
||||
@ -608,8 +608,8 @@ bool QLibraryPrivate::unload(UnloadFlag flag)
|
||||
if (qt_debug_component())
|
||||
qWarning() << "QLibraryPrivate::unload succeeded on" << fileName
|
||||
<< (flag == NoUnloadSys ? "(faked)" : "");
|
||||
//when the library is unloaded, we release the reference on it so that 'this'
|
||||
//can get deleted
|
||||
// when the library is unloaded, we release the reference on it so that 'this'
|
||||
// can get deleted
|
||||
libraryRefCount.deref();
|
||||
pHnd.storeRelaxed(nullptr);
|
||||
instanceFactory.storeRelaxed(nullptr);
|
||||
@ -772,7 +772,7 @@ void QLibraryPrivate::updatePluginState()
|
||||
}
|
||||
|
||||
if (!success) {
|
||||
if (errorString.isEmpty()){
|
||||
if (errorString.isEmpty()) {
|
||||
if (fileName.isEmpty())
|
||||
errorString = QLibrary::tr("The shared library was not found.");
|
||||
else
|
||||
@ -884,12 +884,11 @@ QLibrary::QLibrary(QObject *parent) : QObject(parent)
|
||||
suffix in accordance with the platform, e.g. ".so" on Unix,
|
||||
".dylib" on \macos and iOS, and ".dll" on Windows. (See \l{fileName}.)
|
||||
*/
|
||||
QLibrary::QLibrary(const QString& fileName, QObject *parent) : QObject(parent)
|
||||
QLibrary::QLibrary(const QString &fileName, QObject *parent) : QObject(parent)
|
||||
{
|
||||
setFileName(fileName);
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
Constructs a library object with the given \a parent that will
|
||||
load the library specified by \a fileName and major version number \a verNum.
|
||||
@ -900,7 +899,7 @@ QLibrary::QLibrary(const QString& fileName, QObject *parent) : QObject(parent)
|
||||
suffix in accordance with the platform, e.g. ".so" on Unix,
|
||||
".dylib" on \macos and iOS, and ".dll" on Windows. (See \l{fileName}.)
|
||||
*/
|
||||
QLibrary::QLibrary(const QString& fileName, int verNum, QObject *parent) : QObject(parent)
|
||||
QLibrary::QLibrary(const QString &fileName, int verNum, QObject *parent) : QObject(parent)
|
||||
{
|
||||
setFileNameAndVersion(fileName, verNum);
|
||||
}
|
||||
@ -915,7 +914,7 @@ QLibrary::QLibrary(const QString& fileName, int verNum, QObject *parent) : QObje
|
||||
suffix in accordance with the platform, e.g. ".so" on Unix,
|
||||
".dylib" on \macos and iOS, and ".dll" on Windows. (See \l{fileName}.)
|
||||
*/
|
||||
QLibrary::QLibrary(const QString& fileName, const QString &version, QObject *parent)
|
||||
QLibrary::QLibrary(const QString &fileName, const QString &version, QObject *parent)
|
||||
: QObject(parent)
|
||||
{
|
||||
setFileNameAndVersion(fileName, version);
|
||||
@ -935,7 +934,6 @@ QLibrary::~QLibrary()
|
||||
d->release();
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
\property QLibrary::fileName
|
||||
\brief the file name of the library
|
||||
|
@ -67,9 +67,9 @@ public:
|
||||
Q_FLAG(LoadHints)
|
||||
|
||||
explicit QLibrary(QObject *parent = nullptr);
|
||||
explicit QLibrary(const QString& fileName, QObject *parent = nullptr);
|
||||
explicit QLibrary(const QString& fileName, int verNum, QObject *parent = nullptr);
|
||||
explicit QLibrary(const QString& fileName, const QString &version, QObject *parent = nullptr);
|
||||
explicit QLibrary(const QString &fileName, QObject *parent = nullptr);
|
||||
explicit QLibrary(const QString &fileName, int verNum, QObject *parent = nullptr);
|
||||
explicit QLibrary(const QString &fileName, const QString &version, QObject *parent = nullptr);
|
||||
~QLibrary();
|
||||
|
||||
QFunctionPointer resolve(const char *symbol);
|
||||
@ -92,6 +92,7 @@ public:
|
||||
|
||||
void setLoadHints(LoadHints hints);
|
||||
LoadHints loadHints() const;
|
||||
|
||||
private:
|
||||
enum LoadStatusTag {
|
||||
NotLoaded,
|
||||
|
@ -61,10 +61,10 @@ QT_BEGIN_NAMESPACE
|
||||
static QString qdlerror()
|
||||
{
|
||||
const char *err = dlerror();
|
||||
return err ? QLatin1Char('(') + QString::fromLocal8Bit(err) + QLatin1Char(')'): QString();
|
||||
return err ? QLatin1Char('(') + QString::fromLocal8Bit(err) + QLatin1Char(')') : QString();
|
||||
}
|
||||
|
||||
QStringList QLibraryPrivate::suffixes_sys(const QString& fullVersion)
|
||||
QStringList QLibraryPrivate::suffixes_sys(const QString &fullVersion)
|
||||
{
|
||||
QStringList suffixes;
|
||||
#if defined(Q_OS_HPUX)
|
||||
@ -266,7 +266,7 @@ bool QLibraryPrivate::load_sys()
|
||||
QByteArray utf8Bundle = fileName.toUtf8();
|
||||
QCFType<CFURLRef> bundleUrl = CFURLCreateFromFileSystemRepresentation(NULL, reinterpret_cast<const UInt8*>(utf8Bundle.data()), utf8Bundle.length(), true);
|
||||
QCFType<CFBundleRef> bundle = CFBundleCreate(NULL, bundleUrl);
|
||||
if(bundle) {
|
||||
if (bundle) {
|
||||
QCFType<CFURLRef> url = CFBundleCopyExecutableURL(bundle);
|
||||
char executableFile[FILENAME_MAX];
|
||||
CFURLGetFileSystemRepresentation(url, true, reinterpret_cast<UInt8*>(executableFile), FILENAME_MAX);
|
||||
@ -320,7 +320,7 @@ Q_CORE_EXPORT QFunctionPointer qt_mac_resolve_sys(void *handle, const char *symb
|
||||
}
|
||||
#endif
|
||||
|
||||
QFunctionPointer QLibraryPrivate::resolve_sys(const char* symbol)
|
||||
QFunctionPointer QLibraryPrivate::resolve_sys(const char *symbol)
|
||||
{
|
||||
QFunctionPointer address = QFunctionPointer(dlsym(pHnd.loadAcquire(), symbol));
|
||||
return address;
|
||||
|
@ -147,7 +147,7 @@ bool QLibraryPrivate::unload_sys()
|
||||
return true;
|
||||
}
|
||||
|
||||
QFunctionPointer QLibraryPrivate::resolve_sys(const char* symbol)
|
||||
QFunctionPointer QLibraryPrivate::resolve_sys(const char *symbol)
|
||||
{
|
||||
FARPROC address = GetProcAddress(pHnd.loadAcquire(), symbol);
|
||||
return QFunctionPointer(address);
|
||||
|
@ -211,7 +211,6 @@ bool QPluginLoader::load()
|
||||
return d->loadPlugin();
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
Unloads the plugin and returns \c true if the plugin could be
|
||||
unloaded; otherwise returns \c false.
|
||||
@ -234,7 +233,7 @@ bool QPluginLoader::unload()
|
||||
did_load = false;
|
||||
return d->unload();
|
||||
}
|
||||
if (d) // Ouch
|
||||
if (d) // Ouch
|
||||
d->errorString = tr("The plugin was not loaded.");
|
||||
return false;
|
||||
}
|
||||
@ -347,7 +346,7 @@ void QPluginLoader::setFileName(const QString &fileName)
|
||||
#else
|
||||
if (qt_debug_component()) {
|
||||
qWarning("Cannot load %s into a statically linked Qt library.",
|
||||
(const char*)QFile::encodeName(fileName));
|
||||
(const char *)QFile::encodeName(fileName));
|
||||
}
|
||||
Q_UNUSED(fileName);
|
||||
#endif
|
||||
|
@ -100,4 +100,4 @@ public:
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif //QPLUGINLOADER_H
|
||||
#endif // QPLUGINLOADER_H
|
||||
|
@ -118,7 +118,6 @@ HINSTANCE QSystemLibrary::load(const wchar_t *libraryName, bool onlySystemDirect
|
||||
return inst;
|
||||
}
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
@ -110,6 +110,6 @@ private:
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif //Q_OS_WIN
|
||||
#endif // Q_OS_WIN
|
||||
|
||||
#endif //QSYSTEMLIBRARY_P_H
|
||||
#endif // QSYSTEMLIBRARY_P_H
|
||||
|
@ -58,7 +58,7 @@ void _q_toHex(char *&dst, Integral value)
|
||||
{
|
||||
value = qToBigEndian(value);
|
||||
|
||||
const char* p = reinterpret_cast<const char*>(&value);
|
||||
const char *p = reinterpret_cast<const char *>(&value);
|
||||
|
||||
for (uint i = 0; i < sizeof(Integral); ++i, dst += 2) {
|
||||
dst[0] = QtMiscUtils::toHexLower((p[i] >> 4) & 0xf);
|
||||
@ -646,7 +646,7 @@ QString QUuid::toString(QUuid::StringFormat mode) const
|
||||
QByteArray QUuid::toByteArray(QUuid::StringFormat mode) const
|
||||
{
|
||||
QByteArray result(MaxStringUuidLength, Qt::Uninitialized);
|
||||
const auto end = _q_uuidToHex(*this, const_cast<char*>(result.constData()), mode);
|
||||
const auto end = _q_uuidToHex(*this, const_cast<char *>(result.constData()), mode);
|
||||
result.resize(end - result.constData());
|
||||
return result;
|
||||
}
|
||||
@ -687,7 +687,7 @@ QByteArray QUuid::toRfc4122() const
|
||||
{
|
||||
// we know how many bytes a UUID has, I hope :)
|
||||
QByteArray bytes(16, Qt::Uninitialized);
|
||||
uchar *data = reinterpret_cast<uchar*>(bytes.data());
|
||||
uchar *data = reinterpret_cast<uchar *>(bytes.data());
|
||||
|
||||
qToBigEndian(data1, data);
|
||||
data += sizeof(quint32);
|
||||
@ -717,7 +717,7 @@ QDataStream &operator<<(QDataStream &s, const QUuid &id)
|
||||
} else {
|
||||
// we know how many bytes a UUID has, I hope :)
|
||||
bytes = QByteArray(16, Qt::Uninitialized);
|
||||
uchar *data = reinterpret_cast<uchar*>(bytes.data());
|
||||
uchar *data = reinterpret_cast<uchar *>(bytes.data());
|
||||
|
||||
qToLittleEndian(id.data1, data);
|
||||
data += sizeof(quint32);
|
||||
|
@ -104,7 +104,7 @@ public:
|
||||
data1 = 0;
|
||||
data2 = 0;
|
||||
data3 = 0;
|
||||
for(int i = 0; i < 8; i++)
|
||||
for (int i = 0; i < 8; i++)
|
||||
data4[i] = 0;
|
||||
}
|
||||
QUuid(uint l, ushort w1, ushort w2, uchar b1, uchar b2, uchar b3, uchar b4, uchar b5, uchar b6, uchar b7, uchar b8) noexcept
|
||||
@ -169,7 +169,7 @@ public:
|
||||
data1 = guid.Data1;
|
||||
data2 = guid.Data2;
|
||||
data3 = guid.Data3;
|
||||
for(int i = 0; i < 8; i++)
|
||||
for (int i = 0; i < 8; i++)
|
||||
data4[i] = guid.Data4[i];
|
||||
}
|
||||
#endif
|
||||
@ -213,7 +213,6 @@ public:
|
||||
return QUuid::createUuidV5(ns, baseData.toUtf8());
|
||||
}
|
||||
|
||||
|
||||
QUuid::Variant variant() const noexcept;
|
||||
QUuid::Version version() const noexcept;
|
||||
|
||||
|
@ -105,7 +105,7 @@ public:
|
||||
}
|
||||
|
||||
protected:
|
||||
QList<QFuture<T> > m_futures;
|
||||
QList<QFuture<T>> m_futures;
|
||||
bool m_cancelOnWait;
|
||||
};
|
||||
|
||||
|
@ -90,7 +90,8 @@ public:
|
||||
QAtomicInt refCount;
|
||||
int id;
|
||||
|
||||
bool ref() {
|
||||
bool ref()
|
||||
{
|
||||
Q_ASSERT(refCount.loadRelaxed() >= 0);
|
||||
int c;
|
||||
do {
|
||||
@ -101,7 +102,8 @@ public:
|
||||
Q_ASSERT(refCount.loadRelaxed() >= 0);
|
||||
return true;
|
||||
}
|
||||
void deref() {
|
||||
void deref()
|
||||
{
|
||||
Q_ASSERT(refCount.loadRelaxed() >= 0);
|
||||
if (!refCount.deref())
|
||||
release();
|
||||
|
@ -858,7 +858,7 @@ bool QThread::wait(QDeadlineTimer deadline)
|
||||
return false;
|
||||
}
|
||||
|
||||
bool QThread::event(QEvent* event)
|
||||
bool QThread::event(QEvent *event)
|
||||
{
|
||||
return QObject::event(event);
|
||||
}
|
||||
|
@ -109,7 +109,8 @@ public:
|
||||
|
||||
inline QPostEventList() : QList<QPostEvent>(), recursion(0), startOffset(0), insertionOffset(0) { }
|
||||
|
||||
void addEvent(const QPostEvent &ev) {
|
||||
void addEvent(const QPostEvent &ev)
|
||||
{
|
||||
int priority = ev.priority;
|
||||
if (isEmpty() ||
|
||||
constLast().priority >= priority ||
|
||||
@ -125,6 +126,7 @@ public:
|
||||
insert(at, ev);
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
//hides because they do not keep that list sorted. addEvent must be used
|
||||
using QList<QPostEvent>::append;
|
||||
@ -176,7 +178,7 @@ public:
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
static unsigned int __stdcall start(void *) noexcept;
|
||||
static void finish(void *, bool lockAnyway=true) noexcept;
|
||||
static void finish(void *, bool lockAnyway = true) noexcept;
|
||||
|
||||
Qt::HANDLE handle;
|
||||
unsigned int id;
|
||||
@ -215,7 +217,7 @@ public:
|
||||
QThreadData *data;
|
||||
bool running = false;
|
||||
|
||||
static void setCurrentThread(QThread*) {}
|
||||
static void setCurrentThread(QThread *) { }
|
||||
static QThread *threadForId(int) { return QThread::currentThread(); }
|
||||
static QAbstractEventDispatcher *createEventDispatcher(QThreadData *data);
|
||||
|
||||
@ -265,7 +267,7 @@ public:
|
||||
static const uint Count = 2;
|
||||
|
||||
uint idx;
|
||||
const char* locations[Count];
|
||||
const char *locations[Count];
|
||||
|
||||
public:
|
||||
FlaggedDebugSignatures() : idx(0)
|
||||
|
@ -235,7 +235,7 @@ void QAdoptedThread::init()
|
||||
*/
|
||||
|
||||
extern "C" {
|
||||
typedef void*(*QtThreadCallback)(void*);
|
||||
typedef void *(*QtThreadCallback)(void *);
|
||||
}
|
||||
|
||||
#endif // QT_CONFIG(thread)
|
||||
|
@ -258,7 +258,7 @@ bool QThreadPoolPrivate::tooManyThreadsActive() const
|
||||
void QThreadPoolPrivate::startThread(QRunnable *runnable)
|
||||
{
|
||||
Q_ASSERT(runnable != nullptr);
|
||||
QScopedPointer <QThreadPoolThread> thread(new QThreadPoolThread(this));
|
||||
QScopedPointer<QThreadPoolThread> thread(new QThreadPoolThread(this));
|
||||
thread->setObjectName(QLatin1String("Thread (pooled)"));
|
||||
Q_ASSERT(!allThreads.contains(thread.data())); // if this assert hits, we have an ABA problem (deleted threads don't get removed here)
|
||||
allThreads.insert(thread.data());
|
||||
@ -282,7 +282,7 @@ void QThreadPoolPrivate::reset()
|
||||
waitingThreads.clear();
|
||||
mutex.unlock();
|
||||
|
||||
for (QThreadPoolThread *thread: qAsConst(allThreadsCopy)) {
|
||||
for (QThreadPoolThread *thread : qAsConst(allThreadsCopy)) {
|
||||
if (!thread->isFinished()) {
|
||||
thread->runnableReady.wakeAll();
|
||||
thread->wait();
|
||||
|
@ -51,7 +51,6 @@ QT_REQUIRE_CONFIG(thread);
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
|
||||
class QThreadPoolPrivate;
|
||||
class Q_CORE_EXPORT QThreadPool : public QObject
|
||||
{
|
||||
|
@ -65,47 +65,44 @@ QT_BEGIN_NAMESPACE
|
||||
|
||||
class QDeadlineTimer;
|
||||
|
||||
class QueuePage {
|
||||
class QueuePage
|
||||
{
|
||||
public:
|
||||
enum {
|
||||
MaxPageSize = 256
|
||||
};
|
||||
|
||||
QueuePage(QRunnable *runnable, int pri)
|
||||
: m_priority(pri)
|
||||
QueuePage(QRunnable *runnable, int pri) : m_priority(pri) { push(runnable); }
|
||||
|
||||
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(!isFull());
|
||||
m_lastIndex += 1;
|
||||
m_entries[m_lastIndex] = runnable;
|
||||
}
|
||||
|
||||
void skipToNextOrEnd() {
|
||||
void skipToNextOrEnd()
|
||||
{
|
||||
while (!isFinished() && m_entries[m_firstIndex] == nullptr) {
|
||||
m_firstIndex += 1;
|
||||
}
|
||||
}
|
||||
|
||||
QRunnable *first() {
|
||||
QRunnable *first()
|
||||
{
|
||||
Q_ASSERT(!isFinished());
|
||||
QRunnable *runnable = m_entries[m_firstIndex];
|
||||
Q_ASSERT(runnable);
|
||||
return runnable;
|
||||
}
|
||||
|
||||
QRunnable *pop() {
|
||||
QRunnable *pop()
|
||||
{
|
||||
Q_ASSERT(!isFinished());
|
||||
QRunnable *runnable = first();
|
||||
Q_ASSERT(runnable);
|
||||
@ -120,7 +117,8 @@ public:
|
||||
return runnable;
|
||||
}
|
||||
|
||||
bool tryTake(QRunnable *runnable) {
|
||||
bool tryTake(QRunnable *runnable)
|
||||
{
|
||||
Q_ASSERT(!isFinished());
|
||||
for (int i = m_firstIndex; i <= m_lastIndex; i++) {
|
||||
if (m_entries[i] == runnable) {
|
||||
@ -135,9 +133,7 @@ public:
|
||||
return false;
|
||||
}
|
||||
|
||||
int priority() const {
|
||||
return m_priority;
|
||||
}
|
||||
int priority() const { return m_priority; }
|
||||
|
||||
private:
|
||||
int m_priority = 0;
|
||||
|
@ -209,7 +209,7 @@ public:
|
||||
return qThreadStorage_hasLocalData(data);
|
||||
}
|
||||
|
||||
inline T& localData()
|
||||
inline T &localData()
|
||||
{
|
||||
if (!data)
|
||||
data.reset(new T());
|
||||
|
@ -73,7 +73,7 @@ public:
|
||||
private:
|
||||
Q_DISABLE_COPY(QWaitCondition)
|
||||
|
||||
QWaitConditionPrivate * d;
|
||||
QWaitConditionPrivate *d;
|
||||
};
|
||||
|
||||
#else
|
||||
|
@ -60,8 +60,7 @@
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
namespace QtPrivate
|
||||
{
|
||||
namespace QtPrivate {
|
||||
|
||||
#if defined(Q_OS_INTEGRITY)
|
||||
|
||||
@ -70,6 +69,7 @@ class condition_variable;
|
||||
class mutex : private QMutex
|
||||
{
|
||||
friend class QtPrivate::condition_variable;
|
||||
|
||||
public:
|
||||
// all special member functions are ok!
|
||||
// do not expose the (QMutex::Recursive) ctor
|
||||
|
@ -114,7 +114,8 @@ void qt_abstime_for_timeout(timespec *ts, QDeadlineTimer deadline)
|
||||
#endif
|
||||
}
|
||||
|
||||
class QWaitConditionPrivate {
|
||||
class QWaitConditionPrivate
|
||||
{
|
||||
public:
|
||||
pthread_mutex_t mutex;
|
||||
pthread_cond_t cond;
|
||||
@ -169,7 +170,6 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
QWaitCondition::QWaitCondition()
|
||||
{
|
||||
d = new QWaitConditionPrivate;
|
||||
@ -178,7 +178,6 @@ QWaitCondition::QWaitCondition()
|
||||
d->waiters = d->wakeups = 0;
|
||||
}
|
||||
|
||||
|
||||
QWaitCondition::~QWaitCondition()
|
||||
{
|
||||
report_error(pthread_cond_destroy(&d->cond), "QWaitCondition", "cv destroy");
|
||||
@ -211,7 +210,7 @@ bool QWaitCondition::wait(QMutex *mutex, unsigned long time)
|
||||
|
||||
bool QWaitCondition::wait(QMutex *mutex, QDeadlineTimer deadline)
|
||||
{
|
||||
if (! mutex)
|
||||
if (!mutex)
|
||||
return false;
|
||||
|
||||
report_error(pthread_mutex_lock(&d->mutex), "QWaitCondition::wait()", "mutex lock");
|
||||
|
@ -45,7 +45,7 @@
|
||||
#include "qlist.h"
|
||||
#include "qalgorithms.h"
|
||||
|
||||
#define Q_MUTEX_T void*
|
||||
#define Q_MUTEX_T void *
|
||||
#include <private/qmutex_p.h>
|
||||
#include <private/qreadwritelock_p.h>
|
||||
#include <qt_windows.h>
|
||||
@ -87,7 +87,7 @@ QWaitConditionEvent *QWaitConditionPrivate::pre()
|
||||
{
|
||||
mtx.lock();
|
||||
QWaitConditionEvent *wce =
|
||||
freeQueue.isEmpty() ? new QWaitConditionEvent : freeQueue.takeFirst();
|
||||
freeQueue.isEmpty() ? new QWaitConditionEvent : freeQueue.takeFirst();
|
||||
wce->priority = GetThreadPriority(GetCurrentThread());
|
||||
wce->wokenUp = false;
|
||||
|
||||
@ -109,7 +109,8 @@ bool QWaitConditionPrivate::wait(QWaitConditionEvent *wce, unsigned long time)
|
||||
// wait for the event
|
||||
bool ret = false;
|
||||
switch (WaitForSingleObjectEx(wce->event, time, FALSE)) {
|
||||
default: break;
|
||||
default:
|
||||
break;
|
||||
|
||||
case WAIT_OBJECT_0:
|
||||
ret = true;
|
||||
|
Loading…
Reference in New Issue
Block a user