...by implementing it via std::equal().
This might also enable STL implementations to choose a
hand-optimized version of the algorithm for C++ builtin types.
Change-Id: I1347a7f365b3d2947f19a81b95aa8d89b8ad303d
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
...by implementing it via std::find().
This might also enable STL implementations to choose a
hand-optimized version of the algorithm for C++ builtin types.
Change-Id: I86e94d63ff58332f2fa6eafb3c1baccd125a6f34
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
primeForCount tries to calculate a rough base 2 logarithm of the argument,
in order to access the array of deltas between primes.
However, the usage of an arithmetic shift instead of a logical shift
could cause "high" to stay at 32 -- if the argument is INT_MAX, for instance,
the condition of the if clause in the loop is always true. The loop
would go this way:
* precond: low = 0 , high = 32
* i = 0 : mid = 16, if TRUE, low = 16, high = 32
* i = 1 : mid = 24, if TRUE, low = 24, high = 32
* i = 2 : mid = 28, if TRUE, low = 28, high = 32
* i = 3 : mid = 30, if TRUE, low = 30, high = 32
* i = 4 : mid = 31, if TRUE, low = 31, high = 32
and hence the subsequent access of the 33rd position of the array
(by passing index 32) is out of bounds.
Now the if at i = 4 is true because "1 << 31" is an arithmetic shift,
not a logical one, and gives - (2^31) as result. Making it a logical shift
fixes this (INT_MAX is 2^31-1, the shift gives 2^31, so the if is false).
Spotted by Coverity.
Change-Id: Ied89f4c87d603a209284e22c30f18a3e464d84fd
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@digia.com>
121e712935 fixed it into QHash,
so copy the same ranges here.
Change-Id: Ia7738f878965b5593d6ca641d6b8911abfdd2dd3
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com>
- Streamline code and remove code that has no effect.
- Create temporary directory and files only when it is actually
required (empty start path).
- Remove try/catch as it is not commonly used in Qt autotests.
Its original purpose was apparently to ensure temporary file
cleanup, but that should now work since smart pointers are used
for temporary files and directories.
- Introduce variable for case sensitivity.
Task-number: QTBUG-41681
Change-Id: Ie5f621c30fc461b880292b853e0660b8fba316eb
Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
The previous patch was flawed since by the time the QEglPlatformIntegration
destructor was called the virtual function table did not point to the methods in
QEglFsPlatformIntegration any more.
Change-Id: I310e5e3e734a22b44645ba912b579f193bcfae86
Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
When:
- i == 0 (at end of current POINTBLOCK),
- numFullPtBlocks == 1 (only one more POINTBLOCK left) and
- iCurPtBlock == 0 (last block contains no points),
Valgrind rightfully complained about an invalid read:
Conditional jump or move depends on uninitialised value(s)
at 0x517B08B: PolygonRegion(QPoint const*, int, int) (qregion.cpp:3480)
Fixed by setting 'next' to nullptr when !numFullPtBlocks OR !iCurPtBlock.
Change-Id: If5225fdfa66f2910a8aafb675cd02b40c0a81ad9
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
GCC and Clang support compiler intrinsic error detections tools:
address, memory, thread, undefined
Let users conveniently enable it in qmake, for instance with
CONFIG += sanitizer sanitize_address
Also add a -sanitize [...] option to configure to use it by default
for both the Qt libraries, and user applications.
[ChangeLog][configure] Added support for GCC/Clang -fsanitize= options
Change-Id: Ie5418abcdf41842566df510d7707e41739e66f87
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
On Yosemite checkable toolbuttons look differently
when highlighted - this modification tries to imitate such look
without pixmaps we used on OS X >= 10.5 && < 10.10.
Change-Id: I0fcdff42a67fa6d5188c9dc64401f0f27ae60b5d
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com>
This is an opt-in trade-off between type safety and user
code convenience.
QT_NO_CAST_FROM_ASCII is highly beneficial to avoid unintended
conversions from 8 bit data with potentially "unsuitable"
encodings to QString. However, it has the undesirable side-effect
to require user code to wrap character and string literals
in QLatin1Char(...) and QLatin1String(...) or use similar
construction, cluttering the code significantly.
This patch introduces a QT_RESTRICTED_CAST_FROM_ASCII macro
that works almost as QT_NO_CAST_FROM_ASCII, except that it
enables the QChar(char) constructor and adds an additional
QString(const char (&ch)[N]) constructor that matches
C++ string literals, but no arbitrary character pointers.
This avoids a significant share of the need to clutter the
user code by only a slight relaxation of the type-safety.
[ChangeLog][QtCore][QString] Added QT_RESTRICTED_CAST_FROM_ASCII
macro as less intrusive alternative to QT_NO_CAST_FROM_ASCII.
Change-Id: Iac72f1f90f81fbcae9bfb1fe68b0fec6ffb36c50
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
Reviewed-by: Kai Koehne <kai.koehne@digia.com>
Reviewed-by: Eike Ziller <eike.ziller@digia.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Make getProperties() return a reference and directly call value() on it.
Almost is a tail-call now, if it wasn't inlined and if the dtor of the
default argument didn't have to be called.
Saves 288bytes in text size even so.
Change-Id: Ie841501c1ce1379ca928f7474b90bc6487d77ab2
Reviewed-by: Valerio Valerio <valerio.valerio@jollamobile.com>
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
The rest of the code uses Q_SIGNALS, even Q_EMIT, so be consistent,
if nothing else.
Change-Id: I6441d0a630e7b592d15431c2b9ff4398223bbe9c
Reviewed-by: Valerio Valerio <valerio.valerio@jollamobile.com>
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
And no, I didn't investigate why a Q_UNUSED line with a missing
semicolon compiled so far...
Change-Id: I72f9bad758932fb617f43e712ac09c9e72436ff4
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
It doesn't allocate memory, so cannot throw and is a lot faster
than qgetenv().
Change-Id: I3bd7b79b520ddbb9d4dd6adb3a495e214f111c2c
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
It doesn't allocate memory, so cannot throw and is a lot faster
than qgetenv().
Change-Id: I78ced6a0207e3a9c6deb71c6ce097eb79fe5e8cf
Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
Instead of initializing accelEnv to -1 (thus forcing the variable
into the data segment), and then overwriting the -1 with a read
from the env-var, dynamically initialize the variable from the
env-var directly, thus allowing the variable back into the bss
segment (which doesn't occupy storage in the executable).
There may have been a reason to do it this way when the old code
could fail due to the memory allocation involved, but now with
qEnvironmentVariableIntValue(), that is no longer a reason.
Change-Id: I619fe45d8eb2a50515f5fb255cabd23a5966b11e
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
It doesn't allocate memory, so cannot throw and is a lot faster
than qgetenv().
Change-Id: I7efe6124ab78092f05ef4296e37bd0d123deb064
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
The types are already defined by qopengl.h, and the GLchar could be
incorrectly defined in the Qt namespace for GLES2 namespaced builds.
Change-Id: Ia2052599538af51fdadc434935d51bbfe8437453
Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
It doesn't belong in QIOScreen, and simplifies the flow when changing
the focus window or the window state of the focus window. Both will
result in calling updateProperties on the view-controller, which will
re-configure the statusbar visibility and hide/show it as appropriate,
before triggering a re-layout of its own view, which will in turn
trigger an update of the screen properties based on the new statusbar
state, before re-layouting of QWindow based on the new screen state.
Change-Id: I89077a3fb5f843949ce833e4e727d2c753ea2eb6
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@digia.com>
This reverts commit dbbb4d1654.
This change should enable QDoc to generate documentation for the
Mac-specific widgets, QMacCocoaViewContainer and QMacNativeWidget.
Change-Id: If0dd6530906e3e13921384372badc73ba4727b9d
Reviewed-by: Andy Shaw <andy.shaw@digia.com>
OpenVG support and the -graphicssystem command-line option
is not available since Qt 5.0.
Change-Id: I19c89cd3bb2c4a2215cdfae9fd783dece637b30f
Task-number: QTBUG-41265
Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
Reviewed-by: Topi Reiniö <topi.reinio@digia.com>
This lifts the documentation into a more recent context. One might
argue that Qt is a little bit older too.
Change-Id: I3e85f21bbad1179136629c2025e3499481fc8334
Task-number: QTBUG-16809
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@digia.com>
Reviewed-by: Topi Reiniö <topi.reinio@digia.com>
Add missing transformation for first rectangle of a region
consisting of multiple rectangles.
Task-number: QTBUG-41300
Change-Id: I1a25c422c93ceade79de79d5c49891e0a7211943
Reviewed-by: MihailNaydenov <garfieldhq@yahoo.com>
Reviewed-by: Alessandro Portale <alessandro.portale@digia.com>
Print a warning when the developer/user has explicitly
requested the software backend, but loading openglsw.dll fails.
Change-Id: I8b1f079538ac70ceacbf1a397a276659c760a4cc
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
The code which extracts style assets for the Android style
is licensed under the Apache license, which is not compatible
with LGPLv2.1. It is, however, compatible with LGPLv3. This
means that the Android platform plugin cannot be LGPLv2.1
as long as this code is included.
To minimize licensing confusion, we default to only providing
LGPLv3 for Android. If you want to build a LGPLv2.1-compatible
library, you can add -no-android-style-assets to the
configuration. This will in turn enable the LGPLv2.1 in
the configure output, and it will disable the extraction
code in the platform plugin.
Running the Android style with an LGPLv2.1-compatible platform
plugin will work, but it will look horrible.
[ChangeLog][Android] Default open-source license for
Qt for Android is now LGPLv3. For compatibility with the LGPLv2.1
license, add "-no-android-style-assets" to your configuration.
Change-Id: I6c7b52140f38138520871fa7c69debbb4ee90e6c
Task-number: QTBUG-41365
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
Reviewed-by: Christian Stromme <christian.stromme@digia.com>
This license file has to exist, since much of the code is licensed under
LGPLv3.
Change-Id: I2795a7cc62f6de65a35921e38d2ab5f8f0233f71
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
We don't have an explicit XPLATFORM_OSX, but XPLATFORM_MAC applies
to both OS X and iOS (as now clarified), so we move the default
out of the XPLATFORM_IOS scope and to a XPLATFORM_MAC scope.
Change-Id: I6b9ba9c881c28def08b9ab863d0165fbd9dedc6d
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
On API-11+ we are going to use PopupMenu instead of ContextMenu to show
context menus. A PopupMenu displays a Menu in a modal popup window
anchored to a View. The popup will appear below the anchor view if there
is room, or above it if there is not.
Task-number: QTBUG-39736
Change-Id: Ie412ab0935b868348ce5c8bb0bf53571ffefd582
Reviewed-by: J-P Nurmi <jpnurmi@digia.com>
Reviewed-by: Paul Olav Tvete <paul.tvete@digia.com>
After much head-scratching, we found no reason for the backwards iteration.
Indeed, forward iteration should be slightly faster than backwards, because
it operates in the direction in which cache-lines are filled, usually.
This is in preparation of using std algorithms instead of hand-written
loops. It avoids having to use std::reverse_iterator.
Change-Id: Id2388eab2339c24deb93095495d87056a9c57133
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
After much head-scratching, we found no reason for the backwards iteration.
Indeed, forward iteration should be slightly faster than backwards, because
it operates in the direction in which cache-lines are filled, usually.
This is in preparation of using std algorithms instead of hand-written
loops. It avoids having to use std::reverse_iterator.
Change-Id: I180c52e0bb90e823216b77d3f49f2a3fd395567d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
After much head-scratching, we found no reason for the backwards iteration.
Indeed, forward iteration should be slightly faster than backwards, because
it operates in the direction in which cache-lines are filled, usually.
This is in preparation of using std algorithms instead of hand-written
loops. It avoids having to use std::reverse_iterator.
Change-Id: Ib62cf0a6f2a33d186cb174b23b0d6bb2891b6c63
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
After much head-scratching, we found no reason for the backwards iteration.
Indeed, forward iteration should be slightly faster than backwards, because
it operates in the direction in which cache-lines are filled, usually.
This is in preparation of using std algorithms instead of hand-written
loops. It avoids having to use std::reverse_iterator.
Change-Id: I31be6ad2b6d78ccce7e8a8f8f8b9e0af62f7471b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
MSVC 2013 complains about the use of 's' if a variable 's' is already
defined in the context:
error C2373: 's' : redefinition; different type modifiers
error C3493: 's' cannot be implicitly captured because no default capture
mode has been specified
This looks like a compiler bug. Anyhow, it's easy to avoid the clash in
most cases by using a more distinctive name ...
Task-number: QTBUG-41706
Change-Id: Iaff1b6d37897fa8cf9e4913effa0498f9fd7bb07
Reviewed-by: hjk <hjk121@nokiamail.com>
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Tracking the file, line, function means the information has to be stored
in the binaries, enlarging the size. It also might be a surprise to some
commercial customers that their internal file & function names are
'leaked'. Therefore we enable it for debug builds only.
[ChangeLog][QtCore][Logging] File, line, function information are not
recorded anymore for logging statements in release builds. Set
QT_MESSAGELOGCONTEXT explicitly to enable recording in all configurations.
Change-Id: I454bdb42bcf5b5a8de6507f29f2a61109dca9b91
Reviewed-by: Fawzi Mohamed <fawzi.mohamed@digia.com>
Reviewed-by: Alex Blasche <alexander.blasche@digia.com>
The example suggested that QProcess searches the PATH variable to find
the executable for the child process. That's not true. The environment
that's passed with setProcessEnvironment is just passed to the child
process. Removed the misleading example and fixed the function's
description.
Task-number: QTBUG-7321
Change-Id: I8ac4b6b02002eb0a99686f09bcf45f9bc677c8e2
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@digia.com>
Even when we do not intend to display the text, we still need to go
through the processing of mnemonics to remove them from the text.
Instead of capping the max underlines to 0, the TextDontPrint option now
just saves adding the underline formats.
Task-number: QTBUG-41593
Change-Id: I67790650dbed0092de2c63e5d5a9349dc02d5846
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
Reviewed-by: Robert Loehning <robert.loehning@digia.com>
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
The proper init/destruction order is as follows:
QEglFsHooks::platformInit()
eglInitialize()
eglTerminate()
QEglFsHooks::platformDestroy()
Prior to this patch platformDestroy() was called before eglTerminate(),
leading to a crash on some platforms.
Additionally we need to destroy the native windows before deleting the
screen, otherwise the QEglFSWindow destructor ends up calling into the
deallocated screen.
Change-Id: Id08ccbac9bb44a778bcf1a55f73c0057e0a7b3af
Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
otherwise we'll produce lines with tens of thousands columns when
dealing with QMAKE_BUNDLE_DATA.
Change-Id: Ia2a70f25e4ee1d3fe976027a7c46d234809a3f70
Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
with qmake now de-duplicating the paths properly, we should version
these QMAKE_BUNDLE_DATA entries as well, so we don't depend on the
symlinking of the regular headers being done first.
Change-Id: Idaa2ccc1ba9b5684b0c8d84f7f760735f54432e1
Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
According to Apple's documentation [1], framework bundles don't
have a 'Contents' folder. Instead, each version folder gets a
'Resources' folder which contains the Info.plist file, and which
is also symlinked at the top-level framework folder.
[1]: https://developer.apple.com/library/mac/documentation/macosx/conceptual/BPFrameworks/Concepts/FrameworkAnatomy.html
Task-number: QTBUG-32895
Change-Id: I5e55cc097b179012add0ceb7c567dace8e282895
Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
the target path may have multiple components, e.g. Headers/private.
obviously, only the first component must be linked in such cases.
Task-number: QTBUG-32895
Change-Id: If632b3b72c170a9fde36e62c165e06ded53deda3
Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
multiple QMAKE_BUNDLE_DATA entries can install into the same directory,
but it obviously makes no sense to symlink that repeatedly.
Change-Id: If65f7acdf4e158e33511917a027a380e642e2f28
Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
instead of duplicating the plist/icon/bundled_files logic just to obtain
the dependencies, create them as a side effect of the actual target
creation.
Change-Id: I6a0fe26c82c490b1040a7a06d5d0e7a4567ae1af
Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
Add @FULL_VERSION@ -> Qt version substitution to
unixmake2.
This makes the Qt-generated Info.plist files compliant
with the bundle signing/validation process.
Task-number: QTBUG-32896
Change-Id: I1818f028c2f740d699629dd78cc0fe6ffaf94a1c
Reviewed-by: Jake Petroules <jake.petroules@petroules.com>
Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
We do so by setting a 'no_plist' config property. Can be overridden
with 'force_debug_plist'.
The debug version of Info.plist would overwrite the release version,
and it also happens to contain invalid data. In particular,
CFBundleExecutable would contain the _debug suffixed libname, which
it shouldn't. See the entry about CFBundleExecutable on
https://developer.apple.com/library/ios/documentation/general/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
Task-number: QTBUG-32894
Change-Id: Ideb018e4768a7c4e276e1b07d77937451f6db6a2
Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>