From db644d10181b5959ae25aa1024cd815dfcb987ea Mon Sep 17 00:00:00 2001 From: Ivailo Monev Date: Sat, 12 Nov 2016 19:58:01 +0000 Subject: [PATCH] various cleanups Signed-off-by: Ivailo Monev --- src/declarative/qml/qdeclarativecomponent.cpp | 3 +-- src/declarative/qml/qdeclarativecomponent.h | 2 +- src/gui/painting/qcolormap_x11.cpp | 23 +++++++++++------------ src/gui/painting/qdrawutil.h | 3 +-- 4 files changed, 14 insertions(+), 17 deletions(-) diff --git a/src/declarative/qml/qdeclarativecomponent.cpp b/src/declarative/qml/qdeclarativecomponent.cpp index b223f2da1..eb264625d 100644 --- a/src/declarative/qml/qdeclarativecomponent.cpp +++ b/src/declarative/qml/qdeclarativecomponent.cpp @@ -770,8 +770,7 @@ QObject *QDeclarativeComponent::beginCreate(QDeclarativeContext *context) return rv; } -QObject * -QDeclarativeComponentPrivate::beginCreate(QDeclarativeContextData *context) +QObject * QDeclarativeComponentPrivate::beginCreate(QDeclarativeContextData *context) { Q_Q(QDeclarativeComponent); if (!context) { diff --git a/src/declarative/qml/qdeclarativecomponent.h b/src/declarative/qml/qdeclarativecomponent.h index 7d8fccb61..5e667267d 100644 --- a/src/declarative/qml/qdeclarativecomponent.h +++ b/src/declarative/qml/qdeclarativecomponent.h @@ -70,7 +70,7 @@ class Q_DECLARATIVE_EXPORT QDeclarativeComponent : public QObject public: QDeclarativeComponent(QObject *parent = Q_NULLPTR); - QDeclarativeComponent(QDeclarativeEngine *, QObject *parent=0); + QDeclarativeComponent(QDeclarativeEngine *, QObject *parent = Q_NULLPTR); QDeclarativeComponent(QDeclarativeEngine *, const QString &fileName, QObject *parent = Q_NULLPTR); QDeclarativeComponent(QDeclarativeEngine *, const QUrl &url, QObject *parent = Q_NULLPTR); virtual ~QDeclarativeComponent(); diff --git a/src/gui/painting/qcolormap_x11.cpp b/src/gui/painting/qcolormap_x11.cpp index e12f150ad..0afb24f90 100644 --- a/src/gui/painting/qcolormap_x11.cpp +++ b/src/gui/painting/qcolormap_x11.cpp @@ -44,7 +44,7 @@ #include "qapplication.h" #include "qdebug.h" #include "qdesktopwidget.h" -#include "qvarlengtharray.h" +#include "qvector.h" #include "qx11info_x11.h" #include @@ -58,7 +58,7 @@ public: QColormapPrivate() : ref(1), mode(QColormap::Direct), depth(0), colormap(0), defaultColormap(true), - visual(0), defaultVisual(true), + visual(Q_NULLPTR), defaultVisual(true), r_max(0), g_max(0), b_max(0), r_shift(0), g_shift(0), b_shift(0) {} @@ -301,14 +301,12 @@ static void init_indexed(QColormapPrivate *d, int screen) query_colormap(d, screen); } -static void init_direct(QColormapPrivate *d, bool ownColormap) +static void init_direct(QColormapPrivate *d) { - if (d->visual->c_class != DirectColor || !ownColormap) + if (d->visual->c_class != DirectColor) return; - // preallocate 768 on the stack, so that we don't have to malloc - // for the common case (<= 24 bpp) - QVarLengthArray colorTable(d->r_max + d->g_max + d->b_max); + QVector colorTable(d->r_max + d->g_max + d->b_max); int i = 0; for (int r = 0; r < d->r_max; ++r) { @@ -335,7 +333,7 @@ static void init_direct(QColormapPrivate *d, bool ownColormap) XStoreColors(X11->display, d->colormap, colorTable.data(), colorTable.count()); } -static QColormap **cmaps = 0; +static QColormap **cmaps = Q_NULLPTR; void QColormap::initialize() { @@ -358,7 +356,7 @@ void QColormap::initialize() d->visual = DefaultVisual(display, i); d->defaultVisual = true; - Visual *argbVisual = 0; + Visual *argbVisual = Q_NULLPTR; if (X11->visual && i == DefaultScreen(display)) { // only use the outside colormap on the default screen @@ -371,7 +369,7 @@ void QColormap::initialize() d->visual = find_visual(display, i, X11->visual_class, X11->visual_id, &d->depth, &d->defaultVisual); } else if (!X11->custom_cmap) { - XStandardColormap *stdcmap = 0; + XStandardColormap *stdcmap = Q_NULLPTR; int ncmaps = 0; #ifndef QT_NO_XRENDER @@ -541,7 +539,8 @@ void QColormap::initialize() init_indexed(d, i); break; case Direct: - init_direct(d, ownColormap); + if (ownColormap) + init_direct(d); break; } @@ -577,7 +576,7 @@ void QColormap::cleanup() delete cmaps[i]; delete [] cmaps; - cmaps = 0; + cmaps = Q_NULLPTR; } diff --git a/src/gui/painting/qdrawutil.h b/src/gui/painting/qdrawutil.h index 90343cd3f..fb4bdc5fb 100644 --- a/src/gui/painting/qdrawutil.h +++ b/src/gui/painting/qdrawutil.h @@ -43,14 +43,13 @@ #define QDRAWUTIL_H #include -#include // char*->QString conversion #include #include + QT_BEGIN_HEADER QT_BEGIN_NAMESPACE - class QPainter; class QPalette; class QPoint; -- 2.11.0