aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4jsonobject.cpp
diff options
context:
space:
mode:
authorErik Verbruggen <erik.verbruggen@digia.com>2013-11-01 12:38:32 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-11-04 02:16:04 +0100
commita79e400150e9d550cc4ddc0c0497778d8b78fe5d (patch)
tree5a66670d4c31aaf0d356042b6fe607728e237b5b /src/qml/jsruntime/qv4jsonobject.cpp
parentb5991ce2a61219bda5a7fa6e33f323158d1eb78b (diff)
Fix various compiler warnings in order to remove warn_off in the near future
Change-Id: Ic0492fbe31a1e134674bc6c20381f735dd6d5b7a Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/qml/jsruntime/qv4jsonobject.cpp')
-rw-r--r--src/qml/jsruntime/qv4jsonobject.cpp46
1 files changed, 23 insertions, 23 deletions
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();