Commit Graph

7378 Commits

Author SHA1 Message Date
Maurice Kalinowski
d3eec16862 Remove support for WinRT 8.1 and Windows Phone 8.1
[ChangeLog][QtBase][General] Removed support for WinRT/Windows Phone 8.1.

Task-number: QTBUG-57288
Change-Id: Ifd6d6780cbbdb710d99556ba3d2fb2e514d4f789
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2017-01-18 12:38:56 +00:00
Jake Petroules
ae072cd9c4 Polish up the QOperatingSystemVersion API and documentation
operator== and operator!= have been disabled, as they are likely to be
misused and are not particularly useful in practice. The same goes for
the QVersionNumber conversion convenience functions.

The constructor normalizes version component values so that invalid
versions like [5, -1, 3] cannot be constructed and made to wreak havoc
on assumed logic.

Change-Id: Iabb6876bd5dc11522032837f78cf825b921a49b2
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-01-18 05:15:01 +00:00
Jake Petroules
7634225ad2 Fix whitespace, formatting, and line length in QOperatingSystemVersion
Change-Id: Ie26571a8098e8215a6bc1e0e363763e5fc546bcd
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-01-17 01:40:54 +00:00
Tasuku Suzuki
ca7f67e82b Fix build without feature.animation
Change-Id: Ia1b9ae3a35cbc73d0bbf27db234d0cd120d0b601
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-01-16 14:12:50 +00:00
Liang Qi
7600cb6901 Merge "Merge remote-tracking branch 'origin/5.8.0' into 5.8" into refs/staging/5.8 2017-01-15 16:48:35 +00:00
Kavindra Palaraja
dbb4504f12 Add Q_CC_CLANG to the documentation page
Task-number: QTBUG-42247
Change-Id: I3f707df4d25cac12fabac863b4f6bb50bfac5e26
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
2017-01-15 11:33:20 +00:00
Marc Mutz
0deca277d2 QtCore: fix GCC 7 warnings
GCC 7 warns about implicit fall-throughs now.

Fix by adding Q_FALLTHROUGH.

Change-Id: I482ab4c6adc469b11e1fd163516ff486b3b55ef7
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-01-15 08:09:24 +00:00
Liang Qi
00935bf8c2 Merge remote-tracking branch 'origin/5.8.0' into 5.8
Conflicts:
	src/gui/painting/qcoregraphics.mm

Change-Id: I4d49535cd75f2cdf0151c1dbff312cce5e159760
2017-01-14 22:02:55 +01:00
Thiago Macieira
5a1b4832a2 Adapt to the C++ SIC introduced by P0021: noexcept overloading
C++17 adopts P0021R1[1], which makes noexcept be part of the function
pointer's type and thus be overloadable. It contains some provisions for
allowing a noexcept function pointer to cast implicitly to a non-
noexcept function pointer, but that fails in the presence of templates
and additional overloads that could match the type in question.

Fortunately, the paper proposed a test macro, so we can change our
sources now and be compatible with both C++14 and C++17 rules.

This first failed with Clang 4.0 trunk. This source incompatibility is
not our fault, it's the language's doing.

[1] http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/p0012r1.html

Task-number: QTBUG-58054
Change-Id: I2bc52f3c7a574209b213fffd14988cf0b875be63
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2017-01-14 03:24:30 +00:00
Paul Olav Tvete
635d0ae007 Fix typo in QT_REQUIRE_CONFIG error message
Change-Id: Iecfd398935f9c10aa456bd3452d34b31bc7eb4c9
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2017-01-13 08:25:50 +00:00
Kimmo Ollila
01cade5050 Fix build for INTEGRITY
Change-Id: I2c41295688e962eb263f2180bebfd1dd37613804
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
2017-01-13 07:52:16 +00:00
Jake Petroules
2f08a1d614 qglobal.cpp/QSysInfo::macVersion(): Silence deprecation warning
clang/g++ still warn when encountering the implementation of a
deprecated function.

Follows up 21a247adb4

Change-Id: I6ab1695acb520ef7ce7cb1896545d02607c3ce29
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@qt.io>
2017-01-13 01:53:48 +00:00
Giuseppe D'Angelo
6255cb893d Remove qtypetraits.h's contents altogether
So that QFlags can use an (un)signed int matching the
underlying type as identified by the compiler and not by us.

Requires fixing a few warnings about sign conversion due to
QFlags misusages in qtbase that were either plain wrong, or
were relying on the enum being backed by an (un)signed int
when it wasn't.

Keep qtypetraits.h in the source tree in order to prevent
source breaks if some downstream #includes it (note however
that it did not contain any public API).

Change-Id: Ib3a92b98db7031e793a088fb2a3b306eff4d7a3c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-01-12 22:16:06 +00:00
Alexander Volkov
dcec1420ea Use QString::asprintf(), QStringBuilder, and the multi-arg overload of QString::arg()
... instead of sequential .arg(const QString &) callings.
It saves memory allocations and prevents unexpected results
if replacing strings contain place markers.
Found with clazy's qstring-arg check.

Change-Id: I3912275a6e11c6fb7559ff5623f2e8cde9b7f07a
Reviewed-by: Anton Kudryavtsev <antkudr@mail.ru>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-01-12 17:54:28 +00:00
Edward Welbourne
8f469e4a19 Remove two unused static methods of QDateTimePrivate
... along with the two matching unused methods of QDateTime's test.

Change-Id: Id11a4b1b0132587f0df451d49c0043e9425d87ad
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-01-12 16:42:21 +00:00
Giuseppe D'Angelo
d9cb064425 Doc: fix the datatype returned by Qt::TextAlignmentRole
It's supposed to be a full alignment (like Top | Right), not
just one flag.

Change-Id: I656adda83742d7e4f31955322e937e979b32747c
Reviewed-by: David Faure <david.faure@kdab.com>
2017-01-12 16:14:40 +00:00
Jake Petroules
2b928ef6f9 Provide sensible defaults for QCoreApplication::applicationVersion
[ChangeLog][QtCore] QCoreApplication::applicationVersion now defaults to
an appropriate platform-specific value. On Windows, it defaults to the
PRODUCTVERSION parameter of the VERSIONINFO resource for classic desktop
apps, and the version attribute of the application package manifest for
Univeral Windows Platform apps. On Apple Platforms (macOS, iOS, tvOS,
watchOS), it defaults to the CFBundleVersion property of the information
property list (Info.plist) file. On Android, it defaults to the
android:versionName attribute of the AndroidManifest.xml manifest
element. On other platforms, the default remains an empty string.

Task-number: QTBUG-57715
Change-Id: I26f83dd00737e06f4321cf962aa5fab8398104ec
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-01-12 02:13:21 +00:00
Edward Welbourne
4b4bd6ab98 Simplify fileTimeToQDateTime() by having it return a UTC time
This avoids so many complications.  The prior code, using
SystemTimeToTzSpecificLocalTime(), lead to unhelpful results when the
QDateTime() implementation used MS-POSIX's defective mktime().
Although SystemTimeToTzSpecificLocalTime() is actually more correct,
we were getting inconsistent results by mixing the two: and
eliminating the use of mktime() turns out to be decidedly tricky.  So,
to avoid inconsistency, stick with a UTC time (which is what FILETIME
is defined as).  Change QFileInfo's methods to explicitly convert
.toLocalTime() where appropriate and document that these methods do
indeed return local time (as we conjecture has been taken for granted
by callers).

Also added a regression test for the reported case of this going
wrong.  A time-stamp from before Russia's (permanent, not DST) change
of TZ could end up inconsistently handled between file-system
meta-data and raw date-time APIs, due to cross-talk between different
MS-Win time APIs.

[ChangeLog][QtCore][QFileInfo] Made sure that all file lifecycle times
are in local time. This was probably true before, but is now explicit.

Task-number: QTBUG-48306
Change-Id: Ic0b99d25c4168f623d31967bc60665c0c4f38a14
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-01-11 11:53:27 +00:00
Jason Erb
ae42bf0f9b Fixed Chinese language selection on iOS
For language "Traditional Chinese" on iOS with region "US",
the logic was formerly to attempt a match on country/language/script (fail),
followed by country/language (which would result in script defaulting to
"Simplified"). Now, the logic is to try language/script first if script is
specified. Failing that, language/country will be attempted.

Task-number: QTBUG-39639
Change-Id: I75a774b1e66686e95167ff221458a97a7ea2660d
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Jason Erb <jason.erb@sparist.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-01-10 17:35:35 +00:00
Rafael Roquetto
858c1afb7a QNX: Fix comments on qcompilerdetection.h
Change-Id: I75495b4ba3d8742419f824aa0e0b52694dbd42ed
Reviewed-by: James McDonnell <jmcdonnell@blackberry.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-01-10 17:33:57 +00:00
Ulf Hermann
eaa0063b70 Fix compilation with QT_NO_SHAREDMEMORY
If we use QLatin1String we should include qstring.h.

Change-Id: Iebd761b98e515e9cd9cd34b96a0f8a602d00f086
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-01-10 16:35:06 +00:00
Kimmo Ollila
03a59d1bb8 Add support for building for INTEGRITY using GHS toolchain
Initial support for INTEGRITY to build QtBase

Change-Id: I18f36b4dea9107f01e1c281e4b62880590c777a1
Reviewed-by: Tuukka Turunen <tuukka.turunen@theqtcompany.com>
Reviewed-by: Nikola Velinov <nvelinov@ghs.com>
Reviewed-by: Risto Avila <risto.avila@qt.io>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-01-10 10:06:23 +00:00
Giuseppe D'Angelo
a35a01aaa2 QForeachContainer: make it a move-only type
Honor the rule of five. Copy assignment was already disabled.
Disable also copy construction, but re-enable the move special
member functions.

This requires making the container non-const; to avoid detaches
and keep compatibility with containers that only have begin/end
(but not cbegin/cend), use qAsConst. This requires moving qAsConst
definition a bit up in the file.

Change-Id: I19cd74437cf69baceada9483920a21e96d7b1727
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-01-10 08:29:19 +00:00
Kavindra Palaraja
41d1785e13 Clarify that QString::toDouble does not have a fallback
QString::toDouble always uses the 'C' locale.

Task-number: QTBUG-44045
Change-Id: Ifb0c2f11c83c209907dd35bb39d1450022c8e85c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-01-10 06:38:03 +00:00
James McDonnell
b0a9b9ab87 Adjust QNX choices
Don't use Dinkum choices when the C++ library is libC++ (QNX 7.0).

Change-Id: I18c3f716ccfb0c02dbfdc01eac4b707d3ae9aab6
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-01-10 01:42:53 +00:00
Jake Petroules
6b7e633248 Remove compatibility code paths for macOS < 10.10 and iOS < 8.0
Change-Id: I11bec0efc2b4d86adf64a58990260fee70f050ac
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2017-01-09 10:11:48 +00:00
Elvis Angelaccio
3f455a4b53 Introduce QDir::isEmpty()
A directory is empty when it doesn't contain files or folders.
We can exploit QDirIterator::hasNext() to check whether this is the
case. This is efficient since it doesn't list the whole folder (in the
non-empty case).

Test cases are added for both the empty and non-empty cases.

Change-Id: I0f7e26782c0f97f9c16f928dab6cae37927875d8
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-01-08 16:11:34 +00:00
Kavindra Palaraja
389165dd25 Clarify StripTrailingSlash behavior
StripTrailingSlash removes trailing slashes from the path, but not the
entire URL.

Task-number: QTBUG-47607
Change-Id: Id62b971e563e290b7ca000576bcc328616a3f1a2
Reviewed-by: David Faure <david.faure@kdab.com>
2017-01-08 16:02:44 +00:00
Martin Smith
9605f4f47b doc: clangqdoc documents the threads case
qmutex.h is updated to let clangqdoc document the threads case,
because the no-threads case is not interesting, and clang can
handle everything declared in qmutex.h. This change required
that a few minor qdoc errors be corrected in qmutex.cpp as well.

Change-Id: Icb4122f2179d6aad39dc68376498364820143297
Reviewed-by: Martin Smith <martin.smith@qt.io>
2017-01-06 20:18:19 +00:00
Oswald Buddenhagen
52d64fca66 revert to building qmake with qconfig.cpp
turns out that just appending builtin-qt.conf isn't a good idea:
executable-editing tools (objcopy, prelink, etc.) will happily drop the
"attachment".

a safe method would be adding a proper section to the executable, but
there doesn't appear to be an objcopy equivalent in msvc, and using
entirely different methods of embedding the file with different
toolchains seems like a rather bad idea.

so instead go back to the old method of building qmake with a generated
qconfig.cpp. of course, as said file is now created by qmake itself, we
have to compile qlibraryinfo.cpp a second time, and link a second qmake
executable.

Task-number: QTBUG-57803
Change-Id: I9e232693550aa870cec154e49cc06add13017cc2
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-01-06 20:09:08 +00:00
Martin Smith
45ff1cf60a doc: Fix all remaining "Cannot tie" errors in QtBase
Most of these involved moving or removing extraneous
aide-memoir comments left by programmers between qdoc
comments and their functions. There were also some
cases where Q_CLANG_QDOC had to be tested to make
something visible to clangqdoc. And there were a few
functions that should not have been documented at all.

Change-Id: I3bf7c397a9e5ddbffc40cc1fee7f19cad71a1ae7
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
2017-01-06 07:04:12 +00:00
Ulf Hermann
2ed9a52ebf Fix compilation without sharedmemory
We have to enable qt_safe_ftok with either sharedmemory or
systemsemaphore. In order to make the resulting QT_CONFIG work with the
bootstrap library we switch the features off for bootstrapping. Some
tests and examples have to be excluded when sharedmemory is not
available.

Change-Id: I3fc3926d160202b378be2293fba40201a4bf50c5
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-01-05 08:38:33 +00:00
Ulf Hermann
9ba39c4b05 Remove pointless QT_NO_THREAD ifdefs from qpropertyanimation.cpp
Change-Id: I7b7e80abbddf4d43c6135775136d993196d708b3
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-01-04 17:39:55 +00:00
Ulf Hermann
99245e9576 Avoid zero-as-nullpointer warnings in QThread
Change-Id: I3fd557a54d63c2dcabe58fab65326538896d02a2
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2017-01-04 16:17:44 +00:00
Martin Smith
dd58804cfe doc: clangqdoc doesn't need Q_GADGET
This update undefines Q_GADGET when clangqdoc is running.
With Q_GADGET defined, clangqdoc expects documentation for
QtGadgetHelper in each class where Q_GADGET is used.

Note that the documentation for the Q_GADGET macro is still
generated.

Change-Id: I3e6e6644c2c537c00c44ae77664892e125046daa
Reviewed-by: Martin Smith <martin.smith@qt.io>
2017-01-04 12:58:37 +00:00
Simon Hausmann
47c4d1378c Restore configure command line compatibility for PCRE support
Commit 9ca635482d renamed the configure
feature from pcre to pcre2, which unfortunately means that people would
have to change their build scripts to pass -qt-pcre2 instead of
-qt-pcre. As the configure check already verifies the correct PCRE
version for use (when using the system library), it seems more
convenient for our users to retain compatibility and call the configure
feature "pcre" again.

Change-Id: If26e7888814d8204d43baf7298d9916a4f856a48
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
2017-01-04 12:02:31 +00:00
Aleksey Lysenko
1b82a9aea5 Doc: add note about unsupported platforms for QProcess
Task-number: QTBUG-57840
Change-Id: I46a26a9c4c6ad0aa6994945091a2904c3b51080f
Reviewed-by: Martin Smith <martin.smith@qt.io>
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
2017-01-04 07:20:06 +00:00
Ulf Hermann
c96a4058f1 Avoid compile warnings in qabstractanimation.cpp
Change-Id: I57f90fc335b50231fb2093f096ad38168d476145
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2017-01-03 16:29:07 +00:00
Jędrzej Nowacki
5d4089299a Reduce size of QPpsObject by one pointer
Change-Id: Ibb1bef375e7d23b45595ca759646883820643f02
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2017-01-03 15:27:01 +00:00
Frederik Schwarzer
1c3c2486c6 Fix broken link in documentation
Task-number: QTBUG-57530
Change-Id: Iecb1a26f6b8a7e8a506d768668cde1c277d15dde
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
Reviewed-by: Martin Smith <martin.smith@qt.io>
2017-01-03 15:08:20 +00:00
Thiago Macieira
39e80062d0 Work around MSVC ABI stupidity in exporting inline members of base class
In this case, the issue was ICC, when compiling QtQml:

qv4sequenceobject.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __cdecl QList<class QItemSelectionRange>::replace(int,class QItemSelectionRange const &)" (__imp_?replace@?$QList@VQItemSelectionRange@@@@QEAAXHAEBVQItemSelectionRange@@@Z)
  referenced in function "public: static bool __cdecl QV4::QQmlSequence<class QItemSelection>::deleteIndexedProperty(struct QV4::Managed *,unsigned int)" (?deleteIndexedProperty@?$QQmlSequence@VQItemSelection@@@QV4@@SA_NPEAUManaged@2@I@Z)

This applies the same fix as qvector.h has had for ages due to QPolygon.

Change-Id: I15b62e0f9cec482fbb40fffd1490d791db5056bc
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-01-03 15:01:32 +00:00
David Faure
a8ae8e3130 QDateTime::fromString(): improve performance by 33%
getMaximum() and getMinimum(), called during parsing, create new
QDateTime instances, which on Linux end up calling mktime().
Making these static (for the common case of LocalTime spec)
improves performance dramatically, when parsing several date/times.

tests/benchmarks/corelib/tools/qdatetime/ (after fixing it to
actually parse a valid date/time) says:
 RESULT : tst_QDateTime::fromString():
-     36,742,060 instruction reads per iteration (total: 36,742,060, iterations: 1)
+     24,230,060 instruction reads per iteration (total: 24,230,060, iterations: 1)

Change-Id: I0c3931285475bf19a5be8cba1486ed07cbf5e134
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-01-03 13:37:49 +00:00
Simon Hausmann
79bf4e8f1c Added QSaveFile to the bootstrap library
It's quite a simple addition and required for the ahead of time compilation
tool for qtdeclarative.

Change-Id: Iba85ae5182919cdb5ab15a0b643e57c103eae632
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-01-02 12:51:37 +00:00
Daniel Vrátil
c7f0e3ebc2 Use qGetPtrHelper in Q_DECLARE_PRIVATE_D macro
This allows the Dptr parameter of the Q_DECLARE_PRIVATE_D macro to be
a smart pointer, not just a raw pointer.

Change-Id: Iaf27352e327e9aedea149461d47f2f11460a42dc
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-12-30 11:07:15 +00:00
Thiago Macieira
69ce68cb89 Doc: add a quick note about unfixed Windows encoding bug
Task-number: QTBUG-49640
Change-Id: Icb0289e3118a41dd9438fffd1492925b03de62d6
Reviewed-by: David Faure <david.faure@kdab.com>
2016-12-28 14:56:01 +00:00
Kavindra Palaraja
a89c392097 Link QVariant class documentation to the Creating Custom Qt Types article
The article does answer the questions asked in the bug.

Task-number: QTBUG-56629
Change-Id: Ib8bac0acf45bc10598fc47feb6dd73005b5ad040
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-12-28 13:31:45 +00:00
Thiago Macieira
d908ba2765 Remove HarryF's "compiler error feature" that isn't used anymore
The "qYouForgotTheQ_OBJECT_Macro" function hasn't been used in
qobject_cast since commit 7d7e8ae3fa (Qt
5.2), when Olivier made the error use Q_STATIC_ASSERT instead.

Change-Id: I15b62e0f9cec482fbb40fffd1490d7c050084369
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2016-12-28 12:43:53 +00:00
Thiago Macieira
dc6b73390b Revert "QUrl::resolved: keep treating file:name.txt as relative for now"
This reverts commit 91a2c8630b. We
promised in the Qt 5.6.2 changelog to do it in Qt 5.8. It was a
temporary compatibility hack.

[ChangeLog][QtCore][QUrl] The temporary compatibility in
QUrl::resolved() that treated the base URL as relative if its scheme
matched the current URL's scheme has been removed.

Change-Id: I3e4e5051937c40319d6efffd1490eb9a5a948481
Reviewed-by: David Faure <david.faure@kdab.com>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2016-12-28 12:43:50 +00:00
Kavindra Palaraja
2be9880ebb Removed random notes in the documentation that should not be there
Two sentences that read like author notes likely added by accident.

Task-number: QTBUG-56630
Change-Id: I7a0b114e128f95e54e9e8f26b43493f67747d650
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2016-12-28 12:00:44 +00:00
David Faure
6722147696 QMimeDatabase: fix handling of conflicting globs
This code always intended to follow the recommended checking order from
the spec, which says "if multiple globs match, use file contents".
But if the globs had different weights, it would discard globs with
lower weights, and then wrongly conclude, if there is only one glob
left, that there was no ambiguity.

The correct way is rather: remember that multiple globs matched,
do determination from contents, and if that didn't work, *then* use
(one of) the highest-weight glob(s).

This fixes PGP-encrypted *.asc files being detected as text/plain rather
than application/pgp-encrypted.
(https://bugs.kde.org/show_bug.cgi?id=346754)

Change-Id: I734459daf9f502baa95ebb89432819964e0ce304
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-12-27 11:33:03 +00:00
David Faure
f163912b5d QMimeMagicRule: endianness fixes
* apply endianness to the mask as well
* do not apply endianness to "host" entries, they were wrongly behaving
exactly like "big endian" entries.

The issue with the mask was detected by the audio/aac magic
 <match type="big16" value="0xFFF0" mask="0xFFF6" offset="0"/>
which failed to identify the test file ct_faac-adts.aac since it was
applying the mask 0xFFF6 instead of 0xF6FF (on a little-endian machine).

Not yet detected by tst_qmimedatabase which is based on shared-mime-info 1.0,
will be covered by the upgrade to 1.8 in dev.

Change-Id: I4fb7af2d367099817e712b14f2a031066d0ac432
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-12-27 11:28:55 +00:00
David Faure
7322c65ba7 QMimeMagicRule: fix off by one in the number of bytes checked
Since the loop says p <= e, no +1 should be added to e.

Testcase:

The magic for application/x-gameboy-rom says
<match type="byte" value="0x0" mask="0x80" offset="323"/>
and this code was checking both byte 323 and byte 324, finding a match
at pos 324, returning application/x-gameboy-rom erroneously.

Given the magic for application/x-gameboy-color-rom:
<match type="byte" value="0x80" mask="0x80" offset="323"/>
the expected result for game-boy-color-test.gbc is application/x-gameboy-color-rom

Not yet detected by tst_qmimedatabase which is based on shared-mime-info 1.0,
will be covered by the upgrade to 1.8.

Change-Id: I2396cb1ccfb26db5a24d5551fef493cc0b98a247
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-12-27 08:44:32 +00:00
Lars Schmertmann
5882866768 Extend qChecksum calculation
ISO 14443-3 is for nfc communication and uses 2 different checksums.
The existing one is from ISO 3309 and the other one is from ITU-V.41.
Both are needed to implement an own transport layer defined in ISO
14443-4 to allow nfc commands with a length above 250 byte independent
from the smartphone.

This change will avoid code duplication in QNearFieldTarget.
The private function qNfcChecksum is a copy of qChecksum.

Change-Id: I790ffec8e2ea46f88b2db6f48b64fdcb140e7b70
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-12-25 08:24:18 +00:00
Andre Hartmann
615027129d QByteArray: Overload toHex() with separator character
The separator character is inserted in the resulting array
after every byte and is useful for MAC address output like
01:23:45🆎cd:ef, Hash fingerprints, or low level data
debug output.

[ChangeLog][QtCore][QByteArray] Added toHex() overload to
insert a separator character between the hex bytes.

Change-Id: Ibe436094badc02f3ade7751aa8b5d690599941d4
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-12-24 21:05:43 +00:00
Anton Kudryavtsev
6d1d66a042 QObject: add startTimer() overload with std::chrono
In client code I often see code like:

    startTimer(1000); //ms

Let the code to be self-explaining. So provide overload
method that takes std::chrono::milliseconds as arg.
QTimer already has std::chrono support, but QObject does not.

Change-Id: Ib348612ce35f1a997b4816fe9e864775cbcbec16
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2016-12-23 18:08:53 +00:00
Oswald Buddenhagen
8f49da6c18 ... and so configureapp.exe disappeareth
Change-Id: I3fd9f2b0d4cf05a625484fce21532da8563cd62c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-12-23 13:45:59 +00:00
Oswald Buddenhagen
a71b53d600 fix sysrootification of install paths
initially, the idea was that QLibraryInfo would receive a
pre-sysrootified ExtPrefix from the builtin qt.conf. matching this
against the sysroot would then tell us whether to sysrootify the Prefix
from a "regular" qt.conf as well.
however, this would have lead to some major ugliness and inconsistency
between the code paths, so i changed my mind.
unfortunately, i failed to adjust the remaining code, leading to
169a40d51 entirely breaking sysrootification ...

the proper (and nicely consistent) solution is to introduce a
SysrootifyPrefix key to qt.conf. this is user-accessible as well, so as
a bonus it is now possible to adjust the setting at qmake installation
time. incidentally, this omission was the last thing that prevented
using the same qmake host build for any imaginable configuration of the
same qt version ... i think.

Change-Id: Ic0eebf21f93651f6374628c0ad8b206d696a4a7e
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2016-12-22 11:48:05 +00:00
David Faure
b9edbb5d54 QLockFile: make sure we encode the hostname as UTF-8 in the lock file
We chose to use UTF-8 as it allows us to ensure there's no mistaking the
hostname in case the locale is changed, if the host name contains
characters outside of US-ASCII.

But this didn't work because the code that wrote the hostname always
used the local 8-bit codec instead of UTF-8. On Unix, we used the
result of gethostname(3) directly, which is supposedly on the locale codec.
This commit doesn't fix Windows, which requires _wgetenv, the plan being
to encapsulate that with a qEnvironmentVariable() method.

[ChangeLog][QtCore][QLockFile] Fixed a bug that caused QLockFile not to
recognize a stale lock file if the machine's hostname contained non-US-
ASCII characters, on Unix. A Windows fix is still pending.

Task-number: QTBUG-49640
Change-Id: Ib9d045544ff370ec901626658a84ec4e6575fe21
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-12-21 15:57:40 +00:00
Stephen Kelly
baad82d242 QIPM: Persist model indexes after emitting layoutChange, not before
Callers can persist a QModelIndex which was not persisted before in a
slot connected to the signal, and such a persisted index must be updated
in the course of the layoutChange.

Store the indexes to persist after emitting the signal.

Task-number: QTBUG-32981
Change-Id: Ibee4c0d84817d72603a03fe5b22fdeefeac0695e
Reviewed-by: David Faure <david.faure@kdab.com>
2016-12-21 01:37:50 +00:00
Stephen Kelly
0874861bcc QSFPM: Remove data manipulation from move handlers
Similar to the fix in the parent commit, incorrect updating of the
internal data structures during layout changes can lead to dangling
pointers being dereferenced later.  Moves are treated as layoutChanges
by this proxy by forwarding to the appropriate method.  However, data is
incorrectly cleared prior to that forwarding.  Remove that, and let the
layoutChange handling take appropriate action.

Change-Id: Iee951e37152328a4e6a5fb8e5385c32a2fe4c0bd
Reviewed-by: David Faure <david.faure@kdab.com>
2016-12-21 01:37:40 +00:00
Stephen Kelly
3bd0fd8f97 QSFPM: Fix handling of source model layout change
In sourceLayoutAboutToBeChanged the source model update is ignored if
the affected parents are filtered out anyway.  The same logic is
attempted in the sourceLayoutChanged slot, but there the early-return
logic is applied too late - the mapping is cleared before performing the
early-return.  Because pointers into the mapping are used in the
internalPointer of QModelIndexes in this class, persistent indexes used
later will segfault when attempting to dereference it.

Additionally, if a parent becomes invalid as a result of the
layoutChange, it would be filtered out by the condition in the loop,
resulting in a different result in the comparison of emptiness of the
parents container.

Fix that by persisting the parent's container, and performing the test
for early-return before clearing the mapping.

Task-number: QTBUG-47711
Task-number: QTBUG-32981
Change-Id: If45e8a1c97d39454160f52041bc9ae7e337dce97
Reviewed-by: David Faure <david.faure@kdab.com>
2016-12-21 01:37:31 +00:00
Thiago Macieira
7ca66b1e66 Fix race condition in QFactoryLoader: lock the mutex we already have
The process of loading a plugin is examplified by the qLoadPlugin
function (though not all users of QFactoryLoader use this function, they
all do something similar):

    const int index = loader->indexOf(key);
    if (index != -1) {
        QObject *factoryObject = loader->instance(index);
        if (FactoryInterface *factory = qobject_cast<FactoryInterface *>(factoryObject))
            if (PluginInterface *result = factory->create(key, std::forward<Args>(args)...))
                return result;
    }

QFactoryLoader::indexOf already locked the mutex, but not
QFactoryLoader::instance. This commit fixes that.

Note that calling the virtual create() in the plugin's factory is not
protected by the mutex. Each plugin's factory must be thread-safe and
also create an object that works on any thread too. It's also the
responsibility of the caller of qLoadPlugin to ensure that it's called
thread-safely.

Task-number: QTBUG-42855
Change-Id: I63e21df51c7448bc8b5ffffd148ebee33d4c47de
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2016-12-17 04:11:09 +00:00
Liang Qi
b131503361 Merge remote-tracking branch 'origin/5.8' into dev
Conflicts:
	configure
	configure.pri
	examples/widgets/painting/fontsampler/mainwindow.cpp
	examples/widgets/painting/fontsampler/mainwindow.h
	mkspecs/features/moc.prf
	src/corelib/global/qglobal.h
	src/gui/text/qtextdocument.cpp

Change-Id: Ica65512e00871695190a14ccea5c275b0165f787
2016-12-16 16:38:33 +01:00
Jake Petroules
ff19ebcc2d Make QProcessEnvironment available on Apple Platforms and VxWorks
All Apple Platforms have public API to get the environment; there is no
reason to exclude it from the UIKit subset. It can be useful for
debugging in Xcode, in particular. Furthermore, VxWorks appears to have
support for the Unix environment API, so don't exclude it either.

[ChangeLog][QtCore] QProcessEnvironment is now available on iOS, tvOS,
watchOS, and VxWorks

Change-Id: Ife3745f9b0a588de521a714b4273c5c08eeef286
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2016-12-16 09:15:03 +00:00
Jake Petroules
b9f56751cb Introduce a configure option for QProcessEnvironment
This decouples QProcess and QProcessEnvironment, since the latter may
actually be available on platforms where the former is not.

Change-Id: I3dc799ffdf94486b64143ed01a369897fff44a96
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-12-16 09:14:24 +00:00
Liang Qi
9bfe3ab71e Merge remote-tracking branch 'origin/5.8.0' into 5.8
Conflicts:
	doc/global/qt-cpp-defines.qdocconf
	src/plugins/platforms/android/qandroidplatformopenglcontext.h
	src/plugins/platforms/android/qandroidplatformtheme.h

Change-Id: I13d51cc66f708138ff4d667ceea7d515992e58a4
2016-12-16 09:45:16 +01:00
Thiago Macieira
9f96e4f431 Work around old Clang bug parsing of NSDMI referring to members
Clang pre-3.4 didn't like this and it's used in Xcode 5.1 (which we need
to support for 5.8).

error: 'this' cannot be implicitly captured in this context
    typename T::const_iterator i = c.begin(), e = c.end();
                                   ^

Task-number: QTBUG-57488
Change-Id: I63e21df51c7448bc8b5ffffd148e688d7c9b89d6
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2016-12-16 04:05:56 +00:00
Oliver Wolff
56a167d30c winrt: Check for removed timers after sending events
After all the check makes sense here. If a timer was removed as a result
of sendEvent and it was not at the end of the list the list is not
shrunk but the timer info's id is just set to INVALID_TIMER_ID.

Additionally the timer's object should be fetched before we unlock the
locker as timerIdToObject is changed in removeTimer and we might access
a nullptr if the timer has been removed.

Reverts c83ba01f7b

Task-number: QTBUG-56756
Change-Id: Ib1a04c02fbfcf4c939b4891d42f954dc9e87149e
(cherry picked from commit 8f2088db17)
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
2016-12-15 05:20:45 +00:00
Topi Reinio
cfbe5df48c qdoc: Define Q_COMPILER_UNICODE_STRINGS
Some public functions in QString and QDebug are declared inside
Q_COMPILER_UNICODE_STRINGS. This commit defines it for QDoc, and
adds documentation for QDebug functions that are now visible to
QDoc.

Change-Id: Ia7f2501c1dc7b8244dcc3ce4adcd2019fdbffcb6
Reviewed-by: Martin Smith <martin.smith@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-12-15 05:20:24 +00:00
Friedemann Kleint
21a247adb4 qglobal.cpp/QSysInfo::windowsVersion(): Silence deprecation warning
g++ still warns when encountering the implementation of a deprecated
function.

Change-Id: I6a25fc8c814590e5337069f9bced0cdec97653bf
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
2016-12-14 17:45:04 +00:00
Alexander Volkov
b57e7c0963 doc: Replace Q_DECL_OVERRIDE by override in snippets
And remove redundant virtual.

Change-Id: If0650409b88ad962f6713d082d9095675f4c68e8
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: hjk <hjk@qt.io>
2016-12-14 16:49:23 +00:00
Edward Welbourne
f8ec940ab6 Simplify QDateTime::toString(Qt::TextDate)'s text construction
We can in fact delegate to QDate::toString(), contrary to the comment
that was there; we just need to insert the time in the right place,
which is easy enough to find.

Change-Id: I66624724628d45ce283243879b102ec8f741a15f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-12-14 16:41:06 +00:00
Edward Welbourne
ff4f0c3276 Fix handling of time-zones in QDateTime::toString(Qt::TextDate)
Previously, a zone-based time would claim to be GMT, rather than
identifying its zone properly.  Sadly, testing this reveals that
proprietary operating systems don't handle abbreviations ideally.

Task-number: QTBUG-57320
Task-number: QTBUG-57298
Change-Id: I8d8b7fffdbf65ac6178a65f5fc2df4d25afb1a14
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-12-14 16:40:57 +00:00
Edward Welbourne
7c33c644d3 Fix QDateTime::toString(Qt::ISODate)'s handling of Qt::TimeZone
When the time is specified relative to a zone, the ISO date produced
lacked its offset suffix; all zones were treated as if they were local
time.  Handle zone as for an offset from UTC and ensure we do set the
date-time objects's offset from UTC when it's zone-based.

Change-Id: I7c9896bb8ec0a9d89df14a6e94b005174ab9e943
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-12-14 16:40:42 +00:00
Erik Verbruggen
311e523cef Aarch64: vectorize findChar
The "algorithm" is the same as the one for x86.

Also added a comment to qt_from_latin1 to indicate that manual
vectorization doesn't bring anything useful.

Change-Id: I6130cbd83c14c22b1bd15d726b26dbc83068b1a6
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-12-14 09:34:25 +00:00
Oswald Buddenhagen
169a40d511 move generation of qconfig.cpp (and qt.conf) to qmake-based configure
this moves us another step towards the "outer" configure doing just
minimal bootstrapping of qmake.

a challenge here was that so far, qmake itself needed qconfig.cpp. this
was replaced by usage of a qt.conf file instead of compiled-in values.
however, to make the executable still self-contained, that qt.conf is
embedded into it (by simple appending of a fixed signature and the text
file).

the qmake with the embedded qt.conf is not used for the qt build itself,
which instead relies on the qt.conf in bin/ as before. however, due to
the missing built-in values, this file now needs to contain more
information than before. but except for a minimal version that is needed
to start up qmake/configure at all, that file is now also generated with
qmake. as some of the newly set up properties are subsequently used by
configure itself, qmake gains a (deliberately undocumented) function to
reload the qt.conf after it's fully populated.

unlike the old implementations, this one doesn't emit redundant qt.conf
entries which match the hard-coded fallbacks. omitting them leads to
leaner files which are more comprehensible.

Started-by: Paolo Angelelli <paolo.angelelli@qt.io>
Change-Id: I4526ef64b3c89d9851e10f83965fe479ed7f39f6
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
2016-12-13 18:56:12 +00:00
Liang Qi
6755ec891a Merge remote-tracking branch 'origin/5.8' into dev
Conflicts:
	configure
	qmake/Makefile.unix.macos
	qmake/Makefile.unix.win32
	qmake/generators/win32/msvc_vcproj.cpp
	src/3rdparty/pcre/qt_attribution.json
	src/corelib/io/qsettings.cpp
	src/corelib/kernel/qdeadlinetimer.cpp
	src/platformsupport/kmsconvenience/qkmsdevice.cpp
	src/platformsupport/kmsconvenience/qkmsdevice_p.h
	src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmscreen.cpp
	src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldeviceintegration.cpp
	src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldevicescreen.cpp
	src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsdevice.cpp
	src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsscreen.h
	tests/manual/qstorageinfo/printvolumes.cpp
	tools/configure/configureapp.cpp

Change-Id: Ibaabcc8e965c44926f9fb018466e8b132b8df49e
2016-12-13 09:39:20 +01:00
Allan Sandfeld Jensen
bb0f29f82b Fix gcc 6.4 builds
The builtins clzs and ctzs have been removed. Additionally they were
never proper internal GCC builtins and shouldn't have been used in a
constexpr function in the first place. This patch removes the assumption
that they exist when BMI is available, and let GCC fall back to using
__builtin_clz and __builtin_ctz.

Change-Id: I3e0b4e246098bb9ce6ede28b311948260ef881b9
Task-number: QTBUG-56813
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-12-13 05:14:32 +00:00
Giuseppe D'Angelo
9ca635482d PCRE2: port QRegularExpression to PCRE2
PCRE1 is going towards EOL. PCRE2 is the way forward in terms
of new features, performance, and security improvements. The
APIs that QRegularExpression uses are similar so the required
modifications aren't extensive.

The biggest difference comes to JIT-compiling of the pattern.

In PCRE1, JIT-compiling did not modify the processed PCRE pattern,
but returned a new chunk of data.

This allowed multiple threads to keep matching using the same
processed data and NULL for the JIT data, until a thread
JIT-compiled and atomically set the shared JIT data to the results
of the compilation.

In PCRE2, JIT-compiling _modifies_ the processed PCRE pattern in a
way that it's thread unsafe [1]; the results of JIT-compilation
are stored somewhere inside the processed pattern.
This means the above approach cannot work -- a thread may be
matching while another one JIT-compiles, causing a data race.

While waiting for better workarounds from upstream, employ a
read/write mutex to protect the matching from JIT-compilation.

[1] https://lists.exim.org/lurker/message/20160104.105831.3cb25b39.en.html

[ChangeLog][General] QRegularExpression now requires the PCRE2
library, at least version 10.20. Support for the PCRE1 library
has been dropped. A copy of PCRE2 is shipped with Qt and will
automatically be used on those platforms which lack it.

Change-Id: I9fe11104230a096796df2d0bdcea861acf769f57
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-12-12 15:22:01 +00:00
Edward Welbourne
c237a8d76f QTzTimeZonePrivate: don't assume int is a 4-byte type
It probably is today, but when the I/O we're doing is explicit about
how many bytes it eats, make sure we're using an explicitly 4-byte
type, qint32.

Change-Id: I48a35fe58043368cdfd096e2628bba410d94ceaa
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-12-12 13:59:07 +00:00
Edward Welbourne
772b12c436 QTzTimeZonePrivate::init() fix for DST start as standard time changes
Europe/Samara reduced its standard offset at the same time as it
started DST in March 2010, so the transition didn't change net offset.
Our interpretation of the TZ database assumed the prior standard
offset still applied; as this was equal to the new offset with DST, it
marked the dst offset as zero, so we interpreted the next few months
as being without DST, although the TZ database marks it as with.

Generally, if a DST period has an odd DST offset, it's possible it's
due to a change to standard offset at its start.  Deem the offset odd
if it's not what we last saw (or, on the first DST, not an hour); in
that case, check the DST period's end, to see if it offers a less odd
DST offset.  Positive DST offsets are less odd than zero or negative;
otherwise, expect what we saw last, one hour is not odd and closer to
what we saw last is less odd than further from it.  This suffices to
fix Samara in 2010, at least.

Task-number: QTBUG-56345
Change-Id: I9f0ee4e9cd6901c28a8ec1558aec5d26a21152f6
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-12-12 13:58:45 +00:00
Edward Welbourne
6e3f58cbbe QDateTime, QTimeZone: fix mappings from zone time to UTC
Such mappings are ill-defined in the presence of daylight-savings time
(DST); at its transitions, you need information about whether DST is
active or not to determine the correct UTC value.  Existing code did
not have a way to be told that hint, so could not be correct.

Fixing this required changing the (thankfully private) APIs by which
QDateTime accessed QTimeZone's information stipulated by zone time.
In QDateTime, this required propagating the needed hint, when DST
status was known.

QAndroidTimeZonePrivate overloaded QTimeZonePrivate::dataForLocalTime
with an implementation that works whenever !hasTransitions(); the base
implementation handled this case lamely, so I've moved the Android
implementation there, to have only one place for both re-writes.

Amended tst_QDateTime's expected failures; passing a date and time to
the constructor *is* ambiguous when the moment indicated is in a
transition.  I have changed which way we resolve that ambiguity.

Added round-trip test of QDateTime's fromMSecs/toMSecs (but as a
QTimeZone test, since that's what's actually getting tested), based on
a test-case from Marko Kangas.  Initially failed for various zones,
each at one hour-offset; and, on some platforms, for some zones, at
all offsets.  These last revealed that a platform may claim to have
zone information yet, for some zones, lack it (or have very incomplete
information).  In each case, despite this, the platform does give
offsetFromUtc().  (The test also found another pre-existing bug on
Linux; fixed in an earlier commit.)

To accommodate these gaps in transition data, the transition-based
code now falls back to the offsetFromUtc()-based code (used when there
are no transitions) if it can't find a previous transition (which, in
any case, it needs to do its job).

Task-number: QTBUG-56460
Task-number: QTBUG-56397
Task-number: QTBUG-52284
Change-Id: I2f7422a9e9d3767940b1901d887c6a2c1f36ac9f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-12-12 13:58:26 +00:00
Giuseppe D'Angelo
1da70af724 QMap: use std::less for defining an order between pointers
Reinterpret_cast()ing a pointer to a suitably sized integer is not guaranteed
to always give the same result for the same pointer (!). Therefore the
resulting integers are not comparable in a meaningful way. std::less is
supposed to be used to compare arbitrary pointers, so use it.

(Hopefully and reasonably, under the hood std::less does exactly what we
were doing, so this isn't BiC.)

Change-Id: I9960b3d6e35657fe7a25b842054f5d338280e850
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-12-12 11:15:22 +00:00
Friedemann Kleint
101449a4cf QDir::cd(): Handle UNC server paths correctly
Add a bool *ok out parameter to qt_normalizePathSegments() and return false
when ".." are left over for an absolute path, indicating an attempt to
change above root.
Factor out static helper qt_cleanPath() to be able to pass the return value
to QDir::cd() and return on failure from there.

Amends change 63f634322b, which did
not handle UNC paths.

Task-number: QTBUG-53712
Change-Id: I3e63a5dd0259306a0b99145348d815899582f78e
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-12-12 07:25:22 +00:00
Friedemann Kleint
f7b44f879c QDir::cleanPath(): Do not cd above root paths (UNC, WinRT)
Calling QDir::cleanPath() on "//server/path/.." resulted in "/".

Factor out a function to determine the root path part of an absolute
path for later use, and handle some special cases:
- Consider server name of "//server/path/.." as part of the prefix.
- Check on the root path for WinRT.

Task-number: QTBUG-53712
Change-Id: Ibddacf06212b6fc86fa74a5e4078df6cfd5b66f5
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-12-12 07:25:05 +00:00
Thiago Macieira
4c0760d327 Re-fix the build with ICC and cmath & math.h
Commit c35fef9d3b wasn't sufficient. The
problem is that there's a complex combination of libc headers (math.h),
C++ headers (cmath), which may be provided by three different sources on
Linux (glibc, gcc and ICC). On some combinations, the isnan macro leaks
from math.h or cmath and that's what the the commit above tried to fix.

On some other combinations, there's no macro but there's an ::isnan
function defined. When we do "using namespace std; return isnan(x);",
that causes a compilation error. This commit solves that by detecting
whether there is a macro defined.

error: more than one instance of overloaded function "isnan" matches the argument list
             function "isnan(double)"
             function "std::isnan(double)"
             argument types are: (double)

Change-Id: Iaeecaffe26af4535b416fffd148bf71826541bdd
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-12-10 19:31:45 +00:00
Giuseppe D'Angelo
e5e26294f2 foreach: do not use operators that trigger non-evaluated contexts
Namely: decltype(). Ideally we'd want C++17's template constructor
argument deduction, but instead use the C++11 solution: a factory
function. This enables using things such as lambdas in the container
argument.

Change-Id: Idba64d8069d15bbafe54cfdebe24b1fba1eb8d0a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-12-10 18:11:38 +00:00
Thiago Macieira
b0c321a8db Don't crash on QVLA construction from an empty std::initializer_list
The C++ standard says in [support.initlist.access]/1:

 constexpr const E* begin() const noexcept;

 Returns: A pointer to the beginning of the array. If size() == 0 the
 values of begin() and end() are unspecified but they shall be
 identical.

So we can't assume it's non-null. I didn't want to remove the Q_ASSERT,
so passing a non-null pointer to append() remains required. This patch
simply won't call append() if the initializer list is empty.

This was already tested, but the failure is with a compiler that is not
part of the Qt CI.

Task-number: QTBUG-57277
Change-Id: Iaeecaffe26af4535b416fffd1489806872b412ee
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2016-12-09 03:11:34 +00:00
Liang Qi
cae32bd04d Merge remote-tracking branch 'origin/5.7' into 5.8.0
Change-Id: I576187a9905802c177ae483e6c29d0f55cf7034d
2016-12-08 08:20:36 +01:00
Erik Verbruggen
062be10228 Mark qt_addObject/qt_removeObject for removal in Qt6
We now have qtHookData, which is a better (and cheaper) way to add hooks
for object creation and deletion. For binary-compatibility reasons we
cannot remove it in Qt5.

Change-Id: Iecd9f4e1195f90279c395845fa26c6301b67b9a1
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-12-07 09:15:10 +00:00
Tobias Hunger
1f87726980 MimeTypeParser: Make sure errorMessage is set
Other methods that call this method check for errorMessage to be
nullptr, so better check here, too.

Change-Id: I8cf4e9d4f5eaafcfc8309dc351ae3b7027c40a98
Reviewed-by: David Faure <david.faure@kdab.com>
2016-12-07 08:40:05 +00:00
Jake Petroules
f7253b2568 Don't advertise deprecated members of QSysInfo in the documentation
Provide appropriate alternative documentation where applicable.

Change-Id: I73d810938bb961a74d06d8cedb05c38675363ef0
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-12-06 22:02:38 +00:00
Jake Petroules
2da89b8fb2 Complete QOperatingSystemVersion documentation
This adds documentation for QOperatingSystemVersion::OSType and cleans
up some extraneous quotes.

Change-Id: Idaeb163caded9a51ce0fbcc812eb622b4227844e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-12-06 22:02:33 +00:00
Ulf Hermann
141be52f2f Merge the two features for shared memory
Change-Id: Ic7bd27b289b755c801e3c510c44b2afe9a253bd8
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
2016-12-06 17:03:26 +00:00
Martin Smith
c27750ea2b qdoc: Ignore Q_COMPILER_REF_QUALIFIERS for now
Q_COMPILER_REF_QUALIFIERS is not yet supported
on all platforms, so clangqdoc must ignore
functions that are defined only when it is
defined. This change adds  && !defined(Q_CLANG_QDOC)
to some #if defined(Q_COMPILER_REF_QUALIFIERS) tests
to allow clangqdoc to use old declarations.

Note that Q_CLANG_QDOC should also be used instead
of Q_QDOC from now on, so that we know that uses
of Q_QDOC have been examined to see if they are
still required for clangqdoc.

Change-Id: I910be70df63eca09985728c7b9eba473aed141ba
Reviewed-by: Martin Smith <martin.smith@qt.io>
2016-12-04 12:28:35 +00:00
Martin Smith
128748d6fe doc: make Q_OS_WIN code available to qdoc
Some declarations in QProcess are declared only
for Windows. This change uses the Q_CLANG_QDOC
macro so that #if defined(Q_OS_WIN) becomes
This ensures that Windows-specific documentation
always gets generated. The macro is added in
both .h and .cpp files.

Change-Id: I632fc52d010cd7c0399fd191f44cbacf6ed25aff
Reviewed-by: Martin Smith <martin.smith@qt.io>
2016-12-04 12:28:24 +00:00
Martin Smith
bf2af6af68 doc: Upgrade QDeadlineTimer for clang-qdoc
Duplicate qdoc comments removed for setPreciseRemainingTime(),
remainingTime(), and deadline(). Added qdoc comments for swap(),
and two new assignment operators. Also added a few parameter names.

Change-Id: I5c19ca3bdef876019c5742397249ea9e0c066bf3
Reviewed-by: Martin Smith <martin.smith@qt.io>
2016-12-04 12:28:05 +00:00
Thiago Macieira
32a7efe225 Fix the warning number for ICC deprecated warnings
That's what happens when you don't test and just rely on an the warning
listing. ICC has two warning numbers for deprecated warnings: one that
matches Q_DECL_DEPRECATED and one for Q_DECL_DEPRECATED_X.

Change-Id: I73fa1e59a4844c43a109fffd148ca7a05eda8f13
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2016-12-04 07:26:13 +00:00
Marc Mutz
5497e6de89 QItemSelectionRange: de-inline op<
It's a bit large for an inline function.

Note for Qt 6 that this function is nonsense.

Change-Id: If6af5d3538aac86d55313ba6accdb13f892e6564
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2016-12-02 20:22:20 +00:00
Anton Kudryavtsev
fec08545ff QVariant: optimize convert() for bool case
Do not create QByteArray from const char* to compare with other
QByteArray, because there is an overloaded operator==.
So avoid needless allocations.

Reorder condition, because isEmpty() method is cheaper than
string compare.

Change-Id: I8d2c8a0fb247528d9ce485007431167372d62bff
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2016-12-01 12:20:23 +00:00
Topi Reinio
5ac33fff0f QCommandLineOption: Remove excess close parenthesis from a warning
Change-Id: Iff197a2a00b686ad2d29a1e156389bec4639f3c0
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-11-30 08:50:17 +00:00
Marc Mutz
feb95effc4 QDeadlineTimer: fix namespace for chrono literals in examples
Change-Id: I6d39b4fe653cf89d2bd27af4b3f606d98ac83eba
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-11-30 08:28:35 +00:00
Lars Knoll
b82650891e Use poll related features properly
And get rid of related DEFINES in the pri file

Change-Id: I54cf25b7cb447af22b410213759044e8018939a6
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
2016-11-30 08:11:12 +00:00
Oliver Wolff
8f2088db17 winrt: Check for removed timers after sending events
After all the check makes sense here. If a timer was removed as a result
of sendEvent and it was not at the end of the list the list is not
shrunk but the timer info's id is just set to INVALID_TIMER_ID.

Additionally the timer's object should be fetched before we unlock the
locker as timerIdToObject is changed in removeTimer and we might access
a nullptr if the timer has been removed.

Reverts c83ba01f7b

Task-number: QTBUG-56756
Change-Id: Ib1a04c02fbfcf4c939b4891d42f954dc9e87149e
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
2016-11-30 07:49:41 +00:00
Lars Knoll
e3555fe970 Properly use QT_CONFIG macro to check for ICU
And remove the QT_USE_ICU define.

Change-Id: I8134ee18af7c90ed7070926ca31b3a57b3ec37dd
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
2016-11-29 19:04:37 +00:00
Lars Knoll
0c8f3229de Clean up config handling of logging backends
Turn them into proper private features, and remove setting of
defines in the pri file.

Change-Id: Iafc11e93d4a9349bf15971dc1adac9a828ea03f6
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
2016-11-29 19:04:30 +00:00
Albert Astals Cid
1155ca10f8 QSettings: Avoid unneeded sync() on destruction
... if sync() has already been called manually.

Change-Id: I11bd6810aa3c1065a72ffaa2001d1bdbf8bf9c89
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-11-29 15:42:25 +00:00
Marc Mutz
1710947fde QMutex: small doc fixes
Add parentheses after function names, replace
  is different -> differs

Change-Id: I6332db1d1650ed8d8320c5f20cd79d0bf1870e27
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
2016-11-29 12:27:07 +00:00
Oliver Wolff
a103992f49 Fixed build using Visual Studio 2017
As _BitScanForward and friends are not marked constexpr in Visual Studio,
functions using these may not be marked either.

Task-number: QTBUG-57086
Change-Id: I29cfa4459580b5740f1011e7f39309844518ce03
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
2016-11-29 10:05:58 +00:00
Anton Kudryavtsev
7eb4be9db8 QStringRef: de-duplicate lastIndexOf code
Change-Id: Id6d804b2ab4c9c763d7ec9cb66c255ed0b4f785d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-11-28 13:18:45 +00:00
Thiago Macieira
534c1ce76d Remove unnecessary warning disabling
Qt 5.7 cannot be compiled in C++03 mode anymore.

Change-Id: Iaeecaffe26af4535b416fffd1489d808edc3c996
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2016-11-27 03:20:23 +00:00
Thiago Macieira
40c9e9dc5f Add a macros for disabling deprecated declaration warnings
This is the only warning we disable in a lot of places in Qt 5.8 source
code. If other warnings become common, we can add macros for them too.

Change-Id: Iaeecaffe26af4535b416fffd1489d1968e29c52a
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2016-11-27 02:31:12 +00:00
Liang Qi
d34be32434 Merge "Merge remote-tracking branch 'origin/5.7' into 5.8" into refs/staging/5.8 2016-11-26 10:25:14 +00:00
Thiago Macieira
20526cb014 Make sure all pattern args get cleared when parsing a new pattern
The user can call qSetMessagePattern after program start, so we need to
be sure that the parsed argument data is properly cleared.

Task-number: QTBUG-57144
Change-Id: I1978c6b95bd84639a8c4fffd1487429b04725522
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
2016-11-26 07:13:45 +00:00
Liang Qi
bce25a6340 Merge remote-tracking branch 'origin/5.7' into 5.8
Conflicts:
	src/gui/painting/qcoregraphics.mm
	src/gui/painting/qcoregraphics_p.h
	src/plugins/platforms/cocoa/qcocoahelpers.h
	src/plugins/platforms/cocoa/qcocoahelpers.mm

Change-Id: Ibe5efcae73526b3d3931ed22730b13d372dcf54e
2016-11-25 14:41:29 +01:00
Konstantin Tokarev
5cd4001bf2 Use separate Qt5Config.cmake inside build directory
Qt5Config restricts search paths of Qt components to ${_qt5_install_prefix}
to prevent accidentally using system Qt modules in case of restricted Qt
configuration. However this does not work properly when Qt is used without
installation, in particular when building cmake-based QtWebKit as a Qt
submodule, because ${_qt5_install_prefix} resolves to QtBase and does not
contain components from other modules.

This patch changes search path from ${_qt5_install_prefix} to all qt5
subdirectories.

Change-Id: Icf01a256097710889573ad69d847b9c3bffa1449
Reviewed-by: Kevin Funk <kevin.funk@kdab.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
2016-11-25 10:46:34 +00:00
Liang Qi
50aeedd86c Merge remote-tracking branch 'origin/5.6' into 5.7
Conflicts:
	mkspecs/features/qml_module.prf
	src/corelib/tools/qdatetimeparser_p.h

Change-Id: I5382cee3ddb33107dc61ee20f7a9188c4a68a882
2016-11-25 10:32:29 +01:00
Orgad Shaneh
5bd2d6afec Remove nokia reference in example mimetype
Change-Id: I45c01fd57171f4ba6ea195d7ad3ae988a1797acb
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Reviewed-by: David Faure <david.faure@kdab.com>
2016-11-24 20:03:35 +00:00
Liang Qi
3966ab51ff Merge "Merge remote-tracking branch 'origin/5.7' into 5.8" into refs/staging/5.8 2016-11-24 11:18:22 +00:00
Laszlo Agocs
85f868e73e Add an OpenGL program binary disk cache
Introduce a glProgramBinary-based disk cache in QOpenGLShaderProgram.

By switching the typical

program->addShaderFromSourceCode(QOpenGLShader::Vertex, ...)
program->addShaderFromSourceCode(QOpenGLShader::Fragment, ...)

invocations to

program->addCacheableShaderFromSourceCode(QOpenGLShader::Vertex, ...)
program->addCacheableShaderFromSourceCode(QOpenGLShader::Fragment, ...)

the compilation may be skipped via gl(Get)ProgramBinary and a disk
cache, when supported.  Such QOpenGLShaderProgram instances will have
no QOpenGLShader instances attached. Instead, the entire program
binary (which is driver-specific) is loaded as-is.

Support means OpenGL ES 3.0 or the presence of
GL_ARB_get_program_binary, in combination with >= 1 supported binary
formats. Note that some drivers claim program binary support but
expose no formats. This amounts to no support in practice.

When support is not present, calling the new functions is equivalent
to the non-cacheable variants. If the OpenGL driver changes (vendor,
renderer, version strings), recompilation and storage of the new,
potentially incompatible binary program will happen transparently.

The cache can always be disabled by setting
QT_DISABLE_SHADER_DISK_CACHE=1 or the new application attribute
Qt::AA_DisableShaderDiskCache.

Location-wise the primary choice is the shared cache
(GenericCacheLocation). If this is not available or is not writable,
the per-process one (CacheLocation) is used instead.

In addition to the new public APIs in QOpenGLShaderProgram, the main
shader users in QtGui are migrated as well. (OpenGL paint engine,
glyph cache, blitter, eglfs mouse cursor).  This means that any
application using QPainter on OpenGL or widgets with eglfs will
benefit from the improved startup times. Qt Quick will follow suit as
well.

[ChangeLog][QtGui][OpenGL] QOpenGLShaderProgram offers a built-in
program binary disk cache for systems with OpenGL ES 3.x or
GL_ARB_get_program_binary. This can lead to significant increases in
performance when it comes to application startup times for
example. Usage is opt-in for direct C++ users of the class, however
Qt's own main users of shaders, including Qt Quick and QPainter's
OpenGL engine, are migrated to use the new, cache-enabled APIs.
Opting out on application level is always possible via
Qt::AA_DisableShaderDiskCache.

Task-number: QTBUG-55496
Change-Id: I556f053d258bfa6887b1d5238c9f6396914c5421
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2016-11-24 10:27:16 +00:00
Liang Qi
4783de0473 Merge remote-tracking branch 'origin/5.7' into 5.8
Conflicts:
	src/network/socket/qnativesocketengine_winrt.cpp
	tools/configure/configureapp.cpp
	tools/configure/environment.cpp

Change-Id: Ieae6f2ee004a87f041751852b687484f91ee4480
2016-11-24 10:31:21 +01:00
Lars Knoll
72ed34b792 Don't set platform specific QT_NO_FOO defines in qglobal.h
They should be enabled/disabled through the configuration system.
Remove some unused defines, and move one define from qglobal.h to
a proper feature definition in Qt Gui.

Change-Id: Ie8d5bff9712ba745af60b42ceca3f0440bed2706
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-11-24 08:37:38 +00:00
Ulf Hermann
710414d4a2 Make sure we can compile QtCore without QT_CONFIG(translation)
Change-Id: I755834b77e50ff6f44bda561f007ec3306f3c1f9
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-11-24 07:42:48 +00:00
Simon Hausmann
dc4c647137 Clean up the resource reading code
Instead of doing the conversion from the big-endian data by hand, let's
use the convenience functions from qendian.h.

Change-Id: If3966ca94428afabb1f5c922967fb9970f976622
Reviewed-by: hjk <hjk@qt.io>
2016-11-23 20:50:37 +00:00
Edward Welbourne
7c41ced98c QDateTimeParser: introduce at least some encapsulation
Shuffled its parts to make clear which bits are public, private and
protected.  QDateTimeEditPrivate makes rather heavy use of the last.

Change-Id: Ic5f9d0c5cc85f02e57d3f31e9ac31a17428c5311
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2016-11-23 15:02:50 +00:00
Edward Welbourne
0aa3de46ca Fix two leaky uses of realloc()
If it fails, we get NULL back but haven't free()d the old pointer;
saving the NULL return over the old pointer forgets it, leaking the
memory it pointed to.  This is particularly severe in the JSON
parser's grow(), where reading a very large JSON document can lead to
the last successful realloc() in a doubling pattern being very large
indeed; the subsequent failure will leak this very last allocation.

Only worth checking for, however, when the subsequent code takes care
to handle failure: in most cases, if realloc() fails, we're about to
crash anyway.

Change-Id: Icd3a503f169be224f0a058c58e8b7c82a3241ae7
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Anton Kudryavtsev <antkudr@mail.ru>
2016-11-23 15:02:15 +00:00
Edward Welbourne
a4bd635b33 Typo fix in QDateTime::toString() documentation
Text that should simply have been naming days of the week used
Qt::Sunday rather than the simple day name.

Change-Id: I64a3cdacd854c1c9c0fbf2d11826555086d674f4
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-11-23 15:01:39 +00:00
Kai Koehne
60054b5940 QSettings: Replace deprecated Win32 SHGetSpecialFolderPath
SHGetSpecialFolderPath is declared 'unsupported' by Microsoft, and has
problems with non-ASCII characters. Replace it by the newer
SHGetKnownFolderPath.

Task-number: QTBUG-50570
Change-Id: I8b2dfa10fa5dc30e6c3be094a2ba8d7c3504f2ca
GPush-Base: 4d181bd93234a3747b520d10417825a0147bfeb1
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
2016-11-23 13:48:46 +00:00
Lars Knoll
5d9413ab35 Remove Mac specific code paths from qiconvcodec
The code is dead, as the codec is never used on macOS.

Change-Id: I86138f1c95e5564256b4d592f0044e83658def93
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
2016-11-23 10:31:03 +00:00
Lars Knoll
fd9e5d9033 Clean up iconv configuration
Turn iconv off if ICU is being used (in line with codecs.pri)
and get rid of the DEFINES += GNU_LIBICONV in the pri file.

Change-Id: I6fbca975498adbb3e67f913ae9b1dd5cc53ee8da
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
2016-11-23 10:30:57 +00:00
Lars Knoll
7e9aca683a De-duplicate the systemsemaphore entry
Change-Id: Id015cfe60956d899bbb58597b88204738578b7fe
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
2016-11-23 10:30:45 +00:00
Kai Koehne
ae93a76c93 Document The Public Suffix List
Change-Id: I3c8b00e04ed30209b0de0927b473ba2b9a4f0c87
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
2016-11-23 09:35:35 +00:00
Edward Welbourne
a32424b46c AreArgumentsNarrowedBase: Correct logic for narrowing connect() casts
The prior test deemed there to be narrowing if source and destination
integral-or-enum types didn't have the same signedness; but all values
of an unsigned source type can be represented in a larger signed
destination type, so there is no narrowing in this case.
Updated QObject test-case to match.

Change-Id: I517a5997adcad70e185d7469a8d26788e463cb75
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2016-11-23 09:24:40 +00:00
Liang Qi
38c1057f69 Merge remote-tracking branch 'origin/5.6' into 5.7
This also reverts commit 0d2f0164f4.

Conflicts:
	header.BSD-NEW
	qmake/Makefile.win32
	src/openglextensions/qopenglextensions.cpp
	src/openglextensions/qopenglextensions.h
	src/winmain/qtmain_win.cpp
	src/winmain/qtmain_winrt.cpp
	tools/configure/configureapp.cpp
	util/glgen/qopenglextensions.cpp.header
	util/glgen/qopenglextensions.h.header

Change-Id: If26c6f4111b342378dd88bbdc657e322d2ab6ad8
2016-11-23 09:24:36 +01:00
Anton Kudryavtsev
be94fc445a QString: optimize remove(QChar, Qt::CaseSensitivity)
remove(int, int) with O(N) was used in a loop.
We had a quadratic complexity.

Use erase-remove idiom to fix it.

Change-Id: I643a2a75619ec5ea2bf99e48a25f64a7f69ba156
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2016-11-23 05:27:05 +00:00
Friedemann Kleint
b5222307af Fix some qdoc-warnings
qtbase/src/corelib/kernel/qdeadlinetimer.cpp:343: warning: Cannot find 'setPreciseRemainingTime(...)' in '\fn' void QDeadlineTimer::setPreciseRemainingTime(qint64 secs, unsigned nsecs, Qt::TimerType type)
qtbase/src/corelib/kernel/qdeadlinetimer.cpp:459: warning: Overrides a previous doc
qtbase/src/corelib/kernel/qelapsedtimer.cpp:86: warning: Unknown command '\ref'
qtbase/src/corelib/global/qglobal.cpp:1184: warning: Undocumented enum item 'MV_WATCHOS_2_2' in QSysInfo::MacVersion
qtbase/src/corelib/global/qglobal.cpp:1184: warning: Undocumented enum item 'MV_WATCHOS_3_0' in QSysInfo::MacVersion
qtbase/src/corelib/global/qglobal.cpp:1184: warning: Undocumented enum item 'MV_WATCHOS' in QSysInfo::MacVersion
qtbase/src/corelib/global/qglobal.cpp:1184: warning: Undocumented enum item 'MV_WATCHOS_2_1' in QSysInfo::MacVersion
qtbase/src/corelib/global/qglobal.cpp:1184: warning: Undocumented enum item 'MV_WATCHOS_2_0' in QSysInfo::MacVersion
qtbase/src/corelib/kernel/qdeadlinetimer.cpp:175: warning: Missing parameter name
qtbase/src/corelib/kernel/qdeadlinetimer.cpp:175: warning: No such parameter 'ForeverConstant' in QDeadlineTimer::QDeadlineTimer()
qtbase/src/corelib/kernel/qdeadlinetimer.h:156: warning: No documentation for 'QDeadlineTimer::remainingTimeAsDuration()'
qtbase/src/gui/painting/qcolor.cpp:796: warning: Undocumented parameter 'name' in QColor::QColor()
qtbase/src/gui/painting/qcolor.cpp:802: warning: Undocumented parameter 'name' in QColor::QColor()

Some errors in QDeadlineTimer remain due to qdoc not fully supporting templates.

Change-Id: Ie7afd91c48048748eeda23c32056583c31fd7490
Reviewed-by: Nico Vertriest <nico.vertriest@theqtcompany.com>
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
2016-11-23 05:24:02 +00:00
Timur Pocheptsov
e2b856d562 QDir::tempPath - use NSTemporaryDirectory on Darwin
Instead of hardcoded "/tmp".

Task-number: QTBUG-57165
Change-Id: I9d3ae157c22ce131281b8279149eea87a26244e8
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2016-11-22 19:10:05 +00:00
Marc Mutz
d6c8fab880 QMutex: make sure we try_lock_for no shorter than the duration passed
By templating on the <chrono> types and unconditionally using
duration_cast to coerce the duration into a milliseconds, we
allowed code such as

   mutex.try_lock_for(10us)

to compile, which is misleading, since it's actually a zero-
timeout try_lock().

Feedback from the std-discussions mailing list is that the
wait_for functions should wait for _at least_ the duration
given, because that is the natural direction of variance
(tasks becoming ready to run might not get a CPU immediately,
causing delays), while an interface that documents to wait
_no more_ than the given duration is promising something it
cannot fulfill.

Fix by converting the given duration to the smallest number
of milliseconds not less than the original duration. If that
is not representable in an int, use INT_MAX, emulating the
effect of a spurious wakeup, which are allowed to happen if
the function returns false in that case.

In the above example, the try_lock_for call is now equivalent
to

  mutex.tryLock(1);

The tryLock() docs state that the actual waiting time does
not exceed the given milliseconds, but fixing that is a
separate issue.

Change-Id: Id4cbbea0ecc6fd2f94bb5aef28a1658be3728e52
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-11-22 11:32:35 +00:00
Andy Shaw
3cd457bdad Handle RemovePath correctly when calling matches()
Change-Id: Ied324a537df127e676fad26b42e658a9d5aeec9b
Reviewed-by: David Faure <david.faure@kdab.com>
2016-11-22 07:05:30 +00:00
Oliver Wolff
9f17c24589 Enable constexpr support for Visual Studio 2017
Change-Id: I894789c41cc2c1a327c14d0526e658520d096085
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-11-22 06:07:25 +00:00
Oliver Wolff
38675e18fc Add support for Visual Studio 2017
Tested with RC

Task-number: QTBUG-57086
Change-Id: I21f56edca3852b52edd2c5fdcce76817141e8d4a
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2016-11-22 06:07:23 +00:00
Simon Hausmann
d207738245 Fix missing last modification time stamp in qrc content
The time stamp is added at the end of the node information and
consequently this also bumps the version.

Task-number: QTBUG-57182
Change-Id: Ia10e006f28c0b168b2bcd74ed8b7098f84d10af3
Reviewed-by: hjk <hjk@qt.io>
2016-11-22 04:57:02 +00:00
Marc Mutz
3691f7ca0c QFutureInterface: make accesses to 'state' thread-safe
Introduce helper functions switch_{on,off,from_to} to make
the code more readable, and prepare everything for later
optimizations reducing the sizes of critical sections (by
locking the mutex later, or even never).

This commit, however, is only concerned with shutting up
tsan.

In waitForResult(), simplified the code by removing an
unneeded if guard: the condition is checked in the while
loop immediately following in the then-block, and the
local variable declaration that precedes the loop is not
worth guarding.

Change-Id: I24bfd864ca96f862302536ad8662065e6f366fa8
Reviewed-by: David Faure <david.faure@kdab.com>
2016-11-20 15:48:05 +00:00
Martin Smith
693f913a99 doc: clangqdoc must see class QWinEventNotifier
clangqdoc must parse the declaration for QWinEventNotifier
for all platforms, not just for Q_OS_WIN, so Q_CLANG_QDOC
must be tested as well.

Plus the qdoc comment for an invisible static function is
converted to a non-qdoc comment in qvariant.cpp

Change-Id: Ic41731decca55b3be837f9c5f832310513773e60
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
2016-11-19 18:55:47 +00:00
Kai Koehne
4b1c343e5e Doc: Add missing reference to qInfo()
Change-Id: I7438aa8ff9fddf2e0155ffe0d442f96d4d9265d4
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
2016-11-18 16:19:49 +00:00
Edward Welbourne
982e17f52d QChar::Direction: more specific link to unicode standard
Giving the URL of unicode.org isn't much use; the standard is enormous
and the reader shall have trouble finding the specific table that
enumerates the direction types.  Found a more specific URL (that looks
like it should be stable) for this one link.

Change-Id: I8abcedf530baf692d7e0c7f146f3066df223951f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-11-18 15:40:42 +00:00
Marc Mutz
1a3a8cf87b QDeadlineTimer: mark more functions nothrow
Change-Id: I3be9c69b46901311e9150a7f718707d8ff523e9e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-11-18 07:43:42 +00:00
Edward Welbourne
658c8370e4 QDateTimeParser: localize variable to avoid shadowing
The outer scope it was in had a later clause with its own pos
variable.

Change-Id: I8d083d3d5935416ef82a78890ed145f02d6d6ded
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2016-11-17 14:22:44 +00:00
Liang Qi
e5ac4afbf9 Merge remote-tracking branch 'origin/5.8' into dev
Conflicts:
	mkspecs/features/mac/default_post.prf
	mkspecs/features/uikit/default_post.prf

Change-Id: I2a6f783451f2ac9eb4c1a050f605435d2dacf218
2016-11-17 14:43:26 +01:00
Alexander Volkov
48d7db6b31 QtCore: Add missing override
Change-Id: Ifdec31aabdd0371f36abbb382e49f52f5b58ee94
Reviewed-by: hjk <hjk@qt.io>
2016-11-16 22:57:22 +00:00
Liang Qi
b39adf8945 Merge "Merge remote-tracking branch 'origin/5.7' into 5.8" into refs/staging/5.8 2016-11-16 13:54:01 +00:00
Liang Qi
90c425642d Merge remote-tracking branch 'origin/5.7' into 5.8
Conflicts:
	mkspecs/common/linux-android.conf
	src/gui/opengl/qopengl.h
	src/network/socket/qnativesocketengine_winrt.cpp
	src/network/socket/qnativesocketengine_winrt_p.h
	src/plugins/platforms/cocoa/qcocoawindow.mm
	src/plugins/platforms/eglfs/api/qeglfsintegration.cpp
	src/plugins/platforms/linuxfb/qlinuxfbintegration.cpp
	sync.profile

Change-Id: If70aaf2c49df91157b864cf0d7d9513546c9bec4
2016-11-16 12:35:36 +01:00
Kai Koehne
a6fbfea24a Doc: Mention qtmain library in Qt Core overview
The documentation for the qtmain license is right now pretty hidden.
The library is added by qmake independent of the Qt module that are
linked to, but it seems safe to assume people at least link against
Qt Core.

Change-Id: Id474990edde45feab6727bada2bc6a28946216cd
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
2016-11-16 11:32:10 +00:00
Oswald Buddenhagen
4d90bd55a5 re-arrange QLibraryInfo::rawLocation() for comprehensibility
swap the branches for (not) reading from qt.conf, and use a state
variable instead of an 'else' for mutual exclusion. this is somewhat
more self-documenting, and allows for a saner handling of the mkspec
fallbacks (which really should have been in a separate [QMake] section
along with Host* and Sysroot, but changing that now is way too much
hassle downstream).

Change-Id: I80a73294022fd1e8d84fe501b737c4fc7758662f
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2016-11-15 22:44:36 +00:00
Oswald Buddenhagen
712a041eb8 qmake: don't look for qrc-based qt.conf
we know there is none.

Change-Id: I75bc39f8b900525e7db29664f7dd2117d2bd33d2
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2016-11-15 22:44:14 +00:00
Allan Sandfeld Jensen
e133f0cca4 Improve error offset in JSON parsing
Do not consume white-space after a token before the token has been
parsed, otherwise we end up with misleading offsets. This also fixes
a wrong error of illegal number in several cases.

Change-Id: I492ca4de0346a1d0ab73b1c23d7a72dba812664c
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
2016-11-15 14:19:23 +00:00
Liang Qi
9808b53fde Merge remote-tracking branch 'origin/5.6' into 5.7
Conflicts:
	configure
	src/plugins/platforms/eglfs/qeglfsintegration.cpp
	src/plugins/platforms/linuxfb/qlinuxfbintegration.cpp

Change-Id: Id2da7c775439adb62646d5b741ee7c638042b34b
2016-11-15 09:58:16 +01:00
Marc Mutz
80842959c4 Revert "Optimize QJsonObject::operator=="
This reverts commit 862fa24179,
which attempted to optimize QJsonObject::operator== under the
assumption that the entries it holds are lexicographically
sorted. They should be, because Object::indexOf() finds them
by binary search, but apparently both fromJson(), as well as
construction through op[] leave (some) entries unsorted.

This behavior should be fixed, because other code relies on
sorted entries, too, but until the problem is more fully under-
stood, revert the patch to unbreak equality comparisons.

Task-number: QTBUG-56843
Change-Id: I5b608c16d1bbcb4f01b75ce93bd58b49ff050be2
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2016-11-14 16:49:39 +00:00
Lars Knoll
0038b40053 Unbreak a couple of configurations
Fix compilation with topleveldomain, textodfwriter
and cssparser features disabled.

Change-Id: I3f061fb09eef36cd640256a46cf77dde85a54d3d
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2016-11-11 17:04:47 +00:00
Lars Knoll
bfaa8925d5 Improve the validation algorithm for binary JSON
Add better boundary checks and catch (hopefully all)
cases where invalid binary JSON could cause crashes.

Change-Id: I206510b7c5e3ba953802a5f46645878e65704ecc
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2016-11-11 12:34:27 +00:00
Erik Verbruggen
c877af847a Aarch64: Vectorize ucstrncmp of QChar arrays
Change-Id: I0b3f9d975bfdf6839b97f5753f299074dbf8face
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2016-11-11 11:55:56 +00:00
Olivier Goffart
bd75876e7e QObject: remove unused function qt_find_obj_child
qt_find_obj_child is a vestige from Qt3. It is not used nor
exported. It can safely be removed.

Change-Id: Ief6164c361a369559e067b99880c357e421e6342
Reviewed-by: Martin Smith <martin.smith@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-11-09 15:25:52 +00:00
Allan Sandfeld Jensen
9512d97c90 Remove a few unnecessary recalculations of hash
When we already have the hash-value we can give it to findNode to avoid
recalculating it, and if don't need it later, we don't need to request
it.

Removes around 1% of qHash calls when running QtCreator.

Change-Id: I0e5e61e26a407f4ac7e029a3ac13ddd553e4994b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-11-09 14:42:43 +00:00
Paul Olav Tvete
49680fe0bb Fix misspelled QT_NO_ features
Change-Id: I77ca4139cb8437b781f082195bf4c92034f55512
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2016-11-09 13:13:22 +00:00
Edward Welbourne
8ee65cd1f2 Correct a Q_CHECK_PTR()'s parameter
Someone cut-and-pasted but forgot one of the changes.

Change-Id: I647dc8117ebfe8ce3d4b26d468b80c15d4e533e8
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-11-09 09:41:15 +00:00
Kai Koehne
615270a300 Rename QtPrivate::is_[un]signed to QtPrivate::Is[Un]signedEnum
Any other use than for enums should use std::is_[un]signed. Make this
explicit by renaming the type traits.

Change-Id: I494158563c95c710e710d0d337f4e547006df171
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-11-09 09:13:29 +00:00
Kai Koehne
5c3b16706f Remove compiler-specific implementations of Q_IS_ENUM
Since the macro is now just a wrapper for std::is_enum,
its use is also deprecated.

[ChangeLog][QtCore][Global] Q_IS_ENUM is deprecated.
Use std::is_enum<>::value instead.

Change-Id: I09b9f4559c02c81f338cace927873318f2acafde
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-11-09 09:13:01 +00:00
Maurice Kalinowski
c83ba01f7b winrt: remove superfluous code
We do not need to check for an invalid timer id, as this can only happen
if the above check is already true. Hence, this was doing the same check
twice.

Task-number: QTBUG-56756
Change-Id: Icca9b26c32ce88eab76dd02c6c10b24af07bfad7
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2016-11-09 07:03:31 +00:00
Maurice Kalinowski
0383d0be33 winrt: Do not copy into a reference
The intention has probably been to reset a reference, which is not
required.

Task-number: QTBUG-56756
Change-Id: I1ef44b6c9b8365ac5c8d48234137e518558e9398
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2016-11-09 07:03:28 +00:00
Kai Koehne
ed7f77071d Replace custom type traits with std one's
Remove most type traits from qtypetraits.h, but keep the custom
implementation of is_signed/is_unsigned. This gets rid of
BSD-3 licensed code from Google in a public header (hugh!).

The custom implementations for is_signed/is_unsigned are kept
because the implementations in gcc's standard headers do not
work as we expect for enums - both is_signed and is_unsigned
always returns false there - see also
  https://gcc.gnu.org/bugzilla/show_bug.cgi?id=59027

[ChangeLog][QtCore][General] Qt now relies on type traits from
the C++ standard library.

Change-Id: I3f2188b46949f04ca4482a6ac9afd3482103f0e1
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-11-08 15:31:17 +00:00
Kai Koehne
b5fa247102 QStandardPaths: Do not check whether path exists (Windows)
It's arguably better to return a non-existing location than no location
at all. This makes it in line with the documentation for e.g.
QStandardPaths::writableLocation that says

  Note: The storage location returned can be a directory that does not
  exist; i.e., it may need to be created by the system or the user.

Finally, this was also the behavior of code that used
SHGetSpecialFolderPath before.

Change-Id: I5ee44747a38434535610e45a4d303b36ef79d42a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2016-11-08 15:30:42 +00:00
Kai Koehne
aa73a7026f QStandardPaths: Replace deprecated Win32 SHGetSpecialFolderPath
SHGetSpecialFolderPath is declared 'unsupported' by Microsoft, and has
problems with non-ASCII characters. Replace it by the newer
SHGetKnownFolderPath.

To fix compilation with MinGW, we have to link in libuuid also in
the bootstrapped tools. The alternative is redefining all GUID's
(like we did for FOLDERID_Downloads), which is arguably less elegant.

Task-number: QTBUG-50570
Change-Id: If99be559bc72de3734ae1fa4d50f960659739898
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2016-11-08 15:30:39 +00:00
Kai Koehne
aa7e764058 MinGW: Explicitly define NTDDI_VERSION
Define NTDDI_VERSION, just like _WIN32_WINNT, to be Windows Vista.
Usually NTDDI_VERSION is automatically set by MinGW headers to the value
that matches _WIN32_WINNT. However, for precompiled headers the inclusion
order is that _WIN32_WINNT is set _after_ the relevant MinGW header is
parsed, so this can fail.

The alternative would be to set _WIN32_WINNT via a compiler flag, e.g.
in the mkspecs.

Change-Id: Id59e7083f0d3e00491b54e87647c6c9fabb99795
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-11-08 15:30:33 +00:00
Liang Qi
ef5b4d2ada Merge "Merge remote-tracking branch 'origin/5.7' into 5.8" into refs/staging/5.8 2016-11-08 12:16:18 +00:00
Allan Sandfeld Jensen
baebb6aa26 QVariant to QJsonValue::Null conversion
Adds a few missing parts of the conversion from QVariant to QJsonValue
after the introduction of the nullptr QVariant. The conversion the other
way is already implemented.

Change-Id: I8b25dec4b476c4761c5098a60944ff11c36f8bec
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2016-11-08 09:50:32 +00:00
Liang Qi
9d50df5511 Merge remote-tracking branch 'origin/5.7' into 5.8
Conflicts:
	src/corelib/tools/qalgorithms.h

Change-Id: Ib8ce4d5d9ecd5b9c166d5b8b44e58f3e4e7283ff
2016-11-08 10:01:50 +01:00
Maurice Kalinowski
fe51dbac3d winrt: Fix potential memory corruption
The timerInfo list might get accessed concurrently and cause references
to become dangling. Hence, we need to protect usages with a mutex.
According to tests/benchmark there is no impact on performance.

Task-number: QTBUG-56756
Change-Id: I4bdffccff70d2dca99f4a39defad438afe571ada
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2016-11-08 07:32:43 +00:00
Anton Kudryavtsev
e88ccc0c42 Nitpick: fix style in QtCore code
Change-Id: I28ab07f950c0992a2f3e14d139363d6c1b8af673
Reviewed-by: André Hartmann <aha_1980@gmx.de>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-11-07 11:03:44 +00:00
Andrew Knight
b18a4de814 Register Qt::TextFlag with QT_Q_ENUM
By some unfortunate oversight, this enum was never registered.

Change-Id: I2227ccf294d2cf717187a3dcaaf4cbfacc4ac65d
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2016-11-05 10:15:03 +00:00
Tor Arne Vestbø
e79ceb9734 Merge remote-tracking branch 'gerrit/5.8' into dev
Change-Id: Ib31cae9b57f6fb078739c409162bf2987eb430ad
2016-11-05 01:53:17 +01:00
Thiago Macieira
ea9a8672a1 Fix build with ICC on macOS: <atomic> is properly supported
I'm guess I introduced the regression in the commit
18ed6f20ad, which I wasn't sure about.

Change-Id: Ic46ff326a6ba46bc877cfffd14839f84fdf796e7
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
2016-11-04 16:32:54 +00:00
Kai Koehne
dd876ccb66 Add missing QBIG5CODEC_LICENSE.txt file
Add file that was forgotten in eb96813976.

Change-Id: Ib288bfc1f1f9cb4857e42f2fa3fe750e23b56aea
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
2016-11-04 11:48:47 +00:00
Liang Qi
e918605f42 Merge remote-tracking branch 'origin/5.6' into 5.7
Conflicts:
	src/corelib/json/qjsonparser.cpp
	src/gui/opengl/qopengl.cpp

Change-Id: Ib4d3208398399691839e6c6eaeb9006f99e3a62b
2016-11-04 11:39:15 +01:00
Lars Knoll
15df60239d Fix OOM crashes for huge json documents
Check all places where we reallocate our internal data structure
and return a DocumentTooLarge parse error if we can't get enough
memory.

Change-Id: I006d0170d941837220c7dad0508571b68e2cbfd7
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Kati Kankaanpaa <kati.kankaanpaa@qt.io>
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2016-11-04 07:53:39 +00:00
Thiago Macieira
4b6784b49c Stop using readdir_r: glibc deprecated it and it's not a good idea
POSIX does not require that readdir() be reentrant even for operations
on different dirent objects, but all implementations (according to the
glibc documentation) already do that. Moreover, it's not a good idea to
use readdir_r since the buffer space is limited by the caller, so
certain file names may be too long (ENAMETOOLONG) -- we had a workaround
for QNX, but for no other OS. According to the glibc documentation, it
is expected that POSIX will mark readdir_r obsolete and instead require
some form of reentrancy for readdir.

This commit makes everyone use readdir instead. The macros in
qplatformdefs.h are left behind in case someone else is using them.

With glibc 2.24, we started getting:

 qplatformdefs.h:150:35: warning: ‘int readdir_r(DIR*, dirent*, dirent**)’ is deprecated [-Wdeprecated-declarations]
 qfilesystemiterator_unix.cpp:112:17: note: in expansion of macro ‘QT_READDIR_R’

Task-number: QTBUG-56088
Change-Id: I33dc971f005a4848bb8ffffd14749b4082f62e69
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: James McDonnell <jmcdonnell@blackberry.com>
2016-11-03 15:31:33 +00:00
Thiago Macieira
ca4d93d85e Stop unloading plugins in QPluginLoader and QFactoryLoader
QPluginLoader hasn't unloaded in its destructor since Qt 5.0, but we
missed the equivalent code in QFactoryLoader (which bypasses
QPluginLoader). Besides, QPluginLoader::unload() was still doing
unloading, which it won't anymore.

Not unloading plugins is Qt's policy, as decided during the 5.0
development process and reaffirmed now in 5.6. This is due to static
data in plugins leaking out and remaining in use past the unloading of
the plugin, causing crashes.

This does not affect QLibrary and QLibrary::unload(). Those are meant
for non-Qt loadable modules, so unloading them may be safe.

Task-number: QTBUG-49061
Discussed-on: http://lists.qt-project.org/pipermail/development/2015-November/023681.html
Change-Id: I461e9fc7199748faa187ffff1416070f138df8db
(cherry picked from commit 494376f980)
Discussed-again-on: http://lists.qt-project.org/pipermail/development/2016-October/027476.html
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2016-11-02 17:58:48 +00:00
Jesus Fernandez
dcedce51a6 Include intrin.h header when using MSVC
Fixes the build with MSVC15

Change-Id: I7f22938583775bb3f0767d50cf59a43cab95eede
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2016-11-02 09:49:54 +00:00
Liang Qi
d7e4980132 Merge remote-tracking branch 'origin/5.8' into dev
Blacklist tst_QMenuBar::taskQTBUG46812_doNotLeaveMenubarHighlighted() on macOS.

Conflicts:
	mkspecs/features/mac/default_post.prf
	mkspecs/features/mac/sdk.prf
	mkspecs/features/uikit/default_post.prf
	mkspecs/features/uikit/sdk.prf
	src/angle/src/libEGL/libEGL.pro
	src/platformsupport/fontdatabases/fontdatabases.pro
	src/platformsupport/platformsupport.pro
	src/plugins/platforms/cocoa/qnswindowdelegate.mm
	src/plugins/platforms/direct2d/qwindowsdirect2dintegration.cpp
	src/plugins/platforms/ios/ios.pro
	src/plugins/platforms/ios/kernel.pro
	tests/auto/widgets/widgets/qmenubar/BLACKLIST
	tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp

Task-number: QTBUG-56853
Change-Id: If58785210feee3550892fc7768cce90e75a2416c
2016-11-02 09:24:11 +01:00
Anton Kudryavtsev
c12f42e91b QString: optimize replace(QChar, QChar, Qt::CaseSensitivity)
Only detach() if the string does contain the character to be replaced.
Save memory allocations.

Change-Id: I69c070d3f0b99f505fb6c209f657cdce31a35461
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2016-11-01 18:36:53 +00:00
Liang Qi
a732576a66 Merge remote-tracking branch 'origin/5.7' into 5.8
Conflicts:
	config.tests/win/msvc_version.cpp
	configure.pri
	mkspecs/macx-ios-clang/features/default_post.prf
	mkspecs/macx-ios-clang/features/resolve_config.prf
	mkspecs/features/uikit/default_post.prf
	mkspecs/features/uikit/resolve_config.prf
	src/corelib/io/qsettings_mac.cpp
	src/corelib/json/qjsondocument.cpp
	src/plugins/platforms/cocoa/qcocoawindow.h
	src/plugins/platforms/cocoa/qcocoawindow.mm
	src/plugins/platforms/cocoa/qnswindowdelegate.h
	src/plugins/platforms/cocoa/qnswindowdelegate.mm
	src/plugins/platforms/ios/ios.pro
	src/plugins/platforms/ios/kernel.pro
	src/plugins/platforms/ios/qiosintegration.h
	src/plugins/platforms/minimalegl/qminimaleglintegration.cpp
	tests/auto/gui/painting/qpainter/tst_qpainter.cpp
	tools/configure/environment.cpp

Change-Id: I654845e54e40f5951fb78aab349ca667e9f27843
2016-11-01 06:02:55 +01:00
Martin Smith
1df45820d4 doc: Document two undocumented functions
This change provides missing documentation for two member
functions of QString.

QString QString::fromUtf16(const char16_t *str, int size)
QString QString::fromUcs4(const char32_t *str, int size)

Change-Id: I94a9437a457062e49e4457f5876e4d7c31fff24c
Reviewed-by: André Hartmann <aha_1980@gmx.de>
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
2016-10-31 14:03:58 +00:00
Kai Koehne
e5451f086b Document license for CLDR data in Qt Core
Change-Id: I21bf76a5603f3384fccad46a16b7304380a7a444
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2016-10-28 12:46:46 +00:00
Kai Koehne
e46cf80f8a Remove legalese text from QLocale
The mentioned functions are now documented in src/3rdparty/freebsd.
Anyhow, the license and copyright differs ...

Change-Id: Ib59ace624d1d8244f591668ed05993787ca65d24
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
2016-10-28 12:46:43 +00:00
Kai Koehne
eb96813976 Document use of BSD code in Qt Core
Change-Id: I31305e40dc57ddd37e5ef35a52cc99dc7ebb3bc5
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2016-10-28 12:46:39 +00:00
Jake Petroules
8a49b314e3 QOperatingSystemVersion: add Android Nougat MR1 (v7.1, API level 25)
Change-Id: I1c391fc06b6fc5bb97d402ab3c3bc40520d26269
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-10-28 03:30:24 +00:00
Jake Petroules
7883329a6d QOperatingSystemVersion: add separate variables per Android API level
It's nonsensical to have a variable like AndroidJellyBean which is
documented as Android versions 4.1 through 4.3 but is actually codified
as 4.1. Add separate variables for Android "maintenance releases" which
incremented both the version number and API level. "MRn" where n is an
integer is the same naming convention the Android APIs use.

The only exception to this rule is Android 4.4W (API level 20) which was
KitKat for watches. 4.4W is not a representible or comparable version
number, so for now, AndroidKitKat will identify both Android 4.4 and
4.4W (API levels 19 and 20). As Qt does not yet support Android Wear,
this is not expected to be a problem in practice.

Change-Id: I28473bad86bbe747db292bd0a9a164eeeba56a32
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-10-28 03:30:11 +00:00
Liang Qi
af0d0b9c06 Merge remote-tracking branch 'origin/5.6' into 5.7
Conflicts:
	src/plugins/platforms/ios/ios.pro
	src/plugins/platforms/ios/kernel.pro
	src/plugins/platforms/ios/optional/nsphotolibrarysupport/qiosfileengineassetslibrary.h
	src/plugins/platforms/ios/optional/nsphotolibrarysupport/qiosfileengineassetslibrary.mm
	src/plugins/platforms/ios/optional/nsphotolibrarysupport/qiosfileenginefactory.h
	src/plugins/platforms/ios/qiosintegration.h
	src/widgets/widgets/qcombobox.cpp
	tests/auto/widgets/dialogs/qwizard/tst_qwizard.cpp
	tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp

Change-Id: Ibaee7cbbba99e7c4b1d8926e55932ffa6030ce45
2016-10-27 10:23:39 +02:00
James McDonnell
145587a521 Recontribute QUrl::fromUserInput
Recontribute QUrl::fromUserInput under the corporate license agreement;
i.e. remove the separate BSD license from the code.

Change-Id: I1e0b4aab921fb20d2fd558fe732cea596ecbc9ca
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2016-10-27 06:22:41 +00:00
Lars Knoll
99331f661d Fix QStandardPaths::FontsLocation to be compliant with the latest XDG spec
According to the latest XDG spec, FontsLocation should point to
XDG_DATA_DIR/fonts, not ~/.fonts.

Task-number: QTBUG-55507
Change-Id: Ia62ffe172abbb93d5ce7fd58bdf038ff13954f1b
Reviewed-by: David Faure <david.faure@kdab.com>
2016-10-26 13:07:43 +00:00
Lars Knoll
04f0a69e96 Replace PKGCONFIG+=foo usages with QMAKE_USE
replace explicit pkg-config uses with the results of configure tests,
for consistency.

Change-Id: I3587db6085798ea7a49f8871fc6838eb687a6391
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
2016-10-26 13:07:34 +00:00
André Somers
60dbd80e5a Document that qFuzzyCompare does not work on NaN or infinity
On a discussion in the Development mailing list it became clear that
qFuzzyCompare does not work for NaN or infinity values. That was not
mentioned in the method documentation though. This patch fixes that
hiatus. It also clarifies how to deal with the comparing to 0.0
limitation.

Change-Id: I8b6d54cc0c1136e79b0d7be1a62bc9ed394d2575
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
Reviewed-by: Martin Smith <martin.smith@theqtcompany.com>
2016-10-26 08:39:46 +00:00
Kai Koehne
443c9c1db5 Remove QSegfaultHandler class
The origin of the class predate git history, but it has been apparently
unused in Qt since Qt 4.5 times. Removing this relieves us from
documenting its custom license.

Change-Id: Ie91be5f0b2fbaf10dc212c44ebd37e6b9d781592
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2016-10-26 03:16:53 +00:00
Jesus Fernandez
951b34453b Include intrin.h header when using MSVC
Allows the usage of _BitScanForward, _BitScanReverse, __popcnt and
__popcnt16 functions.
Fixes part of the build with MSVC15.

Change-Id: I5ec37184209196ad19beddb4d6a36f9a9fd3b315
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-10-26 03:16:45 +00:00
Thiago Macieira
0cffe2135e qversiontagging.h: Don't tag binaries in static mode
Though there should have been no ill-effects, they happen.

Task-number: QTBUG-52605
Change-Id: I9093948278414644a416fffd147444078edc3183
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-10-25 20:21:20 +00:00
Anton Kudryavtsev
aa60e2d777 QStringRef: add isRightToLeft()
isRightToLeft() was missing in the API.

Change-Id: I49bc30e4c50f5693eb613c200587acba85074f33
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2016-10-25 05:13:46 +00:00
Friedemann Kleint
0d9cd98c07 qsettings_win.cpp: Use qt_error_string()
Remove the errorCodeToString() which is duplicating
the functionality and does apparently not work.

Change-Id: Ib1ca2dfed630b10d01c0acf278c42eb851405b46
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2016-10-24 16:26:55 +00:00
Erik Verbruggen
f6eb570c7d Darwin: normalize all watched paths to composed from
This will be done by all POSIX APIs for strings coming in that way, but
because other code (like NSWhateverViews) will most likely return
decomposed form, we make sure that those are in composed form too.

Task-number: QTBUG-55896
Change-Id: I065e11cee6b59706d4346ed20d4b59b9b95163b8
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2016-10-24 15:10:42 +00:00
Anton Kudryavtsev
9c02bfdb73 QStringRef: add constBegin() and constEnd()
These methods were missing in the API. constBegin, constEnd
are the more Qt-ish names.

Also it makes porting client code from QString to QStringRef easier.

Change-Id: I3fce1d206073d26259fe0fa44d0f7ca718504ec3
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-10-24 09:07:37 +00:00
Kai Koehne
71d4aea646 Fix description of feature 'topleveldomain'
The property is 'purpose' now. Also elaborate a bit more on the feature.

Change-Id: I66aa4165044f132dff018cfd01d54b939bb64fac
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2016-10-24 07:32:51 +00:00
Erik Verbruggen
30b7278c5c Remove type punning from ucstrncmp
Type punning is UB.

Change-Id: I0022d2a38136d80f5ddda21cea7dc0968c736242
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-10-23 11:48:20 +00:00
Liang Qi
28628a5d5e Merge remote-tracking branch 'origin/5.6' into 5.7
Conflicts:
	src/plugins/platforms/eglfs/qeglfshooks.cpp

Change-Id: I483f0dbd876943b184803f0fe65a0c686ad75db2
2016-10-22 21:19:57 +02:00
Alex Trotsenko
9cac65bc66 QRingBuffer::reserve(): remove superfluous assert
'bytes' is checked against MaxByteArraySize in the beginning and
remains unchanged in the function.

Change-Id: Ibd4091b95837db16cf45f845d485bfb189317125
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-10-22 08:06:28 +00:00
Frederik Schwarzer
92df823ed6 QFileInfo: fix double sentence in apidoc
Change-Id: Ie1cf32565b2fcb828ec381c45595adad1392e2ec
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
2016-10-21 09:06:50 +00:00
Frederik Schwarzer
ef88bf02ef Fix some typos in docs and apidocs
While "commonest" is still correct English, it's rather old-fashioned
and "most common" predominates Qt's wording style.

Change-Id: I20d72c098ee40b2a89f91e42f7208fe5b87286a2
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
2016-10-21 09:06:13 +00:00
Erik Verbruggen
49d3bb0058 Normalize realpath(3) output to composed form
All strings coming out of POSIX API calls are converted to composed form
by QFile::decodeName. Do the same for realpath(3) output. This is
especially important for HFS+, which will store file names in decomposed
form, and APIs will therefore return strings in decomposed form.

Task-number: QTBUG-55896
Change-Id: I5e51f4e5712ff26bf9644cbcf9a9603995748892
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2016-10-21 07:49:00 +00:00
Kai Koehne
557abfc327 QUrl effective TLDs: update table
There are more than 1000 new entries since the table has been
generated the last time. The autotest needs to be tweaked
because the rules for the .mz domains have changed; use the
.ck domain instead.

Change-Id: Ife692afd46ac41a66604e966e5e8cb57c7aa649c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-10-21 06:29:53 +00:00
Tor Arne Vestbø
837781db52 Add Qt::ISODateWithMs date format, with support in QTime/Date/DateTime
The Qt::ISODate format strips milliseconds, so a new format is introduced
that keeps the milliseconds. A new format was chosen over fixing the
existing format due to the behavioral change of suddenly having ms
as part of Qt::ISODate.

Change-Id: If8b852daed068cce8eee9b61a7cd4576bc763443
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-10-20 15:15:40 +00:00
Marc Mutz
46078f3374 QOrderedMutexLocker: unlock in reverse order of locking
This is an improvement for the following reasons:

- Should mutex locking allocate any kind of resource,
  unlocking in reverse order will free those resources
  in inverse order, which helps typical allocators.
- If the lock pair is contended, by unlocking in the
  same order as locking, we were allowing the waiting
  thread to wake up to take the first lock just to
  find that the second lock is still held by someone
  else.

The order of unlocking has no influence on the correct-
ness of the algorithm.

Change-Id: Id16b0342aef325c14a7bd8836d3a75db68ef2588
Reviewed-by: David Faure <david.faure@kdab.com>
2016-10-19 13:25:01 +00:00
Friedemann Kleint
0c85e3cdb5 Add header guard and We-mean-it comment to qoperatingsystemversion_p.h
Amends change 26b2ad5a18

Change-Id: I64c3a2338b6fa821f6951edffe6ddc050b513743
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-10-19 10:55:42 +00:00
Andy Shaw
683c9bc4a8 Windows: Fix regression in QFSFileEnginePrivate::nativeWrite()
Change 0696566b1e caused the block
size to be incorrect for data > 32MB.
Since bytesToWrite changes within the do...while loop, then the block size
can potentially change too each time. So it needs to be recalculated each
time rather than just once.

Task-number: QTBUG-56616
Change-Id: I9880d0985f2d0242c30e67230be7271eb806db95
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2016-10-19 08:05:32 +00:00
Anton Kudryavtsev
a9835dfe55 QJsonDocument: fix repetition of 'document' in doc
Change-Id: I8909336274b2c72e526d63fe9e21368550de6678
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-10-19 07:34:56 +00:00
Anton Kudryavtsev
ef826d9268 Nitpick: fix style in QtCore code
Change-Id: I60b3539f6c8cc36e4ad6988799d3cf9c565bdb21
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-10-19 05:12:24 +00:00
Anton Kudryavtsev
a769b34754 QLocale: optimize string usage
Use QStringBuilder more.
Avoid quadratic behavior when prepending zeros
in a loop, prepend whole string intead.
Use const API more for CoW types.

Change-Id: If114107dc3d9876b9a7c77bc0071878cb6e00892
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-10-18 17:45:10 +00:00
Anton Kudryavtsev
f620ad1499 QJsonDocument: enable NRVO for gcc in toJson()
Change-Id: I1b639272d38f8463b17a85a406addb74bb572756
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-10-18 17:42:27 +00:00
Anton Kudryavtsev
3d76031217 QJsonDocument: don't re-call QVariant::type() in if-else chain
Replace if-else chain with switch statement.

Change-Id: Idd2d0198178685bdaf8f77fa6cae5025ea9de561
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-10-18 17:42:02 +00:00
Marc Mutz
e80faf3db6 QTimer: don't circumvent <chrono> safety net
By templating on the <chrono> types and unconditionally using
duration_cast to coerce the duration into a milliseconds, we
violate a principal design rule of <chrono>, namely that non-
narrowing conversions are implicit, but narrowing conversions
need duration_cast. By accepting any duration, we allow non-
sensical code such as

   QTimer::singleShot(10us, ...)

to compile, which is misleading, since it's actually a zero-
timeout timer.

Overloading a non-template with a template also has adverse
effects: it breaks qOverload().

Fix by replacing the function templates with functions that
just take std::chrono::milliseconds. This way, benign code
such as

    QTimer::singleShot(10s, ...)
    QTimer::singleShot(10min, ...)
    QTimer::singleShot(1h, ...)

work as expected, but attempts to use sub-millisecond
resolution fails to compile / needs an explicit user-
provided duration_cast.

To allow future extension to more precise timers, forcibly
inline the functions, so they don't partake in the ABI of the
class and we can later support sub-millisecond resolution by
simply taking micro- or nano- instead of milliseconds.

Change-Id: I12c9a98bdabefcd8ec18a9eb09f87ad908d889de
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-10-18 16:06:28 +00:00
Tor Arne Vestbø
4cb614c7ab Apple OS: Handle QSetting strings with embedded zero-bytes
Saving strings with embedded zero-bytes (\0) as CFStrings would
sometimes fail, and only write the part of the string leading
up to the first zero-byte, instead of all the way to the final
zero-terminator. This bug was revealed by the code-path that
falls back to storing e.g. QTime as strings, via the helper
method QSettingsPrivate::variantToString().

We now use the same approach as on platforms such as Windows
and WinRT, where the string produced by variantToString() is
checked for null-bytes, and if so, stored using a binary
representation instead of as a string. For our case that
means we fall back to CFData when detecting the null-byte.

To separate strings from regular byte arrays, new logic has
been added to variantToString() that wraps the null-byte
strings in @String(). That way we can implement a fast-path
when converting back from CFData, that doesn't go via the
slow and lossy conversion via UTF8, and the resulting QVariant
will be of type QVariant::ByteArray. The reason for using
UTF-8 as the binary representation of the string is that
in the case of storing a QByteArray("@foo") we need to
still be able to convert it back to the same byte array,
which doesn't work if the on-disk format is UTF-16.

Task-number: QTBUG-56124
Change-Id: Iab2f71cf96cf3225de48dc5e71870d74b6dde1e8
Cherry-picked: 764f5bf48c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-10-18 14:35:08 +00:00
Marc Mutz
ed5d04fcfc QOrderedMutexLocker: fix UB (pointer comparison with <) in static relock()
Comparing pointers that do not point into the same array using
operator< is UB. You need to use std::less<>.

The QOrderedMutexLocker ctor already used std::less to compare
pointers, but the static relock() function was not fixed.

Amends 5007352164.

Change-Id: I584d382391dd5a2af75020a4e77f3e42ee5d5708
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2016-10-18 13:46:11 +00:00
Frederik Schwarzer
cbb2ba23e2 Qt 5.7 requires C++11 so this hint is not needed anymore
Change-Id: I7e267c69ccf3835e4d69b4c612f1baaf40d8be39
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
Reviewed-by: Topi Reiniö <topi.reinio@theqtcompany.com>
2016-10-18 12:14:17 +00:00
Friedemann Kleint
45580aa925 QFileSystemWatcher/Win32: Listen for WM_DEVICECHANGE
Add a class QWindowsRemovableDriveListener to
QWindowsFileSystemWatcherEngine listening to the WM_DEVICECHANGE messages
sent to the top level windows to detect insertion and removal of USB drives.
In addition, hook into QWindowsFileSystemWatcherEngine::addPaths() when
watching on removable drives, registering a notification for a
volume-lock-for-removal message on the internal window handle obtained from
QEventDispatcherWin32. When a request to lock the volume for removal is
received, remove the paths from the watcher, enabling removal.

The class instance is set as a dynamic property on the QFileSystemWatcher where
it can be retrieved from clients. This is primarily intended for use by
QFileInfoGatherer/QFileSystemModel.

Task-number: QTBUG-14290
Task-number: QTBUG-18729
Task-number: QTBUG-55459
Change-Id: Ic95b9d9291b1ec6f426c0702bad896bb064b9346
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2016-10-18 07:52:22 +00:00
Oswald Buddenhagen
7c1d640c0c stop exporting the library versions
all users of this functionality have been removed, and not emitting the
version info saves quite some noise from the generated files.

the reason why the users have been removed is that it was unreliable in
the first place: if a dependency is found without pkg-config, no version
information would be available.

the extraction of the version via pkg-config itself is kept in place, as
configure tests could be potentially optimized by utilizing it.

this reverts much of commit 48b4e0bf6f.

Change-Id: I01917f3b2a56b747d7cc54955141d20d23d0990a
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2016-10-18 05:59:14 +00:00
Liang Qi
d90b155c60 Merge remote-tracking branch 'origin/5.6' into 5.7
Conflicts:
	mkspecs/macx-ios-clang/features/resolve_config.prf
	src/testlib/qtestcase.qdoc

Change-Id: Icefa63056ffb37106f35299a8f19165535571799
2016-10-17 11:02:54 +02:00
Jake Petroules
5d1e5003be Explicitly mark old macros as compatibility synonyms
Change-Id: Ia471fff171b3bc3de40e166e18f30e6782581611
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2016-10-16 00:11:24 +00:00
Oswald Buddenhagen
9a088e7869 use helper libs via QMAKE_USE
for that, qt_help_lib.prf gains the ability to write "external module
pri" files that contain suitable information for QMAKE_USE.

these files have a bunch of limitations:
- they are not installed, because a) they are not relocatable and b) the
  helper libs' headers are not installed, either
- it won't work with qmake -r, which is ok, as qt5 does not build with
  qmake -r anyway
- deps are not transitive, neither at build nor at use time

the freetype, harfbuzz-ng, pcre, and png helper libs have been adjusted
accordingly, and their uses replaced with QMAKE_USE instances. this also
allowed inlining the now trivial {harfbuzz,pcrc,png}_dependency.pri
files. freetype_dependency.pri remains due to its funkiness.

Change-Id: I16890eecb122e34ec49f3d3e68380d1ea71a198a
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
2016-10-15 18:45:10 +00:00
Erik Verbruggen
936e132122 Add optimize-for-size case to ucstrncmp
The SSE code had a case where tail-loop unrolling was disabled when
optimizing for size. What would be even shorter, is to just do a
straight-forward loop over the arrays and compare them. For anything
else, we can just go for speed.

Change-Id: Ifb31650e10e41409972a38014067dbd2927674c9
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-10-14 10:17:51 +00:00
J-P Nurmi
7740f5e98b QMimeXMLProvider: add missing out-of-line destructor
Fixes build with the latest GCC 7.

Change-Id: I4900a256ed1c6cb177d7f94d54e5b07c06ddad08
Task-number: QTBUG-56514
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2016-10-13 16:54:30 +00:00
Kai Koehne
d023b300b2 Document that am/pm in QDateTime::toString are locale-specific
Change-Id: I28382b25ac94cbfbad4acff1308ddd8baf5ca693
Task-number: QTBUG-55632
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2016-10-13 15:16:23 +00:00
Liang Qi
dfc177e3a9 Merge remote-tracking branch 'origin/5.8' into dev
Conflicts:
	qmake/library/qmakeevaluator.cpp
	(cherry picked from commit 1af6dc2c8fb4d91400fddc5050166f972ae57c9a in qttools)
	src/corelib/kernel/qcore_mac_objc.mm
	src/gui/painting/qcolor.h
	src/plugins/platforms/cocoa/qcocoawindow.mm

Change-Id: I5b3ec468a5a9a73911b528d3d24ff8e19f339f31
2016-10-13 09:49:38 +02:00
Lars Knoll
93b78e7c61 Fix build with various features disabled
Change-Id: I95cb3cf3434306344af3f4c7556f45dbfa0b08d6
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
2016-10-11 14:20:34 +00:00
Lars Knoll
369857d294 Add configure feature for QUrl::topLevelDomain
Change-Id: I237af8c60a9572c707e7004c9a284dd6cd3306ce
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
2016-10-11 14:20:27 +00:00
Lars Knoll
5574a814ff Add configure feature for QCommandLineParser
Change-Id: I78c1159d29e12ad03b9a3c076a40ee533958af8a
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
2016-10-11 14:20:24 +00:00
Lars Knoll
93178d26f8 Add configure feature for time zone support
Change-Id: I6ea02dab33e67e7f312a62d94d82eaf1fbe9d9bc
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
2016-10-11 14:20:19 +00:00
Liang Qi
e166d7d135 Merge "Merge remote-tracking branch 'origin/5.7' into 5.8" into refs/staging/5.8 2016-10-11 14:14:31 +00:00
Allan Sandfeld Jensen
a6dc284869 Avoid auto-vectorization of epilogues of manual vectorization
Defines a structure that tells the compiler in no uncertain terms the
maximum number of times a loop can be run.

The reduces the size of qdrawhelper_avx2.o from 22kbytes to 11kbytes.

Change-Id: Ie3d6281b04b4be3332497c15f3dfe9f185e20507
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-10-11 07:38:29 +00:00
Lars Knoll
dee8b4d6b1 Save 100k by not using bloated sha3 code
Probably makes sha3 calculations somewhat slower.

Change-Id: Ie082c163b91d4e2282ad68b810e56b2437a1eb8a
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
2016-10-11 06:05:13 +00:00
Lars Knoll
8d330f55ba Fix build with statemachine feature disabled
The sources of the state machine are excluded completely at the build
system level instead of littering them with #ifs.

All remaining usages of QT_NO_STATEMACHINE are converted to
QT_CONFIG(statemachine) or a QT_REQUIRE_CONFIG(statemachine).

Also make the qeventtransition feature dependent on statemachine.

Change-Id: Ib05c7ca263a02042523fff8f794fa87342df1069
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
2016-10-11 06:05:09 +00:00
Lars Knoll
267dd9133d Clean up building of bootstrap lib and tools
Add a qconfig-bootstrap.h, which contains all the defines required
to build the bootstrapped tools. This will be required anyway when
moving more code over to use QT_CONFIG(foo) instead of QT_NO_FOO.

Change-Id: I783d0aa0100b9190fe2d422bee4a95b05720aebe
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2016-10-11 06:04:54 +00:00
Liang Qi
905329200f Merge remote-tracking branch 'origin/5.7' into 5.8
Conflicts:
	src/gui/image/qpixmap.cpp
	src/widgets/kernel/qformlayout.cpp

Change-Id: I8a8391a202adf7f18464a22ddf0a6c4974eab692
2016-10-11 07:40:32 +02:00
Jørn Bersvendsen
91cde06296 Extracted cleanup from QCoreApplication::exec() into separate function
Not all Qt integration points can call QCoreApplication::exec(), in
particular, ActiveQt. When an ActiveQt server is loaded, it tries to
mimic the behavior of calling QCoreApplication::exec() by setting
QCoreApplicationPrivate::in_exec = true. However, when unloading the
DLL it is necessary to call the same clean-up (e.g. deferred delete)
that QCoreApplication::exec() does. Extracting the cleanup in a separate
function means implementation does not have to be duplicated.

Task-number: QTBUG-56172
Change-Id: I061f1c06f38881032ad7044416c12c91e536478a
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-10-10 17:44:56 +00:00
Marc Mutz
7eddca359d Q_FALLTHROUGH: use GCC extensions in non-C++17-code
GCC defines the [[gnu::fallthrough]] attribute for C++11 and C++14
code, as well as __attribute__((fallthrough)) for C++98 and C code.

Use them.

Change-Id: I66aa178c2a96e2ff9ac3f6f02821c978b4ec3696
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2016-10-10 17:17:54 +00:00
Liang Qi
3e71810cf3 Merge remote-tracking branch 'origin/5.6' into 5.7
Conflicts:
	src/network/access/qhttpnetworkconnection.cpp
	src/network/access/qhttpnetworkconnection_p.h

Change-Id: I11f8641ef482efa8cee1b79977d19cc3182814b4
2016-10-08 17:15:55 +02:00
Giuseppe D'Angelo
dca8678efa QSysInfo: shut down the deprecation warning
Since this is a GCC bug, just disable the deprecation there.

Task-number: QTBUG-56122
Change-Id: I32884a4c19eb79d9c68343f29cdb619eb0d1b217
Reviewed-by: Paolo Angelelli <paolo.angelelli@qt.io>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
2016-10-07 23:38:36 +00:00
Laszlo Agocs
dcbff0a9e1 Fix signed-unsigned mismatch with gcc 4.9.0
Android NDK r10d with gcc 4.9.0 fails with:

gglobal/qoperatingsystemversion.cpp: In static member function 'static QOperatingSystemVersion QOperatingSystemVersion::current()':
global/qoperatingsystemversion.cpp:150:25: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
     if (sdk >= 1 && sdk <= sizeof(versions) / sizeof(versions[0])) {

Switch to size_t and store the array index in order to simplify.

Code is new in dev, introduced in 26b2ad5a18

Change-Id: Ia19cfcb9789e225760f4d1a05c91463f4c7c2302
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2016-10-07 12:06:46 +00:00
Erik Verbruggen
eda095ebb4 Darwin: correct state restore when FSEventsStream starting fails
The previous state was not restored completely when adding/removing
paths resulted in a stream start failure.

It also removes an autoreleasepool in restartStream, because both
stopStream and startStream do already create an autoreleasepool of their
own. (So, this pool will always be empty.)

Change-Id: Idc674e9c040f346703ab3ec256957e787a0ade73
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2016-10-07 09:13:34 +00:00
Sune Vuorela
4268dde1f1 QTemporaryFile's setFileTemplate operates not only on XXXXXX in the end
Is even covered by unit tests.

Change-Id: I7b22da2a338868fdb99c6238925f944bfea88190
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-10-06 21:33:29 +00:00
Liang Qi
ef25620ac1 Merge remote-tracking branch 'origin/5.7' into 5.8
Conflicts:
	mkspecs/features/mac/default_pre.prf
	mkspecs/features/qpa/genericunixfontdatabase.prf
	mkspecs/features/uikit/default_post.prf
	mkspecs/features/uikit/resolve_config.prf
	mkspecs/macx-ios-clang/features/default_post.prf
	mkspecs/macx-ios-clang/features/resolve_config.prf
	src/corelib/io/qiodevice.cpp

Change-Id: I6f210f71f177a3c3278a4f380542195e14e4b491
2016-10-06 20:12:27 +02:00
Kai Koehne
8f4054a7e6 Doc: Document that by default, QTimer is not single-shot
Change-Id: I586997ddb5ed55d68f53ddfe9302b961296cc4eb
Reviewed-by: Topi Reiniö <topi.reinio@theqtcompany.com>
2016-10-06 13:51:48 +00:00
Tor Arne Vestbø
669add92d9 Replace QCFString::to(CF/NS/Q)String usage with QString methods
Slims down QCFString and leaves only one implementation of converting
back and forth between CF/NS strings and QStrings.

Change-Id: I068568ffa25e6f4f6d6c99dcf47078b7a8e70e10
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
2016-10-06 08:02:59 +00:00
Tor Arne Vestbø
fd7e00aff5 Don't truncate QDateTime milliseconds when storing QSettings on Apple platforms
The fix is trivial, but the patch adds a new QSettings tests that iterates most
of the QMetaTypes and verifies that storing and retrieving them again gives the
same value. This is a more complete test than the testVariantTypes tests, which
is limited to a subset of the QVariant types. The new tests borrows logic from
the QMetaType test machinery.

QSettings has been Q_ENUM'ified in the process, for improved debug output.

Note that on backends such as the INI backend, the metatype of the QVariant read
from the settings will be a string, so it won't match the input QVariant type,
but the result of converting that to the original value type should still work.

Task-number: QTBUG-56124
Change-Id: Ib03a26abf77c9fb449b94160d28bc4baeb095f25
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
2016-10-05 18:45:04 +00:00
Liang Qi
6feec9da93 Merge remote-tracking branch 'origin/5.6' into 5.7
Change-Id: I34b5e290233d0869fbafac094a939aec2bf83fd5
2016-10-05 19:33:26 +02:00
Frederik Schwarzer
c3605980d9 Fix some typos and minor sentence structure issues in docs
Change-Id: Ibede1aeb046e2df6723e3041152bfae22a9fde32
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-10-05 15:00:24 +00:00
Tor Arne Vestbø
764f5bf48c Apple OS: Handle QSetting strings with embedded zero-bytes
Saving strings with embedded zero-bytes (\0) as CFStrings would
sometimes fail, and only write the part of the string leading
up to the first zero-byte, instead of all the way to the final
zero-terminator. This bug was revealed by the code-path that
falls back to storing e.g. QTime as strings, via the helper
method QSettingsPrivate::variantToString().

We now use the same approach as on platforms such as Windows
and WinRT, where the string produced by variantToString() is
checked for null-bytes, and if so, stored using a binary
representation instead of as a string. For our case that
means we fall back to CFData when detecting the null-byte.

To separate strings from regular byte arrays, new logic has
been added to variantToString() that wraps the null-byte
strings in @String(). That way we can implement a fast-path
when converting back from CFData, that doesn't go via the
slow and lossy conversion via UTF8, and the resulting QVariant
will be of type QVariant::ByteArray. The reason for using
UTF-8 as the binary representation of the string is that
in the case of storing a QByteArray("@foo") we need to
still be able to convert it back to the same byte array,
which doesn't work if the on-disk format is UTF-16.

Task-number: QTBUG-56124
Change-Id: Iab2f71cf96cf3225de48dc5e71870d74b6dde1e8
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-10-05 11:57:41 +00:00
Maurice Kalinowski
d44925507b winrt: Fix compilation for projects using C++/CX extensions
In case a project uses C++/CX extensions via /ZW compile flag including
qfunctions_winrt.h resulted in a compile error about duplicate
definition of Started due to namespace usages.

Change-Id: I8913522eafbabae77dd7d17187f202e555b0275f
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2016-10-05 06:33:33 +00:00
Tor Arne Vestbø
f2b90b4e82 Apple OS: Resolve QStandardPaths test data locations based on real locations
Instead of the manual logic for computing test data locations, we use the
locations from baseWritableLocation, but make sure to put them all under
'.qttest' in the home directory. This approach handles more cases for test
data, and also plays nice with locations that are not in the home directory
due to being containerized (and hence do not need a separate test data scope).

Change-Id: Iea4f21acb75c0191be35a3619c05143e8929bd6e
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
2016-10-04 21:22:05 +00:00
Peter Varga
37ad51a44e Revert "Doc: Added enums in qnamespace.qdoc"
Remove duplicated enum values from doc.

This reverts commit dfb55da5d6.

Change-Id: I27c85f66123731e0106bd702e843a24d7e9b5931
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Reviewed-by: Topi Reiniö <topi.reinio@theqtcompany.com>
2016-10-04 17:58:57 +00:00
Allan Sandfeld Jensen
f3d19244cd Fix PrintScreen mapping on macOS and more
Fixes the mapping of the rare multimedia Print key, adds the real
mapping of the Print Screen key.

Also adds a mapping for few other short-cut keys that were added in 5.6

Change-Id: I931bf1eed062536e1be2aa6aa6f19d773bb5ec55
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@theqtcompany.com>
2016-10-04 12:53:08 +00:00
Giuseppe D'Angelo
e02adc3e68 QObject::dumpObject*: add const overloads
They don't modify "this", so they should be const. Mark
the existing non-const overloads for removal in Qt 6.

[ChangeLog][QtCore][QObject] QObject::dumpObjectInfo and
QObject::dumpObjectTree now have const overloads.

Change-Id: If9fb15692d2d1536930f86d043d688236d4b778a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-10-03 19:42:48 +00:00
Tor Arne Vestbø
be7f671ac9 Round to nearest millisecond in QDateTime::fromCFDate()
CFAbsoluteTime is measured in seconds, represented by a double,
so when converting milliseconds to CFAbsoluteTime we may get a
slight error due to missing precision in double to represent
the milliseconds exactly. By rounding to the closest millisecond
when converting back, we avoid truncating and being one ms off.

Change-Id: If1e99f97b000fb8cb893ddfc5d7ba81096c0ea88
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
2016-10-02 13:07:18 +00:00
Alex Trotsenko
4518345b80 QIODevice: add CHECK_MAXBYTEARRAYSIZE macro
It unifies handling of QByteArray's size limit in read(), readLine()
and will be used in a follow-up change which optimizes the performance
of QIODevice::peek() function.

Change-Id: Idb9fbbe14d9632ee267d2a0e47c8a88603c024a2
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-10-01 17:36:50 +00:00
Liang Qi
e66d181e65 Merge remote-tracking branch 'origin/5.8' into dev
Change-Id: I3b51bb706e401edfda09a433c67aa58e44f33e83
2016-09-29 12:58:41 +02:00
Liang Qi
75aea3ff5e Merge "Merge remote-tracking branch 'origin/5.7' into 5.8" into refs/staging/5.8 2016-09-29 07:42:39 +00:00
Aleix Pol
433e5ccf50 Reduce memory allocations when reading the QMimeType list
Use QTextStream::readLineInto instead of using N internal buffers
temporarily to read the mime types file into a QSet<QString>.

Change-Id: I05110a4d484cc9485ceb3bc2be2fc7c78f4b2434
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-09-29 02:59:05 +00:00
Liang Qi
cdb56c42fc Merge remote-tracking branch 'origin/5.7' into 5.8
Conflicts:
	mkspecs/features/uikit/xcodebuild.mk
	tests/auto/other/lancelot/tst_lancelot.cpp
	tests/auto/widgets/widgets/qmdisubwindow/tst_qmdisubwindow.cpp
	tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp

Change-Id: Ia0ae2de86094120281abd445138877c2cc3e882c
2016-09-29 00:38:01 +02:00
Palo Kisa
4758555f3e QSettings: Add proper support for XDG_CONFIG_DIRS
Update fallback mechanism for Q_XDG_PLATFORM based systems to follow the
Xdg specification.

[ChangeLog][QtCore][QSettings] Added proper support for system-wide
configuration file lookup based on Xdg spec (XDG_CONFIG_DIRS) on Unix
based systems

Task-number: QTBUG-34919
Change-Id: Ieddee1c0b3b1506bf19aa865bdab87fc81d58cfd
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-09-27 22:03:11 +00:00
Palo Kisa
ee35fbbf52 qsettings: Simplify confFiles logic
Use a QVector to hold the QConfFile(s) to allow more configuration
files than the statically defined number -> this will allow considering
multiple system-wide configuration files if needed.

To use a dynamic container we get rid of use QScopedSharedPointer, which
actually wasn't needed anyway, as the "deref" logic was/is done manually
in the QConfFileSettingsPrivate destructor.

Change-Id: Ie9341da2cbe2e2b1379f9e2538cb4c9ebbd6fc97
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-09-27 22:03:04 +00:00
Simon Hausmann
bdb81d0bd1 Avoid re-use of QFileSystemMetaData instance in dir entry listing
We've observed that on machines with SELinux installed but disabled, the
behavior of readdir() changes slightly. In the case of tst_qdir's
entryList QDir::Hidden test case, the listing of the directory contents
returns DT_UNKNOWN for the files and (broken) symlink(s) that are
present. When SELinux is enabled, we do see DT_REG and DT_LNK. Our
fallback to DT_UNKNOWN however resets merely the knownFlags, it does not
reset entryFlags, as all the other cases do.

The bug comes when QDirIteratorPrivate::advance() re-uses the
QFileSystemMetaData instance across iterations, and this way we get the
entryFlags values from a previous iteration (with != DT_UNKNOWN) into
the evaluation of an entry with DT_UNKNOWN.

The more conservative approach to fixing this is here by assuming that
QFileSystemMetaData is not designed for re-use and re-initialize it
explicitly in the iteration.

Change-Id: I875856f5ee63a7072d172033e90d02cf41bcab20
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
2016-09-27 15:45:04 +00:00
Nico Vertriest
3efb84ffdb Doc: several minor doc issues
- linking errors
- parameter definition

Change-Id: I879b38c159822900ab9851407f0e9067b318ca1f
Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io>
2016-09-27 08:30:30 +00:00
Liang Qi
06bd93c4ac Merge remote-tracking branch 'origin/5.8' into dev
Conflicts:
	src/plugins/platforms/ios/qiosmessagedialog.mm

Change-Id: Icfbf55c3215ec088e552d0b42a5c94d04b17c65f
2016-09-26 21:43:25 +02:00
Alex Trotsenko
bafad505a0 QDataStream: refactor (de)serialization of containers
- Introduce templates to (de)serialize the different types of
  containers;
- Unify the naming of parameters;
- Fix style issues.

Change-Id: Ie096b7c0846a280a32282c5427f4836e6a8eefed
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2016-09-26 16:00:35 +00:00
Sérgio Martins
4d676acdc5 Fix event names on comment about QChildEvent
Change-Id: If9901471e459acb374807649e0affb84d82f7b8b
Reviewed-by: David Faure <david.faure@kdab.com>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2016-09-25 18:53:51 +00:00
Liang Qi
680dd3313c Merge remote-tracking branch 'origin/5.6' into 5.7
Conflicts:
	src/corelib/global/qlogging.cpp

Change-Id: I9cc8f25ad897efab6a42cb5c5161b1c9402952f0
2016-09-23 22:28:33 +02:00
Jake Petroules
ed928cee12 Suppress deprecated warnings for some QSysInfo members
Otherwise, merely including qsysinfo.h can result in warnings even if
the deprecated symbols are not used by the client code (because they are
"used" within QSysInfo itself).

Task-number: QTBUG-56122
Change-Id: I040b416eeaed5069e0fd6cf5850d0790900a2842
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-09-22 21:55:16 +00:00
Liang Qi
50908f023d Merge remote-tracking branch 'origin/5.7' into 5.8
Conflicts:
	src/plugins/platforms/ios/qiosviewcontroller.mm

Change-Id: I2dda31867cbc79ea7fe965f52afb518aefa4ad20
2016-09-22 07:28:34 +02:00
Olivier Goffart
7c5cf8b2bd Fix bootstrap applications crashing when QT_MESSAGE_PATTERN contains %{backtrace}
tokens[i] was left uninitialized. This could cause a crash when moc produces a
qWarning.

Task-number: QTBUG-56045
Change-Id: I6fba933005edd29756f0d6b1cfe53243254ac7b2
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-09-21 13:22:54 +00:00
Liang Qi
7555a92581 Merge remote-tracking branch 'origin/5.7' into 5.8
5971b88e is not needed in new configure.

This merge also reverts "fix QMAKE_DEFAULT_*DIRS resolution with
apple SDK", 2c9d15d7, because it breaks iOS build with new
configure system.

Conflicts:
	mkspecs/features/default_pre.prf
	mkspecs/features/mac/toolchain.prf
	mkspecs/features/toolchain.prf
	src/dbus/qdbusconnection.cpp
	src/plugins/sqldrivers/mysql/qsql_mysql.cpp
	src/sql/drivers/mysql/qsql_mysql.cpp
	src/widgets/widgets/qmenubar.cpp
	src/widgets/widgets/qmenubar_p.h
	tools/configure/configureapp.cpp
	tools/configure/environment.cpp
	tools/configure/environment.h

Change-Id: I995533dd334211ebd25912db05b639d6f908aaec
2016-09-21 11:57:52 +02:00
Liang Qi
eaec2b664a Merge remote-tracking branch 'origin/5.8' into dev
Conflicts:
	src/gui/painting/qcoregraphics.mm
	src/network/access/qnetworkrequest.h
	src/plugins/platforms/cocoa/qcocoahelpers.mm

Change-Id: I81266414c06ea2edf63cbc7e93a86bd5d66a31a5
2016-09-21 09:11:02 +02:00
Liang Qi
d10e4c193b Merge remote-tracking branch 'origin/5.6' into 5.7
Change-Id: I9cfefaf22b010fca937be77979f5fb50574bb71e
2016-09-21 07:14:40 +02:00
Samuel Gaist
23e76a12b9 Doc: add macOS example of QAbstractNativeEventFilter implementation
This patch adds a sample native event filter that can be easily
integrated in a project.

Task-number: QTBUG-53209
Change-Id: Iedf6df33a3de5b01dc7871cca5e7897a5b485733
Reviewed-by: Topi Reiniö <topi.reinio@theqtcompany.com>
2016-09-20 21:23:32 +00:00
Nico Vertriest
b69ac5a0af Doc: corrected mistaken refernce to macro \macos
Change-Id: I734943820400384a2f9ac7e148dc42d3428b0732
Reviewed-by: Topi Reiniö <topi.reinio@theqtcompany.com>
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
2016-09-20 19:46:17 +00:00
Jake Petroules
6616617a87 Replace usages of QSysInfo with QOperatingSystemVersion
Occurrences which should simply be removed entirely (due to always being
true or always being false as a result of the current OS support matrix)
have been left untouched for now.

Change-Id: I86d5a084cb84bc28fefc5191d40924de1439b3de
Reviewed-by: Liang Qi <liang.qi@qt.io>
2016-09-20 06:46:10 +00:00
Jake Petroules
8a48d66da9 Deprecate QSysInfo::MacVersion, QSysInfo::WindowsVersion, etc
QSysInfo::WinVersion, QSysInfo::WindowsVersion,
QSysInfo::windowsVersion(), QSysInfo::MacVersion,
QSysInfo::MacintoshVersion, and QSysInfo::macVersion() are now
deprecated.

QOperatingSystemVersion exists as a more flexible replacement.

Change-Id: Ib97d1bfb260f2595ba3c06ff8fd251c5de41cedc
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-09-20 06:46:14 +00:00
Frederik Schwarzer
e30d0e462f QAbstractProxyModel: fix sentence structure in apidoc
Change-Id: Ib3371549ecb80da326260b1df431f20e7a04f07e
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2016-09-19 11:17:58 +00:00
Jake Petroules
42ac179631 Remove special case for Android in QSysInfo::productVersion
Incidentally, this means that the function will no longer include the
patch version number on Android, but this is more consistent with other
platforms like Apple and Windows anyways.

Change-Id: I9996317e73e491b3a139a511efe1384c57b73e0a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-09-18 21:22:33 +00:00
Jake Petroules
55ac42dd13 Change QSysInfo::prettyProductName() to print the codename on Android
Change-Id: I967d57121c8e48c603842cd1024d9228cff19944
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-09-18 21:22:28 +00:00
Jake Petroules
26b2ad5a18 Long live QOperatingSystemVersion!
This class provides a "type safe" way to compare and access operating
system version numbers.

[ChangeLog][Deprecation Notice] QSysInfo::windowsVersion() and
QSysInfo::macVersion() are deprecated and are replaced by the newly
introduced QOperatingSystemVersion.

Change-Id: I52b532de2e068ccf90faaa8342eee90c0a4145de
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-09-18 21:22:22 +00:00
Allan Sandfeld Jensen
8b2f91e328 Add AVX2 versions of the fast blending functions
This patch adds AVX2 versions of the fast blending functions that we
already have SSE2 versions of.

Change-Id: Ifd1a22f7891b6208cb74929ad26095d12c5a1efb
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-09-18 19:36:30 +00:00
Marc Mutz
d58d7a5376 Add QStringList::join(QLatin1String) overload
Costs only ~300B in text size in QtCore, which is roughly compensated by
savings in other QtBase libraries, even without specifically porting
users to QL1S.

Of course, the raison d'être for this overload is avoiding the expensive
QLatin1String -> QString conversion which, for small lists, can take up
to 50% of the total runtime (assuming memory allocations dominate over
scanning and copying the list).

[ChangeLog][QtCore][QStringList] Added join(QLatin1String) overload.

Change-Id: I91d7e1d4e2c76d6dc79f2b750cf8e256dd4e0ab6
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-09-18 07:28:56 +00:00
Liang Qi
bd4d847903 Merge "Merge remote-tracking branch 'origin/5.6' into 5.7" into refs/staging/5.7 2016-09-17 03:11:41 +00:00
Thiago Macieira
18ed6f20ad Change some #elif to #endif / #if in qcompilerdetection.h
The conditions aren't exclusive, but complementary.

This change removes one check for defined(Q_CC_INTEL) because it was
disabled before and requires testing before we confirm it to be correct.

Change-Id: I33dc971f005a4848bb8ffffd14748cde4dd23333
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2016-09-16 21:25:47 +00:00
Liang Qi
d148019f16 Merge remote-tracking branch 'origin/5.6' into 5.7
Conflicts:
	src/plugins/platforms/qnx/qqnxscreeneventhandler.cpp

Change-Id: I0af32ee55936d523cbd259b6fe82eb9c409f9074
2016-09-16 23:16:25 +02:00
Thiago Macieira
597d625c2c Disable forcing of -fomit-frame-pointer with ICC
qlogging.cpp(1226): error #3175: unrecognized gcc optimization level
  __attribute__((optimize("omit-frame-pointer")))
                          ^

Change-Id: I33dc971f005a4848bb8ffffd14748b100dcefa95
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2016-09-16 20:50:05 +00:00
Thiago Macieira
a6bc0157eb Correct the C++ standard references in QMutex functions
Section 30.4.1.3 [thread.timedmutex.requirements] has 16 paragraphs and
2 subsections.

Change-Id: I9093948278414644a416fffd1473fec7fdd2716c
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2016-09-16 15:33:46 +00:00
Lars Knoll
8d6f2e7e15 Add a QT_REQUIRE_CONFIG(feature) macro
This macro expands into a static_assert and can be used to
trigger a compile error if a certain feature is not available
when trying to compile some code.

This is especially useful to protect against accidental inclusion
of headers that implement functionality related to a feature.

Change-Id: I456c55b989ce5f35f3af0e13c1886a85c23dfe29
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2016-09-16 12:27:59 +00:00
BogDan Vatra
31a63b6903 Say hello to Android 6+ permissions model
This API was introduced by Android v23 and is used in connection with
the new permission request system. From Android v23 onwards, some
permissions such as Location permissions cannot only be granted via
Android's Manifest files. An additional runtime check/request system
was introduced which forces applications to prompt the user
the first time a privileged function is called. Such user prompt
responses
are returned to the current application via the
Activity.onRequestPermissionsResult(..) callback.
This change add Qt API to nicely check & request permissions. For now
this is private
API which can be used to fix permission problems in other Qt
compontents. Later Qt versions will introduce a public API to
QtAndroidExtras.

[ChangeLog][QtCore][Android] Introduced a mechanism to forward
permission related callbacks on Activity objects to interested parties.

Task-number: QTBUG-55035
Task-number: QTBUG-50759
Change-Id: I64ee748d741b39e35c4713ed9fdd15dd1d96dc56
Reviewed-by: Christian Stromme <christian.stromme@qt.io>
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
2016-09-16 12:13:29 +00:00
Edward Welbourne
a95d81e786 Q(Date|Time)+::(to|from)String(): mention relevant QLocale methods
The const QString &format variants of these methods lack adequate
control over the locale used; the Qt::DateFormat variants give only
limited control over the format string.  So reference the QLocale
methods that provide the general case, in the docs of each.  Also made
the \sa cross-referencing among these methods a little more coherent.

Task-number: QTBUG-55632
Change-Id: Icd0c8548045e74879e941ba089c3bdea78f14e34
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-09-16 12:07:05 +00:00
Edward Welbourne
4ed59b90a1 Q(Date|Time)+::(to|from)String(): use C locale from Qt 6
We're using QLocale::system() by default for conversions between
date/time and strings; locale-dependency should be left to QLocale's
methods, so we should switch to using the C locale for the date/time
classes' methods, to make the results locale-independent.

Task-number: QTBUG-55632
Change-Id: I6ea6e8d2289e537f4d26eccf69a4f314c501f116
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-09-16 12:06:50 +00:00
Loïc Molinari
2ccf6c60d9 Fix the GCC version supporting -Wsuggest-override
Q_CC_GNU is (__GNUC__ * 100 + __GNUC_MINOR__), so 510 is 5.10 not
5.1.0. The first GCC 5 release has support for -Wsuggest-override, so
it should really be 501.

Change-Id: I7b264af087cd4562ce8720c99b70116d7654ea5f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-09-16 04:11:57 +00:00
Jake Petroules
eecc5fc52c Merge "Merge remote-tracking branch 'origin/5.8' into dev" into refs/staging/dev 2016-09-15 18:22:50 +00:00
Liang Qi
40a1f69e86 Merge remote-tracking branch 'origin/5.8' into dev
Conflicts:
	configure.json
	mkspecs/macx-tvos-clang/qmake.conf
	mkspecs/macx-watchos-clang/qmake.conf

Change-Id: Iaf32339ace59dff9ed344972472744c55d75025c
2016-09-15 19:47:57 +02:00
Thiago Macieira
c59c759fcc Suppress ICC warning #111 about unreachable code in toWCharArray
qstring.h(961): warning #111: statement is unreachable

Change-Id: I33dc971f005a4848bb8ffffd14748ae03dadefc9
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2016-09-15 16:54:56 +00:00
Ulf Hermann
6b3845320a QLocale: Add option to pad numbers with trailing zeroes
EcmaScript mandates that number-to-string functions pad the resulting
strings with zeroes, up to the requested precision. QLocale actually
supports this, under the disguise of the "Alternate" flag, used by
QString::asprintf().

We split this flag into the three options it actually represents and
make IncludeTrailingZeroesAfterDot available as a NumberOption. This
allows us to generate numbers in an EcmaScript compliant way.

In addition, a symmetrical option to reject trailing zeroes when
parsing strings to numbers is added.

[ChangeLog][QtCore][QLocale] Additional flags in QLocale::NumberOption
allow generating strings from doubles in accordance to EcmaScript's
Number.toPrecision(n).

Change-Id: If1090d5a0364a29811011a472afc8b75d0af0a8f
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-09-15 16:01:02 +00:00
Marc Mutz
a54d44298f QLatin1String: Fix UB (nullptr passed) in relational operators
Found by UBSan:

  qstring.h:1160:44: runtime error: null pointer passed as argument 1, which is declared to never be null
  qstring.h:1160:44: runtime error: null pointer passed as argument 2, which is declared to never be null

Fix by avoiding the memcmp() calls if there's a chance that they
might be called with nullptr.

While at it, also implement !=, >, <=, >= in terms of ==, <,
and add a test, because this particular UB was not fingered by
any of the QtCore test cases, but by a Qt3D one.

Change-Id: I413792dcc8431ef14f0c79f26e89a3e9fab69465
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2016-09-15 10:10:28 +00:00
Anton Kudryavtsev
6b2071c697 Use QStringBuilder more to optimize memory allocations
Change-Id: I2939ffa10496fdc59e0402a9cb54458565ccd657
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-09-15 09:08:45 +00:00
Lars Knoll
a668c6a6b6 Convert the old feature system
... to the new qmake based configuration system.

This removes the old qfeatures.txt (distributed over configure.json
files) and qfeatures.h (distributed over qconfig-<module>.h files).

qfeatures.prf is gone without replacement, as attempts to use it would
lead to followup errors anyway.

Change-Id: I1598de19db937082283a905b9592d3849d2199d0
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
2016-09-15 08:24:10 +00:00
Oswald Buddenhagen
b754b2815d rename description => label in configure.json
"description" suggests something slightly longer.

this may seem like a gratuitous change, but the upcoming replacement of
the old feature system clarifies makes it seem much less so.

Change-Id: Ibe702e01cb146b59127bf1f990b4acaef1c61d55
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2016-09-15 08:24:00 +00:00
Lars Knoll
2d3c73fcfe Modularize configure.json/.pri
Move the different parts of configure.json/.pri into the libraries where
they belong.

Gui is not yet fully modularized, and contains many things related to
the different QPA plugins.

Done-with: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Change-Id: I6659bb29354ed1f36b95b8c69e7fce58f642053f
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2016-09-15 08:23:53 +00:00
Maurice Kalinowski
13d20e4787 winrt: Report system languages for QLocale::uiLanguages
dc3e7e45eb introduced locales from a
packaging perspective, providing the information available from the
package manifest. However, developers are rather interested in the
available and preferred system languages to update user interfaces.

Task-number: QTBUG-55672
Change-Id: I740d4f9c9ca21a8cbd437d3b232470897c569d34
Reviewed-by: Jens Bache-Wiig <jensbw@gmail.com>
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2016-09-11 17:15:14 +00:00
Marc Mutz
6549bd383d Optimize Q_FOREACH for rvalues
Add an rvalue overload of the QForeachContainer ctor to allow moving
rvalues into the internal container copy.

This does not change the semantics of Q_FOREACH. It is just an
optimization.

Port to NSDMI to minimize code duplication.

Costs ~1.3KiB across all libraries and plugins in a QtBase Linux
build (optimized GCC 6.1 AMD64).

Change-Id: I180e35ecab68aa1d37773b3546787481bb5515a2
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2016-09-09 17:19:27 +00:00
Thiago Macieira
39a2eed039 QByteArray: Clean up qUncompress
qUncompress has code to deal with OOM situations without crashing. This
code is highly convoluted. It achieves that by realloc()ing QByteArray's
buffer. Instead, let's operate on QByteArray::Data and use RAII to
manage the lifetime of the buffer.

Change-Id: I1cc7601489634e96833cfffd145688433b76f447
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2016-09-07 14:35:58 +00:00
Thiago Macieira
42f974f56b Add QArrayData::reallocateUnaligned for QString and QByteArray
This function reallocates a QArrayData block with realloc() but, as
the name says, it's only valid for types that do not increase the
alignment requirements. I don't think it's worth doing this for types
that do increase the alignment requirements, since we don't know the
alignment of the pointer returned by realloc(). If the new pointer
modulo the alignment is different from the old pointer modulo the
alignment, we'd have to memmove data around, which would be quite
inefficient (realloc might have memcpy'ed already and this memmove
would copy data to nearby).

This function is intended to be used especially in QString and
QByteArray, which were already using realloc() on pointers created by
QArrayData::allocate.

Change-Id: I45b61247db2e84797ad794c1049c47a09c1fb29a
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2016-09-07 14:35:51 +00:00
Friedemann Kleint
60e8714e58 Bring back QSysInfo enumeration values for Windows CE
Partially revert 7fc2864dc5.

Entries should be kept until Qt 6 for source compatibility.

Task-number: QTBUG-55973
Change-Id: I09346fcd9227224f878f5ee064152e85f075ae09
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-09-16 04:30:47 +00:00
Thiago Macieira
ec770a8530 Nitpick: fix style in QtCore code added since 5.7
Change-Id: I9093948278414644a416fffd147400f99fc9f844
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Anton Kudryavtsev <a.kudryavtsev@netris.ru>
2016-09-15 19:38:20 +00:00
Anton Kudryavtsev
6aa935cd92 Use QString::fromLatin1() less to avoid string allocations
QString::fromLatin1 always allocates memory, but there are
cases where we can avoid/reduce allocations or/and reduce
text size, e.g.:

QStringBuilder expressions
Fix: replace QString::fromLatin1 with QL1S

QString::fromLatin1().arg(String) pattern
Fix: replace with QStringBuilder

Overloaded functions with QL1S arg
Fix: replace QString::fromLatin1 with QL1S

In rare cases if there is no overloaded function
with QL1S and we have deal with string literal,
replace QString::fromLatin1 with QStringLiteral.

Change-Id: Iabe1a3cc0830f40ef78a0548afa4368583c31def
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2016-09-15 15:55:57 +00:00
Giuseppe D'Angelo
8e5cd8017e QObject::dumpObject*: enable them also for non-debug builds
It makes very little sense that one needs to have a debug build
of Qt to debug QObject issues in application code. At this date
we don't even offer debug builds for Linux systems, and anyhow
one might want to debug an application running against a
release build of Qt.

[ChangeLog][QtCore][QObject] QObject::dumpObjectInfo and
QObject::dumpObjectTree are now fully functional even in a non-debug
build of Qt.

Change-Id: Ifddd3023ffc82f3dc3928a7a94d4970e2fb1b44a
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2016-09-06 16:35:24 +00:00
Alexander Volkov
160a4fe7ee doc: Fix the release in which QTemporaryDir::filePath() was added
Initially it was planned to introduce it in 5.8, but actually
it was introduced in 5.9.

Change-Id: I9101a78fa4c17572982571bac37a8fce00e86d01
Reviewed-by: David Faure <david.faure@kdab.com>
2016-09-06 11:44:27 +00:00
Liang Qi
d892e6f721 Merge remote-tracking branch 'origin/5.7' into 5.8
Conflicts:
	mkspecs/features/qt_common.prf
	src/plugins/platforms/windows/qwindowsdialoghelpers.cpp

Change-Id: I03b92b6b89ecc5a8db7c95f04ebb92ed198098a8
2016-09-05 18:47:27 +02:00
Alexander Volkov
6b7c1f5b82 Add a convenience function QTemporaryDir::filePath()
It allows to write more readable code:
    QString filePath = tmpDir.filePath(fileName);
instead of
    QString filePath = tmpDir.path() + QLatin1Char('/') + fileName;

Change-Id: I85aa54fd365e3bdd3ca41018ead7ed8741352b16
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: David Faure <david.faure@kdab.com>
2016-09-05 15:55:11 +00:00
Liang Qi
657c2bfbec Merge remote-tracking branch 'origin/5.6' into 5.7
Conflicts:
	tests/auto/testlib/selftests/generate_expected_output.py

Change-Id: If856162abf9a24ae2c9946d336a7d1da03520fa7
2016-09-05 13:57:12 +02:00
Thiago Macieira
cec8cdba4d QTextStream: log the defect that op<< uses Latin 1
The rest of Qt, including the QString constructor, uses UTF-8 to
interpret narrow character literals. The fact that QTextStream uses
Latin 1 should be considered a defect.

We can't fix this in Qt 5, so log it for consideration in Qt 6.

Change-Id: I9e96ecd4f6aa4ff0ae08fffd14710fa61673db57
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2016-09-04 09:21:30 +00:00
Thiago Macieira
590ca43603 QStorageInfo: Add support for obtaining subvolume names
[ChangeLog][QtCore][QStorageInfo] Added QStorageInfo::subvolume(), which
returns the name of the subvolume of a volume that was mounted, if one
was detected. This is currently implemented only for btrfs on Linux.

Change-Id: Ib57b52598e2f452985e9fffd1459f3145d733ce5
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-09-03 06:41:33 +00:00
Marc Mutz
2a6bea7a55 qcompilerdetection.h: retract Q_COMPILER_DEFAULT_MEMBERS for MSVC < 2015
Earlier versions of the compiler cannot default
move special member functions, even though we
also define Q_COMPILER_RVALUE_REFS for them.

Fix by retracting the less-often-used of the
two compiler feature defines.

Q_COMPILER_DEFAULT_MEMBERS is not used outside
QtBase in neither 5.6 nor 5.7 (5.8 is not
released at this time, so wasn't considered).
The same is true of the dependent macros
Q_COMPILER_DEFAULT_DELETE_MEMBERS and
Q_DECL_EQ_DEFAULT.

In QtBase, the three uses are:
1. in QAtomic*, where the user also requires
   Q_COMPILER_CONSTEXPR, which is not defined
   for any MSVC at this time,
2. for QEnableSharedFromThis, which is a class
   template with an alternative {} implementa-
   tion of the default constructor, and uncon-
   ditional user-defined copy special member
   functions.
3. The test of the corresponding functionality
   in tst_compiler, which this commit amends.

That means that neither of these two only uses
of the macro in Qt libraries are affected by
the change.

The reason we do this change, then, is that in
the future, we want to be able to more easily
restore move special member functions for
classes for which they are suppressed due to
user-defined dtors or copy special member
functions.

Change-Id: I6f88cad66d6b87a758231f16355c3bddae697b86
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-09-03 05:11:40 +00:00
Marc Mutz
312d08b290 qstrncpy: don't call strncpy_s with invalid parameters
According to https://msdn.microsoft.com/en-us/library/5dae5d43.aspx,
strncpy_s' second argument must not be 0:

> If strDest or strSource is NULL, *or numberOfElements is 0*, the
> invalid parameter handler is invoked.

Move the existing check for len > 0 up to protect the strncpy_s
call, too.

Change-Id: I70d339ea60d4b76f3038b2e4e4756f6590a9bd31
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-09-03 05:07:54 +00:00
Liang Qi
f510a51dac Merge remote-tracking branch 'origin/5.8' into dev
Change-Id: I843994939f126ced22f7fe978ec4403f599fc7c9
2016-08-31 08:24:21 +02:00
Thiago Macieira
84830fc07d QLockFile::tryLock: prevent over-sleeping in certain cases
The sleep time increases exponentially, but we never checked whether the
time to sleep was less than the remaining time. For example, if timeout
was 4000 ms on entry, we'd progressively sleep 100 ms, 200, 400, 800,
1600 ms. At this point, the accummulated sleep time would be 3100 ms and
the next sleep should be no more than 900 ms.

Prior to this change, the tryLock() would then proceed to sleep 3200 ms,
for a total wait time of 6300 ms, or 57.5% above the timeout provided by
the user.

Change-Id: Ifc295639c8cf4ddcaa69fffd146f7586a7ee95e4
Reviewed-by: David Faure <david.faure@kdab.com>
2016-08-30 21:52:04 +00:00
Thiago Macieira
eebdb16c63 QLockFile: Use QDeadlineTimer in tryLock
This simplifies the code a bit.

Change-Id: Ifc295639c8cf4ddcaa69fffd146f7535d646cb15
Reviewed-by: David Faure <david.faure@kdab.com>
2016-08-30 21:51:55 +00:00
Thiago Macieira
1a09c599b3 QDeadlineTimer: inline the isForever function
The constructor that sets it is inline already, so there's no point in
hiding this.

Change-Id: I66707fdfe8eb460a9c72fffd146d8dbc35b13056
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2016-08-30 18:41:29 +00:00
Gabriel de Dietrich
bc1b45ff9f QSettings: Remove calls to deprecated API on macOS
CFURLCreateDataAndPropertiesFromResource and
CFURLWriteDataAndPropertiestoResource have been
deprecated since 10.9. We replace them with simple
QFile access.

Code cleaning and included.

Change-Id: I19c7ceac41c8c511962f1128bd8e210e3adb434c
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@theqtcompany.com>
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
2016-08-30 01:52:53 +00:00
Liang Qi
1cc571593a Merge remote-tracking branch 'origin/5.7' into 5.8
cf53aa21bf and 3aaa5d6b32
were reverted because of reconstruction in 5.7.

defineTest(qtConfTest_checkCompiler) in configure.pri is smart
enough to cover the case in a9474d1260.

DirectWrite: Fix advances being scaled to 0

Since 131eee5cd, the stretch of a font can be 0, meaning
"whatever the font provides". In combination with ec7fee96,
this would cause advances in the DirectWrite engine to be scaled to
0, causing the QRawFont test to fail.

Conflicts:
	configure
	mkspecs/features/uikit/device_destinations.sh
	mkspecs/features/uikit/xcodebuild.mk
	src/corelib/global/qglobal.cpp
	src/corelib/global/qnamespace.qdoc
	src/plugins/platforms/cocoa/qcocoamenuitem.h
	src/plugins/platforms/windows/qwindowsservices.cpp
	src/plugins/platformthemes/gtk3/qgtk3dialoghelpers.cpp
	src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp
	src/widgets/kernel/qapplication.cpp
	tests/auto/widgets/dialogs/qfiledialog/tst_qfiledialog.cpp
	tests/auto/widgets/dialogs/qfiledialog2/tst_qfiledialog2.cpp

Change-Id: I4656d8133da7ee9fcc84ad3f1c7950f924432d1e
2016-08-29 15:30:17 +02:00
Oswald Buddenhagen
ccedc853a6 Bump version
Change-Id: I7badbdbb9ae68550914d3b3bffab99d72eb0b56a
2016-08-29 14:35:49 +02:00
Nico Vertriest
6cbd982836 Revert "Doc: removed reference to non-existing method"
This reverts commit 53f0b43a4b.
{QAbstractAnimation::}{updateCurrentValue()} had been modified to
{QVariantAnimation::}{updateCurrentValue()} in a previous patch.

Change-Id: Ibaccf51de816966f16b8f3109e0c20626d5102a8
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-08-26 11:40:11 +00:00
Marc Mutz
d875a04174 QtJson: simplify/add missing relational operators involving Latin1String
As noted by Mat Sutcliffe <oktal3700@gmail.com>, there were
no relational operators for Latin1String/QLatin1String and
String/QLatin1String mixed comparisons, leading to implicit
conversions from QL1S to QString in Entry::op==(QL1S).

This patch fixes half of the issue, by providing the operators
for Latin1String/QLatin1String. In doing so, it cleans up their
definition (non-members, non-friends, delegating to existing
QL1S operators where possible, passing both {Q,}Latin1String by
value, as they're both Trivially Copyable and small).

A follow-up patch will deal with String/QLatin1String
comparisons. It will be not quite as straight-forward as
this patch, since we don't, yet, have QStringView, the
UTF-16 equivalent of QL1S, available.

Amends a5159cc50a.

Change-Id: I596358eb3ccf847b7680f171f9992f3fad80132c
Reviewed-by: Mat Sutcliffe <oktal3700@gmail.com>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2016-08-26 08:25:31 +00:00
Nick Shaforostoff
8adad2fe09 fix build with various QT_NO_* defines
Done-with: Andriy Gerasika <andriy.gerasika@gmail.com>
Change-Id: I90883a491dbddb005c3d756c339e42285d50e437
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2016-08-26 07:39:53 +00:00
Liang Qi
13680ceb9a Merge "Merge remote-tracking branch 'origin/5.6' into 5.7" into refs/staging/5.7 2016-08-25 16:08:09 +00:00
Liang Qi
c7cdf3aac7 Merge remote-tracking branch 'origin/5.6' into 5.7
Conflicts:
	src/corelib/mimetypes/qmimeprovider.cpp
	src/corelib/mimetypes/qmimetype.cpp

Change-Id: Ib483ddb6bfc380e7c8f195feca535703814c3872
2016-08-25 16:12:11 +02:00
Ulf Hermann
de7f281d7a QLocale: Fix wrong assert
The endptr from reading the exponent of a 'g' form snprintf result
should not be past the end of the string we're reading from. It has
nothing to do with the 'e' sign.

Task-number: QTBUG-54482
Change-Id: I8bdee917b8d21fdc94c255548ad7e008431a07fa
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2016-08-25 12:45:50 +00:00
Marc Mutz
e83f6aaaa6 QMimeProvider: fix quadratic loop
Calling QMutableListIterator::remove() in a loop constitutes quadratic
behavior (O(N) function called O(N) times).

Fix by splitting the loop, simplifying it by sharing conditions, and
using std::remove_if(), which is linear.

Removes one more use of mutable Java iterators.

Change-Id: I88bde414777b50996e546bc8cb238619ea4fb645
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: David Faure <david.faure@kdab.com>
2016-08-25 04:14:24 +00:00
David Faure
3e453abc7d QMimeType: use default locale rather than system locale
This makes it possible for the application to control which language
is used by QMimeType::comment()

[ChangeLog][QtCore][QMimeType] QMimeType::comment() now uses the default locale
rather than system locale, so that applications can control which language
is being used.

Task-number: QTBUG-50776
Change-Id: I82623b7c488035a4164fadaf37ebcc79a9fd6173
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-08-24 20:30:13 +00:00
Raphael Kubo da Costa
680ec54a76 QMutex: Make freelist() return a real global static
Since Qt 5.6.0, some applications such as Kate (built with clang, libc++
and libcxxrt) on FreeBSD occasionally crash with the following error
message on exit:

    QMutex::lock(): sem_wait failure: Invalid argument
    [or pthread_cond_wait in the 5.6 branch]

Investigation by Gleb Popov, Thiago Macieira and Olivier Goffart has
shown that this is caused by the fact that QDBusConnectionManager is a
Q_GLOBAL_STATIC (so it will be destroyed with all the other
Q_GLOBAL_STATICs in the reverse order of construction). In the
Q_COMPILER_THREADSAFE_STATICS case, freelist() also returns a
function-level static that is constructed on first use, so it may be
destroyed earlier than the QDBusConnectionManager object, making it
impossible to lock a contended mutex.

We now make freelist() return a global static, so that it is always
destroyed after QDBusConnectionManager and other function-static
variables.

Change-Id: I210fa7c18dbdf2345863da49141b9a85cffdef52
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2016-08-23 15:37:00 +00:00
Christian Strømme
5e3f770ad5 Fix problem with exception reporting in QFuture::waitForResult()
This fixes a problem that occurs when a task, that is run synchronously,
throws an exception. If that happened, then the exception would not be
re-thrown, because of an early return.

Task-number: QTBUG-54831
Change-Id: Ic70c5b810ec6adce6e62bfd6832ba9f170b13a7f
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com>
2016-08-23 14:55:49 +00:00
Orgad Shaneh
449390c3a5 Revert "QLocale: Actually get the language script for the system locale"
The text direction should *not* be set by the default script, but by the
UI direction.

For example, if the default script is Hebrew, but the UI is in English,
it doesn't make sense to default all the controls to RTL. This should be
done only if the UI is RTL.

This reverts commit a90869861c.

Task-number: QTBUG-53110
Change-Id: I5a6951ac30f24eec86bc0ae2a9fcfe14eb3a8e28
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-08-23 14:52:31 +00:00