The code was checking the write buffer in a branch for unbuffered sockets.
Change-Id: I4dc722e7f182562332c3d167e6ebbab7f53f51e7
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
... such as GCC.
truncate(0) was chosen because it is already used throughout
the function. Using clear(), say, which is inline, produces
slightly more code.
As is, saves 160b in text size on optimized GCC 4.9 Linux
AMD64 builds.
Change-Id: I415d09ad2b4547f1d69f78d85e2aa1c1f9a17ed3
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Saves just 168b in text size on optimized GCC 4.9 Linux
AMD64 builds, but most for loops are in non-Linux code.
Change-Id: I4f20a65c2e4953011308ff831c9e8fa37a25274b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
It was already movable, so it's BC. Only needed to add
nothrow member-swap and nothrow move assignment.
Change-Id: Iefedb877078da8ee075eb67185eef221143ddec1
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
For HSL colors, the (heavily over-parenthesized) code compared hslHue
values mod 36000, _and also_ for equality. Of course, the second
comparison is dead code.
This was a cut'n'paste error from the non-HSL comparison.
So, remove it. And also some of the over-parenthesization.
There are no tests for operator==, and the HSL color comparison is
completely opaque for me, so I'm not going to write any for this
trivial change.
Change-Id: I74572273730cb5cc9f427c524c268ba3f90304c1
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Saves a bit more than 0.5KiB in text size on optimized
GCC 4.9 Linux AMD64 builds.
Change-Id: I3b7e4751c4799c3e2c9f8f23b769e1659d863579
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
It just prevents the compiler from synthesizing move
special member functions, something that is very much
desired, seeing as there's a QVector member.
Change-Id: I4daabb380cd73dcacf3f514827b84562767a7a20
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
... instead of using erase in a loop, with quadratic complexity.
Change-Id: I4ac03ac0e893fc5dbb5e45131fcbfe82f1564bee
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
... each time around the loops. Cache it.
Also use QStringLiteral, since the string will never be
modified.
Also saves 96b in text size on optimized GCC 4.9 Linux
AMD64 builds.
Change-Id: I0269586235da18f3073a553739561ea7db6356e8
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
For almost the whole of its life time, 'realname' has the same
prefix, but the old code used the same string-builder expression
to construct it over and over again. If QStringBuilder would
re-use the capacity of the LHS object, that would boil down to
just a bit more copying of characters than necessary. But
assigning a QStringBuilder expression to a QString works by
implicit conversion of the QStringBuilder expression to a
QString, followed by move-assigning the new QString into the
old.
The new code keeps the common prefix around, resetting
'realname' to that prefix with truncate, only appending the
varying suffixes. In this way, one memory allocation per
assignment is saved (ignoring a potentially required capacity
increase in one of the appends here), and also some out-of-line
QString dtor calls, since op+=(QString&, QStringBuilder...)
doesn't create a temporary QString.
Also saves ~1KiB in text size on optimized GCC 4.9 Linux AMD64
builds.
Change-Id: I0872a69c9111d7218567f06f8fefb010f2430532
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
... instead of using erase in a loop, with quadratic complexity.
Change-Id: I9686d117e092f5d74c6e74a462adf503a7b7ae79
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
... instead of using erase in a loop, with quadratic complexity.
Change-Id: If30c6c99a775aec07eef9ddf953e944dc916b5a2
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
The extra length has been used for a sentinel null value.
By checking the index before indexing into the array, that
extra element can be dropped.
Change-Id: I0b309420d8d89f75e2381a8065c8e68a1a33427c
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
... instead of using erase in a loop, with quadratic complexity.
Change-Id: Ia5201e0bedca7abec6d485505f61f3f76a028bd1
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
std::stack, based on std::vector, tends to be more efficient that
QStack, based on QVector, but, crucially, it is an actual stack,
so doesn't allow, say, iteration or insertion in the middle, which
QStack does allow.
Since a lot of places where QStack is used use at least some of
those non-stack features, protect this instance which doesn't, yet,
from becoming another such site.
Since the use of std::stack with the default std::deque increases
text size by almost 1K, and a vector makes a perfectly good stack,
use std::vector as the backing container (which std::stack, being
a container adapter, allows easily).
Saves ~0.5KiB in text size on optimized GCC 5.3 Linux AMD64 builds.
Change-Id: I51c8fb1dc4e9907ae00ed1cee8f320304321b322
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
proper prefix builds don't have the redundant .dlls in bin (the copy
step is simply omitted), so this is broken. the change would have to be
done atomically with making DLLDESTDIR sane.
This reverts commit 9b2e98245a.
Task-number: QTBUG-50065
Change-Id: I9ce0a2d1147a1a2d4bd2f22e619d5c737864a637
Reviewed-by: Romain Pokrzywka <romain.pokrzywka@gmail.com>
Reviewed-by: Tim Blechmann <tim@klingt.org>
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@theqtcompany.com>
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
this is just an optimization/clarification: variables which are known to
be never empty (like PATH) can be extended with less convoluted code.
Change-Id: Ib365bbec8301673ed1c874979b4de19bc983dab1
Reviewed-by: Romain Pokrzywka <romain.pokrzywka@gmail.com>
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
the primary purpose is making env var prepend mode work for unset
variables on windows. this is achieved by using a conditional and delayed
variable expansion. however, the latter is disabled by default and can
be locally enabled only in batch files. therefore, write wrapper scripts
and substitute them for the actual commands. we do this also on unix,
both for consistency and simply because the commands look much less
confusing.
this change is slightly backwards-incompatible, as invoking
qtAddToolEnv() multiple times on the same command will now make a total
mess. also, invoking it on a command that contains 'make' macro
expansions isn't a good idea, so testcase.prf needed an adjustment. the
function is an undocumented internal, so Nobody Should Care (TM).
this also reverts 80ebedecf9, as it's obsolete now.
Change-Id: I8394b77868b495abcf27b688996ca74c40b80994
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
Don't try to run test_interface when Qt is configured without QtWidgets.
Change-Id: If6c376c250215c1d639b06881d16c0141091f288
Reviewed-by: Stephen Kelly <ske@ableton.com>
Render-to-texture widgets that are native children may have a non-zero
offset telling the position within the top-level widget. The size is
usually different (smaller) than the tlw's size as well.
An unfortunate optimization attempt led to ignoring the size for native
children with offset (0, 0). This resulted in interesting rendering
artifacts whenever such widgets were placed in the top-left corner of
the toplevel. This is now corrected.
Task-number: QTBUG-48130
Change-Id: If449610c3f3333cb73ae149efaefd7ef42953951
Reviewed-by: Paul Olav Tvete <paul.tvete@theqtcompany.com>
Setting a screen to a child window causes a warning message. This patch
prevents the debug message by catching incorrect behavior made by QPA
earlier.
Change-Id: Idf3ac02290a18afc134f19c2b91348dc009ca4ca
Reviewed-by: Shawn Rutledge <shawn.rutledge@theqtcompany.com>
Find the top level window on the primary virtual desktop first to avoid
obtaining a window which doesn't belong to the primary virtual desktop
when screen geometry is similar.
Change-Id: I78fdfa0b5146d0ba9b912338adeb612c102c4ac3
Reviewed-by: Adam Majer <adamm@zombino.com>
Reviewed-by: Shawn Rutledge <shawn.rutledge@theqtcompany.com>
Qt3D is making heavy use of this, causing the QList node allocations
to be among the top 10 per frame allocation sources. Switching to
QVector fixes that.
Change-Id: I3b4df329710f82bf8d6797ea1f0c79b288a08063
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
The reply serial is displayed for method call returns and errors,
while the serial is displayed for all message types.
To see a message serial it is required to dump messages after
sending, not before.
Task-number: QTBUG-44490
Change-Id: I859f50d739ed059d5b2dfe1a2efdf04b906891a7
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This patch includes setup of class member 'msg' in
QDBusMessagePrivate::toDBusMessage() to be able to get the
serial after message sending.
Testcases for comparing the 'reply serial to' with the 'serial'
are included.
Task-number: QTBUG-44490
Change-Id: Iae7c48f5b0c70a6c5ae500904072b38b46dfd876
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Change the QWindowsInputContext::composition if it is called
with lParam has flags GCS_RESULTSTR and GCS_DELTASTART,
it doesn't call endContextComposition.
Task-number: QTBUG-49955
Change-Id: I49de3f239bf8a77414e433b255db08f227141158
Reviewed-by: Tasuku Suzuki <stasuku@gmail.com>
Reviewed-by: Takumi ASAKI <takumi.asaki@gmail.com>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
Reviewed-by: Andy Shaw <andy.shaw@theqtcompany.com>
Reviewed-by: Liang Qi <liang.qi@theqtcompany.com>
(cherry picked from qtbase/786984e7e47a63094ad64ec86a4892cc5c0ad6d4)
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
On Android, back button will send a CloseEvent to the focused window.
This change will activate (focus) the Popup windows when they'll become
visible.
Task-number: QTBUG-46419
Change-Id: I6787435b24502bbf9a78662a0c6fd159d4ee2e8d
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
Implicitly add the minimum required `-std=...` to Qt5 module targets.
Use the newly introduced INTERFACE_COMPILE_FEATURES property for this,
which is available starting from CMake version 3.1.
This also fixes the Qt5 CMake tests, which previously try-compiled projects
using Qt 5.7 headers in non-C++11 mode, thus failed.
Change-Id: I54fc0e07403b646b5d6ac3ab6b8b47119b4feef6
Reviewed-by: Stephen Kelly <steveire@gmail.com>
On X11, QXcbVirtualDesktop represents an X11 screen while QScreen
represents an X11 output. In the case that there are multiple screens
(possibly with multiple outputs), calculate the screen number correctly:
Find the screen index on the primary virtual desktop first to avoid
obtaining a screen index which doesn't belong to the primary virtual
desktop when screen geometry is similar.
Change-Id: I4cbb29b7aa7cd2125759ffbbbe3db4e934feaeae
Reviewed-by: Shawn Rutledge <shawn.rutledge@theqtcompany.com>
Find the root widget only when more than one virtual desktop exists
and find the screen index using virtual siblings from this root
widget.
Use intersecting rects instead of middle point to obtain the screen.
This can help to get the screen index when the middle point is outside
the screen geometry, but part of the window is still on the screen.
If the widget is completely outside the screen geometry, -1 is
returned.
This commit amends: a6b2a4642f
Change-Id: I80247fc1956a82c487ee6f728d1576bf48b28748
Reviewed-by: Shawn Rutledge <shawn.rutledge@theqtcompany.com>
This is a partial revert of eaa3a9d010
Task-number: QTBUG-50081
Change-Id: Ic3dc4daa90d7a968a4ebf45d3029c99a12985686
Reviewed-by: Shawn Rutledge <shawn.rutledge@theqtcompany.com>
Use QSharedPointer::create(), to fuse control block and
payload into a single memory allocation.
Change-Id: I8d87c73566c3be960e957ec0b5419a77da2fc8c9
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
GCC 5.3's undefined-behavior sanitizer checks that the
declared type of the object is a base class of the
dynamic type of the object on each access to a member
of a class type.
It therefore requires the typeinfo for these types,
which for polymorphic types is emitted in the TU where
the vtable is emitted, too.
QFileDialogPrivate is a polymorphic non-exported class,
so this failed at link-time. Ditto for the other cases.
Fix by autotest-exporting the classs.
Also, where applicable, de-inline the dtors, so the
vtable (and typeinfo) are pinned to one TU, and the
ctor, just because it's the correct thing to do.
Change-Id: I2b7dba776282a2809c80eb2bc36440d7d698f926
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Remove a superfluous loop and thus the usage of QIncrementalSleepTimer
from QProcess::waitForFinished. We just wait for the process handle.
There's no need for a loop that checks multiple wait conditions.
This enables us to remove QWindowsPipeWriter from the Windows CE port in
a subsequent commit.
Change-Id: If6a82405227cf145263dba3726bae959e6871d0e
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
...even if reserve() hasn't been called before.
[ChangeLog][QtCore][QString] resize() will no longer shrink the
capacity. That means resize(0) now reliably preserves capacity().
Change-Id: If499a20990bbf3a20553da14e50a42918d310c9f
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
Added check for traiCollection selector.
Task-number: QTBUG-50159
Change-Id: Ie3efafe9e22e59aef862a681ad733f2bb0a5ba49
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com>
Instead of converting a QVector to a QList to a QSet just to
be able to look up some indexes, take the original QVector,
sort it, and use std::binary_search().
Change-Id: If56e9371972b9aaebb033a8a499be306163266e2
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
There's no variant with bool first argument.
Change-Id: Ib18b50ed6271d21253d075dc72b6e2b8744cf131
Reviewed-by: Topi Reiniö <topi.reinio@theqtcompany.com>
The function is not available on Windows XP.
Task-number: QTBUG-50188
Change-Id: I4ded1a4eb37af84979c3ce1a9af0d95da60b56ac
Reviewed-by: Kai Koehne <kai.koehne@theqtcompany.com>
This code seems to be hit three times per frame in a hybrid QQ2/Qt3D app,
quickly generating thousands of allocations here via the detach in begin().
Heaptrack confirms they are all gone now.
Change-Id: I7d09f3f5c2b24a2590b701216715055751306e82
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>