QList: iterate forward in operator==

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>
QList: iterate forward in count()/contains()

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>
QVector: iterate forward in operator==

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>
QList: iterate forward in contains()

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>
QWidgetBackingStore: use qEnvironmentVariableIntValue()

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>
QWidgetBackingStore: simplify reading of an env-var in {move,scroll}Rect()

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>
QPlatformTheme: use qEnvironmentVariableIntValue()

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>
QApplication: use qEnvironmentVariableIntValue()

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>
QTreeView: remove dead code

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>
QOfonoService: use Q_SLOTS

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>
Simplify QOfonoDataConnectionManagerInterface::getProperty()

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>
Add a macro to disable only some 8 bit/16 bit string conversions

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>
Add support for gcc/clang's sanitize features

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>