aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/3rdparty/double-conversion/cached-powers.cc1
-rw-r--r--src/3rdparty/double-conversion/fixed-dtoa.cc2
-rw-r--r--src/3rdparty/double-conversion/strtod.cc2
-rw-r--r--src/3rdparty/double-conversion/utils.h3
-rw-r--r--src/qml/animations/qparallelanimationgroupjob.cpp2
-rw-r--r--src/qml/compiler/qqmlcodegenerator.cpp23
-rw-r--r--src/qml/compiler/qv4codegen.cpp56
-rw-r--r--src/qml/compiler/qv4compileddata.cpp23
-rw-r--r--src/qml/compiler/qv4compiler.cpp4
-rw-r--r--src/qml/compiler/qv4isel_masm.cpp22
-rw-r--r--src/qml/compiler/qv4isel_moth.cpp1
-rw-r--r--src/qml/compiler/qv4jsir.cpp4
-rw-r--r--src/qml/compiler/qv4jsir_p.h9
-rw-r--r--src/qml/compiler/qv4regalloc.cpp20
-rw-r--r--src/qml/compiler/qv4ssa.cpp22
-rw-r--r--src/qml/debugger/qv4debugservice_p.h2
-rw-r--r--src/qml/debugger/qv8profilerservice.cpp4
-rw-r--r--src/qml/jsapi/qjsvalue.cpp11
-rw-r--r--src/qml/jsruntime/qv4argumentsobject.cpp6
-rw-r--r--src/qml/jsruntime/qv4arrayobject.cpp14
-rw-r--r--src/qml/jsruntime/qv4context.cpp10
-rw-r--r--src/qml/jsruntime/qv4dateobject.cpp16
-rw-r--r--src/qml/jsruntime/qv4debugging.cpp4
-rw-r--r--src/qml/jsruntime/qv4engine.cpp2
-rw-r--r--src/qml/jsruntime/qv4errorobject.cpp2
-rw-r--r--src/qml/jsruntime/qv4function.cpp10
-rw-r--r--src/qml/jsruntime/qv4functionobject.cpp13
-rw-r--r--src/qml/jsruntime/qv4globalobject.cpp16
-rw-r--r--src/qml/jsruntime/qv4identifier.cpp6
-rw-r--r--src/qml/jsruntime/qv4identifiertable.cpp2
-rw-r--r--src/qml/jsruntime/qv4include.cpp18
-rw-r--r--src/qml/jsruntime/qv4internalclass.cpp16
-rw-r--r--src/qml/jsruntime/qv4jsonobject.cpp46
-rw-r--r--src/qml/jsruntime/qv4lookup.cpp2
-rw-r--r--src/qml/jsruntime/qv4managed.cpp6
-rw-r--r--src/qml/jsruntime/qv4mathobject.cpp4
-rw-r--r--src/qml/jsruntime/qv4object.cpp24
-rw-r--r--src/qml/jsruntime/qv4objectiterator.cpp2
-rw-r--r--src/qml/jsruntime/qv4qobjectwrapper.cpp10
-rw-r--r--src/qml/jsruntime/qv4regexp.cpp26
-rw-r--r--src/qml/jsruntime/qv4regexpobject.cpp21
-rw-r--r--src/qml/jsruntime/qv4regexpobject_p.h2
-rw-r--r--src/qml/jsruntime/qv4runtime.cpp4
-rw-r--r--src/qml/jsruntime/qv4script.cpp2
-rw-r--r--src/qml/jsruntime/qv4sequenceobject.cpp5
-rw-r--r--src/qml/jsruntime/qv4serialize.cpp2
-rw-r--r--src/qml/jsruntime/qv4string.cpp4
-rw-r--r--src/qml/jsruntime/qv4stringobject.cpp10
-rw-r--r--src/qml/qml/ftw/qhashedstring.cpp131
-rw-r--r--src/qml/qml/qqmlabstractbinding.cpp3
-rw-r--r--src/qml/qml/qqmlcomponent.cpp4
-rw-r--r--src/qml/qml/qqmlengine.cpp1
-rw-r--r--src/qml/qml/qqmlimport.cpp8
-rw-r--r--src/qml/qml/qqmljavascriptexpression.cpp5
-rw-r--r--src/qml/qml/qqmllistwrapper.cpp2
-rw-r--r--src/qml/qml/qqmlobjectcreator.cpp14
-rw-r--r--src/qml/qml/qqmlpropertycache.cpp2
-rw-r--r--src/qml/qml/qqmltypeloader.cpp2
-rw-r--r--src/qml/qml/qqmltypenamecache.cpp2
-rw-r--r--src/qml/qml/qqmlvme.cpp2
-rw-r--r--src/qml/qml/qqmlxmlhttprequest.cpp4
-rw-r--r--src/qml/qml/v8/qqmlbuiltinfunctions.cpp18
-rw-r--r--src/qml/qml/v8/qv8engine.cpp2
-rw-r--r--src/qml/types/qqmldelegatemodel.cpp3
-rw-r--r--src/qml/types/qquickworkerscript.cpp8
-rw-r--r--src/qml/util/qqmllistcompositor.cpp2
66 files changed, 325 insertions, 404 deletions
diff --git a/src/3rdparty/double-conversion/cached-powers.cc b/src/3rdparty/double-conversion/cached-powers.cc
index c676429194..7067fca4a9 100644
--- a/src/3rdparty/double-conversion/cached-powers.cc
+++ b/src/3rdparty/double-conversion/cached-powers.cc
@@ -144,6 +144,7 @@ void PowersOfTenCache::GetCachedPowerForBinaryExponentRange(
int max_exponent,
DiyFp* power,
int* decimal_exponent) {
+ (void)max_exponent; // Silence unused parameter warning in release builds
int kQ = DiyFp::kSignificandSize;
double k = ceil((min_exponent + kQ - 1) * kD_1_LOG2_10);
int foo = kCachedPowersOffset;
diff --git a/src/3rdparty/double-conversion/fixed-dtoa.cc b/src/3rdparty/double-conversion/fixed-dtoa.cc
index d56b1449b2..6d63c71858 100644
--- a/src/3rdparty/double-conversion/fixed-dtoa.cc
+++ b/src/3rdparty/double-conversion/fixed-dtoa.cc
@@ -152,6 +152,8 @@ static void FillDigits32(uint32_t number, Vector<char> buffer, int* length) {
static void FillDigits64FixedLength(uint64_t number, int requested_length,
Vector<char> buffer, int* length) {
+ (void) requested_length;
+
const uint32_t kTen7 = 10000000;
// For efficiency cut the number into 3 uint32_t parts, and print those.
uint32_t part2 = static_cast<uint32_t>(number % kTen7);
diff --git a/src/3rdparty/double-conversion/strtod.cc b/src/3rdparty/double-conversion/strtod.cc
index 9758989f71..2620fbbf0f 100644
--- a/src/3rdparty/double-conversion/strtod.cc
+++ b/src/3rdparty/double-conversion/strtod.cc
@@ -137,6 +137,7 @@ static void TrimAndCut(Vector<const char> buffer, int exponent,
Vector<const char> right_trimmed = TrimTrailingZeros(left_trimmed);
exponent += left_trimmed.length() - right_trimmed.length();
if (right_trimmed.length() > kMaxSignificantDecimalDigits) {
+ (void)space_size; // Silence unused parameter warning in release build
ASSERT(space_size >= kMaxSignificantDecimalDigits);
CutToMaxSignificantDigits(right_trimmed, exponent,
buffer_copy_space, updated_exponent);
@@ -515,6 +516,7 @@ float Strtof(Vector<const char> buffer, int exponent) {
double double_next2 = Double(double_next).NextDouble();
f4 = static_cast<float>(double_next2);
}
+ (void)f2; // Silence unused parameter warning in release builds
ASSERT(f1 <= f2 && f2 <= f3 && f3 <= f4);
// If the guess doesn't lie near a single-precision boundary we can simply
diff --git a/src/3rdparty/double-conversion/utils.h b/src/3rdparty/double-conversion/utils.h
index 044c0c25eb..29c7626345 100644
--- a/src/3rdparty/double-conversion/utils.h
+++ b/src/3rdparty/double-conversion/utils.h
@@ -302,7 +302,8 @@ template <class Dest, class Source>
inline Dest BitCast(const Source& source) {
// Compile time assertion: sizeof(Dest) == sizeof(Source)
// A compile error here means your Dest and Source have different sizes.
- typedef char VerifySizesAreEqual[sizeof(Dest) == sizeof(Source) ? 1 : -1];
+ char VerifySizesAreEqual[sizeof(Dest) == sizeof(Source) ? 1 : -1];
+ (void) VerifySizesAreEqual;
Dest dest;
memmove(&dest, &source, sizeof(dest));
diff --git a/src/qml/animations/qparallelanimationgroupjob.cpp b/src/qml/animations/qparallelanimationgroupjob.cpp
index 43dda478f7..85a8527c6b 100644
--- a/src/qml/animations/qparallelanimationgroupjob.cpp
+++ b/src/qml/animations/qparallelanimationgroupjob.cpp
@@ -227,7 +227,7 @@ void QParallelAnimationGroupJob::uncontrolledAnimationFinished(QAbstractAnimatio
if (!running
&& ((m_direction == Forward && m_currentLoop == m_loopCount -1)
- || m_direction == Backward && m_currentLoop == 0)) {
+ || (m_direction == Backward && m_currentLoop == 0))) {
stop();
}
}
diff --git a/src/qml/compiler/qqmlcodegenerator.cpp b/src/qml/compiler/qqmlcodegenerator.cpp
index 546c92cd04..c2f2feb6bf 100644
--- a/src/qml/compiler/qqmlcodegenerator.cpp
+++ b/src/qml/compiler/qqmlcodegenerator.cpp
@@ -542,7 +542,7 @@ bool QQmlCodeGenerator::visit(AST::UiPublicMember *node)
for (int typeIndex = 0; typeIndex < propTypeNameToTypesCount; ++typeIndex) {
const TypeNameToType *t = propTypeNameToTypes + typeIndex;
if (t->nameLength == size_t(memberType.length()) &&
- QHashedString::compare(memberType.constData(), t->name, t->nameLength)) {
+ QHashedString::compare(memberType.constData(), t->name, static_cast<int>(t->nameLength))) {
type = t;
break;
}
@@ -600,7 +600,7 @@ bool QQmlCodeGenerator::visit(AST::UiPublicMember *node)
QV4::CompiledData::Property::Type type;
if ((unsigned)memberType.length() == strlen("alias") &&
- QHashedString::compare(memberType.constData(), "alias", strlen("alias"))) {
+ QHashedString::compare(memberType.constData(), "alias", static_cast<int>(strlen("alias")))) {
type = QV4::CompiledData::Property::Alias;
typeFound = true;
}
@@ -608,7 +608,7 @@ bool QQmlCodeGenerator::visit(AST::UiPublicMember *node)
for (int ii = 0; !typeFound && ii < propTypeNameToTypesCount; ++ii) {
const TypeNameToType *t = propTypeNameToTypes + ii;
if (t->nameLength == size_t(memberType.length()) &&
- QHashedString::compare(memberType.constData(), t->name, t->nameLength)) {
+ QHashedString::compare(memberType.constData(), t->name, static_cast<int>(t->nameLength))) {
type = t->type;
typeFound = true;
}
@@ -620,7 +620,7 @@ bool QQmlCodeGenerator::visit(AST::UiPublicMember *node)
if (typeModifier.isEmpty()) {
type = QV4::CompiledData::Property::Custom;
} else if ((unsigned)typeModifier.length() == strlen("list") &&
- QHashedString::compare(typeModifier.constData(), "list", strlen("list"))) {
+ QHashedString::compare(typeModifier.constData(), "list", static_cast<int>(strlen("list")))) {
type = QV4::CompiledData::Property::CustomList;
} else {
QQmlError error;
@@ -1044,18 +1044,18 @@ bool QQmlCodeGenerator::isStatementNodeScript(AST::Statement *statement)
{
if (AST::ExpressionStatement *stmt = AST::cast<AST::ExpressionStatement *>(statement)) {
AST::ExpressionNode *expr = stmt->expression;
- if (AST::StringLiteral *lit = AST::cast<AST::StringLiteral *>(expr))
+ if (AST::cast<AST::StringLiteral *>(expr))
return false;
else if (expr->kind == AST::Node::Kind_TrueLiteral)
return false;
else if (expr->kind == AST::Node::Kind_FalseLiteral)
return false;
- else if (AST::NumericLiteral *lit = AST::cast<AST::NumericLiteral *>(expr))
+ else if (AST::cast<AST::NumericLiteral *>(expr))
return false;
else {
if (AST::UnaryMinusExpression *unaryMinus = AST::cast<AST::UnaryMinusExpression *>(expr)) {
- if (AST::NumericLiteral *lit = AST::cast<AST::NumericLiteral *>(unaryMinus->expression)) {
+ if (AST::cast<AST::NumericLiteral *>(unaryMinus->expression)) {
return false;
}
}
@@ -1068,7 +1068,6 @@ bool QQmlCodeGenerator::isStatementNodeScript(AST::Statement *statement)
QV4::CompiledData::QmlUnit *QmlUnitGenerator::generate(ParsedQML &output, const QVector<int> &runtimeFunctionIndices)
{
jsUnitGenerator = &output.jsGenerator;
- const QmlObject *rootObject = output.objects.at(output.indexOfRootObject);
int unitSize = 0;
QV4::CompiledData::Unit *jsUnit = jsUnitGenerator->generateUnit(&unitSize);
@@ -1232,7 +1231,7 @@ QVector<int> JSCodeGen::generateJSCodeForFunctionsAndBindings(const QList<AST::N
ScanFunctions scan(this, sourceCode, GlobalCode);
scan.enterEnvironment(0, QmlBinding);
- scan.enterQmlScope(qmlRoot, "context scope");
+ scan.enterQmlScope(qmlRoot, QStringLiteral("context scope"));
foreach (AST::Node *node, functions) {
Q_ASSERT(node != qmlRoot);
AST::FunctionDeclaration *function = AST::cast<AST::FunctionDeclaration*>(node);
@@ -1245,7 +1244,7 @@ QVector<int> JSCodeGen::generateJSCodeForFunctionsAndBindings(const QList<AST::N
scan.leaveEnvironment();
_env = 0;
- _function = _module->functions.at(defineFunction(QString("context scope"), qmlRoot, 0, 0));
+ _function = _module->functions.at(defineFunction(QStringLiteral("context scope"), qmlRoot, 0, 0));
for (int i = 0; i < functions.count(); ++i) {
AST::Node *node = functions.at(i);
@@ -1521,7 +1520,7 @@ bool SignalHandlerConverter::convertSignalHandlerExpressionsToFunctionDeclaratio
QHash<QString, QStringList>::ConstIterator entry = customSignals.find(propertyName);
if (entry == customSignals.constEnd() && propertyName.endsWith(QStringLiteral("Changed"))) {
- QString alternateName = propertyName.mid(0, propertyName.length() - strlen("Changed"));
+ QString alternateName = propertyName.mid(0, propertyName.length() - static_cast<int>(strlen("Changed")));
entry = customSignals.find(alternateName);
}
@@ -1613,7 +1612,7 @@ QQmlPropertyData *PropertyResolver::signal(const QString &name, bool *notInRevis
}
if (name.endsWith(QStringLiteral("Changed"))) {
- QString propName = name.mid(0, name.length() - strlen("Changed"));
+ QString propName = name.mid(0, name.length() - static_cast<int>(strlen("Changed")));
d = property(propName, notInRevision);
if (d)
diff --git a/src/qml/compiler/qv4codegen.cpp b/src/qml/compiler/qv4codegen.cpp
index b4193a4253..58c9fc59bb 100644
--- a/src/qml/compiler/qv4codegen.cpp
+++ b/src/qml/compiler/qv4codegen.cpp
@@ -131,7 +131,7 @@ void Codegen::ScanFunctions::checkName(const QStringRef &name, const SourceLocat
|| name == QLatin1String("public")
|| name == QLatin1String("static")
|| name == QLatin1String("yield")) {
- _cg->throwSyntaxError(loc, QCoreApplication::translate("qv4codegen", "Unexpected strict mode reserved word"));
+ _cg->throwSyntaxError(loc, QStringLiteral("Unexpected strict mode reserved word"));
}
}
}
@@ -202,7 +202,7 @@ bool Codegen::ScanFunctions::visit(ArrayLiteral *ast)
bool Codegen::ScanFunctions::visit(VariableDeclaration *ast)
{
if (_env->isStrict && (ast->name == QLatin1String("eval") || ast->name == QLatin1String("arguments")))
- _cg->throwSyntaxError(ast->identifierToken, QCoreApplication::translate("qv4codegen", "Variable name may not be eval or arguments in strict mode"));
+ _cg->throwSyntaxError(ast->identifierToken, QStringLiteral("Variable name may not be eval or arguments in strict mode"));
checkName(ast->name, ast->identifierToken);
if (ast->name == QLatin1String("arguments"))
_env->usesArgumentsObject = Environment::ArgumentsObjectNotUsed;
@@ -222,7 +222,7 @@ bool Codegen::ScanFunctions::visit(ExpressionStatement *ast)
{
if (FunctionExpression* expr = AST::cast<AST::FunctionExpression*>(ast->expression)) {
if (!_allowFuncDecls)
- _cg->throwSyntaxError(expr->functionToken, QCoreApplication::translate("qv4codegen", "conditional function or closure declaration"));
+ _cg->throwSyntaxError(expr->functionToken, QStringLiteral("conditional function or closure declaration"));
enterFunction(expr, /*enterName*/ true);
Node::accept(expr->formals, this);
@@ -232,7 +232,7 @@ bool Codegen::ScanFunctions::visit(ExpressionStatement *ast)
} else {
SourceLocation firstToken = ast->firstSourceLocation();
if (_sourceCode.midRef(firstToken.offset, firstToken.length) == QStringLiteral("function")) {
- _cg->throwSyntaxError(firstToken, QCoreApplication::translate("qv4codegen", "unexpected token"));
+ _cg->throwSyntaxError(firstToken, QStringLiteral("unexpected token"));
}
}
return true;
@@ -247,7 +247,7 @@ bool Codegen::ScanFunctions::visit(FunctionExpression *ast)
void Codegen::ScanFunctions::enterFunction(FunctionExpression *ast, bool enterName, bool isExpression)
{
if (_env->isStrict && (ast->name == QLatin1String("eval") || ast->name == QLatin1String("arguments")))
- _cg->throwSyntaxError(ast->identifierToken, QCoreApplication::translate("qv4codegen", "Function name may not be eval or arguments in strict mode"));
+ _cg->throwSyntaxError(ast->identifierToken, QStringLiteral("Function name may not be eval or arguments in strict mode"));
enterFunction(ast, ast->name.toString(), ast->formals, ast->body, enterName ? ast : 0, isExpression);
}
@@ -297,7 +297,7 @@ void Codegen::ScanFunctions::endVisit(FunctionDeclaration *)
bool Codegen::ScanFunctions::visit(WithStatement *ast)
{
if (_env->isStrict) {
- _cg->throwSyntaxError(ast->withToken, QCoreApplication::translate("qv4codegen", "'with' statement is not allowed in strict mode"));
+ _cg->throwSyntaxError(ast->withToken, QStringLiteral("'with' statement is not allowed in strict mode"));
return false;
}
@@ -388,11 +388,11 @@ void Codegen::ScanFunctions::enterFunction(Node *ast, const QString &name, Forma
for (FormalParameterList *it = formals; it; it = it->next) {
QString arg = it->name.toString();
if (args.contains(arg)) {
- _cg->throwSyntaxError(it->identifierToken, QCoreApplication::translate("qv4codegen", "Duplicate parameter name '%1' is not allowed in strict mode").arg(arg));
+ _cg->throwSyntaxError(it->identifierToken, QStringLiteral("Duplicate parameter name '%1' is not allowed in strict mode").arg(arg));
return;
}
if (arg == QLatin1String("eval") || arg == QLatin1String("arguments")) {
- _cg->throwSyntaxError(it->identifierToken, QCoreApplication::translate("qv4codegen", "'%1' cannot be used as parameter name in strict mode").arg(arg));
+ _cg->throwSyntaxError(it->identifierToken, QStringLiteral("'%1' cannot be used as parameter name in strict mode").arg(arg));
return;
}
args += arg;
@@ -1177,7 +1177,7 @@ bool Codegen::visit(BinaryExpression *ast)
return false;
V4IR::Expr* right = *expression(ast->right);
if (! (left->asTemp() || left->asName() || left->asSubscript() || left->asMember())) {
- throwReferenceError(ast->operatorToken, QCoreApplication::translate("qv4codegen", "left-hand side of assignment operator is not an lvalue"));
+ throwReferenceError(ast->operatorToken, QStringLiteral("left-hand side of assignment operator is not an lvalue"));
return false;
}
@@ -1207,7 +1207,7 @@ bool Codegen::visit(BinaryExpression *ast)
return false;
V4IR::Expr* right = *expression(ast->right);
if (!left->isLValue()) {
- throwSyntaxError(ast->operatorToken, QCoreApplication::translate("qv4codegen", "left-hand side of inplace operator is not an lvalue"));
+ throwSyntaxError(ast->operatorToken, QStringLiteral("left-hand side of inplace operator is not an lvalue"));
return false;
}
@@ -1344,17 +1344,17 @@ bool Codegen::visit(DeleteExpression *ast)
V4IR::Expr* expr = *expression(ast->expression);
// Temporaries cannot be deleted
V4IR::Temp *t = expr->asTemp();
- if (t && t->index < _env->members.size()) {
+ if (t && t->index < static_cast<unsigned>(_env->members.size())) {
// Trying to delete a function argument might throw.
if (_function->isStrict) {
- throwSyntaxError(ast->deleteToken, "Delete of an unqualified identifier in strict mode.");
+ throwSyntaxError(ast->deleteToken, QStringLiteral("Delete of an unqualified identifier in strict mode."));
return false;
}
_expr.code = _block->CONST(V4IR::BoolType, 0);
return false;
}
if (_function->isStrict && expr->asName()) {
- throwSyntaxError(ast->deleteToken, "Delete of an unqualified identifier in strict mode.");
+ throwSyntaxError(ast->deleteToken, QStringLiteral("Delete of an unqualified identifier in strict mode."));
return false;
}
@@ -1371,7 +1371,7 @@ bool Codegen::visit(DeleteExpression *ast)
_expr.code = _block->CONST(V4IR::BoolType, 1);
return false;
}
- if (expr->asTemp() && expr->asTemp()->index >= _env->members.size()) {
+ if (expr->asTemp() && expr->asTemp()->index >= static_cast<unsigned>(_env->members.size())) {
_expr.code = _block->CONST(V4IR::BoolType, 1);
return false;
}
@@ -1432,7 +1432,7 @@ V4IR::Expr *Codegen::identifier(const QString &name, int line, int col)
Q_ASSERT (index < e->members.size());
if (index != -1) {
V4IR::Temp *t = _block->LOCAL(index, scope);
- if (name == "arguments" || name == "eval")
+ if (name == QStringLiteral("arguments") || name == QStringLiteral("eval"))
t->isArgumentsOrEval = true;
return t;
}
@@ -1595,7 +1595,7 @@ bool Codegen::visit(ObjectLiteral *ast)
ObjectPropertyValue &v = valueMap[name];
if (v.hasGetter() || v.hasSetter() || (_function->isStrict && v.value)) {
throwSyntaxError(nv->lastSourceLocation(),
- QCoreApplication::translate("qv4codegen", "Illegal duplicate key '%1' in object literal").arg(name));
+ QStringLiteral("Illegal duplicate key '%1' in object literal").arg(name));
return false;
}
@@ -1608,7 +1608,7 @@ bool Codegen::visit(ObjectLiteral *ast)
(gs->type == PropertyGetterSetter::Getter && v.hasGetter()) ||
(gs->type == PropertyGetterSetter::Setter && v.hasSetter())) {
throwSyntaxError(gs->lastSourceLocation(),
- QCoreApplication::translate("qv4codegen", "Illegal duplicate key '%1' in object literal").arg(name));
+ QStringLiteral("Illegal duplicate key '%1' in object literal").arg(name));
return false;
}
if (gs->type == PropertyGetterSetter::Getter)
@@ -1729,7 +1729,7 @@ bool Codegen::visit(PostDecrementExpression *ast)
Result expr = expression(ast->base);
if (!expr->isLValue()) {
- throwReferenceError(ast->base->lastSourceLocation(), "Invalid left-hand side expression in postfix operation");
+ throwReferenceError(ast->base->lastSourceLocation(), QStringLiteral("Invalid left-hand side expression in postfix operation"));
return false;
}
if (throwSyntaxErrorOnEvalOrArgumentsInStrictMode(*expr, ast->decrementToken))
@@ -1755,7 +1755,7 @@ bool Codegen::visit(PostIncrementExpression *ast)
Result expr = expression(ast->base);
if (!expr->isLValue()) {
- throwReferenceError(ast->base->lastSourceLocation(), "Invalid left-hand side expression in postfix operation");
+ throwReferenceError(ast->base->lastSourceLocation(), QStringLiteral("Invalid left-hand side expression in postfix operation"));
return false;
}
if (throwSyntaxErrorOnEvalOrArgumentsInStrictMode(*expr, ast->incrementToken))
@@ -1962,7 +1962,7 @@ int Codegen::defineFunction(const QString &name, AST::Node *ast,
function->column = loc.startColumn;
if (function->usesArgumentsObject)
- _env->enter("arguments", Environment::VariableDeclaration);
+ _env->enter(QStringLiteral("arguments"), Environment::VariableDeclaration);
// variables in global code are properties of the global context object, not locals as with other functions.
if (_env->compilationMode == FunctionCode || _env->compilationMode == QmlBinding) {
@@ -2032,7 +2032,7 @@ int Codegen::defineFunction(const QString &name, AST::Node *ast,
}
}
if (_function->usesArgumentsObject) {
- move(identifier("arguments", ast->firstSourceLocation().startLine, ast->firstSourceLocation().startColumn),
+ move(identifier(QStringLiteral("arguments"), ast->firstSourceLocation().startLine, ast->firstSourceLocation().startColumn),
_block->CALL(_block->NAME(V4IR::Name::builtin_setup_argument_object,
ast->firstSourceLocation().startLine, ast->firstSourceLocation().startColumn), 0));
}
@@ -2118,7 +2118,7 @@ bool Codegen::visit(BreakStatement *ast)
return false;
if (!_loop) {
- throwSyntaxError(ast->lastSourceLocation(), QCoreApplication::translate("qv4codegen", "Break outside of loop"));
+ throwSyntaxError(ast->lastSourceLocation(), QStringLiteral("Break outside of loop"));
return false;
}
Loop *loop = 0;
@@ -2130,7 +2130,7 @@ bool Codegen::visit(BreakStatement *ast)
break;
}
if (!loop) {
- throwSyntaxError(ast->lastSourceLocation(), QCoreApplication::translate("qv4codegen", "Undefined label '%1'").arg(ast->label.toString()));
+ throwSyntaxError(ast->lastSourceLocation(), QStringLiteral("Undefined label '%1'").arg(ast->label.toString()));
return false;
}
}
@@ -2159,12 +2159,12 @@ bool Codegen::visit(ContinueStatement *ast)
}
}
if (!loop) {
- throwSyntaxError(ast->lastSourceLocation(), QCoreApplication::translate("qv4codegen", "Undefined label '%1'").arg(ast->label.toString()));
+ throwSyntaxError(ast->lastSourceLocation(), QStringLiteral("Undefined label '%1'").arg(ast->label.toString()));
return false;
}
}
if (!loop) {
- throwSyntaxError(ast->lastSourceLocation(), QCoreApplication::translate("qv4codegen", "continue outside of loop"));
+ throwSyntaxError(ast->lastSourceLocation(), QStringLiteral("continue outside of loop"));
return false;
}
unwindException(loop->scopeAndFinally);
@@ -2451,7 +2451,7 @@ bool Codegen::visit(ReturnStatement *ast)
return true;
if (_env->compilationMode != FunctionCode && _env->compilationMode != QmlBinding) {
- throwSyntaxError(ast->returnToken, QCoreApplication::translate("qv4codegen", "Return statement outside of function"));
+ throwSyntaxError(ast->returnToken, QStringLiteral("Return statement outside of function"));
return false;
}
if (ast->expression) {
@@ -2580,7 +2580,7 @@ bool Codegen::visit(TryStatement *ast)
if (_function->isStrict && ast->catchExpression &&
(ast->catchExpression->name == QLatin1String("eval") || ast->catchExpression->name == QLatin1String("arguments"))) {
- throwSyntaxError(ast->catchExpression->identifierToken, QCoreApplication::translate("qv4codegen", "Catch variable name may not be eval or arguments in strict mode"));
+ throwSyntaxError(ast->catchExpression->identifierToken, QStringLiteral("Catch variable name may not be eval or arguments in strict mode"));
return false;
}
@@ -2827,7 +2827,7 @@ bool Codegen::throwSyntaxErrorOnEvalOrArgumentsInStrictMode(V4IR::Expr *expr, co
} else {
return false;
}
- throwSyntaxError(loc, QCoreApplication::translate("qv4codegen", "Variable name may not be eval or arguments in strict mode"));
+ throwSyntaxError(loc, QStringLiteral("Variable name may not be eval or arguments in strict mode"));
return true;
}
diff --git a/src/qml/compiler/qv4compileddata.cpp b/src/qml/compiler/qv4compileddata.cpp
index 0f5c1857c8..51f39e7e6c 100644
--- a/src/qml/compiler/qv4compileddata.cpp
+++ b/src/qml/compiler/qv4compileddata.cpp
@@ -55,13 +55,6 @@ namespace QV4 {
namespace CompiledData {
-namespace {
- bool functionSortHelper(QV4::Function *lhs, QV4::Function *rhs)
- {
- return reinterpret_cast<quintptr>(lhs->codePtr) < reinterpret_cast<quintptr>(rhs->codePtr);
- }
-}
-
CompilationUnit::~CompilationUnit()
{
unlink();
@@ -77,13 +70,13 @@ QV4::Function *CompilationUnit::linkToEngine(ExecutionEngine *engine)
runtimeStrings = (QV4::SafeString *)malloc(data->stringTableSize * sizeof(QV4::SafeString));
// memset the strings to 0 in case a GC run happens while we're within the loop below
memset(runtimeStrings, 0, data->stringTableSize * sizeof(QV4::SafeString));
- for (int i = 0; i < data->stringTableSize; ++i)
+ for (uint i = 0; i < data->stringTableSize; ++i)
runtimeStrings[i] = engine->newIdentifier(data->stringAt(i));
runtimeRegularExpressions = new QV4::SafeValue[data->regexpTableSize];
// memset the regexps to 0 in case a GC run happens while we're within the loop below
memset(runtimeRegularExpressions, 0, data->regexpTableSize * sizeof(QV4::SafeValue));
- for (int i = 0; i < data->regexpTableSize; ++i) {
+ for (uint i = 0; i < data->regexpTableSize; ++i) {
const CompiledData::RegExp *re = data->regexpAt(i);
int flags = 0;
if (re->flags & CompiledData::RegExp::RegExp_Global)
@@ -109,8 +102,8 @@ QV4::Function *CompilationUnit::linkToEngine(ExecutionEngine *engine)
else if (compiledLookups[i].type_and_flags == CompiledData::Lookup::Type_GlobalGetter)
l->globalGetter = QV4::Lookup::globalGetterGeneric;
- for (int i = 0; i < QV4::Lookup::Size; ++i)
- l->classList[i] = 0;
+ for (int j = 0; j < QV4::Lookup::Size; ++j)
+ l->classList[j] = 0;
l->level = -1;
l->index = UINT_MAX;
l->name = runtimeStrings[compiledLookups[i].nameIndex].asString();
@@ -120,7 +113,7 @@ QV4::Function *CompilationUnit::linkToEngine(ExecutionEngine *engine)
if (data->jsClassTableSize) {
runtimeClasses = (QV4::InternalClass**)malloc(data->jsClassTableSize * sizeof(QV4::InternalClass*));
- for (int i = 0; i < data->jsClassTableSize; ++i) {
+ for (uint i = 0; i < data->jsClassTableSize; ++i) {
int memberCount = 0;
const CompiledData::JSClassMember *member = data->jsClassAt(i, &memberCount);
QV4::InternalClass *klass = engine->objectClass;
@@ -167,17 +160,17 @@ void CompilationUnit::unlink()
void CompilationUnit::markObjects()
{
- for (int i = 0; i < data->stringTableSize; ++i)
+ for (uint i = 0; i < data->stringTableSize; ++i)
runtimeStrings[i].mark();
if (runtimeRegularExpressions) {
- for (int i = 0; i < data->regexpTableSize; ++i)
+ for (uint i = 0; i < data->regexpTableSize; ++i)
runtimeRegularExpressions[i].mark();
}
for (int i = 0; i < runtimeFunctions.count(); ++i)
if (runtimeFunctions[i])
runtimeFunctions[i]->mark();
if (runtimeLookups) {
- for (int i = 0; i < data->lookupTableSize; ++i)
+ for (uint i = 0; i < data->lookupTableSize; ++i)
runtimeLookups[i].name->mark();
}
}
diff --git a/src/qml/compiler/qv4compiler.cpp b/src/qml/compiler/qv4compiler.cpp
index 4ee34d8aec..a808e88afa 100644
--- a/src/qml/compiler/qv4compiler.cpp
+++ b/src/qml/compiler/qv4compiler.cpp
@@ -270,11 +270,11 @@ QV4::CompiledData::Unit *QV4::Compiler::JSUnitGenerator::generateUnit(int *total
}
uint *functionTable = (uint *)(data + unit->offsetToFunctionTable);
- for (uint i = 0; i < irModule->functions.size(); ++i)
+ for (int i = 0; i < irModule->functions.size(); ++i)
functionTable[i] = functionOffsets.value(irModule->functions.at(i));
char *f = data + unitSize + stringDataSize;
- for (uint i = 0; i < irModule->functions.size(); ++i) {
+ for (int i = 0; i < irModule->functions.size(); ++i) {
QQmlJS::V4IR::Function *function = irModule->functions.at(i);
if (function == irModule->rootFunction)
unit->indexOfRootFunction = i;
diff --git a/src/qml/compiler/qv4isel_masm.cpp b/src/qml/compiler/qv4isel_masm.cpp
index 0b372fec03..e33d3fdaf9 100644
--- a/src/qml/compiler/qv4isel_masm.cpp
+++ b/src/qml/compiler/qv4isel_masm.cpp
@@ -235,6 +235,8 @@ void Assembler::registerBlock(V4IR::BasicBlock* block, V4IR::BasicBlock *nextBlo
void Assembler::jumpToBlock(V4IR::BasicBlock* current, V4IR::BasicBlock *target)
{
+ Q_UNUSED(current);
+
if (target != _nextBlock)
_patches[target].append(jump());
}
@@ -371,6 +373,8 @@ void Assembler::copyValue(Result result, V4IR::Expr* source)
storeDouble(toDoubleRegister(source), result);
} else if (V4IR::Temp *temp = source->asTemp()) {
#ifdef VALUE_FITS_IN_REGISTER
+ Q_UNUSED(temp);
+
// Use ReturnValueRegister as "scratch" register because loadArgument
// and storeArgument are functions that may need a scratch register themselves.
loadArgumentInRegister(source, ReturnValueRegister, 0);
@@ -706,7 +710,7 @@ void InstructionSelection::run(int functionIndex)
foreach (V4IR::Stmt *s, _block->statements) {
if (s->location.isValid()) {
_as->recordLineNumber(s->location.startLine);
- if (s->location.startLine != lastLine) {
+ if (int(s->location.startLine) != lastLine) {
_as->saveInstructionPointer(Assembler::ScratchRegister);
lastLine = s->location.startLine;
}
@@ -744,7 +748,7 @@ QV4::CompiledData::CompilationUnit *InstructionSelection::backendCompileStep()
void InstructionSelection::callBuiltinInvalid(V4IR::Name *func, V4IR::ExprList *args, V4IR::Temp *result)
{
- int argc = prepareCallData(args, 0);
+ prepareCallData(args, 0);
if (useFastLookups && func->global) {
uint index = registerGlobalGetterLookup(*func->id);
@@ -936,7 +940,7 @@ void InstructionSelection::callValue(V4IR::Temp *value, V4IR::ExprList *args, V4
{
Q_ASSERT(value);
- int argc = prepareCallData(args, 0);
+ prepareCallData(args, 0);
generateFunctionCall(result, __qmljs_call_value, Assembler::ContextRegister,
Assembler::Reference(value),
baseAddressForCallData());
@@ -1350,7 +1354,7 @@ void InstructionSelection::unop(V4IR::AluOp oper, V4IR::Temp *sourceTemp, V4IR::
}
}
-static inline Assembler::FPRegisterID getFreeFPReg(V4IR::Expr *shouldNotOverlap, int hint)
+static inline Assembler::FPRegisterID getFreeFPReg(V4IR::Expr *shouldNotOverlap, unsigned hint)
{
if (V4IR::Temp *t = shouldNotOverlap->asTemp())
if (t->type == V4IR::DoubleType)
@@ -1481,7 +1485,7 @@ void InstructionSelection::callProperty(V4IR::Expr *base, const QString &name, V
{
assert(base != 0);
- int argc = prepareCallData(args, base);
+ prepareCallData(args, base);
if (useFastLookups) {
uint index = registerGetterLookup(name);
@@ -1502,7 +1506,7 @@ void InstructionSelection::callSubscript(V4IR::Expr *base, V4IR::Expr *index, V4
{
assert(base != 0);
- int argc = prepareCallData(args, base);
+ prepareCallData(args, base);
generateFunctionCall(result, __qmljs_call_element, Assembler::ContextRegister,
Assembler::PointerToValue(index),
baseAddressForCallData());
@@ -1806,7 +1810,7 @@ void InstructionSelection::convertTypeToUInt32(V4IR::Temp *source, V4IR::Temp *t
void InstructionSelection::constructActivationProperty(V4IR::Name *func, V4IR::ExprList *args, V4IR::Temp *result)
{
assert(func != 0);
- int argc = prepareCallData(args, 0);
+ prepareCallData(args, 0);
if (useFastLookups && func->global) {
uint index = registerGlobalGetterLookup(*func->id);
@@ -1825,7 +1829,7 @@ void InstructionSelection::constructActivationProperty(V4IR::Name *func, V4IR::E
void InstructionSelection::constructProperty(V4IR::Temp *base, const QString &name, V4IR::ExprList *args, V4IR::Temp *result)
{
- int argc = prepareCallData(args, 0);
+ prepareCallData(args, 0);
generateFunctionCall(result, __qmljs_construct_property, Assembler::ContextRegister,
Assembler::Reference(base), Assembler::PointerToString(name),
baseAddressForCallData());
@@ -1835,7 +1839,7 @@ void InstructionSelection::constructValue(V4IR::Temp *value, V4IR::ExprList *arg
{
assert(value != 0);
- int argc = prepareCallData(args, 0);
+ prepareCallData(args, 0);
generateFunctionCall(result, __qmljs_construct_value,
Assembler::ContextRegister,
Assembler::Reference(value),
diff --git a/src/qml/compiler/qv4isel_moth.cpp b/src/qml/compiler/qv4isel_moth.cpp
index a67675ecdf..df206d7890 100644
--- a/src/qml/compiler/qv4isel_moth.cpp
+++ b/src/qml/compiler/qv4isel_moth.cpp
@@ -638,7 +638,6 @@ void InstructionSelection::unop(V4IR::AluOp oper, V4IR::Temp *sourceTemp, V4IR::
if (_stackSlotAllocator)
_stackSlotAllocator->addHint(*sourceTemp, *targetTemp);
- QV4::UnaryOpName op = 0;
switch (oper) {
case V4IR::OpIfTrue:
Q_ASSERT(!"unreachable"); break;
diff --git a/src/qml/compiler/qv4jsir.cpp b/src/qml/compiler/qv4jsir.cpp
index 4c5847f778..b4630793ef 100644
--- a/src/qml/compiler/qv4jsir.cpp
+++ b/src/qml/compiler/qv4jsir.cpp
@@ -474,7 +474,7 @@ void Closure::dump(QTextStream &out) const
{
QString name = functionName ? *functionName : QString();
if (name.isEmpty())
- name.sprintf("%p", value);
+ name.sprintf("%x", value);
out << "closure(" << name << ')';
}
@@ -597,6 +597,8 @@ void Ret::dump(QTextStream &out, Mode)
void Phi::dump(QTextStream &out, Stmt::Mode mode)
{
+ Q_UNUSED(mode);
+
targetTemp->dump(out);
out << " = phi(";
for (int i = 0, ei = d->incoming.size(); i < ei; ++i) {
diff --git a/src/qml/compiler/qv4jsir_p.h b/src/qml/compiler/qv4jsir_p.h
index 41191b0bec..933ba1321d 100644
--- a/src/qml/compiler/qv4jsir_p.h
+++ b/src/qml/compiler/qv4jsir_p.h
@@ -578,7 +578,14 @@ struct Stmt {
AST::SourceLocation location;
Stmt(): d(0), id(-1) {}
- virtual ~Stmt() { Q_UNREACHABLE(); }
+ virtual ~Stmt()
+ {
+#ifdef Q_CC_MSVC
+ // MSVC complains about potential memory leaks if a destructor never returns.
+#else
+ Q_UNREACHABLE();
+#endif
+ }
virtual Stmt *asTerminator() { return 0; }
virtual void accept(StmtVisitor *) = 0;
diff --git a/src/qml/compiler/qv4regalloc.cpp b/src/qml/compiler/qv4regalloc.cpp
index 62013fc2b7..9a1897d494 100644
--- a/src/qml/compiler/qv4regalloc.cpp
+++ b/src/qml/compiler/qv4regalloc.cpp
@@ -51,7 +51,7 @@ struct Use {
unsigned flag : 1;
unsigned pos : 31;
- Use(): pos(0), flag(MustHaveRegister) {}
+ Use(): flag(MustHaveRegister), pos(0) {}
Use(int pos, RegisterFlag flag): flag(flag), pos(pos) {}
bool mustHaveRegister() const { return flag == MustHaveRegister; }
@@ -219,6 +219,8 @@ protected: // IRDecoder
virtual void callProperty(V4IR::Expr *base, const QString &name, V4IR::ExprList *args,
V4IR::Temp *result)
{
+ Q_UNUSED(name)
+
addDef(result);
addUses(base->asTemp(), Use::CouldHaveRegister);
addUses(args, Use::CouldHaveRegister);
@@ -336,6 +338,7 @@ protected: // IRDecoder
virtual void loadQmlIdObject(int id, V4IR::Temp *temp)
{
+ Q_UNUSED(id);
addDef(temp);
addCall();
}
@@ -354,22 +357,30 @@ protected: // IRDecoder
virtual void loadQmlScopeObject(Temp *temp)
{
+ Q_UNUSED(temp);
+
addDef(temp);
addCall();
}
virtual void loadConst(V4IR::Const *sourceConst, V4IR::Temp *targetTemp)
{
+ Q_UNUSED(sourceConst);
+
addDef(targetTemp);
}
virtual void loadString(const QString &str, V4IR::Temp *targetTemp)
{
+ Q_UNUSED(str);
+
addDef(targetTemp);
}
virtual void loadRegexp(V4IR::RegExp *sourceRegexp, V4IR::Temp *targetTemp)
{
+ Q_UNUSED(sourceRegexp);
+
addDef(targetTemp);
addCall();
}
@@ -388,6 +399,8 @@ protected: // IRDecoder
virtual void initClosure(V4IR::Closure *closure, V4IR::Temp *target)
{
+ Q_UNUSED(closure);
+
addDef(target);
addCall();
}
@@ -534,7 +547,7 @@ protected: // IRDecoder
#endif
} else if (Binop *b = s->cond->asBinop()) {
binop(b->op, b->left, b->right, 0);
- } else if (Const *c = s->cond->asConst()) {
+ } else if (s->cond->asConst()) {
// TODO: SSA optimization for constant condition evaluation should remove this.
// See also visitCJump() in masm.
addCall();
@@ -873,7 +886,7 @@ private:
if (_info->def(it.temp()) != successorStart && !it.isSplitFromInterval()) {
const int successorEnd = successor->statements.last()->id;
foreach (const Use &use, _info->uses(it.temp()))
- Q_ASSERT(use.pos < successorStart || use.pos > successorEnd);
+ Q_ASSERT(use.pos < static_cast<unsigned>(successorStart) || use.pos > static_cast<unsigned>(successorEnd));
}
#endif
@@ -954,7 +967,6 @@ protected:
int pReg = platformRegister(i);
t->kind = Temp::PhysicalRegister;
t->index = pReg;
- Q_ASSERT(t->index >= 0);
} else {
int stackSlot = _assignedSpillSlots.value(*t, -1);
Q_ASSERT(stackSlot >= 0);
diff --git a/src/qml/compiler/qv4ssa.cpp b/src/qml/compiler/qv4ssa.cpp
index 1c88740ef1..6b8c8af8e4 100644
--- a/src/qml/compiler/qv4ssa.cpp
+++ b/src/qml/compiler/qv4ssa.cpp
@@ -1274,7 +1274,7 @@ private:
}
protected:
- virtual void visitConst(Const *e) {}
+ virtual void visitConst(Const *) {}
virtual void visitString(String *) {}
virtual void visitRegExp(RegExp *) {}
virtual void visitName(Name *) {}
@@ -1897,8 +1897,8 @@ QHash<BasicBlock *, BasicBlock *> scheduleBlocks(Function *function, const Domin
I(const DominatorTree &df, QVector<BasicBlock *> &sequence,
QHash<BasicBlock *, BasicBlock *> &startEndLoops)
: df(df)
- , sequence(sequence)
, startEndLoops(startEndLoops)
+ , sequence(sequence)
, currentGroup(0)
{}
@@ -1963,6 +1963,7 @@ QHash<BasicBlock *, BasicBlock *> scheduleBlocks(Function *function, const Domin
return startEndLoops;
}
+#ifndef QT_NO_DEBUG
void checkCriticalEdges(QVector<BasicBlock *> basicBlocks) {
foreach (BasicBlock *bb, basicBlocks) {
if (bb && bb->out.size() > 1) {
@@ -1976,6 +1977,7 @@ void checkCriticalEdges(QVector<BasicBlock *> basicBlocks) {
}
}
}
+#endif
void cleanupBasicBlocks(Function *function)
{
@@ -2038,20 +2040,6 @@ inline Const *isConstPhi(Phi *phi)
return 0;
}
-inline Temp *isSameTempPhi(Phi *phi)
-{
- if (Temp *t = phi->d->incoming[0]->asTemp()) {
- for (int i = 1, ei = phi->d->incoming.size(); i != ei; ++i) {
- if (Temp *tt = phi->d->incoming[i]->asTemp())
- if (t->index == tt->index)
- continue;
- return 0;
- }
- return t;
- }
- return 0;
-}
-
static Expr *clone(Expr *e, Function *function) {
if (Temp *t = e->asTemp()) {
return CloneExpr::cloneTemp(t, function);
@@ -2636,7 +2624,7 @@ protected:
virtual void visitJump(Jump *) {}
virtual void visitCJump(CJump *s) { s->cond->accept(this); }
virtual void visitRet(Ret *s) { s->expr->accept(this); }
- virtual void visitPhi(Phi *s) {
+ virtual void visitPhi(Phi *) {
// Handled separately
}
};
diff --git a/src/qml/debugger/qv4debugservice_p.h b/src/qml/debugger/qv4debugservice_p.h
index a89b009c7f..e61bc01d19 100644
--- a/src/qml/debugger/qv4debugservice_p.h
+++ b/src/qml/debugger/qv4debugservice_p.h
@@ -57,7 +57,7 @@
QT_BEGIN_NAMESPACE
-namespace QV4 { class ExecutionEngine; }
+namespace QV4 { struct ExecutionEngine; }
class QQmlEngine;
class QV4DebugServicePrivate;
diff --git a/src/qml/debugger/qv8profilerservice.cpp b/src/qml/debugger/qv8profilerservice.cpp
index 33d6747b3b..7b9331da66 100644
--- a/src/qml/debugger/qv8profilerservice.cpp
+++ b/src/qml/debugger/qv8profilerservice.cpp
@@ -247,7 +247,7 @@ void QV8ProfilerService::stopProfiling(const QString &title)
void QV8ProfilerService::takeSnapshot()
{
- Q_D(QV8ProfilerService);
+// Q_D(QV8ProfilerService);
// ### FIXME: v4
// d->takeSnapshot(v8::HeapSnapshot::kFull);
}
@@ -260,7 +260,7 @@ void QV8ProfilerService::deleteSnapshots()
void QV8ProfilerService::sendProfilingData()
{
- Q_D(QV8ProfilerService);
+// Q_D(QV8ProfilerService);
// Send messages to client
// ### FIXME: v4
// d->sendMessages();
diff --git a/src/qml/jsapi/qjsvalue.cpp b/src/qml/jsapi/qjsvalue.cpp
index 9031187d7e..4035fb9fa6 100644
--- a/src/qml/jsapi/qjsvalue.cpp
+++ b/src/qml/jsapi/qjsvalue.cpp
@@ -712,11 +712,12 @@ void QJSValue::setPrototype(const QJSValue& prototype)
*/
QJSValue& QJSValue::operator=(const QJSValue& other)
{
- if (d == other.d)
- return *this;
- d->deref();
- d = other.d;
- d->ref();
+ if (d != other.d) {
+ d->deref();
+ d = other.d;
+ d->ref();
+ }
+ return *this;
}
/*!
diff --git a/src/qml/jsruntime/qv4argumentsobject.cpp b/src/qml/jsruntime/qv4argumentsobject.cpp
index fb4fcb7b1a..13075f05ed 100644
--- a/src/qml/jsruntime/qv4argumentsobject.cpp
+++ b/src/qml/jsruntime/qv4argumentsobject.cpp
@@ -66,7 +66,7 @@ ArgumentsObject::ArgumentsObject(CallContext *context)
memberData[CallerPropertyIndex] = pd;
arrayReserve(context->callData->argc);
- for (unsigned int i = 0; i < context->callData->argc; ++i)
+ for (int i = 0; i < context->callData->argc; ++i)
arrayData[i].value = context->callData->args[i];
arrayDataLen = context->callData->argc;
} else {
@@ -154,7 +154,7 @@ ReturnedValue ArgumentsGetterFunction::call(Managed *getter, CallData *callData)
if (!o)
return v4->current->throwTypeError();
- Q_ASSERT(g->index < o->context->callData->argc);
+ Q_ASSERT(g->index < static_cast<unsigned>(o->context->callData->argc));
return o->context->argument(g->index);
}
@@ -169,7 +169,7 @@ ReturnedValue ArgumentsSetterFunction::call(Managed *setter, CallData *callData)
if (!o)
return v4->current->throwTypeError();
- Q_ASSERT(s->index < o->context->callData->argc);
+ Q_ASSERT(s->index < static_cast<unsigned>(o->context->callData->argc));
o->context->callData->args[s->index] = callData->argc ? callData->args[0].asReturnedValue() : Encode::undefined();
return Encode::undefined();
}
diff --git a/src/qml/jsruntime/qv4arrayobject.cpp b/src/qml/jsruntime/qv4arrayobject.cpp
index 22ad10560e..85423a4118 100644
--- a/src/qml/jsruntime/qv4arrayobject.cpp
+++ b/src/qml/jsruntime/qv4arrayobject.cpp
@@ -143,7 +143,7 @@ ReturnedValue ArrayPrototype::method_toString(SimpleCallContext *ctx)
ScopedObject o(scope, ctx->callData->thisObject, ScopedObject::Convert);
if (ctx->engine->hasException)
return Encode::undefined();
- ScopedString s(scope, ctx->engine->newString("join"));
+ ScopedString s(scope, ctx->engine->newString(QStringLiteral("join")));
ScopedFunctionObject f(scope, o->get(s));
if (!!f) {
ScopedCallData d(scope, 0);
@@ -174,7 +174,7 @@ ReturnedValue ArrayPrototype::method_concat(SimpleCallContext *ctx)
}
ScopedArrayObject elt(scope);
- for (uint i = 0; i < ctx->callData->argc; ++i) {
+ for (int i = 0; i < ctx->callData->argc; ++i) {
elt = ctx->callData->args[i];
if (elt)
result->arrayConcat(elt.getPointer());
@@ -299,7 +299,7 @@ ReturnedValue ArrayPrototype::method_push(SimpleCallContext *ctx)
}
if (!instance->protoHasArray() && instance->arrayDataLen <= len) {
- for (uint i = 0; i < ctx->callData->argc; ++i) {
+ for (int i = 0; i < ctx->callData->argc; ++i) {
if (!instance->sparseArray) {
if (len >= instance->arrayAlloc)
instance->arrayReserve(len + 1);
@@ -308,13 +308,13 @@ ReturnedValue ArrayPrototype::method_push(SimpleCallContext *ctx)
instance->arrayAttributes[len] = Attr_Data;
instance->arrayDataLen = len + 1;
} else {
- uint i = instance->allocArrayValue(ctx->callData->args[i]);
- instance->sparseArray->push_back(i, len);
+ uint j = instance->allocArrayValue(ctx->callData->args[i]);
+ instance->sparseArray->push_back(j, len);
}
++len;
}
} else {
- for (uint i = 0; i < ctx->callData->argc; ++i)
+ for (int i = 0; i < ctx->callData->argc; ++i)
instance->putIndexed(len + i, ctx->callData->args[i]);
len += ctx->callData->argc;
}
@@ -591,7 +591,7 @@ ReturnedValue ArrayPrototype::method_unshift(SimpleCallContext *ctx)
else
instance->deleteIndexedProperty(k + ctx->callData->argc - 1);
}
- for (uint i = 0; i < ctx->callData->argc; ++i)
+ for (int i = 0; i < ctx->callData->argc; ++i)
instance->putIndexed(i, ctx->callData->args[i]);
}
diff --git a/src/qml/jsruntime/qv4context.cpp b/src/qml/jsruntime/qv4context.cpp
index ece31822b5..a8628d6fa8 100644
--- a/src/qml/jsruntime/qv4context.cpp
+++ b/src/qml/jsruntime/qv4context.cpp
@@ -85,7 +85,7 @@ CallContext *ExecutionContext::newCallContext(void *stackSpace, SafeValue *local
if (function->varCount)
std::fill(c->locals, c->locals + function->varCount, Primitive::undefinedValue());
- if (callData->argc < function->formalParameterCount) {
+ if (callData->argc < static_cast<int>(function->formalParameterCount)) {
#ifndef QT_NO_DEBUG
Q_ASSERT(function->formalParameterCount <= QV4::Global::ReservedArgumentCount);
#endif
@@ -128,7 +128,7 @@ CallContext *ExecutionContext::newCallContext(FunctionObject *function, CallData
c->callData = reinterpret_cast<CallData *>(c->locals + function->varCount);
::memcpy(c->callData, callData, sizeof(CallData) + (callData->argc - 1) * sizeof(SafeValue));
- if (callData->argc < function->formalParameterCount)
+ if (callData->argc < static_cast<int>(function->formalParameterCount))
std::fill(c->callData->args + c->callData->argc, c->callData->args + function->formalParameterCount, Primitive::undefinedValue());
c->callData->argc = qMax((uint)callData->argc, function->formalParameterCount);
@@ -309,13 +309,13 @@ bool ExecutionContext::deleteProperty(const StringRef name)
}
if (strictMode)
- throwSyntaxError(QString("Can't delete property %1").arg(name->toQString()));
+ throwSyntaxError(QStringLiteral("Can't delete property %1").arg(name->toQString()));
return true;
}
bool CallContext::needsOwnArguments() const
{
- return function->needsActivation || callData->argc < function->formalParameterCount;
+ return function->needsActivation || callData->argc < static_cast<int>(function->formalParameterCount);
}
void ExecutionContext::mark()
@@ -328,7 +328,7 @@ void ExecutionContext::mark()
outer->mark();
callData->thisObject.mark();
- for (unsigned arg = 0; arg < callData->argc; ++arg)
+ for (int arg = 0; arg < callData->argc; ++arg)
callData->args[arg].mark();
if (type >= Type_CallContext) {
diff --git a/src/qml/jsruntime/qv4dateobject.cpp b/src/qml/jsruntime/qv4dateobject.cpp
index 688730af9b..462210adae 100644
--- a/src/qml/jsruntime/qv4dateobject.cpp
+++ b/src/qml/jsruntime/qv4dateobject.cpp
@@ -1282,25 +1282,25 @@ ReturnedValue DatePrototype::method_toISOString(SimpleCallContext *ctx)
if (year < 0 || year > 9999) {
if (qAbs(year) >= 1000000)
return ctx->engine->newString(QStringLiteral("Invalid Date"))->asReturnedValue();
- result += year < 0 ? '-' : '+';
+ result += year < 0 ? QLatin1Char('-') : QLatin1Char('+');
year = qAbs(year);
addZeroPrefixedInt(result, year, 6);
} else {
addZeroPrefixedInt(result, year, 4);
}
- result += '-';
+ result += QLatin1Char('-');
addZeroPrefixedInt(result, (int)MonthFromTime(t) + 1, 2);
- result += '-';
+ result += QLatin1Char('-');
addZeroPrefixedInt(result, (int)DateFromTime(t), 2);
- result += 'T';
+ result += QLatin1Char('T');
addZeroPrefixedInt(result, HourFromTime(t), 2);
- result += ':';
+ result += QLatin1Char(':');
addZeroPrefixedInt(result, MinFromTime(t), 2);
- result += ':';
+ result += QLatin1Char(':');
addZeroPrefixedInt(result, SecFromTime(t), 2);
- result += '.';
+ result += QLatin1Char('.');
addZeroPrefixedInt(result, msFromTime(t), 3);
- result += 'Z';
+ result += QLatin1Char('Z');
return ctx->engine->newString(result)->asReturnedValue();
}
diff --git a/src/qml/jsruntime/qv4debugging.cpp b/src/qml/jsruntime/qv4debugging.cpp
index a29aba8504..a9fc050483 100644
--- a/src/qml/jsruntime/qv4debugging.cpp
+++ b/src/qml/jsruntime/qv4debugging.cpp
@@ -356,6 +356,8 @@ void Debugger::maybeBreakAtInstruction(const uchar *code, bool breakPointHit)
void Debugger::aboutToThrow(const QV4::ValueRef value)
{
+ Q_UNUSED(value);
+
qDebug() << "*** We are about to throw...";
}
@@ -470,7 +472,7 @@ void Debugger::BreakPoints::applyToFunction(Function *function, bool removeBreak
while (breakPoint != breakPointsForFile->end()) {
bool breakPointFound = false;
const quint32 *lineNumberMappings = function->compiledFunction->lineNumberMapping();
- for (int i = 0; i < function->compiledFunction->nLineNumberMappingEntries; ++i) {
+ for (quint32 i = 0; i < function->compiledFunction->nLineNumberMappingEntries; ++i) {
const int codeOffset = lineNumberMappings[i * 2];
const int lineNumber = lineNumberMappings[i * 2 + 1];
if (lineNumber == *breakPoint) {
diff --git a/src/qml/jsruntime/qv4engine.cpp b/src/qml/jsruntime/qv4engine.cpp
index 3b5b1f3ff9..6cb269d842 100644
--- a/src/qml/jsruntime/qv4engine.cpp
+++ b/src/qml/jsruntime/qv4engine.cpp
@@ -857,7 +857,7 @@ QQmlError ExecutionEngine::catchExceptionAsQmlError(ExecutionContext *context)
}
QV4::Scoped<QV4::ErrorObject> errorObj(scope, exception);
if (!!errorObj && errorObj->asSyntaxError()) {
- QV4::ScopedString m(scope, errorObj->engine()->newString("message"));
+ QV4::ScopedString m(scope, errorObj->engine()->newString(QStringLiteral("message")));
QV4::ScopedValue v(scope, errorObj->get(m));
error.setDescription(v->toQStringNoThrow());
} else
diff --git a/src/qml/jsruntime/qv4errorobject.cpp b/src/qml/jsruntime/qv4errorobject.cpp
index 12ac4218bd..f149bc556e 100644
--- a/src/qml/jsruntime/qv4errorobject.cpp
+++ b/src/qml/jsruntime/qv4errorobject.cpp
@@ -82,7 +82,7 @@ ErrorObject::ErrorObject(InternalClass *ic)
Scope scope(engine());
ScopedValue protectThis(scope, this);
- ScopedString s(scope, ic->engine->newString("Error"));
+ ScopedString s(scope, ic->engine->newString(QStringLiteral("Error")));
defineDefaultProperty(QStringLiteral("name"), s);
}
diff --git a/src/qml/jsruntime/qv4function.cpp b/src/qml/jsruntime/qv4function.cpp
index d660457aa6..99d5de4fe5 100644
--- a/src/qml/jsruntime/qv4function.cpp
+++ b/src/qml/jsruntime/qv4function.cpp
@@ -58,19 +58,21 @@ Function::Function(ExecutionEngine *engine, CompiledData::CompilationUnit *unit,
, codeData(0)
, codeSize(_codeSize)
{
+ Q_UNUSED(engine);
+
name = compilationUnit->runtimeStrings[compiledFunction->nameIndex].asString();
formals.resize(compiledFunction->nFormals);
formals.fill(0);
const quint32 *formalsIndices = compiledFunction->formalsTable();
- for (int i = 0; i < compiledFunction->nFormals; ++i)
+ for (quint32 i = 0; i < compiledFunction->nFormals; ++i)
formals[i] = compilationUnit->runtimeStrings[formalsIndices[i]].asString();
locals.resize(compiledFunction->nLocals);
locals.fill(0);
const quint32 *localsIndices = compiledFunction->localsTable();
- for (int i = 0; i < compiledFunction->nLocals; ++i)
+ for (quint32 i = 0; i < compiledFunction->nLocals; ++i)
locals[i] = compilationUnit->runtimeStrings[localsIndices[i]].asString();
}
@@ -92,7 +94,7 @@ namespace QV4 {
struct LineNumberMappingHelper
{
const quint32 *table;
- int lowerBound(int begin, int end, qptrdiff offset) {
+ int lowerBound(int begin, int end, quint32 offset) {
int middle;
int n = int(end - begin);
int half;
@@ -122,7 +124,7 @@ int Function::lineNumberForProgramCounter(qptrdiff offset) const
int pos = helper.lowerBound(0, count, offset);
if (pos != 0 && count > 0)
--pos;
- if (pos == count)
+ if (static_cast<uint>(pos) == count)
return -1;
return helper.table[pos * 2 + 1];
}
diff --git a/src/qml/jsruntime/qv4functionobject.cpp b/src/qml/jsruntime/qv4functionobject.cpp
index 523ef9c1e7..d8029548f4 100644
--- a/src/qml/jsruntime/qv4functionobject.cpp
+++ b/src/qml/jsruntime/qv4functionobject.cpp
@@ -244,7 +244,7 @@ ReturnedValue FunctionCtor::construct(Managed *that, CallData *callData)
QString arguments;
QString body;
if (callData->argc > 0) {
- for (uint i = 0; i < callData->argc - 1; ++i) {
+ for (int i = 0; i < callData->argc - 1; ++i) {
if (i)
arguments += QLatin1String(", ");
arguments += callData->args[i].toString(ctx)->toQString();
@@ -264,13 +264,13 @@ ReturnedValue FunctionCtor::construct(Managed *that, CallData *callData)
const bool parsed = parser.parseExpression();
if (!parsed)
- return f->engine()->current->throwSyntaxError(0);
+ return f->engine()->current->throwSyntaxError(QLatin1String("Parse error"));
using namespace QQmlJS::AST;
FunctionExpression *fe = QQmlJS::AST::cast<FunctionExpression *>(parser.rootNode());
ExecutionEngine *v4 = f->engine();
if (!fe)
- return v4->current->throwSyntaxError(0);
+ return f->engine()->current->throwSyntaxError(QLatin1String("Parse error"));
QQmlJS::V4IR::Module module(v4->debugger != 0);
@@ -350,7 +350,7 @@ ReturnedValue FunctionPrototype::method_apply(SimpleCallContext *ctx)
callData->args[i] = arr->getIndexed(i);
} else {
int alen = qMin(len, arr->arrayDataLen);
- for (quint32 i = 0; i < alen; ++i)
+ for (int i = 0; i < alen; ++i)
callData->args[i] = arr->arrayData[i].value;
for (quint32 i = alen; i < len; ++i)
callData->args[i] = Primitive::undefinedValue();
@@ -387,7 +387,7 @@ ReturnedValue FunctionPrototype::method_bind(SimpleCallContext *ctx)
ScopedValue boundThis(scope, ctx->argument(0));
QVector<SafeValue> boundArgs;
- for (uint i = 1; i < ctx->callData->argc; ++i)
+ for (int i = 1; i < ctx->callData->argc; ++i)
boundArgs += ctx->callData->args[i];
return ctx->engine->newBoundFunction(ctx->engine->rootContext, target, boundThis, boundArgs)->asReturnedValue();
@@ -462,7 +462,6 @@ ReturnedValue ScriptFunction::construct(Managed *that, CallData *callData)
ReturnedValue ScriptFunction::call(Managed *that, CallData *callData)
{
ScriptFunction *f = static_cast<ScriptFunction *>(that);
- void *stackSpace;
ExecutionContext *context = f->engine()->current;
Scope scope(context);
if (scope.hasException())
@@ -642,7 +641,7 @@ DEFINE_MANAGED_VTABLE(IndexedBuiltinFunction);
DEFINE_MANAGED_VTABLE(BoundFunction);
BoundFunction::BoundFunction(ExecutionContext *scope, FunctionObjectRef target, const ValueRef boundThis, const QVector<SafeValue> &boundArgs)
- : FunctionObject(scope, 0)
+ : FunctionObject(scope, QStringLiteral("__bound function__"))
, target(target)
, boundArgs(boundArgs)
{
diff --git a/src/qml/jsruntime/qv4globalobject.cpp b/src/qml/jsruntime/qv4globalobject.cpp
index fca49308cc..3ded454f2e 100644
--- a/src/qml/jsruntime/qv4globalobject.cpp
+++ b/src/qml/jsruntime/qv4globalobject.cpp
@@ -101,16 +101,16 @@ static QString escape(const QString &input)
output.append(QChar(uc));
} else {
output.append('%');
- output.append(QChar(toHex(uc >> 4)));
- output.append(QChar(toHex(uc)));
+ output.append(QLatin1Char(toHex(uc >> 4)));
+ output.append(QLatin1Char(toHex(uc)));
}
} else {
output.append('%');
output.append('u');
- output.append(QChar(toHex(uc >> 12)));
- output.append(QChar(toHex(uc >> 8)));
- output.append(QChar(toHex(uc >> 4)));
- output.append(QChar(toHex(uc)));
+ output.append(QLatin1Char(toHex(uc >> 12)));
+ output.append(QLatin1Char(toHex(uc >> 8)));
+ output.append(QLatin1Char(toHex(uc >> 4)));
+ output.append(QLatin1Char(toHex(uc)));
}
}
return output;
@@ -396,7 +396,7 @@ ReturnedValue EvalFunction::evalCall(CallData *callData, bool directCall)
const QString code = callData->args[0].stringValue()->toQString();
bool inheritContext = !ctx->strictMode;
- Script script(ctx, code, QString("eval code"));
+ Script script(ctx, code, QStringLiteral("eval code"));
script.strictMode = (directCall && parentContext->strictMode);
script.inheritContext = inheritContext;
script.parse();
@@ -558,7 +558,7 @@ ReturnedValue GlobalFunctions::method_parseFloat(SimpleCallContext *ctx)
if (trimmed.startsWith(QLatin1String("Infinity"))
|| trimmed.startsWith(QLatin1String("+Infinity")))
return Encode(Q_INFINITY);
- if (trimmed.startsWith("-Infinity"))
+ if (trimmed.startsWith(QStringLiteral("-Infinity")))
return Encode(-Q_INFINITY);
QByteArray ba = trimmed.toLatin1();
bool ok;
diff --git a/src/qml/jsruntime/qv4identifier.cpp b/src/qml/jsruntime/qv4identifier.cpp
index 08f48c36a4..87fbd6f8e4 100644
--- a/src/qml/jsruntime/qv4identifier.cpp
+++ b/src/qml/jsruntime/qv4identifier.cpp
@@ -57,8 +57,8 @@ static inline int primeForNumBits(int numBits)
IdentifierHashData::IdentifierHashData(int numBits)
- : numBits(numBits)
- , size(0)
+ : size(0)
+ , numBits(numBits)
{
refCount.store(1);
alloc = primeForNumBits(numBits);
@@ -83,7 +83,7 @@ IdentifierHashEntry *IdentifierHashBase::addEntry(const Identifier *identifier)
int newAlloc = primeForNumBits(d->numBits);
IdentifierHashEntry *newEntries = (IdentifierHashEntry *)malloc(newAlloc * sizeof(IdentifierHashEntry));
memset(newEntries, 0, newAlloc*sizeof(IdentifierHashEntry));
- for (uint i = 0; i < d->alloc; ++i) {
+ for (int i = 0; i < d->alloc; ++i) {
const IdentifierHashEntry &e = d->entries[i];
if (!e.identifier)
continue;
diff --git a/src/qml/jsruntime/qv4identifiertable.cpp b/src/qml/jsruntime/qv4identifiertable.cpp
index 04c31828cc..e300a4811e 100644
--- a/src/qml/jsruntime/qv4identifiertable.cpp
+++ b/src/qml/jsruntime/qv4identifiertable.cpp
@@ -91,7 +91,7 @@ void IdentifierTable::addEntry(String *str)
int newAlloc = primeForNumBits(numBits);
String **newEntries = (String **)malloc(newAlloc*sizeof(String *));
memset(newEntries, 0, newAlloc*sizeof(String *));
- for (uint i = 0; i < alloc; ++i) {
+ for (int i = 0; i < alloc; ++i) {
String *e = entries[i];
if (!e)
continue;
diff --git a/src/qml/jsruntime/qv4include.cpp b/src/qml/jsruntime/qv4include.cpp
index 40f7b865d0..f156065125 100644
--- a/src/qml/jsruntime/qv4include.cpp
+++ b/src/qml/jsruntime/qv4include.cpp
@@ -89,11 +89,11 @@ QV4::ReturnedValue QV4Include::resultValue(QV4::ExecutionEngine *v4, Status stat
QV4::ScopedObject o(scope, v4->newObject());
QV4::ScopedString s(scope);
QV4::ScopedValue v(scope);
- o->put((s = v4->newString("OK")), (v = QV4::Primitive::fromInt32(Ok)));
- o->put((s = v4->newString("LOADING")), (v = QV4::Primitive::fromInt32(Loading)));
- o->put((s = v4->newString("NETWORK_ERROR")), (v = QV4::Primitive::fromInt32(NetworkError)));
- o->put((s = v4->newString("EXCEPTION")), (v = QV4::Primitive::fromInt32(Exception)));
- o->put((s = v4->newString("status")), (v = QV4::Primitive::fromInt32(status)));
+ o->put((s = v4->newString(QStringLiteral("OK"))), (v = QV4::Primitive::fromInt32(Ok)));
+ o->put((s = v4->newString(QStringLiteral("LOADING"))), (v = QV4::Primitive::fromInt32(Loading)));
+ o->put((s = v4->newString(QStringLiteral("NETWORK_ERROR"))), (v = QV4::Primitive::fromInt32(NetworkError)));
+ o->put((s = v4->newString(QStringLiteral("EXCEPTION"))), (v = QV4::Primitive::fromInt32(Exception)));
+ o->put((s = v4->newString(QStringLiteral("status"))), (v = QV4::Primitive::fromInt32(status)));
return o.asReturnedValue();
}
@@ -154,19 +154,19 @@ void QV4Include::finished()
QV4::Script script(v4, qmlglobal, code, m_url.toString());
QV4::ExecutionContext *ctx = v4->current;
- QV4::ScopedString status(scope, v4->newString("status"));
+ QV4::ScopedString status(scope, v4->newString(QStringLiteral("status")));
script.parse();
if (!scope.engine->hasException)
script.run();
if (scope.engine->hasException) {
QV4::ScopedValue ex(scope, ctx->catchException());
resultObj->put(status, QV4::ScopedValue(scope, QV4::Primitive::fromInt32(Exception)));
- resultObj->put(QV4::ScopedString(scope, v4->newString("exception")), ex);
+ resultObj->put(QV4::ScopedString(scope, v4->newString(QStringLiteral("exception"))), ex);
} else {
resultObj->put(status, QV4::ScopedValue(scope, QV4::Primitive::fromInt32(Ok)));
}
} else {
- resultObj->put(QV4::ScopedString(scope, v4->newString("status")), QV4::ScopedValue(scope, QV4::Primitive::fromInt32(NetworkError)));
+ resultObj->put(QV4::ScopedString(scope, v4->newString(QStringLiteral("status"))), QV4::ScopedValue(scope, QV4::Primitive::fromInt32(NetworkError)));
}
QV4::ScopedValue cb(scope, m_callbackFunction.value());
@@ -227,7 +227,7 @@ QV4::ReturnedValue QV4Include::method_include(QV4::SimpleCallContext *ctx)
if (v4->hasException) {
QV4::ScopedValue ex(scope, ctx->catchException());
result = resultValue(v4, Exception);
- result->asObject()->put(QV4::ScopedString(scope, v4->newString("exception")), ex);
+ result->asObject()->put(QV4::ScopedString(scope, v4->newString(QStringLiteral("exception"))), ex);
} else {
result = resultValue(v4, Ok);
}
diff --git a/src/qml/jsruntime/qv4internalclass.cpp b/src/qml/jsruntime/qv4internalclass.cpp
index 02783b79a0..c3dd3e0505 100644
--- a/src/qml/jsruntime/qv4internalclass.cpp
+++ b/src/qml/jsruntime/qv4internalclass.cpp
@@ -69,8 +69,8 @@ static inline int primeForNumBits(int numBits)
}
PropertyHashData::PropertyHashData(int numBits)
- : numBits(numBits)
- , size(0)
+ : size(0)
+ , numBits(numBits)
{
refCount.store(1);
alloc = primeForNumBits(numBits);
@@ -85,9 +85,9 @@ void PropertyHash::addEntry(const PropertyHash::Entry &entry, int classSize)
if (classSize < d->size || grow) {
PropertyHashData *dd = new PropertyHashData(grow ? d->numBits + 1 : d->numBits);
- for (uint i = 0; i < d->alloc; ++i) {
+ for (int i = 0; i < d->alloc; ++i) {
const Entry &e = d->entries[i];
- if (!e.identifier || e.index >= classSize)
+ if (!e.identifier || e.index >= static_cast<unsigned>(classSize))
continue;
uint idx = e.identifier->hashValue % dd->alloc;
while (dd->entries[idx].identifier) {
@@ -155,7 +155,7 @@ InternalClass *InternalClass::changeMember(String *string, PropertyAttributes da
return this;
- Transition t = { string->identifier, (int)data.flags() };
+ Transition t = { { string->identifier }, (int)data.flags() };
QHash<Transition, InternalClass *>::const_iterator tit = transitions.constFind(t);
if (tit != transitions.constEnd())
return tit.value();
@@ -211,7 +211,7 @@ InternalClass *InternalClass::addMember(String *string, PropertyAttributes data,
if (propertyTable.lookup(string->identifier) < size)
return changeMember(string, data, index);
- Transition t = { string->identifier, (int)data.flags() };
+ Transition t = { { string->identifier }, (int)data.flags() };
QHash<Transition, InternalClass *>::const_iterator tit = transitions.constFind(t);
if (index)
@@ -239,9 +239,9 @@ InternalClass *InternalClass::addMember(String *string, PropertyAttributes data,
void InternalClass::removeMember(Object *object, Identifier *id)
{
int propIdx = propertyTable.lookup(id);
- assert(propIdx < size);
+ assert(propIdx < static_cast<int>(size));
- Transition t = { id, -1 };
+ Transition t = { { id } , -1 };
QHash<Transition, InternalClass *>::const_iterator tit = transitions.constFind(t);
if (tit != transitions.constEnd()) {
diff --git a/src/qml/jsruntime/qv4jsonobject.cpp b/src/qml/jsruntime/qv4jsonobject.cpp
index 5a8acf803c..8d693f7705 100644
--- a/src/qml/jsruntime/qv4jsonobject.cpp
+++ b/src/qml/jsruntime/qv4jsonobject.cpp
@@ -614,8 +614,8 @@ bool JsonParser::parseString(QString *string)
}
qDebug() << "scanEscape" << hex << ch;
if (QChar::requiresSurrogates(ch)) {
- *string += QChar::highSurrogate(ch);
- *string += QChar::lowSurrogate(ch);
+ *string += QChar(QChar::highSurrogate(ch));
+ *string += QChar(QChar::lowSurrogate(ch));
} else {
*string += QChar(ch);
}
@@ -661,42 +661,42 @@ struct Stringify
static QString quote(const QString &str)
{
- QString product = "\"";
+ QString product = QStringLiteral("\"");
for (int i = 0; i < str.length(); ++i) {
QChar c = str.at(i);
switch (c.unicode()) {
case '"':
- product += "\\\"";
+ product += QStringLiteral("\\\"");
break;
case '\\':
- product += "\\\\";
+ product += QStringLiteral("\\\\");
break;
case '\b':
- product += "\\b";
+ product += QStringLiteral("\\b");
break;
case '\f':
- product += "\\f";
+ product += QStringLiteral("\\f");
break;
case '\n':
- product += "\\n";
+ product += QStringLiteral("\\n");
break;
case '\r':
- product += "\\r";
+ product += QStringLiteral("\\r");
break;
case '\t':
- product += "\\t";
+ product += QStringLiteral("\\t");
break;
default:
if (c.unicode() <= 0x1f) {
- product += "\\u00";
- product += c.unicode() > 0xf ? '1' : '0';
- product += "0123456789abcdef"[c.unicode() & 0xf];
+ product += QStringLiteral("\\u00");
+ product += c.unicode() > 0xf ? QLatin1Char('1') : QLatin1Char('0');
+ product += QLatin1Char("0123456789abcdef"[c.unicode() & 0xf]);
} else {
product += c;
}
}
}
- product += '"';
+ product += QLatin1Char('"');
return product;
}
@@ -768,9 +768,9 @@ QString Stringify::makeMember(const QString &key, ValueRef v)
{
QString strP = Str(key, v);
if (!strP.isEmpty()) {
- QString member = quote(key) + ':';
+ QString member = quote(key) + QLatin1Char(':');
if (!gap.isEmpty())
- member += ' ';
+ member += QLatin1Char(' ');
member += strP;
return member;
}
@@ -823,10 +823,10 @@ QString Stringify::JO(ObjectRef o)
if (partial.isEmpty()) {
result = QStringLiteral("{}");
} else if (gap.isEmpty()) {
- result = "{" + partial.join(",") + "}";
+ result = QStringLiteral("{") + partial.join(QLatin1Char(',')) + QStringLiteral("}");
} else {
- QString separator = ",\n" + indent;
- result = "{\n" + indent + partial.join(separator) + "\n" + stepback + "}";
+ QString separator = QStringLiteral(",\n") + indent;
+ result = QStringLiteral("{\n") + indent + partial.join(separator) + QStringLiteral("\n") + stepback + QStringLiteral("}");
}
indent = stepback;
@@ -868,10 +868,10 @@ QString Stringify::JA(ArrayObjectRef a)
if (partial.isEmpty()) {
result = QStringLiteral("[]");
} else if (gap.isEmpty()) {
- result = "[" + partial.join(",") + "]";
+ result = QStringLiteral("[") + partial.join(QLatin1Char(',')) + QStringLiteral("]");
} else {
- QString separator = ",\n" + indent;
- result = "[\n" + indent + partial.join(separator) + "\n" + stepback + "]";
+ QString separator = QStringLiteral(",\n") + indent;
+ result = QStringLiteral("[\n") + indent + partial.join(separator) + QStringLiteral("\n") + stepback + QStringLiteral("]");
}
indent = stepback;
@@ -905,7 +905,7 @@ ReturnedValue JsonObject::method_parse(SimpleCallContext *ctx)
ScopedValue result(scope, parser.parse(&error));
if (error.error != QJsonParseError::NoError) {
DEBUG << "parse error" << error.errorString();
- return ctx->throwSyntaxError("JSON.parse: Parse error");
+ return ctx->throwSyntaxError(QStringLiteral("JSON.parse: Parse error"));
}
return result.asReturnedValue();
diff --git a/src/qml/jsruntime/qv4lookup.cpp b/src/qml/jsruntime/qv4lookup.cpp
index 4123e95d87..f67b24c040 100644
--- a/src/qml/jsruntime/qv4lookup.cpp
+++ b/src/qml/jsruntime/qv4lookup.cpp
@@ -343,7 +343,7 @@ ReturnedValue Lookup::globalGetterGeneric(Lookup *l, ExecutionContext *ctx)
}
Scope scope(ctx);
Scoped<String> n(scope, l->name);
- ctx->throwReferenceError(n);
+ return ctx->throwReferenceError(n);
}
ReturnedValue Lookup::globalGetter0(Lookup *l, ExecutionContext *ctx)
diff --git a/src/qml/jsruntime/qv4managed.cpp b/src/qml/jsruntime/qv4managed.cpp
index 4d40b72bab..6455a08037 100644
--- a/src/qml/jsruntime/qv4managed.cpp
+++ b/src/qml/jsruntime/qv4managed.cpp
@@ -168,6 +168,12 @@ QString Managed::className() const
case Type_ForeachIteratorObject:
s = "__ForeachIterator";
break;
+ case Type_RegExp:
+ s = "RegExp";
+ break;
+ case Type_QmlSequence:
+ s = "QmlSequence";
+ break;
}
return QString::fromLatin1(s);
}
diff --git a/src/qml/jsruntime/qv4mathobject.cpp b/src/qml/jsruntime/qv4mathobject.cpp
index c5cd77fc14..d5a1a88dc5 100644
--- a/src/qml/jsruntime/qv4mathobject.cpp
+++ b/src/qml/jsruntime/qv4mathobject.cpp
@@ -210,7 +210,7 @@ ReturnedValue MathObject::method_log(SimpleCallContext *context)
ReturnedValue MathObject::method_max(SimpleCallContext *context)
{
double mx = -qInf();
- for (unsigned i = 0; i < context->callData->argc; ++i) {
+ for (int i = 0; i < context->callData->argc; ++i) {
double x = context->callData->args[i].toNumber();
if (x > mx || std::isnan(x))
mx = x;
@@ -221,7 +221,7 @@ ReturnedValue MathObject::method_max(SimpleCallContext *context)
ReturnedValue MathObject::method_min(SimpleCallContext *context)
{
double mx = qInf();
- for (unsigned i = 0; i < context->callData->argc; ++i) {
+ for (int i = 0; i < context->callData->argc; ++i) {
double x = context->callData->args[i].toNumber();
if ((x == 0 && mx == x && copySign(1.0, x) == -1.0)
|| (x < mx) || std::isnan(x)) {
diff --git a/src/qml/jsruntime/qv4object.cpp b/src/qml/jsruntime/qv4object.cpp
index 3277ea96ab..25443a59c2 100644
--- a/src/qml/jsruntime/qv4object.cpp
+++ b/src/qml/jsruntime/qv4object.cpp
@@ -244,10 +244,10 @@ void Object::markObjects(Managed *that)
Object *o = static_cast<Object *>(that);
if (!o->hasAccessorProperty) {
- for (int i = 0; i < o->internalClass->size; ++i)
+ for (uint i = 0; i < o->internalClass->size; ++i)
o->memberData[i].value.mark();
} else {
- for (int i = 0; i < o->internalClass->size; ++i) {
+ for (uint i = 0; i < o->internalClass->size; ++i) {
const Property &pd = o->memberData[i];
if (o->internalClass->propertyData[i].isAccessor()) {
if (pd.getter())
@@ -1128,6 +1128,8 @@ void Object::copyArrayData(Object *other)
ReturnedValue Object::arrayIndexOf(const ValueRef v, uint fromIndex, uint endIndex, ExecutionContext *ctx, Object *o)
{
+ Q_UNUSED(ctx);
+
Scope scope(engine());
ScopedValue value(scope);
@@ -1150,7 +1152,7 @@ ReturnedValue Object::arrayIndexOf(const ValueRef v, uint fromIndex, uint endInd
return Encode(n->key());
}
} else {
- if ((int) endIndex > arrayDataLen)
+ if (endIndex > arrayDataLen)
endIndex = arrayDataLen;
Property *pd = arrayData;
Property *end = pd + endIndex;
@@ -1191,14 +1193,14 @@ void Object::arrayConcat(const ArrayObject *other)
}
}
} else {
- int oldSize = arrayLength();
+ uint oldSize = arrayLength();
arrayReserve(oldSize + other->arrayDataLen);
if (oldSize > arrayDataLen) {
- for (int i = arrayDataLen; i < oldSize; ++i)
+ for (uint i = arrayDataLen; i < oldSize; ++i)
arrayData[i].value = Primitive::emptyValue();
}
if (other->arrayAttributes) {
- for (int i = 0; i < other->arrayDataLen; ++i) {
+ for (uint i = 0; i < other->arrayDataLen; ++i) {
bool exists;
arrayData[oldSize + i].value = const_cast<ArrayObject *>(other)->getIndexed(i, &exists);
arrayDataLen = oldSize + i + 1;
@@ -1223,7 +1225,7 @@ void Object::arraySort(ExecutionContext *context, ObjectRef thisObject, const Va
return;
if (sparseArray) {
- context->throwUnimplemented("Object::sort unimplemented for sparse arrays");
+ context->throwUnimplemented(QStringLiteral("Object::sort unimplemented for sparse arrays"));
return;
}
@@ -1267,7 +1269,7 @@ void Object::arraySort(ExecutionContext *context, ObjectRef thisObject, const Va
// and aborts otherwise. We do not want JavaScript to easily crash
// the entire application and therefore choose qSort, which doesn't
// have this property.
- qSort(begin, begin + len, lessThan);
+ std::sort(begin, begin + len, lessThan);
}
@@ -1276,7 +1278,7 @@ void Object::initSparse()
if (!sparseArray) {
flags &= ~SimpleArray;
sparseArray = new SparseArray;
- for (int i = 0; i < arrayDataLen; ++i) {
+ for (uint i = 0; i < arrayDataLen; ++i) {
if (!((arrayAttributes && arrayAttributes[i].isGeneric()) || arrayData[i].value.isEmpty())) {
SparseArrayNode *n = sparseArray->insert(i);
n->value = i + arrayOffset;
@@ -1296,7 +1298,7 @@ void Object::initSparse()
}
arrayData[o - 1].value = Primitive::fromInt32(arrayDataLen + off);
}
- for (int i = arrayDataLen + off; i < arrayAlloc; ++i) {
+ for (uint i = arrayDataLen + off; i < arrayAlloc; ++i) {
arrayData[i].value = Primitive::fromInt32(i + 1);
}
}
@@ -1443,6 +1445,8 @@ ArrayObject::ArrayObject(ExecutionEngine *engine, const QStringList &list)
void ArrayObject::init(ExecutionEngine *engine)
{
+ Q_UNUSED(engine);
+
type = Type_ArrayObject;
memberData[LengthPropertyIndex].value = Primitive::fromInt32(0);
}
diff --git a/src/qml/jsruntime/qv4objectiterator.cpp b/src/qml/jsruntime/qv4objectiterator.cpp
index 46698b0ad3..cec0873527 100644
--- a/src/qml/jsruntime/qv4objectiterator.cpp
+++ b/src/qml/jsruntime/qv4objectiterator.cpp
@@ -83,7 +83,7 @@ Property *ObjectIterator::next(StringRef name, uint *index, PropertyAttributes *
if (!current)
break;
- while (p = current->advanceIterator(this, name, index, attrs)) {
+ while ((p = current->advanceIterator(this, name, index, attrs))) {
// check the property is not already defined earlier in the proto chain
if (current != object) {
Property *pp;
diff --git a/src/qml/jsruntime/qv4qobjectwrapper.cpp b/src/qml/jsruntime/qv4qobjectwrapper.cpp
index 091eddcf99..5284f927d4 100644
--- a/src/qml/jsruntime/qv4qobjectwrapper.cpp
+++ b/src/qml/jsruntime/qv4qobjectwrapper.cpp
@@ -257,6 +257,8 @@ void QObjectWrapper::initializeBindings(ExecutionEngine *engine)
QQmlPropertyData *QObjectWrapper::findProperty(ExecutionEngine *engine, QQmlContextData *qmlContext, String *name, RevisionMode revisionMode, QQmlPropertyData *local) const
{
+ Q_UNUSED(revisionMode);
+
QQmlData *ddata = QQmlData::get(m_object, false);
if (!ddata)
return 0;
@@ -277,7 +279,7 @@ ReturnedValue QObjectWrapper::getQmlProperty(ExecutionContext *ctx, QQmlContextD
return QV4::Encode::undefined();
}
- QV4:Scope scope(ctx);
+ QV4::Scope scope(ctx);
QV4::ScopedString name(scope, n);
if (name->equals(m_destroy) || name->equals(scope.engine->id_toString)) {
@@ -704,7 +706,7 @@ Property *QObjectWrapper::advanceIterator(Managed *m, ObjectIterator *it, String
const QMetaObject *mo = that->m_object->metaObject();
const int propertyCount = mo->propertyCount();
- if (it->arrayIndex < propertyCount) {
+ if (it->arrayIndex < static_cast<uint>(propertyCount)) {
name = that->engine()->newString(QString::fromUtf8(mo->property(it->arrayIndex).name()));
++it->arrayIndex;
if (attributes)
@@ -713,7 +715,7 @@ Property *QObjectWrapper::advanceIterator(Managed *m, ObjectIterator *it, String
return &it->tmpDynamicProperty;
}
const int methodCount = mo->methodCount();
- if (it->arrayIndex < propertyCount + methodCount) {
+ if (it->arrayIndex < static_cast<uint>(propertyCount + methodCount)) {
name = that->engine()->newString(QString::fromUtf8(mo->method(it->arrayIndex - propertyCount).name()));
++it->arrayIndex;
if (attributes)
@@ -1226,7 +1228,7 @@ static int MatchScore(const QV4::ValueRef actual, int conversionType)
} else if (QV4::Object *obj = actual->asObject()) {
QV8Engine *engine = obj->engine()->v8Engine;
- if (QV4::VariantObject *v = obj->as<QV4::VariantObject>()) {
+ if (obj->as<QV4::VariantObject>()) {
if (conversionType == qMetaTypeId<QVariant>())
return 0;
if (engine->toVariant(actual, -1).userType() == conversionType)
diff --git a/src/qml/jsruntime/qv4regexp.cpp b/src/qml/jsruntime/qv4regexp.cpp
index 103605ee7a..8c184754ca 100644
--- a/src/qml/jsruntime/qv4regexp.cpp
+++ b/src/qml/jsruntime/qv4regexp.cpp
@@ -134,6 +134,7 @@ void RegExp::destroy(Managed *that)
void RegExp::markObjects(Managed *that)
{
+ Q_UNUSED(that);
}
ReturnedValue RegExp::get(Managed *, const StringRef, bool *)
@@ -143,24 +144,40 @@ ReturnedValue RegExp::get(Managed *, const StringRef, bool *)
ReturnedValue RegExp::getIndexed(Managed *m, uint index, bool *hasProperty)
{
+ Q_UNUSED(m);
+ Q_UNUSED(index);
+ Q_UNUSED(hasProperty);
+
return Encode::undefined();
}
void RegExp::put(Managed *m, const StringRef name, const ValueRef value)
{
+ Q_UNUSED(m);
+ Q_UNUSED(name);
+ Q_UNUSED(value);
}
void RegExp::putIndexed(Managed *m, uint index, const ValueRef value)
{
+ Q_UNUSED(m);
+ Q_UNUSED(index);
+ Q_UNUSED(value);
}
PropertyAttributes RegExp::query(const Managed *m, StringRef name)
{
+ Q_UNUSED(m);
+ Q_UNUSED(name);
+
return Attr_Invalid;
}
PropertyAttributes RegExp::queryIndexed(const Managed *m, uint index)
{
+ Q_UNUSED(m);
+ Q_UNUSED(index);
+
return Attr_Invalid;
}
@@ -171,10 +188,19 @@ bool RegExp::deleteProperty(Managed *, const StringRef)
bool RegExp::deleteIndexedProperty(Managed *m, uint index)
{
+ Q_UNUSED(m);
+ Q_UNUSED(index);
+
return false;
}
Property *RegExp::advanceIterator(Managed *m, ObjectIterator *it, StringRef name, uint *index, PropertyAttributes *attributes)
{
+ Q_UNUSED(m);
+ Q_UNUSED(it);
+ Q_UNUSED(name);
+ Q_UNUSED(index);
+ Q_UNUSED(attributes);
+
return 0;
}
diff --git a/src/qml/jsruntime/qv4regexpobject.cpp b/src/qml/jsruntime/qv4regexpobject.cpp
index 4f0f07377f..02467c3045 100644
--- a/src/qml/jsruntime/qv4regexpobject.cpp
+++ b/src/qml/jsruntime/qv4regexpobject.cpp
@@ -185,6 +185,7 @@ void RegExpObject::markObjects(Managed *that)
Property *RegExpObject::lastIndexProperty(ExecutionContext *ctx)
{
+ Q_UNUSED(ctx);
Q_ASSERT(0 == internalClass->find(ctx->engine->newIdentifier(QStringLiteral("lastIndex"))));
return &memberData[0];
}
@@ -200,14 +201,14 @@ QRegExp RegExpObject::toQRegExp() const
QString RegExpObject::toString() const
{
- QString result = QChar('/') + source();
- result += QChar('/');
+ QString result = QLatin1Char('/') + source();
+ result += QLatin1Char('/');
if (global)
- result += QChar('g');
+ result += QLatin1Char('g');
if (value->ignoreCase())
- result += QChar('i');
+ result += QLatin1Char('i');
if (value->multiLine())
- result += QChar('m');
+ result += QLatin1Char('m');
return result;
}
@@ -270,21 +271,21 @@ ReturnedValue RegExpCtor::construct(Managed *m, CallData *callData)
if (scope.hasException())
return Encode::undefined();
for (int i = 0; i < str.length(); ++i) {
- if (str.at(i) == QChar('g') && !global) {
+ if (str.at(i) == QLatin1Char('g') && !global) {
global = true;
- } else if (str.at(i) == QChar('i') && !ignoreCase) {
+ } else if (str.at(i) == QLatin1Char('i') && !ignoreCase) {
ignoreCase = true;
- } else if (str.at(i) == QChar('m') && !multiLine) {
+ } else if (str.at(i) == QLatin1Char('m') && !multiLine) {
multiLine = true;
} else {
- return ctx->throwSyntaxError(0);
+ return ctx->throwSyntaxError(QStringLiteral("Invalid flags supplied to RegExp constructor"));
}
}
}
Scoped<RegExp> regexp(scope, RegExp::create(ctx->engine, pattern, ignoreCase, multiLine));
if (!regexp->isValid())
- return ctx->throwSyntaxError(0);
+ return ctx->throwSyntaxError(QStringLiteral("Invalid regular expression"));
return Encode(ctx->engine->newRegExpObject(regexp, global));
}
diff --git a/src/qml/jsruntime/qv4regexpobject_p.h b/src/qml/jsruntime/qv4regexpobject_p.h
index 0ef95a36e2..eb932a49ee 100644
--- a/src/qml/jsruntime/qv4regexpobject_p.h
+++ b/src/qml/jsruntime/qv4regexpobject_p.h
@@ -63,7 +63,7 @@ QT_BEGIN_NAMESPACE
namespace QV4 {
-struct RegExp;
+class RegExp;
struct RegExpObject: Object {
Q_MANAGED
diff --git a/src/qml/jsruntime/qv4runtime.cpp b/src/qml/jsruntime/qv4runtime.cpp
index 923c51f1f9..4e40779c16 100644
--- a/src/qml/jsruntime/qv4runtime.cpp
+++ b/src/qml/jsruntime/qv4runtime.cpp
@@ -823,7 +823,7 @@ ReturnedValue __qmljs_call_property(ExecutionContext *context, const StringRef n
Scoped<FunctionObject> o(scope, baseObject->get(name));
if (!o) {
- QString error = QString("Property '%1' of object %2 is not a function").arg(name->toQString(), callData->thisObject.toQStringNoThrow());
+ QString error = QStringLiteral("Property '%1' of object %2 is not a function").arg(name->toQString(), callData->thisObject.toQStringNoThrow());
return context->throwTypeError(error);
}
@@ -1065,7 +1065,7 @@ ReturnedValue __qmljs_builtin_define_object_literal(QV4::ExecutionContext *ctx,
QV4::InternalClass *klass = ctx->compilationUnit->runtimeClasses[classId];
Scoped<Object> o(scope, ctx->engine->newObject(klass));
- for (int i = 0; i < klass->size; ++i) {
+ for (uint i = 0; i < klass->size; ++i) {
if (klass->propertyData[i].isData())
o->memberData[i].value = *args++;
else {
diff --git a/src/qml/jsruntime/qv4script.cpp b/src/qml/jsruntime/qv4script.cpp
index f1903cf323..49fee99135 100644
--- a/src/qml/jsruntime/qv4script.cpp
+++ b/src/qml/jsruntime/qv4script.cpp
@@ -223,7 +223,7 @@ void Script::parse()
if (!vmFunction) {
// ### FIX file/line number
- Scoped<Object> error(valueScope, v4->newSyntaxErrorObject("Syntax error"));
+ Scoped<Object> error(valueScope, v4->newSyntaxErrorObject(QStringLiteral("Syntax error")));
v4->current->throwError(error);
}
}
diff --git a/src/qml/jsruntime/qv4sequenceobject.cpp b/src/qml/jsruntime/qv4sequenceobject.cpp
index 5a42c7fe35..8d2a399b70 100644
--- a/src/qml/jsruntime/qv4sequenceobject.cpp
+++ b/src/qml/jsruntime/qv4sequenceobject.cpp
@@ -178,6 +178,7 @@ public:
flags &= ~SimpleArray;
QV4::Scope scope(engine);
QV4::ScopedObject protectThis(scope, this);
+ Q_UNUSED(protectThis);
init();
}
@@ -192,6 +193,7 @@ public:
flags &= ~SimpleArray;
QV4::Scope scope(engine);
QV4::ScopedObject protectThis(scope, this);
+ Q_UNUSED(protectThis);
loadReference();
init();
}
@@ -297,7 +299,7 @@ public:
loadReference();
}
- if (it->arrayIndex < m_container.count()) {
+ if (it->arrayIndex < static_cast<uint>(m_container.count())) {
if (attrs)
*attrs = QV4::Attr_Data;
*index = it->arrayIndex;
@@ -569,6 +571,7 @@ QV4::ReturnedValue SequencePrototype::method_sort(QV4::SimpleCallContext *ctx)
FOREACH_QML_SEQUENCE_TYPE(CALL_SORT)
#undef CALL_SORT
+ {}
return o.asReturnedValue();
}
diff --git a/src/qml/jsruntime/qv4serialize.cpp b/src/qml/jsruntime/qv4serialize.cpp
index 88e7630055..06a2603280 100644
--- a/src/qml/jsruntime/qv4serialize.cpp
+++ b/src/qml/jsruntime/qv4serialize.cpp
@@ -371,7 +371,7 @@ ReturnedValue Serialize::deserialize(const char *&data, QV8Engine *engine)
QQmlListModelWorkerAgent::VariantRef ref(agent);
QVariant var = qVariantFromValue(ref);
QV4::ScopedValue v(scope, engine->fromVariant((var)));
- QV4::ScopedString s(scope, v4->newString("__qml:hidden:ref"));
+ QV4::ScopedString s(scope, v4->newString(QStringLiteral("__qml:hidden:ref")));
rv->asObject()->defineReadonlyProperty(s, v);
agent->release();
diff --git a/src/qml/jsruntime/qv4string.cpp b/src/qml/jsruntime/qv4string.cpp
index 01d76c48bd..016bc3878e 100644
--- a/src/qml/jsruntime/qv4string.cpp
+++ b/src/qml/jsruntime/qv4string.cpp
@@ -167,7 +167,7 @@ ReturnedValue String::getIndexed(Managed *m, uint index, bool *hasProperty)
Scope scope(engine);
ScopedString that(scope, static_cast<String *>(m));
- if (index < (uint)that->_text->size) {
+ if (index < static_cast<uint>(that->_text->size)) {
if (hasProperty)
*hasProperty = true;
return Encode(engine->newString(that->toQString().mid(index, 1)));
@@ -216,7 +216,7 @@ PropertyAttributes String::query(const Managed *m, StringRef name)
PropertyAttributes String::queryIndexed(const Managed *m, uint index)
{
const String *that = static_cast<const String *>(m);
- return (index < (uint)that->_text->size) ? Attr_NotConfigurable|Attr_NotWritable : Attr_Invalid;
+ return (index < static_cast<uint>(that->_text->size)) ? Attr_NotConfigurable|Attr_NotWritable : Attr_Invalid;
}
bool String::deleteProperty(Managed *, const StringRef)
diff --git a/src/qml/jsruntime/qv4stringobject.cpp b/src/qml/jsruntime/qv4stringobject.cpp
index f36c7d84a4..0fc5dee5be 100644
--- a/src/qml/jsruntime/qv4stringobject.cpp
+++ b/src/qml/jsruntime/qv4stringobject.cpp
@@ -86,7 +86,7 @@ StringObject::StringObject(InternalClass *ic)
Scope scope(engine());
ScopedObject protectThis(scope, this);
- value = ic->engine->newString("")->asReturnedValue();
+ value = ic->engine->newString(QStringLiteral(""))->asReturnedValue();
tmpProperty.value = Primitive::undefinedValue();
@@ -129,7 +129,7 @@ bool StringObject::deleteIndexedProperty(Managed *m, uint index)
return false;
}
- if (index < o->value.stringValue()->toQString().length()) {
+ if (index < static_cast<uint>(o->value.stringValue()->toQString().length())) {
if (v4->current->strictMode)
v4->current->throwTypeError();
return false;
@@ -444,7 +444,7 @@ static void appendReplacementString(QString *result, const QString &input, const
uint substStart = JSC::Yarr::offsetNoMatch;
uint substEnd = JSC::Yarr::offsetNoMatch;
if (ch == '$') {
- *result += ch;
+ *result += QLatin1Char(ch);
continue;
} else if (ch == '&') {
substStart = matchOffsets[0];
@@ -457,7 +457,7 @@ static void appendReplacementString(QString *result, const QString &input, const
substEnd = input.length();
} else if (ch >= '1' && ch <= '9') {
uint capture = ch - '0';
- if (capture > 0 && capture < captureCount) {
+ if (capture > 0 && capture < static_cast<uint>(captureCount)) {
substStart = matchOffsets[capture * 2];
substEnd = matchOffsets[capture * 2 + 1];
}
@@ -557,7 +557,7 @@ ReturnedValue StringPrototype::method_replace(SimpleCallContext *ctx)
callData->args[k] = entry;
}
uint matchStart = matchOffsets[i * numCaptures * 2];
- Q_ASSERT(matchStart >= lastEnd);
+ Q_ASSERT(matchStart >= static_cast<uint>(lastEnd));
uint matchEnd = matchOffsets[i * numCaptures * 2 + 1];
callData->args[numCaptures] = Primitive::fromUInt32(matchStart);
callData->args[numCaptures + 1] = ctx->engine->newString(string);
diff --git a/src/qml/qml/ftw/qhashedstring.cpp b/src/qml/qml/ftw/qhashedstring.cpp
index 40caaf379f..321e6ccb41 100644
--- a/src/qml/qml/ftw/qhashedstring.cpp
+++ b/src/qml/qml/ftw/qhashedstring.cpp
@@ -209,137 +209,6 @@ static inline bool isUnicodeNonCharacter(uint ucs4)
|| (ucs4 - 0xfdd0U) < 16;
}
-static int utf8LengthFromUtf16(const QChar *uc, int len)
-{
- int length = 0;
-
- int surrogate_high = -1;
-
- const QChar *ch = uc;
- int invalid = 0;
-
- const QChar *end = ch + len;
- while (ch < end) {
- uint u = ch->unicode();
- if (surrogate_high >= 0) {
- if (u >= 0xdc00 && u < 0xe000) {
- u = (surrogate_high - 0xd800)*0x400 + (u - 0xdc00) + 0x10000;
- surrogate_high = -1;
- } else {
- // high surrogate without low
- ++ch;
- ++invalid;
- surrogate_high = -1;
- continue;
- }
- } else if (u >= 0xdc00 && u < 0xe000) {
- // low surrogate without high
- ++ch;
- ++invalid;
- continue;
- } else if (u >= 0xd800 && u < 0xdc00) {
- surrogate_high = u;
- ++ch;
- continue;
- }
-
- if (u < 0x80) {
- ++length;
- } else {
- if (u < 0x0800) {
- ++length;
- } else {
- // is it one of the Unicode non-characters?
- if (isUnicodeNonCharacter(u)) {
- ++length;
- ++ch;
- ++invalid;
- continue;
- }
-
- if (u > 0xffff) {
- ++length;
- ++length;
- } else {
- ++length;
- }
- ++length;
- }
- ++length;
- }
- ++ch;
- }
-
- return length;
-}
-
-// Writes the utf8 version of uc to output. uc is of length len.
-// There must be at least utf8LengthFromUtf16(uc, len) bytes in output.
-// A null terminator is not written.
-static void utf8FromUtf16(char *output, const QChar *uc, int len)
-{
- uchar replacement = '?';
- int surrogate_high = -1;
-
- uchar* cursor = (uchar*)output;
- const QChar *ch = uc;
- int invalid = 0;
-
- const QChar *end = ch + len;
- while (ch < end) {
- uint u = ch->unicode();
- if (surrogate_high >= 0) {
- if (u >= 0xdc00 && u < 0xe000) {
- u = (surrogate_high - 0xd800)*0x400 + (u - 0xdc00) + 0x10000;
- surrogate_high = -1;
- } else {
- // high surrogate without low
- *cursor = replacement;
- ++ch;
- ++invalid;
- surrogate_high = -1;
- continue;
- }
- } else if (u >= 0xdc00 && u < 0xe000) {
- // low surrogate without high
- *cursor = replacement;
- ++ch;
- ++invalid;
- continue;
- } else if (u >= 0xd800 && u < 0xdc00) {
- surrogate_high = u;
- ++ch;
- continue;
- }
-
- if (u < 0x80) {
- *cursor++ = (uchar)u;
- } else {
- if (u < 0x0800) {
- *cursor++ = 0xc0 | ((uchar) (u >> 6));
- } else {
- // is it one of the Unicode non-characters?
- if (isUnicodeNonCharacter(u)) {
- *cursor++ = replacement;
- ++ch;
- ++invalid;
- continue;
- }
-
- if (u > 0xffff) {
- *cursor++ = 0xf0 | ((uchar) (u >> 18));
- *cursor++ = 0x80 | (((uchar) (u >> 12)) & 0x3f);
- } else {
- *cursor++ = 0xe0 | (((uchar) (u >> 12)) & 0x3f);
- }
- *cursor++ = 0x80 | (((uchar) (u >> 6)) & 0x3f);
- }
- *cursor++ = 0x80 | ((uchar) (u&0x3f));
- }
- ++ch;
- }
-}
-
QHashedStringRef QHashedStringRef::mid(int offset, int length) const
{
Q_ASSERT(offset < m_length);
diff --git a/src/qml/qml/qqmlabstractbinding.cpp b/src/qml/qml/qqmlabstractbinding.cpp
index c01981b3d2..32762a46bf 100644
--- a/src/qml/qml/qqmlabstractbinding.cpp
+++ b/src/qml/qml/qqmlabstractbinding.cpp
@@ -56,9 +56,8 @@ QQmlAbstractBinding::VTable *QQmlAbstractBinding::vTables[] = {
};
QQmlAbstractBinding::QQmlAbstractBinding(BindingType bt)
-: m_nextBindingPtr(bt)
+ : m_nextBindingPtr(bt)
{
- Q_ASSERT(bt <= 0x03);
}
QQmlAbstractBinding::~QQmlAbstractBinding()
diff --git a/src/qml/qml/qqmlcomponent.cpp b/src/qml/qml/qqmlcomponent.cpp
index 883237130b..bc804c4f2d 100644
--- a/src/qml/qml/qqmlcomponent.cpp
+++ b/src/qml/qml/qqmlcomponent.cpp
@@ -1265,7 +1265,6 @@ void QQmlComponent::createObject(QQmlV4Function *args)
Q_ASSERT(object->isObject());
if (!valuemap->isUndefined()) {
- QQmlComponentExtension *e = componentExtension(args->engine());
QV4::ScopedObject qmlglobal(scope, args->qmlGlobal());
QV4::ScopedValue f(scope, QV4::Script::evaluate(v4, QString::fromLatin1(INITIALPROPERTIES_SOURCE), qmlglobal));
Q_ASSERT(f->asFunctionObject());
@@ -1420,7 +1419,6 @@ void QQmlComponentPrivate::initializeObjectWithInitialProperties(const QV4::Valu
Q_ASSERT(object->asObject());
if (!valuemap->isUndefined()) {
- QQmlComponentExtension *e = componentExtension(v8engine);
QV4::ScopedObject qmlGlobalObj(scope, qmlGlobal);
QV4::Scoped<QV4::FunctionObject> f(scope, QV4::Script::evaluate(QV8Engine::getV4(v8engine),
QString::fromLatin1(INITIALPROPERTIES_SOURCE), qmlGlobalObj));
@@ -1521,8 +1519,6 @@ void QmlIncubatorObject::setInitialState(QObject *o)
QQmlComponent_setQmlParent(o, parent);
if (!valuemap.isUndefined()) {
- QQmlComponentExtension *e = componentExtension(v8);
-
QV4::ExecutionEngine *v4 = QV8Engine::getV4(v8);
QV4::Scope scope(v4);
diff --git a/src/qml/qml/qqmlengine.cpp b/src/qml/qml/qqmlengine.cpp
index 64cde85913..f7b36b51bb 100644
--- a/src/qml/qml/qqmlengine.cpp
+++ b/src/qml/qml/qqmlengine.cpp
@@ -1761,7 +1761,6 @@ void QQmlEnginePrivate::warning(const QList<QQmlError> &errors)
void QQmlEnginePrivate::warning(QQmlDelayedError *error)
{
- Q_Q(QQmlEngine);
warning(error->error());
}
diff --git a/src/qml/qml/qqmlimport.cpp b/src/qml/qml/qqmlimport.cpp
index 63151b18bf..f33fd97c16 100644
--- a/src/qml/qml/qqmlimport.cpp
+++ b/src/qml/qml/qqmlimport.cpp
@@ -839,11 +839,12 @@ bool QQmlImportsPrivate::populatePluginPairVector(QVector<StaticPluginPair> &res
foreach (const QStaticPlugin &plugin, plugins) {
// Since a module can list more than one plugin, we keep iterating even after we found a match.
if (QQmlExtensionPlugin *instance = qobject_cast<QQmlExtensionPlugin *>(plugin.instance())) {
- const QJsonArray metaTagsUriList = plugin.metaData().value("uri").toArray();
+ const QJsonArray metaTagsUriList = plugin.metaData().value(QStringLiteral("uri")).toArray();
if (metaTagsUriList.isEmpty()) {
if (errors) {
QQmlError error;
- error.setDescription(QQmlImportDatabase::tr("static plugin for module \"%1\" with name \"%2\" has no metadata URI").arg(uri).arg(instance->metaObject()->className()));
+ error.setDescription(QQmlImportDatabase::tr("static plugin for module \"%1\" with name \"%2\" has no metadata URI")
+ .arg(uri).arg(QString::fromUtf8(instance->metaObject()->className())));
error.setUrl(QUrl::fromLocalFile(qmldirPath));
errors->prepend(error);
}
@@ -945,7 +946,8 @@ bool QQmlImportsPrivate::importExtension(const QString &qmldirFilePath,
if (errors) {
QQmlError poppedError = errors->takeFirst();
QQmlError error;
- error.setDescription(QQmlImportDatabase::tr("static plugin for module \"%1\" with name \"%2\" cannot be loaded: %3").arg(uri).arg(instance->metaObject()->className()).arg(poppedError.description()));
+ error.setDescription(QQmlImportDatabase::tr("static plugin for module \"%1\" with name \"%2\" cannot be loaded: %3")
+ .arg(uri).arg(QString::fromUtf8(instance->metaObject()->className())).arg(poppedError.description()));
error.setUrl(QUrl::fromLocalFile(qmldirFilePath));
errors->prepend(error);
}
diff --git a/src/qml/qml/qqmljavascriptexpression.cpp b/src/qml/qml/qqmljavascriptexpression.cpp
index 79b7aa2e7a..53b7504196 100644
--- a/src/qml/qml/qqmljavascriptexpression.cpp
+++ b/src/qml/qml/qqmljavascriptexpression.cpp
@@ -148,9 +148,6 @@ QV4::ReturnedValue QQmlJavaScriptExpression::evaluate(QQmlContextData *context,
if (notifyOnValueChanged())
capture.guards.copyAndClearPrepend(activeGuards);
- QQmlContextData *lastSharedContext = 0;
- QObject *lastSharedScope = 0;
-
// All code that follows must check with watcher before it accesses data members
// incase we have been deleted.
DeleteWatcher watcher(this);
@@ -275,6 +272,8 @@ void QQmlJavaScriptExpression::clearError()
QQmlError QQmlJavaScriptExpression::error(QQmlEngine *engine) const
{
+ Q_UNUSED(engine);
+
if (m_vtable.hasValue())
return m_vtable.constValue()->error();
else
diff --git a/src/qml/qml/qqmllistwrapper.cpp b/src/qml/qml/qqmllistwrapper.cpp
index 12ebc102ee..73dc3192aa 100644
--- a/src/qml/qml/qqmllistwrapper.cpp
+++ b/src/qml/qml/qqmllistwrapper.cpp
@@ -122,6 +122,8 @@ ReturnedValue QmlListWrapper::get(Managed *m, const StringRef name, bool *hasPro
ReturnedValue QmlListWrapper::getIndexed(Managed *m, uint index, bool *hasProperty)
{
+ Q_UNUSED(hasProperty);
+
QV4::ExecutionEngine *e = m->engine();
QmlListWrapper *w = m->as<QmlListWrapper>();
if (!w)
diff --git a/src/qml/qml/qqmlobjectcreator.cpp b/src/qml/qml/qqmlobjectcreator.cpp
index 8cce2db340..59d7da342d 100644
--- a/src/qml/qml/qqmlobjectcreator.cpp
+++ b/src/qml/qml/qqmlobjectcreator.cpp
@@ -1266,7 +1266,7 @@ QObject *QmlObjectCreator::createInstance(int index, QObject *parent)
}
QQmlData *ddata = QQmlData::get(instance, /*create*/true);
- if (index == qmlUnit->indexOfRootObject) {
+ if (static_cast<quint32>(index) == qmlUnit->indexOfRootObject) {
if (ddata->context) {
Q_ASSERT(ddata->context != context);
Q_ASSERT(ddata->outerContext);
@@ -1433,7 +1433,7 @@ bool QQmlComponentAndAliasResolver::resolve()
// when someProperty _is_ a QQmlComponent. In that case the Item {}
// should be implicitly surrounded by Component {}
- for (int i = 0; i < qmlUnit->nObjects; ++i) {
+ for (quint32 i = 0; i < qmlUnit->nObjects; ++i) {
const QV4::CompiledData::Object *obj = qmlUnit->objectAt(i);
if (stringAt(obj->inheritedTypeNameIndex).isEmpty())
continue;
@@ -1517,14 +1517,14 @@ bool QQmlComponentAndAliasResolver::collectIdsAndAliases(int objectIndex)
}
const QV4::CompiledData::Property *property = obj->propertyTable();
- for (int i = 0; i < obj->nProperties; ++i, ++property)
+ for (quint32 i = 0; i < obj->nProperties; ++i, ++property)
if (property->type == QV4::CompiledData::Property::Alias) {
_objectsWithAliases.append(objectIndex);
break;
}
const QV4::CompiledData::Binding *binding = obj->bindingTable();
- for (int i = 0; i < obj->nBindings; ++i, ++binding) {
+ for (quint32 i = 0; i < obj->nBindings; ++i, ++binding) {
if (binding->type != QV4::CompiledData::Binding::Type_Object
&& binding->type != QV4::CompiledData::Binding::Type_AttachedProperty
&& binding->type != QV4::CompiledData::Binding::Type_GroupProperty)
@@ -1700,7 +1700,7 @@ QQmlPropertyValidator::QQmlPropertyValidator(const QUrl &url, const QV4::Compile
bool QQmlPropertyValidator::validate()
{
- for (int i = 0; i < qmlUnit->nObjects; ++i) {
+ for (quint32 i = 0; i < qmlUnit->nObjects; ++i) {
const QV4::CompiledData::Object *obj = qmlUnit->objectAt(i);
if (stringAt(obj->inheritedTypeNameIndex).isEmpty())
continue;
@@ -1724,7 +1724,7 @@ bool QQmlPropertyValidator::validateObject(const QV4::CompiledData::Object *obj,
QQmlPropertyData *defaultProperty = propertyCache->defaultProperty();
const QV4::CompiledData::Binding *binding = obj->bindingTable();
- for (int i = 0; i < obj->nBindings; ++i, ++binding) {
+ for (quint32 i = 0; i < obj->nBindings; ++i, ++binding) {
if (binding->type == QV4::CompiledData::Binding::Type_AttachedProperty
|| binding->type == QV4::CompiledData::Binding::Type_GroupProperty)
continue;
@@ -1760,4 +1760,6 @@ bool QQmlPropertyValidator::validateObject(const QV4::CompiledData::Object *obj,
}
}
}
+
+ return true;
}
diff --git a/src/qml/qml/qqmlpropertycache.cpp b/src/qml/qml/qqmlpropertycache.cpp
index 2cb944d824..6c40557886 100644
--- a/src/qml/qml/qqmlpropertycache.cpp
+++ b/src/qml/qml/qqmlpropertycache.cpp
@@ -1154,7 +1154,7 @@ QString QQmlPropertyCache::signalParameterStringForJS(QQmlEngine *engine, const
if (errorString)
*errorString = QCoreApplication::translate("QQmlRewrite", "Signal uses unnamed parameter followed by named parameter.");
return QString();
- } else if (illegalNames.contains(param)) {
+ } else if (illegalNames.contains(QString::fromUtf8(param))) {
if (errorString)
*errorString = QCoreApplication::translate("QQmlRewrite", "Signal parameter \"%1\" hides global variable.").arg(QString::fromUtf8(param));
return QString();
diff --git a/src/qml/qml/qqmltypeloader.cpp b/src/qml/qml/qqmltypeloader.cpp
index 4abc33a49e..4b398fb6b8 100644
--- a/src/qml/qml/qqmltypeloader.cpp
+++ b/src/qml/qml/qqmltypeloader.cpp
@@ -2691,8 +2691,8 @@ QQmlScriptData::QQmlScriptData()
: importCache(0)
, pragmas(QQmlScript::Object::ScriptBlock::None)
, m_loaded(false)
- , m_program(0)
, m_precompiledScript(0)
+ , m_program(0)
{
}
diff --git a/src/qml/qml/qqmltypenamecache.cpp b/src/qml/qml/qqmltypenamecache.cpp
index 87764c49ae..a880bbdd58 100644
--- a/src/qml/qml/qqmltypenamecache.cpp
+++ b/src/qml/qml/qqmltypenamecache.cpp
@@ -106,7 +106,7 @@ QQmlTypeNameCache::Result QQmlTypeNameCache::query(const QHashedStringRef &name,
const Import *i = static_cast<const Import *>(importNamespace);
Q_ASSERT(i->scriptIndex == -1);
- Result result = result = typeSearch(i->modules, name);
+ Result result = typeSearch(i->modules, name);
if (!result.isValid())
result = query(i->compositeSingletons, name);
diff --git a/src/qml/qml/qqmlvme.cpp b/src/qml/qml/qqmlvme.cpp
index b425b84a53..7c27d77b2e 100644
--- a/src/qml/qml/qqmlvme.cpp
+++ b/src/qml/qml/qqmlvme.cpp
@@ -638,7 +638,7 @@ QObject *QQmlVME::run(QList<QQmlError> *errors,
QML_BEGIN_INSTR(CreateSimpleObject)
QObject *o = (QObject *)operator new(instr.typeSize + sizeof(QQmlData));
- ::memset(o, 0, instr.typeSize + sizeof(QQmlData));
+ ::memset(static_cast<void *>(o), 0, instr.typeSize + sizeof(QQmlData));
instr.create(o);
QQmlData *ddata = (QQmlData *)(((const char *)o) + instr.typeSize);
diff --git a/src/qml/qml/qqmlxmlhttprequest.cpp b/src/qml/qml/qqmlxmlhttprequest.cpp
index 541c188d13..ab4c94704c 100644
--- a/src/qml/qml/qqmlxmlhttprequest.cpp
+++ b/src/qml/qml/qqmlxmlhttprequest.cpp
@@ -189,8 +189,8 @@ class NamedNodeMap : public Object
public:
NamedNodeMap(ExecutionEngine *engine, NodeImpl *data, const QList<NodeImpl *> &list)
: Object(engine)
- , d(data)
, list(list)
+ , d(data)
{
vtbl = &static_vtbl;
@@ -608,7 +608,6 @@ ReturnedValue Node::create(QV8Engine *engine, NodeImpl *data)
ExecutionEngine *v4 = QV8Engine::getV4(engine);
Scope scope(v4);
- QQmlXMLHttpRequestData *d = xhrdata(engine);
Scoped<Node> instance(scope, new (v4->memoryManager) Node(v4, data));
ScopedObject p(scope);
@@ -992,7 +991,6 @@ ReturnedValue NodeList::get(Managed *m, const StringRef name, bool *hasProperty)
ReturnedValue NodeList::create(QV8Engine *engine, NodeImpl *data)
{
- QQmlXMLHttpRequestData *d = xhrdata(engine);
ExecutionEngine *v4 = QV8Engine::getV4(engine);
Scope scope(v4);
Scoped<NodeList> instance(scope, new (v4->memoryManager) NodeList(v4, data));
diff --git a/src/qml/qml/v8/qqmlbuiltinfunctions.cpp b/src/qml/qml/v8/qqmlbuiltinfunctions.cpp
index 047faabd1a..c02096614b 100644
--- a/src/qml/qml/v8/qqmlbuiltinfunctions.cpp
+++ b/src/qml/qml/v8/qqmlbuiltinfunctions.cpp
@@ -102,11 +102,11 @@ QV4::QtObject::QtObject(ExecutionEngine *v4, QQmlEngine *qmlEngine)
for (int ii = 0; ii < qtMetaObject->enumeratorCount(); ++ii) {
QMetaEnum enumerator = qtMetaObject->enumerator(ii);
for (int jj = 0; jj < enumerator.keyCount(); ++jj) {
- put((str = v4->newString(enumerator.key(jj))), (v = QV4::Primitive::fromInt32(enumerator.value(jj))));
+ put((str = v4->newString(QString::fromUtf8(enumerator.key(jj)))), (v = QV4::Primitive::fromInt32(enumerator.value(jj))));
}
}
- put((str = v4->newString("Asynchronous")), (v = QV4::Primitive::fromInt32(0)));
- put((str = v4->newString("Synchronous")), (v = QV4::Primitive::fromInt32(1)));
+ put((str = v4->newString(QStringLiteral("Asynchronous"))), (v = QV4::Primitive::fromInt32(0)));
+ put((str = v4->newString(QStringLiteral("Synchronous"))), (v = QV4::Primitive::fromInt32(1)));
defineDefaultProperty(QStringLiteral("include"), QV4Include::method_include);
defineDefaultProperty(QStringLiteral("isQtObject"), method_isQtObject);
@@ -962,16 +962,16 @@ ReturnedValue QtObject::method_createQmlObject(SimpleCallContext *ctx)
const QQmlError &error = errors.at(ii);
errorstr += QLatin1String("\n ") + error.toString();
qmlerror = v4->newObject();
- qmlerror->put((s = v4->newString("lineNumber")), (v = QV4::Primitive::fromInt32(error.line())));
- qmlerror->put((s = v4->newString("columnNumber")), (v = QV4::Primitive::fromInt32(error.column())));
- qmlerror->put((s = v4->newString("fileName")), (v = v4->newString(error.url().toString())));
- qmlerror->put((s = v4->newString("message")), (v = v4->newString(error.description())));
+ qmlerror->put((s = v4->newString(QStringLiteral("lineNumber"))), (v = QV4::Primitive::fromInt32(error.line())));
+ qmlerror->put((s = v4->newString(QStringLiteral("columnNumber"))), (v = QV4::Primitive::fromInt32(error.column())));
+ qmlerror->put((s = v4->newString(QStringLiteral("fileName"))), (v = v4->newString(error.url().toString())));
+ qmlerror->put((s = v4->newString(QStringLiteral("message"))), (v = v4->newString(error.description())));
qmlerrors->putIndexed(ii, qmlerror);
}
v = v4->newString(errorstr);
Scoped<Object> errorObject(scope, v4->newErrorObject(v));
- errorObject->put((s = v4->newString("qmlErrors")), qmlerrors);
+ errorObject->put((s = v4->newString(QStringLiteral("qmlErrors"))), qmlerrors);
return errorObject.asReturnedValue();
}
};
@@ -1358,7 +1358,7 @@ static QString jsStack(QV4::ExecutionEngine *engine) {
QString::number(frame.line));
if (i)
- stack += QChar('\n');
+ stack += QLatin1Char('\n');
stack += stackFrame;
}
return stack;
diff --git a/src/qml/qml/v8/qv8engine.cpp b/src/qml/qml/v8/qv8engine.cpp
index 4e8738b826..14fd74701f 100644
--- a/src/qml/qml/v8/qv8engine.cpp
+++ b/src/qml/qml/v8/qv8engine.cpp
@@ -141,7 +141,7 @@ QVariant QV8Engine::toVariant(const QV4::ValueRef value, int typeHint)
return QVariant::fromValue(QV4::JsonObject::toJsonObject(object));
} else if (QV4::QObjectWrapper *wrapper = object->as<QV4::QObjectWrapper>()) {
return qVariantFromValue<QObject *>(wrapper->object());
- } else if (QV4::QmlContextWrapper *wrapper = object->as<QV4::QmlContextWrapper>()) {
+ } else if (object->as<QV4::QmlContextWrapper>()) {
return QVariant();
} else if (QV4::QmlTypeWrapper *w = object->as<QV4::QmlTypeWrapper>()) {
return w->toVariant();
diff --git a/src/qml/types/qqmldelegatemodel.cpp b/src/qml/types/qqmldelegatemodel.cpp
index a1163f0a98..cdd5f8583a 100644
--- a/src/qml/types/qqmldelegatemodel.cpp
+++ b/src/qml/types/qqmldelegatemodel.cpp
@@ -67,7 +67,7 @@ struct DelegateModelGroupFunction: QV4::FunctionObject
uint flag;
DelegateModelGroupFunction(QV4::ExecutionContext *scope, uint flag, QV4::ReturnedValue (*code)(QQmlDelegateModelItem *item, uint flag, const QV4::ValueRef arg))
- : FunctionObject(scope, /*name*/0)
+ : FunctionObject(scope, QStringLiteral("DelegateModelGroupFunction"))
, code(code)
, flag(flag)
{
@@ -1622,7 +1622,6 @@ void QQmlDelegateModelItemMetaType::initializeMetaObject()
void QQmlDelegateModelItemMetaType::initializePrototype()
{
- QQmlDelegateModelEngineData *data = engineData(v8Engine);
QV4::ExecutionEngine *v4 = QV8Engine::getV4(v8Engine);
QV4::Scope scope(v4);
diff --git a/src/qml/types/qquickworkerscript.cpp b/src/qml/types/qquickworkerscript.cpp
index 78dbeb9d4f..cf19bbc56a 100644
--- a/src/qml/types/qquickworkerscript.cpp
+++ b/src/qml/types/qquickworkerscript.cpp
@@ -229,9 +229,9 @@ void QQuickWorkerScriptEnginePrivate::WorkerEngine::init()
"})"
QV4::Scope scope(m_v4Engine);
- onmessage = QV4::Script(m_v4Engine->rootContext, CALL_ONMESSAGE_SCRIPT).run();
+ onmessage = QV4::Script(m_v4Engine->rootContext, QString::fromUtf8(CALL_ONMESSAGE_SCRIPT)).run(); // do not use QStringLiteral here, MSVC2012 cannot apply this cleanly to the macro
Q_ASSERT(!scope.engine->hasException);
- QV4::Script createsendscript(m_v4Engine->rootContext, SEND_MESSAGE_CREATE_SCRIPT);
+ QV4::Script createsendscript(m_v4Engine->rootContext, QString::fromUtf8(SEND_MESSAGE_CREATE_SCRIPT)); // do not use QStringLiteral here, MSVC2012 cannot apply this cleanly to the macro
QV4::Scoped<QV4::FunctionObject> createsendconstructor(scope, createsendscript.run());
Q_ASSERT(!scope.engine->hasException);
QV4::ScopedString name(scope, m_v4Engine->newString(QStringLiteral("sendMessage")));
@@ -315,9 +315,9 @@ QV4::ReturnedValue QQuickWorkerScriptEnginePrivate::getWorker(WorkerScript *scri
w->setReadOnly(false);
QV4::Scoped<QV4::Object> api(scope, v4->newObject());
- api->put(QV4::ScopedString(scope, v4->newString("sendMessage")), QV4::ScopedValue(scope, workerEngine->sendFunction(script->id)));
+ api->put(QV4::ScopedString(scope, v4->newString(QStringLiteral("sendMessage"))), QV4::ScopedValue(scope, workerEngine->sendFunction(script->id)));
- w->QV4::Object::put(QV4::ScopedString(scope, v4->newString("WorkerScript")), api);
+ w->QV4::Object::put(QV4::ScopedString(scope, v4->newString(QStringLiteral("WorkerScript"))), api);
w->setReadOnly(true);
}
diff --git a/src/qml/util/qqmllistcompositor.cpp b/src/qml/util/qqmllistcompositor.cpp
index 75d2f67b51..830a24e752 100644
--- a/src/qml/util/qqmllistcompositor.cpp
+++ b/src/qml/util/qqmllistcompositor.cpp
@@ -942,7 +942,7 @@ void QQmlListCompositor::move(
void QQmlListCompositor::clear()
{
- QT_QML_TRACE_LISTCOMPOSITOR( )
+ QT_QML_TRACE_LISTCOMPOSITOR("")
for (Range *range = m_ranges.next; range != &m_ranges; range = erase(range)) {}
m_end = iterator(m_ranges.next, 0, Default, m_groupCount);
m_cacheIt = m_end;