compiler warning fixes

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2022-06-04 23:08:03 +03:00
parent 39d024c581
commit 9b9a8d3d1a
11 changed files with 12 additions and 95 deletions

View file

@ -688,83 +688,6 @@ void QDeclarativeCompiledBindingsPrivate::disconnectOne(
} }
// Conversion functions - these MUST match the QtScript expression path // 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) static QObject *variantToQObject(const QVariant &value, bool *ok)
{ {
if (ok) *ok = true; if (ok) *ok = true;
@ -1010,8 +933,6 @@ void QDeclarativeCompiledBindingsPrivate::run(int instrIndex,
QDeclarativeContextData *context, QDeclarativeDelayedError *error, QDeclarativeContextData *context, QDeclarativeDelayedError *error,
QObject *scope, QObject *output, QDeclarativePropertyPrivate::WriteFlags storeFlags) QObject *scope, QObject *output, QDeclarativePropertyPrivate::WriteFlags storeFlags)
{ {
Q_Q(QDeclarativeCompiledBindings);
error->removeError(); error->removeError();
Register registers[32]; Register registers[32];

View file

@ -32,7 +32,7 @@ QT_BEGIN_NAMESPACE
QDeclarativeInclude::QDeclarativeInclude(const QUrl &url, QDeclarativeInclude::QDeclarativeInclude(const QUrl &url,
QDeclarativeEngine *engine, QDeclarativeEngine *engine,
QScriptContext *ctxt) QScriptContext *ctxt)
: QObject(engine), m_engine(engine), m_url(url) : QObject(engine), m_url(url)
{ {
QDeclarativeEnginePrivate *ep = QDeclarativeEnginePrivate::get(engine); QDeclarativeEnginePrivate *ep = QDeclarativeEnginePrivate::get(engine);
m_context = ep->contextClass->contextFromValue(QScriptDeclarativeClass::scopeChainValue(ctxt, -3)); m_context = ep->contextClass->contextFromValue(QScriptDeclarativeClass::scopeChainValue(ctxt, -3));

View file

@ -71,7 +71,6 @@ public:
static QScriptValue worker_include(QScriptContext *ctxt, QScriptEngine *engine); static QScriptValue worker_include(QScriptContext *ctxt, QScriptEngine *engine);
private: private:
QDeclarativeEngine *m_engine;
QScriptEngine *m_scriptEngine; QScriptEngine *m_scriptEngine;
QUrl m_url; QUrl m_url;

View 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) 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_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)
{ {
} }

View file

@ -126,9 +126,8 @@ private:
// Manager that is currently fetching data for me // Manager that is currently fetching data for me
QDeclarativeDataLoader *m_manager; QDeclarativeDataLoader *m_manager;
int m_redirectCount:30; bool m_inCallback;
bool m_inCallback:1; bool m_isDone;
bool m_isDone:1;
QList<QDeclarativeError> m_errors; QList<QDeclarativeError> m_errors;
}; };

View file

@ -390,7 +390,7 @@ QTransform &QTransform::translate(qreal dx, qreal dy)
if (dx == 0 && dy == 0) if (dx == 0 && dy == 0)
return *this; return *this;
#ifndef QT_NO_DEBUG #ifndef QT_NO_DEBUG
if (qIsNaN(dx) | qIsNaN(dy)) { if (qIsNaN(dx) || qIsNaN(dy)) {
qWarning() << "QTransform::translate with NaN called"; qWarning() << "QTransform::translate with NaN called";
return *this; return *this;
} }
@ -433,7 +433,7 @@ QTransform &QTransform::translate(qreal dx, qreal dy)
QTransform QTransform::fromTranslate(qreal dx, qreal dy) QTransform QTransform::fromTranslate(qreal dx, qreal dy)
{ {
#ifndef QT_NO_DEBUG #ifndef QT_NO_DEBUG
if (qIsNaN(dx) | qIsNaN(dy)) { if (qIsNaN(dx) || qIsNaN(dy)) {
qWarning() << "QTransform::fromTranslate with NaN called"; qWarning() << "QTransform::fromTranslate with NaN called";
return QTransform(); return QTransform();
} }
@ -458,7 +458,7 @@ QTransform & QTransform::scale(qreal sx, qreal sy)
if (sx == 1 && sy == 1) if (sx == 1 && sy == 1)
return *this; return *this;
#ifndef QT_NO_DEBUG #ifndef QT_NO_DEBUG
if (qIsNaN(sx) | qIsNaN(sy)) { if (qIsNaN(sx) || qIsNaN(sy)) {
qWarning() << "QTransform::scale with NaN called"; qWarning() << "QTransform::scale with NaN called";
return *this; return *this;
} }
@ -499,7 +499,7 @@ QTransform & QTransform::scale(qreal sx, qreal sy)
QTransform QTransform::fromScale(qreal sx, qreal sy) QTransform QTransform::fromScale(qreal sx, qreal sy)
{ {
#ifndef QT_NO_DEBUG #ifndef QT_NO_DEBUG
if (qIsNaN(sx) | qIsNaN(sy)) { if (qIsNaN(sx) || qIsNaN(sy)) {
qWarning() << "QTransform::fromScale with NaN called"; qWarning() << "QTransform::fromScale with NaN called";
return QTransform(); return QTransform();
} }
@ -524,7 +524,7 @@ QTransform & QTransform::shear(qreal sh, qreal sv)
if (sh == 0 && sv == 0) if (sh == 0 && sv == 0)
return *this; return *this;
#ifndef QT_NO_DEBUG #ifndef QT_NO_DEBUG
if (qIsNaN(sh) | qIsNaN(sv)) { if (qIsNaN(sh) || qIsNaN(sv)) {
qWarning() << "QTransform::shear with NaN called"; qWarning() << "QTransform::shear with NaN called";
return *this; return *this;
} }

View file

@ -100,7 +100,6 @@ static void qt_cleanlooks_draw_buttongradient(QPainter *painter, const QRect &re
const QColor &gradientMid, const QColor &gradientStop, QBrush bgBrush) const QColor &gradientMid, const QColor &gradientStop, QBrush bgBrush)
{ {
int x = rect.center().x(); int x = rect.center().x();
int y = rect.center().y();
QLinearGradient *gradient = new QLinearGradient(x, rect.top(), x, rect.bottom()); QLinearGradient *gradient = new QLinearGradient(x, rect.top(), x, rect.bottom());
if (bgBrush.gradient()) if (bgBrush.gradient())
gradient->setStops(bgBrush.gradient()->stops()); gradient->setStops(bgBrush.gradient()->stops());

View file

@ -87,9 +87,7 @@ private:
uint press_count; uint press_count;
uint release_count; uint release_count;
int cur_state; int cur_state;
uint tmp;
QCheckBox *testWidget; QCheckBox *testWidget;
uint tmp2;
}; };
tst_QCheckBox::tst_QCheckBox() tst_QCheckBox::tst_QCheckBox()

View file

@ -151,7 +151,7 @@ public:
QColumnView::setSelection(rect, command); QColumnView::setSelection(rect, command);
} }
QRegion visualRegionForSelection(QItemSelection selection){ QRegion visualRegionForSelection(const QItemSelection &selection) const {
return QColumnView::visualRegionForSelection(selection); return QColumnView::visualRegionForSelection(selection);
} }
protected: protected:

View file

@ -463,7 +463,6 @@ void tst_QMainWindow::iconSize()
// the default is determined by the style // the default is determined by the style
const int metric = mw.style()->pixelMetric(QStyle::PM_ToolBarIconSize); 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 smallIconSize = QSize(metric / 2, metric / 2);
const QSize largeIconSize = QSize(metric * 2, metric * 2); const QSize largeIconSize = QSize(metric * 2, metric * 2);

View file

@ -3561,6 +3561,8 @@ void tst_QObject::disconnectByMetaMethod()
connect(s, signal2, r2, slot2); connect(s, signal2, r2, slot2);
connect(s, signal3, r1, slot3); connect(s, signal3, r1, slot3);
connect(s, signal3, r2, slot3); connect(s, signal3, r2, slot3);
connect(s, signal4, r1, slot4);
connect(s, signal4, r2, slot4);
// disconnect signal1() from all receivers // disconnect signal1() from all receivers
QObject::disconnect(s, signal1, 0, QMetaMethod()); QObject::disconnect(s, signal1, 0, QMetaMethod());