summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJoona Petrell <joona.t.petrell@nokia.com>2010-08-24 04:13:25 (GMT)
committerJoona Petrell <joona.t.petrell@nokia.com>2010-08-24 04:18:03 (GMT)
commit0f3d7560855dd83b63ee090ee74b8770163e806c (patch)
treea08907d6028fb1e97ef31825d9977b4e274266b9 /src
parent0f32923c15739ad555e8915cba8afae9c05fd485 (diff)
downloadQt-0f3d7560855dd83b63ee090ee74b8770163e806c.zip
Qt-0f3d7560855dd83b63ee090ee74b8770163e806c.tar.gz
Qt-0f3d7560855dd83b63ee090ee74b8770163e806c.tar.bz2
Fix few declarative code issues discovered by static code analysis
Task-number: Reviewed-by: Aaron Kennedy
Diffstat (limited to 'src')
-rw-r--r--src/declarative/graphicsitems/qdeclarativelistview.cpp2
-rw-r--r--src/declarative/graphicsitems/qdeclarativetext.cpp2
-rw-r--r--src/declarative/qml/parser/qdeclarativejslexer.cpp2
-rw-r--r--src/declarative/qml/qdeclarativecompositetypemanager.cpp2
-rw-r--r--src/declarative/qml/qdeclarativeengine.cpp2
-rw-r--r--src/declarative/qml/qdeclarativeimport.cpp2
-rw-r--r--src/declarative/qml/qdeclarativescriptparser.cpp2
-rw-r--r--src/declarative/qml/qmetaobjectbuilder.cpp2
-rw-r--r--src/declarative/util/qdeclarativelistmodel.cpp4
-rw-r--r--src/declarative/util/qdeclarativestategroup.cpp4
10 files changed, 12 insertions, 12 deletions
diff --git a/src/declarative/graphicsitems/qdeclarativelistview.cpp b/src/declarative/graphicsitems/qdeclarativelistview.cpp
index ec1b6cf..2e2e08c 100644
--- a/src/declarative/graphicsitems/qdeclarativelistview.cpp
+++ b/src/declarative/graphicsitems/qdeclarativelistview.cpp
@@ -983,7 +983,7 @@ void QDeclarativeListViewPrivate::updateSections()
void QDeclarativeListViewPrivate::updateCurrentSection()
{
if (!sectionCriteria || visibleItems.isEmpty()) {
- currentSection = QString();
+ currentSection.clear();
return;
}
int index = 0;
diff --git a/src/declarative/graphicsitems/qdeclarativetext.cpp b/src/declarative/graphicsitems/qdeclarativetext.cpp
index fcd112e..b96b43c 100644
--- a/src/declarative/graphicsitems/qdeclarativetext.cpp
+++ b/src/declarative/graphicsitems/qdeclarativetext.cpp
@@ -1218,7 +1218,7 @@ void QDeclarativeText::mousePressEvent(QGraphicsSceneMouseEvent *event)
if (!d->richText || !d->doc || d->doc->documentLayout()->anchorAt(event->pos()).isEmpty()) {
event->setAccepted(false);
- d->activeLink = QString();
+ d->activeLink.clear();
} else {
d->activeLink = d->doc->documentLayout()->anchorAt(event->pos());
}
diff --git a/src/declarative/qml/parser/qdeclarativejslexer.cpp b/src/declarative/qml/parser/qdeclarativejslexer.cpp
index 65a6af2..cd08658 100644
--- a/src/declarative/qml/parser/qdeclarativejslexer.cpp
+++ b/src/declarative/qml/parser/qdeclarativejslexer.cpp
@@ -120,7 +120,7 @@ Lexer::~Lexer()
void Lexer::setCode(const QString &c, int lineno)
{
- errmsg = QString();
+ errmsg.clear();
yylineno = lineno;
yycolumn = 1;
restrKeyword = false;
diff --git a/src/declarative/qml/qdeclarativecompositetypemanager.cpp b/src/declarative/qml/qdeclarativecompositetypemanager.cpp
index 26b2a9b..2e77534 100644
--- a/src/declarative/qml/qdeclarativecompositetypemanager.cpp
+++ b/src/declarative/qml/qdeclarativecompositetypemanager.cpp
@@ -544,7 +544,7 @@ int QDeclarativeCompositeTypeManager::resolveTypes(QDeclarativeCompositeTypeData
}
- foreach (QDeclarativeScriptParser::Import imp, unit->data.imports()) {
+ foreach (const QDeclarativeScriptParser::Import &imp, unit->data.imports()) {
QDeclarativeDirComponents qmldircomponentsnetwork;
if (imp.type == QDeclarativeScriptParser::Import::Script)
continue;
diff --git a/src/declarative/qml/qdeclarativeengine.cpp b/src/declarative/qml/qdeclarativeengine.cpp
index cedf9d5..4e45636 100644
--- a/src/declarative/qml/qdeclarativeengine.cpp
+++ b/src/declarative/qml/qdeclarativeengine.cpp
@@ -2079,7 +2079,7 @@ void QDeclarativeEnginePrivate::registerCompositeType(QDeclarativeCompiledData *
QByteArray name = data->root->className();
QByteArray ptr = name + '*';
- QByteArray lst = "QDeclarativeListProperty<" + name + ">";
+ QByteArray lst = "QDeclarativeListProperty<" + name + '>';
int ptr_type = QMetaType::registerType(ptr.constData(), voidptr_destructor,
voidptr_constructor);
diff --git a/src/declarative/qml/qdeclarativeimport.cpp b/src/declarative/qml/qdeclarativeimport.cpp
index 8d81b34..5c21ebc 100644
--- a/src/declarative/qml/qdeclarativeimport.cpp
+++ b/src/declarative/qml/qdeclarativeimport.cpp
@@ -338,7 +338,7 @@ QString QDeclarativeImportsPrivate::resolvedUri(const QString &dir_arg, QDeclara
qSort(paths.begin(), paths.end(), greaterThan); // Ensure subdirs preceed their parents.
QString stableRelativePath = dir;
- foreach( QString path, paths) {
+ foreach(const QString &path, paths) {
if (dir.startsWith(path)) {
stableRelativePath = dir.mid(path.length()+1);
break;
diff --git a/src/declarative/qml/qdeclarativescriptparser.cpp b/src/declarative/qml/qdeclarativescriptparser.cpp
index 0657f49..0b3b35f 100644
--- a/src/declarative/qml/qdeclarativescriptparser.cpp
+++ b/src/declarative/qml/qdeclarativescriptparser.cpp
@@ -543,7 +543,7 @@ bool ProcessAST::visit(AST::UiPublicMember *node)
QString typemodifier;
if(node->typeModifier)
typemodifier = node->typeModifier->asString();
- if (typemodifier == QString()) {
+ if (typemodifier.isEmpty()) {
type = Object::DynamicProperty::Custom;
} else if(typemodifier == QLatin1String("list")) {
type = Object::DynamicProperty::CustomList;
diff --git a/src/declarative/qml/qmetaobjectbuilder.cpp b/src/declarative/qml/qmetaobjectbuilder.cpp
index 6e4d7b8..0954248 100644
--- a/src/declarative/qml/qmetaobjectbuilder.cpp
+++ b/src/declarative/qml/qmetaobjectbuilder.cpp
@@ -1142,7 +1142,7 @@ static QByteArray buildParameterNames
if (!parameterNames.isEmpty()) {
QByteArray names;
bool first = true;
- foreach (QByteArray name, parameterNames) {
+ foreach (const QByteArray &name, parameterNames) {
if (first)
first = false;
else
diff --git a/src/declarative/util/qdeclarativelistmodel.cpp b/src/declarative/util/qdeclarativelistmodel.cpp
index 1f66f0f..0162beb 100644
--- a/src/declarative/util/qdeclarativelistmodel.cpp
+++ b/src/declarative/util/qdeclarativelistmodel.cpp
@@ -570,7 +570,7 @@ bool QDeclarativeListModelParser::compileProperty(const QDeclarativeCustomParser
QList<QDeclarativeCustomParserProperty> props = node.properties();
for(int jj = 0; jj < props.count(); ++jj) {
const QDeclarativeCustomParserProperty &nodeProp = props.at(jj);
- if (nodeProp.name() == "") {
+ if (nodeProp.name().isEmpty()) {
error(nodeProp, QDeclarativeListModel::tr("ListElement: cannot contain nested elements"));
return false;
}
@@ -658,7 +658,7 @@ QByteArray QDeclarativeListModelParser::compile(const QList<QDeclarativeCustomPa
for(int ii = 0; ii < customProps.count(); ++ii) {
const QDeclarativeCustomParserProperty &prop = customProps.at(ii);
- if(prop.name() != "") { // isn't default property
+ if(!prop.name().isEmpty()) { // isn't default property
error(prop, QDeclarativeListModel::tr("ListModel: undefined property '%1'").arg(QString::fromUtf8(prop.name())));
return QByteArray();
}
diff --git a/src/declarative/util/qdeclarativestategroup.cpp b/src/declarative/util/qdeclarativestategroup.cpp
index fc90baa..6d9563e 100644
--- a/src/declarative/util/qdeclarativestategroup.cpp
+++ b/src/declarative/util/qdeclarativestategroup.cpp
@@ -272,7 +272,7 @@ void QDeclarativeStateGroup::componentComplete()
return;
} else if (!d->currentState.isEmpty()) {
QString cs = d->currentState;
- d->currentState = QString();
+ d->currentState.clear();
d->setCurrentStateInternal(cs, true);
}
}
@@ -314,7 +314,7 @@ bool QDeclarativeStateGroupPrivate::updateAutoState()
}
}
if (revert) {
- bool rv = currentState != QString();
+ bool rv = !currentState.isEmpty();
q->setState(QString());
return rv;
} else {