* apply endianness to the mask as well
* do not apply endianness to "host" entries, they were wrongly behaving
exactly like "big endian" entries.
The issue with the mask was detected by the audio/aac magic
<match type="big16" value="0xFFF0" mask="0xFFF6" offset="0"/>
which failed to identify the test file ct_faac-adts.aac since it was
applying the mask 0xFFF6 instead of 0xF6FF (on a little-endian machine).
Not yet detected by tst_qmimedatabase which is based on shared-mime-info 1.0,
will be covered by the upgrade to 1.8 in dev.
Change-Id: I4fb7af2d367099817e712b14f2a031066d0ac432
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Since the loop says p <= e, no +1 should be added to e.
Testcase:
The magic for application/x-gameboy-rom says
<match type="byte" value="0x0" mask="0x80" offset="323"/>
and this code was checking both byte 323 and byte 324, finding a match
at pos 324, returning application/x-gameboy-rom erroneously.
Given the magic for application/x-gameboy-color-rom:
<match type="byte" value="0x80" mask="0x80" offset="323"/>
the expected result for game-boy-color-test.gbc is application/x-gameboy-color-rom
Not yet detected by tst_qmimedatabase which is based on shared-mime-info 1.0,
will be covered by the upgrade to 1.8.
Change-Id: I2396cb1ccfb26db5a24d5551fef493cc0b98a247
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
initially, the idea was that QLibraryInfo would receive a
pre-sysrootified ExtPrefix from the builtin qt.conf. matching this
against the sysroot would then tell us whether to sysrootify the Prefix
from a "regular" qt.conf as well.
however, this would have lead to some major ugliness and inconsistency
between the code paths, so i changed my mind.
unfortunately, i failed to adjust the remaining code, leading to
169a40d51 entirely breaking sysrootification ...
the proper (and nicely consistent) solution is to introduce a
SysrootifyPrefix key to qt.conf. this is user-accessible as well, so as
a bonus it is now possible to adjust the setting at qmake installation
time. incidentally, this omission was the last thing that prevented
using the same qmake host build for any imaginable configuration of the
same qt version ... i think.
Change-Id: Ic0eebf21f93651f6374628c0ad8b206d696a4a7e
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
We chose to use UTF-8 as it allows us to ensure there's no mistaking the
hostname in case the locale is changed, if the host name contains
characters outside of US-ASCII.
But this didn't work because the code that wrote the hostname always
used the local 8-bit codec instead of UTF-8. On Unix, we used the
result of gethostname(3) directly, which is supposedly on the locale codec.
This commit doesn't fix Windows, which requires _wgetenv, the plan being
to encapsulate that with a qEnvironmentVariable() method.
[ChangeLog][QtCore][QLockFile] Fixed a bug that caused QLockFile not to
recognize a stale lock file if the machine's hostname contained non-US-
ASCII characters, on Unix. A Windows fix is still pending.
Task-number: QTBUG-49640
Change-Id: Ib9d045544ff370ec901626658a84ec4e6575fe21
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Callers can persist a QModelIndex which was not persisted before in a
slot connected to the signal, and such a persisted index must be updated
in the course of the layoutChange.
Store the indexes to persist after emitting the signal.
Task-number: QTBUG-32981
Change-Id: Ibee4c0d84817d72603a03fe5b22fdeefeac0695e
Reviewed-by: David Faure <david.faure@kdab.com>
Similar to the fix in the parent commit, incorrect updating of the
internal data structures during layout changes can lead to dangling
pointers being dereferenced later. Moves are treated as layoutChanges
by this proxy by forwarding to the appropriate method. However, data is
incorrectly cleared prior to that forwarding. Remove that, and let the
layoutChange handling take appropriate action.
Change-Id: Iee951e37152328a4e6a5fb8e5385c32a2fe4c0bd
Reviewed-by: David Faure <david.faure@kdab.com>
In sourceLayoutAboutToBeChanged the source model update is ignored if
the affected parents are filtered out anyway. The same logic is
attempted in the sourceLayoutChanged slot, but there the early-return
logic is applied too late - the mapping is cleared before performing the
early-return. Because pointers into the mapping are used in the
internalPointer of QModelIndexes in this class, persistent indexes used
later will segfault when attempting to dereference it.
Additionally, if a parent becomes invalid as a result of the
layoutChange, it would be filtered out by the condition in the loop,
resulting in a different result in the comparison of emptiness of the
parents container.
Fix that by persisting the parent's container, and performing the test
for early-return before clearing the mapping.
Task-number: QTBUG-47711
Task-number: QTBUG-32981
Change-Id: If45e8a1c97d39454160f52041bc9ae7e337dce97
Reviewed-by: David Faure <david.faure@kdab.com>
The process of loading a plugin is examplified by the qLoadPlugin
function (though not all users of QFactoryLoader use this function, they
all do something similar):
const int index = loader->indexOf(key);
if (index != -1) {
QObject *factoryObject = loader->instance(index);
if (FactoryInterface *factory = qobject_cast<FactoryInterface *>(factoryObject))
if (PluginInterface *result = factory->create(key, std::forward<Args>(args)...))
return result;
}
QFactoryLoader::indexOf already locked the mutex, but not
QFactoryLoader::instance. This commit fixes that.
Note that calling the virtual create() in the plugin's factory is not
protected by the mutex. Each plugin's factory must be thread-safe and
also create an object that works on any thread too. It's also the
responsibility of the caller of qLoadPlugin to ensure that it's called
thread-safely.
Task-number: QTBUG-42855
Change-Id: I63e21df51c7448bc8b5ffffd148ebee33d4c47de
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Clang pre-3.4 didn't like this and it's used in Xcode 5.1 (which we need
to support for 5.8).
error: 'this' cannot be implicitly captured in this context
typename T::const_iterator i = c.begin(), e = c.end();
^
Task-number: QTBUG-57488
Change-Id: I63e21df51c7448bc8b5ffffd148e688d7c9b89d6
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
After all the check makes sense here. If a timer was removed as a result
of sendEvent and it was not at the end of the list the list is not
shrunk but the timer info's id is just set to INVALID_TIMER_ID.
Additionally the timer's object should be fetched before we unlock the
locker as timerIdToObject is changed in removeTimer and we might access
a nullptr if the timer has been removed.
Reverts c83ba01f7b
Task-number: QTBUG-56756
Change-Id: Ib1a04c02fbfcf4c939b4891d42f954dc9e87149e
(cherry picked from commit 8f2088db17)
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
Some public functions in QString and QDebug are declared inside
Q_COMPILER_UNICODE_STRINGS. This commit defines it for QDoc, and
adds documentation for QDebug functions that are now visible to
QDoc.
Change-Id: Ia7f2501c1dc7b8244dcc3ce4adcd2019fdbffcb6
Reviewed-by: Martin Smith <martin.smith@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
this moves us another step towards the "outer" configure doing just
minimal bootstrapping of qmake.
a challenge here was that so far, qmake itself needed qconfig.cpp. this
was replaced by usage of a qt.conf file instead of compiled-in values.
however, to make the executable still self-contained, that qt.conf is
embedded into it (by simple appending of a fixed signature and the text
file).
the qmake with the embedded qt.conf is not used for the qt build itself,
which instead relies on the qt.conf in bin/ as before. however, due to
the missing built-in values, this file now needs to contain more
information than before. but except for a minimal version that is needed
to start up qmake/configure at all, that file is now also generated with
qmake. as some of the newly set up properties are subsequently used by
configure itself, qmake gains a (deliberately undocumented) function to
reload the qt.conf after it's fully populated.
unlike the old implementations, this one doesn't emit redundant qt.conf
entries which match the hard-coded fallbacks. omitting them leads to
leaner files which are more comprehensible.
Started-by: Paolo Angelelli <paolo.angelelli@qt.io>
Change-Id: I4526ef64b3c89d9851e10f83965fe479ed7f39f6
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
The builtins clzs and ctzs have been removed. Additionally they were
never proper internal GCC builtins and shouldn't have been used in a
constexpr function in the first place. This patch removes the assumption
that they exist when BMI is available, and let GCC fall back to using
__builtin_clz and __builtin_ctz.
Change-Id: I3e0b4e246098bb9ce6ede28b311948260ef881b9
Task-number: QTBUG-56813
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reinterpret_cast()ing a pointer to a suitably sized integer is not guaranteed
to always give the same result for the same pointer (!). Therefore the
resulting integers are not comparable in a meaningful way. std::less is
supposed to be used to compare arbitrary pointers, so use it.
(Hopefully and reasonably, under the hood std::less does exactly what we
were doing, so this isn't BiC.)
Change-Id: I9960b3d6e35657fe7a25b842054f5d338280e850
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Add a bool *ok out parameter to qt_normalizePathSegments() and return false
when ".." are left over for an absolute path, indicating an attempt to
change above root.
Factor out static helper qt_cleanPath() to be able to pass the return value
to QDir::cd() and return on failure from there.
Amends change 63f634322b, which did
not handle UNC paths.
Task-number: QTBUG-53712
Change-Id: I3e63a5dd0259306a0b99145348d815899582f78e
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Calling QDir::cleanPath() on "//server/path/.." resulted in "/".
Factor out a function to determine the root path part of an absolute
path for later use, and handle some special cases:
- Consider server name of "//server/path/.." as part of the prefix.
- Check on the root path for WinRT.
Task-number: QTBUG-53712
Change-Id: Ibddacf06212b6fc86fa74a5e4078df6cfd5b66f5
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Commit c35fef9d3b wasn't sufficient. The
problem is that there's a complex combination of libc headers (math.h),
C++ headers (cmath), which may be provided by three different sources on
Linux (glibc, gcc and ICC). On some combinations, the isnan macro leaks
from math.h or cmath and that's what the the commit above tried to fix.
On some other combinations, there's no macro but there's an ::isnan
function defined. When we do "using namespace std; return isnan(x);",
that causes a compilation error. This commit solves that by detecting
whether there is a macro defined.
error: more than one instance of overloaded function "isnan" matches the argument list
function "isnan(double)"
function "std::isnan(double)"
argument types are: (double)
Change-Id: Iaeecaffe26af4535b416fffd148bf71826541bdd
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The C++ standard says in [support.initlist.access]/1:
constexpr const E* begin() const noexcept;
Returns: A pointer to the beginning of the array. If size() == 0 the
values of begin() and end() are unspecified but they shall be
identical.
So we can't assume it's non-null. I didn't want to remove the Q_ASSERT,
so passing a non-null pointer to append() remains required. This patch
simply won't call append() if the initializer list is empty.
This was already tested, but the failure is with a compiler that is not
part of the Qt CI.
Task-number: QTBUG-57277
Change-Id: Iaeecaffe26af4535b416fffd1489806872b412ee
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
That's what happens when you don't test and just rely on an the warning
listing. ICC has two warning numbers for deprecated warnings: one that
matches Q_DECL_DEPRECATED and one for Q_DECL_DEPRECATED_X.
Change-Id: I73fa1e59a4844c43a109fffd148ca7a05eda8f13
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Do not create QByteArray from const char* to compare with other
QByteArray, because there is an overloaded operator==.
So avoid needless allocations.
Reorder condition, because isEmpty() method is cheaper than
string compare.
Change-Id: I8d2c8a0fb247528d9ce485007431167372d62bff
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
And get rid of related DEFINES in the pri file
Change-Id: I54cf25b7cb447af22b410213759044e8018939a6
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
After all the check makes sense here. If a timer was removed as a result
of sendEvent and it was not at the end of the list the list is not
shrunk but the timer info's id is just set to INVALID_TIMER_ID.
Additionally the timer's object should be fetched before we unlock the
locker as timerIdToObject is changed in removeTimer and we might access
a nullptr if the timer has been removed.
Reverts c83ba01f7b
Task-number: QTBUG-56756
Change-Id: Ib1a04c02fbfcf4c939b4891d42f954dc9e87149e
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
Turn them into proper private features, and remove setting of
defines in the pri file.
Change-Id: Iafc11e93d4a9349bf15971dc1adac9a828ea03f6
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
... if sync() has already been called manually.
Change-Id: I11bd6810aa3c1065a72ffaa2001d1bdbf8bf9c89
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Add parentheses after function names, replace
is different -> differs
Change-Id: I6332db1d1650ed8d8320c5f20cd79d0bf1870e27
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
As _BitScanForward and friends are not marked constexpr in Visual Studio,
functions using these may not be marked either.
Task-number: QTBUG-57086
Change-Id: I29cfa4459580b5740f1011e7f39309844518ce03
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
This is the only warning we disable in a lot of places in Qt 5.8 source
code. If other warnings become common, we can add macros for them too.
Change-Id: Iaeecaffe26af4535b416fffd1489d1968e29c52a
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
The user can call qSetMessagePattern after program start, so we need to
be sure that the parsed argument data is properly cleared.
Task-number: QTBUG-57144
Change-Id: I1978c6b95bd84639a8c4fffd1487429b04725522
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
Qt5Config restricts search paths of Qt components to ${_qt5_install_prefix}
to prevent accidentally using system Qt modules in case of restricted Qt
configuration. However this does not work properly when Qt is used without
installation, in particular when building cmake-based QtWebKit as a Qt
submodule, because ${_qt5_install_prefix} resolves to QtBase and does not
contain components from other modules.
This patch changes search path from ${_qt5_install_prefix} to all qt5
subdirectories.
Change-Id: Icf01a256097710889573ad69d847b9c3bffa1449
Reviewed-by: Kevin Funk <kevin.funk@kdab.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
They should be enabled/disabled through the configuration system.
Remove some unused defines, and move one define from qglobal.h to
a proper feature definition in Qt Gui.
Change-Id: Ie8d5bff9712ba745af60b42ceca3f0440bed2706
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Instead of doing the conversion from the big-endian data by hand, let's
use the convenience functions from qendian.h.
Change-Id: If3966ca94428afabb1f5c922967fb9970f976622
Reviewed-by: hjk <hjk@qt.io>
Shuffled its parts to make clear which bits are public, private and
protected. QDateTimeEditPrivate makes rather heavy use of the last.
Change-Id: Ic5f9d0c5cc85f02e57d3f31e9ac31a17428c5311
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
If it fails, we get NULL back but haven't free()d the old pointer;
saving the NULL return over the old pointer forgets it, leaking the
memory it pointed to. This is particularly severe in the JSON
parser's grow(), where reading a very large JSON document can lead to
the last successful realloc() in a doubling pattern being very large
indeed; the subsequent failure will leak this very last allocation.
Only worth checking for, however, when the subsequent code takes care
to handle failure: in most cases, if realloc() fails, we're about to
crash anyway.
Change-Id: Icd3a503f169be224f0a058c58e8b7c82a3241ae7
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Anton Kudryavtsev <antkudr@mail.ru>
Text that should simply have been naming days of the week used
Qt::Sunday rather than the simple day name.
Change-Id: I64a3cdacd854c1c9c0fbf2d11826555086d674f4
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>