Make local symbols of some leaked names

Unnamed namespaces and static are great tools. Use them.

Change-Id: Ie01831ddac5446fdbdeefffd15468b3acb3ced79
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
Reviewed-by: André Hartmann <aha_1980@gmx.de>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
bb10
Thiago Macieira 2018-07-31 12:36:47 -07:00
parent 95c0b24cd8
commit 9bb27ca6cc
9 changed files with 46 additions and 37 deletions

View File

@ -243,7 +243,7 @@ static bool systemHasStderr()
\internal
\sa systemHasStderr()
*/
bool stderrHasConsoleAttached()
static bool stderrHasConsoleAttached()
{
static const bool stderrHasConsoleAttached = []() -> bool {
if (!systemHasStderr())

View File

@ -126,6 +126,25 @@ QT_BEGIN_NAMESPACE
descendant state the parent was in the last time it was exited.
*/
namespace {
class DefaultStateTransition: public QAbstractTransition
{
Q_OBJECT
public:
DefaultStateTransition(QHistoryState *source, QAbstractState *target);
protected:
// It doesn't matter whether this transition matches any event or not. It is always associated
// with a QHistoryState, and as soon as the state-machine detects that it enters a history
// state, it will handle this transition as a special case. The history state itself is never
// entered either: either the stored configuration will be used, or the target(s) of this
// transition are used.
bool eventTest(QEvent *event) override { Q_UNUSED(event); return false; }
void onTransition(QEvent *event) override { Q_UNUSED(event); }
};
}
QHistoryStatePrivate::QHistoryStatePrivate()
: QAbstractStatePrivate(HistoryState)
, defaultTransition(0)
@ -312,4 +331,4 @@ bool QHistoryState::event(QEvent *e)
QT_END_NAMESPACE
#include "moc_qhistorystate.cpp"
#include "moc_qhistorystate_p.cpp"
#include "qhistorystate.moc"

View File

@ -75,23 +75,6 @@ public:
QList<QAbstractState*> configuration;
};
class DefaultStateTransition: public QAbstractTransition
{
Q_OBJECT
public:
DefaultStateTransition(QHistoryState *source, QAbstractState *target);
protected:
// It doesn't matter whether this transition matches any event or not. It is always associated
// with a QHistoryState, and as soon as the state-machine detects that it enters a history
// state, it will handle this transition as a special case. The history state itself is never
// entered either: either the stored configuration will be used, or the target(s) of this
// transition are used.
bool eventTest(QEvent *event) override { Q_UNUSED(event); return false; }
void onTransition(QEvent *event) override { Q_UNUSED(event); }
};
QT_END_NAMESPACE
#endif // QHISTORYSTATE_P_H

View File

@ -62,6 +62,7 @@ const quint32 BINSHADER_MAGIC = 0x5174;
const quint32 BINSHADER_VERSION = 0x2;
const quint32 BINSHADER_QTVERSION = QT_VERSION;
namespace {
struct GLEnvInfo
{
GLEnvInfo();
@ -70,6 +71,7 @@ struct GLEnvInfo
QByteArray glrenderer;
QByteArray glversion;
};
}
GLEnvInfo::GLEnvInfo()
{

View File

@ -244,7 +244,7 @@ void QTextureFileData::setLogName(const QByteArray &name)
d->logName = name;
}
QByteArray glFormatName(quint32 fmt)
static QByteArray glFormatName(quint32 fmt)
{
const char *id = 0;
#if QT_CONFIG(opengl)

View File

@ -54,6 +54,7 @@ QEglFSDeviceIntegration *qt_egl_device_integration()
#else
namespace {
class DeviceIntegration
{
public:
@ -63,6 +64,7 @@ public:
private:
QEglFSDeviceIntegration *m_integration;
};
}
Q_GLOBAL_STATIC(DeviceIntegration, deviceIntegration)

View File

@ -157,6 +157,7 @@ private:
QByteArray format_atoms;
};
namespace {
class INCRTransaction;
typedef QMap<xcb_window_t,INCRTransaction*> TransactionMap;
static TransactionMap *transactions = 0;
@ -263,6 +264,7 @@ private:
uint offset;
int abort_timer;
};
} // unnamed namespace
const int QXcbClipboard::clipboard_timeout = 5000;

View File

@ -74,6 +74,23 @@
QT_BEGIN_NAMESPACE
namespace {
class CloseButton : public QAbstractButton
{
Q_OBJECT
public:
explicit CloseButton(QWidget *parent = 0);
QSize sizeHint() const override;
QSize minimumSizeHint() const override
{ return sizeHint(); }
void enterEvent(QEvent *event) override;
void leaveEvent(QEvent *event) override;
void paintEvent(QPaintEvent *event) override;
};
}
QMovableTabWidget::QMovableTabWidget(QWidget *parent)
: QWidget(parent)
{
@ -2695,5 +2712,4 @@ void QTabBarPrivate::Tab::TabBarAnimation::updateState(QAbstractAnimation::State
QT_END_NAMESPACE
#include "moc_qtabbar.cpp"
#include "moc_qtabbar_p.cpp"
#include "qtabbar.moc"

View File

@ -271,21 +271,6 @@ public:
};
class CloseButton : public QAbstractButton
{
Q_OBJECT
public:
explicit CloseButton(QWidget *parent = 0);
QSize sizeHint() const override;
QSize minimumSizeHint() const override
{ return sizeHint(); }
void enterEvent(QEvent *event) override;
void leaveEvent(QEvent *event) override;
void paintEvent(QPaintEvent *event) override;
};
QT_END_NAMESPACE
#endif