EGLFS: Fix plugin destruction (again)

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>
Do not assume QEGLPlatformCursor in the common egl bits

The kms hook uses a custom QPlatformCursor.

Change-Id: I4543df6314a45abfc20495cbffdd376aed8bbe93
Reviewed-by: Jørgen Lind <jorgen.lind@digia.com>
QTriangulator: fix the array of deltas between primes

121e71293500e08148d3c2ce31a8e9b618943cba fixed it into QHash,
so copy the same ranges here.

Change-Id: Ia7738f878965b5593d6ca641d6b8911abfdd2dd3
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com>
QTriangulator: fix a potential out of bounds access

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>
Prepare QVector::contains() for sharing with QList::contains()

...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>
Prepare QVector::operator==() for sharing with QList::operator==()

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

It doesn't allocate memory, so cannot throw and is a lot faster
than qgetenv().

Change-Id: I5b5aec194aab66c7cea8da736655cc7270ade272
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>