From 320f172c851a4720299297c8b3b757eb1202c568 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Abecasis?= Date: Mon, 2 May 2011 13:46:40 +0200 Subject: Don't realloc user-provided buffer When QTextBoundaryFinder doesn't own the buffer, don't realloc it and get a new one instead. Reviewed-by: Ritt Konstantin --- src/corelib/tools/qtextboundaryfinder.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/corelib/tools/qtextboundaryfinder.cpp b/src/corelib/tools/qtextboundaryfinder.cpp index 34bc406..47319d4 100644 --- a/src/corelib/tools/qtextboundaryfinder.cpp +++ b/src/corelib/tools/qtextboundaryfinder.cpp @@ -199,11 +199,11 @@ QTextBoundaryFinder &QTextBoundaryFinder::operator=(const QTextBoundaryFinder &o chars = other.chars; length = other.length; pos = other.pos; - freePrivate = true; QTextBoundaryFinderPrivate *newD = (QTextBoundaryFinderPrivate *) - realloc(d, length*sizeof(HB_CharAttributes)); + realloc(freePrivate ? d : 0, length*sizeof(HB_CharAttributes)); Q_CHECK_PTR(newD); + freePrivate = true; d = newD; memcpy(d, other.d, length*sizeof(HB_CharAttributes)); -- cgit v0.12 From 4cb9db404224c55859713c282aa90409e375c372 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Abecasis?= Date: Mon, 2 May 2011 13:49:36 +0200 Subject: Don't rely on uninitialized data HB_GetCharAttributes used to require a zero-initialized array for attributes, as it selectively sets relevant bits for each character. We ease that requirement by always initializing the attributes buffer explicitly with memset. Task-number: QT-4911 Reviewed-by: Ritt Konstantin --- src/3rdparty/harfbuzz/src/harfbuzz-shaper.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/3rdparty/harfbuzz/src/harfbuzz-shaper.cpp b/src/3rdparty/harfbuzz/src/harfbuzz-shaper.cpp index ce4d4ac..1021b02 100644 --- a/src/3rdparty/harfbuzz/src/harfbuzz-shaper.cpp +++ b/src/3rdparty/harfbuzz/src/harfbuzz-shaper.cpp @@ -643,6 +643,7 @@ void HB_GetCharAttributes(const HB_UChar16 *string, hb_uint32 stringLength, const HB_ScriptItem *items, hb_uint32 numItems, HB_CharAttributes *attributes) { + memset(attributes, 0, stringLength * sizeof(HB_CharAttributes)); calcLineBreaks(string, stringLength, attributes); for (hb_uint32 i = 0; i < numItems; ++i) { -- cgit v0.12 From ae128aef03d246c9f89bed015092b1c5a925bcbc Mon Sep 17 00:00:00 2001 From: Simon Frost Date: Tue, 3 May 2011 18:29:56 +0100 Subject: Add enablers for Symbian App Booster To use the Symbian App Booster, a registration file (matching the filename of the executable, eg helloworld.applite) must be copied to the import folder within QtAppBooster's private directory. The appropriate library (qdeclarativebooster) must also be linked against. With this change, the required actions are carried out by adding "CONFIG += symbian_appbooster" to the application's .pro file. Task-number: QT-4892 Reviewed-by: Miikka Heikkinen --- mkspecs/common/symbian/template.applite | 1 + mkspecs/features/symbian/symbian_appbooster.prf | 32 +++++++++++++++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 mkspecs/common/symbian/template.applite create mode 100644 mkspecs/features/symbian/symbian_appbooster.prf diff --git a/mkspecs/common/symbian/template.applite b/mkspecs/common/symbian/template.applite new file mode 100644 index 0000000..73a1999 --- /dev/null +++ b/mkspecs/common/symbian/template.applite @@ -0,0 +1 @@ +// This is an auto-generated lite registration file \ No newline at end of file diff --git a/mkspecs/features/symbian/symbian_appbooster.prf b/mkspecs/features/symbian/symbian_appbooster.prf new file mode 100644 index 0000000..080f4d0 --- /dev/null +++ b/mkspecs/features/symbian/symbian_appbooster.prf @@ -0,0 +1,32 @@ +contains(TEMPLATE, ".*app") { + baseTarget = $$symbianRemoveSpecialCharacters($$basename(TARGET)) + + symbian-abld|symbian-sbsv2 { + LITE_REG_TARGET = $$_PRO_FILE_PWD_ + } else { + contains(DESTDIR, "/.*") { + LITE_REG_TARGET = $$DESTDIR + } else:isEmpty(DESTDIR) { + LITE_REG_TARGET = $$OUT_PWD + } else { + LITE_REG_TARGET = $$OUT_PWD/$$DESTDIR + } + } + + LITE_REG_TARGET = $${LITE_REG_TARGET}/$${baseTarget}.applite + LITE_REG_TEMPLATE = $$[QT_INSTALL_DATA]/mkspecs/common/symbian/template.applite + + lite_reg_copy.input = LITE_REG_TEMPLATE + lite_reg_copy.output = $$LITE_REG_TARGET + lite_reg_copy.variable_out = PRE_TARGETDEPS + lite_reg_copy.commands = $$QMAKE_COPY ${QMAKE_FILE_IN} ${QMAKE_FILE_OUT} + lite_reg_copy.CONFIG += no_link + QMAKE_EXTRA_COMPILERS += lite_reg_copy + + isEmpty(LITE_IMPORT_DIR): LITE_IMPORT_DIR = /private/20034884/import/apps + lite_deployment.sources += $$LITE_REG_TARGET + lite_deployment.path = $$LITE_IMPORT_DIR + DEPLOYMENT += lite_deployment + + LIBS += -lqDeclarativeBooster.dll +} -- cgit v0.12 From 1db1c895259fba1813a2d970d2334a6b35ba4f5d Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Tue, 22 Mar 2011 14:54:33 +0100 Subject: QNAM HTTP: Fix bug with explicitly zero-length compressed responses. In the case of a response with e.g content-encoding "gzip" and content-length "0", the HTTP backend would incorrectly fall back to the "unspecified length" code path and wait for readyRead() forever. Task-number: QTBUG-18232 Reviewed-by: Markus Goetz --- src/network/access/qhttpnetworkreply.cpp | 8 +++++++- tests/auto/qnetworkreply/tst_qnetworkreply.cpp | 21 +++++++++++++++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/src/network/access/qhttpnetworkreply.cpp b/src/network/access/qhttpnetworkreply.cpp index e608005..d329c10 100644 --- a/src/network/access/qhttpnetworkreply.cpp +++ b/src/network/access/qhttpnetworkreply.cpp @@ -811,8 +811,14 @@ bool QHttpNetworkReplyPrivate::expectContent() return false; if (request.operation() == QHttpNetworkRequest::Head) return !shouldEmitSignals(); - if (contentLength() == 0) + qint64 expectedContentLength = contentLength(); + if (expectedContentLength == 0) return false; + if (expectedContentLength == -1 && bodyLength == 0) { + // The content-length header was stripped, but its value was 0. + // This would be the case for an explicitly zero-length compressed response. + return false; + } return true; } diff --git a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp index 81278b6..d9285c8 100644 --- a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp +++ b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp @@ -329,6 +329,8 @@ private Q_SLOTS: void qtbug15311doubleContentLength(); + void qtbug18232gzipContentLengthZero(); + void synchronousRequest_data(); void synchronousRequest(); void synchronousRequestSslFailure(); @@ -5217,6 +5219,25 @@ void tst_QNetworkReply::qtbug15311doubleContentLength() QCOMPARE(reply->readAll(), QByteArray("ABC")); } +void tst_QNetworkReply::qtbug18232gzipContentLengthZero() +{ + QByteArray response("HTTP/1.0 200 OK\r\nContent-Encoding: gzip\r\nContent-Length: 0\r\n\r\n"); + MiniHttpServer server(response); + server.doClose = true; + + QNetworkRequest request(QUrl("http://localhost:" + QString::number(server.serverPort()))); + QNetworkReplyPtr reply = manager.get(request); + + connect(reply, SIGNAL(finished()), &QTestEventLoop::instance(), SLOT(exitLoop())); + QTestEventLoop::instance().enterLoop(10); + QVERIFY(!QTestEventLoop::instance().timeout()); + QVERIFY(reply->isFinished()); + QCOMPARE(reply->error(), QNetworkReply::NoError); + QCOMPARE(reply->size(), qint64(0)); + QCOMPARE(reply->header(QNetworkRequest::ContentLengthHeader).toLongLong(), qint64(0)); + QCOMPARE(reply->readAll(), QByteArray()); +} + void tst_QNetworkReply::synchronousRequest_data() { QTest::addColumn("url"); -- cgit v0.12