OSDN Git Service

compiler warning fixes
authorIvailo Monev <xakepa10@gmail.com>
Sat, 4 Jun 2022 20:08:03 +0000 (23:08 +0300)
committerIvailo Monev <xakepa10@gmail.com>
Sat, 4 Jun 2022 20:08:03 +0000 (23:08 +0300)
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
src/declarative/qml/qdeclarativecompiledbindings.cpp
src/declarative/qml/qdeclarativeinclude.cpp
src/declarative/qml/qdeclarativeinclude_p.h
src/declarative/qml/qdeclarativetypeloader.cpp
src/declarative/qml/qdeclarativetypeloader_p.h
src/gui/painting/qtransform.cpp
src/gui/styles/qcleanlooksstyle.cpp
tests/auto/qcheckbox/tst_qcheckbox.cpp
tests/auto/qcolumnview/tst_qcolumnview.cpp
tests/auto/qmainwindow/tst_qmainwindow.cpp
tests/auto/qobject/tst_qobject.cpp

index 1c60c26..034b9c5 100644 (file)
@@ -688,83 +688,6 @@ void QDeclarativeCompiledBindingsPrivate::disconnectOne(
 }
 
 // Conversion functions - these MUST match the QtScript expression path
-inline static qreal toReal(Register *reg, int type, bool *ok = 0)
-{
-    if (ok) *ok = true;
-
-    if (type == QMetaType::QReal) {
-        return reg->getqreal();
-    } else if (type == qMetaTypeId<QVariant>()) {
-        return reg->getvariantptr()->toReal();
-    } else {
-        if (ok) *ok = false;
-        return 0;
-    }
-}
-
-inline static QString toString(Register *reg, int type, bool *ok = 0)
-{
-    if (ok) *ok = true;
-
-    if (type == QMetaType::QReal) {
-        return QString::number(reg->getqreal());
-    } else if (type == QMetaType::Int) {
-        return QString::number(reg->getint());
-    } else if (type == qMetaTypeId<QVariant>()) {
-        return reg->getvariantptr()->toString();
-    } else if (type == QMetaType::QString) {
-        return *reg->getstringptr();
-    } else {
-        if (ok) *ok = false;
-        return QString();
-    }
-}
-
-inline static bool toBool(Register *reg, int type, bool *ok = 0)
-{
-    if (ok) *ok = true;
-
-    if (type == QMetaType::Bool) {
-        return reg->getbool();
-    } else if (type == qMetaTypeId<QVariant>()) {
-        return reg->getvariantptr()->toBool();
-    } else {
-        if (ok) *ok = false;
-        return false;
-    }
-}
-
-inline static QUrl toUrl(Register *reg, int type, QDeclarativeContextData *context, bool *ok = 0)
-{
-    if (ok) *ok = true;
-
-    QUrl base;
-    if (type == qMetaTypeId<QVariant>()) {
-        QVariant *var = reg->getvariantptr();
-        int vt = var->type();
-        if (vt == QVariant::Url) {
-            base = var->toUrl();
-        } else if (vt == QVariant::ByteArray) {
-            base = QUrl(QString::fromUtf8(var->toByteArray()));
-        } else if (vt == QVariant::String) {
-            base = QUrl(var->toString());
-        } else {
-            if (ok) *ok = false;
-            return QUrl();
-        }
-    } else if (type == QMetaType::QString) {
-        base = QUrl(*reg->getstringptr());
-    } else {
-        if (ok) *ok = false;
-        return QUrl();
-    }
-
-    if (!base.isEmpty() && base.isRelative())
-        return context->url.resolved(base);
-    else
-        return base;
-}
-
 static QObject *variantToQObject(const QVariant &value, bool *ok)
 {
     if (ok) *ok = true;
@@ -1010,8 +933,6 @@ void QDeclarativeCompiledBindingsPrivate::run(int instrIndex,
                                               QDeclarativeContextData *context, QDeclarativeDelayedError *error,
                                               QObject *scope, QObject *output, QDeclarativePropertyPrivate::WriteFlags storeFlags)
 {
-    Q_Q(QDeclarativeCompiledBindings);
-
     error->removeError();
 
     Register registers[32];
index c25b4f6..687718d 100644 (file)
@@ -32,7 +32,7 @@ QT_BEGIN_NAMESPACE
 QDeclarativeInclude::QDeclarativeInclude(const QUrl &url, 
                                          QDeclarativeEngine *engine, 
                                          QScriptContext *ctxt)
-    : QObject(engine), m_engine(engine), m_url(url)
+    : QObject(engine), m_url(url)
 {
     QDeclarativeEnginePrivate *ep = QDeclarativeEnginePrivate::get(engine);
     m_context = ep->contextClass->contextFromValue(QScriptDeclarativeClass::scopeChainValue(ctxt, -3));
index cf7f607..3b0593f 100644 (file)
@@ -71,7 +71,6 @@ public:
     static QScriptValue worker_include(QScriptContext *ctxt, QScriptEngine *engine);
 
 private:
-    QDeclarativeEngine *m_engine;
     QScriptEngine *m_scriptEngine;
 
     QUrl m_url;
index 615cb59..0b56ab6 100644 (file)
@@ -106,7 +106,7 @@ Create a new QDeclarativeDataBlob for \a url and of the provided \a type.
 */
 QDeclarativeDataBlob::QDeclarativeDataBlob(const QUrl &url, Type type)
 : m_type(type), m_status(Null), m_progress(0), m_url(url), m_finalUrl(url), m_manager(0),
-  m_redirectCount(0), m_inCallback(false), m_isDone(false)
+  m_inCallback(false), m_isDone(false)
 {
 }
 
index 4fc96f8..caddcaf 100644 (file)
@@ -126,9 +126,8 @@ private:
 
     // Manager that is currently fetching data for me
     QDeclarativeDataLoader *m_manager;
-    int m_redirectCount:30;
-    bool m_inCallback:1;
-    bool m_isDone:1;
+    bool m_inCallback;
+    bool m_isDone;
 
     QList<QDeclarativeError> m_errors;
 };
index 64fe846..47e6828 100644 (file)
@@ -390,7 +390,7 @@ QTransform &QTransform::translate(qreal dx, qreal dy)
     if (dx == 0 && dy == 0)
         return *this;
 #ifndef QT_NO_DEBUG
-    if (qIsNaN(dx) | qIsNaN(dy)) {
+    if (qIsNaN(dx) || qIsNaN(dy)) {
         qWarning() << "QTransform::translate with NaN called";
         return *this;
     }
@@ -433,7 +433,7 @@ QTransform &QTransform::translate(qreal dx, qreal dy)
 QTransform QTransform::fromTranslate(qreal dx, qreal dy)
 {
 #ifndef QT_NO_DEBUG
-    if (qIsNaN(dx) | qIsNaN(dy)) {
+    if (qIsNaN(dx) || qIsNaN(dy)) {
         qWarning() << "QTransform::fromTranslate with NaN called";
         return QTransform();
 }
@@ -458,7 +458,7 @@ QTransform & QTransform::scale(qreal sx, qreal sy)
     if (sx == 1 && sy == 1)
         return *this;
 #ifndef QT_NO_DEBUG
-    if (qIsNaN(sx) | qIsNaN(sy)) {
+    if (qIsNaN(sx) || qIsNaN(sy)) {
         qWarning() << "QTransform::scale with NaN called";
         return *this;
     }
@@ -499,7 +499,7 @@ QTransform & QTransform::scale(qreal sx, qreal sy)
 QTransform QTransform::fromScale(qreal sx, qreal sy)
 {
 #ifndef QT_NO_DEBUG
-    if (qIsNaN(sx) | qIsNaN(sy)) {
+    if (qIsNaN(sx) || qIsNaN(sy)) {
         qWarning() << "QTransform::fromScale with NaN called";
         return QTransform();
 }
@@ -524,7 +524,7 @@ QTransform & QTransform::shear(qreal sh, qreal sv)
     if (sh == 0 && sv == 0)
         return *this;
 #ifndef QT_NO_DEBUG
-    if (qIsNaN(sh) | qIsNaN(sv)) {
+    if (qIsNaN(sh) || qIsNaN(sv)) {
         qWarning() << "QTransform::shear with NaN called";
         return *this;
     }
index 552dc9d..8a4330c 100644 (file)
@@ -100,7 +100,6 @@ static void qt_cleanlooks_draw_buttongradient(QPainter *painter, const QRect &re
                                                 const QColor &gradientMid, const QColor &gradientStop, QBrush bgBrush)
 {
         int x = rect.center().x();
-        int y = rect.center().y();
         QLinearGradient *gradient = new QLinearGradient(x, rect.top(), x, rect.bottom());
         if (bgBrush.gradient())
             gradient->setStops(bgBrush.gradient()->stops());
index c7debc6..64c2ecc 100644 (file)
@@ -87,9 +87,7 @@ private:
     uint press_count;
     uint release_count;
     int cur_state;
-    uint tmp;
     QCheckBox *testWidget;
-    uint tmp2;
 };
 
 tst_QCheckBox::tst_QCheckBox()
index 13fdd95..637613d 100644 (file)
@@ -151,7 +151,7 @@ public:
         QColumnView::setSelection(rect, command);
     }
 
-    QRegion visualRegionForSelection(QItemSelection selection){
+    QRegion visualRegionForSelection(const QItemSelection &selection) const {
         return QColumnView::visualRegionForSelection(selection);
     }
 protected:
index 359088c..bec9d62 100644 (file)
@@ -463,7 +463,6 @@ void tst_QMainWindow::iconSize()
 
         // the default is determined by the style
         const int metric = mw.style()->pixelMetric(QStyle::PM_ToolBarIconSize);
-        const QSize defaultIconSize = QSize(metric, metric);
         const QSize smallIconSize = QSize(metric / 2, metric / 2);
         const QSize largeIconSize = QSize(metric * 2, metric * 2);
 
index aaed61c..6f3b379 100644 (file)
@@ -3561,6 +3561,8 @@ void tst_QObject::disconnectByMetaMethod()
     connect(s, signal2, r2, slot2);
     connect(s, signal3, r1, slot3);
     connect(s, signal3, r2, slot3);
+    connect(s, signal4, r1, slot4);
+    connect(s, signal4, r2, slot4);
 
     // disconnect signal1() from all receivers
     QObject::disconnect(s, signal1, 0, QMetaMethod());