This functionality is used in multiple places in Qt itself, so it makes
sense to have a global function for this. This also allows to map this
onto specialized assembler instructions, should an architecture provide
them, later on.
Also added comprehensive tests, using a 4-bit lookup-table implementation
as a reference.
Change-Id: I8c4ea72cce54506ebb9fbe61141dbb5f1b7a660f
Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
Changelog: http://pcre.org/changelog.txt
Amongst other things, the Unicode tables were upgraded to 6.2.0
and case folding support was added, which also fixes a QString
autotest (marked as XFAIL).
Qt still requires 8.30, not 8.32.
Change-Id: I4056c1dc1d949d33443bb8ca280de4c8c363ac74
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Say hello to Interlingua and Mongolian once again.
Change-Id: I735fbc5793f34620be1f6932a251224b9ded02e3
Reviewed-by: Denis Dzyubenko <denis@ddenis.info>
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
When QTemporaryFile attempts to create a new file in
createFileFromTemplate, it fails if the filename exists and is a
directory. Windows returns error code 5 (ERROR_ACCESS_DENIED) in this
case - rather than ERROR_FILE_EXISTS - which is not handled.
This patch handles ERROR_ACCESS_DENIED in addition to the already
handled ERROR_FILE_EXISTS, meaning that QTemporaryFile will continue
to look for unique names when a directory with the same name exists.
Task-number: QTBUG-30058
Change-Id: I42339887d7f5483e3dc6a03a9da15111c350da8f
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
Reviewed-by: David Faure <david.faure@kdab.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
When variadic templates and decltype are supported, detect the best
overload of operator() to call.
Currently, the code takes the type of the operator(), which requires that
the functor only has one, and that it has no template parameter.
This feature is required if we want to connect to c++1y generic lambda
(N3418)
Change-Id: Ifa957da6955ea39ab804b58f320da9f98ff47d63
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com>
OpenProcess + WaitForSingleObject is supposed to fail after the process exits,
but this seems to take some time until Windows notices.
Change-Id: I942a9b4a458c23fc4ac33b28386e28821128e991
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
Remove all trailing whitespace from the following list of files:
*.cpp *.h *.conf *.qdoc *.pro *.pri *.mm *.rc *.pl *.qps *.xpm *.txt *README
excluding 3rdparty, test-data and auto generated code.
Note A): the only non 3rdparty c++-files that still
have trailing whitespace after this change are:
* src/corelib/codecs/cp949codetbl_p.h
* src/corelib/codecs/qjpunicode.cpp
* src/corelib/codecs/qbig5codec.cpp
* src/corelib/xml/qxmlstream_p.h
* src/tools/qdoc/qmlparser/qqmljsgrammar.cpp
* src/tools/uic/ui4.cpp
* tests/auto/other/qtokenautomaton/tokenizers/*
* tests/benchmarks/corelib/tools/qstring/data.cpp
* util/lexgen/tokenizer.cpp
Note B): in about 30 files some overlapping 'leading tab' and
'TAB character in non-leading whitespace' issues have been fixed
to make the sanity bot happy. Plus some general ws-fixes here
and there as asked for during review.
Change-Id: Ia713113c34d82442d6ce4d93d8b1cf545075d11d
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
Change the data type of PI from qreal to double, because qreal is defined as float and not as double on arm.
The testcase however expects PI to be a double value.
Change-Id: I003481071ecb2c1f54e6dcee9b450da2f1654969
Reviewed-by: Thomas McGuire <thomas.mcguire@kdab.com>
Reviewed-by: Laszlo Papp <lpapp@kde.org>
While adding a test case for the new behavior, two issues
with the connectSlotsByName implementation came up:
1. for auto-connected slots that don't exactly match a signal,
a 'compatible' one is searched. There might be more than
one of those. The implementation randomly picks any.
2. The "No matching signal for %s" warning gets printed even for
slots that can never be connected via connectSlotsMyName
anyway (e.g. "on_something"). This is inconsistent.
This fixed both: an explicit warning is printed if more than one
'compatible' signal is found and the "No matching signal for %s"
warning is only printed if the slot adheres to the full
"on_child_signal()" naming convention.
In the process I added comments and changed the code slightly to
make it more readable and explicitly hint at non-obvious behavior.
Change-Id: Icc8e3b9936188d2da8dfff9f0373c8e5c776eb14
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
The problem was that the elapsed timer was not restarted,
causing the currentTime() not being adjusted for the time
it was paused.
Task-number: QTBUG-30108
Change-Id: Ib9b2c5a0dea52762109e0b25f1068dd7c88e15ba
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@digia.com>
tst_QSharedMemory::simpleProcessProducerConsumer is on the top list of
unstable autotests. Disabling it for now.
Task-number: QTBUG-25655
Change-Id: Ib297b3382b736794bab6cdb668103bef74a55d8c
Reviewed-by: Samuel Rødal <samuel.rodal@digia.com>
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Replaces "QRegularExpresssion" with "QRegularExpression" and adds some
auto tests for the warning itself.
Task-number: QTBUG-30054
Change-Id: Iba333a4388795eccca809fb430c295f503794263
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com>
It introduced a regression by requiring that a p/P was also present:
QTime time = QTime::currentTime();
qDebug() << time.toString("h:mm:ss a");
// Outputs "10:05:42 am" in Qt 4.8.
// Outputs "10:05:42 a" with 6497649730.
This patch also clarifies the QTime::toString(QString) documentation.
Change-Id: I4d73a959c2ca76304f03a4ce9717b540ad4e8811
Reviewed-by: Andy Shaw <andy.shaw@digia.com>
We do not currently have shared memory or system semaphore support
on Android.
Change-Id: I8e8f3fc6ff8d6de0333002c3e1b31cf070416dbd
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
Android is not a proper Linux, and in particular it does not have
pthread_yield().
Change-Id: Ibf94cfacdc24d0c3baaef002c64f9f50c72c01d2
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
This broke the build on Android where fileno returns a short.
Change-Id: Ic8d32380078faeedcd22e785a912fede28251156
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
QMetaObject::connectSlotsByName(QObject* o) creates a list of all
children to look for signals that match slots of o. This changeset
simply adds the object o itself to that list.
The motivation is to finally fix the long standing QtCreator bug
QTCREATORBUG-6494. Where executing 'Go to slot...' and choosing
'accepted()' for a simple QDialog named 'MyDialog' will add a
on_MyDialog_accepted() slot to MyDialog. That slot never gets
connected. More details may be found in the linked QTBUG-7595.
Task-number: QTBUG-7595
Task-number: QTCREATORBUG-6494
Change-Id: I35f52761791af697eabb569adb5faee6fae50638
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
In case somebody uses QVector as a stack, it is not fair to have
takeLast, removeLast and pop_back to do way too much work.
This is still very slow compared to std::vector::pop_back
(mostly due implicit sharing), however it is more than a
factor faster than before.
Change-Id: I636872675e80c8ca0c8ebc94b04f587a2dcd6d8d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This patch adds takeFirst and takeLast which are functions
that QList also has.
Change-Id: I761f90b529774edc8fa96e07c6fcf76226123b20
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This patch adds the functions removeFirst() and removeLast().
Functions that QList has.
Beside making these functions, pop_back and pop_front are
redirected to these rather than calling erase.
Change-Id: Ifc5f8a78e33f436f06f21095a920ec5d4311fd6f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
I changed the existing test-case code to make it more scalable
in terms of adding more connectSlotsByName related tests. The
old "manual list of ints"-method was really not developer friendly.
This is a preparation for a subsequent modification of
connectSlotsByName behavior.
Change-Id: Ib760e52631ce4b5ae2a3ebdb4854849ff6c93bfe
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
This provides a fast multiInsert in QMap (and a fast insert in
QMultiMap) when providing a correct hint.
Change-Id: I3c864c3a7842765fe63f8ecb4b54d0e8c9fd22d7
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This adds a fast insert on QMap when providing a correct hint.
Change-Id: I256bba342932c1d4f24c6e65074e1bf47b519537
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
QSharedMemory and QSystemSemaphore are not available on QNX so the autotests can not be built.
Change-Id: Ibfb405f951d21342d64bf215cedc203a8cefe070
Reviewed-by: Wolfgang Bremer <wbremer@rim.com>
Reviewed-by: Thomas McGuire <thomas.mcguire@kdab.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The former applies both on Mac OS X and iOS, but 'macx' is specific to
Mac OS X.
ios.conf and macx.conf now share most of their settings in the common
mac.conf. We set the default QMAKE_MAC_SDK before loading mac.conf, so
that any overrides in the device config will apply afterwards. This
means configure's mkspec parsing will be able to read the QMAKE_MAC_SDK.
Change-Id: I0c7e26a6a0103e19b23ef152aa9e4ab461cee632
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@digia.com>
This avoids crashes accessing deleted memory when creating a QObject
after the last QObject had been deleted, like a qDebug() in global
destructors.
==41000== Invalid read of size 4
==41000== at 0x5F01ED5: bool QBasicAtomicOps<4>::ref<int>(int&) (qatomic_x86.h:208)
==41000== by 0x5F01309: QBasicAtomicInteger<int>::ref() (qbasicatomic.h:147)
==41000== by 0x5F24051: QThreadData::ref() (qthread.cpp:100)
==41000== by 0x614A984: QObject::QObject(QObject*) (qobject.cpp:681)
==41000== Address 0x6ee73f0 is 0 bytes inside a block of size 152 free'd
==41000== at 0x4A0736C: operator delete(void*) (vg_replace_malloc.c:480)
==41000== by 0x5F240BF: QThreadData::deref() (qthread.cpp:109)
==41000== by 0x6113F6B: QCoreApplicationData::~QCoreApplicationData() (qcoreapplication.cpp:268)
The comment right above the change in qthread.cpp looks eerily similar
to the problem I'm trying to fix. However, the actual change that
introduced the change is not in the Qt public history, so we can't
know for sure what the problem was then.
Change-Id: I0dba895b041fe6cf81e6f8939ca85035cd00aad1
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Add setProgram() and setArguments() methods to the QProcess api.
Add a convenient start(QIODevice::OpenMode) method.
Move the implementation of QProcess::start() to QProcess::open()
unifying the QProcess api with other QIODevice subclasses.
Change-Id: Id1af57da05f750fe8d526d391589c05ee8037bca
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Locking between processes, implemented with open(O_EXCL) on Unix
and CreateFile(CREATE_NEW) on Windows.
Supports detecting stale lock files and deleting them.
Advisory locking is used to prevent deletion of files that are still in use.
Change-Id: Id00ee2a4e77a29483d869037c7047c59cb909339
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Most notably, .com and .net now may contain non-ASCII characters.
list has been generated from
http://www.mozilla.org/projects/security/tld-idn-policy-list.html
Change-Id: Idc3191dc782bc4173ccb19b4bc81f4f061ca7999
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The problem was that the HolderBase destructor was getting called after
the contained type's constructor threw an exception, as is required by
RAII semantics (the base was fully initialized, so it had to be
destroyed). That was required because we want to return a non-null
pointer from operator() during destruction and return null after
destruction, to keep compatibility with Qt 4.
The solution is to only set the guard to Destroyed only if it is already
at value Initialized. This way, if the HolderBase destructor is run as
part of the stack unwinding, it knows that the construction did not
complete.
Change-Id: I9849b43ed7112bf9e70861b48a56a924c286617e
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
The motivation is to enable coloration the way KDE currently does.
It can now be achieved with a QT_MESSAGE_OUTPUT set to
"%{appname}(%{category}) \033[31m%{if-debug}\033[34m%{endif}%{function}\033[0m: %{message}"
I was thinking about supporting directly color using something like
%{begin-category-color} that would be smart and detect if we are running
on a terminal, but it would be less flexible in the way the colors van
be configured.
Changelog: QT_MESSAGE_OUTPUT can contain conditionals based on the type
of the message
Change-Id: Icd8de04734a94a3afcbf542a5b78b290a1914960
Reviewed-by: David Faure (KDE) <faure@kde.org>
For systems where the Unix signature checker isn't enabled (read: Mac
and Windows), QPluginLoader must actually load the plugin to query for
the metadata. On Mac it even tried to keep the library loaded to avoid
unloading and reloading again when the user calls load().
However, that plus the fact that it was calling load_sys() (on Mac)
meant that it would bypass the reference count checking. And on all
Unix, if a library-that-wasnt-a-plugin was already loaded by way of a
QLibrary, it would have an effect of unloading said library.
So remove the "caching" of the library. We should instead invest time to
write a proper Mach-O binary decoder.
Task-number: QTBUG-29776
Change-Id: Iebbddabe60047aafedeced21f26a170f59656757
Reviewed-by: Liang Qi <liang.qi@digia.com>
Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com>