From 0fce92af2cab51d03f33230718ab5ae35149b9e1 Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Fri, 12 Oct 2018 22:24:58 +0200 Subject: 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 --- tools/qmljs/qmljs.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'tools') 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)); -- cgit v1.2.3