qgis/QGIS — pull request #1717 by manisandro (2014-12-02 12:55:20+00:00)
Title: Store result of OGR_FD_GetGeomType into a QGis::WkbType, not in an int, ...

In `qgsogrprovider.cpp`, the result of `OGR_FD_GetGeomType` (which returns an `OGRwkbGeometryType`) is assigned to an `int`. All 2.5 D fields of `OGRwkbGeometryType` cause the signed int to overflow (`int32_t` overflows after `0x7FFFFFFF`):

wkbPoint25D = 0x80000001, /**< 2.5D extension as per 99-402 */
wkbLineString25D = 0x80000002, /**< 2.5D extension as per 99-402 */
wkbPolygon25D = 0x80000003, /**< 2.5D extension as per 99-402 */
wkbMultiPoint25D = 0x80000004, /**< 2.5D extension as per 99-402 */
wkbMultiLineString25D = 0x80000005, /**< 2.5D extension as per 99-402 */
wkbMultiPolygon25D = 0x80000006, /**< 2.5D extension as per 99-402 */
wkbGeometryCollection25D = 0x80000007 /**< 2.5D extension as per 99-402 */

Since the value is later casted to a `QGis::WkbType`, this should not be an issue on most platforms, assuming the compiler will choose `QGis::WkbType` to be an `uint32_t`, and hence the value overflows back. However, since the compiler is allowed to freely choose the integer type to use for an enum, this is not robust.

Similar situation arises with `QgsVectorLayer::mWkbType` being an int, and it being assigned a `Qgis::WkbType`.

This commit changes the types to ensure no potentially dangerous casts are performed.

Funded by Sourcepole