From 245a68a0aad0473fcf56cd75e78b951480d39e2b Mon Sep 17 00:00:00 2001 From: David Boddie Date: Fri, 16 Jul 2010 19:25:31 +0200 Subject: Doc: Added more license information. Task-number: QT-3585 Reviewed-by: Trust Me --- doc/src/legal/licenses.qdoc | 46 +++++++++-- doc/src/snippets/legal/CatharonLicense.txt | 123 +++++++++++++++++++++++++++++ 2 files changed, 161 insertions(+), 8 deletions(-) create mode 100644 doc/src/snippets/legal/CatharonLicense.txt diff --git a/doc/src/legal/licenses.qdoc b/doc/src/legal/licenses.qdoc index a04a256..12aca6b 100644 --- a/doc/src/legal/licenses.qdoc +++ b/doc/src/legal/licenses.qdoc @@ -262,14 +262,14 @@ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:\br -     * Redistributions of source code must retain the above copyright -       notice, this list of conditions and the following disclaimer.\br -     * Redistributions in binary form must reproduce the above copyright -       notice, this list of conditions and the following disclaimer in the -       documentation and/or other materials provided with the distribution.\br -     * Neither the name of Research In Motion Limited nor the -       names of its contributors may be used to endorse or promote products -       derived from this software without specific prior written permission. + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer.\br + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution.\br + * Neither the name of Research In Motion Limited nor the + names of its contributors may be used to endorse or promote products + derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY Research In Motion Limited ''AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED @@ -476,6 +476,24 @@ \hr + Copyright 2001, 2002 Catharon Productions Inc. + + This file is part of the Catharon Typography Project and shall only + be used, modified, and distributed under the terms of the Catharon + Open Source License that should come with this file under the name + `CatharonLicense.txt'. By continuing to use, modify, or distribute + this file you indicate that you have read the license and + understand and accept it fully. + + Note that this license is compatible with the FreeType license. + + \list + \o Included in the build system of the FreeType library + \o See \l{CatharonLicense.txt} for more information + \endlist + + \hr + Copyright (C) 2006 Apple Computer, Inc. All rights reserved.\br Copyright (C) 2007 Eric Seidel \br Copyright (C) 2008 Kelvin W Sherlock (ksherlock@gmail.com)\br @@ -987,3 +1005,15 @@ and have given a quick thought about whether Roman might perhaps be interested to read what you did with his stuff. Horizontal rules don't apply.} */ + +/*! + \page catharon-license.html + \title CatharonLicense.txt + \ingroup licensing + \brief The Catharon License used in parts of FreeType. + + See the \l{Other Licenses Used in Qt} document for information on the + context in which this license is applied to code in the FreeType library. + + \quotefile doc/src/snippets/legal/CatharonLicense.txt +*/ diff --git a/doc/src/snippets/legal/CatharonLicense.txt b/doc/src/snippets/legal/CatharonLicense.txt new file mode 100644 index 0000000..789c8c9 --- /dev/null +++ b/doc/src/snippets/legal/CatharonLicense.txt @@ -0,0 +1,123 @@ + The Catharon Open Source LICENSE + ---------------------------- + + 2000-Jul-04 + + Copyright (C) 2000 by Catharon Productions, Inc. + + + +Introduction +============ + + This license applies to source files distributed by Catharon + Productions, Inc. in several archive packages. This license + applies to all files found in such packages which do not fall + under their own explicit license. + + This license was inspired by the BSD, Artistic, and IJG + (Independent JPEG Group) licenses, which all encourage inclusion + and use of free software in commercial and freeware products + alike. As a consequence, its main points are that: + + o We don't promise that this software works. However, we are + interested in any kind of bug reports. (`as is' distribution) + + o You can use this software for whatever you want, in parts or + full form, without having to pay us. (`royalty-free' usage) + + o You may not pretend that you wrote this software. If you use + it, or only parts of it, in a program, you must acknowledge + somewhere in your documentation that you have used the + Catharon Code. (`credits') + + We specifically permit and encourage the inclusion of this + software, with or without modifications, in commercial products. + We disclaim all warranties covering the packages distributed by + Catharon Productions, Inc. and assume no liability related to + their use. + + +Legal Terms +=========== + +0. Definitions +-------------- + + Throughout this license, the terms `Catharon Package', `package', + and `Catharon Code' refer to the set of files originally + distributed by Catharon Productions, Inc. + + `You' refers to the licensee, or person using the project, where + `using' is a generic term including compiling the project's source + code as well as linking it to form a `program' or `executable'. + This program is referred to as `a program using one of the + Catharon Packages'. + + This license applies to all files distributed in the original + Catharon Package(s), including all source code, binaries and + documentation, unless otherwise stated in the file in its + original, unmodified form as distributed in the original archive. + If you are unsure whether or not a particular file is covered by + this license, you must contact us to verify this. + + The Catharon Packages are copyright (C) 2000 by Catharon + Productions, Inc. All rights reserved except as specified below. + +1. No Warranty +-------------- + + THE CATHARON PACKAGES ARE PROVIDED `AS IS' WITHOUT WARRANTY OF ANY + KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + PURPOSE. IN NO EVENT WILL ANY OF THE AUTHORS OR COPYRIGHT HOLDERS + BE LIABLE FOR ANY DAMAGES CAUSED BY THE USE OF OR THE INABILITY TO + USE THE CATHARON PACKAGE. + +2. Redistribution +----------------- + + This license grants a worldwide, royalty-free, perpetual and + irrevocable right and license to use, execute, perform, compile, + display, copy, create derivative works of, distribute and + sublicense the Catharon Packages (in both source and object code + forms) and derivative works thereof for any purpose; and to + authorize others to exercise some or all of the rights granted + herein, subject to the following conditions: + + o Redistribution of source code must retain this license file + (`license.txt') unaltered; any additions, deletions or changes + to the original files must be clearly indicated in + accompanying documentation. The copyright notices of the + unaltered, original files must be preserved in all copies of + source files. + + o Redistribution in binary form must provide a disclaimer that + states that the software is based in part on the work of + Catharon Productions, Inc. in the distribution documentation. + + These conditions apply to any software derived from or based on + the Catharon Packages, not just the unmodified files. If you use + our work, you must acknowledge us. However, no fee need be paid + to us. + +3. Advertising +-------------- + + Neither Catharon Productions, Inc. and contributors nor you shall + use the name of the other for commercial, advertising, or + promotional purposes without specific prior written permission. + + We suggest, but do not require, that you use the following phrase + to refer to this software in your documentation: 'this software is + based in part on the Catharon Typography Project'. + + As you have not signed this license, you are not required to + accept it. However, as the Catharon Packages are copyrighted + material, only this license, or another one contracted with the + authors, grants you the right to use, distribute, and modify it. + Therefore, by using, distributing, or modifying the Catharon + Packages, you indicate that you understand and accept all the + terms of this license. + +--- end of license.txt --- -- cgit v0.12 From aafdc4d4c795ee25a0da1087fada999fbe6c47bc Mon Sep 17 00:00:00 2001 From: Robin Burchell Date: Tue, 27 Jul 2010 23:38:54 +0100 Subject: Move note on connectToBus() not actually being able to reconnect to connectToBus() documentation, where it belongs. This also fixes some bad English ("make be connected") by means of removing it. --- src/dbus/qdbusconnection.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/dbus/qdbusconnection.cpp b/src/dbus/qdbusconnection.cpp index 4382032..9aa1cc5 100644 --- a/src/dbus/qdbusconnection.cpp +++ b/src/dbus/qdbusconnection.cpp @@ -173,6 +173,9 @@ void QDBusConnectionManager::setConnection(const QString &name, QDBusConnectionP The connection is then torn down using the disconnectFromBus() function. + Once disconnected, calling connectToBus() will not reestablish a + connection, you must create a new QDBusConnection instance. + As a convenience for the two most common connection types, the sessionBus() and systemBus() functions return open connections to the session server daemon and the system server daemon, @@ -853,10 +856,6 @@ QDBusConnectionInterface *QDBusConnection::interface() const /*! Returns true if this QDBusConnection object is connected. - - If it isn't connected, calling connectToBus() on the same - connection name will not make be connected. You need to call the - QDBusConnection constructor again. */ bool QDBusConnection::isConnected() const { -- cgit v0.12 From d754440bf7ce91a2f4a56a8873b6bfa546719c08 Mon Sep 17 00:00:00 2001 From: Robin Burchell Date: Tue, 27 Jul 2010 23:40:39 +0100 Subject: Remove useless QString::clear() from QSharedData example snippet. --- doc/src/snippets/sharedemployee/employee.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/src/snippets/sharedemployee/employee.h b/doc/src/snippets/sharedemployee/employee.h index 18b47e0..2c9ba6f 100644 --- a/doc/src/snippets/sharedemployee/employee.h +++ b/doc/src/snippets/sharedemployee/employee.h @@ -48,7 +48,7 @@ class EmployeeData : public QSharedData { public: - EmployeeData() : id(-1) { name.clear(); } + EmployeeData() : id(-1) { } EmployeeData(const EmployeeData &other) : QSharedData(other), id(other.id), name(other.name) { } ~EmployeeData() { } -- cgit v0.12 From 3378fe13f8d865463c79f34017a1d82e03cdf147 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Wed, 4 Aug 2010 16:32:00 +0200 Subject: Doc: Fixed typo in a shortcut string. Reviewed-by: Trust Me Task-number: QTBUG-12355 --- examples/phonon/qmusicplayer/mainwindow.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/phonon/qmusicplayer/mainwindow.cpp b/examples/phonon/qmusicplayer/mainwindow.cpp index 4778138..0e8e780 100644 --- a/examples/phonon/qmusicplayer/mainwindow.cpp +++ b/examples/phonon/qmusicplayer/mainwindow.cpp @@ -248,7 +248,7 @@ void MainWindow::aboutToFinish() void MainWindow::setupActions() { playAction = new QAction(style()->standardIcon(QStyle::SP_MediaPlay), tr("Play"), this); - playAction->setShortcut(tr("Crl+P")); + playAction->setShortcut(tr("Ctrl+P")); playAction->setDisabled(true); pauseAction = new QAction(style()->standardIcon(QStyle::SP_MediaPause), tr("Pause"), this); pauseAction->setShortcut(tr("Ctrl+A")); -- cgit v0.12 From 3833dc0a0535fa8320e17c741ca2746e9bebcaa9 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Mon, 9 Aug 2010 20:27:42 +0200 Subject: qdoc: Fixed non-well-formed markup. Reviewed-by: Trust Me To-be-really-reviewed-by: Qt Doc Team --- tools/qdoc3/htmlgenerator.cpp | 24 +++++++++++------------- tools/qdoc3/test/qt-html-templates.qdocconf | 3 ++- 2 files changed, 13 insertions(+), 14 deletions(-) diff --git a/tools/qdoc3/htmlgenerator.cpp b/tools/qdoc3/htmlgenerator.cpp index b1a8336..27d5b0f 100644 --- a/tools/qdoc3/htmlgenerator.cpp +++ b/tools/qdoc3/htmlgenerator.cpp @@ -1717,7 +1717,7 @@ void HtmlGenerator::generateBreadCrumbs(const QString& title, out() << "\n"; } if (!cn->name().isEmpty()) - out() << "
  • " << cn->name() << "
  • \n"; + out() << "
  • " << protect(cn->name()) << "
  • \n"; } else if (node->type() == Node::Fake) { const FakeNode* fn = static_cast(node); @@ -1725,52 +1725,50 @@ void HtmlGenerator::generateBreadCrumbs(const QString& title, out() << "
  • Modules
  • "; QString name = node->name(); if (!name.isEmpty()) - out() << "
  • " << name << "
  • \n"; + out() << "
  • " << protect(name) << "
  • \n"; } else if (node->subType() == Node::Group) { if (fn->name() == QString("modules")) out() << "
  • Modules
  • "; else { - out() << "
  • " << title << "
  • "; + out() << "
  • " << protect(title) << "
  • "; } } else if (node->subType() == Node::Page) { if (fn->name() == QString("qdeclarativeexamples.html")) { out() << "
  • Examples
  • "; - out() << "
  • QML Examples & Demos
  • "; + out() << "
  • QML Examples & Demos
  • "; } else if (fn->name().startsWith("examples-")) { out() << "
  • Examples
  • "; - out() << "
  • " << title << "
  • "; + out() << "
  • " << protect(title) << "
  • "; } else if (fn->name() == QString("namespaces.html")) { out() << "
  • Namespaces
  • "; } else { - out() << "
  • " << title << "
  • "; + out() << "
  • " << protect(title) << "
  • "; } } else if (node->subType() == Node::QmlClass) { out() << "
  • QML Elements
  • "; - out() << "
  • " << title << "
  • "; + out() << "
  • " << protect(title) << "
  • "; } else if (node->subType() == Node::Example) { out() << "
  • Examples
  • "; QStringList sl = fn->name().split('/'); if (sl.contains("declarative")) - out() << "
  • QML Examples & Demos
  • "; + out() << "
  • QML Examples & Demos
  • "; else { - QString name = "examples-" + sl.at(0) + ".html"; // this generates an empty link + QString name = protect("examples-" + sl.at(0) + ".html"); // this generates an empty link QString t = CodeParser::titleFromName(name); - // out() << "
  • " - // << t << "
  • "; } - out() << "
  • " << title << "
  • "; + out() << "
  • " << protect(title) << "
  • "; } } else if (node->type() == Node::Namespace) { out() << "
  • Namespaces
  • "; - out() << "
  • " << title << "
  • "; + out() << "
  • " << protect(title) << "
  • "; } } diff --git a/tools/qdoc3/test/qt-html-templates.qdocconf b/tools/qdoc3/test/qt-html-templates.qdocconf index cf15628..67d7165 100644 --- a/tools/qdoc3/test/qt-html-templates.qdocconf +++ b/tools/qdoc3/test/qt-html-templates.qdocconf @@ -168,4 +168,5 @@ HTML.footer = " \n" \ " \n" \ " \n" \ "
    \n" \ - "
    \n" + " \n" \ + " \n" -- cgit v0.12 From 9986c3f0c0681c7ea8bc8e5cfea5662880db6654 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Tue, 10 Aug 2010 15:03:59 +0200 Subject: qdoc: Ensured that text is encoded correctly. --- tools/qdoc3/htmlgenerator.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/tools/qdoc3/htmlgenerator.cpp b/tools/qdoc3/htmlgenerator.cpp index 27d5b0f..356e615 100644 --- a/tools/qdoc3/htmlgenerator.cpp +++ b/tools/qdoc3/htmlgenerator.cpp @@ -1717,7 +1717,7 @@ void HtmlGenerator::generateBreadCrumbs(const QString& title, out() << "\n"; } if (!cn->name().isEmpty()) - out() << "
  • " << protect(cn->name()) << "
  • \n"; + out() << "
  • " << protectEnc(cn->name()) << "
  • \n"; } else if (node->type() == Node::Fake) { const FakeNode* fn = static_cast(node); @@ -1725,13 +1725,13 @@ void HtmlGenerator::generateBreadCrumbs(const QString& title, out() << "
  • Modules
  • "; QString name = node->name(); if (!name.isEmpty()) - out() << "
  • " << protect(name) << "
  • \n"; + out() << "
  • " << protectEnc(name) << "
  • \n"; } else if (node->subType() == Node::Group) { if (fn->name() == QString("modules")) out() << "
  • Modules
  • "; else { - out() << "
  • " << protect(title) << "
  • "; + out() << "
  • " << protectEnc(title) << "
  • "; } } else if (node->subType() == Node::Page) { @@ -1741,18 +1741,18 @@ void HtmlGenerator::generateBreadCrumbs(const QString& title, } else if (fn->name().startsWith("examples-")) { out() << "
  • Examples
  • "; - out() << "
  • " << protect(title) << "
  • "; + out() << "
  • " << protectEnc(title) << "
  • "; } else if (fn->name() == QString("namespaces.html")) { out() << "
  • Namespaces
  • "; } else { - out() << "
  • " << protect(title) << "
  • "; + out() << "
  • " << protectEnc(title) << "
  • "; } } else if (node->subType() == Node::QmlClass) { out() << "
  • QML Elements
  • "; - out() << "
  • " << protect(title) << "
  • "; + out() << "
  • " << protectEnc(title) << "
  • "; } else if (node->subType() == Node::Example) { out() << "
  • Examples
  • "; @@ -1760,15 +1760,15 @@ void HtmlGenerator::generateBreadCrumbs(const QString& title, if (sl.contains("declarative")) out() << "
  • QML Examples & Demos
  • "; else { - QString name = protect("examples-" + sl.at(0) + ".html"); // this generates an empty link + QString name = protectEnc("examples-" + sl.at(0) + ".html"); // this generates an empty link QString t = CodeParser::titleFromName(name); } - out() << "
  • " << protect(title) << "
  • "; + out() << "
  • " << protectEnc(title) << "
  • "; } } else if (node->type() == Node::Namespace) { out() << "
  • Namespaces
  • "; - out() << "
  • " << protect(title) << "
  • "; + out() << "
  • " << protectEnc(title) << "
  • "; } } -- cgit v0.12 From 997e4161cf937aa34a16bb2e708fa1bc7909355f Mon Sep 17 00:00:00 2001 From: Morten Engvoldsen Date: Wed, 11 Aug 2010 12:45:58 +0200 Subject: Doc: Fixing bug involving header misplacement in Creator style Task-number: QTBUG-11408 --- doc/src/template/style/style.css | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/src/template/style/style.css b/doc/src/template/style/style.css index d6b0fda..6a32e53 100755 --- a/doc/src/template/style/style.css +++ b/doc/src/template/style/style.css @@ -1375,7 +1375,7 @@ .creator .wrapper { position:relative; - top:50px; + top:5px; } .creator .wrapper .bd { @@ -1486,7 +1486,7 @@ - position:fixed; + /* position:fixed;*/ } -- cgit v0.12 From 5fa15620d09df1164cc28aa9b1e646a61f87e909 Mon Sep 17 00:00:00 2001 From: Morten Engvoldsen Date: Wed, 11 Aug 2010 12:47:05 +0200 Subject: Doc: Fixing typo --- src/gui/styles/qstylesheetstyle.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/styles/qstylesheetstyle.cpp b/src/gui/styles/qstylesheetstyle.cpp index dff525e..92e2c81 100644 --- a/src/gui/styles/qstylesheetstyle.cpp +++ b/src/gui/styles/qstylesheetstyle.cpp @@ -4094,7 +4094,7 @@ void QStyleSheetStyle::drawControl(ControlElement ce, const QStyleOption *opt, Q if (pe1 != PseudoElement_None) { QRenderRule subRule = renderRule(w, opt, pe1); if (subRule.bg != 0 || subRule.hasDrawable()) { - //We test subRule.bg dirrectly because hasBackground() would return false for background:none. + //We test subRule.bg directly because hasBackground() would return false for background:none. //But we still don't want the default drawning in that case (example for QScrollBar::add-page) (task 198926) subRule.drawRule(p, opt->rect); } else if (fallback) { -- cgit v0.12 From a77dbcdbb7022cc754ba87aea9a4fc471d1e4495 Mon Sep 17 00:00:00 2001 From: Peter Hartmann Date: Wed, 4 Aug 2010 11:59:49 +0200 Subject: QSslCertificate: support expiration dates > 2049 X509 has two time formats: UTC, where the year is in two-digit format, and generalized time with four-digit years. This patch allows dates specified generalized time. Reviewed-by: Thiago Macieira Task-number: QTBUG-12489 --- src/network/ssl/qsslsocket_openssl_symbols.cpp | 121 ++++++++++++--------- .../cert-large-expiration-date.pem | 15 +++ tests/auto/qsslcertificate/tst_qsslcertificate.cpp | 15 +++ 3 files changed, 101 insertions(+), 50 deletions(-) create mode 100644 tests/auto/qsslcertificate/more-certificates/cert-large-expiration-date.pem diff --git a/src/network/ssl/qsslsocket_openssl_symbols.cpp b/src/network/ssl/qsslsocket_openssl_symbols.cpp index 09ecd4d..d1225c1 100644 --- a/src/network/ssl/qsslsocket_openssl_symbols.cpp +++ b/src/network/ssl/qsslsocket_openssl_symbols.cpp @@ -761,74 +761,95 @@ bool q_resolveOpenSslSymbols() //============================================================================== QDateTime q_getTimeFromASN1(const ASN1_TIME *aTime) { - char lBuffer[24]; - char *pBuffer = lBuffer; - size_t lTimeLength = aTime->length; char *pString = (char *) aTime->data; if (aTime->type == V_ASN1_UTCTIME) { + + char lBuffer[24]; + char *pBuffer = lBuffer; + if ((lTimeLength < 11) || (lTimeLength > 17)) return QDateTime(); memcpy(pBuffer, pString, 10); pBuffer += 10; pString += 10; - } else { - if (lTimeLength < 13) - return QDateTime(); - - memcpy(pBuffer, pString, 12); - pBuffer += 12; - pString += 12; - } - if ((*pString == 'Z') || (*pString == '-') || (*pString == '+')) { - *pBuffer++ = '0'; - *pBuffer++ = '0'; - } else { - *pBuffer++ = *pString++; - *pBuffer++ = *pString++; - // Skip any fractional seconds... - if (*pString == '.') { - pString++; - while ((*pString >= '0') && (*pString <= '9')) + if ((*pString == 'Z') || (*pString == '-') || (*pString == '+')) { + *pBuffer++ = '0'; + *pBuffer++ = '0'; + } else { + *pBuffer++ = *pString++; + *pBuffer++ = *pString++; + // Skip any fractional seconds... + if (*pString == '.') { pString++; + while ((*pString >= '0') && (*pString <= '9')) + pString++; + } } - } - *pBuffer++ = 'Z'; - *pBuffer++ = '\0'; + *pBuffer++ = 'Z'; + *pBuffer++ = '\0'; - time_t lSecondsFromUCT; - if (*pString == 'Z') { - lSecondsFromUCT = 0; - } else { - if ((*pString != '+') && (*pString != '-')) - return QDateTime(); + time_t lSecondsFromUCT; + if (*pString == 'Z') { + lSecondsFromUCT = 0; + } else { + if ((*pString != '+') && (*pString != '-')) + return QDateTime(); + + lSecondsFromUCT = ((pString[1] - '0') * 10 + (pString[2] - '0')) * 60; + lSecondsFromUCT += (pString[3] - '0') * 10 + (pString[4] - '0'); + lSecondsFromUCT *= 60; + if (*pString == '-') + lSecondsFromUCT = -lSecondsFromUCT; + } + + tm lTime; + lTime.tm_sec = ((lBuffer[10] - '0') * 10) + (lBuffer[11] - '0'); + lTime.tm_min = ((lBuffer[8] - '0') * 10) + (lBuffer[9] - '0'); + lTime.tm_hour = ((lBuffer[6] - '0') * 10) + (lBuffer[7] - '0'); + lTime.tm_mday = ((lBuffer[4] - '0') * 10) + (lBuffer[5] - '0'); + lTime.tm_mon = (((lBuffer[2] - '0') * 10) + (lBuffer[3] - '0')) - 1; + lTime.tm_year = ((lBuffer[0] - '0') * 10) + (lBuffer[1] - '0'); + if (lTime.tm_year < 50) + lTime.tm_year += 100; // RFC 2459 + + QDate resDate(lTime.tm_year + 1900, lTime.tm_mon + 1, lTime.tm_mday); + QTime resTime(lTime.tm_hour, lTime.tm_min, lTime.tm_sec); + + QDateTime result(resDate, resTime, Qt::UTC); + result = result.addSecs(lSecondsFromUCT); + return result; + + } else if (aTime->type == V_ASN1_GENERALIZEDTIME) { - lSecondsFromUCT = ((pString[1] - '0') * 10 + (pString[2] - '0')) * 60; - lSecondsFromUCT += (pString[3] - '0') * 10 + (pString[4] - '0'); - lSecondsFromUCT *= 60; - if (*pString == '-') - lSecondsFromUCT = -lSecondsFromUCT; + if (lTimeLength < 15) + return QDateTime(); // hopefully never triggered + + // generalized time is always YYYYMMDDHHMMSSZ (RFC 2459, section 4.1.2.5.2) + tm lTime; + lTime.tm_sec = ((pString[12] - '0') * 10) + (pString[13] - '0'); + lTime.tm_min = ((pString[10] - '0') * 10) + (pString[11] - '0'); + lTime.tm_hour = ((pString[8] - '0') * 10) + (pString[9] - '0'); + lTime.tm_mday = ((pString[6] - '0') * 10) + (pString[7] - '0'); + lTime.tm_mon = (((pString[4] - '0') * 10) + (pString[5] - '0')); + lTime.tm_year = ((pString[0] - '0') * 1000) + ((pString[1] - '0') * 100) + + ((pString[2] - '0') * 10) + (pString[3] - '0'); + + QDate resDate(lTime.tm_year, lTime.tm_mon, lTime.tm_mday); + QTime resTime(lTime.tm_hour, lTime.tm_min, lTime.tm_sec); + + QDateTime result(resDate, resTime, Qt::UTC); + return result; + + } else { + qWarning("unsupported date format detected"); + return QDateTime(); } - tm lTime; - lTime.tm_sec = ((lBuffer[10] - '0') * 10) + (lBuffer[11] - '0'); - lTime.tm_min = ((lBuffer[8] - '0') * 10) + (lBuffer[9] - '0'); - lTime.tm_hour = ((lBuffer[6] - '0') * 10) + (lBuffer[7] - '0'); - lTime.tm_mday = ((lBuffer[4] - '0') * 10) + (lBuffer[5] - '0'); - lTime.tm_mon = (((lBuffer[2] - '0') * 10) + (lBuffer[3] - '0')) - 1; - lTime.tm_year = ((lBuffer[0] - '0') * 10) + (lBuffer[1] - '0'); - if (lTime.tm_year < 50) - lTime.tm_year += 100; // RFC 2459 - - QDate resDate(lTime.tm_year + 1900, lTime.tm_mon + 1, lTime.tm_mday); - QTime resTime(lTime.tm_hour, lTime.tm_min, lTime.tm_sec); - QDateTime result(resDate, resTime, Qt::UTC); - result = result.addSecs(lSecondsFromUCT); - return result; } QT_END_NAMESPACE diff --git a/tests/auto/qsslcertificate/more-certificates/cert-large-expiration-date.pem b/tests/auto/qsslcertificate/more-certificates/cert-large-expiration-date.pem new file mode 100644 index 0000000..416dd4d --- /dev/null +++ b/tests/auto/qsslcertificate/more-certificates/cert-large-expiration-date.pem @@ -0,0 +1,15 @@ +-----BEGIN CERTIFICATE----- +MIICWjCCAcOgAwIBAgIJAM7bMShFxAVAMA0GCSqGSIb3DQEBBQUAMEUxCzAJBgNV +BAYTAkFVMRMwEQYDVQQIDApTb21lLVN0YXRlMSEwHwYDVQQKDBhJbnRlcm5ldCBX +aWRnaXRzIFB0eSBMdGQwIBcNMTAwODA0MDk1MzQxWhgPMjA1MTA4MjkwOTUzNDFa +MEUxCzAJBgNVBAYTAkFVMRMwEQYDVQQIDApTb21lLVN0YXRlMSEwHwYDVQQKDBhJ +bnRlcm5ldCBXaWRnaXRzIFB0eSBMdGQwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJ +AoGBAM2q22/WNMmn8cC+5EEYGeICySLmp9W6Ay6eKHr0Xxp3X3epETuPfvAuxp7r +OtkS18EMUegkUj8jw0IMEcbyHKFC/rTCaYOt93CxGBXMIChiMPAsFeYzGa/D6xzA +kfcRaJRQ+Ek3CDLXPnXfo7xpABXezYcPXAJrgsgBfWrwHdxzAgMBAAGjUDBOMB0G +A1UdDgQWBBSKbhnnl5uP2X+zuwFP6GovUpUN2TAfBgNVHSMEGDAWgBSKbhnnl5uP +2X+zuwFP6GovUpUN2TAMBgNVHRMEBTADAQH/MA0GCSqGSIb3DQEBBQUAA4GBAKF0 +jl02liwFfupmzC5oxz2T3IyjEa21fm7QBMQJvQr5OTuX1/C7DAl7g/6/h7BH6JS3 +qpx5rXGet8SZmG8dODL4o3U4xOXnNzch7HtQixWwlx4XnFAXPMHflFX7YC5QQNHq +I8Y8IW+XjAYWpYJywWMUZIbr1/9y9gn1beYEE3pq +-----END CERTIFICATE----- diff --git a/tests/auto/qsslcertificate/tst_qsslcertificate.cpp b/tests/auto/qsslcertificate/tst_qsslcertificate.cpp index d0509bb..963bf11 100644 --- a/tests/auto/qsslcertificate/tst_qsslcertificate.cpp +++ b/tests/auto/qsslcertificate/tst_qsslcertificate.cpp @@ -110,6 +110,7 @@ private slots: void nulInCN(); void nulInSan(); void largeSerialNumber(); + void largeExpirationDate(); // ### add tests for certificate bundles (multiple certificates concatenated into a single // structure); both PEM and DER formatted #endif @@ -802,6 +803,20 @@ void tst_QSslCertificate::largeSerialNumber() QCOMPARE(cert.serialNumber(), QByteArray("01:02:03:04:05:06:07:08:09:10:aa:bb:cc:dd:ee:ff:17:18:19:20")); } +void tst_QSslCertificate::largeExpirationDate() // QTBUG-12489 +{ + QList certList = + QSslCertificate::fromPath(SRCDIR "more-certificates/cert-large-expiration-date.pem"); + + QCOMPARE(certList.size(), 1); + + const QSslCertificate &cert = certList.at(0); + QVERIFY(!cert.isNull()); + QCOMPARE(cert.effectiveDate().toUTC(), QDateTime(QDate(2010, 8, 4), QTime(9, 53, 41), Qt::UTC)); + // if the date is larger than 2049, then the generalized time format is used + QCOMPARE(cert.expiryDate().toUTC(), QDateTime(QDate(2051, 8, 29), QTime(9, 53, 41), Qt::UTC)); +} + #endif // QT_NO_OPENSSL QTEST_MAIN(tst_QSslCertificate) -- cgit v0.12 From c7fcd56bd3e150e57230ea1445bf4286b3f3fabe Mon Sep 17 00:00:00 2001 From: Peter Hartmann Date: Thu, 5 Aug 2010 11:56:47 +0200 Subject: QXmlStreamReader: avoid unnecessary detaching Reviewed-by: Markus Goetz Task-number: QTBUG-12259 --- src/corelib/xml/qxmlstream.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/corelib/xml/qxmlstream.cpp b/src/corelib/xml/qxmlstream.cpp index 853f311..91c3a19 100644 --- a/src/corelib/xml/qxmlstream.cpp +++ b/src/corelib/xml/qxmlstream.cpp @@ -1523,7 +1523,7 @@ ushort QXmlStreamReaderPrivate::getChar_helper() decoder = codec->makeDecoder(); } - decoder->toUnicode(&readBuffer, rawReadBuffer.data(), nbytesread); + decoder->toUnicode(&readBuffer, rawReadBuffer.constData(), nbytesread); if(lockEncoding && decoder->hasFailure()) { raiseWellFormedError(QXmlStream::tr("Encountered incorrectly encoded content.")); -- cgit v0.12 From 59f01a1efe818004fdc9265af6a0e9a05c43932a Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Thu, 5 Aug 2010 18:36:54 +0200 Subject: 64-bit versions of PREMUL, BYTE_MUL and INTERPOLATE_PIXEL_256 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Corrected and enabled the 64-bit versions of these three functions. Speed improvements (tested on an i7): BYTE_MUL : 104.7% INTERPOLATE_PIXEL_256 : 13.2% PREMUL : 13.1% Reviewed-by: Samuel Rødal --- src/gui/painting/qdrawhelper_p.h | 140 +++++++++++++++++++-------------------- 1 file changed, 67 insertions(+), 73 deletions(-) diff --git a/src/gui/painting/qdrawhelper_p.h b/src/gui/painting/qdrawhelper_p.h index 1a87127..d04c70d 100644 --- a/src/gui/painting/qdrawhelper_p.h +++ b/src/gui/painting/qdrawhelper_p.h @@ -314,18 +314,61 @@ struct QSpanData void adjustSpanMethods(); }; +#if defined(Q_CC_RVCT) +# pragma push +# pragma arm +#endif +Q_STATIC_INLINE_FUNCTION uint INTERPOLATE_PIXEL_255(uint x, uint a, uint y, uint b) { + uint t = (x & 0xff00ff) * a + (y & 0xff00ff) * b; + t = (t + ((t >> 8) & 0xff00ff) + 0x800080) >> 8; + t &= 0xff00ff; -Q_STATIC_INLINE_FUNCTION uint BYTE_MUL_RGB16(uint x, uint a) { - a += 1; - uint t = (((x & 0x07e0)*a) >> 8) & 0x07e0; - t |= (((x & 0xf81f)*(a>>2)) >> 6) & 0xf81f; - return t; + x = ((x >> 8) & 0xff00ff) * a + ((y >> 8) & 0xff00ff) * b; + x = (x + ((x >> 8) & 0xff00ff) + 0x800080); + x &= 0xff00ff00; + x |= t; + return x; } +#if defined(Q_CC_RVCT) +# pragma pop +#endif -Q_STATIC_INLINE_FUNCTION uint BYTE_MUL_RGB16_32(uint x, uint a) { - uint t = (((x & 0xf81f07e0) >> 5)*a) & 0xf81f07e0; - t |= (((x & 0x07e0f81f)*a) >> 5) & 0x07e0f81f; - return t; +#if QT_POINTER_SIZE == 8 // 64-bit versions + +Q_STATIC_INLINE_FUNCTION uint INTERPOLATE_PIXEL_256(uint x, uint a, uint y, uint b) { + quint64 t = (((quint64(x)) | ((quint64(x)) << 24)) & 0x00ff00ff00ff00ff) * a; + t += (((quint64(y)) | ((quint64(y)) << 24)) & 0x00ff00ff00ff00ff) * b; + t >>= 8; + t &= 0x00ff00ff00ff00ff; + return (uint(t)) | (uint(t >> 24)); +} + +Q_STATIC_INLINE_FUNCTION uint BYTE_MUL(uint x, uint a) { + quint64 t = (((quint64(x)) | ((quint64(x)) << 24)) & 0x00ff00ff00ff00ff) * a; + t = (t + ((t >> 8) & 0xff00ff00ff00ff) + 0x80008000800080) >> 8; + t &= 0x00ff00ff00ff00ff; + return (uint(t)) | (uint(t >> 24)); +} + +Q_STATIC_INLINE_FUNCTION uint PREMUL(uint x) { + uint a = x >> 24; + quint64 t = (((quint64(x)) | ((quint64(x)) << 24)) & 0x00ff00ff00ff00ff) * a; + t = (t + ((t >> 8) & 0xff00ff00ff00ff) + 0x80008000800080) >> 8; + t &= 0x000000ff00ff00ff; + return (uint(t)) | (uint(t >> 24)) | (a << 24); +} + +#else // 32-bit versions + +Q_STATIC_INLINE_FUNCTION uint INTERPOLATE_PIXEL_256(uint x, uint a, uint y, uint b) { + uint t = (x & 0xff00ff) * a + (y & 0xff00ff) * b; + t >>= 8; + t &= 0xff00ff; + + x = ((x >> 8) & 0xff00ff) * a + ((y >> 8) & 0xff00ff) * b; + x &= 0xff00ff00; + x |= t; + return x; } #if defined(Q_CC_RVCT) @@ -359,6 +402,21 @@ Q_STATIC_INLINE_FUNCTION uint PREMUL(uint x) { x |= t | (a << 24); return x; } +#endif + + +Q_STATIC_INLINE_FUNCTION uint BYTE_MUL_RGB16(uint x, uint a) { + a += 1; + uint t = (((x & 0x07e0)*a) >> 8) & 0x07e0; + t |= (((x & 0xf81f)*(a>>2)) >> 6) & 0xf81f; + return t; +} + +Q_STATIC_INLINE_FUNCTION uint BYTE_MUL_RGB16_32(uint x, uint a) { + uint t = (((x & 0xf81f07e0) >> 5)*a) & 0xf81f07e0; + t |= (((x & 0x07e0f81f)*a) >> 5) & 0x07e0f81f; + return t; +} #define INV_PREMUL(p) \ (qAlpha(p) == 0 ? 0 : \ @@ -1847,70 +1905,6 @@ inline int qBlue565(quint16 rgb) { return (b << 3) | (b >> 2); } -#if 1 -Q_STATIC_INLINE_FUNCTION uint INTERPOLATE_PIXEL_256(uint x, uint a, uint y, uint b) { - uint t = (x & 0xff00ff) * a + (y & 0xff00ff) * b; - t >>= 8; - t &= 0xff00ff; - - x = ((x >> 8) & 0xff00ff) * a + ((y >> 8) & 0xff00ff) * b; - x &= 0xff00ff00; - x |= t; - return x; -} - -#if defined(Q_CC_RVCT) -# pragma push -# pragma arm -#endif -Q_STATIC_INLINE_FUNCTION uint INTERPOLATE_PIXEL_255(uint x, uint a, uint y, uint b) { - uint t = (x & 0xff00ff) * a + (y & 0xff00ff) * b; - t = (t + ((t >> 8) & 0xff00ff) + 0x800080) >> 8; - t &= 0xff00ff; - - x = ((x >> 8) & 0xff00ff) * a + ((y >> 8) & 0xff00ff) * b; - x = (x + ((x >> 8) & 0xff00ff) + 0x800080); - x &= 0xff00ff00; - x |= t; - return x; -} -#if defined(Q_CC_RVCT) -# pragma pop -#endif -#else -// possible implementation for 64 bit -Q_STATIC_INLINE_FUNCTION uint INTERPOLATE_PIXEL_256(uint x, uint a, uint y, uint b) { - ulong t = (((ulong(x)) | ((ulong(x)) << 24)) & 0x00ff00ff00ff00ff) * a; - t += (((ulong(y)) | ((ulong(y)) << 24)) & 0x00ff00ff00ff00ff) * b; - t >>= 8; - t &= 0x00ff00ff00ff00ff; - return (uint(t)) | (uint(t >> 24)); -} - -Q_STATIC_INLINE_FUNCTION uint INTERPOLATE_PIXEL_255(uint x, uint a, uint y, uint b) { - ulong t = (((ulong(x)) | ((ulong(x)) << 24)) & 0x00ff00ff00ff00ff) * a; - t += (((ulong(y)) | ((ulong(y)) << 24)) & 0x00ff00ff00ff00ff) * b; - t = (t + ((t >> 8) & 0xff00ff00ff00ff) + 0x80008000800080); - t &= 0x00ff00ff00ff00ff; - return (uint(t)) | (uint(t >> 24)); -} - -Q_STATIC_INLINE_FUNCTION uint BYTE_MUL(uint x, uint a) { - ulong t = (((ulong(x)) | ((ulong(x)) << 24)) & 0x00ff00ff00ff00ff) * a; - t = (t + ((t >> 8) & 0xff00ff00ff00ff) + 0x80008000800080); - t &= 0x00ff00ff00ff00ff; - return (uint(t)) | (uint(t >> 24)); -} - -Q_STATIC_INLINE_FUNCTION uint PREMUL(uint x) { - uint a = x >> 24; - ulong t = (((ulong(x)) | ((ulong(x)) << 24)) & 0x00ff00ff00ff00ff) * a; - t = (t + ((t >> 8) & 0xff00ff00ff00ff) + 0x80008000800080); - t &= 0x00ff00ff00ff00ff; - return (uint(t)) | (uint(t >> 24)) | 0xff000000; -} -#endif - const uint qt_bayer_matrix[16][16] = { { 0x1, 0xc0, 0x30, 0xf0, 0xc, 0xcc, 0x3c, 0xfc, 0x3, 0xc3, 0x33, 0xf3, 0xf, 0xcf, 0x3f, 0xff}, -- cgit v0.12