Benign, but easy to avoid by allocating objects on the stack.
Change-Id: I1933d0abb2ebd53bcf0402f392e7e3c201756b9e
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Benign, but easy to avoid by using the same pattern as in clear().
Change-Id: Ie382313343385f0709519b232a7d58dd8181b8de
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Benign, but easy to avoid by using automatic storage.
Change-Id: I4eefce9a7c902ceadebdd0aba1bbba7e5519cf24
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Benign, but easy to avoid by distinguishing between
owning and non-owning smart pointers.
Change-Id: Idcd7ae550a8e4e00dfcd5570790e2ed985e2379a
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com>
Makes the test execute faster (not that it's slow in any way)
and more importantly gets rid of the QGuiApplication-induced
3rd-party library leaks reported by asan and/or valgrind.
Change-Id: I94b505f15b4db577a2807b0b81464e19ce7e7cab
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
[ChangeLog][Important behavior changes][QSettings]
QSettings::value() now returns an invalid QVariant
when passing an empty key. The code path ran into
an assert, which was only noticeable in debug
builds.
Task-number: QTBUG-41812
Change-Id: I5cc32be3aa267a132e9d6639ecd6cb0bbafc15b0
Reviewed-by: Stéphane Fabry, Cutesoft <stephane.fabry@gmail.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The implementation was inconsistent with QString::right(),
and did not return the N rightmost characters but actually did
the same as QString::mid(N) (returning the rightmost size - N
characters.)
Since this function is fairly recent (Qt 5.2), is documented to
behave the same as QString::right(), and since these APIs are
meant to be interchangeable, this needs to be fixed, even though
it changes behavior.
[ChangeLog][Important Behavior Changes] Changed QStringRef::right()
to be consistent with QString::right(). The function now returns
the N right-most characters, like the documentation already claimed.
Change-Id: I2d1cd6d958dfa9354aa09f16bd27b1ed209c2d11
Task-number: QTBUG-41858
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.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>
IPv6 addresses can start with ":", for which QDir::isAbsolute() would
always return true (QResourceFileEngine::isRelativePath() returns
constant false) and would trip the calculation for local files.
Similarly, IPv6 addresses can start with strings that look like Windows
drives: "a:", "b:", "c:", "d:", "e:" and "f:" (though not today, as
those address blocks are unassigned). Since a valid IPv6 address will
definitely require at least one more colon and Windows file names cannot
contain ':', there's no ambiguity: a valid IPv6 address is never a valid
file on Windows.
This resolves the ambiguity in favor of IPv6 for Unix filenames (which
can contain a colon) and in case of an URL containing scheme, relative
path and no authority ("dead:beef::" for example could have been parsed
as scheme() == "dead" and path() == "beef::").
Task-number: QTBUG-41089
Change-Id: Id9119af1acf8a75a786519af3b48b4ca3dbf3719
Reviewed-by: David Faure <david.faure@kdab.com>
There were several use cases that did not work with the old
implementation and it was not really readable.
Task-number: QTBUG-3472
Task-number: QTBUG-40067
Task-number: QTBUG-23892
Change-Id: I1e038792dc54cdc6f8d9bb59d80b11dd3c56fac6
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
The result of qstrtoull() was unconditionally truncated to an int,
resulting in wrong values being appended to the segments vector
when the numerical segment value was above INT_MAX.
Prevent this by first checking the return value of qstrtoull
as a qulonglong for values larger than INT_MAX and stopping
processing in that case. That means that segments that
numerically overflow an int are now considered part of the
suffix.
Also added tests for the case where a segment value is larger
than ULLONG_MAX. That was already working correctly.
Change-Id: Ia4b89021dcfe6bfae27c8d89bb678ec5e0e3b847
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
I think supporting them now is too complex for the Qt code. We would
probably need to rewrite the parser using a tokenizer so we can find the
right name of the function. Just skipping backwards breaks the support
for returning function pointers and PMFs.
Change-Id: I78636437ecd46d77e6b9b013b2f2668cca1b6cd6
Reviewed-by: David Faure <david.faure@kdab.com>
tst_qtjson.cpp(2711) : warning C4566: character represented by universal-character-name '\u2090' cannot be represented in the current code page (1252)
tst_qtjson.cpp(2712) : warning C4566: character represented by universal-character-name '\u2090' cannot be represented in the current code page (1252)
tst_qtjson.cpp(2713) : warning C4566: character represented by universal-character-name '\u2090' cannot be represented in the current code page (1252)
Task-number: QTBUG-41100
Change-Id: I193dc48236bdd3857657a5684178630f0e1dab6d
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
This was done wrong when using the ini format.
Task-number: QTBUG-22461
Change-Id: Ib9390460bce6138659cceac7e3cd25339ba5e9bb
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
We need to have a finer grained control over the tests
we skip in our CI system. This adds a blacklisting
mechanism that allows blacklisting individual test
functions (or even test data) using a set of predefined
matching keys for the operating system and some other
relevant variables.
QTestlib will search for a file called BLACKLIST in the test
directory and parse it if found. The file contains a simple
ini style list of functions to blacklist. For details see
qtestblacklist.cpp.
Change-Id: Id3fae4b264ca99970cbf9f45bfb85fa75c1fd823
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
If the types doesn't match in QVariant::compare we do a comparison based
on QString, this may end up indicating a full match, though the we don't
match according to cmp. In this case it would be better if we preserved
the non-matching to avoid breaking ordering.
[ChangeLog][QtCore][QVariant] Fixed ordered comparison between QVariants
that do not match but produce identical toString output.
Task-number: QTBUG-40363
Change-Id: I84a8eca11e8875dba9948bde2906ae7c5aa35704
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com>
This reverts commit 20cf632ad5. The commit
produced to many problems during statics destruction. For example
causing QtCreator crash (QTBUG-40987).
Change-Id: Ib52f6a449c2d84deab2de792559a6a065ca45e8d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
A "sharing violation" happens when trying to delete the lock file and another
thread/process is reading it at that very moment. Detect the error and try again,
up to 10000 times - to avoid an infinite loop if QFile::remove fails for another
reason such as a sudden change of permissions preventing us from deleting our
own lock file.
On Unix the deletion can't fail because of readers, but it doesn't hurt
to check the return value there too, to catch other reasons for failures
such as a sudden permission change.
Task-number: QTBUG-38853
Change-Id: Icf12a74faed4a4916e3427abc09d9c33aa141476
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Refactor the code and move more things into the cross platform
code path.
Make sure the flags survive changing the locale of QCollator.
Use the correct locale on Windows, WinRT and OS X. We now
pass all QCollator autotests on these platforms.
Task-number: QTBUG-40778
Change-Id: Ic2d3334b5018c323a35a3ea8fc1d7ab5f99b4e62
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The old code was completely broken. It did dereference
val for user types, but val does in this case only contain
garbage. Instead use the pointer to the correct data.
Change-Id: I20ccf0bfa3dd3774c787d08c51cc8dd7b1ec9a1a
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com>
A well formed JSON document is not allowed to contain
trailing garbage at the end. Don't accept this in the
parser.
Task-number: QTBUG-40062
Change-Id: I0a09dbd099a8c643f58023342546c4e67d026fec
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com>
The comparison operators between QJsonPrivate::String
and QJsonPrivate::Latin1String weren't all correct, leading
to wrong sorting of keys in QJsonObjects when the keys were
outside of the latin1 range and resulting lookup errors.
Task-number: QTBUG-41100
Change-Id: Idceff615f85d7ab874ad2a8e4a6c1ce8c2aa0f65
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com>
Both Q_LITTLE_ENDIAN and Q_BIG_ENDIAN macros are always defined
on all architectures. So, byte order detection results in
"little_endian" value for big endian systems. Test the system
endianness in a right way, according to Q_BYTE_ORDER macro
documentation.
Change-Id: I5523f90567e78d679a3ff2902a8f5377ed39ceb1
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The practical uses of a POD QElapsedTimer are not really that clear, and the
number of misuses of this API are quite high. Default the state to invalid to
prevent against mistakes.
[ChangeLog][QtCore][QElapsedTimer] Is no longer a POD.
Change-Id: I267292acf2bfca7404e3e449dd04410441d7ce26
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
As a side effects it also adds core templates types to the tests
Change-Id: I0e3338e0bffdf21982aa83d404c83288e54411f4
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com>
The iterators for QJsonArray and QJsonObject are currently lacking an
operator-> definition. Unfortunately it is not possible to do in clean
way without redefining either the iterators or QJsonValueRef class.
This patch instead adds two fake pointer classes that are only used
to handle the operator-> return value.
Task-number: QTBUG-29573
Change-Id: Ief785a6afbbedc9e89cf3b6f3958c2c755997a66
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
kUCCollateDigitsAsNumberMask works only if kUCCollateDigitsOverrideMask
is also set.
Update 0: - test added.
Task-number: QTBUG-40777
Change-Id: I48bfec78f5f8439a51f8d749f0fc4397a72b29f2
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
WinRT is a sanboxed environment, hence files can only be created in
some writable location.
For some tests we reset the current directory to minimize the required
changes. We cannot do this for the application lifetime as the test
also has cases where it reads files relative to the executable inside
the sandbox.
Change-Id: Ib9d37c8cffd191f0d1055f835c11d10887923378
Reviewed-by: Andrew Knight <andrew.knight@digia.com>
If we write to a file, its size changes. We should drop previous size
caches.
Change-Id: Ib687c91e5fc88cab588c89023f23da9622160da9
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Reviewed-by: Rafael Roquetto <rafael.roquetto@kdab.com>
Allows to retrieve information about mounted volumes such as label,
total/available size, filesystem type and so on.
Possible use cases are:
- allows to do checks about filesystem before performing actual
operation (such as available/maximum volume size)
- allows to retrive information about volume that can be shown in file
dialogs
- allows to retrieve volume for specific path and check if two or more
paths belong to the same volume or not
[ChangeLog][QtCore] Added QStorageInfo class to retrive information
about mounted volumes and drives
Change-Id: Ibf9c2e6b53ef39c5605894a4422acdbbca4030c4
Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com>
WinRT stores settings inside the app bundle, not in the registry.
Some tests are not fully functional due to errors in the file
implementation (See QTBUG-40588).
QSettings::SystemScope translates to a roaming container on WinRT,
meaning that settings stored inside there should be uploaded and
shared among devices. However, this is untested so far.
The tests have been updated for those platforms which do not store
the order of keys. This has been done on some locations only so
far, but needed to be done on more places for WinRT.
Task-number: QTBUG-33498
Change-Id: Ifd0194387b09c220d31812b4b6fd0ce9a7d84d24
Reviewed-by: Andrew Knight <andrew.knight@digia.com>
Manually included changes from
3a347a4e70
in src/opengl/qgl.cpp.
Conflicts:
src/opengl/qgl_qpa.cpp
src/plugins/platforms/android/androidjnimain.cpp
Change-Id: Ic26b58ee587d4884c9d0fba45c5a94b5a45ee929
Fix disconnection from pointer to member signal that belongs to the base
class, but whose type is a pointer to a member of the derived class.
Commit 9cc106d9d7 fixed connect, so apply
the same fix in disconnect
[ChangeLog][QtCore][QObject] Fixed disconnecting from pointer to member
signal that belongs in the base class but whose type is explicitly given
as a pointer to a member in the derived class
Task-number: QTBUG-40638
Change-Id: Ia546fc8f36e1ea0dd0645bdd820aea47f43677ac
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit adds tests for ref-qualified member functions, the new
syntax for functions and decltype.
__PRETTY_FUNCTION__ for lambdas varies wildly between compilers and will
produce really bizarre results after cleanup. It's not tested and is
known to be broken.
Change-Id: I70c8dbcba54790357cecba35aa45c5cc672f29d1
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
On templates, adding constexpr makes a given instantiation constexpr
if it can be.
This turns qMakePair(0,0), say, into a compile-time constant.
The effects on existing code are small, but exist:
$ size lib/*{-baseline,-paircexp} | sort -nr
6516727 211192 2608 6730527 66b31f lib/libQt5Widgets.so.5.4.0-baseline
6516711 211192 2608 6730511 66b30f lib/libQt5Widgets.so.5.4.0-paircexp
5373720 44492 15976 5434188 52eb4c lib/libQt5Core.so.5.4.0-baseline
5373504 44492 15976 5433972 52ea74 lib/libQt5Core.so.5.4.0-paircexp
5107206 125072 6080 5238358 4fee56 lib/libQt5Gui.so.5.4.0-baseline
5107030 125072 6080 5238182 4feda6 lib/libQt5Gui.so.5.4.0-paircexp
1341290 30180 2600 1374070 14f776 lib/libQt5Network.so.5.4.0-baseline
1341210 30180 2600 1373990 14f726 lib/libQt5Network.so.5.4.0-paircexp
# no other libraries benefit
[ChangeLog][QtCore][QPair] Can now be used in C++11 constexpr contexts.
Change-Id: I3872e6aa33a7d02a168516f4dfa7119efcac8c40
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com>
and make QByteArrayList be a simple typedef.
As a side-effect, the constructor taking a QByteArray is no longer
available since I couldn't find a way to add it to QList<T> when T is
QByteArray. My template-foo failed me. I tried:
- QEnableIf<is_same<T, QByteArray>::value, QByteArray>::type
=> makes QList fail to compile for any T that isn't QByteArray
- make the constructor a template member
=> it compiles if the parameter is a QByteArray, but not a const
char[4] like the test was
- inheriting constructors
=> runs into ICC and Clang bugs that I could not work around
Besides, the constructor with std::initializer_list is a superior
solution anyway.
Change-Id: Ic86fbadc1104142bfd907a5c4147199bf839fb89
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com>
Initial submission of a new class QByteArrayList with the
purpose of aggregating and then joining QByteArray instances.
[ChangeLog][QtCore] Added new QByteArrayList class.
Done-with: Marc Mutz <marc.mutz@kdab.com>
Change-Id: I503af58f125d7f44fef10360177490c933e5840f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The class provides compare operators, stream operators, and hashing
functions. This class aims to be compatible with (but not restricted to)
the Semantic Versioning 2.0 standard (semver.org).
[ChangeLog][QtCore] Added QVersionNumber class
Done-with: Marc Mutz <marc.mutz@kdab.com>
Change-Id: I244c8ccc002909af03987a2df052734d1a8621a9
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
The goal of this commit to make the code in the test work:
QCommandLineParser parser;
parser.addOptions({
{ "a", "The A option." },
{ { "v", "verbose" }, "The verbose option." },
{ { "i", "infile" }, "The input file.", "value" },
});
For this, QCommandLineParser needs a version of addOption that can
take a list of options. That's what addOptions() is for.
More importantly, the QCommandLineOption ctors mustn't be explicit.
OTOH, any implicit conversion from QString or QStringList to
QCommandLineOption is also undesirable.
To solve this dilemma, add new QCommandLineOption ctors that just
take one argument and are explicit, and make the existing ctors
implicit. In order to avoid ambiguities, remove the default values
of their resp. 2nd arguments. The new ctors are by intention not
\since 5.4, as they are completely transparent to the user.
Et voila, even better than getopt_long(3).
[ChangeLog][QtCore][QCommandLineParser] Added addOptions() method.
Change-Id: I5e779f3406cd0f6c8ec6ecbf6c8074af226de300
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit reverts c4cef6fae9.
The above fix for QTBUG-25958 (cloned in QTBUG-40219) is not
complete and introduces the regression QTBUG-30049.
Task-number: QTBUG-30049, QTBUG-25958, QTBUG-40219
Change-Id: I3c4b774dce06c13cb4e089f8413a7747cedfd212
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Background:
It is often necessary/advisable to schedule tasks on thread pools !=
globalInstance(). As Herb Sutter writes in
http://www.drdobbs.com/parallel/use-thread-pools-correctly-keep-tasks-sh/216500409
and the Qt Training Material stresses, tasks you schedule on a (global)
thread pool should be non-blocking, which currently rules out using any of
the QtConcurrent functions for, say, file I/O.
Nonetheless it's often convenient to have thread pools also for file I/O, as
the thumbnail viewer exercise in the Qt Training Material shows. In this
case, you'd use a dedicated thead pool, leaving the global thread pool for
CPU-bound tasks.
Yet, none of the QtConcurrent functions allow to pick the QThreadPool
instance on which to schedule the work created with them.
This patch prepares for them to do so.
This is the first part of the forward-port of
https://qt.gitorious.org/qt/qt/merge_requests/1281.
Implement by using a new QThreadPool* member that defaults to nullptr,
and adding setThreadPool to set this member, then using it in lieu of
QThreadPool::globalInstance() everywhere.
I chose to leave m_pool == nullptr to mean globalInstance() to avoid
creating the global instance whenever a QFuture is created, even if the
future represents the result of a calculation not run on the global thread
pool.
[ChangeLog][QtCore][QFuture] Can now be used with any QThreadPool, not
just globalInstance().
Task-number: QTBUG-17220
Change-Id: I4e1dc18d55cf60141b2fa3d14e2d44a3e9e74858
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Add a test that checks that QHash keeps the first of the keys
that compare equal. This may or may not be documented, but is
inconsistent with the values in a QHash, where the last element
with equal key is kept.
Document this as a test. That way, we'll be informed when the
behavior changes (e.g. by a port to std::unordered_map).
Do the equivalent checks in tst_QMap, too. There, of course,
instead of equal keys, check equivalent ones.
Change-Id: I2c5f04f8e8a6bbc7dbaadadd878a4c876e4df042
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Add a test that checks that QSet keeps the first of the elements
that have equal value. This is documented, but inconsistent with
values in a QHash, which keeps the last element with equal key.
Document this as a test. That way, we'll be informed when the
behavior changes (e.g. by a port to std::unordered_set).
Change-Id: I4ca1718bb86599b925b3ccd13b0856917cd4ce67
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
This is in preparation of rewriting the function for efficiency.
Change-Id: Id5c16b984b95d76e1f26d862e3813f75980f44fb
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The functions can be used to optimize code that do not need to use
the split results as QString directly.
[ChangeLog][QtCore] QString can now split a string to a list of
QStringRef.
Change-Id: Ic2dc929e1fba82f9a060e37c51068a301cb5b866
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
[ChangeLog][QtCore][QByteArray] Fixed a bug that would cause QByteArray
to stop converting toUpper or toLower at the first embedded null
character.
Change-Id: Ia369037206617813d86a8f1489589243c82aa51b
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Use the built-in hex, showbase manipulator to format the number in
hex. Also, apply nospace() only once.
Change-Id: Id4b3d5f082ad13f52c8711408d7ec609bec3a621
Reviewed-by: Alex Blasche <alexander.blasche@digia.com>
Export the former qMessageFormatString() as qFormatLogMessage(). This
allows custom message handlers to format their messages just like the
default message handler, taking qSetMessagePattern() /
QT_MESSAGE_PATTERN into account.
The method should arguably not add the '\n' at the end, which a follow
up commit will fix.
Change-Id: Ib2a9cfda91473df079daf03bf3197e6ac63e013e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Alex Blasche <alexander.blasche@digia.com>
It allows to create a QJsonObject instance in C++ by using
initializer list of pairs QString QJsonValue, for example:
QJsonObject o = {{"property1", 1}, {"property2", 2}};
[ChangeLog][QtCore][QtJson] QJsonObject now supports
C++11 initializer lists.
Task-number: QTBUG-26606
Change-Id: I67af881e175f427e563e685336c48a5f8466b476
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
On supported platform, allow to show a backtrace by using
%{backtrace} or %{backtrace depth=N separator="|"}
[ChangeLog][QtCore][Logging] QT_MESSAGE_PATTERN can include a
backtrace using %{backtrace}
Change-Id: Ib00418c070d3bd6fe846dc04bf69fa91ba64f9cd
Reviewed-by: Kai Koehne <kai.koehne@digia.com>
If the test fails here, output the values actually used in comparison.
Change-Id: Ie4ed5ebdf1951c02b89a9648aee50a99d0bb0628
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This is much more useful than the URL "file:", it allows to use
"empty path" and "empty URL" for the same meaning (e.g. not set).
QFileDialog actually uses "file:" though, as the URL for the
"My Computer" item in the sidebar. This patch preserves that.
[ChangeLog][QtCore][QUrl] QUrl::fromLocalFile now returns an empty URL
if the input string is empty.
Change-Id: Ib5ce1a3cdf5f229368e5bcd83c62c1d1ac9f8a17
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
QJsonValue, while comparing two QJsonArrays, should consult also length
of the arrays, because a different than null base pointer doesn't mean
that an array is not empty.
Change-Id: If76739355a4e74b842e836289565f98d95c006d5
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
QJsonValue, while comparing two QJsonObjects, should consult also length
of the objects, because a different than null base pointer doesn't mean
that an object is not empty.
Change-Id: Ibee1849ef9fed15d32f2c8f2aad9b053846e46b7
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Before this change such code:
QJsonObject o;
o["blah"];
would create property "blah" and assign null value to it, while
this code:
const QJsonObject o;
o["blah"];
would not. The change unifies the confusing behavior. Now reading
a non-existing property, is not causing a property to be added
in any visible way.
Internally QJsonObject stores a special hash of undefined, but
referenced values. Such reference is supposed to not live long,
only to the first compacting or assignment.
Change-Id: Ib022acf74ff49bad88d45d65d7093c4281d468f1
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
The operator should always return an undefined values for an empty
object
Change-Id: Ic38f7660d77c64b2d001967bc5109df4185db74a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
No actual reason for this test, except my curiority. Then again, it's
good to have this check, too.
Change-Id: I815fce7e4dbe76e21cac29beb1dbfc1083191d24
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
No actual reason for this test, except my curiority. Then again, it's
good to have this check, too.
Also checks that the last entry in the init_list "wins", which is
not how std:: containers work.
Change-Id: I4f7d1228f2b90a904b6c3f99e54afcd9970b723e
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
No actual reason for this test, except my curiority. Then again, it's
good to have this check, too.
Also checks that the last entry in the init_list "wins", which is
not how std:: containers work.
Change-Id: Ia284d093cd0029432372630e81657fb687b9516f
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
The old unix locking code is no longer working on unix since it locks on
a file descriptor, but QSaveFile creates a new file, and as a result we
get the lock on the wrong file. Also there is no need to keep the lock
held only for reading as QSaveFile is atomic. It just needs to be held
when doing a read before writing.
As a result, since we don't hold the same lock, there could be a race
with an application running an older version of Qt if they are writing
on the same configuration file.
[ChangeLog][QtCore][QSettings] Fixed data loss while writing the config
to the disk fails.
[ChangeLog][Important behavior changes] The locking mechanism inside
QSettings has changed and is no longer compatible with the one of
previous versions of Qt. There might be corruption if two applications
running different versions of Qt are writing to the same config file
at the same time. You must also now have write permissions in the
directory containing the settings file in order to write settings
Task-number: QTBUG-21739
Change-Id: I0844a5e96c8bc1e1222a3dac6cc48170ca77fe1b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
QRingBuffer is a fully inlined class used in many I/O classes.
So, it must be as fast and small as possible. To this end, a lot of
unnecessary special cases were replaced by generic structures.
Change-Id: Ic189ced3b200924da158ce511d69d324337d01b6
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
The default in QTextStream is to use the C locale, so default
QTextStream are not affected. When you set a QLocale on it, the default
was to use group separators (which is the QLocale default too). This
commit makes QTextStream respect a QLocale in which the
OmitGroupSeparators option had been set.
Task-number: QTBUG-39956
Change-Id: I00fbe12fca7f0287c7217deb487ded6582a03b52
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
They shouldn't exist in the first place. They exist in two cases only:
1) mistake by the user in the QLibrary or QPluginLoader constructors or
setFileName
2) as a kludge for setLoadHints before a file name is set (we need to
store the user's requested hints somewhere)
This is important for the second case, as otherwise all QLibrary and
QPluginLoader objects without a file name would share the setting.
Task-number: QTBUG-39642
Change-Id: Iebff0252fd4d95a1d54caf338d4e2fff4de3b189
Reviewed-by: David Faure <david.faure@kdab.com>
This commit makes replaces the loadHints member with a setter, a getter
and an atomic variable. The setter will not set anything if the library
has already been loaded.
Task-number: QTBUG-39642
Change-Id: Ibb7692f16d80211b52aaf4dc88db1a989738a24d
Reviewed-by: David Faure <david.faure@kdab.com>
Allow to alter the default configuration for categories by passing a
message type: All message types with lower severity are disabled in this
category.
This is useful for libraries, which shouldn't mess with the category
registry itself: Setting rules, a category filter ... might cause
conflicts and ordering problems, so this API should be reserved to the
specific application.
For the Qt categories, we have code in the default category filter that
disables the 'debug' category. However, this is hardcoded, and there's no
way so far for other libraries to get the same behavior. With this patch
one can get the same behavior:
Q_LOGGING_CATEGORY(DRIVER_USB_EVENTS, "driver.usb.events", QtWarningMsg);
[ChangeLog][QtCore][Logging] Added QtMsgType argument to QLoggingCategory
constructor and Q_LOGGING_CATEGORY macro that controls the default
category configuration.
Change-Id: Ib2902f755f9f7285d79888ec30e8f3cef95ae628
Reviewed-by: Alex Blasche <alexander.blasche@digia.com>
~QDebug() removes any trailing space if autoInsertSpaces() is true.
However, if one uses QDebugStateSaver the global autoInsertSpaces might
be false, but a space was added by a custom operator<<.
Explicitly check for this in QDebugStateSaverPrivate::restoreState. Remove
any trailing space if the local state asks for adding trailing spaces, but
the original one doesn't. Add a trailing space if the local state doesn't
ask for one, but the global state does.
Change-Id: I243b5c76d5ed2c1ec4820da35ab6e254da1551d9
Reviewed-by: David Faure <david.faure@kdab.com>
Passing this flag to QFileDevice::map() will allow writes to the mapped memory
without modifying the file that was mapped. These writes will be lost when the
memory is unmapped.
Change-Id: I7d46b044fc370585de8c06fdb4059f1f1be12d7d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
This was prompted by https://git.reviewboard.kde.org/r/119221
Change-Id: Ia148f07f6d711df533693918bbedfa5e7dc02cd5
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Similar to QTextStream::reset(), this resets the stream format to the
defaults. Its primary use is inside custom operator<< implementations,
where you'd want to have a fixed format regardless of the current
stream state.
Change-Id: I421d76c61f164579bb90cf4195cc5376e2dcf0f3
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
We really do not need to do string parsing there.
Change-Id: Ie2277d9ff0d0445285b7108023941af111d9baca
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This revert commit de1d5815c1 which
wrongly fixed a typo. There is no typo because we use startsWith
with that constant.
Also added a test because the %{time} support was added in commit
93563952d0 but the test was missing
Change-Id: Ic96e6f21f989ca3a2905ec6c89b93d2627b77b40
Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com>
The function gives a warning if an argument doesn't exist.
Change-Id: I6a4bbbaf2fd241ced06dc71edfe4ef69732606d1
Reviewed-by: Mitch Curtis <mitch.curtis@digia.com>
Remove old message handler hack as we have a new and better api to
ignore warning messages.
Change-Id: Id967b2672fe3e3638db9977500118a19c2afb730
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
Allow the user to disable the quoting of QString, QByteArray,
QStringLiteral by passing a "noquote()" stream modifier.
This requires another flag to be added to QDebug::Stream. To
keep BC we're using the QMessageLogContext::version field
to differentiate between QDebug streams created by earlier
versions.
Task-number: QTBUG-37146
Change-Id: I9b215eabfcfd754af16ea87f3ef928d698e37d77
Reviewed-by: Jerome Pasion <jerome.pasion@digia.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Check result in initTestData().
Previously, QFINDTESTDATA() was repeatedly invoked in init(). The
data-driven cd() test then failed when invoked stand-alone since
cd_data(), which relies on the data path, is executed before init().
Task-number: QTBUG-40067
Change-Id: I91039247e8dcaedd92fa990f1b5f82bc54b17c60
Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
QMetaType::create can call user code and we should not keep mutex held as
this may cause dead lock.
Make sure the tst_qobjectrace actually emit some signal so the test check
there is no race if the receiver object is destroyed while
the mutex is unlocked.
Task-number: QTBUG-39990
Change-Id: I56ca1ae7a11cd7b33c1a68727370972862e11c2f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Like for integers, this is activated only on QLocales other than C.
[ChangeLog][QtCore][QTextStream] QTextStream now uses group separators
when writing floating-point numbers when the locale is not the C locale.
The old behavior can be restored by setting QLocale::OmitGroupSeparator
on the locale.
Change-Id: Ie451b91017746c3a9b11b6211b2ddd09cd295cd2
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
It allows to create a QJsonArray instance in C++ by using
a similar expression to JSON. For example:
QJsonArray a = {1, 2, 4};
[ChangeLog][QtCore][QtJson] QJsonArray now supports
C++11 initializer lists.
Task-number: QTBUG-26606
Change-Id: Icc352e518d9649d24176c89e7113d200d5c50b0d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>