aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@nokia.com>2011-10-18 11:00:02 +0200
committerQt by Nokia <qt-info@nokia.com>2011-10-19 10:31:31 +0200
commit5ddcd47dbdab9710a547244d29fe038bde3d8c98 (patch)
treefb6176ee512708eabc01cbe43f557c4d306e8c82 /src
parent8f72ef77d1f37b46583deed532951c6b0e5937ae (diff)
Declarative: Fix MSVC and g++ warnings
Potentially severe: - Fix int/bool mismatches - Use of uninitialized variable - Do connectionMask shift operations in 64bit - Enum type mismatch for QLineControl::EchoMode Various: - class/struct mismatches - UnhandledEnumeration values - Unused variables - Constructor initialization order Change-Id: Ieb52f8990445fe95f94070175a0f9beb66863240 Reviewed-by: Martin Jones <martin.jones@nokia.com>
Diffstat (limited to 'src')
-rw-r--r--src/declarative/items/context2d/qsgcontext2dcommandbuffer.cpp1
-rw-r--r--src/declarative/items/context2d/qsgcontext2dtexture.cpp4
-rw-r--r--src/declarative/items/qsgspriteengine.cpp3
-rw-r--r--src/declarative/items/qsgspriteengine_p.h2
-rw-r--r--src/declarative/items/qsgtextinput.cpp6
-rw-r--r--src/declarative/particles/qsgparticlesystem.cpp11
-rw-r--r--src/declarative/particles/qsgspritegoal.cpp7
-rw-r--r--src/declarative/qml/qdeclarativedata_p.h2
-rw-r--r--src/declarative/qml/qdeclarativeengine.cpp2
-rw-r--r--src/declarative/qml/qdeclarativeextensioninterface.h6
-rw-r--r--src/declarative/qml/qdeclarativepropertycache.cpp15
-rw-r--r--src/declarative/qml/v4/qv4bindings_p.h3
-rw-r--r--src/declarative/qml/v8/qv8engine.cpp5
-rw-r--r--src/declarative/qml/v8/qv8variantwrapper.cpp4
-rw-r--r--src/declarative/scenegraph/coreapi/qsgnodeupdater.cpp2
-rw-r--r--src/declarative/scenegraph/util/qsgvertexcolormaterial.cpp2
-rw-r--r--src/qtquick1/graphicsitems/qdeclarativetextinput.cpp3
17 files changed, 53 insertions, 25 deletions
diff --git a/src/declarative/items/context2d/qsgcontext2dcommandbuffer.cpp b/src/declarative/items/context2d/qsgcontext2dcommandbuffer.cpp
index 9dff4e809e..29ed5fbc12 100644
--- a/src/declarative/items/context2d/qsgcontext2dcommandbuffer.cpp
+++ b/src/declarative/items/context2d/qsgcontext2dcommandbuffer.cpp
@@ -340,7 +340,6 @@ QSGContext2D::State QSGContext2DCommandBuffer::replay(QPainter* p, QSGContext2D:
break;
case QSGContext2D::Fill:
{
- bool hasPattern = p->brush().style() == Qt::TexturePattern;
QPainterPath path = takePath();
path.closeSubpath();
if (HAS_SHADOW(state.shadowOffsetX, state.shadowOffsetY, state.shadowBlur, state.shadowColor))
diff --git a/src/declarative/items/context2d/qsgcontext2dtexture.cpp b/src/declarative/items/context2d/qsgcontext2dtexture.cpp
index a57a5e5fba..721f847978 100644
--- a/src/declarative/items/context2d/qsgcontext2dtexture.cpp
+++ b/src/declarative/items/context2d/qsgcontext2dtexture.cpp
@@ -182,8 +182,8 @@ void QSGContext2DTexture::canvasChanged(const QSize& canvasSize, const QSize& ti
if (ts.height() > canvasSize.height())
ts.setHeight(canvasSize.height());
- bool canvasChanged = setCanvasSize(canvasSize);
- bool tileChanged = setTileSize(ts);
+ setCanvasSize(canvasSize);
+ setTileSize(ts);
if (canvasSize == canvasWindow.size()) {
m_tiledCanvas = false;
diff --git a/src/declarative/items/qsgspriteengine.cpp b/src/declarative/items/qsgspriteengine.cpp
index 2ef36dfd71..a376a06483 100644
--- a/src/declarative/items/qsgspriteengine.cpp
+++ b/src/declarative/items/qsgspriteengine.cpp
@@ -226,7 +226,6 @@ QImage QSGSpriteEngine::assembledImage()
if (!state->m_frameWidth)
state->m_frameWidth = img.width() / state->frames();
- int imgHeight = state->frameHeight();
if (!state->m_frameHeight)
state->m_frameHeight = img.height();
@@ -446,7 +445,7 @@ int QSGStochasticEngine::goalSeek(int curIdx, int spriteIdx, int dist)
return *(options.begin());
int option = -1;
qreal r =(qreal) qrand() / (qreal) RAND_MAX;
- qreal total;
+ qreal total = 0;
for (QSet<int>::const_iterator iter=options.constBegin();
iter!=options.constEnd(); iter++)
total += curState->m_to.value(m_states[(*iter)]->name()).toReal();
diff --git a/src/declarative/items/qsgspriteengine_p.h b/src/declarative/items/qsgspriteengine_p.h
index 30a041a98e..8140b3814d 100644
--- a/src/declarative/items/qsgspriteengine_p.h
+++ b/src/declarative/items/qsgspriteengine_p.h
@@ -277,7 +277,7 @@ public:
int spriteStart(int sprite=0);
int spriteFrames(int sprite=0);
int spriteDuration(int sprite=0);
- int spriteX(int sprite=0) { return 0; }//Currently all rows are 0 aligned, if we get more space efficient we might change this
+ int spriteX(int /* sprite */ = 0) { return 0; }//Currently all rows are 0 aligned, if we get more space efficient we might change this
int spriteY(int sprite=0);
int spriteWidth(int sprite=0);
int spriteHeight(int sprite=0);
diff --git a/src/declarative/items/qsgtextinput.cpp b/src/declarative/items/qsgtextinput.cpp
index 1c6bccb5cb..6d0fa47d4f 100644
--- a/src/declarative/items/qsgtextinput.cpp
+++ b/src/declarative/items/qsgtextinput.cpp
@@ -1359,10 +1359,12 @@ QVariant QSGTextInput::inputMethodQuery(Qt::InputMethodQuery property) const
case Qt::ImCursorPosition:
return QVariant(d->control->cursor());
case Qt::ImSurroundingText:
- if (d->control->echoMode() == QLineControl::PasswordEchoOnEdit && !d->control->passwordEchoEditing())
+ if (d->control->echoMode() == QLineControl::PasswordEchoOnEdit
+ && !d->control->passwordEchoEditing()) {
return QVariant(displayText());
- else
+ } else {
return QVariant(text());
+ }
case Qt::ImCurrentSelection:
return QVariant(selectedText());
case Qt::ImMaximumTextLength:
diff --git a/src/declarative/particles/qsgparticlesystem.cpp b/src/declarative/particles/qsgparticlesystem.cpp
index 1d4498891f..1b01081a67 100644
--- a/src/declarative/particles/qsgparticlesystem.cpp
+++ b/src/declarative/particles/qsgparticlesystem.cpp
@@ -388,11 +388,11 @@ QSGParticleData::QSGParticleData(QSGParticleSystem* sys)
, system(sys)
, index(0)
, systemIndex(-1)
- , v8Datum(0)
, colorOwner(0)
, rotationOwner(0)
, deformationOwner(0)
, animationOwner(0)
+ , v8Datum(0)
{
x = 0;
y = 0;
@@ -617,8 +617,13 @@ void QSGParticleData::extendLife(float time)
}
QSGParticleSystem::QSGParticleSystem(QSGItem *parent) :
- QSGItem(parent), particleCount(0), m_running(true), m_paused(false)
- , m_nextIndex(0), m_componentComplete(false), stateEngine(0)
+ QSGItem(parent),
+ stateEngine(0),
+ m_running(true),
+ particleCount(0),
+ m_nextIndex(0),
+ m_componentComplete(false),
+ m_paused(false)
{
connect(&m_painterMapper, SIGNAL(mapped(QObject*)),
this, SLOT(loadPainter(QObject*)));
diff --git a/src/declarative/particles/qsgspritegoal.cpp b/src/declarative/particles/qsgspritegoal.cpp
index 12d985f0c3..260929f28f 100644
--- a/src/declarative/particles/qsgspritegoal.cpp
+++ b/src/declarative/particles/qsgspritegoal.cpp
@@ -80,7 +80,12 @@ QT_BEGIN_NAMESPACE
*/
QSGSpriteGoalAffector::QSGSpriteGoalAffector(QSGItem *parent) :
- QSGParticleAffector(parent), m_goalIdx(-1), m_jump(false), m_systemStates(false), m_lastEngine(0), m_notUsingEngine(false)
+ QSGParticleAffector(parent),
+ m_goalIdx(-1),
+ m_lastEngine(0),
+ m_jump(false),
+ m_systemStates(false),
+ m_notUsingEngine(false)
{
}
diff --git a/src/declarative/qml/qdeclarativedata_p.h b/src/declarative/qml/qdeclarativedata_p.h
index 3229c5e878..1bebee5ef0 100644
--- a/src/declarative/qml/qdeclarativedata_p.h
+++ b/src/declarative/qml/qdeclarativedata_p.h
@@ -187,7 +187,7 @@ QDeclarativeNotifierEndpoint *QDeclarativeData::notify(int index)
{
Q_ASSERT(index <= 0xFFFF);
- if (!notifyList || !(notifyList->connectionMask & (1 << (index % 64)))) {
+ if (!notifyList || !(notifyList->connectionMask & (1 << (quint64(index) % 64)))) {
return 0;
} else if (index < notifyList->notifiesSize) {
return notifyList->notifies[index];
diff --git a/src/declarative/qml/qdeclarativeengine.cpp b/src/declarative/qml/qdeclarativeengine.cpp
index 33fd8b374f..3f12431767 100644
--- a/src/declarative/qml/qdeclarativeengine.cpp
+++ b/src/declarative/qml/qdeclarativeengine.cpp
@@ -1111,7 +1111,7 @@ void QDeclarativeData::addNotify(int index, QDeclarativeNotifierEndpoint *endpoi
Q_ASSERT(!endpoint->isConnected());
index = qMin(index, 0xFFFF - 1);
- notifyList->connectionMask |= (1 << (index % 64));
+ notifyList->connectionMask |= (1 << (quint64(index) % 64));
if (index < notifyList->notifiesSize) {
diff --git a/src/declarative/qml/qdeclarativeextensioninterface.h b/src/declarative/qml/qdeclarativeextensioninterface.h
index 3d2b3c6c7e..5b621e4883 100644
--- a/src/declarative/qml/qdeclarativeextensioninterface.h
+++ b/src/declarative/qml/qdeclarativeextensioninterface.h
@@ -52,14 +52,16 @@ QT_MODULE(Declarative)
class QDeclarativeEngine;
-struct Q_DECLARATIVE_EXPORT QDeclarativeTypesExtensionInterface
+class Q_DECLARATIVE_EXPORT QDeclarativeTypesExtensionInterface
{
+public:
virtual ~QDeclarativeTypesExtensionInterface() {}
virtual void registerTypes(const char *uri) = 0;
};
-struct Q_DECLARATIVE_EXPORT QDeclarativeExtensionInterface : public QDeclarativeTypesExtensionInterface
+class Q_DECLARATIVE_EXPORT QDeclarativeExtensionInterface : public QDeclarativeTypesExtensionInterface
{
+public:
virtual ~QDeclarativeExtensionInterface() {}
virtual void initializeEngine(QDeclarativeEngine *engine, const char *uri) = 0;
};
diff --git a/src/declarative/qml/qdeclarativepropertycache.cpp b/src/declarative/qml/qdeclarativepropertycache.cpp
index cf2022cb0a..134c588538 100644
--- a/src/declarative/qml/qdeclarativepropertycache.cpp
+++ b/src/declarative/qml/qdeclarativepropertycache.cpp
@@ -338,8 +338,12 @@ void QDeclarativePropertyCache::append(QDeclarativeEngine *engine, const QMetaOb
// Extract method name
const char *signature = m.signature();
const char *cptr = signature;
- bool utf8 = false;
- while (*cptr != '(') { Q_ASSERT(*cptr != 0); utf8 |= *cptr & 0x80; ++cptr; }
+ char utf8 = 0;
+ while (*cptr != '(') {
+ Q_ASSERT(*cptr != 0);
+ utf8 |= *cptr & 0x80;
+ ++cptr;
+ }
Data *data = &methodIndexCache[ii - methodIndexCacheStart];
Data *sigdata = 0;
@@ -417,9 +421,12 @@ void QDeclarativePropertyCache::append(QDeclarativeEngine *engine, const QMetaOb
continue;
const char *str = p.name();
- bool utf8 = false;
+ char utf8 = 0;
const char *cptr = str;
- while (*cptr != 0) { utf8 |= *cptr & 0x80; ++cptr; }
+ while (*cptr != 0) {
+ utf8 |= *cptr & 0x80;
+ ++cptr;
+ }
Data *data = &propertyIndexCache[ii - propertyIndexCacheStart];
diff --git a/src/declarative/qml/v4/qv4bindings_p.h b/src/declarative/qml/v4/qv4bindings_p.h
index 8d68863df7..603d05d899 100644
--- a/src/declarative/qml/v4/qv4bindings_p.h
+++ b/src/declarative/qml/v4/qv4bindings_p.h
@@ -101,8 +101,9 @@ private:
QV4Bindings *parent;
};
- struct Subscription : public QDeclarativeNotifierEndpoint
+ class Subscription : public QDeclarativeNotifierEndpoint
{
+ public:
Subscription() : bindings(0), method(-1) { callback = &subscriptionCallback; }
static void subscriptionCallback(QDeclarativeNotifierEndpoint *e);
QV4Bindings *bindings;
diff --git a/src/declarative/qml/v8/qv8engine.cpp b/src/declarative/qml/v8/qv8engine.cpp
index e135ec92c5..7879b7c011 100644
--- a/src/declarative/qml/v8/qv8engine.cpp
+++ b/src/declarative/qml/v8/qv8engine.cpp
@@ -203,6 +203,11 @@ QVariant QV8Engine::toVariant(v8::Handle<v8::Value> value, int typeHint)
QV8ObjectResource *r = (QV8ObjectResource *)value->ToObject()->GetExternalResource();
if (r) {
switch (r->resourceType()) {
+ case QV8ObjectResource::Context2DStyleType:
+ case QV8ObjectResource::Context2DPixelArrayType:
+ case QV8ObjectResource::SignalHandlerType:
+ case QV8ObjectResource::IncubatorType:
+ case QV8ObjectResource::VisualDataItemType:
case QV8ObjectResource::ContextType:
case QV8ObjectResource::XMLHttpRequestType:
case QV8ObjectResource::DOMNodeType:
diff --git a/src/declarative/qml/v8/qv8variantwrapper.cpp b/src/declarative/qml/v8/qv8variantwrapper.cpp
index fbf083273d..671e4d33c3 100644
--- a/src/declarative/qml/v8/qv8variantwrapper.cpp
+++ b/src/declarative/qml/v8/qv8variantwrapper.cpp
@@ -167,14 +167,14 @@ QVariant &QV8VariantWrapper::variantValue(v8::Handle<v8::Value> value)
}
v8::Handle<v8::Value> QV8VariantWrapper::Getter(v8::Local<v8::String> /* property */,
- const v8::AccessorInfo &info)
+ const v8::AccessorInfo & /* info */)
{
return v8::Handle<v8::Value>();
}
v8::Handle<v8::Value> QV8VariantWrapper::Setter(v8::Local<v8::String> /* property */,
v8::Local<v8::Value> value,
- const v8::AccessorInfo &info)
+ const v8::AccessorInfo & /* info */)
{
return value;
}
diff --git a/src/declarative/scenegraph/coreapi/qsgnodeupdater.cpp b/src/declarative/scenegraph/coreapi/qsgnodeupdater.cpp
index 88d7e5a8bf..7bf03fd86b 100644
--- a/src/declarative/scenegraph/coreapi/qsgnodeupdater.cpp
+++ b/src/declarative/scenegraph/coreapi/qsgnodeupdater.cpp
@@ -192,6 +192,8 @@ void QSGNodeUpdater::leaveGeometryNode(QSGGeometryNode *g)
{
#ifdef QSG_UPDATER_DEBUG
qDebug() << "leave geometry" << g;
+#else
+ Q_UNUSED(g)
#endif
}
diff --git a/src/declarative/scenegraph/util/qsgvertexcolormaterial.cpp b/src/declarative/scenegraph/util/qsgvertexcolormaterial.cpp
index 5f6270367f..78cef55215 100644
--- a/src/declarative/scenegraph/util/qsgvertexcolormaterial.cpp
+++ b/src/declarative/scenegraph/util/qsgvertexcolormaterial.cpp
@@ -145,7 +145,7 @@ QSGVertexColorMaterial::QSGVertexColorMaterial()
\internal
*/
-int QSGVertexColorMaterial::compare(const QSGMaterial *other) const
+int QSGVertexColorMaterial::compare(const QSGMaterial * /* other */) const
{
return 0;
}
diff --git a/src/qtquick1/graphicsitems/qdeclarativetextinput.cpp b/src/qtquick1/graphicsitems/qdeclarativetextinput.cpp
index 3a36e6b070..009c72a4cd 100644
--- a/src/qtquick1/graphicsitems/qdeclarativetextinput.cpp
+++ b/src/qtquick1/graphicsitems/qdeclarativetextinput.cpp
@@ -1392,7 +1392,8 @@ QVariant QDeclarative1TextInput::inputMethodQuery(Qt::InputMethodQuery property)
case Qt::ImCursorPosition:
return QVariant(d->control->cursor());
case Qt::ImSurroundingText:
- if (d->control->echoMode() == PasswordEchoOnEdit && !d->control->passwordEchoEditing())
+ if (d->control->echoMode() == QLineControl::PasswordEchoOnEdit
+ && !d->control->passwordEchoEditing())
return QVariant(displayText());
else
return QVariant(text());