[gdal] 26/29: Imported Upstream version 2.0.0~rc2+dfsg

Sebastiaan Couwenberg sebastic at moszumanska.debian.org
Sun Jun 14 20:19:47 UTC 2015


This is an automated email from the git hooks/post-receive script.

sebastic pushed a commit to branch experimental-2.0
in repository gdal.

commit bf69e09ee97030f9130bec06a10d8892e9d00665
Author: Bas Couwenberg <sebastic at xs4all.nl>
Date:   Sun Jun 14 21:02:38 2015 +0200

    Imported Upstream version 2.0.0~rc2+dfsg
---
 MIGRATION_GUIDE.TXT                              |   6 +-
 NEWS                                             |  27 ++---
 alg/gdalgrid_priv.h                              |  11 +-
 alg/gdaltransformer.cpp                          |   6 +-
 alg/gdalwarper.h                                 |   4 +-
 apps/commonutils.cpp                             |   6 +-
 apps/gdal_grid.cpp                               |  10 +-
 apps/gdal_utilities.dox                          |   5 +-
 apps/ogr_utilities.dox                           |   3 +-
 apps/ogrlineref.cpp                              |   2 +-
 configure                                        |   4 +-
 configure.in                                     |  12 +--
 data/gdalvrt.xsd                                 |  22 +++-
 frmts/e00grid/e00read.c                          |   2 +-
 frmts/ecw/ecwasyncreader.cpp                     |   4 +-
 frmts/ecw/ecwdataset.cpp                         |   6 +-
 frmts/gtiff/geotiff.cpp                          |  20 ++--
 frmts/hdf4/hdf-eos/GDapi.c                       |   4 +-
 frmts/hdf4/hdf-eos/SWapi.c                       |   4 +-
 frmts/l1b/l1bdataset.cpp                         |   6 +-
 frmts/mbtiles/frmt_mbtiles.html                  |   2 +-
 frmts/openjpeg/frmt_jp2openjpeg.html             |   8 +-
 frmts/openjpeg/openjpegdataset.cpp               |  10 +-
 frmts/pdf/frmt_pdf.html                          |   2 +-
 frmts/rasdaman/frmt_rasdaman.html                |   2 +-
 frmts/vrt/vrt_tutorial.dox                       |  14 ++-
 frmts/vrt/vrtsources.cpp                         |  34 +++++--
 frmts/zlib/zlib.h                                |   2 +-
 gcore/gdal.h                                     |   4 +-
 gcore/gdal_misc.cpp                              |  14 ++-
 gcore/gdaldataset.cpp                            |  14 +--
 gcore/gdaldllmain.cpp                            |   2 +-
 gcore/gdaldrivermanager.cpp                      |   6 +-
 gcore/gdaljp2metadata.cpp                        |   6 +-
 gcore/gdalproxypool.cpp                          |  75 ++++++++++++--
 gcore/gdalrasterblock.cpp                        | 122 +++++++++++++----------
 man/man1/gdal-config.1                           |   4 +-
 man/man1/gdal2tiles.1                            |   4 +-
 man/man1/gdal_calc.1                             |   4 +-
 man/man1/gdal_contour.1                          |   4 +-
 man/man1/gdal_edit.1                             |   4 +-
 man/man1/gdal_fillnodata.1                       |   4 +-
 man/man1/gdal_grid.1                             |   4 +-
 man/man1/gdal_merge.1                            |   4 +-
 man/man1/gdal_polygonize.1                       |   4 +-
 man/man1/gdal_proximity.1                        |   4 +-
 man/man1/gdal_rasterize.1                        |   4 +-
 man/man1/gdal_retile.1                           |   4 +-
 man/man1/gdal_sieve.1                            |   4 +-
 man/man1/gdal_translate.1                        |   4 +-
 man/man1/gdal_utilities.1                        |   8 +-
 man/man1/gdaladdo.1                              |   4 +-
 man/man1/gdalbuildvrt.1                          |   4 +-
 man/man1/gdalcompare.1                           |   4 +-
 man/man1/gdaldem.1                               |   4 +-
 man/man1/gdalinfo.1                              |   4 +-
 man/man1/gdallocationinfo.1                      |   4 +-
 man/man1/gdalmanage.1                            |   4 +-
 man/man1/gdalmove.1                              |   4 +-
 man/man1/gdalsrsinfo.1                           |   4 +-
 man/man1/gdaltindex.1                            |   4 +-
 man/man1/gdaltransform.1                         |   4 +-
 man/man1/gdalwarp.1                              |   4 +-
 man/man1/nearblack.1                             |   4 +-
 man/man1/ogr2ogr.1                               |   6 +-
 man/man1/ogr_utilities.1                         |   8 +-
 man/man1/ogrinfo.1                               |   4 +-
 man/man1/ogrlineref.1                            |   4 +-
 man/man1/ogrtindex.1                             |   4 +-
 man/man1/pct2rgb.1                               |   4 +-
 man/man1/rgb2pct.1                               |   4 +-
 nmake.opt                                        |   4 +-
 ogr/ogrcurvecollection.cpp                       |   4 +-
 ogr/ogrgeometrycollection.cpp                    |   6 +-
 ogr/ogrgeometryfactory.cpp                       |  12 +--
 ogr/ogrlinestring.cpp                            |   6 +-
 ogr/ogrsf_frmts/arcobjects/aolayer.cpp           |   6 +-
 ogr/ogrsf_frmts/arcobjects/ogr_ao.h              |   2 +-
 ogr/ogrsf_frmts/cartodb/drv_cartodb.html         |   2 +-
 ogr/ogrsf_frmts/csv/drv_csv.html                 |   2 +-
 ogr/ogrsf_frmts/filegdb/FGdbDatasource.cpp       |   6 +-
 ogr/ogrsf_frmts/filegdb/FGdbLayer.cpp            |  14 +--
 ogr/ogrsf_frmts/filegdb/FGdbResultLayer.cpp      |   2 +-
 ogr/ogrsf_frmts/filegdb/ogr_fgdb.h               |   4 +-
 ogr/ogrsf_frmts/generic/ogrunionlayer.h          |   4 +-
 ogr/ogrsf_frmts/geojson/drv_geojson.html         |   2 +-
 ogr/ogrsf_frmts/gml/ogrgmldatasource.cpp         |   6 +-
 ogr/ogrsf_frmts/gpkg/drv_geopackage_raster.html  |   4 +-
 ogr/ogrsf_frmts/gpkg/ogrgeopackagelayer.cpp      |   2 +-
 ogr/ogrsf_frmts/gpkg/ogrgeopackagetablelayer.cpp |   4 +-
 ogr/ogrsf_frmts/ili/imdreader.cpp                |  40 +++++---
 ogr/ogrsf_frmts/mitab/mitab_bounds.cpp           |   2 +-
 ogr/ogrsf_frmts/openfilegdb/filegdbtable.cpp     |   4 +-
 ogr/ogrsf_frmts/pg/ogrpglayer.cpp                |   6 +-
 ogr/ogrsf_frmts/pg/ogrpgtablelayer.cpp           |   8 +-
 ogr/ogrsf_frmts/pgdump/ogrpgdumplayer.cpp        |   6 +-
 ogr/ogrsf_frmts/selafin/drv_selafin.html         |   2 +-
 ogr/ogrsf_frmts/selafin/ogrselafindriver.cpp     |   2 +-
 ogr/ogrsf_frmts/shape/shpopen.c                  |   2 +-
 ogr/ogrsf_frmts/sqlite/drv_sqlite.html           |   2 +-
 ogr/ogrsf_frmts/sqlite/ogr_sqlite.h              |   4 +-
 ogr/ogrsf_frmts/sqlite/ogrsqlitetablelayer.cpp   |   8 +-
 ogr/ogrsf_frmts/vrt/drv_vrt.html                 |   2 +-
 ogr/ogrsf_frmts/vrt/ogrvrtlayer.cpp              |   8 +-
 port/cpl_csv.cpp                                 |   6 +-
 port/cpl_error.cpp                               |   6 +-
 port/cpl_multiproc.cpp                           |  22 ++--
 port/cpl_virtualmem.cpp                          |   4 +-
 port/cpl_virtualmem.h                            |   4 +-
 swig/include/gdal_array.i                        |  14 +--
 swig/java/GNUmakefile                            |  10 +-
 swig/php/gdal_wrap.cpp                           |   2 +-
 swig/php/gdalconst_wrap.c                        |   2 +-
 swig/php/ogr_wrap.cpp                            |   2 +-
 swig/php/osr_wrap.cpp                            |   2 +-
 swig/python/extensions/gdal_array_wrap.cpp       |   2 +-
 swig/python/extensions/gdal_wrap.cpp             |   2 +-
 swig/python/extensions/gdalconst_wrap.c          |   2 +-
 swig/python/extensions/ogr_wrap.cpp              |   2 +-
 swig/python/extensions/osr_wrap.cpp              |   2 +-
 swig/python/osgeo/gdal_array.py                  |  12 +--
 swig/python/samples/validate_jp2.py              |  12 +--
 122 files changed, 549 insertions(+), 378 deletions(-)

diff --git a/MIGRATION_GUIDE.TXT b/MIGRATION_GUIDE.TXT
index 6f7b134..a6138bb 100644
--- a/MIGRATION_GUIDE.TXT
+++ b/MIGRATION_GUIDE.TXT
@@ -24,7 +24,7 @@ C++ API:
 
   * OGRLayer::GetInfo() has been removed.
 
-  * All methods of OGRDataSource have been transfered to GDALDataset, except
+  * All methods of OGRDataSource have been transferred to GDALDataset, except
     SyncToDisk() that should now be implemented as FlushCache() in drivers.
 
   * GDALOpenInfo::papszSiblingFiles member is now private. Use the new
@@ -141,7 +141,7 @@ Behaviour changes:
 
   * The PG and SQLite drivers could accept apparently nested calls to StartTransaction()
     (at the layer level). This is no longer possible since they are now redirected
-    to dataset transactions, that explicitely do not support it.
+    to dataset transactions, that explicitly do not support it.
 
 H) RFC 55: Refined SetFeature() and DeleteFeature() semantics
 
@@ -227,7 +227,7 @@ OGR drivers :
 
   * Due to RFC 41, if a OGR driver calls SetGeomType(wkbNone) on a layer,
     it will be impossible to affect geometries to features of that layer.
-    This worked before, although it was inconsistant, but it does no longer now.
+    This worked before, although it was inconsistent, but it does no longer now.
     In the developmenet of RFC 41, the CSV and VRT drivers have been upgraded
     to fix such errors.
 
diff --git a/NEWS b/NEWS
index 84cc106..9860b00 100644
--- a/NEWS
+++ b/NEWS
@@ -57,7 +57,7 @@ Build(Unix):
  * Make sure $(GDAL_INCLUDE) is first to avoid being confused by GDAL headers of a previous version elsewhere in the include path (#5664)
  * Always use stat rather than stat64 for Mac OSX in AC_UNIX_STDIO_64. (#5780, #5414).
  * Add support for ECW SDK 5.1 (#5390)
- * Do not enable Python bindings if PYTHON env variable is set without --with-python being explicitely specified (#5956)
+ * Do not enable Python bindings if PYTHON env variable is set without --with-python being explicitly specified (#5956)
 
 Build(Windows):
  * PDF: fix compilation issue with Visual Studio 2012 (#5744)
@@ -100,6 +100,7 @@ Port:
  * vsipreload: implement clearerr() and readdir64() (#5742)
  * CPLsetlocale(): return a string that is thread-locale storage to avoid potential race in CPLLocaleC::CPLLocaleC() (#5747)
  * CPLHexToBinary(): faster implementation (#5812)
+ * CPLAcquireMutex(): improve performance on Windows (#5986)
 
 Core:
  * Add imagery (satellite or aerial) metadata support (Alos, DigitalGlobe, Eros, GeoEye, OrbView, Landsat, Pleiades, Resurs-DK1, Spot/Formosat).
@@ -191,6 +192,7 @@ Utilities:
  * gdallocationinfo: add -oo option
  * gdaltransform: add a -output_xy flag to restrict output coordinates to 'x y' only
  * gdal_grid: use nodata= parameter in the algorithm string to determine the nodata value to set on the band (#5605)
+ * gdal_grid: fix crash in optimized mode with GCC 4.4 on 64bit (#5987)
  * gdalbuildvrt: add a -r option to specify the resampling algorithm
  * gdal_edit.py: add -unsetstats option (and fix -a_nodata to run on all bands, ant not just first one)
  * gdal_edit.py: add -stats and -approx_stats flags (patch by mwtoews, #5805)
@@ -204,7 +206,7 @@ Utilities:
  * pct2rgb.py: make it work with color tables with less than 256 entries (#5555)
  * gdal_fillnodata.py: FillNodata: copy no data value to destination band when creating a dataset (if available) (#4625)
  * gdal_proximity.py: add a -use_input_nodata flag
- * gdalcompare.py: add options to supress selected comparisons
+ * gdalcompare.py: add options to suppress selected comparisons
  * gdalcompare.py: takes into account differences in overview bands
  * gdalcompare.py: compute difference on float to avoid integer underflow
  * epsg_tr.py: change to make it possible to export GEOCCS and COMPD_CS to proj.4 epsg and PostGIS spatial_ref_sys.sql files
@@ -469,6 +471,7 @@ RPFTOC driver:
  * add tweak for weird relative directory names in the A.TOC file (#5979)
 
 VRT driver:
+ * add handling of a shared='0' attribute on <SourceFilename> to open sources in non-shared mode, and VRT_SHARED_SOURCE config option that can be set to 0 in case the shared attribute isn't there (#5992)
  * VRT warp: make selection of source overview work (#5688)
  * VRT warp: expose as many overviews in warped dataset as there are in source dataset, and make warped VRT honour -ovr parameter of gdalwarp (#5688)
  * make sure nodata value set on VRT raster band is taken into account in statistics computation (#5463)
@@ -818,7 +821,7 @@ Shapefile driver:
  * make REPACK compact .shp if SetFeature() is called and changes one geometry size (#5706)
  * add check not to cut unicode character while cut the string lengnt for field max length during SetFeature
  * avoid reading whole .shx at open time for /vsicurl/
- * add SHAPE_REWIND_ON_WRITE configuration option that can be set to NO to disable correction of ring winding order on write. Usefull when dealing with MultiPolygon that are MultiPatch objects in fact (#5888)
+ * add SHAPE_REWIND_ON_WRITE configuration option that can be set to NO to disable correction of ring winding order on write. Useful when dealing with MultiPolygon that are MultiPatch objects in fact (#5888)
  * Make ENCODING layer creation option prioritary over SHAPE_ENCODING config. option
 
 SOSI driver:
@@ -1064,8 +1067,8 @@ Utilities:
  * gdal_translate: fix output file naming scheme in gdal_translate -sds (#5119)
  * gdal_translate: fix logic in detection non-gray color table level (#5245)
  * gdal_translate: add a -norat option
- * gdal_translate: don't add 0.1 when -scale is used with a dstmin equal to dstmax (usefull to generate a raster with uniform color, i.e. scaleRatio = 0)
- * gdal_translate: use floor() to compute image coordinates from world coordinates when specifying -projwin (usefull when extracting from left or top of upper-left corner, which generate negative image coordinates) (#5367)
+ * gdal_translate: don't add 0.1 when -scale is used with a dstmin equal to dstmax (useful to generate a raster with uniform color, i.e. scaleRatio = 0)
+ * gdal_translate: use floor() to compute image coordinates from world coordinates when specifying -projwin (useful when extracting from left or top of upper-left corner, which generate negative image coordinates) (#5367)
  * gdaltindex: remove annoying warning 'Warning 1: Field location of width 255 truncated to 254' (#5121)
  * gdaltindex: add -src_srs_name and -src_srs_format to go with MapServer RFC100; add also a -f and -lyr_name options to be able to create a non-shapefile tileindex
  * gdalwarp: Fix segfault where metadata values weren't being nullchecked properly during conflict resolution (#5069)
@@ -1354,9 +1357,9 @@ Core:
  * introduce OGRLayer::FindFieldIndex() / OGR_L_FindFieldIndex() to lookup potentially laundered field names (RFC 42)
  * OGR SQL: upgrade to support RFC 41 (multiple geometry fields)
  * OGR SQL: more stricter checks
- * OGR SQL: make parsing error report a usefull hint where the syntax error occured
+ * OGR SQL: make parsing error report a useful hint where the syntax error occured
  * OGR SQL: fix thread-safety of swq_op_registrar::GetOperator() (#5196)
- * OGR SQL: support not explicitely specifying AS keyword for aliasing a column spec
+ * OGR SQL: support not explicitly specifying AS keyword for aliasing a column spec
  * OGR SQL: don't call CONCAT(a_column ...) or SUBSTR(a_column ...) as a_column
  * OGR SQL: validate that arguments of MAX, MIN, AVG, SUM, COUNT are columns and not any expression since this is not supported
  * OGR SQL: make AVG field definition a OFTReal
@@ -1513,7 +1516,7 @@ LIBKML driver:
  * when writing a .kmz file, put layers .kml docs into a layers/ subdirectory
  * fix mem leaks, and use after free in kml2FeatureDef() (#5240)
  * create document with default namespace set to http://www.opengis.net/kml/2.2
- * when writing, consider empty strings as unset (usefull when converting from CSV)
+ * when writing, consider empty strings as unset (useful when converting from CSV)
  * don't write empty <Style /> element if OGR_STYLE is empty string
  * transform multigeometry with one single component into single geometry
  * create libkml/ subdirectory entry in .kmz
@@ -2006,7 +2009,7 @@ NetCDF driver:
  * Fix SetNoDataValue() - do not update when already set to new value (#4484)
  * Convert longitude values in [180,360] interval to [-180,180] (#4512) - override with config option GDAL_NETCDF_CENTERLONG_180=0
  * Support 2D GEOLOCATION arrays when a projected variable has coordinates attribute and supporting lon/at arrays (#4513)
- * Ignore coordinate and bounds variables (CF sections 5.2, 5.6 and 7.1) as raster bands, but expose them as subdatasets - this allows to open files with projected SRS (or dimension bounds) directly, without specifying the variable as a subdataset
+ * Ignore coordinate and bounds variables (CF sections 5.2, 5.6 and 7.1) as raster bands, but expose them as subdatasets - this allows opening files with projected SRS (or dimension bounds) directly, without specifying the variable as a subdataset
  * Better support for Gaussian grids - store original latitude values in special Y_VALUES geolocation metadata item and use it for netcdf export (#4514)
  * Write multi-dimensional variables to a single variable (not one for each unrolled band) in CreateCopy() (#2581)
  * Fix handling of km units in netcdf driver and importFromProj4() (#4769)
@@ -3511,7 +3514,7 @@ Port:
 Core:
  * RFC 24: progressive/async raster reading
  * On Unix, add capability of opening the target of a symlink through GDALOpen()
-   even if it not a real filename. Usefull for opening resources expressed as
+   even if it not a real filename. Useful for opening resources expressed as
    GDAL virtual filenames in software offering only file explorers (#3902)
  * Assume anything less than 100000 for GDAL_CACHEMAX is measured in metabytes.
  * Read cartesian coordinates if applicable in GDALLoadOziMapFile().
@@ -3931,7 +3934,7 @@ Core:
  * Add OGRLayer::GetName() and OGRLayer::GetGeomType() virtual methods,
    and their C and SWIG mappings (#3719)
  * On Unix, add capability of opening the target of a symlink through OGROpen()
-   even if it not a real filename. Usefull for opening resources expressed as
+   even if it not a real filename. Useful for opening resources expressed as
    GDAL virtual filenames in software offering only file explorers (#3902)
  * Expat based XML readers : add support for reading files with Windows-1252
    encoding
@@ -5019,7 +5022,7 @@ XPlane/Flightgear driver:
 == SWIG Language Bindings ==
 
 General:
- * Recommanded SWIG version is 1.3.39
+ * Recommended SWIG version is 1.3.39
  * Added API : 
     - GDAL :
         gdal.FilldoData(), gdal.FileFromMemBuffer(), gdal.Unlink()
diff --git a/alg/gdalgrid_priv.h b/alg/gdalgrid_priv.h
index 02f3540..fd61c34 100644
--- a/alg/gdalgrid_priv.h
+++ b/alg/gdalgrid_priv.h
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: gdalgrid_priv.h 28033 2014-11-30 16:37:24Z rouault $
+ * $Id: gdalgrid_priv.h 29314 2015-06-05 20:21:11Z rouault $
  *
  * Project:  GDAL Gridding API.
  * Purpose:  Prototypes, and definitions for of GDAL scattered data gridder.
@@ -81,6 +81,14 @@ CPLErr GDALGridInverseDistanceToAPower2NoSmoothingNoSearchAVX(
 #endif
 
 #if defined(__GNUC__) 
+#if defined(__x86_64)
+#define GCC_CPUID(level, a, b, c, d)            \
+  __asm__ ("xchgq %%rbx, %q1\n"                 \
+           "cpuid\n"                            \
+           "xchgq %%rbx, %q1"                   \
+       : "=a" (a), "=r" (b), "=c" (c), "=d" (d) \
+       : "0" (level))
+#else
 #define GCC_CPUID(level, a, b, c, d)            \
   __asm__ ("xchgl %%ebx, %1\n"                  \
            "cpuid\n"                            \
@@ -88,3 +96,4 @@ CPLErr GDALGridInverseDistanceToAPower2NoSmoothingNoSearchAVX(
        : "=a" (a), "=r" (b), "=c" (c), "=d" (d) \
        : "0" (level))
 #endif
+#endif
diff --git a/alg/gdaltransformer.cpp b/alg/gdaltransformer.cpp
index c4e5774..62a528e 100644
--- a/alg/gdaltransformer.cpp
+++ b/alg/gdaltransformer.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: gdaltransformer.cpp 29271 2015-06-01 14:17:30Z rouault $
+ * $Id: gdaltransformer.cpp 29309 2015-06-05 18:48:48Z rouault $
  *
  * Project:  Mapinfo Image Warper
  * Purpose:  Implementation of one or more GDALTrasformerFunc types, including
@@ -38,7 +38,7 @@
 #include "cpl_list.h"
 #include "cpl_multiproc.h"
 
-CPL_CVSID("$Id: gdaltransformer.cpp 29271 2015-06-01 14:17:30Z rouault $");
+CPL_CVSID("$Id: gdaltransformer.cpp 29309 2015-06-05 18:48:48Z rouault $");
 CPL_C_START
 void *GDALDeserializeGCPTransformer( CPLXMLNode *psTree );
 void *GDALDeserializeTPSTransformer( CPLXMLNode *psTree );
@@ -710,7 +710,7 @@ retry:
         // In some cases this can result in 0 values. See #5980
         // so fallback to safer method in that case
     }
-    if( dfDeltaX == 0.0 || dfDeltaX == 0.0 )
+    if( dfDeltaX == 0.0 || dfDeltaY == 0.0 )
     {
         dfDeltaX = dfMaxXOut - dfMinXOut;
         dfDeltaY = dfMaxYOut - dfMinYOut;
diff --git a/alg/gdalwarper.h b/alg/gdalwarper.h
index 68c3684..4221bf1 100644
--- a/alg/gdalwarper.h
+++ b/alg/gdalwarper.h
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: gdalwarper.h 28876 2015-04-08 22:21:55Z rouault $
+ * $Id: gdalwarper.h 29330 2015-06-14 12:11:11Z rouault $
  *
  * Project:  GDAL High Performance Warper
  * Purpose:  Prototypes, and definitions for warping related work.
@@ -45,7 +45,7 @@
 
 CPL_C_START
 
-/* Note: values are selected to be consistant with GDALRIOResampleAlg of gcore/gdal.h */ 
+/* Note: values are selected to be consistent with GDALRIOResampleAlg of gcore/gdal.h */ 
 /*! Warp Resampling Algorithm */
 typedef enum {
   /*! Nearest neighbour (select on one input pixel) */ GRA_NearestNeighbour=0,
diff --git a/apps/commonutils.cpp b/apps/commonutils.cpp
index 3d10e86..2248546 100644
--- a/apps/commonutils.cpp
+++ b/apps/commonutils.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: commonutils.cpp 27384 2014-05-24 12:28:12Z rouault $
+ * $Id: commonutils.cpp 29330 2015-06-14 12:11:11Z rouault $
  *
  * Project:  GDAL Utilities
  * Purpose:  Common utility routines
@@ -31,12 +31,12 @@
 #include "cpl_string.h"
 #include "gdal.h"
 
-CPL_CVSID("$Id: commonutils.cpp 27384 2014-05-24 12:28:12Z rouault $");
+CPL_CVSID("$Id: commonutils.cpp 29330 2015-06-14 12:11:11Z rouault $");
 
 /* -------------------------------------------------------------------- */
 /*                      CheckExtensionConsistency()                     */
 /*                                                                      */
-/*      Check that the target file extension is consistant with the     */
+/*      Check that the target file extension is consistent with the     */
 /*      requested driver. Actually, we only warn in cases where the     */
 /*      inconsistency is blatant (use of an extension declared by one   */
 /*      or several drivers, and not by the selected one)                */
diff --git a/apps/gdal_grid.cpp b/apps/gdal_grid.cpp
index 06fc474..d47e141 100644
--- a/apps/gdal_grid.cpp
+++ b/apps/gdal_grid.cpp
@@ -1,5 +1,5 @@
 /* ****************************************************************************
- * $Id: gdal_grid.cpp 27942 2014-11-11 00:57:41Z rouault $
+ * $Id: gdal_grid.cpp 29330 2015-06-14 12:11:11Z rouault $
  *
  * Project:  GDAL Utilities
  * Purpose:  GDAL scattered data gridding (interpolation) tool
@@ -40,7 +40,7 @@
 #include "gdalgrid.h"
 #include "commonutils.h"
 
-CPL_CVSID("$Id: gdal_grid.cpp 27942 2014-11-11 00:57:41Z rouault $");
+CPL_CVSID("$Id: gdal_grid.cpp 29330 2015-06-14 12:11:11Z rouault $");
 
 /************************************************************************/
 /*                               Usage()                                */
@@ -610,7 +610,7 @@ int main( int argc, char ** argv )
 {
     GDALDriverH     hDriver;
     const char      *pszSource=NULL, *pszDest=NULL, *pszFormat = "GTiff";
-    int             bFormatExplicitelySet = FALSE;
+    int             bFormatExplicitlySet = FALSE;
     char            **papszLayers = NULL;
     const char      *pszBurnAttribute = NULL;
     double          dfIncreaseBurnValue = 0.0;
@@ -665,7 +665,7 @@ int main( int argc, char ** argv )
         {
             CHECK_HAS_ENOUGH_ADDITIONAL_ARGS(1);
             pszFormat = argv[++i];
-            bFormatExplicitelySet = TRUE;
+            bFormatExplicitlySet = TRUE;
         }
 
         else if( EQUAL(argv[i],"-q") || EQUAL(argv[i],"-quiet") )
@@ -1021,7 +1021,7 @@ int main( int argc, char ** argv )
     if ( nYSize == 0 )
         nYSize = 256;
 
-    if (!bQuiet && !bFormatExplicitelySet)
+    if (!bQuiet && !bFormatExplicitlySet)
         CheckExtensionConsistency(pszDest, pszFormat);
 
     hDstDS = GDALCreate( hDriver, pszDest, nXSize, nYSize, nBands,
diff --git a/apps/gdal_utilities.dox b/apps/gdal_utilities.dox
index 8d7019d..b4f24b4 100644
--- a/apps/gdal_utilities.dox
+++ b/apps/gdal_utilities.dox
@@ -1,9 +1,10 @@
 #ifndef DOXYGEN_SKIP
-/* $Id: gdal_utilities.dox 29243 2015-05-24 15:53:26Z rouault $ */
+/* $Id: gdal_utilities.dox 29338 2015-06-14 17:53:28Z rouault $ */
 #endif /* DOXYGEN_SKIP */
 
 /*! 
 \page gdal_utilities GDAL Utilities
+\brief A collection of GDAL related programs.
 
 The following utility programs are distributed with GDAL. 
 
@@ -173,7 +174,7 @@ and exit.
 
 \htmlonly
 <p>
-$Id: gdal_utilities.dox 29243 2015-05-24 15:53:26Z rouault $
+$Id: gdal_utilities.dox 29338 2015-06-14 17:53:28Z rouault $
 </p>
 \endhtmlonly
 */
diff --git a/apps/ogr_utilities.dox b/apps/ogr_utilities.dox
index 59b5315..8f1495a 100644
--- a/apps/ogr_utilities.dox
+++ b/apps/ogr_utilities.dox
@@ -1,4 +1,5 @@
 /*! \page ogr_utilities OGR Utility Programs
+\brief A collection of OGR related programs.
 
 The following utilities are distributed as part of the OGR Simple Features
 toolkit:
@@ -266,7 +267,7 @@ types.
 Add "25D" to the name to get 2.5D versions.
 Starting with GDAL 1.10, PROMOTE_TO_MULTI can be used to automatically promote layers
 that mix polygon or multipolygons to multipolygons, and layers that mix linestrings or
-multilinestrings to multilinestrings. Can be usefull when converting shapefiles to PostGIS
+multilinestrings to multilinestrings. Can be useful when converting shapefiles to PostGIS
 (and other target drivers) that implements strict checks for geometry type.
 Starting with GDAL 2.0, CONVERT_TO_LINEAR can be used to to convert non-linear geometries
 types into linear geometries by approximating them.</dd>
diff --git a/apps/ogrlineref.cpp b/apps/ogrlineref.cpp
index 204c661..cf94e7c 100644
--- a/apps/ogrlineref.cpp
+++ b/apps/ogrlineref.cpp
@@ -1223,7 +1223,7 @@ int main( int nArgc, char ** papszArgv )
         else if( EQUAL(papszArgv[iArg],"-f") )
         {
             CHECK_HAS_ENOUGH_ADDITIONAL_ARGS(1);
-            //bFormatExplicitelySet = TRUE;
+            //bFormatExplicitlySet = TRUE;
             pszFormat = papszArgv[++iArg];
         }
         else if( EQUAL(papszArgv[iArg],"-dsco") )
diff --git a/configure b/configure
index 74b2748..e03e625 100755
--- a/configure
+++ b/configure
@@ -17463,7 +17463,7 @@ $as_echo "no" >&6; }
              if test "$with_sse" = "yes"; then
                echo "Caution: the generated binaries will not run on this system."
              else
-               echo "Disabling SSE as it is not explicitely required"
+               echo "Disabling SSE as it is not explicitly required"
                HAVE_SSE_AT_COMPILE_TIME=""
                SSEFLAGS=""
              fi
@@ -17537,7 +17537,7 @@ $as_echo "no" >&6; }
              if test "$with_avx" = "yes"; then
                echo "Caution: the generated binaries will not run on this system."
              else
-               echo "Disabling AVX as it is not explicitely required"
+               echo "Disabling AVX as it is not explicitly required"
                AVXFLAGS=""
                HAVE_AVX_AT_COMPILE_TIME=""
              fi
diff --git a/configure.in b/configure.in
index 000ebdb..a3eadb7 100644
--- a/configure.in
+++ b/configure.in
@@ -1,5 +1,5 @@
 dnl ***************************************************************************
-dnl $Id: configure.in 29175 2015-05-09 14:08:22Z rouault $
+dnl $Id: configure.in 29336 2015-06-14 17:37:21Z rouault $
 dnl
 dnl Project:  GDAL
 dnl Purpose:  Configure source file.
@@ -257,7 +257,7 @@ if test "$with_sse" = "yes" -o "$with_sse" = ""; then
 
     dnl On Solaris, the presence of SSE instructions is flagged in the binary
     dnl and prevent it to run on non SSE hardware even if the instructions are
-    dnl not executed. So if the user did not explicitely requires SSE, test that
+    dnl not executed. So if the user did not explicitly requires SSE, test that
     dnl we can run SSE binaries
     if test "$HAVE_SSE_AT_COMPILE_TIME" = "yes"; then
        case $host_os in
@@ -270,7 +270,7 @@ if test "$with_sse" = "yes" -o "$with_sse" = ""; then
              if test "$with_sse" = "yes"; then
                echo "Caution: the generated binaries will not run on this system."
              else
-               echo "Disabling SSE as it is not explicitely required"
+               echo "Disabling SSE as it is not explicitly required"
                HAVE_SSE_AT_COMPILE_TIME=""
                SSEFLAGS=""
              fi
@@ -324,7 +324,7 @@ if test "$with_avx" = "yes" -o "$with_avx" = ""; then
 
     dnl On Solaris, the presence of AVX instructions is flagged in the binary
     dnl and prevent it to run on non AVX hardware even if the instructions are
-    dnl not executed. So if the user did not explicitely requires AVX, test that
+    dnl not executed. So if the user did not explicitly requires AVX, test that
     dnl we can run AVX binaries
     if test "$HAVE_AVX_AT_COMPILE_TIME" = "yes"; then
        case $host_os in
@@ -337,7 +337,7 @@ if test "$with_avx" = "yes" -o "$with_avx" = ""; then
              if test "$with_avx" = "yes"; then
                echo "Caution: the generated binaries will not run on this system."
              else
-               echo "Disabling AVX as it is not explicitely required"
+               echo "Disabling AVX as it is not explicitly required"
                AVXFLAGS=""
                HAVE_AVX_AT_COMPILE_TIME=""
              fi
@@ -1671,7 +1671,7 @@ dnl Not found... again, with -lsz.
     fi
 
     dnl HDF4 library newer than 4.2.5 has a SDreset_maxopenfiles/SDget_maxopenfiles interface
-    dnl which allows to open many HDF files simultaneously (the max number of files was previously
+    dnl which allows opening many HDF files simultaneously (the max number of files was previously
     dnl hardcoded and too low, smth. like 32). Search for it and use if available.
     AC_CHECK_LIB(mfhdfalt,SDget_maxopenfiles,HDF4_HAS_MAXOPENFILES=yes,HDF4_HAS_MAXOPENFILES=no,$HDF_LIB_NAME)
     if test "$HDF4_HAS_MAXOPENFILES" = "no" ; then
diff --git a/data/gdalvrt.xsd b/data/gdalvrt.xsd
index bd83a55..3dbaa90 100644
--- a/data/gdalvrt.xsd
+++ b/data/gdalvrt.xsd
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
 /******************************************************************************
- * $Id: gdalvrt.xsd 28847 2015-04-04 14:14:39Z rouault $
+ * $Id: gdalvrt.xsd 29326 2015-06-10 20:36:31Z rouault $
  *
  * Project:  GDAL/OGR
  * Purpose:  XML Schema for GDAL VRT files.
@@ -340,10 +340,30 @@
             <xs:extension base="xs:string">
                 <xs:attribute name="relativeToVRT" type="ZeroOrOne" />
                 <xs:attribute name="relativetoVRT" type="ZeroOrOne" /> <!-- typo: deprecated -->
+                <xs:attribute name="shared" type="OGRBooleanType"/>
             </xs:extension>
         </xs:simpleContent>
     </xs:complexType>
 
+    <xs:simpleType name="OGRBooleanType">
+        <xs:restriction base="xs:string">
+            <xs:enumeration value="1"/>
+            <xs:enumeration value="0"/>
+            <xs:enumeration value="ON"/>
+            <xs:enumeration value="OFF"/>
+            <xs:enumeration value="on"/>
+            <xs:enumeration value="off"/>
+            <xs:enumeration value="YES"/>
+            <xs:enumeration value="NO"/>
+            <xs:enumeration value="yes"/>
+            <xs:enumeration value="no"/>
+            <xs:enumeration value="TRUE"/>
+            <xs:enumeration value="FALSE"/>
+            <xs:enumeration value="true"/>
+            <xs:enumeration value="false"/>
+        </xs:restriction>
+    </xs:simpleType>
+
     <xs:complexType name="SourcePropertiesType">
         <xs:attribute name="RasterXSize" type="nonNegativeInteger32" />
         <xs:attribute name="RasterYSize" type="nonNegativeInteger32" />
diff --git a/frmts/e00grid/e00read.c b/frmts/e00grid/e00read.c
index 0c91d50..308bf6f 100644
--- a/frmts/e00grid/e00read.c
+++ b/frmts/e00grid/e00read.c
@@ -243,7 +243,7 @@ void    E00ReadClose(E00ReadPtr psInfo)
 /**********************************************************************
  *                          E00ReadRewind()
  *
- * Rewind the E00ReadPtr.  Allows to start another read pass on the 
+ * Rewind the E00ReadPtr.  Allows starting another read pass on the 
  * input file.
  **********************************************************************/
 void    E00ReadRewind(E00ReadPtr psInfo)
diff --git a/frmts/ecw/ecwasyncreader.cpp b/frmts/ecw/ecwasyncreader.cpp
index 36c84bb..3bb589e 100644
--- a/frmts/ecw/ecwasyncreader.cpp
+++ b/frmts/ecw/ecwasyncreader.cpp
@@ -281,8 +281,8 @@ NCSEcwReadStatus ECWAsyncReader::RefreshCB( NCSFileView *pFileView )
             poReader->bComplete = TRUE;
     }
 
-    /* Call CPLCleanupTLS explicitely since this thread isn't managed */
-    /* by CPL. This will free the ressources taken by the above CPLDebug */
+    /* Call CPLCleanupTLS explicitly since this thread isn't managed */
+    /* by CPL. This will free the resources taken by the above CPLDebug */
     if( poReader->bComplete )
         CPLCleanupTLS();
 
diff --git a/frmts/ecw/ecwdataset.cpp b/frmts/ecw/ecwdataset.cpp
index 43d10df..ce1f817 100644
--- a/frmts/ecw/ecwdataset.cpp
+++ b/frmts/ecw/ecwdataset.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: ecwdataset.cpp 29075 2015-04-30 12:51:21Z rouault $
+ * $Id: ecwdataset.cpp 29330 2015-06-14 12:11:11Z rouault $
  *
  * Project:  GDAL 
  * Purpose:  ECW (ERDAS Wavelet Compression Format) Driver
@@ -34,7 +34,7 @@
 #include "ogr_api.h"
 #include "ogr_geometry.h"
 
-CPL_CVSID("$Id: ecwdataset.cpp 29075 2015-04-30 12:51:21Z rouault $");
+CPL_CVSID("$Id: ecwdataset.cpp 29330 2015-06-14 12:11:11Z rouault $");
 
 #undef NOISY_DEBUG
 
@@ -1010,7 +1010,7 @@ ECWDataset::~ECWDataset()
     //
     // We also have an issue with ECW SDK 5.0 and ECW files on Linux when
     // running a multi-threaded test under Java if there's still an ECW dataset
-    // not explicitely closed at process termination.
+    // not explicitly closed at process termination.
     /*  #0  0x00007fffb26e7a80 in NCSAtomicAdd64 () from /home/even/ecwjp2_sdk/redistributable/x64/libNCSEcw.so
         #1  0x00007fffb2aa7684 in NCS::SDK::CBuffer2D::Free() () from /home/even/ecwjp2_sdk/redistributable/x64/libNCSEcw.so
         #2  0x00007fffb2aa7727 in NCS::SDK::CBuffer2D::~CBuffer2D() () from /home/even/ecwjp2_sdk/redistributable/x64/libNCSEcw.so
diff --git a/frmts/gtiff/geotiff.cpp b/frmts/gtiff/geotiff.cpp
index 99df074..a17c1cf 100644
--- a/frmts/gtiff/geotiff.cpp
+++ b/frmts/gtiff/geotiff.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: geotiff.cpp 29257 2015-05-28 18:35:39Z rouault $
+ * $Id: geotiff.cpp 29334 2015-06-14 17:30:54Z rouault $
  *
  * Project:  GeoTIFF Driver
  * Purpose:  GDAL GeoTIFF support.
@@ -63,7 +63,7 @@
 #include "tiffiop.h"
 #endif
 
-CPL_CVSID("$Id: geotiff.cpp 29257 2015-05-28 18:35:39Z rouault $");
+CPL_CVSID("$Id: geotiff.cpp 29334 2015-06-14 17:30:54Z rouault $");
 
 #if SIZEOF_VOIDP == 4
 static int bGlobalStripIntegerOverflow = FALSE;
@@ -2559,7 +2559,7 @@ CPLErr GTiffRasterBand::IReadBlock( int nBlockXOff, int nBlockYOff,
 /*      Handle the case of a strip or tile that doesn't exist yet.      */
 /*      Just set to zeros and return.                                   */
 /* -------------------------------------------------------------------- */
-    if( !poGDS->IsBlockAvailable(nBlockId) )
+    if( nBlockId != poGDS->nLoadedBlock && !poGDS->IsBlockAvailable(nBlockId) )
     {
         NullBlock( pImage );
         return CE_None;
@@ -4392,7 +4392,7 @@ CPLErr GTiffOddBitsBand::IReadBlock( int nBlockXOff, int nBlockYOff,
 /*	exist yet, but that we want to read.  Just set to zeros and	*/
 /*	return.								*/
 /* -------------------------------------------------------------------- */
-    if( !poGDS->IsBlockAvailable(nBlockId) )
+    if( nBlockId != poGDS->nLoadedBlock && !poGDS->IsBlockAvailable(nBlockId) )
     {
         NullBlock( pImage );
         return CE_None;
@@ -7470,14 +7470,14 @@ void GTiffDataset::WriteRPC( GDALDataset *poSrcDS, TIFF *hTIFF,
             bRPCSerializedOtherWay = TRUE;
         }
 
-        /* Write RPB file if explicitely asked, or if a non GDAL specific */
+        /* Write RPB file if explicitly asked, or if a non GDAL specific */
         /* profile is selected and RPCTXT is not asked */
-        int bRPBExplicitelyAsked = CSLFetchBoolean( papszCreationOptions, "RPB", FALSE );
-        int bRPBExplicitelyDenied = !CSLFetchBoolean( papszCreationOptions, "RPB", TRUE );
+        int bRPBExplicitlyAsked = CSLFetchBoolean( papszCreationOptions, "RPB", FALSE );
+        int bRPBExplicitlyDenied = !CSLFetchBoolean( papszCreationOptions, "RPB", TRUE );
         if( (!EQUAL(pszProfile,"GDALGeoTIFF") && 
              !CSLFetchBoolean( papszCreationOptions, "RPCTXT", FALSE ) &&
-             !bRPBExplicitelyDenied )
-            || bRPBExplicitelyAsked )
+             !bRPBExplicitlyDenied )
+            || bRPBExplicitlyAsked )
         {
             if( !bWriteOnlyInPAMIfNeeded )
                 GDALWriteRPBFile( pszTIFFFilename, papszRPCMD );
@@ -7883,8 +7883,6 @@ int GTiffDataset::SetDirectory( toff_t nNewOffset )
 {
     Crystalize();
 
-    FlushBlockBuf();
-
     if( nNewOffset == 0 )
         nNewOffset = nDirOffset;
 
diff --git a/frmts/hdf4/hdf-eos/GDapi.c b/frmts/hdf4/hdf-eos/GDapi.c
index 50c43df..3fd0f82 100644
--- a/frmts/hdf4/hdf-eos/GDapi.c
+++ b/frmts/hdf4/hdf-eos/GDapi.c
@@ -1,5 +1,5 @@
 /*****************************************************************************
- * $Id: GDapi.c 28436 2015-02-07 15:36:06Z rouault $
+ * $Id: GDapi.c 29336 2015-06-14 17:37:21Z rouault $
  *
  * This module has a number of additions and improvements over the original
  * implementation to be suitable for usage in GDAL HDF driver.
@@ -3959,7 +3959,7 @@ GDwrrdfield(int32 gridID, char *fieldname, char *code,
 
 
 		/*
-		 * If strideOne is true use NULL paramater for stride. This
+		 * If strideOne is true use NULL parameter for stride. This
 		 * is a work-around to HDF compression problem
 		 */
 		if (strideOne == 1)
diff --git a/frmts/hdf4/hdf-eos/SWapi.c b/frmts/hdf4/hdf-eos/SWapi.c
index 9cef80a..85c8ec9 100644
--- a/frmts/hdf4/hdf-eos/SWapi.c
+++ b/frmts/hdf4/hdf-eos/SWapi.c
@@ -1,5 +1,5 @@
 /*****************************************************************************
- * $Id: SWapi.c 28435 2015-02-07 14:35:34Z rouault $
+ * $Id: SWapi.c 29336 2015-06-14 17:37:21Z rouault $
  *
  * This module has a number of additions and improvements over the original
  * implementation to be suitable for usage in GDAL HDF driver.
@@ -4922,7 +4922,7 @@ SWwrrdfield(int32 swathID, const char *fieldname, const char *code,
 
 
 		/*
-		 * If strideOne is true use NULL paramater for stride. This
+		 * If strideOne is true use NULL parameter for stride. This
 		 * is a work-around to HDF compression problem
 		 */
 		if (strideOne == 1)
diff --git a/frmts/l1b/l1bdataset.cpp b/frmts/l1b/l1bdataset.cpp
index 326b7c7..3988acb 100644
--- a/frmts/l1b/l1bdataset.cpp
+++ b/frmts/l1b/l1bdataset.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: l1bdataset.cpp 28925 2015-04-16 21:51:54Z rouault $
+ * $Id: l1bdataset.cpp 29330 2015-06-14 12:11:11Z rouault $
  *
  * Project:  NOAA Polar Orbiter Level 1b Dataset Reader (AVHRR)
  * Purpose:  Can read NOAA-9(F)-NOAA-17(M) AVHRR datasets
@@ -38,7 +38,7 @@
 #include "cpl_string.h"
 #include "ogr_srs_api.h"
 
-CPL_CVSID("$Id: l1bdataset.cpp 28925 2015-04-16 21:51:54Z rouault $");
+CPL_CVSID("$Id: l1bdataset.cpp 29330 2015-06-14 12:11:11Z rouault $");
 
 CPL_C_START
 void    GDALRegister_L1B(void);
@@ -178,7 +178,7 @@ static const char *apszBandDesc[] =
 #define L1B_NOAA15_HDR_REC_SRC_OFF  154 // Receiving station name offset
 #define L1B_NOAA15_HDR_REC_ELLIPSOID_OFF 328
 
-/* This only apply if L1B_HIGH_GCP_DENSITY is explicitely set to NO */
+/* This only apply if L1B_HIGH_GCP_DENSITY is explicitly set to NO */
 /* otherwise we will report more GCPs */
 #define DESIRED_GCPS_PER_LINE 11
 #define DESIRED_LINES_OF_GCPS 20
diff --git a/frmts/mbtiles/frmt_mbtiles.html b/frmts/mbtiles/frmt_mbtiles.html
index 096a54d..aecf85a 100644
--- a/frmts/mbtiles/frmt_mbtiles.html
+++ b/frmts/mbtiles/frmt_mbtiles.html
@@ -9,7 +9,7 @@
 
 <h1>MBTiles</h1>
 
-<p>Starting with GDAL 1.10, the MBTiles driver allows to read rasters in the MBTiles format,
+<p>Starting with GDAL 1.10, the MBTiles driver allows reading rasters in the MBTiles format,
 which is a specification for storing tiled map data in SQLite databases.</p>
 
 <p>GDAL/OGR must be compiled with OGR SQLite driver support, and JPEG and PNG drivers.</p>
diff --git a/frmts/openjpeg/frmt_jp2openjpeg.html b/frmts/openjpeg/frmt_jp2openjpeg.html
index 89d2d02..d90c431 100644
--- a/frmts/openjpeg/frmt_jp2openjpeg.html
+++ b/frmts/openjpeg/frmt_jp2openjpeg.html
@@ -110,7 +110,7 @@ are unable to open such files. And regarding the ECW JPEG2000 SDK, decoding of
 </p></li>
 
 <li><p><b>ALPHA=YES/NO</b>: (GDAL >= 2.0) Whether to force encoding last
-channel as alpha channel. Only usefull if the color interpretation of that channel
+channel as alpha channel. Only useful if the color interpretation of that channel
 is not already Alpha. Defaults to NO.</p></li>
 
 <li><p><b>PROFILE=AUTO/UNRESTRICTED/PROFILE_1</b>: (GDAL >= 2.0) Determine
@@ -204,11 +204,11 @@ be written. Defaults to NO.
 <li><p><b>USE_SRC_CODESTREAM=YES/NO</b>: (GDAL >= 2.0)
 (EXPERIMENTAL!) When source dataset is JPEG2000, whether to reuse the codestream
 of the source dataset unmodified. Defaults to NO. Note that enabling that feature might result
-in inconsistant content of the JP2 boxes w.r.t. to the content of the source codestream.
-Most other creation options will be ignored in that mode. Can be usefull in some
+in inconsistent content of the JP2 boxes w.r.t. to the content of the source codestream.
+Most other creation options will be ignored in that mode. Can be useful in some
 use cases when adding/correcting georeferencing, metadata, ... INSPIRE_TG and
 PROFILE options will be ignored, and the profile of the codestream will be overriden
-with the one specified/implied by the options (which may be inconsistant with
+with the one specified/implied by the options (which may be inconsistent with
 the characteristics of the codestream).
 </p></li>
 
diff --git a/frmts/openjpeg/openjpegdataset.cpp b/frmts/openjpeg/openjpegdataset.cpp
index e978e53..d608b91 100644
--- a/frmts/openjpeg/openjpegdataset.cpp
+++ b/frmts/openjpeg/openjpegdataset.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: openjpegdataset.cpp 29131 2015-05-03 14:47:58Z rouault $
+ * $Id: openjpegdataset.cpp 29330 2015-06-14 12:11:11Z rouault $
  *
  * Project:  JPEG2000 driver based on OpenJPEG library
  * Purpose:  JPEG2000 driver based on OpenJPEG library
@@ -45,7 +45,7 @@
 #include "cpl_atomic_ops.h"
 #include "vrt/vrtdataset.h"
 
-CPL_CVSID("$Id: openjpegdataset.cpp 29131 2015-05-03 14:47:58Z rouault $");
+CPL_CVSID("$Id: openjpegdataset.cpp 29330 2015-06-14 12:11:11Z rouault $");
 
 /************************************************************************/
 /*                  JP2OpenJPEGDataset_ErrorCallback()                  */
@@ -2412,7 +2412,7 @@ GDALDataset * JP2OpenJPEGDataset::CreateCopy( const char * pszFilename,
         (GDALGetDataTypeSize(eDataType) == 32 && (nBits <= 16 || nBits > 32)) )
     {
         CPLError(CE_Warning, CPLE_NotSupported,
-                 "Inconsistant NBITS value with data type. Using %d",
+                 "Inconsistent NBITS value with data type. Using %d",
                  GDALGetDataTypeSize(eDataType));
     }
 
@@ -2484,7 +2484,7 @@ GDALDataset * JP2OpenJPEGDataset::CreateCopy( const char * pszFilename,
         !bGeoreferencingCompatOfGMLJP2 && nGMLJP2Version == 1 )
     {
         CPLError(CE_Warning, CPLE_AppDefined,
-                 "GMLJP2 box was explicitely required but cannot be written due "
+                 "GMLJP2 box was explicitly required but cannot be written due "
                  "to lack of georeferencing and/or unsupported georeferencing for GMLJP2");
     }
 
@@ -2492,7 +2492,7 @@ GDALDataset * JP2OpenJPEGDataset::CreateCopy( const char * pszFilename,
         !bGeoreferencingCompatOfGeoJP2 )
     {
         CPLError(CE_Warning, CPLE_AppDefined,
-                 "GeoJP2 box was explicitely required but cannot be written due "
+                 "GeoJP2 box was explicitly required but cannot be written due "
                  "to lack of georeferencing");
     }
     int bGeoBoxesAfter = CSLFetchBoolean(papszOptions, "GEOBOXES_AFTER_JP2C",
diff --git a/frmts/pdf/frmt_pdf.html b/frmts/pdf/frmt_pdf.html
index d373215..70d3d9b 100644
--- a/frmts/pdf/frmt_pdf.html
+++ b/frmts/pdf/frmt_pdf.html
@@ -108,7 +108,7 @@ specified, all features are rendered.</li>
 Defaults to 3.</li>
 <li><i>GDAL_PDF_LAYERS</i> = list of layers (comma separated) to turn ON (or "ALL" to turn all layers ON).
 The layer names can be obtained by querying the LAYERS metadata domain. When this option is specified,
-layers not explicitely listed will be turned off.</li>
+layers not explicitly listed will be turned off.</li>
 <li><i>GDAL_PDF_LAYERS_OFF</i> = list of layers (comma separated) to turn OFF. The layer names can be obtained by
 querying the LAYERS metadata domain.</li>
 </ul>
diff --git a/frmts/rasdaman/frmt_rasdaman.html b/frmts/rasdaman/frmt_rasdaman.html
index 8425996..ae966ff 100644
--- a/frmts/rasdaman/frmt_rasdaman.html
+++ b/frmts/rasdaman/frmt_rasdaman.html
@@ -15,7 +15,7 @@ consideration for OSGeo incubation.</p>
 
 <p>In our driver implementation, GDAL connects to rasdaman by defining a
 query template which is instantiated with the concrete subsetting box
-upon every access. This allows to deliver 2-D cutouts from n-D data sets
+upon every access. This allows delivering 2-D cutouts from n-D data sets
 (such as hyperspectral satellite time series, multi-variable climate
 simulation data, ocean model data, etc.). In particular, virtual imagery
 can be offered which is derived on demand from ground truth data. Some
diff --git a/frmts/vrt/vrt_tutorial.dox b/frmts/vrt/vrt_tutorial.dox
index 7b9bf7e..6b0d220 100644
--- a/frmts/vrt/vrt_tutorial.dox
+++ b/frmts/vrt/vrt_tutorial.dox
@@ -1,5 +1,5 @@
 #ifndef DOXYGEN_SKIP
-/* $Id: vrt_tutorial.dox 28951 2015-04-18 23:25:15Z rouault $ */
+/* $Id: vrt_tutorial.dox 29342 2015-06-14 18:00:24Z rouault $ */
 #endif /* DOXYGEN_SKIP */
 
 /*!
@@ -265,6 +265,12 @@ The relativeToVRT attribute on the SourceFilename indicates whether the
 filename should be interpreted as relative to the .vrt file (value is 1)
 or not relative to the .vrt file (value is 0).  The default is 0.
 
+The shared attribute, added in GDAL 2.0.0, on the SourceFilename indicates whether the
+dataset should be shared (value is 1) or not (value is 0). The default is 1.
+If several VRT datasets refering to the same underlying sources are used in a multithreaded context,
+shared should be set to 0. Alternatively, the VRT_SHARED_SOURCE configuration
+option can be set to 0 to force non-shared mode.
+
 Some characteristics of the source band can be specified in the optional
 SourceProperties tag to enable the VRT driver to differ the opening of the source
 dataset until it really needs to read data from it. This is particularly useful
@@ -871,6 +877,12 @@ underlying datasets. So, if you open twice the same VRT dataset by the same
 thread, both VRT datasets will share the same handles to the underlying
 datasets.
 
+The shared attribute, added in GDAL 2.0.0, on the SourceFilename indicates whether the
+dataset should be shared (value is 1) or not (value is 0). The default is 1.
+If several VRT datasets refering to the same underlying sources are used in a multithreaded context,
+shared should be set to 0. Alternatively, the VRT_SHARED_SOURCE configuration
+option can be set to 0 to force non-shared mode.
+
 \section gdal_vrttut_perf Performance considerations
 
 A VRT can reference many (hundreds, thousands, or more) datasets. Due to
diff --git a/frmts/vrt/vrtsources.cpp b/frmts/vrt/vrtsources.cpp
index 7876c90..9738fea 100644
--- a/frmts/vrt/vrtsources.cpp
+++ b/frmts/vrt/vrtsources.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: vrtsources.cpp 29294 2015-06-05 08:52:15Z rouault $
+ * $Id: vrtsources.cpp 29326 2015-06-10 20:36:31Z rouault $
  *
  * Project:  Virtual GDAL Datasets
  * Purpose:  Implementation of VRTSimpleSource, VRTFuncSource and 
@@ -43,7 +43,7 @@
 #define isnan std::isnan
 #endif
 
-CPL_CVSID("$Id: vrtsources.cpp 29294 2015-06-05 08:52:15Z rouault $");
+CPL_CVSID("$Id: vrtsources.cpp 29326 2015-06-10 20:36:31Z rouault $");
 
 /************************************************************************/
 /* ==================================================================== */
@@ -93,11 +93,14 @@ VRTSimpleSource::VRTSimpleSource()
 VRTSimpleSource::~VRTSimpleSource()
 
 {
+    // We use bRelativeToVRTOri to know if the file has been opened from
+    // XMLInit(), and thus we are sure that no other code has a direct reference
+    // to the dataset
     if( poMaskBandMainBand != NULL )
     {
         if (poMaskBandMainBand->GetDataset() != NULL )
         {
-            if( poMaskBandMainBand->GetDataset()->GetShared() )
+            if( poMaskBandMainBand->GetDataset()->GetShared() || bRelativeToVRTOri >= 0 )
                 GDALClose( (GDALDatasetH) poMaskBandMainBand->GetDataset() );
             else
                 poMaskBandMainBand->GetDataset()->Dereference();
@@ -105,7 +108,7 @@ VRTSimpleSource::~VRTSimpleSource()
     }
     else if( poRasterBand != NULL && poRasterBand->GetDataset() != NULL )
     {
-        if( poRasterBand->GetDataset()->GetShared() )
+        if( poRasterBand->GetDataset()->GetShared() || bRelativeToVRTOri >= 0 )
             GDALClose( (GDALDatasetH) poRasterBand->GetDataset() );
         else
             poRasterBand->GetDataset()->Dereference();
@@ -323,6 +326,14 @@ CPLXMLNode *VRTSimpleSource::SerializeToXML( const char *pszVRTPath )
         CPLCreateXMLNode( CPLGetXMLNode( psSrc, "SourceFilename" ), 
                           CXT_Attribute, "relativeToVRT" ), 
         CXT_Text, bRelativeToVRT ? "1" : "0" );
+    
+    if( !CSLTestBoolean(CPLGetConfigOption("VRT_SHARED_SOURCE", "TRUE")) )
+    {
+        CPLCreateXMLNode( 
+            CPLCreateXMLNode( CPLGetXMLNode( psSrc, "SourceFilename" ), 
+                              CXT_Attribute, "shared" ), 
+                              CXT_Text, "0" );
+    }
 
     char** papszOpenOptions = poDS->GetOpenOptions();
     GDALSerializeOpenOptionsToXML(psSrc, papszOpenOptions);
@@ -406,7 +417,13 @@ CPLErr VRTSimpleSource::XMLInit( CPLXMLNode *psSrc, const char *pszVRTPath )
     // serialize them identically again (#5985)
     osSourceFileNameOri = pszFilename;
     bRelativeToVRTOri = atoi(CPLGetXMLValue( psSourceFileNameNode, "relativetoVRT", "0"));
-    
+    const char* pszShared = CPLGetXMLValue( psSourceFileNameNode, "shared", NULL);
+    int bShared = FALSE;
+    if( pszShared != NULL )
+        bShared = CSLTestBoolean(pszShared);
+    else
+        bShared = CSLTestBoolean(CPLGetConfigOption("VRT_SHARED_SOURCE", "TRUE"));
+
     if( pszVRTPath != NULL
         && bRelativeToVRTOri )
     {
@@ -525,8 +542,11 @@ CPLErr VRTSimpleSource::XMLInit( CPLXMLNode *psSrc, const char *pszVRTPath )
         /* -------------------------------------------------------------------- */
         /*      Open the file (shared).                                         */
         /* -------------------------------------------------------------------- */
+        int nOpenFlags = GDAL_OF_RASTER | GDAL_OF_VERBOSE_ERROR;
+        if( bShared )
+            nOpenFlags |= GDAL_OF_SHARED;
         poSrcDS = (GDALDataset *) GDALOpenEx(
-                    pszSrcDSName, GDAL_OF_SHARED | GDAL_OF_RASTER | GDAL_OF_VERBOSE_ERROR, NULL,
+                    pszSrcDSName, nOpenFlags, NULL,
                     (const char* const* )papszOpenOptions, NULL );
     }
     else
@@ -535,7 +555,7 @@ CPLErr VRTSimpleSource::XMLInit( CPLXMLNode *psSrc, const char *pszVRTPath )
         /*      Create a proxy dataset                                          */
         /* -------------------------------------------------------------------- */
         int i;
-        GDALProxyPoolDataset* proxyDS = new GDALProxyPoolDataset(pszSrcDSName, nRasterXSize, nRasterYSize, GA_ReadOnly, TRUE);
+        GDALProxyPoolDataset* proxyDS = new GDALProxyPoolDataset(pszSrcDSName, nRasterXSize, nRasterYSize, GA_ReadOnly, bShared);
         proxyDS->SetOpenOptions(papszOpenOptions);
         poSrcDS = proxyDS;
 
diff --git a/frmts/zlib/zlib.h b/frmts/zlib/zlib.h
index 1d6cb1f..6c5f03e 100644
--- a/frmts/zlib/zlib.h
+++ b/frmts/zlib/zlib.h
@@ -869,7 +869,7 @@ ZEXTERN int ZEXPORT inflateBackInit OF((z_streamp strm, int windowBits,
      See inflateBack() for the usage of these routines.
 
      inflateBackInit will return Z_OK on success, Z_STREAM_ERROR if any of
-   the paramaters are invalid, Z_MEM_ERROR if the internal state could not
+   the parameters are invalid, Z_MEM_ERROR if the internal state could not
    be allocated, or Z_VERSION_ERROR if the version of the library does not
    match the version of the header file.
 */
diff --git a/gcore/gdal.h b/gcore/gdal.h
index a32146a..d361ae5 100644
--- a/gcore/gdal.h
+++ b/gcore/gdal.h
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: gdal.h 29243 2015-05-24 15:53:26Z rouault $
+ * $Id: gdal.h 29330 2015-06-14 12:11:11Z rouault $
  *
  * Project:  GDAL Core
  * Purpose:  GDAL Core C/Public declarations.
@@ -103,7 +103,7 @@ typedef enum {
     /*! Write data */  GF_Write = 1
 } GDALRWFlag;
 
-/* NOTE: values are selected to be consistant with GDALResampleAlg of alg/gdalwarper.h */ 
+/* NOTE: values are selected to be consistent with GDALResampleAlg of alg/gdalwarper.h */ 
 /** RasterIO() resampling method.
   * @since GDAL 2.0
   */
diff --git a/gcore/gdal_misc.cpp b/gcore/gdal_misc.cpp
index d4d3cc5..b343723 100644
--- a/gcore/gdal_misc.cpp
+++ b/gcore/gdal_misc.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: gdal_misc.cpp 29123 2015-05-03 11:05:46Z bishop $
+ * $Id: gdal_misc.cpp 29326 2015-06-10 20:36:31Z rouault $
  *
  * Project:  GDAL Core
  * Purpose:  Free standing functions for GDAL.
@@ -35,7 +35,7 @@
 #include <ctype.h>
 #include <string>
 
-CPL_CVSID("$Id: gdal_misc.cpp 29123 2015-05-03 11:05:46Z bishop $");
+CPL_CVSID("$Id: gdal_misc.cpp 29326 2015-06-10 20:36:31Z rouault $");
 
 #include "ogr_spatialref.h"
 #include "gdal_mdreader.h"
@@ -2871,7 +2871,10 @@ GDALDataset *GDALFindAssociatedAuxFile( const char *pszBasename,
             /* Avoid causing failure in opening of main file from SWIG bindings */
             /* when auxiliary file cannot be opened (#3269) */
             CPLTurnFailureIntoWarning(TRUE);
-            poODS = (GDALDataset *) GDALOpenShared( osAuxFilename, eAccess );
+            if( poDependentDS != NULL && poDependentDS->GetShared() )
+                poODS = (GDALDataset *) GDALOpenShared( osAuxFilename, eAccess );
+            else
+                poODS = (GDALDataset *) GDALOpen( osAuxFilename, eAccess );
             CPLTurnFailureIntoWarning(FALSE);
         }
         VSIFCloseL( fp );
@@ -2965,7 +2968,10 @@ GDALDataset *GDALFindAssociatedAuxFile( const char *pszBasename,
                 /* Avoid causing failure in opening of main file from SWIG bindings */
                 /* when auxiliary file cannot be opened (#3269) */
                 CPLTurnFailureIntoWarning(TRUE);
-                poODS = (GDALDataset *) GDALOpenShared( osAuxFilename, eAccess );
+                if( poDependentDS != NULL && poDependentDS->GetShared() )
+                    poODS = (GDALDataset *) GDALOpenShared( osAuxFilename, eAccess );
+                else
+                    poODS = (GDALDataset *) GDALOpen( osAuxFilename, eAccess );
                 CPLTurnFailureIntoWarning(FALSE);
             }
             VSIFCloseL( fp );
diff --git a/gcore/gdaldataset.cpp b/gcore/gdaldataset.cpp
index 574313a..744629e 100644
--- a/gcore/gdaldataset.cpp
+++ b/gcore/gdaldataset.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: gdaldataset.cpp 29284 2015-06-03 13:26:10Z rouault $
+ * $Id: gdaldataset.cpp 29330 2015-06-14 12:11:11Z rouault $
  *
  * Project:  GDAL Core
  * Purpose:  Base class for raster file formats.  
@@ -46,7 +46,7 @@
 
 #include <map>
 
-CPL_CVSID("$Id: gdaldataset.cpp 29284 2015-06-03 13:26:10Z rouault $");
+CPL_CVSID("$Id: gdaldataset.cpp 29330 2015-06-14 12:11:11Z rouault $");
 
 CPL_C_START
 GDALAsyncReader *
@@ -3383,7 +3383,7 @@ OGRLayer *GDALDataset::CreateLayer( const char * pszName,
         !poLayer->TestCapability(OLCCurveGeometries) )
     {
         CPLError( CE_Warning, CPLE_AppDefined,
-                  "Inconsistant driver: Layer geometry type is non-linear, but "
+                  "Inconsistent driver: Layer geometry type is non-linear, but "
                   "TestCapability(OLCCurveGeometries) returns FALSE." );
     }
 #endif
@@ -3535,7 +3535,7 @@ OGRLayerH GDALDatasetCopyLayer( GDALDatasetH hDS,
  @param hSpatialFilter geometry which represents a spatial filter. Can be NULL.
  @param pszDialect allows control of the statement dialect. If set to NULL, the
 OGR SQL engine will be used, except for RDBMS drivers that will use their dedicated SQL engine,
-unless OGRSQL is explicitely passed as the dialect. Starting with OGR 1.10, the SQLITE dialect
+unless OGRSQL is explicitly passed as the dialect. Starting with OGR 1.10, the SQLITE dialect
 can also be used.
 
  @return an OGRLayer containing the results of the query.  Deallocate with
@@ -4893,7 +4893,7 @@ OGRErr GDALDataset::ProcessSQLAlterTableAlterColumn( const char *pszSQLCommand )
  @param poSpatialFilter geometry which represents a spatial filter. Can be NULL.
  @param pszDialect allows control of the statement dialect. If set to NULL, the
 OGR SQL engine will be used, except for RDBMS drivers that will use their dedicated SQL engine,
-unless OGRSQL is explicitely passed as the dialect. Starting with OGR 1.10, the SQLITE dialect
+unless OGRSQL is explicitly passed as the dialect. Starting with OGR 1.10, the SQLITE dialect
 can also be used.
 
  @return an OGRLayer containing the results of the query.  Deallocate with
@@ -5559,7 +5559,7 @@ int GDALDataset::TestCapability( CPL_UNUSED const char * pszCap )
  
  By default, when bForce is set to FALSE, only "efficient" transactions will be
  attempted. Some drivers may offer an emulation of transactions, but sometimes
- with significant overhead, in which case the user must explicitely allow for such
+ with significant overhead, in which case the user must explicitly allow for such
  an emulation by setting bForce to TRUE. Drivers that offer emulated transactions
  should advertize the ODsCEmulatedTransactions capability (and not ODsCTransactions).
  
@@ -5609,7 +5609,7 @@ OGRErr GDALDataset::StartTransaction(CPL_UNUSED int bForce)
 
  By default, when bForce is set to FALSE, only "efficient" transactions will be
  attempted. Some drivers may offer an emulation of transactions, but sometimes
- with significant overhead, in which case the user must explicitely allow for such
+ with significant overhead, in which case the user must explicitly allow for such
  an emulation by setting bForce to TRUE. Drivers that offer emulated transactions
  should advertize the ODsCEmulatedTransactions capability (and not ODsCTransactions).
 
diff --git a/gcore/gdaldllmain.cpp b/gcore/gdaldllmain.cpp
index 0531f71..19309d8 100644
--- a/gcore/gdaldllmain.cpp
+++ b/gcore/gdaldllmain.cpp
@@ -55,7 +55,7 @@ void CPLFinalizeTLS();
  * This function calls GDALDestroyDriverManager() and OGRCleanupAll() and
  * finalize Thread Local Storage variables.
  *
- * This function should *not* usually be explicitely called by application code
+ * This function should *not* usually be explicitly called by application code
  * if GDAL is dynamically linked, since it is automatically called through
  * the unregistration mechanisms of dynamic library loading.
  *
diff --git a/gcore/gdaldrivermanager.cpp b/gcore/gdaldrivermanager.cpp
index 2909ee8..9be7a27 100644
--- a/gcore/gdaldrivermanager.cpp
+++ b/gcore/gdaldrivermanager.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: gdaldrivermanager.cpp 29110 2015-05-02 11:54:16Z rouault $
+ * $Id: gdaldrivermanager.cpp 29330 2015-06-14 12:11:11Z rouault $
  *
  * Project:  GDAL Core
  * Purpose:  Implementation of GDALDriverManager class.
@@ -43,7 +43,7 @@
 #  endif
 #endif
 
-CPL_CVSID("$Id: gdaldrivermanager.cpp 29110 2015-05-02 11:54:16Z rouault $");
+CPL_CVSID("$Id: gdaldrivermanager.cpp 29330 2015-06-14 12:11:11Z rouault $");
 
 static const char *pszUpdatableINST_DATA = 
 "__INST_DATA_TARGET:                                                                                                                                      ";
@@ -435,7 +435,7 @@ int GDALDriverManager::RegisterDriver( GDALDriver * poDriver )
         poDriver->SetMetadataItem( GDAL_DCAP_CREATECOPY, "YES" );
 
     /* Backward compability for GDAL raster out-of-tree drivers: */
-    /* if a driver hasn't explicitely set a vector capability, assume it is */
+    /* if a driver hasn't explicitly set a vector capability, assume it is */
     /* a raster driver (legacy OGR drivers will have DCAP_VECTOR set before */
     /* calling RegisterDriver() ) */
     if( poDriver->GetMetadataItem( GDAL_DCAP_RASTER ) == NULL &&
diff --git a/gcore/gdaljp2metadata.cpp b/gcore/gdaljp2metadata.cpp
index 6ebbe9c..9a82ded 100644
--- a/gcore/gdaljp2metadata.cpp
+++ b/gcore/gdaljp2metadata.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: gdaljp2metadata.cpp 29210 2015-05-19 19:04:28Z rouault $
+ * $Id: gdaljp2metadata.cpp 29330 2015-06-14 12:11:11Z rouault $
  *
  * Project:  GDAL 
  * Purpose:  GDALJP2Metadata - Read GeoTIFF and/or GML georef info.
@@ -40,7 +40,7 @@
 #include "json.h"
 #include "gdaljp2metadatagenerator.h"
 
-CPL_CVSID("$Id: gdaljp2metadata.cpp 29210 2015-05-19 19:04:28Z rouault $");
+CPL_CVSID("$Id: gdaljp2metadata.cpp 29330 2015-06-14 12:11:11Z rouault $");
 
 static const unsigned char msi_uuid2[16] =
 {0xb1,0x4b,0xf8,0xbd,0x08,0x3d,0x4b,0x43,
@@ -1139,7 +1139,7 @@ int GDALJP2Metadata::ParseGMLCoverageDesc()
         {
             CPLError(CE_Warning, CPLE_AppDefined,
                      "It is likely that the axis order of the GMLJP2 box is not "
-                     "consistant with the EPSG order and that the resulting georeferencing "
+                     "consistent with the EPSG order and that the resulting georeferencing "
                      "will be incorrect. Try setting GDAL_IGNORE_AXIS_ORIENTATION=TRUE if it is the case");
         }
     }
diff --git a/gcore/gdalproxypool.cpp b/gcore/gdalproxypool.cpp
index ad49d0f..285402f 100644
--- a/gcore/gdalproxypool.cpp
+++ b/gcore/gdalproxypool.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: gdalproxypool.cpp 28899 2015-04-14 09:27:00Z rouault $
+ * $Id: gdalproxypool.cpp 29326 2015-06-10 20:36:31Z rouault $
  *
  * Project:  GDAL Core
  * Purpose:  A dataset and raster band classes that differ the opening of the
@@ -31,7 +31,7 @@
 #include "gdal_proxy.h"
 #include "cpl_multiproc.h"
 
-CPL_CVSID("$Id: gdalproxypool.cpp 28899 2015-04-14 09:27:00Z rouault $");
+CPL_CVSID("$Id: gdalproxypool.cpp 29326 2015-06-10 20:36:31Z rouault $");
 
 /* We *must* share the same mutex as the gdaldataset.cpp file, as we are */
 /* doing GDALOpen() calls that can indirectly call GDALOpenShared() on */
@@ -91,7 +91,9 @@ class GDALDatasetPool
         ~GDALDatasetPool();
         GDALProxyPoolCacheEntry* _RefDataset(const char* pszFileName,
                                              GDALAccess eAccess,
-                                             char** papszOpenOptions);
+                                             char** papszOpenOptions,
+                                             int bShared);
+        void _CloseDataset(const char* pszFileName, GDALAccess eAccess);
 
         void ShowContent();
         void CheckLinks();
@@ -101,8 +103,10 @@ class GDALDatasetPool
         static void Unref();
         static GDALProxyPoolCacheEntry* RefDataset(const char* pszFileName,
                                                    GDALAccess eAccess,
-                                                   char** papszOpenOptions);
+                                                   char** papszOpenOptions,
+                                                   int bShared);
         static void UnrefDataset(GDALProxyPoolCacheEntry* cacheEntry);
+        static void CloseDataset(const char* pszFileName, GDALAccess eAccess);
 
         static void PreventDestroy();
         static void ForceDestroy();
@@ -189,7 +193,8 @@ void GDALDatasetPool::CheckLinks()
 
 GDALProxyPoolCacheEntry* GDALDatasetPool::_RefDataset(const char* pszFileName,
                                                       GDALAccess eAccess,
-                                                      char** papszOpenOptions)
+                                                      char** papszOpenOptions,
+                                                      int bShared)
 {
     GDALProxyPoolCacheEntry* cur = firstEntry;
     GIntBig responsiblePID = GDALGetResponsiblePIDForCurrentThread();
@@ -200,7 +205,8 @@ GDALProxyPoolCacheEntry* GDALDatasetPool::_RefDataset(const char* pszFileName,
         GDALProxyPoolCacheEntry* next = cur->next;
 
         if (strcmp(cur->pszFileName, pszFileName) == 0 &&
-            cur->responsiblePID == responsiblePID)
+            ((bShared && cur->responsiblePID == responsiblePID) ||
+             (!bShared && cur->refCount == 0)) )
         {
             if (cur != firstEntry)
             {
@@ -311,6 +317,41 @@ GDALProxyPoolCacheEntry* GDALDatasetPool::_RefDataset(const char* pszFileName,
 }
 
 /************************************************************************/
+/*                       _CloseDataset()                                */
+/************************************************************************/
+
+void GDALDatasetPool::_CloseDataset(const char* pszFileName, GDALAccess eAccess)
+{
+    GDALProxyPoolCacheEntry* cur = firstEntry;
+    GIntBig responsiblePID = GDALGetResponsiblePIDForCurrentThread();
+
+    while(cur)
+    {
+        GDALProxyPoolCacheEntry* next = cur->next;
+
+        if (strcmp(cur->pszFileName, pszFileName) == 0 && cur->refCount == 0 &&
+            cur->poDS != NULL )
+        {
+            /* Close by pretending we are the thread that GDALOpen'ed this */
+            /* dataset */
+            GDALSetResponsiblePIDForCurrentThread(cur->responsiblePID);
+
+            refCountOfDisableRefCount ++;
+            GDALClose(cur->poDS);
+            refCountOfDisableRefCount --;
+
+            GDALSetResponsiblePIDForCurrentThread(responsiblePID);
+            
+            cur->poDS = NULL;
+            cur->pszFileName[0] = '\0';
+            break;
+        }
+
+        cur = next;
+    }
+}
+
+/************************************************************************/
 /*                                 Ref()                                */
 /************************************************************************/
 
@@ -392,10 +433,11 @@ void GDALDatasetPoolForceDestroy()
 
 GDALProxyPoolCacheEntry* GDALDatasetPool::RefDataset(const char* pszFileName,
                                                      GDALAccess eAccess,
-                                                     char** papszOpenOptions)
+                                                     char** papszOpenOptions,
+                                                     int bShared)
 {
     CPLMutexHolderD( GDALGetphDLMutex() );
-    return singleton->_RefDataset(pszFileName, eAccess, papszOpenOptions);
+    return singleton->_RefDataset(pszFileName, eAccess, papszOpenOptions, bShared);
 }
 
 /************************************************************************/
@@ -408,6 +450,16 @@ void GDALDatasetPool::UnrefDataset(GDALProxyPoolCacheEntry* cacheEntry)
     cacheEntry->refCount --;
 }
 
+/************************************************************************/
+/*                       CloseDataset()                                 */
+/************************************************************************/
+
+void GDALDatasetPool::CloseDataset(const char* pszFileName, GDALAccess eAccess)
+{
+    CPLMutexHolderD( GDALGetphDLMutex() );
+    singleton->_CloseDataset(pszFileName, eAccess);
+}
+
 CPL_C_START
 
 typedef struct
@@ -546,6 +598,10 @@ GDALProxyPoolDataset::GDALProxyPoolDataset(const char* pszSourceDatasetDescripti
 
 GDALProxyPoolDataset::~GDALProxyPoolDataset()
 {
+    if( !bShared )
+    {
+        GDALDatasetPool::CloseDataset(GetDescription(), eAccess);
+    }
     /* See comment in constructor */
     /* It is not really a genuine shared dataset, so we don't */
     /* want ~GDALDataset() to try to release it from its */
@@ -605,7 +661,8 @@ GDALDataset* GDALProxyPoolDataset::RefUnderlyingDataset()
     /* a VRT of GeoTIFFs that have associated .aux files */
     GIntBig curResponsiblePID = GDALGetResponsiblePIDForCurrentThread();
     GDALSetResponsiblePIDForCurrentThread(responsiblePID);
-    cacheEntry = GDALDatasetPool::RefDataset(GetDescription(), eAccess, papszOpenOptions);
+    cacheEntry = GDALDatasetPool::RefDataset(GetDescription(), eAccess, papszOpenOptions,
+                                             GetShared());
     GDALSetResponsiblePIDForCurrentThread(curResponsiblePID);
     if (cacheEntry != NULL)
     {
diff --git a/gcore/gdalrasterblock.cpp b/gcore/gdalrasterblock.cpp
index d665a88..bc89766 100644
--- a/gcore/gdalrasterblock.cpp
+++ b/gcore/gdalrasterblock.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: gdalrasterblock.cpp 29284 2015-06-03 13:26:10Z rouault $
+ * $Id: gdalrasterblock.cpp 29334 2015-06-14 17:30:54Z rouault $
  *
  * Project:  GDAL Core
  * Purpose:  Implementation of GDALRasterBlock class and related global 
@@ -32,7 +32,7 @@
 #include "gdal_priv.h"
 #include "cpl_multiproc.h"
 
-CPL_CVSID("$Id: gdalrasterblock.cpp 29284 2015-06-03 13:26:10Z rouault $");
+CPL_CVSID("$Id: gdalrasterblock.cpp 29334 2015-06-14 17:30:54Z rouault $");
 
 static int bCacheMaxInitialized = FALSE;
 static GIntBig nCacheMax = 40 * 1024*1024;
@@ -393,7 +393,7 @@ int GDALRasterBlock::FlushCacheBlock(int bDirtyBlocksOnly)
  * \brief Flush all dirty blocks from cache.
  *
  * This static method is normally used to recover memory and is especially
- * usefull when doing multi-threaded code that can trigger the block cache.
+ * useful when doing multi-threaded code that can trigger the block cache.
  *
  * Due to the current design of the block cache, dirty blocks belonging to a same
  * dataset could be pushed simultanously to the IWriteBlock() method of that
@@ -686,7 +686,7 @@ void GDALRasterBlock::Touch_unlocked()
 CPLErr GDALRasterBlock::Internalize()
 
 {
-    void        *pNewData;
+    void        *pNewData = NULL;
     int         nSizeInBytes;
 
     CPLAssert( pData == NULL );
@@ -701,71 +701,89 @@ CPLErr GDALRasterBlock::Internalize()
 /* -------------------------------------------------------------------- */
 /*      Flush old blocks if we are nearing our memory limit.            */
 /* -------------------------------------------------------------------- */
-    GDALRasterBlock* apoBlocksToFree[64];
-    int nBlocksToFree = 0;
+    int bFirstIter = TRUE;
+    int bLoopAgain;
+    do
     {
-        TAKE_LOCK;
-
-        nCacheUsed += nSizeInBytes;
-        GDALRasterBlock *poTarget = poOldest;
-        while( nCacheUsed > nCurCacheMax )
+        bLoopAgain = FALSE;
+        GDALRasterBlock* apoBlocksToFree[64];
+        int nBlocksToFree = 0;
         {
-            while( poTarget != NULL && poTarget->GetLockCount() > 0 ) 
-                poTarget = poTarget->poPrevious;
+            TAKE_LOCK;
 
-            if( poTarget != NULL )
+            if( bFirstIter )
+                nCacheUsed += nSizeInBytes;
+            GDALRasterBlock *poTarget = poOldest;
+            while( nCacheUsed > nCurCacheMax )
             {
-                GDALRasterBlock* _poPrevious = poTarget->poPrevious;
-
-                poTarget->Detach_unlocked();
-                poTarget->GetBand()->UnreferenceBlock(poTarget->GetXOff(),poTarget->GetYOff());
+                while( poTarget != NULL && poTarget->GetLockCount() > 0 ) 
+                    poTarget = poTarget->poPrevious;
 
-                apoBlocksToFree[nBlocksToFree++] = poTarget;
-                if( nBlocksToFree == 64 )
+                if( poTarget != NULL )
                 {
-                    CPLDebug("GDAL", "More than 64 blocks are flagged to be flushed. Not trying more");
-                    break;
+                    GDALRasterBlock* _poPrevious = poTarget->poPrevious;
+
+                    poTarget->Detach_unlocked();
+                    poTarget->GetBand()->UnreferenceBlock(poTarget->GetXOff(),poTarget->GetYOff());
+
+                    apoBlocksToFree[nBlocksToFree++] = poTarget;
+                    if( poTarget->GetDirty() )
+                    {
+                        // Only free one dirty block at a time so that
+                        // other dirty blocks of other bands with the same coordinates
+                        // can be found with TryGetLockedBlock()
+                        bLoopAgain = ( nCacheUsed > nCurCacheMax );
+                        break;
+                    }
+                    if( nBlocksToFree == 64 )
+                    {
+                        CPLDebug("GDAL", "More than 64 blocks are flagged to be flushed. Not trying more");
+                        break;
+                    }
+
+                    poTarget = _poPrevious;
                 }
-
-                poTarget = _poPrevious;
+                else
+                    break;
             }
-            else
-                break;
-        }
 
-    /* -------------------------------------------------------------------- */
-    /*      Add this block to the list.                                     */
-    /* -------------------------------------------------------------------- */
-        Touch_unlocked();
-    }
+        /* -------------------------------------------------------------------- */
+        /*      Add this block to the list.                                     */
+        /* -------------------------------------------------------------------- */
+            if( !bLoopAgain )
+                Touch_unlocked();
+        }
 
-    /* Now free blocks we have detached and removed from their band */
-    pNewData = NULL;
-    for(int i=0;i<nBlocksToFree;i++)
-    {
-        GDALRasterBlock *poBlock = apoBlocksToFree[i];
+        bFirstIter = FALSE;
 
-        if( poBlock->GetDirty() )
+        /* Now free blocks we have detached and removed from their band */
+        for(int i=0;i<nBlocksToFree;i++)
         {
-            CPLErr eErr = poBlock->Write();
-            if( eErr != CE_None )
+            GDALRasterBlock *poBlock = apoBlocksToFree[i];
+
+            if( poBlock->GetDirty() )
             {
-                 /* Save the error for later reporting */
-                poBlock->GetBand()->SetFlushBlockErr(eErr);
+                CPLErr eErr = poBlock->Write();
+                if( eErr != CE_None )
+                {
+                    /* Save the error for later reporting */
+                    poBlock->GetBand()->SetFlushBlockErr(eErr);
+                }
             }
-        }
 
-        /* Try to recycle the data of an existing block */
-        void* pDataBlock = poBlock->pData;
-        if( pNewData == NULL && pDataBlock != NULL &&
-            poBlock->GetBlockSize() >= nSizeInBytes )
-        {
-            pNewData = pDataBlock;
-            poBlock->pData = NULL;
-        }
+            /* Try to recycle the data of an existing block */
+            void* pDataBlock = poBlock->pData;
+            if( pNewData == NULL && pDataBlock != NULL &&
+                poBlock->GetBlockSize() >= nSizeInBytes )
+            {
+                pNewData = pDataBlock;
+                poBlock->pData = NULL;
+            }
 
-        delete poBlock;
+            delete poBlock;
+        }
     }
+    while(bLoopAgain);
 
     if( pNewData == NULL )
     {
diff --git a/man/man1/gdal-config.1 b/man/man1/gdal-config.1
index 7f9ee46..edbe8a9 100644
--- a/man/man1/gdal-config.1
+++ b/man/man1/gdal-config.1
@@ -1,8 +1,8 @@
-.TH "gdal-config" 1 "Fri Jun 5 2015" "GDAL" \" -*- nroff -*-
+.TH "gdal-config" 1 "Sun Jun 14 2015" "GDAL" \" -*- nroff -*-
 .ad l
 .nh
 .SH NAME
-gdal-config \- .TH "gdal-config" 1 "Fri Jun 5 2015" "GDAL" \" -*- nroff -*-
+gdal-config \- .TH "gdal-config" 1 "Sun Jun 14 2015" "GDAL" \" -*- nroff -*-
 .ad l
 .nh
 .SH NAME
diff --git a/man/man1/gdal2tiles.1 b/man/man1/gdal2tiles.1
index 092f702..d74aed8 100644
--- a/man/man1/gdal2tiles.1
+++ b/man/man1/gdal2tiles.1
@@ -1,8 +1,8 @@
-.TH "gdal2tiles" 1 "Fri Jun 5 2015" "GDAL" \" -*- nroff -*-
+.TH "gdal2tiles" 1 "Sun Jun 14 2015" "GDAL" \" -*- nroff -*-
 .ad l
 .nh
 .SH NAME
-gdal2tiles \- .TH "gdal2tiles" 1 "Fri Jun 5 2015" "GDAL" \" -*- nroff -*-
+gdal2tiles \- .TH "gdal2tiles" 1 "Sun Jun 14 2015" "GDAL" \" -*- nroff -*-
 .ad l
 .nh
 .SH NAME
diff --git a/man/man1/gdal_calc.1 b/man/man1/gdal_calc.1
index ac0a61e..1604c05 100644
--- a/man/man1/gdal_calc.1
+++ b/man/man1/gdal_calc.1
@@ -1,8 +1,8 @@
-.TH "gdal_calc" 1 "Fri Jun 5 2015" "GDAL" \" -*- nroff -*-
+.TH "gdal_calc" 1 "Sun Jun 14 2015" "GDAL" \" -*- nroff -*-
 .ad l
 .nh
 .SH NAME
-gdal_calc \- .TH "gdal_calc" 1 "Fri Jun 5 2015" "GDAL" \" -*- nroff -*-
+gdal_calc \- .TH "gdal_calc" 1 "Sun Jun 14 2015" "GDAL" \" -*- nroff -*-
 .ad l
 .nh
 .SH NAME
diff --git a/man/man1/gdal_contour.1 b/man/man1/gdal_contour.1
index ffd5cd5..7f33d19 100644
--- a/man/man1/gdal_contour.1
+++ b/man/man1/gdal_contour.1
@@ -1,8 +1,8 @@
-.TH "gdal_contour" 1 "Fri Jun 5 2015" "GDAL" \" -*- nroff -*-
+.TH "gdal_contour" 1 "Sun Jun 14 2015" "GDAL" \" -*- nroff -*-
 .ad l
 .nh
 .SH NAME
-gdal_contour \- .TH "gdal_contour" 1 "Fri Jun 5 2015" "GDAL" \" -*- nroff -*-
+gdal_contour \- .TH "gdal_contour" 1 "Sun Jun 14 2015" "GDAL" \" -*- nroff -*-
 .ad l
 .nh
 .SH NAME
diff --git a/man/man1/gdal_edit.1 b/man/man1/gdal_edit.1
index 657507d..f9fcd03 100644
--- a/man/man1/gdal_edit.1
+++ b/man/man1/gdal_edit.1
@@ -1,8 +1,8 @@
-.TH "gdal_edit" 1 "Fri Jun 5 2015" "GDAL" \" -*- nroff -*-
+.TH "gdal_edit" 1 "Sun Jun 14 2015" "GDAL" \" -*- nroff -*-
 .ad l
 .nh
 .SH NAME
-gdal_edit \- .TH "gdal_edit" 1 "Fri Jun 5 2015" "GDAL" \" -*- nroff -*-
+gdal_edit \- .TH "gdal_edit" 1 "Sun Jun 14 2015" "GDAL" \" -*- nroff -*-
 .ad l
 .nh
 .SH NAME
diff --git a/man/man1/gdal_fillnodata.1 b/man/man1/gdal_fillnodata.1
index 48f604b..cda4f8c 100644
--- a/man/man1/gdal_fillnodata.1
+++ b/man/man1/gdal_fillnodata.1
@@ -1,8 +1,8 @@
-.TH "gdal_fillnodata" 1 "Fri Jun 5 2015" "GDAL" \" -*- nroff -*-
+.TH "gdal_fillnodata" 1 "Sun Jun 14 2015" "GDAL" \" -*- nroff -*-
 .ad l
 .nh
 .SH NAME
-gdal_fillnodata \- .TH "gdal_fillnodata" 1 "Fri Jun 5 2015" "GDAL" \" -*- nroff -*-
+gdal_fillnodata \- .TH "gdal_fillnodata" 1 "Sun Jun 14 2015" "GDAL" \" -*- nroff -*-
 .ad l
 .nh
 .SH NAME
diff --git a/man/man1/gdal_grid.1 b/man/man1/gdal_grid.1
index 5bacc87..3246a49 100644
--- a/man/man1/gdal_grid.1
+++ b/man/man1/gdal_grid.1
@@ -1,8 +1,8 @@
-.TH "gdal_grid" 1 "Fri Jun 5 2015" "GDAL" \" -*- nroff -*-
+.TH "gdal_grid" 1 "Sun Jun 14 2015" "GDAL" \" -*- nroff -*-
 .ad l
 .nh
 .SH NAME
-gdal_grid \- .TH "gdal_grid" 1 "Fri Jun 5 2015" "GDAL" \" -*- nroff -*-
+gdal_grid \- .TH "gdal_grid" 1 "Sun Jun 14 2015" "GDAL" \" -*- nroff -*-
 .ad l
 .nh
 .SH NAME
diff --git a/man/man1/gdal_merge.1 b/man/man1/gdal_merge.1
index 1a2edb9..642bb77 100644
--- a/man/man1/gdal_merge.1
+++ b/man/man1/gdal_merge.1
@@ -1,8 +1,8 @@
-.TH "gdal_merge" 1 "Fri Jun 5 2015" "GDAL" \" -*- nroff -*-
+.TH "gdal_merge" 1 "Sun Jun 14 2015" "GDAL" \" -*- nroff -*-
 .ad l
 .nh
 .SH NAME
-gdal_merge \- .TH "gdal_merge" 1 "Fri Jun 5 2015" "GDAL" \" -*- nroff -*-
+gdal_merge \- .TH "gdal_merge" 1 "Sun Jun 14 2015" "GDAL" \" -*- nroff -*-
 .ad l
 .nh
 .SH NAME
diff --git a/man/man1/gdal_polygonize.1 b/man/man1/gdal_polygonize.1
index ffc9a23..4c4e33a 100644
--- a/man/man1/gdal_polygonize.1
+++ b/man/man1/gdal_polygonize.1
@@ -1,8 +1,8 @@
-.TH "gdal_polygonize" 1 "Fri Jun 5 2015" "GDAL" \" -*- nroff -*-
+.TH "gdal_polygonize" 1 "Sun Jun 14 2015" "GDAL" \" -*- nroff -*-
 .ad l
 .nh
 .SH NAME
-gdal_polygonize \- .TH "gdal_polygonize" 1 "Fri Jun 5 2015" "GDAL" \" -*- nroff -*-
+gdal_polygonize \- .TH "gdal_polygonize" 1 "Sun Jun 14 2015" "GDAL" \" -*- nroff -*-
 .ad l
 .nh
 .SH NAME
diff --git a/man/man1/gdal_proximity.1 b/man/man1/gdal_proximity.1
index c165086..ed3e064 100644
--- a/man/man1/gdal_proximity.1
+++ b/man/man1/gdal_proximity.1
@@ -1,8 +1,8 @@
-.TH "gdal_proximity" 1 "Fri Jun 5 2015" "GDAL" \" -*- nroff -*-
+.TH "gdal_proximity" 1 "Sun Jun 14 2015" "GDAL" \" -*- nroff -*-
 .ad l
 .nh
 .SH NAME
-gdal_proximity \- .TH "gdal_proximity" 1 "Fri Jun 5 2015" "GDAL" \" -*- nroff -*-
+gdal_proximity \- .TH "gdal_proximity" 1 "Sun Jun 14 2015" "GDAL" \" -*- nroff -*-
 .ad l
 .nh
 .SH NAME
diff --git a/man/man1/gdal_rasterize.1 b/man/man1/gdal_rasterize.1
index 6b756f1..a8e7c71 100644
--- a/man/man1/gdal_rasterize.1
+++ b/man/man1/gdal_rasterize.1
@@ -1,8 +1,8 @@
-.TH "gdal_rasterize" 1 "Fri Jun 5 2015" "GDAL" \" -*- nroff -*-
+.TH "gdal_rasterize" 1 "Sun Jun 14 2015" "GDAL" \" -*- nroff -*-
 .ad l
 .nh
 .SH NAME
-gdal_rasterize \- .TH "gdal_rasterize" 1 "Fri Jun 5 2015" "GDAL" \" -*- nroff -*-
+gdal_rasterize \- .TH "gdal_rasterize" 1 "Sun Jun 14 2015" "GDAL" \" -*- nroff -*-
 .ad l
 .nh
 .SH NAME
diff --git a/man/man1/gdal_retile.1 b/man/man1/gdal_retile.1
index 331b6f1..bee1ce2 100644
--- a/man/man1/gdal_retile.1
+++ b/man/man1/gdal_retile.1
@@ -1,8 +1,8 @@
-.TH "gdal_retile" 1 "Fri Jun 5 2015" "GDAL" \" -*- nroff -*-
+.TH "gdal_retile" 1 "Sun Jun 14 2015" "GDAL" \" -*- nroff -*-
 .ad l
 .nh
 .SH NAME
-gdal_retile \- .TH "gdal_retile" 1 "Fri Jun 5 2015" "GDAL" \" -*- nroff -*-
+gdal_retile \- .TH "gdal_retile" 1 "Sun Jun 14 2015" "GDAL" \" -*- nroff -*-
 .ad l
 .nh
 .SH NAME
diff --git a/man/man1/gdal_sieve.1 b/man/man1/gdal_sieve.1
index c5eed23..d6efef2 100644
--- a/man/man1/gdal_sieve.1
+++ b/man/man1/gdal_sieve.1
@@ -1,8 +1,8 @@
-.TH "gdal_sieve" 1 "Fri Jun 5 2015" "GDAL" \" -*- nroff -*-
+.TH "gdal_sieve" 1 "Sun Jun 14 2015" "GDAL" \" -*- nroff -*-
 .ad l
 .nh
 .SH NAME
-gdal_sieve \- .TH "gdal_sieve" 1 "Fri Jun 5 2015" "GDAL" \" -*- nroff -*-
+gdal_sieve \- .TH "gdal_sieve" 1 "Sun Jun 14 2015" "GDAL" \" -*- nroff -*-
 .ad l
 .nh
 .SH NAME
diff --git a/man/man1/gdal_translate.1 b/man/man1/gdal_translate.1
index 9c1eb24..facdc9c 100644
--- a/man/man1/gdal_translate.1
+++ b/man/man1/gdal_translate.1
@@ -1,8 +1,8 @@
-.TH "gdal_translate" 1 "Fri Jun 5 2015" "GDAL" \" -*- nroff -*-
+.TH "gdal_translate" 1 "Sun Jun 14 2015" "GDAL" \" -*- nroff -*-
 .ad l
 .nh
 .SH NAME
-gdal_translate \- .TH "gdal_translate" 1 "Fri Jun 5 2015" "GDAL" \" -*- nroff -*-
+gdal_translate \- .TH "gdal_translate" 1 "Sun Jun 14 2015" "GDAL" \" -*- nroff -*-
 .ad l
 .nh
 .SH NAME
diff --git a/man/man1/gdal_utilities.1 b/man/man1/gdal_utilities.1
index a85b555..f9af3da 100644
--- a/man/man1/gdal_utilities.1
+++ b/man/man1/gdal_utilities.1
@@ -1,12 +1,14 @@
-.TH "gdal_utilities" 1 "Fri Jun 5 2015" "GDAL" \" -*- nroff -*-
+.TH "gdal_utilities" 1 "Sun Jun 14 2015" "GDAL" \" -*- nroff -*-
 .ad l
 .nh
 .SH NAME
-gdal_utilities \- .TH "gdal_utilities" 1 "Fri Jun 5 2015" "GDAL" \" -*- nroff -*-
+gdal_utilities \- .TH "gdal_utilities" 1 "Sun Jun 14 2015" "GDAL" \" -*- nroff -*-
 .ad l
 .nh
 .SH NAME
-gdal_utilities \- The following utility programs are distributed with GDAL.
+gdal_utilities \- A collection of GDAL related programs.
+.PP
+The following utility programs are distributed with GDAL.
 .PP
 .PD 0
 .IP "\(bu" 2
diff --git a/man/man1/gdaladdo.1 b/man/man1/gdaladdo.1
index 805ed35..0fe2a5e 100644
--- a/man/man1/gdaladdo.1
+++ b/man/man1/gdaladdo.1
@@ -1,8 +1,8 @@
-.TH "gdaladdo" 1 "Fri Jun 5 2015" "GDAL" \" -*- nroff -*-
+.TH "gdaladdo" 1 "Sun Jun 14 2015" "GDAL" \" -*- nroff -*-
 .ad l
 .nh
 .SH NAME
-gdaladdo \- .TH "gdaladdo" 1 "Fri Jun 5 2015" "GDAL" \" -*- nroff -*-
+gdaladdo \- .TH "gdaladdo" 1 "Sun Jun 14 2015" "GDAL" \" -*- nroff -*-
 .ad l
 .nh
 .SH NAME
diff --git a/man/man1/gdalbuildvrt.1 b/man/man1/gdalbuildvrt.1
index c9b21d4..f2cd156 100644
--- a/man/man1/gdalbuildvrt.1
+++ b/man/man1/gdalbuildvrt.1
@@ -1,8 +1,8 @@
-.TH "gdalbuildvrt" 1 "Fri Jun 5 2015" "GDAL" \" -*- nroff -*-
+.TH "gdalbuildvrt" 1 "Sun Jun 14 2015" "GDAL" \" -*- nroff -*-
 .ad l
 .nh
 .SH NAME
-gdalbuildvrt \- .TH "gdalbuildvrt" 1 "Fri Jun 5 2015" "GDAL" \" -*- nroff -*-
+gdalbuildvrt \- .TH "gdalbuildvrt" 1 "Sun Jun 14 2015" "GDAL" \" -*- nroff -*-
 .ad l
 .nh
 .SH NAME
diff --git a/man/man1/gdalcompare.1 b/man/man1/gdalcompare.1
index d39fca4..7d492ef 100644
--- a/man/man1/gdalcompare.1
+++ b/man/man1/gdalcompare.1
@@ -1,8 +1,8 @@
-.TH "gdalcompare" 1 "Fri Jun 5 2015" "GDAL" \" -*- nroff -*-
+.TH "gdalcompare" 1 "Sun Jun 14 2015" "GDAL" \" -*- nroff -*-
 .ad l
 .nh
 .SH NAME
-gdalcompare \- .TH "gdalcompare" 1 "Fri Jun 5 2015" "GDAL" \" -*- nroff -*-
+gdalcompare \- .TH "gdalcompare" 1 "Sun Jun 14 2015" "GDAL" \" -*- nroff -*-
 .ad l
 .nh
 .SH NAME
diff --git a/man/man1/gdaldem.1 b/man/man1/gdaldem.1
index 8b5304d..a6a83a3 100644
--- a/man/man1/gdaldem.1
+++ b/man/man1/gdaldem.1
@@ -1,8 +1,8 @@
-.TH "gdaldem" 1 "Fri Jun 5 2015" "GDAL" \" -*- nroff -*-
+.TH "gdaldem" 1 "Sun Jun 14 2015" "GDAL" \" -*- nroff -*-
 .ad l
 .nh
 .SH NAME
-gdaldem \- .TH "gdaldem" 1 "Fri Jun 5 2015" "GDAL" \" -*- nroff -*-
+gdaldem \- .TH "gdaldem" 1 "Sun Jun 14 2015" "GDAL" \" -*- nroff -*-
 .ad l
 .nh
 .SH NAME
diff --git a/man/man1/gdalinfo.1 b/man/man1/gdalinfo.1
index d74cbd1..26bac24 100644
--- a/man/man1/gdalinfo.1
+++ b/man/man1/gdalinfo.1
@@ -1,8 +1,8 @@
-.TH "gdalinfo" 1 "Fri Jun 5 2015" "GDAL" \" -*- nroff -*-
+.TH "gdalinfo" 1 "Sun Jun 14 2015" "GDAL" \" -*- nroff -*-
 .ad l
 .nh
 .SH NAME
-gdalinfo \- .TH "gdalinfo" 1 "Fri Jun 5 2015" "GDAL" \" -*- nroff -*-
+gdalinfo \- .TH "gdalinfo" 1 "Sun Jun 14 2015" "GDAL" \" -*- nroff -*-
 .ad l
 .nh
 .SH NAME
diff --git a/man/man1/gdallocationinfo.1 b/man/man1/gdallocationinfo.1
index 87ace96..7cdbf88 100644
--- a/man/man1/gdallocationinfo.1
+++ b/man/man1/gdallocationinfo.1
@@ -1,8 +1,8 @@
-.TH "gdallocationinfo" 1 "Fri Jun 5 2015" "GDAL" \" -*- nroff -*-
+.TH "gdallocationinfo" 1 "Sun Jun 14 2015" "GDAL" \" -*- nroff -*-
 .ad l
 .nh
 .SH NAME
-gdallocationinfo \- .TH "gdallocationinfo" 1 "Fri Jun 5 2015" "GDAL" \" -*- nroff -*-
+gdallocationinfo \- .TH "gdallocationinfo" 1 "Sun Jun 14 2015" "GDAL" \" -*- nroff -*-
 .ad l
 .nh
 .SH NAME
diff --git a/man/man1/gdalmanage.1 b/man/man1/gdalmanage.1
index 268fcda..95efdb4 100644
--- a/man/man1/gdalmanage.1
+++ b/man/man1/gdalmanage.1
@@ -1,8 +1,8 @@
-.TH "gdalmanage" 1 "Fri Jun 5 2015" "GDAL" \" -*- nroff -*-
+.TH "gdalmanage" 1 "Sun Jun 14 2015" "GDAL" \" -*- nroff -*-
 .ad l
 .nh
 .SH NAME
-gdalmanage \- .TH "gdalmanage" 1 "Fri Jun 5 2015" "GDAL" \" -*- nroff -*-
+gdalmanage \- .TH "gdalmanage" 1 "Sun Jun 14 2015" "GDAL" \" -*- nroff -*-
 .ad l
 .nh
 .SH NAME
diff --git a/man/man1/gdalmove.1 b/man/man1/gdalmove.1
index f87b3da..55aa3c7 100644
--- a/man/man1/gdalmove.1
+++ b/man/man1/gdalmove.1
@@ -1,8 +1,8 @@
-.TH "gdalmove" 1 "Fri Jun 5 2015" "GDAL" \" -*- nroff -*-
+.TH "gdalmove" 1 "Sun Jun 14 2015" "GDAL" \" -*- nroff -*-
 .ad l
 .nh
 .SH NAME
-gdalmove \- .TH "gdalmove" 1 "Fri Jun 5 2015" "GDAL" \" -*- nroff -*-
+gdalmove \- .TH "gdalmove" 1 "Sun Jun 14 2015" "GDAL" \" -*- nroff -*-
 .ad l
 .nh
 .SH NAME
diff --git a/man/man1/gdalsrsinfo.1 b/man/man1/gdalsrsinfo.1
index 6bca5af..208d7c3 100644
--- a/man/man1/gdalsrsinfo.1
+++ b/man/man1/gdalsrsinfo.1
@@ -1,8 +1,8 @@
-.TH "gdalsrsinfo" 1 "Fri Jun 5 2015" "GDAL" \" -*- nroff -*-
+.TH "gdalsrsinfo" 1 "Sun Jun 14 2015" "GDAL" \" -*- nroff -*-
 .ad l
 .nh
 .SH NAME
-gdalsrsinfo \- .TH "gdalsrsinfo" 1 "Fri Jun 5 2015" "GDAL" \" -*- nroff -*-
+gdalsrsinfo \- .TH "gdalsrsinfo" 1 "Sun Jun 14 2015" "GDAL" \" -*- nroff -*-
 .ad l
 .nh
 .SH NAME
diff --git a/man/man1/gdaltindex.1 b/man/man1/gdaltindex.1
index e9834f4..9c202db 100644
--- a/man/man1/gdaltindex.1
+++ b/man/man1/gdaltindex.1
@@ -1,8 +1,8 @@
-.TH "gdaltindex" 1 "Fri Jun 5 2015" "GDAL" \" -*- nroff -*-
+.TH "gdaltindex" 1 "Sun Jun 14 2015" "GDAL" \" -*- nroff -*-
 .ad l
 .nh
 .SH NAME
-gdaltindex \- .TH "gdaltindex" 1 "Fri Jun 5 2015" "GDAL" \" -*- nroff -*-
+gdaltindex \- .TH "gdaltindex" 1 "Sun Jun 14 2015" "GDAL" \" -*- nroff -*-
 .ad l
 .nh
 .SH NAME
diff --git a/man/man1/gdaltransform.1 b/man/man1/gdaltransform.1
index bdf2dbb..1695105 100644
--- a/man/man1/gdaltransform.1
+++ b/man/man1/gdaltransform.1
@@ -1,8 +1,8 @@
-.TH "gdaltransform" 1 "Fri Jun 5 2015" "GDAL" \" -*- nroff -*-
+.TH "gdaltransform" 1 "Sun Jun 14 2015" "GDAL" \" -*- nroff -*-
 .ad l
 .nh
 .SH NAME
-gdaltransform \- .TH "gdaltransform" 1 "Fri Jun 5 2015" "GDAL" \" -*- nroff -*-
+gdaltransform \- .TH "gdaltransform" 1 "Sun Jun 14 2015" "GDAL" \" -*- nroff -*-
 .ad l
 .nh
 .SH NAME
diff --git a/man/man1/gdalwarp.1 b/man/man1/gdalwarp.1
index 346a3bf..b66b7f9 100644
--- a/man/man1/gdalwarp.1
+++ b/man/man1/gdalwarp.1
@@ -1,8 +1,8 @@
-.TH "gdalwarp" 1 "Fri Jun 5 2015" "GDAL" \" -*- nroff -*-
+.TH "gdalwarp" 1 "Sun Jun 14 2015" "GDAL" \" -*- nroff -*-
 .ad l
 .nh
 .SH NAME
-gdalwarp \- .TH "gdalwarp" 1 "Fri Jun 5 2015" "GDAL" \" -*- nroff -*-
+gdalwarp \- .TH "gdalwarp" 1 "Sun Jun 14 2015" "GDAL" \" -*- nroff -*-
 .ad l
 .nh
 .SH NAME
diff --git a/man/man1/nearblack.1 b/man/man1/nearblack.1
index 115b692..470b01d 100644
--- a/man/man1/nearblack.1
+++ b/man/man1/nearblack.1
@@ -1,8 +1,8 @@
-.TH "nearblack" 1 "Fri Jun 5 2015" "GDAL" \" -*- nroff -*-
+.TH "nearblack" 1 "Sun Jun 14 2015" "GDAL" \" -*- nroff -*-
 .ad l
 .nh
 .SH NAME
-nearblack \- .TH "nearblack" 1 "Fri Jun 5 2015" "GDAL" \" -*- nroff -*-
+nearblack \- .TH "nearblack" 1 "Sun Jun 14 2015" "GDAL" \" -*- nroff -*-
 .ad l
 .nh
 .SH NAME
diff --git a/man/man1/ogr2ogr.1 b/man/man1/ogr2ogr.1
index a049b58..44741c4 100644
--- a/man/man1/ogr2ogr.1
+++ b/man/man1/ogr2ogr.1
@@ -1,8 +1,8 @@
-.TH "ogr2ogr" 1 "Fri Jun 5 2015" "GDAL" \" -*- nroff -*-
+.TH "ogr2ogr" 1 "Sun Jun 14 2015" "GDAL" \" -*- nroff -*-
 .ad l
 .nh
 .SH NAME
-ogr2ogr \- .TH "ogr2ogr" 1 "Fri Jun 5 2015" "GDAL" \" -*- nroff -*-
+ogr2ogr \- .TH "ogr2ogr" 1 "Sun Jun 14 2015" "GDAL" \" -*- nroff -*-
 .ad l
 .nh
 .SH NAME
@@ -97,7 +97,7 @@ Layer creation option (format specific)
 .IP "\fB\fB-nln\fP\fI name\fP:\fP" 1c
 Assign an alternate name to the new layer 
 .IP "\fB\fB-nlt\fP\fI type\fP:\fP" 1c
-Define the geometry type for the created layer. One of NONE, GEOMETRY, POINT, LINESTRING, POLYGON, GEOMETRYCOLLECTION, MULTIPOINT, MULTIPOLYGON or MULTILINESTRING. And CIRCULARSTRING, COMPOUNDCURVE, CURVEPOLYGON, MULTICURVE and MULTISURFACE for GDAL 2.0 non-linear geometry types. Add '25D' to the name to get 2.5D versions. Starting with GDAL 1.10, PROMOTE_TO_MULTI can be used to automatically promote layers that mix polygon or multipolygons to multipolygons, and layers that mix linestrin [...]
+Define the geometry type for the created layer. One of NONE, GEOMETRY, POINT, LINESTRING, POLYGON, GEOMETRYCOLLECTION, MULTIPOINT, MULTIPOLYGON or MULTILINESTRING. And CIRCULARSTRING, COMPOUNDCURVE, CURVEPOLYGON, MULTICURVE and MULTISURFACE for GDAL 2.0 non-linear geometry types. Add '25D' to the name to get 2.5D versions. Starting with GDAL 1.10, PROMOTE_TO_MULTI can be used to automatically promote layers that mix polygon or multipolygons to multipolygons, and layers that mix linestrin [...]
 .IP "\fB\fB-dim\fP\fI val\fP:\fP" 1c
 (starting with GDAL 1.10) Force the coordinate dimension to val (valid values are 2 or 3). This affects both the layer geometry type, and feature geometries. Starting with GDAL 1.11, the value can be set to 'layer_dim' to instruct feature geometries to be promoted to the coordinate dimension declared by the layer.  
 .IP "\fB\fB-a_srs\fP\fI srs_def\fP:\fP" 1c
diff --git a/man/man1/ogr_utilities.1 b/man/man1/ogr_utilities.1
index 040b719..12f2313 100644
--- a/man/man1/ogr_utilities.1
+++ b/man/man1/ogr_utilities.1
@@ -1,12 +1,14 @@
-.TH "ogr_utilities" 1 "Fri Jun 5 2015" "GDAL" \" -*- nroff -*-
+.TH "ogr_utilities" 1 "Sun Jun 14 2015" "GDAL" \" -*- nroff -*-
 .ad l
 .nh
 .SH NAME
-ogr_utilities \- .TH "ogr_utilities" 1 "Fri Jun 5 2015" "GDAL" \" -*- nroff -*-
+ogr_utilities \- .TH "ogr_utilities" 1 "Sun Jun 14 2015" "GDAL" \" -*- nroff -*-
 .ad l
 .nh
 .SH NAME
-ogr_utilities \- The following utilities are distributed as part of the OGR Simple Features toolkit:
+ogr_utilities \- A collection of OGR related programs.
+.PP
+The following utilities are distributed as part of the OGR Simple Features toolkit:
 .PP
 .PD 0
 .IP "\(bu" 2
diff --git a/man/man1/ogrinfo.1 b/man/man1/ogrinfo.1
index 48a0177..e4688a3 100644
--- a/man/man1/ogrinfo.1
+++ b/man/man1/ogrinfo.1
@@ -1,8 +1,8 @@
-.TH "ogrinfo" 1 "Fri Jun 5 2015" "GDAL" \" -*- nroff -*-
+.TH "ogrinfo" 1 "Sun Jun 14 2015" "GDAL" \" -*- nroff -*-
 .ad l
 .nh
 .SH NAME
-ogrinfo \- .TH "ogrinfo" 1 "Fri Jun 5 2015" "GDAL" \" -*- nroff -*-
+ogrinfo \- .TH "ogrinfo" 1 "Sun Jun 14 2015" "GDAL" \" -*- nroff -*-
 .ad l
 .nh
 .SH NAME
diff --git a/man/man1/ogrlineref.1 b/man/man1/ogrlineref.1
index 9efd9c5..1ce88ae 100644
--- a/man/man1/ogrlineref.1
+++ b/man/man1/ogrlineref.1
@@ -1,8 +1,8 @@
-.TH "ogrlineref" 1 "Fri Jun 5 2015" "GDAL" \" -*- nroff -*-
+.TH "ogrlineref" 1 "Sun Jun 14 2015" "GDAL" \" -*- nroff -*-
 .ad l
 .nh
 .SH NAME
-ogrlineref \- .TH "ogrlineref" 1 "Fri Jun 5 2015" "GDAL" \" -*- nroff -*-
+ogrlineref \- .TH "ogrlineref" 1 "Sun Jun 14 2015" "GDAL" \" -*- nroff -*-
 .ad l
 .nh
 .SH NAME
diff --git a/man/man1/ogrtindex.1 b/man/man1/ogrtindex.1
index 7d52046..975f087 100644
--- a/man/man1/ogrtindex.1
+++ b/man/man1/ogrtindex.1
@@ -1,8 +1,8 @@
-.TH "ogrtindex" 1 "Fri Jun 5 2015" "GDAL" \" -*- nroff -*-
+.TH "ogrtindex" 1 "Sun Jun 14 2015" "GDAL" \" -*- nroff -*-
 .ad l
 .nh
 .SH NAME
-ogrtindex \- .TH "ogrtindex" 1 "Fri Jun 5 2015" "GDAL" \" -*- nroff -*-
+ogrtindex \- .TH "ogrtindex" 1 "Sun Jun 14 2015" "GDAL" \" -*- nroff -*-
 .ad l
 .nh
 .SH NAME
diff --git a/man/man1/pct2rgb.1 b/man/man1/pct2rgb.1
index ce383c5..72819a5 100644
--- a/man/man1/pct2rgb.1
+++ b/man/man1/pct2rgb.1
@@ -1,8 +1,8 @@
-.TH "pct2rgb" 1 "Fri Jun 5 2015" "GDAL" \" -*- nroff -*-
+.TH "pct2rgb" 1 "Sun Jun 14 2015" "GDAL" \" -*- nroff -*-
 .ad l
 .nh
 .SH NAME
-pct2rgb \- .TH "pct2rgb" 1 "Fri Jun 5 2015" "GDAL" \" -*- nroff -*-
+pct2rgb \- .TH "pct2rgb" 1 "Sun Jun 14 2015" "GDAL" \" -*- nroff -*-
 .ad l
 .nh
 .SH NAME
diff --git a/man/man1/rgb2pct.1 b/man/man1/rgb2pct.1
index ff3057a..d29577f 100644
--- a/man/man1/rgb2pct.1
+++ b/man/man1/rgb2pct.1
@@ -1,8 +1,8 @@
-.TH "rgb2pct" 1 "Fri Jun 5 2015" "GDAL" \" -*- nroff -*-
+.TH "rgb2pct" 1 "Sun Jun 14 2015" "GDAL" \" -*- nroff -*-
 .ad l
 .nh
 .SH NAME
-rgb2pct \- .TH "rgb2pct" 1 "Fri Jun 5 2015" "GDAL" \" -*- nroff -*-
+rgb2pct \- .TH "rgb2pct" 1 "Sun Jun 14 2015" "GDAL" \" -*- nroff -*-
 .ad l
 .nh
 .SH NAME
diff --git a/nmake.opt b/nmake.opt
index 7eb7d86..88a7ad5 100644
--- a/nmake.opt
+++ b/nmake.opt
@@ -1,4 +1,4 @@
-# $Id: nmake.opt 28874 2015-04-08 15:10:44Z dron $
+# $Id: nmake.opt 29336 2015-06-14 17:37:21Z rouault $
 #
 # nmake.opt - main configuration file for NMAKE makefiles.
 #
@@ -352,7 +352,7 @@ JPEG12_SUPPORTED = 1
 #HDF4_DIR =	D:\warmerda\HDF41r5
 #HDF4_LIB =	/LIBPATH:$(HDF4_DIR)\lib Ws2_32.lib
 # HDF4 library newer than 4.2.5 has a SDreset_maxopenfiles/SDget_maxopenfiles
-# interface which allows to open many HDF files simultaneously (the max
+# interface which allows opening many HDF files simultaneously (the max
 # number of files was previously hardcoded and too low, smth. like 32).
 # Uncomment following if your library is newer than 4.2.5.
 #HDF4_HAS_MAXOPENFILES = YES
diff --git a/ogr/ogrcurvecollection.cpp b/ogr/ogrcurvecollection.cpp
index e5c5ea7..519423b 100644
--- a/ogr/ogrcurvecollection.cpp
+++ b/ogr/ogrcurvecollection.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: ogrcurvecollection.cpp 27960 2014-11-14 18:31:32Z rouault $
+ * $Id: ogrcurvecollection.cpp 29330 2015-06-14 12:11:11Z rouault $
  *
  * Project:  OpenGIS Simple Features Reference Implementation
  * Purpose:  The OGRCurveCollection class.
@@ -315,7 +315,7 @@ OGRErr OGRCurveCollection::exportToWkb( const OGRGeometry* poGeom,
         if( nGType == wkbCurvePolygon )
             nGType = POSTGIS15_CURVEPOLYGON;
         if( bIs3D )
-            nGType = (OGRwkbGeometryType)(nGType | wkb25DBitInternalUse); /* yes we explicitely set wkb25DBit */
+            nGType = (OGRwkbGeometryType)(nGType | wkb25DBitInternalUse); /* yes we explicitly set wkb25DBit */
     }
 
     if( eByteOrder == wkbNDR )
diff --git a/ogr/ogrgeometrycollection.cpp b/ogr/ogrgeometrycollection.cpp
index 965a4bb..d629a53 100644
--- a/ogr/ogrgeometrycollection.cpp
+++ b/ogr/ogrgeometrycollection.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: ogrgeometrycollection.cpp 27959 2014-11-14 18:29:21Z rouault $
+ * $Id: ogrgeometrycollection.cpp 29330 2015-06-14 12:11:11Z rouault $
  *
  * Project:  OpenGIS Simple Features Reference Implementation
  * Purpose:  The OGRGeometryCollection class.
@@ -32,7 +32,7 @@
 #include "ogr_p.h"
 #include "ogr_api.h"
 
-CPL_CVSID("$Id: ogrgeometrycollection.cpp 27959 2014-11-14 18:29:21Z rouault $");
+CPL_CVSID("$Id: ogrgeometrycollection.cpp 29330 2015-06-14 12:11:11Z rouault $");
 
 /************************************************************************/
 /*                       OGRGeometryCollection()                        */
@@ -529,7 +529,7 @@ OGRErr  OGRGeometryCollection::exportToWkb( OGRwkbByteOrder eByteOrder,
         else if( nGType == wkbMultiSurface )
             nGType = POSTGIS15_MULTISURFACE;
         if( bIs3D )
-            nGType = (OGRwkbGeometryType)(nGType | wkb25DBitInternalUse); /* yes we explicitely set wkb25DBit */
+            nGType = (OGRwkbGeometryType)(nGType | wkb25DBitInternalUse); /* yes we explicitly set wkb25DBit */
     }
     
     if( eByteOrder == wkbNDR )
diff --git a/ogr/ogrgeometryfactory.cpp b/ogr/ogrgeometryfactory.cpp
index 9a7097d..0cb3691 100644
--- a/ogr/ogrgeometryfactory.cpp
+++ b/ogr/ogrgeometryfactory.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: ogrgeometryfactory.cpp 28039 2014-11-30 18:24:59Z rouault $
+ * $Id: ogrgeometryfactory.cpp 29330 2015-06-14 12:11:11Z rouault $
  *
  * Project:  OpenGIS Simple Features Reference Implementation
  * Purpose:  Factory for converting geometry to and from well known binary
@@ -34,7 +34,7 @@
 #include "ogr_p.h"
 #include "ogr_geos.h"
 
-CPL_CVSID("$Id: ogrgeometryfactory.cpp 28039 2014-11-30 18:24:59Z rouault $");
+CPL_CVSID("$Id: ogrgeometryfactory.cpp 29330 2015-06-14 12:11:11Z rouault $");
 
 /************************************************************************/
 /*                           createFromWkb()                            */
@@ -3485,8 +3485,8 @@ static int OGRGF_NeedSwithArcOrder(double x0, double y0,
  *         and OGRGeometryFactory::curveFromLineString() can decode them.
  *         This is the best compromise for round-tripping in OGR and better results
  *         with PostGIS <a href="http://postgis.org/docs/ST_LineToCurve.html">ST_LineToCurve()</a>
- *         If set to YES, the intermediate point is explicitely added to the linestring.
- *         If set to NO, the intermediate point is not explicitely added.
+ *         If set to YES, the intermediate point is explicitly added to the linestring.
+ *         If set to NO, the intermediate point is not explicitly added.
  * </li>
  * </ul>
  *
@@ -3809,7 +3809,7 @@ static int OGRGF_DetectArc(const OGRLineString* poLS, int i,
 
         double dfStep10 = fabs(alpha1_2 - alpha0_2);
         double dfStep21 = fabs(alpha2_2 - alpha1_2);
-        /* Check that the angle step is consistant with the original */
+        /* Check that the angle step is consistent with the original */
         /* step. */
         if( !(dfStep10 < 2 * dfMaxDeltaAlpha && dfStep21 < 2 * dfMaxDeltaAlpha) )
         {
@@ -3888,7 +3888,7 @@ static int OGRGF_DetectArc(const OGRLineString* poLS, int i,
                 }
 
 #ifdef VERBOSE_DEBUG_CURVEFROMLINESTRING
-                printf("j=%d, nAlphaRatioReversed = %u --> unconsistant values accross arc. Don't use it\n",
+                printf("j=%d, nAlphaRatioReversed = %u --> unconsistent values accross arc. Don't use it\n",
                         j, nAlphaRatioReversed);
 #endif
                 bValidAlphaRatio = FALSE;
diff --git a/ogr/ogrlinestring.cpp b/ogr/ogrlinestring.cpp
index b56c9a4..1718db2 100644
--- a/ogr/ogrlinestring.cpp
+++ b/ogr/ogrlinestring.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: ogrlinestring.cpp 28039 2014-11-30 18:24:59Z rouault $
+ * $Id: ogrlinestring.cpp 29330 2015-06-14 12:11:11Z rouault $
  *
  * Project:  OpenGIS Simple Features Reference Implementation
  * Purpose:  The OGRSimpleCurve and OGRLineString geometry classes.
@@ -33,7 +33,7 @@
 #include <assert.h>
 #include "ogr_geos.h"
 
-CPL_CVSID("$Id: ogrlinestring.cpp 28039 2014-11-30 18:24:59Z rouault $");
+CPL_CVSID("$Id: ogrlinestring.cpp 29330 2015-06-14 12:11:11Z rouault $");
 
 /************************************************************************/
 /*                           OGRSimpleCurve()                           */
@@ -897,7 +897,7 @@ OGRErr  OGRSimpleCurve::exportToWkb( OGRwkbByteOrder eByteOrder,
     if ( eWkbVariant == wkbVariantIso )
         nGType = getIsoGeometryType();
     else if( eWkbVariant == wkbVariantPostGIS1 && wkbHasZ((OGRwkbGeometryType)nGType) )
-        nGType = (OGRwkbGeometryType)(wkbFlatten(nGType) | wkb25DBitInternalUse); /* yes we explicitely set wkb25DBit */
+        nGType = (OGRwkbGeometryType)(wkbFlatten(nGType) | wkb25DBitInternalUse); /* yes we explicitly set wkb25DBit */
 
     if( eByteOrder == wkbNDR )
         nGType = CPL_LSBWORD32( nGType );
diff --git a/ogr/ogrsf_frmts/arcobjects/aolayer.cpp b/ogr/ogrsf_frmts/arcobjects/aolayer.cpp
index bdd0a5c..d953e16 100644
--- a/ogr/ogrsf_frmts/arcobjects/aolayer.cpp
+++ b/ogr/ogrsf_frmts/arcobjects/aolayer.cpp
@@ -37,7 +37,7 @@
 /************************************************************************/
 AOLayer::AOLayer():
 OGRLayer(),m_pFeatureDefn(NULL),m_pSRS(NULL), m_ipQF(CLSID_QueryFilter),
-m_pBuffer(NULL), m_bufferSize(0), m_supressColumnMappingError(false),m_forceMulti(false)
+m_pBuffer(NULL), m_bufferSize(0), m_suppressColumnMappingError(false),m_forceMulti(false)
 {
 }
 
@@ -419,7 +419,7 @@ bool AOLayer::OGRFeatureFromAORow(IRow* pRow, OGRFeature** ppFeature)
       */
     default:
       {
-        if (!m_supressColumnMappingError)
+        if (!m_suppressColumnMappingError)
         {
           foundBadColumn = true;
           CPLError( CE_Warning, CPLE_AppDefined, "Row id: %d col:%d has unhandled col type (%d). Setting to NULL.", oid, i, m_pFeatureDefn->GetFieldDefn(i)->GetType());
@@ -429,7 +429,7 @@ bool AOLayer::OGRFeatureFromAORow(IRow* pRow, OGRFeature** ppFeature)
   }
   
   if (foundBadColumn)
-    m_supressColumnMappingError = true;
+    m_suppressColumnMappingError = true;
   
 
   *ppFeature = pOutFeature;
diff --git a/ogr/ogrsf_frmts/arcobjects/ogr_ao.h b/ogr/ogrsf_frmts/arcobjects/ogr_ao.h
index 0824f2d..d4849b0 100644
--- a/ogr/ogrsf_frmts/arcobjects/ogr_ao.h
+++ b/ogr/ogrsf_frmts/arcobjects/ogr_ao.h
@@ -115,7 +115,7 @@ protected:
     //buffers are used for avoiding constant reallocation of temp memory
     unsigned char* m_pBuffer;
     long  m_bufferSize; //in bytes
-    bool  m_supressColumnMappingError;
+    bool  m_suppressColumnMappingError;
     bool  m_forceMulti;
 };
 
diff --git a/ogr/ogrsf_frmts/cartodb/drv_cartodb.html b/ogr/ogrsf_frmts/cartodb/drv_cartodb.html
index 445e5ba..b501425 100644
--- a/ogr/ogrsf_frmts/cartodb/drv_cartodb.html
+++ b/ogr/ogrsf_frmts/cartodb/drv_cartodb.html
@@ -93,7 +93,7 @@ can cause performance penalties when issuing a lot of commands due to many clien
 
 So, on a newly created layer, the INSERT of CreateFeature() operations are grouped together
 in chunks until they reach 15 MB (can be changed with the CARTODB_MAX_CHUNK_SIZE
-configuration option, with a value in MB), at which point they are transfered
+configuration option, with a value in MB), at which point they are transferred
 to the server. By setting CARTODB_MAX_CHUNK_SIZE to 0, immediate transfer occurs.<p>
 
 <h2>SQL</h2>
diff --git a/ogr/ogrsf_frmts/csv/drv_csv.html b/ogr/ogrsf_frmts/csv/drv_csv.html
index ff0352d..5f48439 100644
--- a/ogr/ogrsf_frmts/csv/drv_csv.html
+++ b/ogr/ogrsf_frmts/csv/drv_csv.html
@@ -148,7 +148,7 @@ Starting with GDAL 2.0, the following open options can be specified
 (typically with the -oo name=value parameters of ogrinfo or ogr2ogr):
 <ul>
 <li><b>MERGE_SEPARATOR</b>=YES/NO (defaults to NO). Setting it to YES will
-enable merging consecutive separators. Mostly usefull when it is the space
+enable merging consecutive separators. Mostly useful when it is the space
 character.</li>
 <li><b>AUTODETECT_TYPE</b>=YES/NO (defaults to NO). Setting it to YES will
 enable auto-detection of field data types. If while reading the records
diff --git a/ogr/ogrsf_frmts/filegdb/FGdbDatasource.cpp b/ogr/ogrsf_frmts/filegdb/FGdbDatasource.cpp
index be0d464..806f0db 100644
--- a/ogr/ogrsf_frmts/filegdb/FGdbDatasource.cpp
+++ b/ogr/ogrsf_frmts/filegdb/FGdbDatasource.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: FGdbDatasource.cpp 29196 2015-05-14 15:50:13Z rouault $
+ * $Id: FGdbDatasource.cpp 29330 2015-06-14 12:11:11Z rouault $
  *
  * Project:  OpenGIS Simple Features Reference Implementation
  * Purpose:  Implements FileGDB OGR Datasource.
@@ -37,7 +37,7 @@
 #include "FGdbUtils.h"
 #include "cpl_multiproc.h"
 
-CPL_CVSID("$Id: FGdbDatasource.cpp 29196 2015-05-14 15:50:13Z rouault $");
+CPL_CVSID("$Id: FGdbDatasource.cpp 29330 2015-06-14 12:11:11Z rouault $");
 
 using std::vector;
 using std::wstring;
@@ -487,7 +487,7 @@ OGRLayer * FGdbDataSource::ExecuteSQL( const char *pszSQLCommand,
         CPLDebug("FGDB", "Support for SELECT is known to be partially "
                          "non-compliant with FileGDB SDK API v1.2.\n"
                          "So for now, we use default OGR SQL engine. "
-                         "Explicitely specify -dialect FileGDB\n"
+                         "Explicitly specify -dialect FileGDB\n"
                          "to use the SQL engine from the FileGDB SDK API");
         return OGRDataSource::ExecuteSQL( pszSQLCommand,
                                         poSpatialFilter,
diff --git a/ogr/ogrsf_frmts/filegdb/FGdbLayer.cpp b/ogr/ogrsf_frmts/filegdb/FGdbLayer.cpp
index 1e3b6f2..e68936b 100644
--- a/ogr/ogrsf_frmts/filegdb/FGdbLayer.cpp
+++ b/ogr/ogrsf_frmts/filegdb/FGdbLayer.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
-* $Id: FGdbLayer.cpp 29196 2015-05-14 15:50:13Z rouault $
+* $Id: FGdbLayer.cpp 29330 2015-06-14 12:11:11Z rouault $
 *
 * Project:  OpenGIS Simple Features Reference Implementation
 * Purpose:  Implements FileGDB OGR layer.
@@ -37,7 +37,7 @@
 #include "FGdbUtils.h"
 #include "cpl_minixml.h" // the only way right now to extract schema information
 
-CPL_CVSID("$Id: FGdbLayer.cpp 29196 2015-05-14 15:50:13Z rouault $");
+CPL_CVSID("$Id: FGdbLayer.cpp 29330 2015-06-14 12:11:11Z rouault $");
 
 using std::string;
 using std::wstring;
@@ -47,7 +47,7 @@ using std::wstring;
 /************************************************************************/
 FGdbBaseLayer::FGdbBaseLayer() :
     m_pFeatureDefn(NULL), m_pSRS(NULL), m_pEnumRows(NULL),
-    m_supressColumnMappingError(false), m_forceMulti(false)
+    m_suppressColumnMappingError(false), m_forceMulti(false)
 {
 }
 
@@ -776,7 +776,7 @@ char* FGdbLayer::CreateFieldDefn(OGRFieldDefn& oField,
             {
                 if( fldtypeCheck != fldtype )
                 {
-                    CPLError(CE_Warning, CPLE_AppDefined, "Ignoring COLUMN_TYPES=%s=%s : %s not consistant with OGR data type",
+                    CPLError(CE_Warning, CPLE_AppDefined, "Ignoring COLUMN_TYPES=%s=%s : %s not consistent with OGR data type",
                          fieldname.c_str(), pszFieldType, pszFieldType);
                 }
                 else
@@ -1247,7 +1247,7 @@ CPLXMLNode* XMLSpatialReference(OGRSpatialReference* poSRS, char** papszOptions)
     const char* gridvalues[7];
 
     /* 
-    Need different default paramters for geographic and projected coordinate systems.
+    Need different default parameters for geographic and projected coordinate systems.
     Try and use ArcGIS 10 default values.
     */
     // default tolerance is 1mm in the units of the coordinate system
@@ -2537,7 +2537,7 @@ bool FGdbBaseLayer::OGRFeatureFromGdbRow(Row* pRow, OGRFeature** ppFeature)
 
             default:
             {
-                if (!m_supressColumnMappingError)
+                if (!m_suppressColumnMappingError)
                 {
                     foundBadColumn = true;
                     CPLError( CE_Warning, CPLE_AppDefined,
@@ -2549,7 +2549,7 @@ bool FGdbBaseLayer::OGRFeatureFromGdbRow(Row* pRow, OGRFeature** ppFeature)
     }
 
     if (foundBadColumn)
-        m_supressColumnMappingError = true;
+        m_suppressColumnMappingError = true;
 
 
     *ppFeature = pOutFeature;
diff --git a/ogr/ogrsf_frmts/filegdb/FGdbResultLayer.cpp b/ogr/ogrsf_frmts/filegdb/FGdbResultLayer.cpp
index c1c2157..cd26dcb 100644
--- a/ogr/ogrsf_frmts/filegdb/FGdbResultLayer.cpp
+++ b/ogr/ogrsf_frmts/filegdb/FGdbResultLayer.cpp
@@ -48,7 +48,7 @@ FGdbResultLayer::FGdbResultLayer(FGdbDataSource* pParentDataSource,
     m_pDS = pParentDataSource;
     osSQL = pszSQL;
 
-    m_supressColumnMappingError = false;
+    m_suppressColumnMappingError = false;
 
     FieldInfo fieldInfo;
     m_pEnumRows->GetFieldInformation(fieldInfo);
diff --git a/ogr/ogrsf_frmts/filegdb/ogr_fgdb.h b/ogr/ogrsf_frmts/filegdb/ogr_fgdb.h
index 2cced8d..039085b 100644
--- a/ogr/ogrsf_frmts/filegdb/ogr_fgdb.h
+++ b/ogr/ogrsf_frmts/filegdb/ogr_fgdb.h
@@ -1,5 +1,5 @@
 /******************************************************************************
-* $Id: ogr_fgdb.h 29196 2015-05-14 15:50:13Z rouault $
+* $Id: ogr_fgdb.h 29330 2015-06-14 12:11:11Z rouault $
 *
 * Project:  OpenGIS Simple Features Reference Implementation
 * Purpose:  Standard includes and class definitions ArcObjects OGR driver.
@@ -82,7 +82,7 @@ protected:
   std::vector<std::wstring> m_vOGRFieldToESRIField; //OGR Field Index to ESRI Field Name Mapping
   std::vector<std::string> m_vOGRFieldToESRIFieldType; //OGR Field Index to ESRI Field Type Mapping
 
-  bool  m_supressColumnMappingError;
+  bool  m_suppressColumnMappingError;
   bool  m_forceMulti;
 
   bool OGRFeatureFromGdbRow(Row* pRow, OGRFeature** ppFeature);
diff --git a/ogr/ogrsf_frmts/generic/ogrunionlayer.h b/ogr/ogrsf_frmts/generic/ogrunionlayer.h
index a245958..8d641b6 100644
--- a/ogr/ogrsf_frmts/generic/ogrunionlayer.h
+++ b/ogr/ogrsf_frmts/generic/ogrunionlayer.h
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: ogrunionlayer.h 28375 2015-01-30 12:06:11Z rouault $
+ * $Id: ogrunionlayer.h 29330 2015-06-14 12:11:11Z rouault $
  *
  * Project:  OpenGIS Simple Features Reference Implementation
  * Purpose:  Defines OGRUnionLayer class
@@ -112,7 +112,7 @@ class OGRUnionLayer : public OGRLayer
     void                SetFields(FieldUnionStrategy eFieldStrategy,
                                   int nFields,
                                   OGRFieldDefn** papoFields,  /* duplicated by the method */
-                                  int nGeomFields, /* maybe -1 to explicitely disable geometry fields */
+                                  int nGeomFields, /* maybe -1 to explicitly disable geometry fields */
                                   OGRUnionLayerGeomFieldDefn** papoGeomFields  /* duplicated by the method */);
     void                SetSourceLayerFieldName(const char* pszSourceLayerFieldName);
     void                SetPreserveSrcFID(int bPreserveSrcFID);
diff --git a/ogr/ogrsf_frmts/geojson/drv_geojson.html b/ogr/ogrsf_frmts/geojson/drv_geojson.html
index 19ddb2a..e7fbb8f 100644
--- a/ogr/ogrsf_frmts/geojson/drv_geojson.html
+++ b/ogr/ogrsf_frmts/geojson/drv_geojson.html
@@ -28,7 +28,7 @@ And starting with OGR 2.0, the GeoJSON driver can scroll through such result set
 are spread over multiple pages (for ArcGIS servers >= 10.3). This is automatically enabled
 if URL does not contain an explicit <i>resultOffset</i> parameter. If it contains
 this parameter and scrolling is still desired, the FEATURE_SERVER_PAGING open option must be set to YES.
-The page size can be explicitely set with the <i>resultRecordCount</i> parameter (but
+The page size can be explicitly set with the <i>resultRecordCount</i> parameter (but
 is subject to a server limit). If it is not set, OGR will set it to the maximum
 value allowed by the server.</p>
 
diff --git a/ogr/ogrsf_frmts/gml/ogrgmldatasource.cpp b/ogr/ogrsf_frmts/gml/ogrgmldatasource.cpp
index dd495b1..d8a623c 100644
--- a/ogr/ogrsf_frmts/gml/ogrgmldatasource.cpp
+++ b/ogr/ogrsf_frmts/gml/ogrgmldatasource.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: ogrgmldatasource.cpp 29273 2015-06-02 08:08:38Z rouault $
+ * $Id: ogrgmldatasource.cpp 29330 2015-06-14 12:11:11Z rouault $
  *
  * Project:  OGR
  * Purpose:  Implements OGRGMLDataSource class.
@@ -47,7 +47,7 @@
 
 #include <vector>
 
-CPL_CVSID("$Id: ogrgmldatasource.cpp 29273 2015-06-02 08:08:38Z rouault $");
+CPL_CVSID("$Id: ogrgmldatasource.cpp 29330 2015-06-14 12:11:11Z rouault $");
 
 static int ExtractSRSName(const char* pszXML, char* szSRSName,
                           size_t sizeof_szSRSName);
@@ -1421,7 +1421,7 @@ OGRGMLLayer *OGRGMLDataSource::TranslateGMLSchema( GMLFeatureClass *poClass )
         }
     }
 
-    /* Report a COMPD_CS only if GML_REPORT_COMPD_CS is explicitely set to TRUE */
+    /* Report a COMPD_CS only if GML_REPORT_COMPD_CS is explicitly set to TRUE */
     if( poSRS != NULL &&
         !CSLTestBoolean(CPLGetConfigOption("GML_REPORT_COMPD_CS", "FALSE")) )
     {
diff --git a/ogr/ogrsf_frmts/gpkg/drv_geopackage_raster.html b/ogr/ogrsf_frmts/gpkg/drv_geopackage_raster.html
index 26db1ca..09763c1 100644
--- a/ogr/ogrsf_frmts/gpkg/drv_geopackage_raster.html
+++ b/ogr/ogrsf_frmts/gpkg/drv_geopackage_raster.html
@@ -124,8 +124,8 @@ recompression of tiles to be done, which might cause unnecessary quality loss wh
 lossy compression (JPEG, WebP). To avoid that, the driver will create a temporary
 database next to the main GeoPackage file to store partial GeoPackage tiles in a
 lossless (and uncompressed) way. Once a tile has received data for its four quadrants
-and for all the bands (or the dataset is closed or explicitely flushed with FlushCache()),
-those uncompressed tiles are definitely transfered to the GeoPackage file with
+and for all the bands (or the dataset is closed or explicitly flushed with FlushCache()),
+those uncompressed tiles are definitely transferred to the GeoPackage file with
 the appropriate compression. All of this is transparent to the user of GDAL API/utilities</p>
 
 <h3><a id="tile_formats">Tile formats</a></h3>
diff --git a/ogr/ogrsf_frmts/gpkg/ogrgeopackagelayer.cpp b/ogr/ogrsf_frmts/gpkg/ogrgeopackagelayer.cpp
index 743ad2e..b76b882 100644
--- a/ogr/ogrsf_frmts/gpkg/ogrgeopackagelayer.cpp
+++ b/ogr/ogrsf_frmts/gpkg/ogrgeopackagelayer.cpp
@@ -356,7 +356,7 @@ void OGRGeoPackageLayer::BuildFeatureDefn( const char *pszLayerName,
         const char * pszDeclType = sqlite3_column_decltype(hStmt, iCol);
 
         // Recognize a geometry column from trying to build the geometry
-        // Usefull for OGRSQLiteSelectLayer
+        // Useful for OGRSQLiteSelectLayer
         if( nColType == SQLITE_BLOB && m_poFeatureDefn->GetGeomFieldCount() == 0 )
         {
             const int nBytes = sqlite3_column_bytes( hStmt, iCol );
diff --git a/ogr/ogrsf_frmts/gpkg/ogrgeopackagetablelayer.cpp b/ogr/ogrsf_frmts/gpkg/ogrgeopackagetablelayer.cpp
index 7d3e3c6..f161760 100644
--- a/ogr/ogrsf_frmts/gpkg/ogrgeopackagetablelayer.cpp
+++ b/ogr/ogrsf_frmts/gpkg/ogrgeopackagetablelayer.cpp
@@ -1130,7 +1130,7 @@ OGRErr OGRGeoPackageTableLayer::ICreateFeature( OGRFeature *poFeature )
                 poFeature->GetFieldAsInteger64(m_iFIDAsRegularColumnIndex) != poFeature->GetFID() )
             {
                 CPLError(CE_Failure, CPLE_AppDefined,
-                            "Inconsistant values of FID and field of same name");
+                            "Inconsistent values of FID and field of same name");
                 return CE_Failure;
             }
         }
@@ -1251,7 +1251,7 @@ OGRErr OGRGeoPackageTableLayer::ISetFeature( OGRFeature *poFeature )
             poFeature->GetFieldAsInteger64(m_iFIDAsRegularColumnIndex) != poFeature->GetFID() )
         {
             CPLError(CE_Failure, CPLE_AppDefined,
-                        "Inconsistant values of FID and field of same name");
+                        "Inconsistent values of FID and field of same name");
             return CE_Failure;
         }
     }
diff --git a/ogr/ogrsf_frmts/ili/imdreader.cpp b/ogr/ogrsf_frmts/ili/imdreader.cpp
index 89cc959..2ece5b0 100644
--- a/ogr/ogrsf_frmts/ili/imdreader.cpp
+++ b/ogr/ogrsf_frmts/ili/imdreader.cpp
@@ -62,11 +62,11 @@ public:
     bool isAssocClass;
     bool hasDerivedClasses;
 
-    IliClass(CPLXMLNode* node_, const char* name, int iliVersion_, StrNodeMap& oTidLookup_, ClassesMap& oClasses_, NodeCountMap& oAxisCount_) :
+    IliClass(CPLXMLNode* node_, int iliVersion_, StrNodeMap& oTidLookup_, ClassesMap& oClasses_, NodeCountMap& oAxisCount_) :
         node(node_), iliVersion(iliVersion_), oTidLookup(oTidLookup_), oClasses(oClasses_), oAxisCount(oAxisCount_),
         poGeomFieldInfos(), poStructFieldInfos(), oFields(), isAssocClass(false), hasDerivedClasses(false)
     {
-        char* layerName = LayerName(name);
+        char* layerName = LayerName();
         poTableDefn = new OGRFeatureDefn(layerName);
         CPLFree(layerName);
     };
@@ -77,7 +77,11 @@ public:
     const char* GetName() {
         return poTableDefn->GetName();
     }
-    char* LayerName(const char* psClassTID) {
+    const char* GetIliName() {
+        return CPLGetXMLValue( node, "TID", NULL );
+    }
+    char* LayerName() {
+        const char* psClassTID = GetIliName();
         if (iliVersion == 1)
         {
             //Skip topic and replace . with __
@@ -378,15 +382,15 @@ void ImdReader::ReadModel(const char *pszFilename) {
                         codeContinue = atoi(CPLGetXMLValue(psFormatNode, "continueCode", "92"));
                     }
                 }
-                else if( EQUAL(psEntry->pszValue, "IlisMeta07.ModelData.SubModel") && !EQUAL(modelName, "MODEL.INTERLIS"))
+                else if( EQUAL(psEntry->pszValue, "IlisMeta07.ModelData.SubModel"))
                 {
                     mainBasketName = CPLGetXMLValue(psEntry, "TID", "OGR");
                     mainTopicName = CPLGetXMLValue(psEntry, "Name", "OGR");
                 }
-                else if( EQUAL(psEntry->pszValue, "IlisMeta07.ModelData.Class") && !EQUAL(modelName, "MODEL.INTERLIS"))
+                else if( EQUAL(psEntry->pszValue, "IlisMeta07.ModelData.Class") )
                 {
                     CPLDebug( "OGR_ILI", "Class name: '%s'", psTID);
-                    oClasses[psEntry] = new IliClass(psEntry, psTID, iliVersion, oTidLookup, oClasses, oAxisCount);
+                    oClasses[psEntry] = new IliClass(psEntry, iliVersion, oTidLookup, oClasses, oAxisCount);
                 }
             }
             psEntry = psEntry->psNext;
@@ -399,7 +403,7 @@ void ImdReader::ReadModel(const char *pszFilename) {
             if (psEntry->eType != CXT_Attribute) //ignore BID
             {
                 //CPLDebug( "OGR_ILI", "Node tag: '%s'", psEntry->pszValue);
-                if( iliVersion == 1 && EQUAL(psEntry->pszValue, "IlisMeta07.ModelData.Ili1TransferElement") && !EQUAL(modelName, "MODEL.INTERLIS"))
+                if( iliVersion == 1 && EQUAL(psEntry->pszValue, "IlisMeta07.ModelData.Ili1TransferElement"))
                 {
                     const char* psClassRef = CPLGetXMLValue( psEntry, "Ili1TransferClass.REF", NULL );
                     const char* psElementRef = CPLGetXMLValue( psEntry, "Ili1RefAttr.REF", NULL );
@@ -408,7 +412,7 @@ void ImdReader::ReadModel(const char *pszFilename) {
                     CPLXMLNode* psElementNode = oTidLookup[psElementRef];
                     psParentClass->AddFieldNode(psElementNode, iOrderPos);
                 }
-                else if( EQUAL(psEntry->pszValue, "IlisMeta07.ModelData.TransferElement") && !EQUAL(modelName, "MODEL.INTERLIS"))
+                else if( EQUAL(psEntry->pszValue, "IlisMeta07.ModelData.TransferElement"))
                 {
                     const char* psClassRef = CPLGetXMLValue( psEntry, "TransferClass.REF", NULL );
                     const char* psElementRef = CPLGetXMLValue( psEntry, "TransferElement.REF", NULL );
@@ -417,7 +421,7 @@ void ImdReader::ReadModel(const char *pszFilename) {
                     CPLXMLNode* psElementNode = oTidLookup[psElementRef];
                     psParentClass->AddFieldNode(psElementNode, iOrderPos);
                 }
-                else if( EQUAL(psEntry->pszValue, "IlisMeta07.ModelData.Role") && !EQUAL(modelName, "MODEL.INTERLIS"))
+                else if( EQUAL(psEntry->pszValue, "IlisMeta07.ModelData.Role"))
                 {
                     const char* psRefParent = CPLGetXMLValue( psEntry, "Association.REF", NULL );
                     int iOrderPos = atoi(CPLGetXMLValue( psEntry, "Association.ORDER_POS", "0" ))-1;
@@ -425,14 +429,14 @@ void ImdReader::ReadModel(const char *pszFilename) {
                     if (psParentClass)
                         psParentClass->AddRoleNode(psEntry, iOrderPos);
                 }
-                else if( EQUAL(psEntry->pszValue, "IlisMeta07.ModelData.AxisSpec") && !EQUAL(modelName, "MODEL.INTERLIS"))
+                else if( EQUAL(psEntry->pszValue, "IlisMeta07.ModelData.AxisSpec"))
                 {
                     const char* psClassRef = CPLGetXMLValue( psEntry, "CoordType.REF", NULL );
                     //int iOrderPos = atoi(CPLGetXMLValue( psEntry, "Axis.ORDER_POS", "0" ))-1;
                     CPLXMLNode* psCoordTypeNode = oTidLookup[psClassRef];
                     oAxisCount[psCoordTypeNode] += 1;
                 }
-                else if( EQUAL(psEntry->pszValue, "IlisMeta07.ModelData.LinesForm") && !EQUAL(modelName, "MODEL.INTERLIS"))
+                else if( EQUAL(psEntry->pszValue, "IlisMeta07.ModelData.LinesForm"))
                 {
                     const char* psLineForm = CPLGetXMLValue( psEntry, "LineForm.REF", NULL );
                     if (EQUAL(psLineForm, "INTERLIS.ARCS")) {
@@ -454,8 +458,15 @@ void ImdReader::ReadModel(const char *pszFilename) {
     {
         //CPLDebug( "OGR_ILI", "Class: '%s'", it->second->GetName());
         const char* psRefSuper = CPLGetXMLValue( it->first, "Super.REF", NULL );
-        if (psRefSuper)
-            oClasses[oTidLookup[psRefSuper]]->hasDerivedClasses = true;
+        if (psRefSuper) {
+            if (oTidLookup.find(psRefSuper) != oTidLookup.end() &&
+                oClasses.find(oTidLookup[psRefSuper]) != oClasses.end()) {
+                oClasses[oTidLookup[psRefSuper]]->hasDerivedClasses = true;
+            } else {
+                CPLError(CE_Warning, CPLE_AppDefined,
+                    "Couldn't reference super class '%s'", psRefSuper);
+            }
+        }
         it->second->InitFieldDefinitions();
         it->second->AddFieldDefinitions(oArcLineTypes);
     }
@@ -463,8 +474,9 @@ void ImdReader::ReadModel(const char *pszFilename) {
     /* Filter relevant classes */
     for (ClassesMap::const_iterator it = oClasses.begin(); it != oClasses.end(); ++it)
     {
+        const char* className = it->second->GetIliName();
         FeatureDefnInfo oClassInfo = it->second->tableDefs();
-        if (oClassInfo.poTableDefn)
+        if (!EQUALN(className, "INTERLIS.", 9) && oClassInfo.poTableDefn)
             featureDefnInfos.push_back(oClassInfo);
     }
 
diff --git a/ogr/ogrsf_frmts/mitab/mitab_bounds.cpp b/ogr/ogrsf_frmts/mitab/mitab_bounds.cpp
index abf9ed2..14f12b0 100644
--- a/ogr/ogrsf_frmts/mitab/mitab_bounds.cpp
+++ b/ogr/ogrsf_frmts/mitab/mitab_bounds.cpp
@@ -1265,7 +1265,7 @@ int MITABLoadCoordSysTable(const char *pszFname)
                 }
                 if( strstr(pszLine, "Bounds") != NULL )
                 {
-                    CPLError(CE_Warning, CPLE_IllegalArg, "Unexpected Bounds paramater at line %d",
+                    CPLError(CE_Warning, CPLE_IllegalArg, "Unexpected Bounds parameter at line %d",
                              iLine);
                 }
                 bHasProjIn = TRUE;
diff --git a/ogr/ogrsf_frmts/openfilegdb/filegdbtable.cpp b/ogr/ogrsf_frmts/openfilegdb/filegdbtable.cpp
index 2eff8a1..bd9fb5f 100644
--- a/ogr/ogrsf_frmts/openfilegdb/filegdbtable.cpp
+++ b/ogr/ogrsf_frmts/openfilegdb/filegdbtable.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: filegdbtable.cpp 29158 2015-05-05 21:19:37Z rouault $
+ * $Id: filegdbtable.cpp 29330 2015-06-14 12:11:11Z rouault $
  *
  * Project:  OpenGIS Simple Features Reference Implementation
  * Purpose:  Implements reading of FileGDB tables
@@ -591,7 +591,7 @@ int FileGDBTable::ReadTableXHeader()
             returnErrorIf(VSIFReadL( pabyTablXBlockMap, nSizeInBytes, 1, fpTableX ) != 1 );
             /* returnErrorIf(nMagic2 == 0 ); */
 
-            // Check that the map is consistant with n1024Blocks
+            // Check that the map is consistent with n1024Blocks
             GUInt32 nCountBlocks = 0;
             for(GUInt32 i=0;i<nBitsForBlockMap;i++)
                 nCountBlocks += TEST_BIT(pabyTablXBlockMap, i) != 0;
diff --git a/ogr/ogrsf_frmts/pg/ogrpglayer.cpp b/ogr/ogrsf_frmts/pg/ogrpglayer.cpp
index 4e39306..22d1f67 100644
--- a/ogr/ogrsf_frmts/pg/ogrpglayer.cpp
+++ b/ogr/ogrsf_frmts/pg/ogrpglayer.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: ogrpglayer.cpp 28900 2015-04-14 09:40:34Z rouault $
+ * $Id: ogrpglayer.cpp 29330 2015-06-14 12:11:11Z rouault $
  *
  * Project:  OpenGIS Simple Features Reference Implementation
  * Purpose:  Implements OGRPGLayer class  which implements shared handling
@@ -65,7 +65,7 @@ PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
 
 #define PQexec this_is_an_error
 
-CPL_CVSID("$Id: ogrpglayer.cpp 28900 2015-04-14 09:40:34Z rouault $");
+CPL_CVSID("$Id: ogrpglayer.cpp 29330 2015-06-14 12:11:11Z rouault $");
 
 // These originally are defined in libpq-fs.h.
 
@@ -1509,7 +1509,7 @@ OGRFeature *OGRPGLayer::GetNextRawFeature()
     {
         CPLError(CE_Failure, CPLE_AppDefined,
                  "Cursor used to read layer has been closed due to a COMMIT. "
-                 "ResetReading() must be explicitely called to restart reading");
+                 "ResetReading() must be explicitly called to restart reading");
         return NULL;
     }
     
diff --git a/ogr/ogrsf_frmts/pg/ogrpgtablelayer.cpp b/ogr/ogrsf_frmts/pg/ogrpgtablelayer.cpp
index d4034a0..558f39a 100644
--- a/ogr/ogrsf_frmts/pg/ogrpgtablelayer.cpp
+++ b/ogr/ogrsf_frmts/pg/ogrpgtablelayer.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: ogrpgtablelayer.cpp 28995 2015-04-24 15:56:15Z rouault $
+ * $Id: ogrpgtablelayer.cpp 29330 2015-06-14 12:11:11Z rouault $
 
  *
  * Project:  OpenGIS Simple Features Reference Implementation
@@ -37,7 +37,7 @@
 
 #define PQexec this_is_an_error
 
-CPL_CVSID("$Id: ogrpgtablelayer.cpp 28995 2015-04-24 15:56:15Z rouault $");
+CPL_CVSID("$Id: ogrpgtablelayer.cpp 29330 2015-06-14 12:11:11Z rouault $");
 
 
 #define USE_COPY_UNSET  -10
@@ -1105,7 +1105,7 @@ OGRErr OGRPGTableLayer::ISetFeature( OGRFeature *poFeature )
             poFeature->GetFieldAsInteger64(iFIDAsRegularColumnIndex) != poFeature->GetFID() )
         {
             CPLError(CE_Failure, CPLE_AppDefined,
-                        "Inconsistant values of FID and field of same name");
+                        "Inconsistent values of FID and field of same name");
             return CE_Failure;
         }
     }
@@ -1319,7 +1319,7 @@ OGRErr OGRPGTableLayer::ICreateFeature( OGRFeature *poFeature )
                 poFeature->GetFieldAsInteger64(iFIDAsRegularColumnIndex) != poFeature->GetFID() )
             {
                 CPLError(CE_Failure, CPLE_AppDefined,
-                            "Inconsistant values of FID and field of same name");
+                            "Inconsistent values of FID and field of same name");
                 return CE_Failure;
             }
         }
diff --git a/ogr/ogrsf_frmts/pgdump/ogrpgdumplayer.cpp b/ogr/ogrsf_frmts/pgdump/ogrpgdumplayer.cpp
index 2939322..fa07f1f 100644
--- a/ogr/ogrsf_frmts/pgdump/ogrpgdumplayer.cpp
+++ b/ogr/ogrsf_frmts/pgdump/ogrpgdumplayer.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: ogrpgdumplayer.cpp 28988 2015-04-24 11:58:49Z rouault $
+ * $Id: ogrpgdumplayer.cpp 29330 2015-06-14 12:11:11Z rouault $
  *
  * Project:  OpenGIS Simple Features Reference Implementation
  * Purpose:  Implements OGRPGDumpLayer class
@@ -32,7 +32,7 @@
 #include "cpl_string.h"
 #include "ogr_p.h"
 
-CPL_CVSID("$Id: ogrpgdumplayer.cpp 28988 2015-04-24 11:58:49Z rouault $");
+CPL_CVSID("$Id: ogrpgdumplayer.cpp 29330 2015-06-14 12:11:11Z rouault $");
 
 #define USE_COPY_UNSET -1
 
@@ -158,7 +158,7 @@ OGRErr OGRPGDumpLayer::ICreateFeature( OGRFeature *poFeature )
                 poFeature->GetFieldAsInteger64(iFIDAsRegularColumnIndex) != poFeature->GetFID() )
             {
                 CPLError(CE_Failure, CPLE_AppDefined,
-                            "Inconsistant values of FID and field of same name");
+                            "Inconsistent values of FID and field of same name");
                 return CE_Failure;
             }
         }
diff --git a/ogr/ogrsf_frmts/selafin/drv_selafin.html b/ogr/ogrsf_frmts/selafin/drv_selafin.html
index 024cede..b6bf8bf 100644
--- a/ogr/ogrsf_frmts/selafin/drv_selafin.html
+++ b/ogr/ogrsf_frmts/selafin/drv_selafin.html
@@ -195,7 +195,7 @@ Numbers can also be negative. In this case, they are counted from the end of the
 	<dt>TITLE</dt>
 	<dd>Title of the datasource, stored in the Selafin file. The title must not hold more than 72 characters. If it is longer, it will be truncated to fit in the file.</dd>
 	<dt>DATE</dt>
-	<dd>Starting date of the simulation. Each layer in a Selafin file is characterized by a date, counted in seconds since a reference date. This option allows to provide the reference date. The format of this field must be YYYY-MM-DD_hh:mm:ss. The format does not mention the time zone.</dd>
+	<dd>Starting date of the simulation. Each layer in a Selafin file is characterized by a date, counted in seconds since a reference date. This option allows providing the reference date. The format of this field must be YYYY-MM-DD_hh:mm:ss. The format does not mention the time zone.</dd>
 </dl>
 
 <p>An example of datasource creation option is: <tt>-dsco TITLE="My simulation" -dsco DATE=2014-05-01_10:00:00</tt>.
diff --git a/ogr/ogrsf_frmts/selafin/ogrselafindriver.cpp b/ogr/ogrsf_frmts/selafin/ogrselafindriver.cpp
index fc5fa76..db27242 100644
--- a/ogr/ogrsf_frmts/selafin/ogrselafindriver.cpp
+++ b/ogr/ogrsf_frmts/selafin/ogrselafindriver.cpp
@@ -182,7 +182,7 @@ void RegisterOGRSelafin() {
         poDriver->SetMetadataItem( GDAL_DMD_CREATIONOPTIONLIST,
 "<CreationOptionList>"
 "  <Option name='TITLE' type='string' description='Title of the datasource, stored in the Selafin file. The title must not hold more than 72 characters.'/>"
-"  <Option name='DATE' type='string' description='Starting date of the simulation. Each layer in a Selafin file is characterized by a date, counted in seconds since a reference date. This option allows to provide the reference date. The format of this field must be YYYY-MM-DD_hh:mm:ss'/>"
+"  <Option name='DATE' type='string' description='Starting date of the simulation. Each layer in a Selafin file is characterized by a date, counted in seconds since a reference date. This option allows providing the reference date. The format of this field must be YYYY-MM-DD_hh:mm:ss'/>"
 "</CreationOptionList>");
         poDriver->SetMetadataItem( GDAL_DS_LAYER_CREATIONOPTIONLIST,
 "<LayerCreationOptionList>"
diff --git a/ogr/ogrsf_frmts/shape/shpopen.c b/ogr/ogrsf_frmts/shape/shpopen.c
index 3387025..c0d1b08 100644
--- a/ogr/ogrsf_frmts/shape/shpopen.c
+++ b/ogr/ogrsf_frmts/shape/shpopen.c
@@ -1792,7 +1792,7 @@ SHPReadObject( SHPHandle psSHP, int hEntity )
         {
             char str[128];
             sprintf( str,
-                    "Sanity check failed when trying to recover from inconsistant .shx/.shp with shape %d",
+                    "Sanity check failed when trying to recover from inconsistent .shx/.shp with shape %d",
                     hEntity );
 
             psSHP->sHooks.Error( str );
diff --git a/ogr/ogrsf_frmts/sqlite/drv_sqlite.html b/ogr/ogrsf_frmts/sqlite/drv_sqlite.html
index 8b8b0fe..55991cd 100644
--- a/ogr/ogrsf_frmts/sqlite/drv_sqlite.html
+++ b/ogr/ogrsf_frmts/sqlite/drv_sqlite.html
@@ -309,7 +309,7 @@ appropriately in order to get optimal performance.
 The default OGR behavior is to COMMIT a transaction every 200 inserted rows. This
 value is surely too low for SQLite; and closing too much frequently the current
 transaction causes severe performance degradation.
-The <b>-gt</b> argument allows to explicitly set the number of rows for each transaction.
+The <b>-gt</b> argument allows explicitly setting the number of rows for each transaction.
 Explicitly defining <b>-gt 1024</b> usually ensures a noticeable performance boost;
 defining an even bigger <b>-gt 65536</b> ensures optimal performance while
 populating some table containing many hundredth thousand or million rows.<p>
diff --git a/ogr/ogrsf_frmts/sqlite/ogr_sqlite.h b/ogr/ogrsf_frmts/sqlite/ogr_sqlite.h
index 19f19d5..8a2931a 100644
--- a/ogr/ogrsf_frmts/sqlite/ogr_sqlite.h
+++ b/ogr/ogrsf_frmts/sqlite/ogr_sqlite.h
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: ogr_sqlite.h 28808 2015-03-28 15:01:36Z rouault $
+ * $Id: ogr_sqlite.h 29330 2015-06-14 12:11:11Z rouault $
  *
  * Project:  OpenGIS Simple Features Reference Implementation
  * Purpose:  Private definitions for OGR/SQLite driver.
@@ -675,7 +675,7 @@ class OGRSQLiteBaseDataSource : public GDALPamDataset
 #endif
 
     VSILFILE*           fpMainFile; /* Set by the VFS layer when it opens the DB */
-                                    /* Must *NOT* be closed by the datasource explicitely. */
+                                    /* Must *NOT* be closed by the datasource explicitly. */
 
     int                 OpenOrCreateDB(int flags, int bRegisterOGR2SQLiteExtensions);
     int                 SetSynchronous();
diff --git a/ogr/ogrsf_frmts/sqlite/ogrsqlitetablelayer.cpp b/ogr/ogrsf_frmts/sqlite/ogrsqlitetablelayer.cpp
index 5c4391f..1cad026 100644
--- a/ogr/ogrsf_frmts/sqlite/ogrsqlitetablelayer.cpp
+++ b/ogr/ogrsf_frmts/sqlite/ogrsqlitetablelayer.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: ogrsqlitetablelayer.cpp 28900 2015-04-14 09:40:34Z rouault $
+ * $Id: ogrsqlitetablelayer.cpp 29330 2015-06-14 12:11:11Z rouault $
  *
  * Project:  OpenGIS Simple Features Reference Implementation
  * Purpose:  Implements OGRSQLiteTableLayer class, access to an existing table.
@@ -37,7 +37,7 @@
 
 #define UNSUPPORTED_OP_READ_ONLY "%s : unsupported operation on a read-only datasource."
 
-CPL_CVSID("$Id: ogrsqlitetablelayer.cpp 28900 2015-04-14 09:40:34Z rouault $");
+CPL_CVSID("$Id: ogrsqlitetablelayer.cpp 29330 2015-06-14 12:11:11Z rouault $");
 
 /************************************************************************/
 /*                        OGRSQLiteTableLayer()                         */
@@ -2585,7 +2585,7 @@ OGRErr OGRSQLiteTableLayer::ISetFeature( OGRFeature *poFeature )
             poFeature->GetFieldAsInteger64(iFIDAsRegularColumnIndex) != poFeature->GetFID() )
         {
             CPLError(CE_Failure, CPLE_AppDefined,
-                        "Inconsistant values of FID and field of same name");
+                        "Inconsistent values of FID and field of same name");
             return CE_Failure;
         }
     }
@@ -2946,7 +2946,7 @@ OGRErr OGRSQLiteTableLayer::ICreateFeature( OGRFeature *poFeature )
                 poFeature->GetFieldAsInteger64(iFIDAsRegularColumnIndex) != poFeature->GetFID() )
             {
                 CPLError(CE_Failure, CPLE_AppDefined,
-                            "Inconsistant values of FID and field of same name");
+                            "Inconsistent values of FID and field of same name");
                 return CE_Failure;
             }
         }
diff --git a/ogr/ogrsf_frmts/vrt/drv_vrt.html b/ogr/ogrsf_frmts/vrt/drv_vrt.html
index fde681e..258ecb1 100644
--- a/ogr/ogrsf_frmts/vrt/drv_vrt.html
+++ b/ogr/ogrsf_frmts/vrt/drv_vrt.html
@@ -160,7 +160,7 @@ whether the geometry field is nullable. It defaults to "true".</li>
 </p>
 <p>
 When several geometry fields are used, the following child elements of <b>GeometryField</b>
-can be defined to explicitely set the geometry type, SRS, source region, or extent.
+can be defined to explicitly set the geometry type, SRS, source region, or extent.
 <ul>
 <li><b>GeometryType</b> (optional) : same syntax as OGRVRTLayer-level <b>GeometryType</b>.</li>
 <li><b>SRS</b> (optional) : same syntax as OGRVRTLayer-level <b>LayerSRS</b> (note SRS vs LayerSRS)</li>
diff --git a/ogr/ogrsf_frmts/vrt/ogrvrtlayer.cpp b/ogr/ogrsf_frmts/vrt/ogrvrtlayer.cpp
index cb8e485..2efa705 100644
--- a/ogr/ogrsf_frmts/vrt/ogrvrtlayer.cpp
+++ b/ogr/ogrsf_frmts/vrt/ogrvrtlayer.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: ogrvrtlayer.cpp 28950 2015-04-18 23:24:49Z rouault $
+ * $Id: ogrvrtlayer.cpp 29330 2015-06-14 12:11:11Z rouault $
  *
  * Project:  OpenGIS Simple Features Reference Implementation
  * Purpose:  Implements OGRVRTLayer class.
@@ -34,7 +34,7 @@
 #include "ogrpgeogeometry.h"
 #include <string>
 
-CPL_CVSID("$Id: ogrvrtlayer.cpp 28950 2015-04-18 23:24:49Z rouault $");
+CPL_CVSID("$Id: ogrvrtlayer.cpp 29330 2015-06-14 12:11:11Z rouault $");
 
 #define UNSUPPORTED_OP_READ_ONLY "%s : unsupported operation on a read-only datasource."
 
@@ -409,7 +409,7 @@ int OGRVRTLayer::ParseGeometryField(CPLXMLNode* psNode,
         CSLTestBoolean(CPLGetXMLValue( psNode, "reportSrcColumn", "YES" ));
 
 /* -------------------------------------------------------------------- */
-/*      Guess geometry type if not explicitely provided (or computed)   */
+/*      Guess geometry type if not explicitly provided (or computed)   */
 /* -------------------------------------------------------------------- */
     if( pszGType == NULL && poProps->eGeomType == wkbUnknown )
     {
@@ -2322,7 +2322,7 @@ OGRErr OGRVRTLayer::SetIgnoredFields( const char **papszFields )
     char** papszFieldsSrc = NULL;
     OGRFeatureDefn* poSrcFeatureDefn = poSrcLayer->GetLayerDefn();
 
-    /* Translate explicitely ignored fields of VRT layers to their equivalent */
+    /* Translate explicitly ignored fields of VRT layers to their equivalent */
     /* source fields. */
     while ( papszIter != NULL && *papszIter != NULL )
     {
diff --git a/port/cpl_csv.cpp b/port/cpl_csv.cpp
index 5f11873..29ee2cf 100644
--- a/port/cpl_csv.cpp
+++ b/port/cpl_csv.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: cpl_csv.cpp 29238 2015-05-24 08:42:03Z rouault $
+ * $Id: cpl_csv.cpp 29330 2015-06-14 12:11:11Z rouault $
  *
  * Project:  CPL - Common Portability Library
  * Purpose:  CSV (comma separated value) file access.
@@ -33,7 +33,7 @@
 #include "cpl_multiproc.h"
 #include "gdal_csv.h"
 
-CPL_CVSID("$Id: cpl_csv.cpp 29238 2015-05-24 08:42:03Z rouault $");
+CPL_CVSID("$Id: cpl_csv.cpp 29330 2015-06-14 12:11:11Z rouault $");
 
 /* ==================================================================== */
 /*      The CSVTable is a persistant set of info about an open CSV      */
@@ -464,7 +464,7 @@ char CSVDetectSeperator (const char* pszLine)
                 chDelimiter = *pszLine;
             else if (chDelimiter != *pszLine)
             {
-                /* The separator is not consistant on the line. */
+                /* The separator is not consistent on the line. */
                 CPLDebug("CSV", "Inconsistent separator. '%c' and '%c' found. Using ',' as default",
                          chDelimiter, *pszLine);
                 chDelimiter = ',';
diff --git a/port/cpl_error.cpp b/port/cpl_error.cpp
index c55be0b..32dc396 100644
--- a/port/cpl_error.cpp
+++ b/port/cpl_error.cpp
@@ -1,5 +1,5 @@
 /**********************************************************************
- * $Id: cpl_error.cpp 28831 2015-04-01 16:46:05Z rouault $
+ * $Id: cpl_error.cpp 29330 2015-06-14 12:11:11Z rouault $
  *
  * Name:     cpl_error.cpp
  * Project:  CPL - Common Portability Library
@@ -43,7 +43,7 @@
 #define TIMESTAMP_DEBUG
 //#define MEMORY_DEBUG
 
-CPL_CVSID("$Id: cpl_error.cpp 28831 2015-04-01 16:46:05Z rouault $");
+CPL_CVSID("$Id: cpl_error.cpp 29330 2015-06-14 12:11:11Z rouault $");
 
 static CPLMutex *hErrorMutex = NULL;
 static void *pErrorHandlerUserData = NULL; 
@@ -537,7 +537,7 @@ void CPL_STDCALL CPLErrorReset()
 /**
  * Restore an error state, without emitting an error.
  *
- * Can be usefull if a routine might call CPLErrorReset() and one wants to
+ * Can be useful if a routine might call CPLErrorReset() and one wants to
  * preserve the previous error state.
  *
  * @since GDAL 2.0
diff --git a/port/cpl_multiproc.cpp b/port/cpl_multiproc.cpp
index 8f3169b..87c8149 100644
--- a/port/cpl_multiproc.cpp
+++ b/port/cpl_multiproc.cpp
@@ -1,5 +1,5 @@
 /**********************************************************************
- * $Id: cpl_multiproc.cpp 29269 2015-06-01 13:23:14Z rouault $
+ * $Id: cpl_multiproc.cpp 29304 2015-06-05 16:44:41Z rouault $
  *
  * Project:  CPL - Common Portability Library
  * Purpose:  CPL Multi-Threading, and process handling portability functions.
@@ -42,7 +42,7 @@
 #  include <wce_time.h>
 #endif
 
-CPL_CVSID("$Id: cpl_multiproc.cpp 29269 2015-06-01 13:23:14Z rouault $");
+CPL_CVSID("$Id: cpl_multiproc.cpp 29304 2015-06-05 16:44:41Z rouault $");
 
 #if defined(CPL_MULTIPROC_STUB) && !defined(DEBUG)
 #  define MUTEX_NONE
@@ -789,12 +789,22 @@ int CPLAcquireMutex( CPLMutex *hMutexIn, double dfWaitInSeconds )
     CRITICAL_SECTION *pcs = (CRITICAL_SECTION *)hMutexIn;
     BOOL ret;
 
-    while( (ret = TryEnterCriticalSection(pcs)) == 0 && dfWaitInSeconds > 0.0 )
+    if( dfWaitInSeconds >= 1000.0 )
     {
-        CPLSleep( MIN(dfWaitInSeconds,0.125) );
-        dfWaitInSeconds -= 0.125;
+        // We assume this is the synonymous for infinite, so it is more
+        // efficient to use EnterCriticalSection() directly
+        EnterCriticalSection(pcs);
+        ret = TRUE;
     }
-    
+    else
+    {
+        while( (ret = TryEnterCriticalSection(pcs)) == 0 && dfWaitInSeconds > 0.0 )
+        {
+            CPLSleep( MIN(dfWaitInSeconds,0.01) );
+            dfWaitInSeconds -= 0.01;
+        }
+    }
+
     return ret;
 #endif
 }
diff --git a/port/cpl_virtualmem.cpp b/port/cpl_virtualmem.cpp
index 529962a..3af2010 100644
--- a/port/cpl_virtualmem.cpp
+++ b/port/cpl_virtualmem.cpp
@@ -1,5 +1,5 @@
 /**********************************************************************
- * $Id: cpl_virtualmem.cpp 28459 2015-02-12 13:48:21Z rouault $
+ * $Id: cpl_virtualmem.cpp 29330 2015-06-14 12:11:11Z rouault $
  *
  * Name:     cpl_virtualmem.cpp
  * Project:  CPL - Common Portability Library
@@ -626,7 +626,7 @@ static void CPLVirtualMemSIGUSR1Handler(int signum_unused,
     /* I guess this is only POSIX correct if it is implemented by an intrinsic */
     CPLAtomicInc(&nCountThreadsInSigUSR1);
     while( nWaitHelperThread )
-        usleep(1); /* not explicitely indicated as signal-async-safe, but hopefully ok */
+        usleep(1); /* not explicitly indicated as signal-async-safe, but hopefully ok */
     CPLAtomicDec(&nCountThreadsInSigUSR1);
     /* fprintfstderr("leaving CPLVirtualMemSIGUSR1Handler %X\n", pthread_self()); */
 }
diff --git a/port/cpl_virtualmem.h b/port/cpl_virtualmem.h
index 830f066..2d6ed45 100644
--- a/port/cpl_virtualmem.h
+++ b/port/cpl_virtualmem.h
@@ -1,5 +1,5 @@
 /**********************************************************************
- * $Id: cpl_virtualmem.h 28543 2015-02-23 21:01:19Z rouault $
+ * $Id: cpl_virtualmem.h 29330 2015-06-14 12:11:11Z rouault $
  *
  * Name:     cpl_virtualmem.h
  * Project:  CPL - Common Portability Library
@@ -198,7 +198,7 @@ int CPL_DLL CPLIsVirtualMemFileMapAvailable(void);
  * @param  nOffset  Offset in the file to start the mapping from.
  * @param  nLength  Length of the portion of the file to map into memory.
  * @param eAccessMode Permission to use for the virtual memory mapping. This must
- *                    be consistant with how the file has been opened.
+ *                    be consistent with how the file has been opened.
  * @param pfnFreeUserData callback that is called when the object is destroyed.
  * @param pCbkUserData user data passed to pfnFreeUserData.
  * @return a virtual memory object that must be freed by CPLVirtualMemFree(),
diff --git a/swig/include/gdal_array.i b/swig/include/gdal_array.i
index 5e87595..2c67f92 100644
--- a/swig/include/gdal_array.i
+++ b/swig/include/gdal_array.i
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: gdal_array.i 28497 2015-02-16 11:31:14Z rouault $
+ * $Id: gdal_array.i 29330 2015-06-14 12:11:11Z rouault $
  *
  * Name:     gdal_array.i
  * Project:  GDAL Python Interface
@@ -1076,9 +1076,9 @@ def DatasetReadAsArray( ds, xoff=0, yoff=0, win_xsize=None, win_ysize=None, buf_
         shape_buf_xsize = buf_obj.shape[2]
         shape_buf_ysize = buf_obj.shape[1]
         if buf_xsize is not None and buf_xsize != shape_buf_xsize:
-            raise ValueError('Specified buf_xsize not consistant with array shape')
+            raise ValueError('Specified buf_xsize not consistent with array shape')
         if buf_ysize is not None and buf_ysize != shape_buf_ysize:
-            raise ValueError('Specified buf_ysize not consistant with array shape')
+            raise ValueError('Specified buf_ysize not consistent with array shape')
         if buf_obj.shape[0] != ds.RasterCount:
             raise ValueError('Array should have space for %d bands' % ds.RasterCount)
 
@@ -1086,7 +1086,7 @@ def DatasetReadAsArray( ds, xoff=0, yoff=0, win_xsize=None, win_ysize=None, buf_
         if not datatype:
             raise ValueError("array does not have corresponding GDAL data type")
         if buf_type is not None and buf_type != datatype:
-            raise ValueError("Specified buf_type not consistant with array type")
+            raise ValueError("Specified buf_type not consistent with array type")
         buf_type = datatype
 
     if DatasetIONumPy( ds, 0, xoff, yoff, win_xsize, win_ysize,
@@ -1134,15 +1134,15 @@ def BandReadAsArray( band, xoff = 0, yoff = 0, win_xsize = None, win_ysize = Non
             shape_buf_xsize = buf_obj.shape[2]
             shape_buf_ysize = buf_obj.shape[1]
         if buf_xsize is not None and buf_xsize != shape_buf_xsize:
-            raise ValueError('Specified buf_xsize not consistant with array shape')
+            raise ValueError('Specified buf_xsize not consistent with array shape')
         if buf_ysize is not None and buf_ysize != shape_buf_ysize:
-            raise ValueError('Specified buf_ysize not consistant with array shape')
+            raise ValueError('Specified buf_ysize not consistent with array shape')
 
         datatype = NumericTypeCodeToGDALTypeCode( buf_obj.dtype.type )
         if not datatype:
             raise ValueError("array does not have corresponding GDAL data type")
         if buf_type is not None and buf_type != datatype:
-            raise ValueError("Specified buf_type not consistant with array type")
+            raise ValueError("Specified buf_type not consistent with array type")
         buf_type = datatype
 
     if BandRasterIONumPy( band, 0, xoff, yoff, win_xsize, win_ysize,
diff --git a/swig/java/GNUmakefile b/swig/java/GNUmakefile
index 725f1f2..2a500cc 100644
--- a/swig/java/GNUmakefile
+++ b/swig/java/GNUmakefile
@@ -38,11 +38,11 @@ JAVA_OBJECTS = gdalconst_wrap.$(OBJ_EXT) gdal_wrap.$(OBJ_EXT) osr_wrap.$(OBJ_EXT
 
 clean:
 	-rm -f ${JAVA_MODULES}
-	-rm *.$(OBJ_EXT)
-	-rm .libs/*.so
-	-rm .libs/*.dylib
-	-rm *.so
-	-rm *.dylib
+	-rm -f *.$(OBJ_EXT)
+	-rm -f .libs/*.so
+	-rm -f .libs/*.dylib
+	-rm -f *.so
+	-rm -f *.dylib
 
 	ant clean
 
diff --git a/swig/php/gdal_wrap.cpp b/swig/php/gdal_wrap.cpp
index f7fd3c9..fcd9997 100644
--- a/swig/php/gdal_wrap.cpp
+++ b/swig/php/gdal_wrap.cpp
@@ -259,7 +259,7 @@ template <typename T> T SwigValueInit() {
    SWIG errors code.
 
    Finally, if the SWIG_CASTRANK_MODE is enabled, the result code
-   allows to return the 'cast rank', for example, if you have this
+   allows returning the 'cast rank', for example, if you have this
 
        int food(double)
        int fooi(int);
diff --git a/swig/php/gdalconst_wrap.c b/swig/php/gdalconst_wrap.c
index 39d4d3b..f106bfd 100644
--- a/swig/php/gdalconst_wrap.c
+++ b/swig/php/gdalconst_wrap.c
@@ -235,7 +235,7 @@
    SWIG errors code.
 
    Finally, if the SWIG_CASTRANK_MODE is enabled, the result code
-   allows to return the 'cast rank', for example, if you have this
+   allows returning the 'cast rank', for example, if you have this
 
        int food(double)
        int fooi(int);
diff --git a/swig/php/ogr_wrap.cpp b/swig/php/ogr_wrap.cpp
index 6fadc30..e979f5d 100644
--- a/swig/php/ogr_wrap.cpp
+++ b/swig/php/ogr_wrap.cpp
@@ -259,7 +259,7 @@ template <typename T> T SwigValueInit() {
    SWIG errors code.
 
    Finally, if the SWIG_CASTRANK_MODE is enabled, the result code
-   allows to return the 'cast rank', for example, if you have this
+   allows returning the 'cast rank', for example, if you have this
 
        int food(double)
        int fooi(int);
diff --git a/swig/php/osr_wrap.cpp b/swig/php/osr_wrap.cpp
index 3e6b015..b0d2173 100644
--- a/swig/php/osr_wrap.cpp
+++ b/swig/php/osr_wrap.cpp
@@ -259,7 +259,7 @@ template <typename T> T SwigValueInit() {
    SWIG errors code.
 
    Finally, if the SWIG_CASTRANK_MODE is enabled, the result code
-   allows to return the 'cast rank', for example, if you have this
+   allows returning the 'cast rank', for example, if you have this
 
        int food(double)
        int fooi(int);
diff --git a/swig/python/extensions/gdal_array_wrap.cpp b/swig/python/extensions/gdal_array_wrap.cpp
index a0d3b30..bb657dd 100644
--- a/swig/python/extensions/gdal_array_wrap.cpp
+++ b/swig/python/extensions/gdal_array_wrap.cpp
@@ -264,7 +264,7 @@ template <typename T> T SwigValueInit() {
    SWIG errors code.
 
    Finally, if the SWIG_CASTRANK_MODE is enabled, the result code
-   allows to return the 'cast rank', for example, if you have this
+   allows returning the 'cast rank', for example, if you have this
 
        int food(double)
        int fooi(int);
diff --git a/swig/python/extensions/gdal_wrap.cpp b/swig/python/extensions/gdal_wrap.cpp
index c1aa90b..4e3a98c 100644
--- a/swig/python/extensions/gdal_wrap.cpp
+++ b/swig/python/extensions/gdal_wrap.cpp
@@ -264,7 +264,7 @@ template <typename T> T SwigValueInit() {
    SWIG errors code.
 
    Finally, if the SWIG_CASTRANK_MODE is enabled, the result code
-   allows to return the 'cast rank', for example, if you have this
+   allows returning the 'cast rank', for example, if you have this
 
        int food(double)
        int fooi(int);
diff --git a/swig/python/extensions/gdalconst_wrap.c b/swig/python/extensions/gdalconst_wrap.c
index 02bd730..38da680 100644
--- a/swig/python/extensions/gdalconst_wrap.c
+++ b/swig/python/extensions/gdalconst_wrap.c
@@ -240,7 +240,7 @@
    SWIG errors code.
 
    Finally, if the SWIG_CASTRANK_MODE is enabled, the result code
-   allows to return the 'cast rank', for example, if you have this
+   allows returning the 'cast rank', for example, if you have this
 
        int food(double)
        int fooi(int);
diff --git a/swig/python/extensions/ogr_wrap.cpp b/swig/python/extensions/ogr_wrap.cpp
index 7d5c5cf..8d9e465 100644
--- a/swig/python/extensions/ogr_wrap.cpp
+++ b/swig/python/extensions/ogr_wrap.cpp
@@ -264,7 +264,7 @@ template <typename T> T SwigValueInit() {
    SWIG errors code.
 
    Finally, if the SWIG_CASTRANK_MODE is enabled, the result code
-   allows to return the 'cast rank', for example, if you have this
+   allows returning the 'cast rank', for example, if you have this
 
        int food(double)
        int fooi(int);
diff --git a/swig/python/extensions/osr_wrap.cpp b/swig/python/extensions/osr_wrap.cpp
index a19501e..8fa3dd5 100644
--- a/swig/python/extensions/osr_wrap.cpp
+++ b/swig/python/extensions/osr_wrap.cpp
@@ -264,7 +264,7 @@ template <typename T> T SwigValueInit() {
    SWIG errors code.
 
    Finally, if the SWIG_CASTRANK_MODE is enabled, the result code
-   allows to return the 'cast rank', for example, if you have this
+   allows returning the 'cast rank', for example, if you have this
 
        int food(double)
        int fooi(int);
diff --git a/swig/python/osgeo/gdal_array.py b/swig/python/osgeo/gdal_array.py
index 93ccc3c..f09960c 100644
--- a/swig/python/osgeo/gdal_array.py
+++ b/swig/python/osgeo/gdal_array.py
@@ -274,9 +274,9 @@ def DatasetReadAsArray( ds, xoff=0, yoff=0, win_xsize=None, win_ysize=None, buf_
         shape_buf_xsize = buf_obj.shape[2]
         shape_buf_ysize = buf_obj.shape[1]
         if buf_xsize is not None and buf_xsize != shape_buf_xsize:
-            raise ValueError('Specified buf_xsize not consistant with array shape')
+            raise ValueError('Specified buf_xsize not consistent with array shape')
         if buf_ysize is not None and buf_ysize != shape_buf_ysize:
-            raise ValueError('Specified buf_ysize not consistant with array shape')
+            raise ValueError('Specified buf_ysize not consistent with array shape')
         if buf_obj.shape[0] != ds.RasterCount:
             raise ValueError('Array should have space for %d bands' % ds.RasterCount)
 
@@ -284,7 +284,7 @@ def DatasetReadAsArray( ds, xoff=0, yoff=0, win_xsize=None, win_ysize=None, buf_
         if not datatype:
             raise ValueError("array does not have corresponding GDAL data type")
         if buf_type is not None and buf_type != datatype:
-            raise ValueError("Specified buf_type not consistant with array type")
+            raise ValueError("Specified buf_type not consistent with array type")
         buf_type = datatype
 
     if DatasetIONumPy( ds, 0, xoff, yoff, win_xsize, win_ysize,
@@ -332,15 +332,15 @@ def BandReadAsArray( band, xoff = 0, yoff = 0, win_xsize = None, win_ysize = Non
             shape_buf_xsize = buf_obj.shape[2]
             shape_buf_ysize = buf_obj.shape[1]
         if buf_xsize is not None and buf_xsize != shape_buf_xsize:
-            raise ValueError('Specified buf_xsize not consistant with array shape')
+            raise ValueError('Specified buf_xsize not consistent with array shape')
         if buf_ysize is not None and buf_ysize != shape_buf_ysize:
-            raise ValueError('Specified buf_ysize not consistant with array shape')
+            raise ValueError('Specified buf_ysize not consistent with array shape')
 
         datatype = NumericTypeCodeToGDALTypeCode( buf_obj.dtype.type )
         if not datatype:
             raise ValueError("array does not have corresponding GDAL data type")
         if buf_type is not None and buf_type != datatype:
-            raise ValueError("Specified buf_type not consistant with array type")
+            raise ValueError("Specified buf_type not consistent with array type")
         buf_type = datatype
 
     if BandRasterIONumPy( band, 0, xoff, yoff, win_xsize, win_ysize,
diff --git a/swig/python/samples/validate_jp2.py b/swig/python/samples/validate_jp2.py
index 5f3ca4b..267a569 100644
--- a/swig/python/samples/validate_jp2.py
+++ b/swig/python/samples/validate_jp2.py
@@ -1,7 +1,7 @@
 #!/usr/bin/env python
 # -*- coding: utf-8 -*-
 #******************************************************************************
-#  $Id: validate_jp2.py 29042 2015-04-28 14:07:13Z rouault $
+#  $Id: validate_jp2.py 29330 2015-06-14 12:11:11Z rouault $
 # 
 #  Project:  GDAL
 #  Purpose:  Validate JPEG2000 file structure
@@ -291,7 +291,7 @@ def check_geojp2_gmljp2_consistency(filename, error_report):
             if abs(geojp2_gt[i] - gmljp2_gt[i] > 1e-8):
                 diff = True
         if diff:
-            error_report.EmitError('GENERAL', 'Inconsistant geotransform between GeoJP2 (%s) and GMLJP2 (%s)' % (str(geojp2_gt), str(gmljp2_gt)))
+            error_report.EmitError('GENERAL', 'Inconsistent geotransform between GeoJP2 (%s) and GMLJP2 (%s)' % (str(geojp2_gt), str(gmljp2_gt)))
 
     geojp2_sr = osr.SpatialReference()
     geojp2_sr.ImportFromWkt(geojp2_wkt)
@@ -303,7 +303,7 @@ def check_geojp2_gmljp2_consistency(filename, error_report):
         geojp2_proj4 = geojp2_sr.ExportToProj4()
         gmljp2_proj4 = gmljp2_sr.ExportToProj4()
         if geojp2_proj4 != gmljp2_proj4:
-            error_report.EmitError('GENERAL', 'Inconsistant SRS between GeoJP2 (wkt=%s, proj4=%s) and GMLJP2 (wkt=%s, proj4=%s)' % (geojp2_wkt, geojp2_proj4, gmljp2_wkt, gmljp2_proj4))
+            error_report.EmitError('GENERAL', 'Inconsistent SRS between GeoJP2 (wkt=%s, proj4=%s) and GMLJP2 (wkt=%s, proj4=%s)' % (geojp2_wkt, geojp2_proj4, gmljp2_wkt, gmljp2_proj4))
 
 
 # Check consistency of georeferencing of OrthoimageCoverage with the one embedded in the JPEG2000 file
@@ -363,7 +363,7 @@ def check_oi_rg_consistency(filename, serialized_oi_rg, error_report):
             if abs(oi_gt[i] - gt[i] > 1e-8):
                 diff = True
         if diff:
-            error_report.EmitError('INSPIRE_TG', 'Inconsistant geotransform between OrthoImagery (%s) and GMLJP2/GeoJP2 (%s)' % (str(oi_gt), str(gt)), conformance_class = 'A.8.8')
+            error_report.EmitError('INSPIRE_TG', 'Inconsistent geotransform between OrthoImagery (%s) and GMLJP2/GeoJP2 (%s)' % (str(oi_gt), str(gt)), conformance_class = 'A.8.8')
 
     sr = osr.SpatialReference()
     sr.ImportFromWkt(wkt)
@@ -375,7 +375,7 @@ def check_oi_rg_consistency(filename, serialized_oi_rg, error_report):
         proj4 = sr.ExportToProj4()
         oi_proj4 = oi_sr.ExportToProj4()
         if proj4 != oi_proj4:
-            error_report.EmitError('INSPIRE_TG', 'Inconsistant SRS between OrthoImagery (wkt=%s, proj4=%s) and GMLJP2/GeoJP2 (wkt=%s, proj4=%s)' % (wkt, proj4, oi_wkt, oi_proj4), conformance_class = 'A.8.8')
+            error_report.EmitError('INSPIRE_TG', 'Inconsistent SRS between OrthoImagery (wkt=%s, proj4=%s) and GMLJP2/GeoJP2 (wkt=%s, proj4=%s)' % (wkt, proj4, oi_wkt, oi_proj4), conformance_class = 'A.8.8')
 
 def validate(filename, oidoc, inspire_tg, expected_gmljp2, ogc_schemas_location, datatype = 'imagery', error_report = None):
 
@@ -450,7 +450,7 @@ def validate(filename, oidoc, inspire_tg, expected_gmljp2, ogc_schemas_location,
                 if h != '1':
                     error_report.EmitError('GeoJP2', 'GeoTIFF should have height of 1 pixel, not %s' % str(h))
 
-        # Check that information of GeoJP2 and GMLJP2 are consistant
+        # Check that information of GeoJP2 and GMLJP2 are consistent
         if geotiff_found and gmljp2_found:
             check_geojp2_gmljp2_consistency(filename, error_report)
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-grass/gdal.git



More information about the Pkg-grass-devel mailing list