Commit Graph

7106 Commits

Author SHA1 Message Date
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
Venugopal Shivashankar
ca979a2f69 Doc: Remove references to Windows CE in Qt Core
The platform is not supported since Qt 5.7

Task-number: QTBUG-55331
Change-Id: I98b90d574d9a76c4281852d93818620b5f489117
Reviewed-by: Topi Reiniö <topi.reinio@theqtcompany.com>
2016-08-23 11:06:30 +00:00
Alexander Volkov
4f6f0cd4c9 Bypass a bug in gcc 4.7 for QAtomicTraits::isLockFree()
It's not possible to build Qt with gcc 4.7 since
aca0e367be because of the bug
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53473 that doesn't
allow to specialize static members declared both as constexpr
and noexcept. That commit was made after 5.7.0 and it introduced
QAtomicTraits::isLockFree() with these specifiers.

Remove the noexcept specifier to fix building.

Change-Id: Ifc2462c90de1180f1e015fdc0646f246d33e68b0
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-08-23 10:10:38 +00:00
Venugopal Shivashankar
c3bd28de8d Doc: Remove references to Windows CE in Qt SQL and Qt Namespace
The platform is not supported since Qt 5.7.

- Removed Windows CE-specific \notes in SQL drivers' documentation
- Marked a couple of Windows CE-specific enum values using
  \omitvalue

Task-number: QTBUG-55331
Change-Id: I35b44f9d31fde6f10013c043260db1b852c171e2
Reviewed-by: Topi Reiniö <topi.reinio@theqtcompany.com>
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
2016-08-23 08:28:23 +00:00
Nico Vertriest
53f0b43a4b Doc: removed reference to non-existing method
QAbstractAnimation::updateCurrentValue


Change-Id: I1610591ec43d019ca136df5a01350dc6ca7392ff
Reviewed-by: Martin Smith <martin.smith@theqtcompany.com>
2016-08-22 14:20:15 +00:00
Oswald Buddenhagen
d314819fc0 Merge dev into 5.8
Change-Id: I41ee7b50534b01cf042bed8bb8824ba2e5026a29
2016-08-22 11:30:01 +02:00
Marc Mutz
519b8d1a28 QtJson: mark String/Latin1String ctors explicit
An implicit conversion from const char* would be quite unfortunate.
Luckily, the code compiles as-is.

Change-Id: I445f983a27cc25bfaf4285c1a6c5811bd5d201b3
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-08-22 07:43:20 +00:00
Jake Petroules
57378a108c Add support for Apple watchOS
Change-Id: I3f9e00569458a463af2eaa5a3a16a6afd1e9c1ea
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com>
2016-08-19 21:05:55 +00:00
Allan Sandfeld Jensen
9f888d2fde Support C++17 fallthrough attribute
Replaces our mix of comments for annotating intended absence of break
in switches with the C++17 attribute [[fallthrough]], or its earlier
a clang extension counterpart.

Change-Id: I4b2d0b9b5e4425819c7f1bf01608093c536b6d14
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-08-19 18:38:53 +00:00
BogDan Vatra
691dc71a01 Say hello to Q_NAMESPACE
Q_NAMESPACE is useful to add Q_ENUM_NS/Q_ENUMS, Q_FLAG_NS/Q_FLAGS and
Q_CLASSINFO to a namespace.

[ChangeLog] Added Q_NAMESPACE which can be used to add Q_ENUM_NS/
Q_ENUMS, Q_FLAG_NS/Q_FLAGS and Q_CLASSINFO to a namespace

Task-number: QTBUG-54981
Change-Id: Ic61b972794063e77134681fb347d6c4acddcdb44
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2016-08-19 15:41:27 +00:00
Lars Knoll
e33a382c33 Add a qeventtransition feature
This replaces the QT_NO_STATEMACHINE_EVENTFILTER define, and
gives it a proper name.

Change-Id: I2b9386458224ff2bd30003daac548daa61961085
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
2016-08-19 04:28:26 +00:00
Lars Knoll
0a070d1e95 Don't use QT_NO_MIMETYPE in mimetypes.pri
Instead define a proper feature for it and use qtConfig().

Change-Id: I64b1d26b2419a24d3239e9935341b7d535990dfb
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
2016-08-19 04:28:21 +00:00
Lars Knoll
cf166e5839 iconv-related cleanup in codecs.pri
The configuration system already takes care of setting QT_NO_ICONV.

Also move the platform conditions for using iconv from the pri file
to the .json.

Change-Id: I91b08bcee6799deddabcbb4a91d0a3f9ed7f0f28
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
2016-08-19 04:28:15 +00:00
Lars Knoll
60985aa42b Use qtConfig throughout in qtbase
Use the new qtConfig macro in all pro/pri files.

This required adding some feature entries, and adding
{private,public}Feature to every referenced already existing entry.

Change-Id: I164214dad1154df6ad84e86d99ed14994ef97cf4
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
2016-08-19 04:28:05 +00:00
Lars Knoll
606924132f Add support for safe feature checking at compile time
Added a qtConfig(feature) function to qmake, and a QT_CONFIG(feature)
macro. These can safely check whether a certain compile time feature of
Qt is enabled or not.

For this to work the feature has to have a publicFeature or
privateFeature output in the configure.json file.

In pro files, please use the qtConfig(feature) test function
instead of checking contains(QT_CONFIG, feature), as the latter
will be unreliable with the upcoming modularization (it requires a
load(qt_module_config) before doing any such checks). Note that
feature names are now lowercase, and identical (except for hyphens
versus underscores currently) in the pro and c++ files.

This makes the logic easier to follow, as we avoid all double negations,
and most importantly, QT_CONFIG and qtConfig are implemented in a
way that you'll get a build error for a mistyped or non-existent
feature. This will also prevent accidental use of a widget feature
in gui in the future.

This gives us complete symmetry between the handling in pro and
c++ files.

Change-Id: I60404f97953724e639ffb6386cce2e8b1e4b735a
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
2016-08-19 04:27:17 +00:00
Lars Knoll
48b4e0bf6f Improve library version handling
Output the version as a define into the private config header as
a define using a hex number. Like that we can easily do version checks
on libraries using the QT_LIBRARY_VERSION(lib) and QT_VERSION_CHECK()
macros.

Change-Id: I6dc4ac6550886ca95c5542b6e75cd933ed079d76
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
2016-08-19 04:27:06 +00:00
Oswald Buddenhagen
de1da50557 make bootstrapped build work entirely without generated headers
instead, the only relevant defines from qconfig.h (QT_VERSION*) are
passed on the command line, like we already did for qmake and
configure.exe.
this enables us to remove the early forwarding header generation from
qtbase.pro, and rely wholly on the regular mechanism from syncqt +
qt_module_headers.prf.
another advantage is that we can be sure that the bootstrapped namespace
is not polluted by the target feature configuration.

Change-Id: If29285cfc697ae56b591e2ff1a2114686d18fb30
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2016-08-19 04:26:59 +00:00
Oswald Buddenhagen
4b288e30ef employ QMAKE_USE: LIBS += -lfoo
this switches all instances of LIBS[_PRIVATE] += -lfoo where a config
tests exists for foo.
this removes some code duplication between tests and project files (in
case of conditionals), and ensures that the projects always actually use
the libraries configure has found.

Change-Id: Ia7e80c8db5f329290c7f1a4e03a8bf78882a687e
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
2016-08-19 04:26:43 +00:00
Oswald Buddenhagen
d5dc46d319 employ QMAKE_USE: LIBS += $$QMAKE_LIBS_FOO
this migrates the cases where the build system already made (some) use
of variables (possibly) set by configure.

Change-Id: I43a08caed481d5f887a3a40821e71a4797760e7e
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2016-08-19 04:26:36 +00:00
Liang Qi
0ca4fcbc36 Merge remote-tracking branch 'origin/5.6' into 5.7
Conflicts:
	src/plugins/platforms/xcb/qxcbintegration.cpp

Change-Id: I2d71d06a55f730df19ace0dd3304238584a0497f
2016-08-18 11:07:51 +02:00
Anton Kudryavtsev
1075f6c764 Use QStringRef to optimize memory allocation
Replace substring functions that return QString
with corresponding functions that return QStringRef.

Change-Id: I3c485f89352a1ee66076fba74fd486da9349c354
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2016-08-18 07:29:37 +00:00
Dyami Caliri
ecb73a7bb3 QJsonValue: use Q_NULLPTR instead of 0 in ctor
Use Q_NULLPTR in all public headers

Task-number: QTBUG-45291
Change-Id: Ib294deb3c210a9a186448cbf9656af7a09fea2c1
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2016-08-17 19:54:40 +00:00
Friedemann Kleint
e4bb9395c2 Standardize some "We mean it" comments
Fix the occurrences where the wrong classes are mentioned.

Change-Id: Ia291af77f0f454a39cab93e7376a110c19a07771
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2016-08-17 19:51:40 +00:00
Anton Kudryavtsev
b0dba5b874 QMimeData: use QStringBuilder more
Change-Id: I5a6937545561c51add0d48a618b1921cf9201c4b
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2016-08-17 19:44:02 +00:00
Marc Mutz
253d2e5135 QLinkedList: restore move special member functions for iterators
They were masked by the pointless user-defined copy special member
functions, which we cannot remove because it would change the way
the iterators are passed by value into functions, on some platforms.

Add a reminder for Qt 6 to fix the issue for good.

Change-Id: I039093894db4a4e5e4bbf94fb346fd90311316c0
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-08-17 08:59:06 +00:00
Anton Kudryavtsev
8617ce5c88 Use QStringRef() more, exploiting its new ::chop()
Change-Id: Id2201639be604b9a32b2dc5d21e675a961bee477
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-08-16 20:08:31 +00:00
Friedemann Kleint
ff00b2efbd Add " We mean it" comment to qdeadlinetimer_p.h
Fix warning:
QtCore: WARNING: qtbase/src/corelib/kernel/qdeadlinetimer_p.h does not have the "We mean it." warning

Amends change 12eacc3bab

Change-Id: Ibb8fd25cee0249380996ae271200055e131d359b
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2016-08-16 15:46:20 +00:00
Friedemann Kleint
ff68be114e Fix documentation of the Windows parts of QSettings::setPath()
Explain in terms of CSIDL_ values and update the sample locations.

Task-number: QTBUG-55065
Change-Id: I15ddf32555d43cffae66d98c6ac12d62a98d5e6d
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
Reviewed-by: Topi Reiniö <topi.reinio@theqtcompany.com>
2016-08-16 13:51:16 +00:00
Marc Mutz
6d95497931 QLinkedList: compile with -Wzero-as-null-pointer-constant
The existing header check unfortunately doesn't detect uses of
'0' as nullptr in template code.

Task-number: QTBUG-45291
Change-Id: Ibe701402d95deca98c5286e2cee5f7118fd7f606
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2016-08-16 13:36:15 +00:00
Giuseppe D'Angelo
8dc45d5b7c Deprecate Q(Persistent)ModelIndex::child
Due to how invalid model indices are handled in Qt, child() is unsuitable
for general purpose usage. In particular you can never get a top level
item in the model because the root model index by definition hasn't got
a pointer to the model it belongs.

That makes child() useless for anything but tree models (and even there
you'd need to special case your code anyhow).

[ChangeLog][QtCore][QModelIndex] QModelIndex::child has
been deprecated due to its lack of generality.
Use model->index(row, column, index) instead.

[ChangeLog][QtCore][QPersistentModelIndex] QPersistentModelIndex::child has
been deprecated due to its lack of generality.
Use model->index(row, column, index) instead.

Change-Id: Ice73c17133aaf71355fa2af1eacfe64da01bd456
Reviewed-by: Thorbjørn Lund Martsum <tmartsum@gmail.com>
Reviewed-by: David Faure <david.faure@kdab.com>
2016-08-16 11:07:03 +00:00
Liang Qi
17198e03ab Merge remote-tracking branch 'origin/5.7' into dev
Conflicts:
	qmake/doc/src/qmake-manual.qdoc
	src/corelib/global/qglobal.cpp
	src/corelib/tools/qstring.cpp
	src/network/socket/qabstractsocket.cpp
	src/network/socket/qnativesocketengine_unix.cpp
	src/plugins/platforms/eglfs/api/qeglfsglobal.h

Change-Id: Id5dfdbd30fa996f9b4b66a0b030b7d3b8c0ef288
2016-08-16 07:58:32 +02:00
Marc Mutz
6e2af81daf QMetaType: clean up #ifdefs
We require Q_COMPILER_VARIADIC_TEMPLATES since Qt 5.7,
so remove the non-variadic version which anyway has
zero test coverage.

Change-Id: I24dd22a798e11d797238f9209312802d1d84a672
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2016-08-15 16:56:01 +00:00
Marc Mutz
7b5d14c699 QFactoryLoader: clean up #ifdefs
We require Q_COMPILER_RVALUE_REFS (implicitly used, but not explicitly
checked for) and Q_COMPILER_VARIADIC_TEMPLATES since Qt 5.7, so remove
the non-variadic version which anyway has zero test coverage.

Change-Id: Ie3658ff6ae71a66df9d35100c3d6df41f2326c80
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2016-08-15 16:55:58 +00:00
Marc Mutz
2889ebc903 QSharedPointer: clean up #ifdefs
We require Q_COMPILER_RVALUE_REFS and _VARIADIC_TEMPLATES since Qt 5.7,
so remove the non-variadic version which anyway has zero test coverage.

Also drop #include <utility>, as that is included from qglobal.h already,
and drop QSKIP from test.

Change-Id: I1fc7f7068eac80ad6fd85e1d8f6d33c5c7bb67db
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2016-08-15 16:55:45 +00:00
Thiago Macieira
12eacc3bab Long live QDeadlineTimer
It's like QElapsedTimer, but marks a time in the future instead.

[ChangeLog][QtCore] Added QDeadlineTimer, a counterpart to
QElapsedTimer, used to mark a time point in the future (a deadline) and
determine whether such a deadline has passed.

Change-Id: Ifea6e497f11a461db432ffff144921f7fbc1d1d3
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2016-08-15 03:07:16 +00:00
J-P Nurmi
906fc0f5e3 Add Q_DECLARE_OPERATORS_FOR_FLAGS(QStandardPaths::LocateOptions)
QStandardPaths::LocateOptions was declared with Q_DECLARE_FLAGS(),
but missing Q_DECLARE_OPERATORS_FOR_FLAGS().

Change-Id: Id4ab1b1c86cdc9e79fb324d9b9d4d8deb659f718
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2016-08-14 18:43:48 +00:00
J-P Nurmi
af87bf4b14 Register QStandardPaths enums & flags
This allows QML StandardPaths to use the same enums without having to
duplicate them.

Change-Id: Ibfc63a97a8ba31e5c4dc11e3e8fee9d753087c54
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2016-08-14 12:41:49 +00:00
Marc Mutz
9c016cefe9 QFuture(Interface): remove unneeded special member functions
The compiler-generated ones are just fine.

This is BC because the class is not exported and
QFutureInterfaceBase (needlessly) contains virtual
functions (the dtor), so this class will never be
trivially copyable. It's also not movable, until I
figure out how to add move special member functions
to QFutureInterfaceBase.

Also made the QFutureInterface(State) constructor
explicit, because a State is not a faithful
representation of a QFutureInterface.

Change-Id: Ifa44f87b41c4ee3c5167c282512ec4860075671d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-08-13 05:34:51 +00:00
Liang Qi
6b8f422c5e Merge remote-tracking branch 'origin/5.6' into 5.7
Conflicts:
	src/corelib/global/qglobal.cpp
	src/corelib/io/qsettings.cpp
	src/corelib/itemmodels/qstringlistmodel.cpp
	tests/auto/gui/image/qimagewriter/tst_qimagewriter.cpp

Change-Id: I1c6c306ef42c3c0234b19907914b19da706b4a03
2016-08-13 01:05:02 +02:00
Frederik Schwarzer
b6fb349ad5 Fix typo (word repetition) in documentation
Change-Id: I1c8785e39f28f94846126fc45b875e6425a4ce12
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2016-08-12 10:41:53 +00:00
Topi Reinio
a2ae631c04 Doc: Change instances of '(Mac) OS X' to 'macOS'
As of version 10.12 (Sierra), the name of Apple's desktop operating
system will be macOS. Change the occurrences where the Mac platform
is discussed to use a macro \macos, which expands to 'macOS'. This
helps with adapting to future renaming.

Update the instructions on mac-specific Q_OS_* macro usage.

Add a \target for the old 'Qt for OS X' topic to keep links working
for other documentation modules that try to link with the old name.

Change-Id: Id33fb0cd985df702a4ae4efb4c5fd428e77d9b85
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
2016-08-12 08:30:29 +00:00
Marc Mutz
b57f743c46 QStringListModel: fix dataChanged's roles parameter
In QStringListModel, the display and the edit roles are synonyms,
so when one is changed, the other changes with it. However, in
setData() we only emitted a vector with just the role that was
passed in by the user.

Fix by always passing both roles, regardless of which one was used
to set the data.

Change-Id: I498e7cb33796fae266901817b01ad85d861d4bb4
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2016-08-12 08:27:53 +00:00
David Faure
4e24ff2e68 QCommandLineParser: call qCoreApp post routines before ::exit()
This gives a chance for some cleanups at least.

Change-Id: I3a628e32c6fc8c7fa00943769210c517005f2a0a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-08-12 08:26:59 +00:00
Kai Koehne
7c5ccdd83b Add list of 3rd party code attributions to Qt Core, Qt GUI, Qt SQL
Also document the current license the modules are available from,
since this is not consistent anymore across Qt.

Task-number: QTBUG-55139
Change-Id: I117fdb0cda7bd7ff92aa825e29c28f22a8a2f96d
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Topi Reiniö <topi.reinio@theqtcompany.com>
2016-08-12 06:55:08 +00:00
Morten Johan Sørvig
b0abe20d4b Darwin: Add QImage::toCGImage() conversion function
(Move QT_FORWARD_DECLARE_CG to qglobal.h)

This function converts to CGImage for supported formats. This
is done by creating a CGImageRef that reuses the QImage data.

The CGImage and QImage ref counting systems are bridged, implemented
by using CGDataProvider that holds a copy of the QImage.

Unlike the previous internal implementation this public version
does not implicitly convert unsupported formats to ARGB32_Premultiplied.

See included documentation for the complete description.

Change-Id: Ie3984a7a8331e02a6f1c42943caaf76854e93538
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@qt.io>
2016-08-11 21:21:05 +00:00
Anton Kudryavtsev
5d1c35e21d QTranslator: use const to avoid detach()'ing
Change-Id: Idbab696affed9486e9077d72ba14ce409b98174c
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-08-11 18:20:25 +00:00
Edward Welbourne
6c473b7e08 QDateTimeParser::getAmPmText() use QLocale instead of tr()
I am not convinced toUpper/toLower is a generally sound solution here;
however, QLocale doesn't make the upper/lower case distinction this
parser does and a bug report shows tr() isn't doing an adequate job.

Task-number: QTBUG-47815
Change-Id: Iaf654d1d76d4c38d74fc647e168d50debb924a8f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-08-11 08:12:04 +00:00
Liang Qi
8ba384a564 Merge remote-tracking branch 'origin/5.6' into 5.7
Change-Id: I1a63523de158757964b6fb5ea026cf69a6c5ddcf
2016-08-10 17:43:13 +02:00
Thiago Macieira
c35fef9d3b Fix qnumeric_p.h with ICC's supplied math.h
ICC supplies a math.h header that defines things like:
 #define isnan( __x__ )      __IMFC99MACRO1ARG_ALL( __x__, isnan,      __, f, __,  , __, l)

So use the already-existing workaround for it.

Since Qt 5.7 requires C++11, we can remove the check for that.

Change-Id: I149e0540c00745fe8119fffd1463cc5caf341337
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2016-08-10 06:42:43 +00:00
Liang Qi
22e96c4d34 Merge remote-tracking branch 'origin/5.7' into dev
Change-Id: I36e6b890b65d12bf6931757540bcc9c553b5eb8f
2016-08-09 17:59:51 +02:00
Thiago Macieira
e24f89f266 Fix build with clang-cl and the Intel compiler on Windows
Neither clang-cl nor the Intel compiler are able to parse the MSVC code
in a constexpr environment. For Clang, we can just use the __builtin
functions, which it does make available on Windows. For the Intel
compiler, there's no alternative, so we just don't use the _BitScanXxx
functions. It will produce slower code, though.

qalgorithms.h(587,19) :  error: variables defined in a constexpr function must be initialized
qalgorithms.h(635,12) :  note: non-constexpr function '__popcnt' cannot be used in a constant expression

etc.

Change-Id: I149e0540c00745fe8119fffd14627ded43807000
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-08-09 02:41:19 +00:00
Giuseppe D'Angelo
874852d625 QMap: remove statement about STL support during Qt's own configuration
Since STL support is mandatory in Qt 5, the sentence is a tautology
and can be removed.

Change-Id: I8676368cc917aa00a85b1113ed2a47694427b2ce
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2016-08-07 07:43:29 +00:00
Marc Mutz
009f1f2812 QString: fix regression comparing null QString with null const char *
Commit 4a40c717f3 optimized
QString::compare_helper(QChar*, int, char*, int), but got
the case wrong where the rhs is null, but the lhs is empty,
not null (which is the case even with a null QString, as
QString().constData() != nullptr). The correct result in
this case is 0, since in Qt empty and null strings compare
equal.

Fix by checking the length of lhs, not its pointer.

Task-number: QTBUG-55154
Change-Id: I3ec2cd25d9bdca90cf3f5568a875b1e52c779979
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-08-05 18:52:16 +00:00
Christian Kandeler
4b63ab9a93 QJsonValue::toVariant(): Differentiate between null and invalid
Both were mapped to QVariant() before. Instead, use a null pointer
QVariant for a null JSON value.

[ChangeLog][QtCore][QJsonValue] QJsonValue(Null).toVariant() now returns
a QVariant of type QMetaType::Nullptr instead of an invalid QVariant.

Task-number: QTBUG-43077
Change-Id: Ife611f418583dbff542210bc8c5cd65201212a6e
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2016-08-05 14:53:33 +00:00
Simon Hausmann
131b7c8f64 Fix permissions on lock files on Unix
We should create the files with 0666 and let the umask take care of adjusting
to the final permissions in the file system.

[ChangeLog][QtCore][QLockFile] Fixed permissions on lock files on Unix to
allow for adjustments via umask.

Change-Id: Iee6a6ac3920d0ffd4465f54ac6e955f7fe087173
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: David Faure <david.faure@kdab.com>
2016-08-05 14:27:04 +00:00
Liang Qi
69ef0481fc Merge remote-tracking branch 'origin/5.6' into 5.7
Conflicts:
	tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp

Change-Id: I6f3878b204464313aa2f9d988d3b35121d4d9867
2016-08-05 08:58:48 +02:00
David Faure
91a2c8630b QUrl::resolved: keep treating file:name.txt as relative for now
8a33077 made QUrl::resolved() follow its documentation ("If relative
is not a relative URL, this function will return relative directly.",
where relative means scheme is empty).
However there is much code out there (e.g. qtdeclarative) which relies
on QUrl::fromLocalFile("fileName.txt") to be treated as relative, so
for now, we still allow this (in Qt 5.6.x). For Qt 5.8, this commit will
be reverted.

[ChangeLog][QtCore][QUrl] [EDITORIAL: replaces 8a33077] QUrl::resolved()
no longer treats a URL with a scheme as a relative URL if it matches
this URL's scheme. For now it still treats "file:name.txt" as relative
for compatibility, but be warned that in Qt 5.8 it will no longer
consider those to be relative. Both isRelative() and RFC 3986 say that
such URLs are not relative, so starting from Qt 5.8, resolved() will
return them as is.

Change-Id: Iff01e5b470319f6c46526086d765187e2259bdf5
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
2016-08-04 19:55:30 +00:00
Anton Kudryavtsev
9c8a8e90a6 QString: fix append(const QStringRef &str)
Use QStringRef::isNull instead of QStringRef::string()
for validation. Non-NULL str.string() may yet leave us
with a useless str.unicode(), which is the actual problem here;
whereas !str.isNull() does really confirm that str.unicode()
is sensible.

Such test prevents situation like:

const QString a;
QString b;
b.append(a); // b.isNull() == true
b.append(QStringRef(&a)); // b.isNull() == false

Auto test updated: create QStringRef from QString directly, without
any condition.

Change-Id: I082cd58ef656d8a53e3c1223aca01feea82fffb9
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2016-08-04 19:55:04 +00:00
Anton Kudryavtsev
955b2bdfc0 QString: de-duplicate code of variants of lastIndexOf()
Re-use methods of QStringRef.

Change-Id: I0f79ee6767653c694ac6a342263c046a5f5f3baa
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2016-08-04 15:46:12 +00:00
Marc Mutz
4a40c717f3 Optimize QString::compare_helper(QChar*, int, char*, int, cs)
... by using the recently-added QUtf8::convertToUnicode()
and a QVarLengthArray instead of QString::fromUtf8().

Like elsewhere in QString, use a QVarLengthArray<ushort>
instead of the more natural <QChar> to avoid instantiating
another QVLA.

Assume that length2 is usually set to a non-negative value.
Not because that's necessarily the frequent case, but
because a negative length2 leads to an expensive strlen,
that usually dwarfs the additional branch cost.

Check for data2 == nullptr early to avoid having to check
it later twice.

Change-Id: I04bda44ed857451efdf04c3283b5726480dd8c0d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-08-04 09:28:41 +00:00
Jędrzej Nowacki
31520c4fc0 Add missing include in qeventloop_p.h
The code depends on qApp to be visible in the scope

Change-Id: Ibeb54c90f5a65f441e9eb90b848952b955c71f0d
Reviewed-by: Jesus Fernandez <jesus.fernandez@theqtcompany.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-08-04 08:47:52 +00:00
Marc Mutz
ed38f516bf QStringListModel: begin/endResetModel() are no signals
... so don't use emit on them.

Just confuses readers.

Change-Id: I24365fc533b5b35f8942d6014dbc68387aa23e22
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2016-08-03 12:10:00 +00:00
Jędrzej Nowacki
d7132c6c6d Add std::nullptr_t as builtin type in QMetaType
Change-Id: If6c484bc89a2610c6a9e3e7bd54ef85ef40a783f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com>
2016-08-03 11:49:28 +00:00
Alex Blasche
958bc5793f Add QtAndroidPrivate::context()
This simplifies the retrieval of the correct Context object.

Task-number: QTBUG-55102
Change-Id: I303bc5393a7900ceb4bde36e711938f3f49075c1
Reviewed-by: BogDan Vatra <bogdan@kdab.com>
2016-08-03 11:49:27 +00:00
Clemens Sielaff
2a24c3c268 Fixed Bug in QVariant comparison when containing QStringLists
As it were, QStringLists were not handled explicitly when comparing
QVariants. If both QStringLists contained only a single entry, they
were treated as QStrings - if both QStringLists were empty, there were
equal (correctly so) - but if one of the QStringLists had more than
one entry, the compare function fell through to returning always 1.
As discussed here:  https://stackoverflow.com/a/38492467/3444217

Added rich comparison tests for all non-numerical, non-recursive
QVariants that support them (except QModelIndex and
QPersistentModelIndex)

Task-number: QTBUG-54893
Change-Id: Icc5480d9ba056ee5efe83da566c5829caa1509d7
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com>
2016-08-03 11:16:35 +00:00
Giuseppe D'Angelo
c0637c0298 QObject::connect: allow to disable narrowing of the connection arguments
One of the good features of the new connection style is that
implicit conversion is performed for the connection arguments.

However, this is also a bad feature when it comes to the old
C remnants in the C++ language: for instance, doubles implicitly
convert to ints, possibly losing precision (and GCC/Clang do not
even warn about those under -Wall, only MSVC does) or even
triggering undefined behavior.

For this reason, when using braced initialization, C++11
disables narrowing conversions or floating/integral conversions.
Use this feature when checking the arguments of a PMF-style
signal/slot connection. Technically this makes the program
ill-formed, however GCC still accepts it (but at least
warns under -Wall).

Hence, add a way to disable these implicit conversions.
This is a opt-in and guarded by a macro, as it's a source
incompatible change.

[ChangeLog][QtCore][QObject] The
QT_NO_NARROWING_CONVERSIONS_IN_CONNECT macro has been added.
When using the new connection syntax (PMF-based) this macro
makes it illegal to narrow the arguments carried by the signal,
and/or to perform floating point to integral implicit
conversions on them. When the macro is defined,
depending on your compiler a QObject::connect() statement
triggering such conversions will now fail to compile.

Change-Id: Ie17eb3e66ce0cd780138e60d8bb7da815a4ada83
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-08-02 23:03:15 +00:00
Edward Welbourne
879fd5bb5c QTzTimeZonePrivate: skip redundant check, tidy up
Various transition functions checked on m_tranTimes.size() > 0 inside
a block which was conditioned on this already; simplify the code by
knowing this is true already.  Tidied up an initializer at the same
time.

Change-Id: I3e933a69e1b71b94bfd4451e4d761844da669d33
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-08-02 08:57:21 +00:00
Edward Welbourne
f6fc34294f Merge remote-tracking branch 'origin/5.7' into dev
Conflicts:
	configure
5.7 now supports clang on android; but dev re-worked configure

	src/gui/kernel/qevent.h
One side renamed a parameter of a constructor; the other added an
alternate constructor on the next line.  Applied the rename to both
for consistency.

	tests/auto/tools/moc/tst_moc.cpp
Each side added a new test at the end.

	.qmake.conf
Ignored 5.7's change to MODULE_VERSION.

	configure.json
No conflict noticed by git; but changes in 5.7 were needed for the
re-worked configure to accommodate 5.7's stricter handling of C++11.

Change-Id: I9cda53836a32d7bf83828212c7ea00b1de3e09d2
2016-08-01 18:20:00 +02:00
Olivier Goffart
49c8923282 QSortFilterProxyModel: Don't forward the hint from source's layoutChanged signal
We can't forward a VerticalSortHint or HorizontalSortHint hint, because we might
be filtering extra items.

The documentation of QAbstractItemModel::LayoutChangeHint states:

    Note that VerticalSortHint and HorizontalSortHint carry the meaning that
    items are being moved within the same parent, not moved to a different
    parent in the model, and not filtered out or in.

And some of the views rely on this assumption (QQmlDelegateModel for example)

What happens in the test is the following:
- 'model' emit the dataChanged signal when its data is changed.
- 'proxi1' QSortFilterProxyModelPrivate::_q_sourceDataChanged does not forward
  the dataChanged signal imediatly, it will instead first re-sort the model and
  call layoutAboutToBeChanged / layouChanged with the VerticalSortHint
- 'proxy2' would forward the layoutAboutToBeChanged with the hint, but in
  QSortFilterProxyModelPrivate::_q_sourceLayoutChanged, it will redo the mapping
  which will cause the changed data to be filtered.
So proxy2 can't forward the VerticalSortHint as it removed rows in the process.

Change-Id: I20b6983e9d18bf7509fe6144c74f37d24e4a18c2
Reviewed-by: Tobias Koenig <tobias.koenig@kdab.com>
Reviewed-by: David Faure <david.faure@kdab.com>
2016-08-01 14:08:15 +00:00
Liang Qi
3cb7302480 Merge remote-tracking branch 'origin/5.6' into 5.7
Conflicts:
	src/widgets/itemviews/qabstractitemview.cpp
	src/widgets/itemviews/qabstractitemview_p.h

Change-Id: I54589b1365103cb1749186af92aab03a49c94b64
2016-08-01 10:03:21 +02:00
David Faure
f2995ee078 QWaitCondition: add notify_one/notify_all, i.e. STL naming
This makes the API more consistent with the STL, which helps discovering
the API. Much like QVector has push_back etc.

Change-Id: I75f6b77ab94233c15e17f66605f4bf13aa03e61c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-07-30 12:10:29 +00:00
Konstantin Shegunov
f0685992a3 Docs changed to reflect that valueName is required with value parsing
When the option expects a value the valueName parameter of the
constructor isn't optional; it must be set. This requirement is made
explicit in the documentation.

Task-number: QTBUG-54855
Change-Id: I190884aff2fa8e96bc5c5e82cdfed85be761d6e3
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: David Faure <david.faure@kdab.com>
2016-07-29 21:18:07 +00:00
David Faure
8a33077853 QUrl: fix resolved() for data URLs
They look relative because the path doesn't start with a '/' but they
have a scheme so they shouldn't be combined as if it was one absolute
and one relative URL.

[ChangeLog][QtCore][QUrl] QUrl::resolved() no longer treats a URL with
a scheme as a relative URL if it matches this URL's scheme. This special
casing was incompatible with RFC 3986 and broke resolving data: URLs,
for instance.

Change-Id: I3758d3a2141cea7c6d13514243eb8dee5d510dd0
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-07-29 17:51:51 +00:00
Denis Kormalev
f24cc53cc2 Fix for race condition in signal activation
There was a race condition between QObject::disconnect() and
QMetaObject::activate() which can occur if there are multiple
BlockingQueued connections to one signal from different threads and
they connect/disconnect their connections often.

What can happen in this case is:
T1 is in activate() method and T2 is in disconnect() method

T1                          T2
locks sender mutex
selects next connection
unlocks sender mutex
                            locks sender mutex
                            sets isSlotObject to false
creates QMetaCallEvent      derefs connection
posts event

Two things can happen here:
1. Connection can still be valid, but it will have isSlotObject==false
and callFunction will be used instead of slotObj
2. Connection can already be invalid

To fix it mutex unlock should be moved after QMetaCallEvent creation.

Also there is another case, when we don't disconnect but delete the
receiver object. In this case it can already be invalid during
postEvent, so we need to move mutex unlock after postEvent.

Change-Id: I8103798324140ee11de5b4e10906562ba878ff8b
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2016-07-29 06:09:22 +00:00
David Faure
4790ccfa7a Fix gcc -Wsuggest-override warning on Q_OBJECT
Same reasoning as commit 3092bd5 (which was for Clang), but for gcc >= 5.1.

Change-Id: I123b17670c1a64876b01fd39fb11648fa4e8b1fd
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2016-07-28 23:43:16 +00:00
David Faure
f5af4428c3 QVector: fix crash on reserve(0)
It crashed when d was equal to Data::unsharableEmpty().

Task-number: QTBUG-51758
Change-Id: If9f2a7d11892507135f4dc0aeef909f59b7478fc
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com>
2016-07-28 13:50:38 +00:00
David Faure
c9354429dd QSocketNotifier: improve warning to show thread names and pointers.
Much like the QObject::setParent() warning, which helps a bit when debugging.

Change-Id: I2abf277a12aa1ce04bd8b5759f46f8bfdcb25383
Reviewed-by: Robin Burchell <robin.burchell@viroteck.net>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2016-07-28 12:03:47 +00:00
Alex Trotsenko
75a9bd2a4f Introduce SCTP sockets support
Add protocol-specific code and the QSctpServer, QSctpSocket classes.

Change-Id: Ie9a1d87bd1fda866a2405043d1c15c12ded5a96e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-07-27 06:37:24 +00:00
Olivier Goffart
c5a4b093d0 Add QMetaEnum::isScoped to be able to destinguish C++11 enum class
Change-Id: I67b1dbd069fa57bd60e50690abb5d876edc0d1d2
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-07-26 22:49:31 +00:00
Mitch Curtis
d9831a03ca Fix grammar error in QFlags documentation
Change-Id: I1c5d2be402f7e194eaa2e6f646aa5edad1bfd9d9
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2016-07-26 11:50:47 +00:00
Edward Welbourne
6c5de416c9 Merge remote-tracking branch 'origin/5.6' into 5.7
Conflicts:
	src/corelib/io/qtemporarydir.cpp
One side encapsulated a repeated piece of #if-ery in a local define;
the other added to the #if-ery.  Made its addition to the other's.

	src/corelib/kernel/qeventdispatcher_unix_p.h
One side moved some members into a struct; this collided with a #undef
check that neither side now has.  Discarded the #undef part.

	src/gui/opengl/qopengltexturehelper_p.h
5.7 deleted a bunch of methods; not clear why merge got confused.

	src/tools/moc/moc.cpp
One added a name to the copyright header; another changed its URL.

Change-Id: I9e9032b819f030d67f1915445acf2793e98713fa
2016-07-26 10:43:29 +02:00
Giuseppe D'Angelo
25d6f312ac qFatal: unify the code path for aborting via std::abort
[ChangeLog][QtCore][Important behavior changes] qFatal will now
use std::abort to terminate the application on all operating
systems. Previously, ::abort() or ::exit(1) were called, depending
on the operating system.

Change-Id: I43da912cce1db3c2229568da25000ea80060eed9
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-07-25 22:18:49 +00:00
Giuseppe D'Angelo
a594f85d54 Q(Basic)Mutex: add try_lock{,_for,_until} for STL compatibility
Now QBasicMutex is Lockable and QMutex is TimedLockable, which means they can
be used in std::lock_guard, std::unique_lock, std::lock, etc.

[ChangeLog][QtCore][QMutex] QMutex now fully models the TimedLockable
concept by providing the try_lock, try_lock_for and try_lock_until
functions, therefore making it usable in Standard Library lock
management classes and functions.

Change-Id: I7c691481a5781a696701e1ab78186b5cefbd6a87
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2016-07-25 13:10:07 +00:00
Thiago Macieira
726c8ca0de Work around ICC bug about shadowing declarations that aren't shadowing
Known ICC bug, still present in version 17 beta.

qdatetime.h(126): error #3280: declaration hides member "QDate::jd" (declared at line 136)

Obviously a parameter to static function or to a function in a nested
class can't shadow an NSDM.

Intel issue IDs: 0000698329 / DPD200245740
Change-Id: I149e0540c00745fe8119fffd1463c679a3a9c8c3
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2016-07-24 05:27:53 +00:00
Alex Trotsenko
3c6a7a96ef QRingBuffer: add packet mode
As a special case, setting the value of chunk size to zero forces
QRingBuffer to produce a separate QByteArray on each call which
appends the data. So, this enables a packet mode where portions of
data are stored independently from each other.

Change-Id: I2d0b331211901a289da7d4533e974f06830b5590
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-07-23 09:05:13 +00:00
Alex Trotsenko
3605fc653b QRingBuffer: allow to change the chunk size of the buffer dynamically
Change-Id: I0ac55713c7bb8c48d2c9c774376543caef781980
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-07-23 09:05:04 +00:00
Oswald Buddenhagen
dd59118b87 move c++11 test into qcompilerdetection.h and make it stricter
it positively makes no sense to have a configure test which will be
never reached due to the configure/qmake bootstrap failing with a
slew of totally unhelpful error messages.

pre-standardization partial c++11 implementations are now rejected,
except for VS2013, which is still sufficient despite not announcing full
compatibility.

Change-Id: I58af10e03960af06b80cedac105cf8433f7a1745
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-07-22 10:21:36 +00:00
Edward Welbourne
601019e3f4 Merge "Merge remote-tracking branch 'origin/5.7' into dev" into refs/staging/dev 2016-07-22 10:15:48 +00:00
Thiago Macieira
b5153d5bfa Windows: Disable unsupported C++11 features with Clang-cl and ICC
Whenever someone installs Clang or the Intel compiler on Windows, it's
very likely that the compiler will be much newer than the MS headers
that came with the installed Visual Studio version. So let's make sure
we disable the C++11 features that the MS headers don't support
properly.

For example, MS's <limits> header supplied with VS 2013 doesn't mark the
max() function as constexpr, resulting compiler errors in uses of that
function in Qt code declared with Q_DECL_CONSTEXPR:

qdeadlinetimer.h(62,13) :  note: non-constexpr function 'max' cannot be used in a constant expression
        : s(std::numeric_limits<qint64>::max()), ns(0), type(type_) {}
            ^

Change-Id: I149e0540c00745fe8119fffd146286ffe480d216
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-07-22 01:01:48 +00:00
Friedemann Kleint
0696566b1e Windows: Fix truncation in QFSFileEnginePrivate::nativeWrite()
The number of bytes to write was converted to a 32bit unsigned value,
causing losses. Change the type to qint64 and adapt the code determining
the block size.

Task-number: QTBUG-54870
Change-Id: I294da5bfe97c7e60f67228399e1244a1aba4c89c
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
2016-07-21 08:50:01 +00:00
BogDan Vatra
e6034a4740 Make sure JNI_OnLoad is not called more than once
Since Android 5.0 Google introduce a nasty bug[1] which calls
JNI_OnLoad more than once.
Basically every time when a library is loaded JNI_OnLoad is
called if found, but it calls *again* JNI_OnLoad of its .so
dependencies! So, JNI_OnLoad of libQt5Core.so gets called may times,
this is not a problem as long as it's called from Qt's java delegate
class loader. The problem is that the application .so file *must* be
called from default class loader to allow the user to find his custom
Activity/Service stuff.


[1] Workaround https://code.google.com/p/android/issues/detail?id=215069

Change-Id: Ia71209658ef56056b560018597608acf7cb0f9ea
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2016-07-20 14:33:31 +00:00
Simon Hausmann
494ced1329 Improve precision of reported file times on Unix-style platforms
Instead of reporting the file times in the precision of seconds, our API allows
us to report it up to millisecond precision.

Change-Id: I8bcc6a1fb4116e8c5421d650a68f6fb00482e551
Reviewed-by: Alex Trotsenko <alex1973tr@gmail.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-07-20 12:35:30 +00:00
Friedemann Kleint
c14c149b51 Fix QTemporaryDir to handle Unicode characters on Windows
For platforms not providing mkdtemp(), QTemporaryDir relied on an implementation
of q_mkdtemp() operating on char *, converting back and forth using
QFile::encodeName()/decodeName() when passing the name to QFileSystemEngine.
This caused failures on Windows (which uses "System"/Latin1 encoding)
for names containing characters outside the Latin1 space.

Reimplement q_mkdtemp() to operate on QString, which avoids the conversions
altogether and also enables the use of larger character spaces for the
pattern.

Add tests.

Task-number: QTBUG-54810
Change-Id: Ie4323ad73b5beb8a1b8ab81425f73d03c626d58a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-07-20 07:31:18 +00:00
BogDan Vatra
cc119dee73 Workaround clang explicit specializations function templates export bug
Should be reverted when https://github.com/android-ndk/ndk/issues/34 is fixed

Change-Id: Ic7fe394412afc25082a9689da59d36cba8b3dade
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2016-07-20 07:06:37 +00:00
Alex Trotsenko
902a5e7aaa QDataStream: adjust containers' deserialization in transaction mode
If an error occurs during the transaction, we should prevent the
containers from being successfully read. So, check the status of the
stream before reading the container, because the deserialization
procedure temporarily resets it on entry.

Task-number: QTBUG-54022
Change-Id: Ie955c2fa3e449374f0f8403f00e487efa2bfdaf3
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2016-07-20 06:52:43 +00:00
Thiago Macieira
ea582cdcbf Work around Apple defining "check"
The header says they'll stop doing that in the next release. It's been
like that since at least the OS X 10.8 SDK...

Change-Id: Ib57b52598e2f452985e9fffd14585d4838dc8b09
Reviewed-by: Richard J. Moore <rich@kde.org>
2016-07-20 06:49:53 +00:00
Thiago Macieira
da04322b4c Make moc obey the preprocessor environment variable for include paths
C preprocessors augment their standard list of include paths from the
environment: Unix preprocessors use $C_INCLUDE_PATH (for C) and
$CPLUS_INCLUDE_PATH (for C++), plus CPATH for both, whereas MSVC uses
the an environment variable simply called "INCLUDE". Handling this for
MSVC is particularly important because the VCVARSALL.BAT script sets the
necessary #include paths in the environment for important things.
Without that being parsed, moc won't find some #defines, like
WINAPI_DESKTOP_FAMILY.

[ChangeLog][moc] qmake and moc now cooperate to use the Visual Studio
environment variables (set by the VCVARSALL.BAT script) to find system
include files. A possible consequence is that moc parses application
headers slightly differently, depending on #if conditions that depended
on macros that previous versions had not seen #define'd. Implementers of
other buildsystems are advised to pass the --compiler-flavor=msvc option
to moc.

Change-Id: I7e06274214d1939b0124e5b4bf169cceaef9ca46
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2016-07-20 02:54:09 +00:00
Thiago Macieira
9467bdc909 Update QLibrary's debug output when loading failed
We were printing 'loaded library "xxx"' even when ret == false, which
was misleading. So instead print the error string.

Change-Id: Ib57b52598e2f452985e9fffd1459ea860ed2dfcf
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
2016-07-20 00:41:29 +00:00
Jake Petroules
23bf3da5a0 Extend PLATFORM_SDK_EQUAL_OR_ABOVE and DEPLOYMENT_TARGET_BELOW macros
There is now a DARWIN version for all four Apple platforms at once,
a MACOS_IOS version for macOS and iOS (since many of the checks we need
are prior to tvOS or watchOS's existence), and MAC and OSX have been
relegated to synonyms for MACOS_IOS and MACOS, respectively.

Change-Id: I54f587e26c6b46bf4b469c5d3039086c65566651
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@qt.io>
2016-07-19 20:54:07 +00:00
Edward Welbourne
782ebeada1 Merge remote-tracking branch 'origin/5.7' into dev
Conflicts:
	qmake/library/qmakebuiltins.cpp
	qmake/library/qmakeevaluator.cpp
	qmake/library/qmakeevaluator.h
	qmake/project.h
QMakeEvaluator:
* evaluateConditional(): one side changed return type, the other
  changed a parameter type.
* split_value_list(): one side changed a parameter adjacent to where ...
* expandVariableReferences(): ... the other killed one overload and
  changed the survivor

	src/corelib/io/qlockfile_unix.cpp
One side changed a #if condition, the other moved NETBSD's part of
what it controlled.

	src/corelib/tools/qdatetime.cpp
One side fixed a reachable Q_UNREACHABLE in toMSecsSinceEpoch(), the
other moved it from the private class to the public one, in the midst
of the "short date-time" optimization, which confused diff entirely.
One side changed a QStringLiteral to QLatin1String, the other rewrote
adjoining code.

	src/network/kernel/qauthenticator.cpp
Both rewrote a line, equivalently; kept the dev version.

	src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm
	src/platformsupport/fontdatabases/mac/qfontengine_coretext_p.h
One side changed #if-ery that the other removed.

	tools/configure/configureapp.cpp
One side added a check to -target parsing; the other killed -target.

	tests/auto/testlib/selftests/expected_cmptest.lightxml
	tests/auto/testlib/selftests/expected_cmptest.teamcity
	tests/auto/testlib/selftests/expected_cmptest.txt
	tests/auto/testlib/selftests/expected_cmptest.xml
	tests/auto/testlib/selftests/expected_cmptest.xunitxml
Regenerated using generate_expected_output.py
I note that quite a few other expected_* come out changed, now.

There was no git-conflict in
	src/widgets/kernel/qformlayout.cpp
but it didn't compile; one side removed some unused methods; the other
found uses for one of them.  Put FixedColumnMatrix<>::removeRow(int)
back for its new user.

Change-Id: I8cc2a71add48c0a848e13cfc47b5a7754e8ca584
2016-07-19 20:14:40 +02:00
Giuseppe D'Angelo
c8277b6e53 QThread: make it fatal to destroy a running QThread
Align ourselves to what std::thread does (and what's sensible to do anyhow,
since we even document that "Deleting a running QThread [...] will probably
result in a program crash").

[ChangeLog][QtCore][QThread] Destroying a QThread which is still running will
now result in immediate and abnormal program termination.

Change-Id: Ib481287915be01a1381df14abf6e0fb68c36b5b5
Reviewed-by: David Faure <david.faure@kdab.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-07-19 11:28:55 +00:00
Friedemann Kleint
62cbb43457 Fix typo in doc snippets of qOverload and related
Task-number: QTBUG-54808
Change-Id: Ic565710e4d3a95abf98d4696ae7c0001a9171697
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2016-07-19 10:49:06 +00:00
Edward Welbourne
b3f260236a Merge "Merge remote-tracking branch 'origin/5.6' into 5.7" into refs/staging/5.7 2016-07-19 10:46:15 +00:00
Edward Welbourne
975d21a8c9 QTzTimeZonePrivate: missing spaces for readability.
Change-Id: If19669750fab89fbe0ac24d98b89fa1ea597fbb9
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-07-18 16:05:17 +00:00
Edward Welbourne
92ccb76550 QUtcTimeZonePrivate::data - skip spurious invalid start state.
Most fields were over-written after setting invalid.  The two that
weren't (not used by QUtcTimeZonePrivate) should be (if only for
uniformity with other QTimeZonePrivate variants), so set them to
sensible values.

Change-Id: I824ca0108d5b6bc322f76a0d1683342f789523b1
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-07-18 16:04:33 +00:00
Kai Koehne
13c198cedb Doc: Fix snippet to use initializer list
We can expect C++11 now, and using an initializer list
is much shorter.

Change-Id: I6424d24ce7660b342a629e836b94d62c8868a44d
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com>
2016-07-18 11:12:46 +00:00
Luca Bellonda
d4302ec693 QtCore: Fix QXmlStreamReader for invalid characters in XML 1.0
The XML parser uses fastScanLiteralContent() to read a block of
text. The routine was not checking the range of valid characters as
defined in the XML standard:
https://www.w3.org/TR/2008/REC-xml-20081126/#NT-Char
A check has been added to stop reading the bad character.
Note that the characters are legal in XML 1.1, but QXmlStreamReader
is a well-formed XML 1.0 parser

[ChangeLog][QtCore][QXmlStreamReader]
Fixed a bug in the XML parser that prevented to load XML that
contained invalid characters for XML 1.0.

Change-Id: I10aaf84fbf95ccdaf9f6d683ea7c31925efff36d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-07-17 14:54:36 +00:00
Edward Welbourne
82ea53ad24 Merge remote-tracking branch 'origin/5.6' into 5.7
Conflicts:
	qmake/library/qmakeevaluator.cpp

One side changed the iterator to use ranged-for, the other changed its
body; they only conflicted because the latter had to add braces around
the body, intruding on the for-line.  Trivial resolution.

Change-Id: Ib487bc3bd6e3c5225db15f94b9a8f6caaa33456b
2016-07-15 20:47:57 +02:00
Lars Knoll
8ee2a659d6 Don't mention private classes in our docs.
Change-Id: I2cb7443ffa9afac8160b9510df95a304936a01c9
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2016-07-15 08:58:53 +00:00
Anton Kudryavtsev
e46e112eb1 Optimize string usage
Use QStringBuilder more.
Use QL1S directly, without QString construction.

Change-Id: Iad844391367681fc1013b9725403d009e7c346e6
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2016-07-15 08:23:04 +00:00
Olivier Goffart
120ba68882 QReadWriteLock fast path for tryLock without timeout
When one tries to lock without a timeout, there is no need to allocate
a QReadWriteLockPrivate as we will not wait on it.

Change-Id: I37c96a7fbc0c66fbdffe372f6089708cb2466fe3
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-07-15 06:33:56 +00:00
Lars Knoll
8fc1cd085c Add qtwidgetsglobal.h and qtwidgetsglobal_p.h
The new modular configuration system requires one global
header per module, that is included by all other files in
this module.

That header will later on #include the configuration file
for Qt Widgets. For now it defines the Q_WIDGETS_EXPORT
macro for this library.

Change-Id: I6698989b952b9bac94d086d9f219e03c000f7d53
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
2016-07-14 13:46:07 +00:00
Lars Knoll
64507c7165 Clean up qwindowdefs_win.h
The file lives in Qt Gui, but declares a few methods from
Qt Core and Widgets. All of those methods are actually mostly
unused, not documented and pretty trivial.

This patch removes the last few places the methods got used and
removes the declarations. The implementations should get removed
in a future release.

Change-Id: I2b609c29f403d2ed4824ff4346008be08b3fd067
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2016-07-14 13:46:03 +00:00
Martin Smith
4038c07e5f qdoc: Documentation for qFuzzyIsNull() is added
The two versions of this function are now documented on the
global variables page.

Change-Id: Iee95e251d616f6c8b1b42458d23cbf64a70a5315
Task-number: QTBUG-50654
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-07-14 13:41:54 +00:00
Marc Mutz
5d935dca0c Remove (private) QString::expand(), port to (new) QString::resize(int, QChar)
We cannot really remove the function, since it's called from
inline code (QCharRef::op=(QChar)), but we can schedule it for
removal in Qt 6, and inline it into existing in-tree callers.

Change-Id: I3499f101dcb5ae908726b3673bf3526a04408db6
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-07-14 06:54:16 +00:00
Marc Mutz
c2f4705f23 Add qHash(QHash) and qHash(QMultiHash)
The hash function is carefully designed to give the same result
as the straight-forward implementation of qHash(unordered_map),
which we'll probably add at some point, namely: std::accumulate
over a container of std::pair.

This is one reason to use std:: and not QPair in the implemen-
tation of qHash(QHash). The other is that qHash(QPair) uses a
bad hash combiner, which may xor out the 'seed' from the result.

We can't fix that until Qt 6, but the qHash(std::pair) overload
uses the well-known boost::hash_combine algorithm (implemented
in Qt as QtPrivate::QHashCombine), so we can use that.

I also trust std::pair to work without problems with reference
template arguments, while QPair only very recently gained a very
basic auto-test for reference parameters.

[ChangeLog][QtCore] Added qHash() overloads for QHash, QMultiHash.

Change-Id: I90879d8a99cf1aadb6e84ecc0c3704f52f3691da
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-07-14 06:53:48 +00:00
Thiago Macieira
aca0e367be Fix the Q_ATOMIC_xxx_IS_www_NATIVE macros with C++11
When I introduced this code in Qt 5.0, I made INT and POINTER be
SOMETIMES_NATIVE, but then later I made the specific sizes be
ALWAYS_NATIVE. That doesn't make sense.

Instead, use the macros from the C++11 <atomic> header.

Note that the member isXxxxNative() functions should not have been
constexpr. That's a defect I introduced in Qt 5.0.

Task-number: QTBUG-51315
Change-Id: I0c94a5c2846b48c8aea7ffff1436013e8686c153
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2016-07-13 21:15:30 +00:00
Simon Hausmann
31b6760e64 Add missing logical bitwise operators to the little-endian storage classes
These make the (future) usage in declarative even more convenient.

Change-Id: I12c0fec1ea843d8acd2ee3fdf2a2189939bebd95
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2016-07-13 18:17:32 +00:00
Allan Sandfeld Jensen
690d6be542 Handle QVariantHash in QJsonDocument::fromVariant
It absence is just an oversight. The patch also adds test for the valid
inputs of the method.

[ChangeLog][QtCore][QJsonDocument] fromVariant can now take a QVariantHash argument.

Task-number: QTBUG-39751
Change-Id: I7e051413f930023db3cbb81452e77c56a7ceffe8
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2016-07-13 10:58:02 +00:00
Ralf Nolden
4397a1b26c FreeBSD: move order of includes for compiling
The previous patch works for FreeBSD 10 but however not for 9 and 11
due to the order of includes. Move <sys/user.h> down to fix those compile
issues due to unknown types when user.h is included first.

Change-Id: Ica3d3ddf335a543c4a473e8b80d1667cb81667cf
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-07-13 06:50:05 +00:00
Marc Mutz
5c46d07a7c Optimize QString::insert()
When the insertion position is not beyond end(), call
resize() instead of expand(), which fills the new size
with spaces, which, however would just be overwritten
by the following memmove().

Add some Q_UNLIKELY to indicate that we strongly
expect the resize() case to be the more common.

Change-Id: Iaf3215dd53c2cbd18f2fd8a5f80af8f6844944da
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Anton Kudryavtsev <a.kudryavtsev@netris.ru>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-07-13 06:33:07 +00:00
Ulf Hermann
972580accd Call disconnectNotify() when disconnecting a QMetaObject::Connection
In all other forms of disconnecting this is done. We also know the
signal index, so there is no reason not to do this.

Change-Id: Ic8b042cd8f45dbff74b42ee30c384a84bef78b20
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2016-07-12 16:53:05 +00:00
Edward Welbourne
e21bf5e6b3 QString::replace(): protect sought text and replacement
When replacing each copy of one text with a copy of another, we do so
in batches of 1024; if we get more than one batch, we need to keep a
copy of the sought text and replacement if they're part of the string
we're modifying, for use in later batches.

Also do the replacements in full batches of 1024, not 1023 (which left
the last entry in an array unused); marked some related tests as
(un)likely; and move some repeated code out into a pair of little
local functions to save duplcation.

Those new functions can also serve replace_helper(); and it can shed a
const_cast and some conditioning of free() by using them the same way
replace() now does.  (There was also one place it still used the raw
after, rather than the replacement copy; which could have produced
errors if memcpy were to exercise its right to assume no overlap in
arrays.  This error is what prompted me to notice all of the above.)

Added tests.  The last error proved untestable as my memcpy is in fact
as fussy as memmove.  The first two tests added were attempts to get a
failure out of it.  The third did get a failure, but also tripped over
the problem in replace() itself.  Added to an existing test function
and renamed it to generally cover extra tests for replace.

Change-Id: I9ba6928c84ece266dbbe52b91e333ea54ab6d95e
Reviewed-by: Robin Burchell <robin.burchell@viroteck.net>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2016-07-12 10:22:25 +00:00
Edward Welbourne
9a3bcd1c3d QString::replace(): Commentary clarifications.
Also skip doing a += 0 when we had to test whether the relevant rhs
was zero anyway (because we want to ++ there instead of +=ing).

Change-Id: Ibd5f21eb9aaf410b09c9db8450b2d61618e628fc
Reviewed-by: Robin Burchell <robin.burchell@viroteck.net>
2016-07-12 10:22:17 +00:00
Timur Pocheptsov
f8dc769655 QMacTimeZonePrivate - correctly initialize m_nstz data-member
The default ctor never initializes m_nstz but calls init with
[NSTimeZone systemTimeZone].name. Init (re)sets m_nstz _only_
if this ianaId is in [NSTimeZone knownTimeZoneName], which is not guaranteed
(a good example is "US/Pacific" that can be returned by systemTimeZoneId() -
the similar problem is described in [*]. Set m_nstz to nil in ctor,
so if 'init' fails we still have a valid (nil) pointer.

[*] http://stackoverflow.com/questions/19819268/convert-ios-localtimezone-to-a-knowntimezone.

Task-number: QTBUG-54330
Change-Id: I68917926350aad3158d44a06f06721f25b3fdb74
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2016-07-11 17:51:21 +00:00
Marc Mutz
8cee6864c6 QStringBuilderCommon: drop const from resolved() result type
The const qualification prevented toUpper() etc from
calling the rvalue overloads of the corresponding QString
functions. Since resolved() always returns a non-shared
object, the rvalue overloads can re-use the object's
capacity for storing their result, saving up to one memory
allocation per QStringBuilderCommon::to*() invocation.

Change-Id: Ica97fcd906cdd949ffe56055654578b93407e2d3
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-07-11 13:57:51 +00:00
Thiago Macieira
a2ff5afffa Correct indentation in qsettings.cpp
Introduced in 9c49d8c411, despite my
pointing out.

Change-Id: Ie585843cfb684bc3b6e3fffd14600c99f7fde591
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Anton Kudryavtsev <a.kudryavtsev@netris.ru>
2016-07-11 06:33:26 +00:00
Anton Kudryavtsev
9c49d8c411 QSettings: optimize string usage
Use QStringBuilder and QString::asprintf more.
Use += operator to reserve extra capacity for
possible free following append/prepend/+= call.

Change-Id: Ia534bec28cb96b688a68a5051a855cda1eb5db4b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2016-07-09 08:37:10 +00:00
Thiago Macieira
cba3378732 Make QDateTime's default constructor not allocate memory on 32-bit
Commit fb498a6519 introduced the short
datetime optimization, but it accidentally removed the optimization from
Qt 5.7 that made QDateTime's default constructor not allocate memory.
Instead of bringing back the Q_GLOBAL_STATIC that was used, let's use
the short date time optimization on 32-bit too.

The CanBeSmall constant remains false on 32-bit systems, but judicious
non-use of that constant in a few functions allows 32-bit systems to use
the optimization. We still say that any date/time value is "unsmall", as
there's no sense in calculating whether the date is between 1970-01-01
and July 14 of the same year.

Change-Id: I413d458307aa46469b80fffd145a9db0325c08cc
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2016-07-09 02:17:30 +00:00
Thiago Macieira
d16ba63f5c QTimer: add support for <chrono> functions
[ChangeLog][QtCore][QTimer] Added support for std::chrono duration
objects for QTimer methods, like QTimer::singleShot and
QTimer::setInterval.

Change-Id: I87e17314d8b24ae983b1fffd14536e24d5b12424
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2016-07-09 02:17:17 +00:00
Anton Kudryavtsev
6bafb9da71 QString: fix incomplete doc of chop()
Change-Id: I84de848681e793e68e0c290719a7f961aca48f4e
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-07-08 06:43:06 +00:00
Anton Kudryavtsev
2788fccd29 Use QStringLiteral more judiciously
Replace it with QL1S in QStringBuilder expressions
and in overloaded functions.

Replace patterns 'QString::number() + QStringLiteral'
and 'QStringLiteral + QString::number()' with
QString::asprintf.

Saves some text size.

Change-Id: Ib39b2332264dfc3df04e77f2c101b47a1030cef4
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-07-08 06:43:02 +00:00
Anton Kudryavtsev
e91c412391 QStringRef: add chop()
chop() was missing in the API.

Change-Id: I15af86c8f218cf159b8ce19bbeb2ffa6201f98cf
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2016-07-07 15:12:27 +00:00
Maurice Kalinowski
753aed83c6 winrt: Fix launch as background task
In case a background task wants to use Qt, winmain is not invoked.
Neither can we create the same objects like winmain do (as in creating a
application view). Instead runOnXamlThread uses the thread pool enabling
the event loop to run successfully.

Task-number: QTBUG-54396
Change-Id: Ia3ba23ed0fd6cd7d2ed8d43675e88073b9aec8b5
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2016-07-06 07:20:16 +00:00
Kevin Funk
bec2fc19fd Windows/QProcess::startDetached(): Don't always create console
Make QProcess::startDetached() behave exactly like QProcess::start() when it
comes to the behavior of whether to create a new console window or not.

Before this patch, QProcess::startDetached() created a new console window
(CREATE_NEW_CONSOLE flag of CreateProcess()) unconditionally. Instead, use the
same rules for deducing whether to show an console window or not as
QProcess::start().

[ChangeLog][QtCore][Platform Specific Changes] QProcess::startDetached()
changed behavior on Windows: it no longer creates a new console window
unconditionally, instead it passes the same creation flags to CreateProcess
as QProcess::start().

Task-number: QTBUG-53833
Change-Id: I0e3d4b161fb5cb94cfbbd21fb4edb8417ab543fd
Reviewed-by: David Faure <david.faure@kdab.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2016-07-06 07:00:13 +00:00
Thiago Macieira
9e49778380 Fix/adapt the uses of {to,set,from}Time_t in the qtbase source code
Move those to the equivalent {to,set,from}SecsSinceEpoch(), except for
the cases that did QDateTime::currentDateTime{,Utc}().toTime_t. Those
are best implemented with QDateTime::currentSecsSinceEpoch().

Change-Id: Ib57b52598e2f452985e9fffd145a366c92cfda20
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2016-07-06 06:28:13 +00:00
Thiago Macieira
b6345a515b QStorageInfo: update the algorithm for ignored filesystems on Unix
Use the criterion that GNU coreutils' df uses: if the total size of the
filesystem is zero, then it's pseudo. After all, if it contains files in
a zero-sized volume, it has to be pseudo; if it contains nothing, then
it's not very useful anyway.

This would have caught most Linux pseudo-fs anyway, but the mount point
check beforehand allows us to skip quite a few statfs() syscalls.

The new algorithm also solves the following cases which had been
mistakenly interpreted:
 * fuse and ZFS (source devices don't usually start with /)
 * pseudo-fs that were mounted from a device starting with /
   (the source device is usually ignored by the OS)

This change is not testable automatically. Manual testing shows it still
reports the same entries it used to on Linux, plus now shows FUSE
(sshfs) mounts.

Task-number: QTBUG-54235
Change-Id: Ib57b52598e2f452985e9fffd1459f06dcefcc5c6
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2016-07-06 03:59:50 +00:00
Timur Pocheptsov
6c935dc74f Merge "Merge remote-tracking branch 'origin/5.6' into 5.7" into refs/staging/5.7 2016-07-05 20:51:40 +00:00
Kevin Funk
6583720aa4 Revert "CMake: Add imported target for qdoc."
This reverts commit dc0ae02ebc.
qdoc is a binary built inside the qttools repository, thus it should be added
to the respective ConfigExtras.cmake.in there instead.

Task-number: QTBUG-54446
Change-Id: I182e5889af164a89c68226a91abc4d9962a508ea
Reviewed-by: Volker Krause <volker.krause@kdab.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
2016-07-05 14:40:29 +00:00
Edward Welbourne
b5695bd5be Merge remote-tracking branch 'origin/5.6' into 5.7
Change-Id: Ibd81cd1df4a0650d93fcb556a57be90be2e1f569
2016-07-04 15:58:39 +02:00
Lars Knoll
8af681c107 Add qtnetworkglobal.h and qtnetworkglobal_p.h
The new modular configuration system requires one global
header per module, that is included by all other files in
this module.

That header will later on #include the configuration file
for Qt Network. For now it defines the Q_NETWORK_EXPORT
macro for this library.

Change-Id: I9c45d425baf881c431ed71fd457c7feb2c123855
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
2016-07-03 07:56:17 +00:00
Lars Knoll
e8fe65205c Add qtguiglobal.h and qtguiglobal_p.h
The new modular configuration system requires one global
header per module, that is included by all other files in
this module.

A similar scheme and naming convention is already being used
for many other modules (e.g. printsupport, qml, quick).

That header will later on #include the configuration file
for Qt Gui. For now it defines the Q_GUI_EXPORT macro for
this library.

In addition, add a private global header, qtguiglobal_p.h,
that can later on include the private config header for
Qt Gui for things we don't want to export to the world.

Change-Id: Id9ce2a4f3d2962c3592c35e3d080574789195f24
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
2016-07-03 07:55:57 +00:00
Giuseppe D'Angelo
daade9b90d QEventLoop: better describe the exception safety of Qt
1) In general it's unsafe to let exceptions propagate through Qt code,
so document that.

2) Add a note that overriding notify() makes sense only in Qt 5, in Qt 6
it's going away.

3) The advice applies also to applications not using QApplication, but
just QCoreApplication.

Change-Id: I4f6e74c53da757faf2eeaa9de226ceba55c52536
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Martin Smith <martin.smith@theqtcompany.com>
2016-07-02 19:36:10 +00:00
Thiago Macieira
946c1a578a Fix build: ftok(3) requires sys/ipc.h
Task-number: QTBUG-54069
Change-Id: Ib57b52598e2f452985e9fffd1457fa9c7ad3bac0
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2016-07-02 16:37:03 +00:00
Thiago Macieira
4f3eb66173 QUrl: Test that we do correctly accept valid schemes
... and reject invalid ones. There was one error: we accepted schemes
starting with pluses, dashes and dots.

Change-Id: Ie585843cfb684bc3b6e3fffd145cfe12227ec4ad
Reviewed-by: David Faure <david.faure@kdab.com>
2016-07-02 16:36:50 +00:00
David Faure
1af4916e11 QTime: restore Qt3 compatibility in the QDataStream operators
A Qt5 program writing a null QTime() using setVersion(QDataStream::Qt_3_3),
and then a Qt3 program reading that, would lead to a weird QTime,
with isNull=false, isValid=false, hour=1193, minute=2, second=47, ms=295.

This commit restores interoperability, by writing out the expected value
(0) for a null QTime rather than the -1 value used by Qt4 and Qt5.

Change-Id: Icde468a8f6fc9434ef7018296725819b44d672af
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-07-02 08:13:44 +00:00
Thiago Macieira
169f1beaf5 Move QElapsedTimer to src/corelib/kernel
It's really a kernel functionality, as it implements really low-level
functionality and it's used by the event dispatcher. It was in tools/
only because QTime is.

QDeadlineTimer is also coming to kernel/.

Change-Id: Ifea6e497f11a461db432ffff14491c6d9b839eb0
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2016-07-02 07:51:45 +00:00
Thiago Macieira
840729a931 QDateTime: use the more efficient currentMSecsSinceEpoch()
... instead of creating a QDateTime object.

Change-Id: Ib57b52598e2f452985e9fffd145a36911de4fa9a
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2016-07-02 07:51:11 +00:00
Anton Kudryavtsev
6662919ecd CoreLib: use QStringRef to optimize memory allocation
Replace substring functions that return QString with
corresponding functions that return QStringRef where
it's possible.

Create QString from QStringRef only where necessary.

Change-Id: Id9ea11b16947220cd27787c0b529de62d10b6c26
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2016-07-02 07:39:06 +00:00
Anton Kudryavtsev
2185b2f054 ItemModel: Extract Method isVariantLessThan()
As noted in comments, QSortFilterProxyModel and QStandardItemModel
duplicate code to compare QVariant; extract this into a separate method
they can share.

Since there is only one common suitable header for both files,
the method was placed in qabstractitemmodel.cpp

Change-Id: I82bb4a2d6084059b8a70a8d556c16f1a29f4f686
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
2016-07-02 07:38:00 +00:00
Alex Trotsenko
3c93286f08 QDataStream: unify deserialization of containers
Serialization of the Qt container classes is accomplished by breaking
up the data into primitive units. On the receiver side, these units
should be read atomically to guarantee integrity of the container.

Deserialization procedures for QHash and QMap were already implemented
in accordance with this strategy and have the following behavior:

 - a previously latched error status is saved for the caller. This
   overrides possible different errors in the current read. This
   is consistent with the treatment of primitive types.
 - if an error occurs during the deserialization, the container is
   cleared.

To make the API consistent, this patch adjusts the behavior of QList,
QLinkedList, QVector, and QSet deserialization. On the implementation
side we accomplish this with a private StreamStateSaver RAII class that
consolidates the handling of the stream status for all containers.

[ChangeLog][Important Behavior Changes][QtCore][QDataStream] Incomplete
reads of Qt containers are now handled same way as for primitive types,
meaning that previous errors are latched.

Task-number: QTBUG-54022
Change-Id: I5c77257fe2a4637e8a7e6cf3cd43091c8469340e
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2016-07-01 16:08:41 +00:00
Kai Koehne
9964b850ad Doc: Improve QJsonDocument::fromJson documentation
Be explicit on how to check whether parsing succeeds.

Change-Id: I44f408cb6e5a830826b84dfb3a8af331f03e58cc
Reviewed-by: Topi Reiniö <topi.reinio@theqtcompany.com>
2016-07-01 14:55:29 +00:00
Liang Qi
200fdd96f0 Merge remote-tracking branch 'origin/5.7' into dev
Conflicts:
	configure
	configure.json

Change-Id: Iba032d9a29c273da2585632bc6e22bbafb961808
2016-07-01 13:21:29 +02:00
Alexander Volkov
c376e3fbf0 QDir: Remove redundant QString wrapping
Change-Id: I8368b137d15509cdec575a17f5dae3c0c343400f
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
2016-06-30 15:28:30 +00:00
Edward Welbourne
f3df265a38 QDateTime: early return to make a Q_UNREACHABLE actually true.
It could be reached when QT_BOOTSTRAPPED was defined.

Change-Id: I632d6f908a3bcbde81a6ebbadcaf2800dfe1449d
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-06-30 12:27:00 +00:00
Maurice Kalinowski
ed32af3506 winrt: fix conditional
Seems the previous check was a leftover from debugging. Tests still pass
and loop checks properly now.

Change-Id: Ic12cd49881f6d146687e257794b3028f6c8e874c
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2016-06-30 11:54:26 +00:00
Anton Kudryavtsev
5c9e393117 QString: add some missing overloaded operator+
to keep compatibility with and without
using QT_USE_QSTRINGBUILDER.

Change-Id: If8218fe0693cdb7ad1250beb272e0e7c356bbf4a
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2016-06-29 14:58:25 +00:00
Liang Qi
f27d8b9f57 Merge remote-tracking branch 'origin/5.6' into 5.7
Change-Id: If6ba05867e7c98159e1b94ff71923e8b36bdbccb
2016-06-29 10:10:22 +02:00
Friedemann Kleint
0dc5d8e6c9 Fix some qdoc-warnings for Qt 5.8.
qtbase/src/corelib/tools/qstring.cpp:8341: warning: Unknown command '\length'
qtbase/src/corelib/tools/qstring.cpp:8354: warning: Unknown command '\length'
qtbase/src/corelib/tools/qstring.cpp:8366: warning: Unknown command '\length'
qtbase/src/corelib/doc/src/animation.qdoc:38: warning: Can't link to 'QAbstractAnimation::updateCurrentValue()'
qtbase/src/corelib/io/qdatastream.cpp:529: warning: Undocumented enum item 'Qt_5_8' in QDataStream::Version
qtbase/src/corelib/tools/qdatetime.cpp:4377: warning: No documentation for 'QDateTime::currentSecsSinceEpoch()'
qtbase/src/corelib/tools/qcommandlineoption.cpp:435: warning: Undocumented parameter 'flags' in QCommandLineOption::setFlags()
qtbase/src/network/ssl/qsslconfiguration.cpp:857: warning: Undocumented parameter 'dhparams' in QSslConfiguration::setDiffieHellmanParameters()
qtbase/src/network/ssl/qsslconfiguration.cpp:830: warning: Undocumented parameter 'hint' in QSslConfiguration::setPreSharedKeyIdentityHint()
qtbase/src/network/ssl/qssldiffiehellmanparameters.cpp:225: warning: No such enum item 'ErrorUnsafeParameters' in QSslDiffieHellmanParameters::Error
qtbase/src/network/ssl/qssldiffiehellmanparameters.cpp:225: warning: No such enum item 'ErrorInvalidInputData' in QSslDiffieHellmanParameters::Error
qtbase/src/network/ssl/qssldiffiehellmanparameters.cpp:225: warning: Undocumented enum item 'UnsafeParametersError' in QSslDiffieHellmanParameters::Error
qtbase/src/network/ssl/qssldiffiehellmanparameters.cpp:225: warning: Undocumented enum item 'NoError' in QSslDiffieHellmanParameters::Error
qtbase/src/network/ssl/qssldiffiehellmanparameters.cpp:225: warning: Undocumented enum item 'InvalidInputDataError' in QSslDiffieHellmanParameters::Error
qtbase/src/network/ssl/qssldiffiehellmanparameters.cpp:105: warning: Undocumented parameter 'encoding' in QSslDiffieHellmanParameters::QSslDiffieHellmanParameters()
qtbase/src/network/ssl/qssldiffiehellmanparameters.cpp:129: warning: Undocumented parameter 'encoding' in QSslDiffieHellmanParameters::QSslDiffieHellmanParameters()
qtbase/src/network/ssl/qssldiffiehellmanparameters.cpp:208: warning: Can't link to 'clear()'
qtbase/src/network/ssl/qssldiffiehellmanparameters.cpp:277: warning: Undocumented parameter 'dhparam' in operator<<()
qtbase/src/network/ssl/qssldiffiehellmanparameters.cpp:277: warning: No such parameter 'dhparm' in operator<<()
qtbase/src/widgets/kernel/qapplication.cpp:999: warning: Cannot find 'QApplication::autoMaximizeThreshold' specified with '\property' in any header file

Change-Id: I4ac00f0fc0dbc4d421cf7c0273635d9681962645
Reviewed-by: Topi Reiniö <topi.reinio@theqtcompany.com>
2016-06-28 13:27:46 +00:00
Thiago Macieira
59c3670b63 Make sure all private headers in Qt Core include qglobal_p.h
The rule was:
 - if the header included qglobal.h, turn that into qglobal_p.h
 - otherwise, insert the #include after the "We mean it" warning

qglobal_p.h currently only includes qglobal.h.

Change-Id: Ib056b47dde3341ef9a52ffff13ef677e471674b7
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2016-06-25 08:01:04 +00:00
Liang Qi
dd90af1221 Merge remote-tracking branch 'origin/5.7' into dev
Conflicts:
	mkspecs/common/mac.conf
	mkspecs/features/configure_base.prf
	mkspecs/features/configure.prf
	mkspecs/macx-clang-32/qmake.conf
	mkspecs/macx-clang/qmake.conf
	mkspecs/macx-ios-clang/qmake.conf
	src/network/ssl/qsslsocket_openssl_symbols_p.h

Change-Id: I768b592e8e589662b1fdb9b8cbd633fef26845b6
2016-06-23 14:24:55 +02:00
Liang Qi
5cfb80a28e Merge remote-tracking branch 'origin/5.6' into 5.7
Conflicts:
	src/angle/src/libGLESv2/libGLESv2.pro
	src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldeviceintegration.cpp

Change-Id: If8da4cfe8f57fea9f78e7239f378a6302c01674e
2016-06-23 10:29:37 +02:00
Kai Koehne
3986e1cb22 Document limitations and good practice for logging category names
Task-number: QTBUG-54238
Change-Id: I2b6f54fb26d24e6da19c0e09782483eeb10206e1
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
Reviewed-by: Michael Brasser <michael.brasser@live.com>
2016-06-23 07:11:34 +00:00
Jake Petroules
0c43ef5023 Update for the newest Darwin-family operating systems.
This also corrects for some code that was not included in the forward
merge from 5.6 (ea438b2508) due to code
restructuring.

Change-Id: I90a20fbcb60cfd6deb1cca3716a62754af27901f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-06-23 02:37:12 +00:00
Thiago Macieira
f4be16e1f7 Win: Get rid of unused variables un QDateTime::currentMSecsSinceEpoch
The compiler didn't complain that they were unused or -Werror / -WX was
not active.

Change-Id: Ib57b52598e2f452985e9fffd145a7b63a32189fd
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
2016-06-22 23:26:43 +00:00
Thiago Macieira
bff15c547e QDateTime: introduce {to,from,set,current}SecsSinceEpoch
These new functions use a 64-bit integer in the API, instead of the
broken 32-bit unsigned integer that the previous xxxTime_t functions
used. That was a design flaw when the API was introduced back in Qt 4.2,
so I'm deprecating the API and slating it for removal in 6.0.

The changes to qfilesystemmetadata_p.h and quuid.cpp are necessary to
build the bootstrap library. The rest of the adaptation to the new API
will come in the next commit.

[ChangeLog][QtCore][QDateTime] Introduced toSecsSinceEpoch,
fromSecsSinceEpoch and setSecsSinceEpoch functions, which use 64-bit
integers to represent the number of seconds.

[ChangeLog][QtCore][QDateTime] The toTime_t, fromTime_t and setTime_t
functions are deprecated and will be removed in Qt 6.0. For new code,
use the equivalent functions with "SecsSinceEpoch" in the name, or the
equivalent ones with millisecond accurancy that have existed since
Qt 4.7.

Change-Id: Ib57b52598e2f452985e9fffd145a355d0e7ff48d
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2016-06-22 18:34:27 +00:00
Ralf Nolden
9caac0f176 Add OpenBSD to list of targets that can't use --no-undefined in qtcore
A prior commit has already added the resetting of QMAKE_LFLAGS_NOUNDEF
in corelib.pro for FreeBSD due to environ(7) not being part of libc.
OpenBSD has the same issue, so add it to the list of BSD systems
affected for resetting the flags for qtcore.

Change-Id: I50a62271ffa05a9976e802de420d47a1425359c4
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-06-22 16:25:22 +00:00
Oswald Buddenhagen
1824e43b51 make plugin meta data load failure error message less cryptic
Change-Id: I280673e7fd582c5877e8e17ed00318cb10cd537c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-06-22 15:12:36 +00:00
BogDan Vatra
930e750b7a Remove duplicated QT_HAS_BUILTIN define
QT_HAS_BUILTIN is already defined in qcompilerdetection.h which is
included in qglobal.h which is included in this header file.

Task-number: QTBUG-54068
Change-Id: I46c2e13d85fc21d3e6c426d0f35a584b21ae792b
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
2016-06-21 18:58:27 +00:00
Liang Qi
ea438b2508 Merge remote-tracking branch 'origin/5.7' into dev
Conflicts:
	src/corelib/global/qglobal.cpp
	src/corelib/global/qsysinfo.h
	src/corelib/kernel/qcoreapplication_win.cpp
	src/gui/text/qdistancefield.cpp
	src/gui/text/qdistancefield_p.h
	src/plugins/platforms/windows/qwindowsglcontext.cpp
	src/plugins/platforms/windows/qwindowsglcontext.h

Change-Id: Ib3500acc2b28553bde06758cd9a2e19eb7fe2978
2016-06-21 08:39:41 +02:00
Liang Qi
5f0ec7305e Merge "Merge remote-tracking branch 'origin/5.6' into 5.7" into refs/staging/5.7 2016-06-20 07:54:09 +00:00
Thiago Macieira
a2f319e9fb Fix MSVC warning about casting to pointer of different size
qdatetime.cpp(2834): warning C4312: 'reinterpret_cast': conversion from 'int' to 'QDateTimePrivate *' of greater size

Change-Id: Ib57b52598e2f452985e9fffd1458fe3ba3fcfb48
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2016-06-20 06:53:10 +00:00
Liang Qi
e32f1a4d61 Merge remote-tracking branch 'origin/5.6' into 5.7
And blacklisted a few tests in tst_QUdpSocket.

Conflicts:
	src/android/jar/src/org/qtproject/qt5/android/QtNative.java
	src/corelib/global/qglobal.cpp
	src/corelib/global/qsystemdetection.h
	src/corelib/io/qfileselector.cpp
	src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldeviceintegration.cpp
	tests/auto/network/socket/qudpsocket/BLACKLIST

Task-number: QTBUG-54205
Change-Id: I11dd1c90186eb1b847d45be87a26041f61d89ef6
2016-06-20 08:00:26 +02:00
Thiago Macieira
683c30074e Add "-softfloat" to archdetect.cpp and clarify what to use when
Change-Id: I1cc7601489634e96833cfffd14563e033c85ff6d
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-06-19 18:46:36 +00:00
Simon Hausmann
ee2eed350f Remove overload tag from QByteArray QIODevice::readAll()
This does not seem to be a function that is overloaded.

Change-Id: Icf8942dfb1e78a2ddb38cbd1c49657f745a61989
Reviewed-by: Alex Trotsenko <alex1973tr@gmail.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-06-17 16:56:55 +00:00
Jake Petroules
2fa4a48ff6 Fix documentation of some QSysInfo functions.
Qt 5.8 no longer supports Windows CE, or versions of Windows where the
marketing version is not an orderable version number.

Change-Id: I8fab7d9b0d466f891e872b6c3fdf9d98ffe6ebc1
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-06-17 16:43:04 +00:00
Thiago Macieira
691b867895 Fix warning about non-void function not returning anything
Found by ICC 17 Beta on Windows.

Change-Id: Ib57b52598e2f452985e9fffd1458b6990b70837a
Reviewed-by: Robin Burchell <robin.burchell@viroteck.net>
2016-06-17 16:12:52 +00:00
Olivier Goffart
f7a0968da4 Forward declarations for platform specific types should also be done with Q_QDOC
The clang based qdoc need to be able to parse properly anything that is
in #ifdef Q_QDOC

The #if for the forward declararion now match the one in which it is used.

Change-Id: Ia6cf84dd07a979b4e7aa8da764d9fb2fce74baa1
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
2016-06-17 14:58:30 +00:00
Liang Qi
3cb56800d5 Merge remote-tracking branch 'origin/5.7' into dev
Conflicts:
	tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp

Change-Id: If899cda251b4dc8b8a7c6764520e88ab719737cd
2016-06-17 10:53:42 +02:00
Liang Qi
3d8c8daae1 Merge "Merge remote-tracking branch 'origin/5.7.0' into 5.7" into refs/staging/5.7 2016-06-16 12:25:24 +00:00
Liang Qi
c4e472ea10 Merge remote-tracking branch 'origin/5.7.0' into 5.7
Conflicts:
	src/corelib/tools/qsimd_p.h

Change-Id: I7c6bfc5873d97ad7f51a540dd9c18b9359dde59f
2016-06-16 07:30:02 +02:00
Thiago Macieira
6cbc9c6d35 QArrayDataOps: silence Clang warning about memmove
Same as 9224255f13: some Qt types are
polymorphic and are marked as movable, so Clang complains.

qarraydataops.h:608:27: error: destination for this 'memmove' call is a pointer to class containing a dynamic class 'QPixmap'; vtable pointer will be overwritten [-Werror,-Wdynamic-class-memaccess]
qarraydataops.h:608:61: error: source of this 'memmove' call is a pointer to class containing a dynamic class 'QPixmap'; vtable pointer will be moved [-Werror,-Wdynamic-class-memaccess]

Change-Id: Ib57b52598e2f452985e9fffd145861e025b81550
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2016-06-16 04:34:05 +00:00
James McDonnell
b07736c0bc Correct a type mismatch in the QNX PPS code
It's a problem when building for 64-bit where the two types no longer
match.

Change-Id: I8c31915caf81a60d635c79816a3a2d5d36742ff9
Reviewed-by: Dan Cape <dcape@qnx.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-06-15 13:46:19 +00:00
David Faure
7b23ebefb2 QReadWriteLock: initialize member var currentWriter
Found by valgrind's memcheck.

Change-Id: I68f7c9279033e76d82f511b9d095548b4ef45723
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2016-06-15 08:57:01 +00:00
Alex Trotsenko
3c87c82e52 QDataStream: do not lose error status while reading containers
Otherwise, the code:

  ds >> s >> hash;

could set the stream status to ReadPastEnd, while deserialization
of the string is failed with ReadCorruptData status.

Proposed solution is to restore a previously latched error status
unconditionally in accordance with QDataStream::setStatus() docs.

Change-Id: Id3a7dccf709b02e5b018efb48d7647ee48fe5124
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2016-06-15 07:43:54 +00:00
Oliver Wolff
e85e7f4b81 Fixed developer build for MinGW
0 must not be used as a null pointer constant

Change-Id: I082d0e99c105fb02980b9cf390e7f6e4c9ad0869
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-06-15 06:31:35 +00:00
Jake Petroules
3e2bde3578 Update for the newest Darwin-family operating systems.
- Adapt to the OS X => macOS rename in Q_OS_ macros/docs, qmake scopes,
file selectors, etc.
- Add new QSysInfo values and MAC_OS_X / __MAC_ / __IPHONE_ values for
macOS 10.12 and iOS 9.1 through 10.0.
- Update prettyProductName with new macOS "Sierra" codename.

Change-Id: Id976530beeafa01b648ebaa16f4a8f0613fcaf75
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-06-15 05:52:47 +00:00
Tor Arne Vestbø
58566686fc darwin: Add Foundation conversion functions for QSize/QSizeF
The fromCGPoint function was left out for QSize, as the foundation type is
using CGFloats internally. Clients should use an explicit QSizeF::toSize()
when potentially throwing away precision.

Change-Id: I12d43ae0881f09ad8d79f2caaa000c3983f4ef30
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com>
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
2016-06-14 17:23:38 +00:00
Tor Arne Vestbø
197471beac darwin: Add Foundation conversion functions for QPoint/QPointF
The fromCGPoint function was left out for QPoint, as the foundation type is
using CGFloats internally. Clients should use an explicit QPointF::toPoint()
when potentially throwing away precision.

Change-Id: I12a37e8f81c86b7ada56066cc18ee29709cc21e3
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com>
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
2016-06-14 17:22:55 +00:00
James McDonnell
e969e6d2ca Fix cast warnings when pthread_t is smaller than a pointer
Push conversions from pthread_t to Qt::HANDLE and back into functions.
The casts that were being used didn't work for the unusual 64-bit
pointer/32-bit int combination that QNX is using for 7.0.  HANDLE ends
up as a 64-bit pointer and pthread_t ends up as a 32-bit integer.  g++
considers the precision loss when converting from the 64-bit pointer
to the 32-bit integer an error.  Better to have the casts hidden in
functions so it's easier to adjust them for unusual combinations such
as this.

Change-Id: Ia156b26224a0f7edc1c31e3d1ee8b21191381698
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-06-13 19:00:32 +00:00
Liang Qi
511790fd1a Merge remote-tracking branch 'origin/5.7' into dev
Conflicts:
	config_help.txt
	configure
	mkspecs/features/uikit/sdk.prf
	src/corelib/global/qhooks.cpp
	src/corelib/io/qfilesystemwatcher.cpp
	src/corelib/io/qlockfile_unix.cpp
	src/corelib/tools/qalgorithms.h
	src/gui/kernel/qwindowsysteminterface.h
	src/gui/text/qtextdocument_p.cpp
	src/network/access/access.pri
	src/network/access/qnetworkaccessmanager.cpp
	src/network/access/qnetworkreplynsurlconnectionimpl.mm
	src/src.pro
	src/testlib/qtestcase.cpp
	src/widgets/kernel/qwidgetbackingstore_p.h
	src/widgets/styles/qwindowscestyle.cpp
	src/widgets/styles/qwindowsmobilestyle.cpp
	tests/auto/corelib/io/qdiriterator/qdiriterator.pro
	tests/auto/corelib/io/qfileinfo/qfileinfo.pro
	tests/auto/gui/kernel/qwindow/BLACKLIST
	tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp
	tools/configure/configureapp.cpp

Change-Id: Ibf7fb9c8cf263a810ade82f821345d0725c57c67
2016-06-13 12:46:46 +02:00
Maurice Kalinowski
27e94bd9d1 winrt: Fix potential crash in QCoreApplication
GetModuleFileName exists for Windows 10 and upwards, hence use the
generic version from the win32 mkspec. This allows to create a
QCoreApplication object with nullptr argv, as the application filename
is identified via the binary itself and not via arguments. A couple of
auto-tests use this method to create multiple application objects during
runtime.

Unfortunately we cannot apply this for msvc2013, even though MSDN states
the GetModuleFileName exists, it fails to compile for Windows Phone 8.1.

Change-Id: I2b8b988107487ef3785462f8ca40b0a6e0623e32
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2016-06-13 06:13:19 +00:00
Maurice Kalinowski
038c57f4b3 winrt: Close IAsyncInfo manually in case of error
In case QEventDispatcherWinRT::runOnXamlThread returns an error the
runtime sets the status of IAsyncInfo to Error. At the point when the
IAsyncInfo destructor is invoked, an unhandled exception is thrown
indicating the error has not been handled, causing any application to
just crash deep inside the Windows platform libraries.

Hence, in case runOnXamlThread returns non-S_OK we have to manually
invoke Close() of the IAsyncInfo to tell the system we have taken care
of everything.

Change-Id: I3ac1e2ec2726f42e44f4f9a92191e454711120dd
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2016-06-13 06:13:15 +00:00
James McDonnell
d4e98a9a38 Move __cpp_constexpr check inside Q_COMPILER_CONSTEXPR check
Q_COMPILER_CONSTEXPR can be undefined (or not defined at all) to
indicate that constexpr should not be used regardless of the compiler's
ability to support it.  This is done for QNX because some C library
floating point functions used in the Dinkumware C++ library aren't
constexpr functions; i.e., the library doesn't have proper constexpr
support even though the compiler does.

(cherry picked from commit d87242968f)
Change-Id: If0bdeb2180710dd9ccd97d79fa91cf9ff42f7990
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-06-13 00:47:13 +00:00
Thiago Macieira
50d70fd1e3 Fix warning when compiling x86 with SSE2 but no AVX2
qstring.cpp:595:13: error: unused variable ‘nullmask’ [-Werror=unused-variable]

Change-Id: I1cc7601489634e96833cfffd1456474a529a79ed
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
2016-06-11 20:50:04 +00:00
Tor Arne Vestbø
ebee64645a darwin: Add Foundation conversion functions for QRect/QRectF
The fromCGRect function was left out for QRect, as the foundation type is
using CGFloats internally. Clients should use an explicit QRectF::toRect()
when potentially throwing away precision.

Change-Id: I0d4c5c5a4e6a45ea3287e3f37a00b69b0bfdefcf
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com>
2016-06-10 23:47:15 +00:00
Liang Qi
cbe332405a Merge remote-tracking branch 'origin/5.6' into 5.7
Conflicts:
	configure
	mkspecs/macx-ios-clang/features/default_pre.prf
	mkspecs/macx-ios-clang/features/sdk.prf
	mkspecs/unsupported/freebsd-g++46/qplatformdefs.h
	src/widgets/styles/qgtkstyle.cpp
	tests/auto/corelib/io/qdiriterator/qdiriterator.pro
	tests/auto/corelib/io/qfileinfo/qfileinfo.pro

Change-Id: Ia943555d1e59234a66f7dc65bdfda838e40001b5
2016-06-10 23:27:10 +02:00
Thiago Macieira
cbe62a0e6d Add move constructor to QDateTime
The move constructor is slightly more interesting than the copy
constructor because we can reset other to a short data state on 64-bit
systems. The assembly of that function is simply:

       mov    (%rsi),%rax
       mov    %rax,(%rdi)
       movq   $0x1,(%rsi)
       retq

The move-assignment operator for QDateTime was already there. There's no
need for one for QDateTime::Data since it's never called.

Change-Id: I06bae9392f534e45b3f1ffff144dffdd7f23b170
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2016-06-10 17:57:17 +00:00
Thiago Macieira
72393ac3b6 Allow QDateTime to shrink back to short data mode on copy
We won't shrink on manipulation when we have memory allocated, but it's
a good idea to create a non-shared copy if we can. It's an unlikely
scenario, though, because it requires the QDateTime object to have been
set to a large state then manipulated back into a small state.

Change-Id: I06bae9392f534e45b3f1ffff144dfee755bafa01
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2016-06-10 17:57:13 +00:00
Thiago Macieira
d1395b76cf Move the QDateTime file static functions to their right place
The file has an organization, so let's follow it. This commit has no
other changes besides moving code around.

Change-Id: I06bae9392f534e45b3f1ffff144e0b1f6dd72622
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2016-06-10 17:57:08 +00:00
Thiago Macieira
fb498a6519 Long live the short QDateTime optimization
Well, maybe not for so long: we may want to revisit it for Qt 6. At the
very least, we should enlarge the size of QDateTime on 32-bit system so
that they too can benefit from the optimization.

With this optimization, on 64-bit systems, the most common uses of
QDateTime now no longer allocate memory at all. The range is slightly
reduced from 584,554,049 years to 2,283,414 years around 1970. The other
drawback is that calling QDateTime::offsetFromUtc() on a localtime now
needs to recalculate the offset, instead of using the cached offset.
(QDateTime::toMSecsSinceEpoch() didn't use the cache).

Change-Id: Id5480807d25e49e78b79ffff144a8b2c9af91814
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2016-06-10 17:57:03 +00:00
Thiago Macieira
3eb5b15d80 QDateTimePrivate refactor: static'fy the date/time manipulators
This commit moves QDateTimePrivate functions setTimeSpec, setDateTime,
getDateTime, checkValidDateTime and refreshDateTime outside the
class. Like the previous commit, this is done in preparation for the
"Short QDateTime Optimization" as the "msecs" field will be placed in
the short data, if possible.

By making them file-level static, this also improves code generation, as
the compiler doesn't know whether it has to emit the class members for
out-of-line use or not.

Change-Id: I06bae9392f534e45b3f1ffff144df4d73cbc9184
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2016-06-10 17:56:57 +00:00
Thiago Macieira
97eae54083 QDateTimePrivate refactor: static'fy access to d->m_status
This commit changes most accesses to the d->m_status (including
d->spec() and d->setSpec() uses) to use new static functions. This is
done in preparation to the "Short QDateTime Optimization" as the status
byte will be kept in the short data.

Change-Id: I06bae9392f534e45b3f1ffff144dbd795d03227a
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2016-06-10 17:56:53 +00:00
Thiago Macieira
b726751cd1 Refactor & simplify QDateTime::setMSecsSinceEpoch
Change-Id: I06bae9392f534e45b3f1ffff144df5ce1aa52636
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2016-06-10 17:56:48 +00:00
Thiago Macieira
38a1f610ab Refactor & simplify QDateTimePrivate::refreshDateTime()
Change-Id: I06bae9392f534e45b3f1ffff144df51ae6159a97
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2016-06-10 17:56:45 +00:00
Thiago Macieira
8e12120a2b Simplify the QDateTimePrivate::setTimeSpec() function
Change-Id: I06bae9392f534e45b3f1ffff144df36cc98b5f3f
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2016-06-10 17:56:41 +00:00
Thiago Macieira
d3279b3217 QDateTime: fix the massageAdjustedDateTime differently
Instead of using a macro for maybe passing an extra parameter, pass the
d pointer and let the function decide what to use and what not to use.

Change-Id: I06bae9392f534e45b3f1ffff144dbeb68a30cb48
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2016-06-10 17:56:37 +00:00
Thiago Macieira
31b926d679 Move QDateTimePrivate::toMSecsSinceEpoch() code into QDateTime
Change-Id: I06bae9392f534e45b3f1ffff144dbad485814779
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2016-06-10 17:56:33 +00:00
Thiago Macieira
0358b87102 Remove QDateTimePrivate::isNull{Date,Time}()
They're superfluous, since b491fab02a
removed the distinction between null and invalid. Just use the
isValidXxx equivalents.

Change-Id: I06bae9392f534e45b3f1ffff144db9badad010fd
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2016-06-10 17:56:28 +00:00
Thiago Macieira
6d311a23ad Stop QDateTimePrivate from inheriting QSharedData
We're going to have to stop using QSharedDataPointer because of the
upcoming short-datetime-optimization. By dropping the inheritance, I am
also able to rearrange the members and remove the padding hole that
existed.

The second padding hole was removed in the previous commit, which merged
two 32-bit fields into one.

On 64-bit systems, there's no way around a remaining 4-byte hole
somewhere due to the odd number of 32-bit members. I chose to leave it
in the middle of the struct, before the m_timeZone member, instead of
tail padding, so that the layout of the first members structure are the
same in bootstrapped and non-bootstrapped builds. That should help
debugging the bootstrapped tools in Qt Creator. It's also now the same
in 32- and in 64-bit systems.

Change-Id: Id69569111e7d4e619e22ffff144b1fba708885f7
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2016-06-10 17:56:23 +00:00
Thiago Macieira
1a161c8ede QDateTimePrivate: merge the time spec, DST status and validity flags
Storing them in a single byte is the first step towards the Short
QDateTime Optimization.

The bump in the "private version" by 10 is to accommodate possible
changes in the Qt 5.7 branch.

Change-Id: Id5480807d25e49e78b79ffff144a59420457bcf0
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2016-06-10 17:56:18 +00:00
Mitch Curtis
ea86f73640 Mention extension in QFileInfo's suffix-related documentation
This makes it easier for users to find out how to get a file's
extension when browsing docs.

Change-Id: I08a1b620dea5432462133324824fae85754b9a09
Task-number: QTBUG-53380
Reviewed-by: Topi Reiniö <topi.reinio@theqtcompany.com>
2016-06-10 06:59:42 +00:00
Anton Kudryavtsev
1c9818c871 QString: use new QL1S::at() in lastIndexOf()
Make overloaded lastIndexOf() functions
more homogeneous.

Change-Id: If45aac88b43d26baf7f93caec3662a1085e26b97
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2016-06-09 18:01:50 +00:00
Thiago Macieira
b05741937c Plug padding holes in QHostAddressPrivate
On ABIs where quint64 is aligned on 8-byte boundaries (such 32-bit
Windows and all 64-bit systems), there was a padding hole of 4 bytes
between QHostAddressPrivate::a and the anonymous union. If we move the
member to after the union, there is no hole anymore.

That operation causes the tail padding to grow from 3 to 7 bytes. Since
we also don't need full 32 bits for the protocol, we can shrink the
structure by 8 bytes on those architectures and by 4 bytes on 32-bit
Unix systems.

Change-Id: I461e9fc7199748faa187ffff1415d6601a7bd777
Reviewed-by: hjk <hjk@theqtcompany.com>
2016-06-09 15:59:24 +00:00
Thiago Macieira
0a78d918f0 Replace qAllocMore with a pair of more useful functions
The first is "exact", not "more": qCalculateBlockSize. It ensures that
there's no overflow in multiplying, adding the header size or when
converting back to an int.

The second is the replacement for qAllocMore: it calculates the block
size like the first, but increases the block size to accommodate future
appends. The number of elements that fit in the block is also returned.

Task-number: QTBUG-41230
Change-Id: I52dd43c12685407bb9a6ffff13f5da09f816e667
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2016-06-09 15:32:14 +00:00
Thiago Macieira
43ff604f94 x86: Fix build with BMI but no LZCNT extensions
The GCC builtins for clzs and ctzs are enabled when the x86 extension
for LZCNT and TZCNT are enabled. The use of only __BMI__ in commit
f5f47987ce was incorrect.

But GCC needs both BMI and LZCNT enabled to enable this builtin.

Change-Id: I1cc7601489634e96833cfffd145647e9fc9f2f51
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2016-06-09 15:29:25 +00:00
Erik Verbruggen
923d869b0f Aarch64: vectorize ascii de-/encoding.
This works only on Aarch64, because the vaddv instruction is only
available on 64bit ARM. Doing something equivalent on 32bit ARM has the
high chance to run into micro-architecture differences: on an Cortex-a8,
transferring a single vector element from NEON to the regular CPU
registers takes 20 cycles(!).

Change-Id: Iccbfe84da82abb9b10f3f3dc35c8b950df69e251
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2016-06-09 08:06:04 +00:00
Thiago Macieira
48fd845c61 QElapsedTimer: Remove legacy code dealing with Windows pre-Vista and CE
GetTickCount64 is available on Windows Vista and WinRT. Since Windows CE
is no longer supported on dev, we don't need to dynamically resolve the
function anymore.

What's more, QueryCounterFrequency is documented to never fail since
Windows XP, so we haven't needed GetTickCount64 for years (no clue when
we dropped support for Win2k).

Change-Id: I115db302eb114bed8cd1fffd14558a81353d2aed
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-06-08 22:49:57 +00:00
Marc Mutz
a7ae92e67d QStringRef: add missing relational operators against QByteArray
QStringRef op QByteArray was ambiguous between

  bool QStringRef::operator op(const char*) const
  bool operator op(const QStringRef&, const QString&)

QByteArray op QStringRef was ambiguous between

  bool operator op(const QString&, const QStringRef&)
  bool operator op(const char*, const QStringRef&)

Fix by providing more overloads.

[ChangeLog][QtCore] Disambiguated the relational operators
comparing QByteArray with QStringRef (and vice versa).

Change-Id: I1cfa9ecfdd8b4102e652593faf35f6098289bc34
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2016-06-08 21:42:33 +00:00
Marc Mutz
f0d9eed064 QString: fix QChar <> QLatin1String relational operators for non-US-ASCII
The implementation used the QString::compare_helper(QChar*, int, char*, int)
overload, which, however, interprets the rhs as a UTF-8 sequence, not as
Latin-1.

Fix by using the (QChar*, int, QLatin1String) overload.

Extend the test to cover this case, too.

Change-Id: I59b26d63d0caec036b80ef8818c75d0cebe519d2
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-06-08 21:35:54 +00:00
Jake Petroules
e672fd5432 Remove QSysInfo code related to unsupported versions of Windows.
Change-Id: Ia28f17146d61724dbea73939793dfbd503546e56
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-06-08 21:21:55 +00:00
Luca Bellonda
767319a5aa Add support for 8bit encodings not ASCII compatible in QXMLStreamWriter.
When using a 8 bit encoding to write a file, a test discovers if the
encoding is really ASCII compatible by examining a letter and one of the
XML reserved characters. EBCDIC, in the current base, was not well
handled.

[ChangeLog][QtCore][QXmlStreamWriter] Fixed a bug that prevented the
generation of valid XML files when using encoding with 8 bit per
character but not ASCII compatible. QXMLStreamWriter generated XML
markup using always ASCII in this case.

Change-Id: I9c86a122dd91b2290d50c358638442f99777d4ae
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-06-08 18:50:25 +00:00
Thiago Macieira
e454e986d5 Move the Q_DECL_UNUSED attribute elsewhere to satisfy ICC 17
It doesn't like the attribute there. I think it's a compiler bug, but I
can't be sure because the part of the standard dealing with the
placement of attributes and where they apply is very complex. Exercise
left for the reader to determine if ICC is correct or not to reject it
there.

Change-Id: I87e17314d8b24ae983b1fffd1454bde826b7bcf4
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
2016-06-08 18:34:10 +00:00
Marc Mutz
5a15545ee2 QDebug: fix streaming of QChars
Commit 9ef3ff30 introduced a new function, putUcs4(), to
output QChar, char16_t, char32_t as a, possibly escaped,
character literal, but got the order of stream modifiers
wrong. Instead of applying the field width to the 'ucs'
streaming, it applied it to the prefix '\u'. The same
problem exists for the pad char, leading to the result
   '00\ue4'
for a QChar containing
  ä (LATIN SMALL LETTER A WITH DIAERESIS)

Fix by reordering the elements streamed so that the
prefixes come last.

Added a test.

Change-Id: I6eaa0586501b9e780aaa3bb5dcec0e5c2f86a219
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-06-08 18:29:38 +00:00
Giuseppe D'Angelo
982ef5b494 QSharedPointer/QWeakPointer/QScopedPointer: add comparison against nullptr
Some constructors were added, but the comparison operators were missing.
The STL has them, so we ought have them too.

Change-Id: I030c14a3b355988f509716b4b1b1a835b3ab9481
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2016-06-08 09:09:47 +00:00
Erik Verbruggen
997572d859 Use built-ins for qPopulationCount on MSVC and recent Clang versions.
Change-Id: Ib7e5f1129dda664d81f8a59bfa851ae70ef04542
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-06-08 08:03:31 +00:00
Anton Kudryavtsev
7a4ce3cbcc QString: remove unnecessary copy in replace()
When a copy is needed, replace_helper() takes
care of that for us.

Change-Id: I9e5c89cb70b2902c96062a9edaf77fedda6ddb2c
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2016-06-08 06:24:08 +00:00
Marc Mutz
862fa24179 Optimize QJsonObject::operator==
The old code iterated through one QJsonObject and looked up the key
in the other, comparing the values. It had linearithmic complexity,
and created one QString 'key' per element.

Since the entries in a QJsonObject are lexicographically ordered,
we can, however, just walk through the two objects in lock-step and
compare corresponding entries (at the same index) with each other.

Doing so saves O(N) QString creations and QJsonObject::value()
calls, and makes operator== linear in the number of elements.

Change-Id: Ib46ee0c1008b7f114454e282b6bd2bfcdbe59e2a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2016-06-08 04:38:20 +00:00
Alejandro Exojo
f9c60038bf Fix QVariantAnimation documentation
Since 5.0, this class is not abstract. Only the documentation of
updateCurrentValue was updated at that time. Fix the class reference and
the mentions of the class being abstract in the Animation Framework
overview.

Change-Id: I8ef9accb0b870dc8eb75bfc74361c7f2ad8d1d8b
Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io>
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
2016-06-08 04:32:45 +00:00
Giuseppe D'Angelo
bc9f8fd8de QSharedPointer/QWeakPointer/QScopedPointer: plaster API with Q_DECL_NOTHROW
Some methods were already marked, this adds noexcept to even more methods.

Change-Id: I420bb1cc985058c7976ce3a1f251fadbba7ddceb
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2016-06-07 21:09:42 +00:00
Richard J. Moore
b6d0c127f8 Make QCryptographicHash a Q_GADGET.
This makes the hash algorithm play nicely with qDebug.

Change-Id: I6db651cd5c73e8be65442dd68d6b865dcb975f4c
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2016-06-07 19:01:02 +00:00
Tor Arne Vestbø
87c426d5f4 Simplify Foundation conversion function documentation
The \fn command to specify the function signature is not needed when
the documentation precedes the function itself.

Change-Id: I9de0d1ae73af443f0beded77538d62cea85b5e72
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@theqtcompany.com>
2016-06-06 22:24:49 +00:00
Ralf Nolden
f969c50bc2 Remove obsolete a.out code after QT_AOUT_UNDERSCORE is gone
Old versions of OpenBSD and NetBSD mkspecs had the QT_AOUT_UNDERSCORE
define declared in their qplatformdefs.h to support systems still
using a.out format. As those systems are long obsolete and the defines
are removed, remove the obsolete code, too.

Change-Id: Ia9e2f2d6de81fb182ef4c995b29062afe570b8b9
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-06-06 16:20:51 +00:00
Liang Qi
57057f76ad Merge remote-tracking branch 'origin/5.6' into 5.7
Conflicts:
	.qmake.conf
	config.tests/unix/nis/nis.cpp
	mkspecs/unsupported/freebsd-g++/qplatformdefs.h
	src/corelib/tools/qdatetime.cpp
	src/corelib/tools/qsimd.cpp
	src/corelib/tools/qsimd_p.h
	src/network/access/access.pri
	src/network/access/qnetworkreplynsurlconnectionimpl.mm
	src/network/access/qnetworkreplynsurlconnectionimpl_p.h
	src/plugins/platforms/cocoa/qnsview.mm
	src/plugins/printsupport/windows/qwindowsprintdevice.cpp
	tests/auto/corelib/kernel/qobject/tst_qobject.cpp
	tests/auto/network/access/qnetworkreply/BLACKLIST
	tests/auto/widgets/widgets/qopenglwidget/BLACKLIST

Change-Id: I4b32055bbf922392ef0264fd403405416fffee57
2016-06-06 09:04:55 +02:00
Volker Krause
dc0ae02ebc CMake: Add imported target for qdoc.
Change-Id: Ic950a4171830c83fb44cab13f79e593e5ea1ed52
Reviewed-by: Stephen Kelly <ske@ableton.com>
2016-06-05 08:38:38 +00:00
Jake Petroules
95ea1b1aa8 Remove all code paths related to unsupported Apple platforms.
Now that the minimum deployment target (and thus SDK) is 10.9 for OS X
and 7.0 for iOS, all code paths affecting platform versions lower than
the aforementioned are removed.

Change-Id: Id985c7259c4ac069319d88f2c29c9559ae9e8641
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
2016-06-04 09:24:33 +00:00
Thiago Macieira
2f01e04d8f QObject::connect: reduce generated code size for statics and functors
Instead of placing the assignment of false in the impl() function, move
it to the inline QSlotObjectBase::compare() function. That means it's
assigned in one place (two, actually, inside qobject.cpp), instead of
for every static member, non-member or functor we connect or disconnect.

Change-Id: I87e17314d8b24ae983b1fffd1453623ad4c4dcb2
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2016-06-03 22:14:49 +00:00
Anton Kudryavtsev
86b612d037 QXmlStreamWriter: don't call virtual QTextCodec::name() twice
Just cache and reuse result.

Change-Id: I2ada2eced7c272c041013d35b59eeb176ed04659
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2016-06-03 08:38:26 +00:00
Thiago Macieira
3ec57107ce Windows: stop using _beginthreadex on regular builds
This commit also reverts fecaa6aae8.

The Microsoft documentation says _beginthreadex and _endthreadex are
used to initialize the C/C++ runtime and are necessary when linking to
libcmt(d).lib (that is, when using the -MT or -MTd options). For regular
builds linking against the .dll runtime, there should be no impact.
Inspection of the CRT source code which gets installed with Visual
Studio or Windows SDK proves that.

It's preferable to use CreateThread directly as _endthreadex will try to
call FreeLibraryAndExitThread, which can cause a deadlock if we try to
wait for the thread to exit from a global destructor.

For -MT builds, since there can be no DLLs, it's not a problem to
continue to use _beginthreadex and follow Microsoft's recommendation.

Task-number: QTBUG-53031
Change-Id: Id5480807d25e49e78b79ffff144af62c3c59dfe0
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2016-06-02 22:16:47 +00:00
Jake Petroules
49e49bdbe1 Remove reliance on QSysInfo::[Mac|Windows]Version in QSysInfo itself.
Those enumerations and their associates are being deprecated,
and so the backing of their replacements cannot rely on it.

Change-Id: Id544aa757313065f435b5e66cd0475975cd5b825
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-06-02 22:16:27 +00:00
Thiago Macieira
7b8a553a13 Remove the code for QObject::connect for non-C++11 compilers
It's required now in Qt 5.7 (at least the required features of rvalue
references and variadic templates)

Change-Id: I87e17314d8b24ae983b1fffd145364c52f9bb6c3
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2016-06-02 20:52:53 +00:00
Friedemann Kleint
740470457e Simplify constructor code of QTemporaryFile.
Pass the name as parameter to the constructor of QTemporaryFilePrivate
and use delegation in the convenience constructors.

Change-Id: I4087600b804fe22910b4985a59a02547f54a6acd
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2016-06-02 12:58:26 +00:00
Joerg Bornemann
5803a9ba57 Remove Windows CE vestiges
Remove every usage of the _WIN32_WCE macro outside of 3rd party
source code directories.

Change-Id: Ia7e859bd6dcaef10c66674612c8e440f9a2dee56
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2016-06-02 08:03:37 +00:00
Liang Qi
688f70634c Merge remote-tracking branch 'origin/5.6.1' into 5.6
This merge also blacklists a flaky tst_QGL::clipTest test on
OpenSUSE 13.1.

Conflicts:
	src/network/socket/qnativesocketengine_winrt.cpp
	tests/auto/opengl/qgl/BLACKLIST

Task-number: QTBUG-53133
Change-Id: I14b431aa5a189b7dd1d3e2dfff767d15df20fde3
2016-06-02 06:01:25 +02:00
Thiago Macieira
e81877218b Revert "QObject::connect: reduce generated code size for statics and functors"
This reverts commit 2e4191eadc. The change
is backwards compatible but not forwards, so it can't appear past the .0
release.

Change-Id: I390c5e80795a9b3b27f6edcab79f7892a79c3564
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2016-06-01 23:41:31 +00:00
Marc Mutz
bbb440bab2 QJsonValue: fix use-after-free in assignment operator
The assignment operator of a String QJsonValue that holds
the only remaining reference to the QString::Data block
was freeing the block before obtaining its own reference,
leading to a use-after-free in the case where *this was
passed as 'other' (self-assignment).

Fixed by reformulating the assignment operator in terms
of the copy ctor, using the copy-swap idiom, with the
twist that QJsonValue doesn't, yet, have a swap member
function, so we use three per-member qSwap()s.

Change-Id: I3c5ccc4d9f32c7593af3fc6a0edbf12b7feb1391
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
2016-06-01 20:59:16 +00:00
Ralf Nolden
d96057328a Compile fix: add OpenBSD define for ffsll usage
On OpenBSD, ffsll needs to be defined to compile. This is the
same change as in commit 725a9c2702
for NetBSD.

Change-Id: I3060caa10950a9419084a12de8c88a2f98b34d07
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-06-01 10:35:48 +00:00
Ralf Nolden
3432742caa Merge BSD implementations of QLockFilePrivate::processNameByPid()
Until now, several solutions for the implementations of
processNameByPid() on BSD systems existed:
- one for FreeBSD using libutil through kinfo_getproc()
  using sysctl() implicitly
- one for GNU/kFreeBSD using sysctl() explicitly added in commit
  a8f4fa217d

OpenBSD and NetBSD also had different approaches in their ports patches
using kvm() and sysctl(). The code unifies this for all BSDs using
sysctl().

Change-Id: Iced9ef01e5966d8688f464f51024a7ed562e26a3
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Dmitry Shachnev <mitya57@gmail.com>
2016-06-01 10:35:39 +00:00
Thiago Macieira
2e4191eadc QObject::connect: reduce generated code size for statics and functors
Instead of placing the assignment of false in the impl() function, move
it to the inline QSlotObjectBase::compare() function. That means it's
assigned in one place (two, actually, inside qobject.cpp), instead of
for every static member, non-member or functor we connect or disconnect.

Change-Id: I87e17314d8b24ae983b1fffd1453623ad4c4dcb2
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2016-05-31 19:40:03 +00:00
Olivier Goffart
375c5a0076 Properly forward-declare the Apple types with Q_QDOC
They are needed for the header to be parsed properly with clang based qdoc.

While we are at it, change the condition from Q_OS_MAC to Q_OS_DARWIN

Change-Id: I2a2f9c1159f47795d9811023d67c86fec1866846
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
2016-05-31 17:20:56 +00:00
Erik Verbruggen
e70324f8dd Remove _bit_scan_{forward,reverse}
Use qCountTrailingZeroBits and qCountLeadingZeroBits from qalgorithms.h
instead. Also extended these versions for MSVC. The _bit_scan_* versions
stem from a time before the glorious days of qalgorithms.h. A big
advantage is that these functions can be used on all platforms.

Change-Id: I5a1b886371520310a7fe16e617635ea335046beb
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2016-05-31 12:09:52 +00:00
Jake Petroules
e8224f8149 Fix unimplemented Mach-O parsing for ARM64 platforms in QPluginLoader.
Change-Id: I4853b5ce1691bd84578ebe46af9f73270598387a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-05-30 20:36:14 +00:00
Joerg Bornemann
2f0ffba638 Fix emission of QProcess:errorOccurred
Consistently use setErrorAndEmit to emit errorOccurred and the
deprecated error signal.

Change-Id: I8bc7634a72d4d13f74bbf76547de08271dfcbb59
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
2016-05-30 16:11:53 +00:00
Anton Kudryavtsev
e4d838ff9d QDateTimeParser: adapt to make good use of QStringRef.
Avoid unnecessary allocations.

Create QString from QStringRef only where necessary.

Change-Id: I8f2a7dce51430162c84328e23ab3cc071227d6ae
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-05-30 15:21:23 +00:00
Aleksei Timofeyev
886086f5d3 QWindowsPipeWriter: Discard queued signals in stop()
The _q_queueBytesWritten signal may be already queued from the event loop
at the time when stop() is called. We do not want to emit signals once
stopped, so reset all respective state variables.

Change-Id: I343e1702955e0bbc1d11930d19e75dab6e129b4c
Reviewed-by: Alex Trotsenko <alex1973tr@gmail.com>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2016-05-30 09:05:43 +00:00
Ralf Nolden
b403b8c094 Add Interix OS system detection defines
NetBSD (pkgsrc) ports are building qt on Interix as well, where the
necessary defines are missing for in qsystemdetection.h.

Patch for adding them provided by NetBSD ports maintainer
Kamil Rytarowski <n54@gmx.com>

Change-Id: I769c47f623317efda3130a7061307e84d3350fac
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-05-30 05:07:15 +00:00
Thiago Macieira
32c301e229 Fix crash when connecting a non-PMF with Qt::UniqueConnection...
...if a PMF connection had already happened. Since UniqueConnection
isn't implemented for non-PMFs (functors and lambdas aren't comparable,
even if static member functions or non-member functions are), we pass a
null pointer for comparison argument. The disconnect() code already
protected against a null pointer there, but not the connect code path
with Qt::UniqueConnection

Change-Id: I87e17314d8b24ae983b1fffd145324beced0494d
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Reviewed-by: Dario Freddi <dario.freddi@ispirata.com>
2016-05-30 00:19:39 +00:00
Thiago Macieira
6d31d3e7ef Fix build with ICC on OS X: __Z18qt_getQtMetaObjectv was undefiend
It's inline, but the compiler did not inline it properly from Objective
C++ sources.

Undefined symbols for architecture x86_64:
  "__Z18qt_getQtMetaObjectv", referenced from:
      __ZN2Qt20qt_getEnumMetaObjectENS_15ScrollBarPolicyE in qlocale_mac.o
      ...

Change-Id: Ie9fd7afe060b4e4a8052fffd144fda60c50a9779
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-05-29 18:49:08 +00:00
Orgad Shaneh
261f9101dd QLockFile: Use a more robust stale file detection
When a process that locked a lockfile crashes on Windows, sometimes
a new instance of the process fails to lock.

Unfortunately, I can't find a way to reproduce the problem consistently,
but it happens from time to time with Qt Creator and Qbs.

There are several ways to detect a dead process on Windows. Some of
them can be found in stackoverflow[1].

The current implementation of stale lock detection is based on the
second answer (using WaitForSingleObject), but apparently it doesn't
work in 100% of the cases.

The most voted answer[2] (using GetProcessExitCode) proves to work also
on this case.

[1] http://stackoverflow.com/q/1591342/764870
[2] http://stackoverflow.com/a/1591379/764870

Task-number: QTBUG-53392
Change-Id: Ied7bf00985d0f12e833b887a0143f7bdeee3e772
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-05-29 18:47:56 +00:00
Thiago Macieira
73e943d967 Clang: remove the QT_NO_RTTI macro declaration
It's not used anywhere in Qt and this was the only definition.

Change-Id: Id69569111e7d4e619e22ffff144daa82a1259cbd
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com>
2016-05-29 18:47:17 +00:00
Thiago Macieira
a7adf3ea1d Remove the Clang __has_feature(cxx_exceptions) check
The check in qglobal.h for __EXCEPTIONS is enough. This check here was
causing moc to define QT_NO_EXCEPTIONS

Change-Id: Id69569111e7d4e619e22ffff144daa661df4181d
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com>
2016-05-29 18:47:13 +00:00
Thiago Macieira
0f559a2d99 Force the use of the C++11 alignof keyword instead of an extension
If the compiler supports C++11 alignof, let's use it. No point in
perpetuating the use of __alignof__ or __alignof.

There's a fallback implementation in qglobal.h that works even without
compiler extensions. We can't drop it just yet (alignas is not a
required C++11 feature), but at this point I doubt that fallback is used
anywhere anymore.

The tst_compiler test was wrong to use alignof(variable). That's not
permitted by the standard nor would it work with our fallback
implementation. MSVC 2015 enforces this, but ICC, GCC and Clang don't.

Change-Id: Ifea6e497f11a461db432ffff1448abfa86672c63
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2016-05-29 18:45:13 +00:00
Ralf Nolden
c85f988fc7 Disable thread_local on clang for FreeBSD
FreeBSD's clang currently is not able to handle thread_local calls due
to linker errors on __cxa_thread_atexit. The patch disables the
define Q_COMPILER_THREAD_LOCAL for clang __FreeBSD__ only, no functional
change. Otherwise, linking the tst_compiler autotest will fail.

For details, see
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=192320

Change-Id: I2395c06499d4821213e2154769ccbeed3dcf1ffe
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-05-27 19:40:43 +00:00
J-P Nurmi
bbf596890f Expose QFileSelectorPrivate::selectionHelper()
Let QQuickStyleSelector in Qt Quick Controls 2 re-use the same
selection helper implementation.

Change-Id: I34cbba0aa178e342bb4004313e7ff56811e6be19
Reviewed-by: Liang Qi <liang.qi@qt.io>
2016-05-27 12:23:21 +00:00
Lorenz Haas
a7372fd79d Add QLineF::center() returning the point in the center of the line
[ChangeLog][QtCore][QLine/QLineF] Added center().

Change-Id: I6dcfa9e839190c0a4caf36fb6ecd01b37d65d274
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2016-05-27 08:49:44 +00:00
Shawn Rutledge
9224255f13 QVector: silence clang warning about memmove
Also made a small comment fix

Task-number: QTBUG-53605
Change-Id: Ica9a06fe7a70f92f2a19a6df3ffdeaf1985e2eb6
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com>
2016-05-27 07:15:40 +00:00
Thiago Macieira
5fe16358bb Fix use of QMutex on Linux before FUTEX_PRIVATE_FLAG was added
It was added in 2.6.22. If we pass it to 2.6.21, we'll get -ENOSYS,
which is bad for QMutex. This fix simply defines it to 0 if the header
doesn't define it.

But as a consequence: if Qt is built with newer kernel headers, it won't
run on older versions. It's not likely that someone is still using Qt
5.7 on a 2.6.21 kernel (v2.6.21.7 was released on 2007-08-04).

Change-Id: Icb178bb113bb437c9b67fffd1451dd7bb964f0c8
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2016-05-26 18:31:22 +00:00
Thiago Macieira
5c2ff22ba1 Use void instead of uchar in the endian-swapping function parameters
This allows us to pass pointers to storage that is not an array of
uchar, which it hardly ever is.

Change-Id: Ifea6e497f11a461db432ffff14490d2c2df21906
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2016-05-26 18:02:49 +00:00
Liang Qi
2fb026d58b Merge remote-tracking branch 'origin/5.6.1' into 5.7.0
Conflicts:
	src/corelib/tools/qsimd_p.h
	src/network/socket/qnativesocketengine_winrt.cpp

Change-Id: I2765b671664c2a84839b2f88ba724fdf0c1fa7c6
2016-05-26 13:04:32 +02:00
Erik Verbruggen
5904822b50 Squeeze more vectorized rounds out of JSON Latin1String conversion.
E.g. for a string of length 16, with i == 0, this loop can still run.
Same for the case where length is 8.

Change-Id: Ie95832b50ddeba2e0dfb0e3308e4c7a5376bb969
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-05-26 08:45:36 +00:00
Laszlo Agocs
184b2ea4ea Check for CRC32 properly
Just being on ARMv8 does not mean CRC32 (and arm_acle.h) is available.

Task-number: QTBUG-53629
Change-Id: I104f643f2d59620e1f4d1ef814a1de71bb484e7b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-05-26 04:26:04 +00:00
Thiago Macieira
540978288e Replace qUnaligned{Load,Store} with the existing q{To,From}Unaligned
Move the Q_ALWAYS_INLINE and forcing of __builtin_memcpy to the existing
functions.

Change-Id: Icaa7fb2a490246bda156ffff143c137e520eea79
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
2016-05-25 15:46:17 +00:00
Ralf Nolden
e0ab94b525 Compile fix: for OpenBSD: <sys/select.h> not included by <sys/types.h>
On OpenBSD, <sys/select.h> isn't included in <sys/types.h>, so that
leads to compile errors on files that include qcore_unix_p.h:

qcore_unix_p.h:335:69: error: 'fd_set' has not been declared

Just move the whole select include section from qcore_unix.cpp, no
functional changes.

The patch is adapted from OpenBSD ports maintainer Vadim Zhukov
<persgray@gmail.com> patch for qt ports.

Change-Id: I35ba693440b1c1644bcfcdb69823e2b37870ad97
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-05-25 11:45:19 +00:00
Thiago Macieira
cd25866f65 Use the code we already have for parsing the transition time too
It's there and it's more efficient anyway.

Change-Id: Ie9fd7afe060b4e4a8052fffd144fc40647430268
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Brett Stottlemyer <bstottle@ford.com>
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
2016-05-24 19:31:47 +00:00
Thiago Macieira
e9041c7fc1 Fix parsing of tzfile(5) POSIX rule zone names with bracket quotes
POSIX.1-2001 allows quoting a zone name so that it can contain other
characters besides letters, by enclosing it in angle brackets ('<' and
'>'). This hadn't been used until recently (tzdata2016b), when the
Asia/Barnaul rule started using a zone name "+07" (the name variable
contained the value "<+07>-7").

Thanks to Paul Eggert for reporting and investigating the root cause.

Task-number: QTBUG-53071
Change-Id: Id5480807d25e49e78b79ffff1449bc410776cb66
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
2016-05-24 19:31:40 +00:00
Thiago Macieira
b084739b89 Revert "QMutexPool: avoid QVarLengthArray of QAtomicPointers"
This reverts commit 4579d966af.

This causes a miscompilation with ICC 16 on Windows (MSVC 2015 ABI): the
vector created by new[] with () in:

      mutexes(new QAtomicPointer<QMutex>[size]()), // (): zero-initialize

does not actually zero-initialize (see disassembly in the bug
report). This is definitely a compiler bug.

Since we plan on removing QMutexPool in Qt 5.8 anyway, let's just revert
the patch.

Task-number: QTBUG-53360
Change-Id: I06bae9392f534e45b3f1ffff144e823b747e7962
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
2016-05-24 17:54:54 +00:00
Liang Qi
4e41babd03 Merge "Merge remote-tracking branch 'origin/5.7' into dev" into refs/staging/dev 2016-05-24 05:44:45 +00:00
Liang Qi
56d6e000f7 Merge remote-tracking branch 'origin/5.7' into dev
Conflicts:
	mkspecs/wince80colibri-armv7-msvc2012/qmake.conf
	qmake/generators/win32/msvc_vcproj.cpp
	src/corelib/global/qnamespace.h
	src/corelib/global/qnamespace.qdoc
	src/corelib/io/qfsfileengine_win.cpp
	src/corelib/tools/tools.pri
	src/network/ssl/qsslconfiguration_p.h
	src/plugins/platforms/linuxfb/qlinuxfbscreen.cpp
	src/plugins/platforms/windows/windows.pri
	src/src.pro
	src/tools/bootstrap/bootstrap.pro
	src/tools/uic/cpp/cppwriteinitialization.cpp
	src/widgets/dialogs/qfilesystemmodel.cpp
	tests/auto/testlib/selftests/expected_cmptest.teamcity
	tests/auto/testlib/selftests/expected_cmptest.txt

Change-Id: I4d2ac78f0dcc97f008186bbbc769c6fe588ab0e5
2016-05-23 21:09:46 +02:00
Thiago Macieira
f156c81d7f Restore the -fno-lto build of qversiontagging.cpp
I'm not sure how one of my machines has this problem and the other
doesn't (same distribution and same compiler version). Must be operator
error. But this is required to compile QtGui when QtCore was compiled in
LTO mode.

qversiontagging.cpp used to be built with -fno-lto before commit
629ceec208. This commit restores that
functionality, but not the clang "-no-integrated-as" part.

Change-Id: Ie9fd7afe060b4e4a8052fffd144fb9c1a1166854
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
2016-05-23 18:22:15 +00:00
Lars Knoll
aa2a310267 Deprecate QLibraryInfo::licensee()/licensedProducts()
This info wasn't really very helpful, and would anyway always
contain either Preview, OpenSource or an empty string for
commercial users.

Change-Id: I311b991834fa83cf1a183083acd5112cda3d2e41
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
2016-05-23 11:19:45 +00:00
Ralf Nolden
e3d1058ae9 Compile fix for NetBSD: only BSD using statvfs, disable f_flags define
Compile fix for NetBSD's use of statvfs having f_flags.All other BSDs use
statfs instead of statvfs, so the f_flags define needs to be prevented
on NetBSD.

Fix obtained from Kamil Rytarowski <n54@gmx.com>, NetBSD qt ports
maintainer.

Change-Id: Ifbd7ba0cba7f6cf280f5984c64abd7649f667332
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-05-23 09:51:35 +00:00
Ralf Nolden
f8c3820de7 Compile fix: remove unused variable bool isEmpty
The local variable isEmpty triggers a compile warning with GCC:
variable ‘isEmpty’ set but not used [-Werror=unused-but-set-variable],
so remove the variable assignment and declaration.

Error is triggered on FreeBSD and NetBSD with gcc.

Change-Id: I37bdb3408ad69093708f2d4bdb04392da66e04e5
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-05-23 09:51:30 +00:00
Ralf Nolden
725a9c2702 Compile fix: add NetBSD define for ffsll usage
On NetBSD, ffsll needs to be defined to compile. The fix adds the
according Q_OS_NETBSD define to the list of operating systems
needing the define.

Fix obtained from NetBSD port maintainer Kamil Rytarowski <n54@gmx.com>
via IRC.

Change-Id: I966a7b3fba43fb56e72f19f6b7f7cacc19c3c6cf
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-05-23 09:51:26 +00:00
Ralf Nolden
9b153f989b Compile fix: convert argument to long to match parameter comparison
GCC creates a warning "enumeral and non-enumeral type in conditional
expression" as the types of the two arguments don't match. Fix
the compile warning by converting the first argument to (long) to match
the type of the second parameter.

Fix confirmed to work on NetBSD and FreeBSD, obtained from
Kamil Rytarowski <n54@gmx.com>, NetBSD qt ports maintainer.

Change-Id: I777dd066a0a8cc8a46e34bd39b256882080a7773
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-05-23 09:51:22 +00:00
Ralf Nolden
14ae00dd50 Compile fix: undefine types before defining them
On NetBSD, the types uint64_t, uint32_t and uint8_t
are already defined in sys/types.h which leads to compile errors.
Those types need to be properly undefined before defining
them with the Qt code.

Change-Id: Icd58f421619f15b899cf5c5de1cfb22a519a4e4b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-05-23 09:51:18 +00:00
Ralf Nolden
e91be71ef0 Add OpenBSD to list of BSD systems defines using kqueue too
Besides FreeBSD and NetBSD, OpenBSD uses kqueue too, so
add the according Q_OS_OPENBSD define here to make that work.
Patch obtained via OpenBSD qt ports maintainer Vadim Zhukov
<persgray@gmail.com> from OpenBSD qt ports patches.

Change-Id: Ib9e6f6303b661beb88666bd3c2bf36a77e929f9d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-05-23 09:51:13 +00:00
Laszlo Agocs
20211c4213 Avoid failing on 64-bit ARM
Affects systems like the NVIDIA DRIVE CX. This did not show up so far
because there was no error when Q_PROCESSOR_ARM was not set.

Task-number: QTBUG-53493
Change-Id: I107155b6dc1a881eca6f57374ad8db4458875243
Reviewed-by: Dominik Holland <dominik.holland@pelagicore.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-05-19 18:28:07 +00:00
Maurice Kalinowski
34fd680802 winrt: Remove explicit exit call
8c3ae221 introduced a mean to actually close an application. Otherwise
the application was in an undefined state and did not exit.

Since 5.6 we switched to Xaml and the explicit call to Exit() is not
required anymore. This also allows using multiple application objects
sequentially as the unit tests do in some cases.

Change-Id: I9030afec72a4534e818c77c373dc3a81b922a480
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2016-05-19 17:07:44 +00:00
Tor Arne Vestbø
b88573e29b Collate conversion functions for Core Foundation/Foundation types
Makes it easier to apply similar changes across all related functions,
and to implement functions for new types by having the previous
approaches available in one place.

Change-Id: I3f0590d67d0e6deb1c6c856ab1de96b55b6af058
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
2016-05-19 11:20:36 +00:00
Liang Qi
818014b449 Merge remote-tracking branch 'origin/5.6' into 5.7
Conflicts:
	configure
	src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Renderer11.cpp
	src/network/access/qnetworkaccessmanager.cpp
	src/plugins/platforms/cocoa/qcocoacolordialoghelper.mm
	src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmcursor.cpp
	src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmcursor.h
	src/widgets/widgets/qlineedit_p.cpp
	src/widgets/widgets/qlineedit_p.h
	src/winmain/winmain.pro
	tests/auto/corelib/io/qstorageinfo/tst_qstorageinfo.cpp
	tests/auto/dbus/qdbusconnection/tst_qdbusconnection.cpp
	tests/auto/dbus/qdbusconnection/tst_qdbusconnection.h
	tests/auto/testlib/selftests/expected_cmptest.teamcity
	tests/auto/testlib/selftests/expected_cmptest.txt
	tests/auto/widgets/itemviews/qtableview/tst_qtableview.cpp
	tools/configure/configureapp.cpp

Change-Id: Ib9997b0d0f91946e4081d36c0c6b696c5c983b2a
2016-05-19 12:55:27 +02:00
Liang Qi
640441882d Merge remote-tracking branch 'origin/5.6.1' into 5.6
Conflicts:
	src/network/socket/qnativesocketengine_winrt.cpp

Change-Id: I8edb72f8ba958d80c3d7993b3feaaae782ca8d9c
2016-05-19 06:31:06 +02:00
Mike Krus
03e9c6f4a6 Add support for Apple tvOS
Pass -xplatform macx-tvos-clang to configure to build.
Builds device and simulator by default.

Added ‘uikit’ platform with the common setup.
Also added QT_PLATFORM_UIKIT define (undocumented).
qmake config defines tvos (but not ios).

tvOS is 64bits only (QT_ARCH is arm64) and requires bitcode to be
embedded in the binary. A new ‘bitcode’ configuration was added.
For ReleaseDevice builds (which get archived and push to the store),
bitcode is actually embedded (-fembed-bitcode passed to clang). For all
other configurations, only using bitcode markers to keep file size
down (-fembed-bitcode-marker).

Build disables Widgets in qtbase, and qtscript (unsupported,
would require fixes to JavaScriptCore source code).

Qpa same as on iOS but disables device orientation, status bar, clipboard,
menus, dialogs which are not supported on tvOS.

Change-Id: I645804fd933be0befddeeb43095a74d2c178b2ba
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com>
2016-05-17 16:11:23 +00:00
Ralf Nolden
bfa53e1c67 Compile fix: remove _POSIX_C_SOURCE usage
Remove _POSIX_C_SOURCE usage as the reason why it was added is not
clear anymore and it causes compile errors on BSD systems if not
circumvented by adding further defines to re-enable function calls
hidden by the _POSIX_C_SOURCE define. (__BSD_VISIBLE on FreeBSD/OpenBSD
and _NETBSD_SOURCE on NetBSD)

Change-Id: Ic6b49ddcd6c481b0f2acd598cea5470604e00507
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-05-17 16:10:41 +00:00
Joerg Bornemann
fade295814 Remove qt_cancelIo helper function
We can now directly use CancelIoEx. The fallback to CancelIo
was needed for supporting Windows XP.

Change-Id: I24a53a774caf695e6006f24a914abaa5ab204035
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2016-05-17 14:47:20 +00:00
Olivier Goffart
45eba73492 Fix QVariant conversion to an enum type.
QVariant::canConvert<Enum> was returning true for everything can can be converted
to integer, but not for integer itself. That's because in QVariant::canConvert
we set the targetType to Int of it's an enum, but the Int->Int case was not
on the conversion matrix. So this commits adds it to the conversion matrix
and now QVariant::canConvert<Enum> returns consistently true for int itself.

But even tough canConvert returned true, it did not actualy do any conversion
to the enum type itself. Fix that by handling the case properlt in 'convert'

[ChangeLog][QtCore][QVariant] Fixed QVariant::canConvert and conversion from
integer types to enumeration types.

Task-number: QTBUG-53384
Change-Id: I6ac066f3900e31bfcea7af77836ddfc7730bd60b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-05-16 15:58:28 +00:00
Shawn Rutledge
28fab27503 add AA_CompressHighFrequencyEvents to control compression on xcb
7edd10e6c added this compression feature, but some applications may
need to disable it.

[ChangeLog][X11] It's now possible to unset AA_CompressHighFrequencyEvents
to disable the new X event compression feature that was added in 5.6.0.
This is a replacement for the WA_NoX11EventCompression flag in Qt 4.

Task-number: QTBUG-44964
Change-Id: I37a9c8a4831f1c02eda0f03b54125f3255d25500
Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io>
2016-05-15 08:05:29 +00:00
Thiago Macieira
dc40abe925 Move out the code to extract the backtrace to another function
This will make it easier to use create backtraces in other contexts.

Change-Id: I56b838ab04d9810108fcdb7f8c2fd91255864850
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2016-05-13 21:42:45 +00:00
Marc Mutz
9e4639060e Move q{Set,}GlobalQHashSeed() to the correct header file
The <QHash> only contains the container these days,
while <QHashFunctions> contains the qHash() function
overloads and related functions. This is where these
two functions belong, too.

This change is BC and SC, since qhash.h includes
qhashfunctions.h.

Change-Id: I2e7febb0ffca209af67fb9f2cd363596867a44e1
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-05-13 19:41:15 +00:00
Anton Kudryavtsev
432d3b6962 QDateTimeParser: use QStringRef more
Avoid unnecessary allocations.

Change-Id: I217ba3fe20293f5cdeeaac2dfae15f837cda51e0
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-05-13 05:25:55 +00:00
Thiago Macieira
c9998b8af3 Fix build with GCC <= 4.2 (FreeBSD 9.x)
15b42af111 changed the qt_cpu_features
variable to be an array and never fixed this #if branch of the code.

Change-Id: Id69569111e7d4e619e22ffff144cf930f86f478e
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2016-05-12 18:31:19 +00:00
Giuseppe D'Angelo
4dc29bc9de QSharedPointer: move QDebug stream operators into qdebug.h
In order to avoid pulling in QDebug when including QSharedPointer.

Change-Id: I14b86d1f100ed44a68258c91bbda394b655bac83
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-05-12 16:41:32 +00:00
Leena Miettinen
d6fbb9070f Doc: Remove references to obsolete reset() function
...from the docs of the signals it emits.

Task-number: QTBUG-53228
Change-Id: Ifdd91404cae9dd6480ae29b31f2a48fa024df442
Reviewed-by: Nico Vertriest <nico.vertriest@theqtcompany.com>
2016-05-12 12:15:57 +00:00
Topi Reinio
72e3fcce38 Doc: Remove repository name from examplesinstallpath
Examples in binary packages now directly match the install path.

Change-Id: Ic1487bc766cfd3b0a0a340cc4ae4ba49d953eaa6
Task-number: QTBUG-52953
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
2016-05-12 12:15:52 +00:00
Oswald Buddenhagen
adf85c09b4 Merge 5.6 into 5.6.1
Change-Id: I22003b840f1a7ac685a1ec3353d7e7dbd84c3953
2016-05-12 11:17:23 +02:00
Friedemann Kleint
feaef44559 Windows: Suppress error dialogs when querying logical drives.
Set the error mode flag SEM_NOOPENFILEERRORBOX when calling Win32 API
GetLogicalDrives() to prevent it from prompting to insert media
as does QStorageInfoPrivate::mountedVolumes().

Task-number: QTBUG-18729
Task-number: QTBUG-32457
Change-Id: I5c76afbb5bf2ec5ec84194650c316fe531578d5b
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2016-05-12 06:58:06 +00:00
Liang Qi
990969655c Merge remote-tracking branch 'origin/5.7' into dev
Conflicts:
	config_help.txt
	configure
	src/corelib/io/qprocess_wince.cpp
	src/plugins/platforms/windows/qwindowstheme.cpp
	src/plugins/platforms/xcb/qxcbbackingstore.cpp
	tests/auto/corelib/tools/qtimezone/BLACKLIST
	tests/auto/network/socket/qudpsocket/tst_qudpsocket.cpp
	tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp

Change-Id: I26644d1cb3b78412c8ff285e2a55bea1bd641c01
2016-05-12 08:33:08 +02:00
Thiago Macieira
9ef59b586d QMutex: make FUTEX_PRIVATE_FLAG a mandatory feature
The flag was introduced in kernel 2.6.22, but we're already depending on
features added on 2.6.23 in qcore_unix_p.h (pipe2, dup3, O_CLOEXEC) and
2.6.27 in qnet_unix_p.h (accept4 and SOCK_CLOEXEC).

Change-Id: Id5480807d25e49e78b79ffff144a093c9e30cd96
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-05-11 22:22:50 +00:00
Marc Mutz
e2e0dfee7c QtCore/QtDBus/QtSql: port the last remaining Q_FOREACH loop and add QT_NO_FOREACH
Port the last remaining Q_FOREACH user in QtCore to
C++11 range-for and mark QtCore, QtSql and QtDBus as
Q_FOREACH-free, using QT_NO_FOREACH.

Change-Id: Ia6f99139cb1ca4a8bbe9e445421592242e048b0a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-05-11 16:55:37 +00:00
Marc Mutz
81793b8b58 Add QT_NO_FOREACH to disable foreach and Q_FOREACH
It has been known for a long time that Q_FOREACH produces
inferior code to other looping constructs, and the use of it
in Qt library code was informally frowned upon since forever
(pun intended).

Yet, to this day, several thousand foreach/Q_FOREACH loops
have been added to Qt libraries, and while many were ported
to range-for in Qt 5.7, there are still new ones added every
day, which is a nuisance, to say the least.

This patch introduces a technical way to prevent new foreach
use to creep into Qt libraries after they have been cleaned,
by simply not defining either Q_FOREACH or foreach when the
QT_NO_FOREACH macro is defined. This way, one library at a
time can be ported away, and, once ported, is guaranteed to
actually stay ported.

Change-Id: Ie042e84d6c7d766bd16095f9bc1118a8e0ce0c7a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-05-11 16:55:22 +00:00
Anton Kudryavtsev
361564dacf QDateTimeParser: adapt unquote() to make good use of QStringRef.
Avoid unnecessary allocations.

Change-Id: I9bed622c0dd7d9fe993b52d9169d1773957da4f2
Reviewed-by: Edward Welbourne <edward.welbourne@theqtcompany.com>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2016-05-11 06:44:22 +00:00
Anton Kudryavtsev
c6618cb885 QDateTimeParser: de-duplicate calls and cache results
Change-Id: I0d6065fbdd19acff14072ff626585e8a12a3e073
Reviewed-by: Edward Welbourne <edward.welbourne@theqtcompany.com>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2016-05-11 06:44:11 +00:00
Thiago Macieira
967c91e777 Make it an #error if we failed to detect the ARM architecture version
... or if it is less than ARMv5. The last ARMv4 Qt supported was Windows
CE 7, which was dropped for Qt 5.7 alongside MSVC 2008.

Change-Id: Ifc817705441a4aab9469ffff141dcfe491464efa
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
2016-05-10 23:11:22 +00:00
Marc Mutz
f5aa65349c QFactoryLoader: use new QJsonObject::value(QLatin1String)
Allows to get rid of some QStringLiterals, reducing QtCore
text size by ~800b.

Change-Id: I8f7e57927163eaaf628e42020f83f053faea6bf8
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
2016-05-10 21:18:52 +00:00
Marc Mutz
a5159cc50a QJsonObject: add some overloads taking QLatin1String
QXmlStreamReader also has QLatin1String overloads, which
greatly benefits parsers, since the vast majority of keys
in both JSON and XML are US-ASCII. This patch adds such an
overload to the JSON parser.

The value() function is all typical parsers need, so even
though many more QJsonObject functions taking QString could
benefit from the same treatment, value() is the single most
important one for read-only JSON access.

Add some more overloads, too, for functions that don't need
more internal scaffolding than value(). Requires adding a
dummy op[](QL1S) (forwarding to the QString overload) so as
not to make

  QJsonObject json;
  json[QLatin1String("key")]; // mutable

ambiguous between const op[](QL1S) and mutable op[](QString).

[ChangeLog][QtCore][QJsonObject] Added value(), op[] const,
find(), constFind(), contains() overloads taking QLatin1String.

Change-Id: I00883028956ad949ba5ba2b18dd8a6a25ad5085b
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
2016-05-10 21:18:46 +00:00
Maurice Kalinowski
4c06592ad8 Fix build on WinRT
a63ca3fa10 caused a build breakage
for WinRT as GetModuleHandleEx does not exist on that platform.

Change-Id: I143d9cad5f32d98a4d86292dfa73f94a4acdf305
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
2016-05-10 13:55:26 +00:00
Anton Kudryavtsev
2f595a0178 QUrl: enable (N)RVO for gcc
Change-Id: Ie0fba08ce55a3c60a5b1565986c4280f065c7b2f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-05-09 18:58:08 +00:00
Anton Kudryavtsev
7abb90a70a QDateTimeParser: proper construction of QString
... with known size and known char by corresponding ctor.

Don't use fill() for this case.

Change-Id: I475a0655132ecbb40b1eac919309597b2560e71b
Reviewed-by: Edward Welbourne <edward.welbourne@theqtcompany.com>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2016-05-09 18:57:57 +00:00
Oswald Buddenhagen
8edfc4e9b6 make zlib_dependency auto-add QtCore as a private dep
our zlib header includes qglobal.h, so we need the qtcore include dirs,
and qtcore is also where the actual code is compiled into.

Change-Id: I09f530a1b4e6160438215a6d7223c0771ce94f05
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
2016-05-09 12:52:08 +00:00
Jędrzej Nowacki
45655cbe8d Be more specific what is in Core and what is not
!isComplex is quite good heuristic, but we know for sure which types
should be included.

Change-Id: I609d021b8a668e6c1945ed2b11d69f5a82b5e2bf
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2016-05-09 08:48:19 +00:00
Marc Mutz
4a4b377cd0 QJsonValue: don't create a temporary QString on every toString() invocation
The vast majority of users call toString() without the optional
defaultValue. So do it like the toArray() and toObject() methods
and split toString() into two overloads, so the common case no
longer needs to pass a temporaray QString.

Saves ~1.4 and ~1KiB in QtCore and QtGui text size, resp., on
optimized GCC 6.0 Linux AMD64 builds, even though we added a new
function to QtCore, too.

Change-Id: Ibe02397ca49ce11fdb58f5c5fc69e909bf94c1c6
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
2016-05-09 08:10:13 +00:00
Thiago Macieira
0b1b06ffc0 Add a QMutex::isRecursive() const noexcept
This is source- and binary-compatible, including the marking of the
existing function as noexcept.

[ChangeLog][QtCore][QMutex] Made the isRecursive() method be a const
function so that it can be called in const QMutex objects too.

Change-Id: Ifea6e497f11a461db432ffff1448bead97c08f92
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2016-05-09 07:48:30 +00:00
Thiago Macieira
0453897f1e QStorageInfo: allow getting the info of pseudo filesystems too
They won't be listed in QStorageInfo::mountedVolumes, but we can now
obtain their info if you know their mountpoint. For example, on Linux:

 $ ./qstorageinfo /dev /proc /sys
 Filesystem (Type)            Size  Available BSize  Label            Mounted on
 devtmpfs (devtmpfs) RW    4029772    4029764  4096                   /dev
 proc (proc)         RW          0          0  4096                   /proc
 sysfs (sysfs)       RW          0          0  4096                   /sys

Change-Id: I3e15a26e0e424169ac2bffff1417ba2429d6d9f4
Reviewed-by: Ivan Komissarov <ABBAPOH@gmail.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-05-09 06:04:36 +00:00
Thiago Macieira
4aba3dbcb3 QStorageInfo: get the label properly if the mounted device is a symlink
This happens for me with LVM:

 $ ls -l /dev/mapper/system-root /dev/system/root /dev/disk/by-label/*
 lrwxrwxrwx 1 root root 10 Nov 17 22:45 /dev/disk/by-label/system -> ../../dm-1
 lrwxrwxrwx 1 root root  7 Nov 17 22:45 /dev/mapper/system-root -> ../dm-1
 lrwxrwxrwx 1 root root  7 Nov 17 22:45 /dev/system/root -> ../dm-1

The mounted device according to /etc/mtab (/proc/self/mounts) is
/dev/mapper/system-root.

Change-Id: I3e15a26e0e424169ac2bffff1417b96779d84246
Reviewed-by: Ivan Komissarov <ABBAPOH@gmail.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-05-09 06:04:31 +00:00
Thiago Macieira
d9f6b6d1f8 QStorageInfo: update the detection of pseudo filesystems
Allow tmpfs filesystems to be reported, as they're often usable by the
user, mounted in /tmp and in /run (the fs for $XDG_RUNTIME_DIR).

But disallow anything whose device is not a pathname. This catches most
of everything else that wasn't specifically tested for before, like
virtual fuse filesystems, like GVFS.

Change-Id: I3e15a26e0e424169ac2bffff1417b7cee0f8ec97
Reviewed-by: Ivan Komissarov <ABBAPOH@gmail.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-05-09 06:04:26 +00:00
Thiago Macieira
b168c6c824 QStorageInfo: fix matching of mountpoints to sibling directories
The path "/usrfoo" starts with "/usr", so if you tried to get
QStorageInfo("/usrfoo") when "/usr" is a mount point, you'd get the
wrong filesystem.

[ChangeLog][QtCore][QStorageInfo] Fixed a bug that caused QStorageInfo
to report information for the wrong filesystem if there is a mounted
filesystem at a path that is a prefix of the requested path (e.g., it
would report "/usr" filesystem for "/usrfoo").

Task-number: QTBUG-49498
Change-Id: I3e15a26e0e424169ac2bffff1417b7a27cd0132d
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
2016-05-09 06:04:21 +00:00
Thiago Macieira
29076cf6cb Fix QBasicAtomicPointer::{load,store} to actually be relaxed
We were using direct loading and operator=, which for everything except
std::atomic was very relaxed. But std::atomic<T *> defines the direct
access to actually be the least relaxed possible, under the idea that if
you didn't know any better to use a member function, you probably need
the most protection.

So use Ops::load and Ops::store.

Change-Id: Id5480807d25e49e78b79ffff144a06a2e6398576
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2016-05-09 05:30:49 +00:00
Thiago Macieira
75d65600f9 Work around ICC's bug in making std::atomic a literal type
ICC 15.x and 16.0 (beta, at least) are missing the "constexpr" and
"noexcept" keywords in the definition of the std::atomic
constructors. The lack of constexpr makes std::atomic a non-literal
type, which in turn makes QBasicAtomicInteger's constructor (which is
constexpr) fail to compile.

Reported as Intel issue 6000117277.

Change-Id: I4a88bcca48bf0ce51557d809ef32a4545edcafee
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2016-05-08 18:10:36 +00:00
Thiago Macieira
29efec2d8c Mark QThread::currentThreadId() as a pure function
It always returns the same information for each thread it is called
in. But since it's different per thread, we don't think it's
const. pthread_self() on Linux is marked const, though we think it
really ought to be pure. On other OSes, the annotation isn't present,
but the we can assume function is so.

Change-Id: Ifea6e497f11a461db432ffff1448c2b37d94d5f3
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2016-05-08 06:51:27 +00:00
Thiago Macieira
a63ca3fa10 Implement QLibrary::PreventUnloadHint for Windows
It's interesting that the HMODULE/HINSTANCE pointer points to something
in the actual module that got loaded, so we can use its value as
"address of something in the module" for GetModuleHandleEx. The "PIN"
flag tells the Windows DLL loader to never unload.

Change-Id: Ifea6e497f11a461db432ffff1449a2169eb6293e
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
2016-05-08 06:51:24 +00:00
Thiago Macieira
04ca11e6f9 Remove includes to qdatetime_p.h that aren't necessary
Since I'm changing QDateTime's privates, it's easier to know what may be
depending on it or not.

Change-Id: Id5480807d25e49e78b79ffff144a53018d057e19
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2016-05-08 06:51:22 +00:00
Thiago Macieira
0b2bc18efd Mark QTimeZone constructor nothrow.
Change-Id: Id5480807d25e49e78b79ffff144a9eead3fc9597
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2016-05-08 06:51:18 +00:00
Frank Meerkoetter
e8995de22a Documentation fix for QStringBuilder
The article describes two ways, not three.

Change-Id: I2b8b3c92135dd87de8a81255cddd1faf7c5455c3
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2016-05-08 06:41:37 +00:00
Thiago Macieira
b491fab02a QDateTime: Remove the distinction between null and invalid date and time
Change-Id: Id5480807d25e49e78b79ffff144a523e6851c03f
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
2016-05-08 05:03:24 +00:00
Thiago Macieira
f402b4886d QDateTime: Remove NoDaylightTime flag
It's not used.

Change-Id: Id5480807d25e49e78b79ffff144a51cb80bd8abf
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
2016-05-08 05:03:20 +00:00
Thiago Macieira
e1d0da6526 Fix Clang -Wexpansion-to-defined warning by deprecating QT_SUPPORTS
The C and C++ standards say it's undefined whether the preprocessor
supports macros that expand to defined() will operate as an ifdef.
Clang 3.9 started complaining about that fact.

One solution was to change QT_SUPPORTS to check for zero or one, which
means we need to change the #defines QT_NO_xxx to #define QT_NO_xxx 1.
The C standard says we don't need to #define to 0, as an unknown token
is interpreted as zero. However, that might produce a warning (GCC with
-Wundef), so changing the macro this way is not recommended.

Instead, we deprecate the macro and replace the uses with #ifdef/ndef.

Change-Id: Id75834dab9ed466e94c7ffff1444874d5680b96a
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-05-08 04:25:27 +00:00
Liang Qi
dbef41f43e Merge remote-tracking branch 'origin/5.6' into 5.7
Conflicts:
	examples/qtestlib/tutorial5/containers.cpp
	examples/widgets/tools/tools.pro
	src/corelib/io/qprocess.cpp
	src/corelib/io/qprocess_unix.cpp
	src/corelib/io/qprocess_win.cpp
	src/network/kernel/qdnslookup_unix.cpp
	src/plugins/platforms/xcb/qxcbconnection_xi2.cpp
	src/testlib/qtestcase.cpp
	tools/configure/configureapp.cpp

Change-Id: I838ae7f082535a67a4a53aa13a21ba5580758be8
2016-05-06 15:36:44 +02:00
Alex Trotsenko
f57d8f1341 QFileSystemMetaData: do not treat block devices as sequential
This patch allows handling of special block devices in random-access
mode that restores a Qt4 behavior.

Can not be tested because requires root privileges in the system.

Task-number: QTBUG-51666
Change-Id: Iaa56355f1be343c0d05b292e3c7d2e1c88724529
Reviewed-by: Edward Welbourne <edward.welbourne@theqtcompany.com>
Reviewed-by: Andrius Štikonas <andrius@stikonas.eu>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@theqtcompany.com>
2016-05-04 17:28:04 +00:00
Thiago Macieira
a4e3e34b83 Let Q_DECLARE_METATYPE and Q_DECLARE_FLAGS be undefined under Q_MOC_RUN
That's required so that they remain in the output from the preprocessor

Change-Id: Id69569111e7d4e619e22ffff144b4a1ee90865f0
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2016-05-04 16:43:30 +00:00
Anton Kudryavtsev
691151a241 QUrlQuery: use erase and std::remove_if with QList
... instead of using erase() in a loop, with quadratic complexity.

Change-Id: I277ff2527e0a22b3d754b1d14296b9882f164c23
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2016-05-04 15:09:41 +00:00
Marc Mutz
5eae0ce800 QScoped(Array)Pointer: canonicalize swapping
This includes:
- have nothrow member-swap
- have ADL non-member swap
- not specialize qSwap or std::swap

Also prevent QScopedPointer <-> QScopedArrayPointer swaps by overloading
swap (both member and non-member) on QScopedArrayPointer. It's not 100%
safe, but it's what we're doing elsewhere (QMulti(Map,Hash), say).

That's technically a SiC change if users expected (qualified) std::swap
to invoke QScopedPointer::swap(), but those users were doing it wrong to
begin with, and they now get a compile-error instead of silent pessimization,
because generic std::swap() doesn't work on QScopedPointer, due to lack
of copy (and thus move) semantics.

Change-Id: I3ab5c1668722a2c8ccafc16f57310ce8d4bffbd6
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2016-05-04 05:21:30 +00:00
Thiago Macieira
494376f980 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
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
2016-05-03 17:54:22 +00:00
Friedemann Kleint
69c2a606b3 Merge "Merge remote-tracking branch 'origin/5.7' into dev" into refs/staging/dev 2016-05-03 18:58:24 +00:00
Tor Arne Vestbø
224db5e6eb darwin: Move conversion function documentation to function definition
It's easier to maintain the function and the docs when they live together.

Change-Id: I1e047b4ac1eb61a36849188da560dd899e05509f
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
2016-05-03 15:20:30 +00:00
Tor Arne Vestbø
597df79c27 darwin: Simplify conversion function declarations in headers
We don't need to include Q_QDOC in the forward-declarations of the native
types, and Q_FORWARD_DECLARE_OBJC_CLASS works in non-Objective-C mode as
well, which means we can declare the Objective-C versions of the functions
without guards.

Change-Id: I32089c496b4f7ce47f0388ba3f65e0b091d1e9ee
Reviewed-by: Martin Smith <martin.smith@theqtcompany.com>
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
2016-05-03 15:20:24 +00:00
Liang Qi
6357813207 Merge remote-tracking branch 'origin/5.7' into dev
Conflicts:
	configure
	src/3rdparty/double-conversion/include/double-conversion/utils.h
	src/corelib/global/qnamespace.qdoc
	src/corelib/tools/qsimd_p.h
	tests/auto/corelib/io/qfile/tst_qfile.cpp

Change-Id: I3ca1007bab5355d251c13002a18e93d81c254d34
2016-05-03 15:49:15 +02:00
Oswald Buddenhagen
5bbbea4c83 normalize structure of plugandpaint example
as in other examples which come with plugins, use an additional
hierarchy level which contains the app and plugin subdirs.

Change-Id: I2487755967aa3474c337c8c8af10be49627b63d0
Reviewed-by: Topi Reiniö <topi.reinio@theqtcompany.com>
2016-05-03 10:25:18 +00:00
Erik Verbruggen
2410be7f45 Tune fast-exit for signal activation for QML.
When using QML, it quite often happens that only the QML engine is
connected to a signal, and no C++ handlers. By splitting up the
fast-exit case and handling QML separately, we can prevent a call to
QThread::currentThreadId, and locking+unlocking the mutex.

On x86 this saves ~130 instructions according to valgrind.

Change-Id: I947fe42afe351922339ac982a6d498bc2f7b5192
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2016-05-03 08:53:53 +00:00
Marc Mutz
5a76a3fb03 QtBase: use printf-style qWarning/qDebug where possible (II)
The printf-style version of QDebug expands to a lot less code than the
std::ostream-style version. Of course, you pay in type safety (but
compilers warn about it these days), you cannot stream complex Qt
types and streaming QStrings is awkward, but in many cases you
actually improve on readability.

But the main reason is that something that's not supposed to be
executed under normal operation has no business bloating executable
code size.

This is not an attempt at converting all qWarnings() to printf-style,
only the low-hanging fruit.

In this second part, replace
   qWarning() << "" << non-QString
with
   qWarning("..%.", non-QString).

QString (and QUrl etc) have special escaping handling when streamed
into QDebug, so leave those alone. They also seem to expand to less
code than the qPrintable() alternative, so there's no reason to
replace them.

Saves 2KiB, 3.4KiB, ~750b and ~450b in text size in QtCore, Gui,
Network and Widgets, resp., on optimized GCC 5.3 AMD64 builds.

Change-Id: Iae6823e543544347e628ca1060d6d51e3b04d3f4
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
2016-05-03 04:35:06 +00:00
John Preston
1c456751b3 Fix QFile::copy() on WinRT.
Implementation of QFileSystemEngine::copyFile() uses CopyFile2() as if
it is CopyFile() function, but CopyFile2() returns HRESULT, not BOOL.
So the success should be checked by "SUCCEEDED()" instead of "!= 0".
Current implementation does exactly the opposite because S_OK == 0.

Change-Id: I0677d54447d22366fb2031e0b928a3d10e24c0ed
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
2016-05-02 12:18:36 +00:00
Giuseppe D'Angelo
ea97a43175 QOpenGLContext: add a way to disable the thread affinity check
The problem of the check is that it makes Qt non compliant with OpenGL
thread affinity semantics. One is allowed to make a GL context
current on any thread, without the Qt-specific idea of moving
the QOpenGLContext to that thread first. Moreover, the move is
plain impossible if the user needs to handle the context
to 3rd party code which assumes the context to have GL semantics.

Add an application flag to disable that.

Change-Id: I55ca02ee62f8cc171a9a1bddef5331ad0949c061
Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
2016-05-02 11:52:00 +00:00
Jan Arve Saether
eb63c0fa47 Add ImInputItemClipRectangle
This rectangle represents the "effective" visual rectangle of the input
item, excluding any areas obscured due to clipping.

Note: The effective visual rectangle will not be influenced by overlapping
items.

Change-Id: I234176161dcfb9c236124e33ae510a0b01fe6dc3
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@theqtcompany.com>
2016-05-02 10:56:45 +00:00
Friedemann Kleint
c09008d27c QWindowsPipeWriter: Fix developer build with MinGW.
Fix signedness in comparion:
io\qwindowspipewriter.cpp: In member function 'void QWindowsPipeWriter::notified(DWORD, DWORD)':
io\qwindowspipewriter.cpp:134:65: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
     Q_ASSERT(errorCode != ERROR_SUCCESS || numberOfBytesWritten == buffer.size());

Amends change a4d26cf522.

Task-number: QTBUG-52401
Change-Id: If0c0e2107342408675fa00b93f28c9de339080f6
Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
2016-05-02 10:55:03 +00:00
Liang Qi
4679861105 Merge "Merge remote-tracking branch 'origin/5.6' into 5.7" into refs/staging/5.7 2016-05-02 07:03:53 +00:00
Marc Mutz
54d95d0988 Fix UB (data race) in Q_GLOBAL_STATIC
The store to guard in the inner function's critical
section was not synchronized-with the load at the
start of the function:

    T1                    T2
    guard.load()
    mutex.lock()
    guard.load()
    d = new Type
    guard.store()
                          guard.load()
                          // use d
    mutex.unlock()

The use of d in T2 does not synchronize with
the write to d in T1 -> data race -> UB.

Fix by storing with release memory ordering,
so that the guard.load() in T2 synchronizes
with the guard.store() in T1.

Change-Id: I5c1cd1fa097c6397cb0b48b0d8e8012f95978558
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2016-05-01 07:25:25 +00:00
Anton Kudryavtsev
6cbcff4971 QDateTime: use default ctor to create invalid object
Don't perform some internal init functions.

Change-Id: I9986e7a8adab35499aea804d1019012547aefd5d
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Edward Welbourne <edward.welbourne@theqtcompany.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-04-30 18:26:09 +00:00
Anton Kudryavtsev
ac7d14f1aa QDateTimeParser: enable RVO in format()
Change-Id: I3d9f84d03519b2b8fb37c7d2e773e68bc4b9a1d3
Reviewed-by: Edward Welbourne <edward.welbourne@theqtcompany.com>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2016-04-30 18:25:57 +00:00
Thiago Macieira
0d0141d746 Don't bother asking if Linux supports a monotonic clock: it does
Change-Id: Id5480807d25e49e78b79ffff144a0e61bd001dff
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
2016-04-30 18:24:15 +00:00
Alex Trotsenko
a4d26cf522 QWindowsPipeWriter: ensure validity of the write buffer
QWindowsPipeWriter uses asynchronous API to perform writing. Once a cycle
has been started, the write buffer must remain valid until the write
operation is completed.

To avoid data corruption and possibly undefined behavior, this patch
makes QWindowsPipeWriter::write() take a QByteArray, which it keeps alive
for the duration of the write cycle.

Autotest-by: Thomas Hartmann
Task-number: QTBUG-52401
Change-Id: Ia35faee735c4e684267daa1f6bd689512b670cd2
Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
2016-04-30 13:13:26 +00:00
Volker Krause
5e059c6047 Decompress QResources only when needed.
In particular, just creating a QFileInfo (or a QDirIterator, which uses
QFileInfo internally) no longer triggers decompression. This doubles the
performance when using a QDirIterator/QFile combo for loading a bunch of
files.

Change-Id: I7f53354e890ad6360693b7848d21a0cd5d595628
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-04-30 12:12:24 +00:00
Friedemann Kleint
b4d2ae0676 Remove remains of Windows CE from QSysInfo.
Remove documentation of enumeration values and code from manual test.

Change-Id: I8e6cbbe11ab38421fb29595ae79351f5a919ff70
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
2016-04-30 10:33:04 +00:00
Thiago Macieira
112e53fdc4 Don't store the pthread_t thread ID twice in QThread
It was being stored once in QThreadPrivate and once in QThreadData, with
the latter being hidden as a Qt::HANDLE. Besides saving a little bit of
memory, this also solves a small data race condition that arises from
trying to connect a signal to an object moved to that thread and then
emit that signal shortly after the thread starts. Before this patch,
QThreadData::threadId was initialized only by QThreadPrivate::start(),
which meant that we were racing that initialization with this check in
QMetaObject::activate:

  const bool receiverInSameThread = currentThreadId == receiver->d_func()->threadData->threadId;

Task-number: QTBUG-52337
Change-Id: Ifea6e497f11a461db432ffff1449ae01f1099aae
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com>
2016-04-30 03:00:33 +00:00
Liang Qi
b894a8def5 Merge remote-tracking branch 'origin/5.6' into 5.7
Conflicts:
	mkspecs/features/qml_module.prf
	mkspecs/features/qt_common.prf
	src/gui/text/qzip.cpp
	src/plugins/platforms/cocoa/qnsview.mm
	src/plugins/platforms/windows/array.h
	src/testlib/qtestcase.cpp
	src/widgets/dialogs/qfilesystemmodel.h

Change-Id: Ie41c5868415b81f7693c80e045497035504bb210
2016-04-29 17:55:20 +02:00
Sérgio Martins
89d1c7c179 Make it clear that QObject::tr() falls back to QString::fromUtf8()
The reference to trUtf8() made it even more confusing, so remove it.
It's redundant and deprecated anyway.

Change-Id: I9921297160db3660bb5099692bbfdaf6e85637aa
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
2016-04-28 23:05:58 +00:00
Thiago Macieira
e22a230a03 Make QSharedPointer without custom deleters call the correct destructor
Where "correct" is defined by what std::shared_ptr does as well as what
happens when an intermediate QSharedPointer of the exact type of the
constructor behaves

That is,
   QSharedPointer<X> ptr(new Y);

Behaves like
   QSharedPointer<X> ptr;
   { QSharedPointer<Y> tmp(new Y); ptr = tmp; }

Change-Id: Id75834dab9ed466e94c7ffff14455d445f72592b
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2016-04-28 12:58:35 +00:00
Alexander Volkov
9a7e967e99 Unhide QObject::parent() from QFileSystemModel and QIdentityProxyModel
It was hidden by overridden parent(const QModelIndex &) methods.
See also 63b5082ea8
(Unhide QObject::parent() from QAbstract{Table,List}model).

Change-Id: I8b6d4d4175e4d43ff269eaeb0b2b1a9fb8f44bab
Task-number: QTBUG-45393
Reviewed-by: Milian Wolff <milian.wolff@kdab.com>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2016-04-28 09:08:22 +00:00
Ulf Hermann
9366a8be1e Add an early-out to QVector::operator+= and QHash::unite for empty LHS
If the container being added to is default constructed and has never
been modified, we don't have to do all the checking and iterating.
Instead we can just assign with operator=.

If the LHS is merely empty, we could lose reserve()d capacity, so only
do this for a shared-null LHS.

Change-Id: If1e3342662d10833babc7ab847ada0285073723b
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Milian Wolff <milian.wolff@kdab.com>
2016-04-28 07:26:52 +00:00
Thiago Macieira
3430552881 Use C++11 alignas() for Q_DECL_ALIGN, if possible
Change-Id: Ifea6e497f11a461db432ffff144863d4ed69a212
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2016-04-28 02:45:40 +00:00
Thiago Macieira
ef7b0df419 Fix QArrayData::allocate() to guard against integer overflows
The proper solution with qCalculateBlockSize will come for Qt 5.7.

Change-Id: Ifea6e497f11a461db432ffff14490788fc522eb7
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2016-04-28 02:45:37 +00:00
Konstantin Ritt
3df159ba17 Improve the script itemization algorithm to match Unicode 8.0
Override preceding Common-s with a subsequent non-Inherited,
non-Common script.
This produces longer script runs, which automagically improves
the shaping quality (as we don't lose the context anymore),
the shaping performance (as we're typically shape a fewer runs),
and the fallback font selection (when the font supports more
than just a single language/script).

Task-number: QTBUG-29930
Change-Id: I1c55af30bd397871d7f1f6e062605517f5a7e5a1
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2016-04-27 16:52:27 +00:00
Thiago Macieira
6dfc3541e6 Add QLibraryInfo::version() returning the Qt version as QVersionNumber
[ChangeLog][QtCore][QLibraryInfo] Added QLibraryInfo::version(), which
returns the current version of the Qt library as a QVersionNumber
object.

Change-Id: Ifea6e497f11a461db432ffff1448d4dc84ef57b1
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
2016-04-27 16:12:55 +00:00
Liang Qi
23a36fd2bf Merge remote-tracking branch 'origin/5.6' into 5.7
Conflicts:
	src/corelib/io/qprocess_win.cpp
	src/widgets/itemviews/qheaderview.cpp

Change-Id: I0a59ade9cd6e91f770fdf298a7d72a41e79fd761
2016-04-27 09:18:05 +02:00
Thiago Macieira
6e306e8d94 Disallow non-character Unicode codepoints in QUrl/QUrlQuery
Since they are non-characters and should not be used for text
interchange, it stands to reason that they should not appear in
unencoded for in a URL. To change the behavior, we just need to toggle
a simple flag for QUtf8Functions.

This behavior also matches the recommendation from RFC 3987. We do not
usually follow recommendations from that RFC (as it is generally
believed to be a bad RFC), but this one seems like a good idea.

Change-Id: Ifea6e497f11a461db432ffff1447486c623c12bd
Reviewed-by: David Faure <david.faure@kdab.com>
2016-04-26 23:08:11 +00:00
Marc Mutz
a1e3a0daed QString: Fix UBs (signed overflow) in hashed string search
Similar change to 390ea21873, but more
extensive because the hash variables were not, yet, of unsigned type.

This brings the three hashed string search algorithms in QtBase (in
QString, QByteArray and QByteArrayMatcher) in line again.

Found by UBSan, fixing the following bunch of errors:

  tools/qstring.cpp:3080:38: runtime error: left shift of negative value -1291179264
  tools/qstring.cpp:3081:42: runtime error: left shift of negative value -1291179264
  tools/qstring.cpp:3091:13: runtime error: left shift of 73 by 26 places cannot be represented in type 'int'
  tools/qstring.cpp:3091:13: runtime error: left shift of negative value -1255957171
  tools/qstring.cpp:3091:13: runtime error: signed integer overflow: 1783052986 - -1207959552 cannot be represented in type 'int'
  tools/qstring.cpp:3097:37: runtime error: left shift of negative value -1298753576
  tools/qstring.cpp:3098:41: runtime error: left shift of negative value -1298753576
  tools/qstring.cpp:3107:13: runtime error: left shift of negative value -1508912760
  tools/qstring.cpp:3158:38: runtime error: left shift of negative value -677037574
  tools/qstring.cpp:3159:42: runtime error: left shift of negative value -677037574
  tools/qstring.cpp:3169:13: runtime error: left shift of negative value -1657715810
  tools/qstring.cpp:3173:38: runtime error: left shift of negative value -677037574
  tools/qstring.cpp:3174:42: runtime error: left shift of negative value -677037574
  tools/qstring.cpp:3183:13: runtime error: left shift of negative value -1657715810

Change-Id: I1436eb61369919df9fe34251f863dd54fb58af98
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2016-04-26 16:37:10 +00:00