diff options
author | Matthew Vogt <matthew.vogt@nokia.com> | 2012-08-09 13:26:32 +1000 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-08-16 01:13:50 +0200 |
commit | 6aeff1b5429ca97af052a7a172369585382096e8 (patch) | |
tree | 68347d53f95cbcb6162a0a4f2e3c198a77f455b1 /src/qml/qml/qqmldirparser.cpp | |
parent | 6096f72e8cf23522cf675d6142492c58401e68b0 (diff) |
Reduce memory consumption of source coordinates
Reduce memory consumption by storing source location coordinates
as 16-bit variables (in run-time structures). Also modify qmlmin
to restrict line lengths so that the column bound is not normally
exceeded.
Change-Id: I08605626ffbdf081b6da2aea1116bdfe24998572
Reviewed-by: Yann Bodson <yann.bodson@nokia.com>
Diffstat (limited to 'src/qml/qml/qqmldirparser.cpp')
-rw-r--r-- | src/qml/qml/qqmldirparser.cpp | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/src/qml/qml/qqmldirparser.cpp b/src/qml/qml/qqmldirparser.cpp index 0bfc4eb4bd..ae328ca240 100644 --- a/src/qml/qml/qqmldirparser.cpp +++ b/src/qml/qml/qqmldirparser.cpp @@ -98,7 +98,7 @@ bool QQmlDirParser::parse(const QString &source) _components.clear(); _scripts.clear(); - int lineNumber = 0; + quint16 lineNumber = 0; bool firstLine = true; const QChar *ch = source.constData(); @@ -141,7 +141,7 @@ bool QQmlDirParser::parse(const QString &source) ++ch; if (invalidLine) { - reportError(lineNumber, -1, + reportError(lineNumber, 0, QString::fromUtf8("invalid qmldir directive contains too many tokens")); continue; } else if (sectionCount == 0) { @@ -149,17 +149,17 @@ bool QQmlDirParser::parse(const QString &source) } else if (sections[0] == QLatin1String("module")) { if (sectionCount != 2) { - reportError(lineNumber, -1, + reportError(lineNumber, 0, QString::fromUtf8("module identifier directive requires one argument, but %1 were provided").arg(sectionCount - 1)); continue; } if (!_typeNamespace.isEmpty()) { - reportError(lineNumber, -1, + reportError(lineNumber, 0, QString::fromUtf8("only one module identifier directive may be defined in a qmldir file")); continue; } if (!firstLine) { - reportError(lineNumber, -1, + reportError(lineNumber, 0, QString::fromUtf8("module identifier directive must be the first command in a qmldir file")); continue; } @@ -168,7 +168,7 @@ bool QQmlDirParser::parse(const QString &source) } else if (sections[0] == QLatin1String("plugin")) { if (sectionCount < 2) { - reportError(lineNumber, -1, + reportError(lineNumber, 0, QString::fromUtf8("plugin directive requires one or two arguments, but %1 were provided").arg(sectionCount - 1)); continue; @@ -180,7 +180,7 @@ bool QQmlDirParser::parse(const QString &source) } else if (sections[0] == QLatin1String("internal")) { if (sectionCount != 3) { - reportError(lineNumber, -1, + reportError(lineNumber, 0, QString::fromUtf8("internal types require 2 arguments, but %1 were provided").arg(sectionCount - 1)); continue; } @@ -189,7 +189,7 @@ bool QQmlDirParser::parse(const QString &source) _components.insertMulti(entry.typeName, entry); } else if (sections[0] == QLatin1String("typeinfo")) { if (sectionCount != 2) { - reportError(lineNumber, -1, + reportError(lineNumber, 0, QString::fromUtf8("typeinfo requires 1 argument, but %1 were provided").arg(sectionCount - 1)); continue; } @@ -207,9 +207,9 @@ bool QQmlDirParser::parse(const QString &source) const int dotIndex = version.indexOf(QLatin1Char('.')); if (dotIndex == -1) { - reportError(lineNumber, -1, QLatin1String("expected '.'")); + reportError(lineNumber, 0, QLatin1String("expected '.'")); } else if (version.indexOf(QLatin1Char('.'), dotIndex + 1) != -1) { - reportError(lineNumber, -1, QLatin1String("unexpected '.'")); + reportError(lineNumber, 0, QLatin1String("unexpected '.'")); } else { bool validVersionNumber = false; const int majorVersion = parseInt(QStringRef(&version, 0, dotIndex), &validVersionNumber); @@ -232,7 +232,7 @@ bool QQmlDirParser::parse(const QString &source) } } } else { - reportError(lineNumber, -1, + reportError(lineNumber, 0, QString::fromUtf8("a component declaration requires two or three arguments, but %1 were provided").arg(sectionCount)); } @@ -242,7 +242,7 @@ bool QQmlDirParser::parse(const QString &source) return hasError(); } -void QQmlDirParser::reportError(int line, int column, const QString &description) +void QQmlDirParser::reportError(quint16 line, quint16 column, const QString &description) { QQmlError error; error.setLine(line); |