aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2018-10-12 22:24:58 +0200
committerLars Knoll <lars.knoll@qt.io>2018-11-05 21:14:54 +0000
commit0fce92af2cab51d03f33230718ab5ae35149b9e1 (patch)
tree6367e64c4c2e6e2f3df02a2ccf6e2a1ae33cca0f /tools
parent2cc77519ebf1b5e7249c1e2f6fec97816c068cd0 (diff)
Correctly read files with a \0 in them
At least one test case uses this, so let's make sure we read them correctly. Change-Id: I9f4ea7785b5a400cd6f0b210a6a98975bbbaf7ce Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'tools')
-rw-r--r--tools/qmljs/qmljs.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/tools/qmljs/qmljs.cpp b/tools/qmljs/qmljs.cpp
index 56d4a7d383..4b581fff05 100644
--- a/tools/qmljs/qmljs.cpp
+++ b/tools/qmljs/qmljs.cpp
@@ -146,7 +146,8 @@ int main(int argc, char *argv[])
}
}
if (!script) {
- const QString code = QString::fromUtf8(file.readAll());
+ QByteArray ba = file.readAll();
+ const QString code = QString::fromUtf8(ba.constData(), ba.length());
file.close();
script.reset(new QV4::Script(ctx, QV4::Compiler::ContextType::Global, code, fn));