General sanitization pass to clean-up code, fix a lot of compiler warnings,
as well as issues pointed by static code analyzers, such as Coverity Scan
(credits to Kurt Schwehr for tackling a large part of them) or CLang Static Analyzer.

prevent potential out of bounds read/write to TIFFTAG_EXTRASAMPLES (#6282)

do not use first directory as potential mask, to avoid assertion in GTiffDataset::SetDirectory?() (#6287)

reject files with strips/tiles/scanlines bigger than 2 GB to avoid 32 bit integer overflow.
Also in case of files with Contig PlanarConfiguration? do not make reading one block for band 2 OK when reading for band 1 issued an error (#6288)

Warped VRT: fix deadlock in situation where warped VRT datasets are read in multiple threads and the block cache reaches saturation. Also add a GDAL_ENABLE_READ_WRITE_MUTEX config option that can be set to NO to disable the read/write mutex mechanism in cases where it would deadlock (#6400)

determine a resolution that will not result in a number that is larger than the maximum size of an integer. Any value that exceeds the maximum size of an integer will raise an invalid dataset dimensions error. (​https://github.com/OSGeo/gdal/pull/89)

OGRLayer::Erase(): do not discard input geometries that have no intersection with method layer (#6322)

OGRLayer::Erase(): Speedup = ~70%

Add OGRPreparedGeometryContains()

Use prepared geometry intersects as pretest in layer Intersection, Union, and Identity methods if requested.
Use prepared geometry containment as pretest in layer Intersection method if requested.

Bail out from layer algebra methods if GEOS calls fail and not SKIP_FAILURES.

OGR_G_SetPoints(): error out if padfX or padfY == NULL, do not change coordinate dimension to 3D when pabyZ == NULL, fix optimization on linestring to call setPoints() only if the strides are the ones of a double, not 0 as incorrectly done before (#6344)

make it accept files with non standard extension if they still have the correct application_id (#6396); also accept the .gpkx extension that may be used for extended geopackages

emit warning when generating a database without .gpkg/.gpkx extension (#6396)

as GPKG 1.1 uses a different application_id, emit a more specific warning if the application id starts with GPxx (but is not GP10). Add GPKG_WARN_UNRECOGNIZED_APPLICATION_ID config option to avoid the warning

correct scope of gpkg_geom_XXXXX extensions to be read-write, and allow reading geometry types CURVE or SURFACE

VFS: increase mxPathname to 2048 by default, and provide OGR_SQLITE_VFS_MAXPATHNAME config option to be able to configure that higher if that would be needed. Useful when dealing with very long names like /vsicurl/.... with AWS S3 security tokens

VFS: do not probe -wal files on /vsicurl/

SXF driver:

fix wrong use of endianness macros to fix behaviour on big-endian hots

fix editing with 'direct' geometry mode which could cause attribute column to be empty (#6289)

fix crash with a OGRVRTWarpedLayer using a source layer that would have non geometry column (unlikely to happen currently as this would require explicit disabling it, but more likey with following commit that createe VRT non-spatial layer implictly when the source is non-spatial, linked to #6336)

avoid creating an implicit wkbUnknown geometry field when the source has no geometry column and there's no XML elements related to geometry fields (#6336)