[gdal] 02/07: Imported Upstream version 2.1.2~rc2+dfsg

Bas Couwenberg sebastic at debian.org
Thu Oct 20 12:05:35 UTC 2016


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

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

commit 262c7fb0ce081d05af23a6b27799dc8c07534207
Author: Bas Couwenberg <sebastic at xs4all.nl>
Date:   Thu Oct 20 09:49:26 2016 +0200

    Imported Upstream version 2.1.2~rc2+dfsg
---
 NEWS                                              |  9 ++++++++
 gcore/gdal_version.h                              |  2 +-
 gcore/gdalabstractbandblockcache.cpp              |  8 +++----
 gcore/gdaldataset.cpp                             | 26 ++++++++++++++++-------
 man/man1/gdal-config.1                            |  2 +-
 man/man1/gdal2tiles.1                             |  2 +-
 man/man1/gdal_calc.1                              |  2 +-
 man/man1/gdal_contour.1                           |  2 +-
 man/man1/gdal_edit.1                              |  2 +-
 man/man1/gdal_fillnodata.1                        |  2 +-
 man/man1/gdal_grid.1                              |  2 +-
 man/man1/gdal_merge.1                             |  2 +-
 man/man1/gdal_pansharpen.1                        |  2 +-
 man/man1/gdal_polygonize.1                        |  2 +-
 man/man1/gdal_proximity.1                         |  2 +-
 man/man1/gdal_rasterize.1                         |  2 +-
 man/man1/gdal_retile.1                            |  2 +-
 man/man1/gdal_sieve.1                             |  2 +-
 man/man1/gdal_translate.1                         |  2 +-
 man/man1/gdal_utilities.1                         |  2 +-
 man/man1/gdaladdo.1                               |  2 +-
 man/man1/gdalbuildvrt.1                           |  2 +-
 man/man1/gdalcompare.1                            |  2 +-
 man/man1/gdaldem.1                                |  2 +-
 man/man1/gdalinfo.1                               |  2 +-
 man/man1/gdallocationinfo.1                       |  2 +-
 man/man1/gdalmanage.1                             |  2 +-
 man/man1/gdalmove.1                               |  2 +-
 man/man1/gdalsrsinfo.1                            |  2 +-
 man/man1/gdaltindex.1                             |  2 +-
 man/man1/gdaltransform.1                          |  2 +-
 man/man1/gdalwarp.1                               |  2 +-
 man/man1/gnm_utilities.1                          |  2 +-
 man/man1/gnmanalyse.1                             |  2 +-
 man/man1/gnmmanage.1                              |  2 +-
 man/man1/nearblack.1                              |  2 +-
 man/man1/ogr2ogr.1                                |  2 +-
 man/man1/ogr_utilities.1                          |  2 +-
 man/man1/ogrinfo.1                                |  2 +-
 man/man1/ogrlineref.1                             |  2 +-
 man/man1/ogrtindex.1                              |  2 +-
 man/man1/pct2rgb.1                                |  2 +-
 man/man1/rgb2pct.1                                |  2 +-
 ogr/ogrsf_frmts/filegdb/FGdbLayer.cpp             | 10 +++++++--
 ogr/ogrsf_frmts/gpkg/ogrgeopackagetablelayer.cpp  |  6 ++++++
 ogr/ogrsf_frmts/ili/ogrili1layer.cpp              |  6 +++---
 ogr/ogrsf_frmts/mem/ogrmemlayer.cpp               |  9 +++++---
 ogr/ogrsf_frmts/pg/ogrpgtablelayer.cpp            | 12 +++++++++--
 ogr/ogrsf_frmts/plscenes/ogrplscenesdataset.cpp   | 16 ++++++++------
 ogr/ogrsf_frmts/plscenes/ogrplscenesv1dataset.cpp | 16 ++++++--------
 ogr/ogrsf_frmts/sqlite/ogrsqlitetablelayer.cpp    | 10 +++++++--
 port/cpl_vsi_mem.cpp                              | 26 ++++++++++++-----------
 port/cpl_vsil_curl.cpp                            | 19 +++++++++++------
 53 files changed, 155 insertions(+), 98 deletions(-)

diff --git a/NEWS b/NEWS
index c0b8bec..5f58206 100644
--- a/NEWS
+++ b/NEWS
@@ -8,6 +8,8 @@ The 2.1.2 release is a bug fix release.
   LoadLibraryW() (#6650)
 * /vsicurl/: take CPL_VSIL_CURL_ALLOWED_EXTENSIONS into account even if
   GDAL_DISABLE_READDIR_ON_OPEN is defined (#6681)
+* Fix regression in PLScenes V1 raster random access. Add a CPL_VSIL_CURL_ALLOWED_FILENAME config option to solve that (fixes #6691)
+* /vsimem/: fix potential crash when closing -different- handles pointing to the same file from different threads (fixes #6683)
 
 == GDAL algorithms ==
 
@@ -19,6 +21,7 @@ The 2.1.2 release is a bug fix release.
 * Fix potential deadlock in multithreaded writing scenarios (#6661)
 * Make multi-threaded reading/writing when using GetLockedBlock()/MarkDirty()/
   DropLock() lower level interfaces (#6665)
+* Fix multi-threading issues in read/write scenarios (fixes #6684)
 
 == Utilities ==
 * gdal_translate & gdalwarp: lower the default value of GDAL_MAX_DATASET_POOL_SIZE
@@ -92,6 +95,9 @@ VRT driver:
 
 == OGR drivers == 
 
+Multi driver fix:
+* GPKG/SQLite/PG/FileGDB/MEM: properly set/reset field subtype with AlterFieldDefn() (fixes #6689)
+
 Carto driver:
 * rebranded from CartoDB to Carto. "CartoDB" is still a valid alias to Carto
 
@@ -118,6 +124,9 @@ GML driver:
   following EPSG axis order. Add SWAP_COORDINATES=YES/NO/AUTO (and
   GML_SWAP_COORDINATES configuration option) to override all auto guessing (#6678)
 
+ILI1 driver:
+* fix crash in OGRILI1Layer::JoinSurfaceLayer() when the multicurve of the feature of the poSurfaceLineLayer layer is empty (fixes #6688)
+
 MSSQLSpatial driver:
 * Fix select layer to recognize geometry column with sqlncli (#6641)
 
diff --git a/gcore/gdal_version.h b/gcore/gdal_version.h
index f10ac50..ff5648f 100644
--- a/gcore/gdal_version.h
+++ b/gcore/gdal_version.h
@@ -22,7 +22,7 @@
 #endif
 
 #ifndef GDAL_RELEASE_DATE
-#  define GDAL_RELEASE_DATE     20161014
+#  define GDAL_RELEASE_DATE     20161020
 #endif
 #ifndef GDAL_RELEASE_NAME
 #  define GDAL_RELEASE_NAME     "2.1.2"
diff --git a/gcore/gdalabstractbandblockcache.cpp b/gcore/gdalabstractbandblockcache.cpp
index 79b23a0..b633203 100644
--- a/gcore/gdalabstractbandblockcache.cpp
+++ b/gcore/gdalabstractbandblockcache.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: gdalabstractbandblockcache.cpp 31703 2015-11-21 22:11:38Z rouault $
+ * $Id: gdalabstractbandblockcache.cpp 35731 2016-10-14 17:07:59Z rouault $
  *
  * Project:  GDAL Core
  * Purpose:  Store cached blocks
@@ -31,7 +31,7 @@
 #include "cpl_multiproc.h"
 #include <new>
 
-CPL_CVSID("$Id: gdalabstractbandblockcache.cpp 31703 2015-11-21 22:11:38Z rouault $");
+CPL_CVSID("$Id: gdalabstractbandblockcache.cpp 35731 2016-10-14 17:07:59Z rouault $");
 
 #ifdef DEBUG_VERBOSE_ABBC
 static int nAllBandsKeptAlivedBlocks = 0;
@@ -108,12 +108,12 @@ void GDALAbstractBandBlockCache::AddBlockToFreeList( GDALRasterBlock *poBlock )
     }
 
     // If no more blocks in transient state, then warn WaitKeepAliveCounter()
+    CPLAcquireMutex(hCondMutex, 1000);
     if( CPLAtomicDec(&nKeepAliveCounter) == 0 )
     {
-        CPLAcquireMutex(hCondMutex, 1000);
         CPLCondSignal(hCond);
-        CPLReleaseMutex(hCondMutex);
     }
+    CPLReleaseMutex(hCondMutex);
 }
 
 /************************************************************************/
diff --git a/gcore/gdaldataset.cpp b/gcore/gdaldataset.cpp
index a71cb37..91b04dd 100644
--- a/gcore/gdaldataset.cpp
+++ b/gcore/gdaldataset.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: gdaldataset.cpp 35553 2016-09-29 23:19:16Z rouault $
+ * $Id: gdaldataset.cpp 35731 2016-10-14 17:07:59Z rouault $
  *
  * Project:  GDAL Core
  * Purpose:  Base class for raster file formats.
@@ -48,7 +48,7 @@
 #include <map>
 #include <new>
 
-CPL_CVSID("$Id: gdaldataset.cpp 35553 2016-09-29 23:19:16Z rouault $");
+CPL_CVSID("$Id: gdaldataset.cpp 35731 2016-10-14 17:07:59Z rouault $");
 
 CPL_C_START
 GDALAsyncReader *
@@ -75,6 +75,9 @@ class GDALDatasetPrivate
     public:
         CPLMutex* hMutex;
         std::map<GIntBig, int> oMapThreadToMutexTakenCount;
+#ifdef DEBUG_EXTRA
+        std::map<GIntBig, int> oMapThreadToMutexTakenCountSaved;
+#endif
         GDALAllowReadWriteMutexState eStateReadWriteMutex;
 
         GDALDatasetPrivate() :
@@ -6105,10 +6108,7 @@ int GDALDataset::EnterReadWrite(GDALRWFlag eRWFlag)
             CPLDebug("GDAL", "[Thread " CPL_FRMT_GIB "] Acquiring RW mutex for %s",
                      CPLGetPID(), GetDescription());
 #endif
-            if( psPrivate->hMutex == NULL )
-                psPrivate->hMutex = CPLCreateMutex();
-            else
-                CPLAcquireMutex(psPrivate->hMutex, 1000.0);
+            CPLCreateOrAcquireMutex( &(psPrivate->hMutex), 1000.0 );
             psPrivate->oMapThreadToMutexTakenCount[ CPLGetPID() ] ++; /* not sure if we can have recursive calls, so ...*/
             return TRUE;
         }
@@ -6182,8 +6182,12 @@ void GDALDataset::TemporarilyDropReadWriteLock()
                  "Temporarily drop RW mutex for %s",
                  CPLGetPID(), GetDescription());
 #endif
+        CPLAcquireMutex(psPrivate->hMutex, 1000.0);
         const int nCount = psPrivate->oMapThreadToMutexTakenCount[ CPLGetPID() ];
-        for(int i=0;i<nCount;i++)
+#ifdef DEBUG_EXTRA
+        psPrivate->oMapThreadToMutexTakenCountSaved[ CPLGetPID() ] = nCount;
+#endif
+        for(int i=0;i<nCount + 1;i++)
         {
             CPLReleaseMutex(psPrivate->hMutex);
         }
@@ -6204,8 +6208,14 @@ void GDALDataset::ReacquireReadWriteLock()
                  "Reacquire temporarily dropped RW mutex for %s",
                  CPLGetPID(), GetDescription());
 #endif
+        CPLAcquireMutex(psPrivate->hMutex, 1000.0);
         const int nCount = psPrivate->oMapThreadToMutexTakenCount[ CPLGetPID() ];
-        for(int i=0;i<nCount;i++)
+#ifdef DEBUG_EXTRA
+        CPLAssert( nCount == psPrivate->oMapThreadToMutexTakenCountSaved[ CPLGetPID() ] );
+#endif
+        if( nCount == 0 )
+            CPLReleaseMutex(psPrivate->hMutex);
+        for(int i=0;i<nCount - 1;i++)
         {
             CPLAcquireMutex(psPrivate->hMutex, 1000.0);
         }
diff --git a/man/man1/gdal-config.1 b/man/man1/gdal-config.1
index 93d5d77..ca84e5f 100644
--- a/man/man1/gdal-config.1
+++ b/man/man1/gdal-config.1
@@ -1,4 +1,4 @@
-.TH "gdal-config" 1 "Fri Oct 14 2016" "GDAL" \" -*- nroff -*-
+.TH "gdal-config" 1 "Wed Oct 19 2016" "GDAL" \" -*- nroff -*-
 .ad l
 .nh
 .SH NAME
diff --git a/man/man1/gdal2tiles.1 b/man/man1/gdal2tiles.1
index 84dc1f1..7a580f3 100644
--- a/man/man1/gdal2tiles.1
+++ b/man/man1/gdal2tiles.1
@@ -1,4 +1,4 @@
-.TH "gdal2tiles" 1 "Fri Oct 14 2016" "GDAL" \" -*- nroff -*-
+.TH "gdal2tiles" 1 "Wed Oct 19 2016" "GDAL" \" -*- nroff -*-
 .ad l
 .nh
 .SH NAME
diff --git a/man/man1/gdal_calc.1 b/man/man1/gdal_calc.1
index 0e293d5..1bd4dc3 100644
--- a/man/man1/gdal_calc.1
+++ b/man/man1/gdal_calc.1
@@ -1,4 +1,4 @@
-.TH "gdal_calc" 1 "Fri Oct 14 2016" "GDAL" \" -*- nroff -*-
+.TH "gdal_calc" 1 "Wed Oct 19 2016" "GDAL" \" -*- nroff -*-
 .ad l
 .nh
 .SH NAME
diff --git a/man/man1/gdal_contour.1 b/man/man1/gdal_contour.1
index fd981ff..f5d457c 100644
--- a/man/man1/gdal_contour.1
+++ b/man/man1/gdal_contour.1
@@ -1,4 +1,4 @@
-.TH "gdal_contour" 1 "Fri Oct 14 2016" "GDAL" \" -*- nroff -*-
+.TH "gdal_contour" 1 "Wed Oct 19 2016" "GDAL" \" -*- nroff -*-
 .ad l
 .nh
 .SH NAME
diff --git a/man/man1/gdal_edit.1 b/man/man1/gdal_edit.1
index 971ad13..c4cb016 100644
--- a/man/man1/gdal_edit.1
+++ b/man/man1/gdal_edit.1
@@ -1,4 +1,4 @@
-.TH "gdal_edit" 1 "Fri Oct 14 2016" "GDAL" \" -*- nroff -*-
+.TH "gdal_edit" 1 "Wed Oct 19 2016" "GDAL" \" -*- nroff -*-
 .ad l
 .nh
 .SH NAME
diff --git a/man/man1/gdal_fillnodata.1 b/man/man1/gdal_fillnodata.1
index f56e96f..b06ae01 100644
--- a/man/man1/gdal_fillnodata.1
+++ b/man/man1/gdal_fillnodata.1
@@ -1,4 +1,4 @@
-.TH "gdal_fillnodata" 1 "Fri Oct 14 2016" "GDAL" \" -*- nroff -*-
+.TH "gdal_fillnodata" 1 "Wed Oct 19 2016" "GDAL" \" -*- nroff -*-
 .ad l
 .nh
 .SH NAME
diff --git a/man/man1/gdal_grid.1 b/man/man1/gdal_grid.1
index 93d834e..dcbd326 100644
--- a/man/man1/gdal_grid.1
+++ b/man/man1/gdal_grid.1
@@ -1,4 +1,4 @@
-.TH "gdal_grid" 1 "Fri Oct 14 2016" "GDAL" \" -*- nroff -*-
+.TH "gdal_grid" 1 "Wed Oct 19 2016" "GDAL" \" -*- nroff -*-
 .ad l
 .nh
 .SH NAME
diff --git a/man/man1/gdal_merge.1 b/man/man1/gdal_merge.1
index 0db2355..f797f2f 100644
--- a/man/man1/gdal_merge.1
+++ b/man/man1/gdal_merge.1
@@ -1,4 +1,4 @@
-.TH "gdal_merge" 1 "Fri Oct 14 2016" "GDAL" \" -*- nroff -*-
+.TH "gdal_merge" 1 "Wed Oct 19 2016" "GDAL" \" -*- nroff -*-
 .ad l
 .nh
 .SH NAME
diff --git a/man/man1/gdal_pansharpen.1 b/man/man1/gdal_pansharpen.1
index db5b919..bab83a7 100644
--- a/man/man1/gdal_pansharpen.1
+++ b/man/man1/gdal_pansharpen.1
@@ -1,4 +1,4 @@
-.TH "gdal_pansharpen" 1 "Fri Oct 14 2016" "GDAL" \" -*- nroff -*-
+.TH "gdal_pansharpen" 1 "Wed Oct 19 2016" "GDAL" \" -*- nroff -*-
 .ad l
 .nh
 .SH NAME
diff --git a/man/man1/gdal_polygonize.1 b/man/man1/gdal_polygonize.1
index ffc8ed5..64c79d0 100644
--- a/man/man1/gdal_polygonize.1
+++ b/man/man1/gdal_polygonize.1
@@ -1,4 +1,4 @@
-.TH "gdal_polygonize" 1 "Fri Oct 14 2016" "GDAL" \" -*- nroff -*-
+.TH "gdal_polygonize" 1 "Wed Oct 19 2016" "GDAL" \" -*- nroff -*-
 .ad l
 .nh
 .SH NAME
diff --git a/man/man1/gdal_proximity.1 b/man/man1/gdal_proximity.1
index ffc72d0..71248bc 100644
--- a/man/man1/gdal_proximity.1
+++ b/man/man1/gdal_proximity.1
@@ -1,4 +1,4 @@
-.TH "gdal_proximity" 1 "Fri Oct 14 2016" "GDAL" \" -*- nroff -*-
+.TH "gdal_proximity" 1 "Wed Oct 19 2016" "GDAL" \" -*- nroff -*-
 .ad l
 .nh
 .SH NAME
diff --git a/man/man1/gdal_rasterize.1 b/man/man1/gdal_rasterize.1
index c8eee30..f45884c 100644
--- a/man/man1/gdal_rasterize.1
+++ b/man/man1/gdal_rasterize.1
@@ -1,4 +1,4 @@
-.TH "gdal_rasterize" 1 "Fri Oct 14 2016" "GDAL" \" -*- nroff -*-
+.TH "gdal_rasterize" 1 "Wed Oct 19 2016" "GDAL" \" -*- nroff -*-
 .ad l
 .nh
 .SH NAME
diff --git a/man/man1/gdal_retile.1 b/man/man1/gdal_retile.1
index 01a9250..360721a 100644
--- a/man/man1/gdal_retile.1
+++ b/man/man1/gdal_retile.1
@@ -1,4 +1,4 @@
-.TH "gdal_retile" 1 "Fri Oct 14 2016" "GDAL" \" -*- nroff -*-
+.TH "gdal_retile" 1 "Wed Oct 19 2016" "GDAL" \" -*- nroff -*-
 .ad l
 .nh
 .SH NAME
diff --git a/man/man1/gdal_sieve.1 b/man/man1/gdal_sieve.1
index 350350e..210bf2b 100644
--- a/man/man1/gdal_sieve.1
+++ b/man/man1/gdal_sieve.1
@@ -1,4 +1,4 @@
-.TH "gdal_sieve" 1 "Fri Oct 14 2016" "GDAL" \" -*- nroff -*-
+.TH "gdal_sieve" 1 "Wed Oct 19 2016" "GDAL" \" -*- nroff -*-
 .ad l
 .nh
 .SH NAME
diff --git a/man/man1/gdal_translate.1 b/man/man1/gdal_translate.1
index 68e182e..d82b937 100644
--- a/man/man1/gdal_translate.1
+++ b/man/man1/gdal_translate.1
@@ -1,4 +1,4 @@
-.TH "gdal_translate" 1 "Fri Oct 14 2016" "GDAL" \" -*- nroff -*-
+.TH "gdal_translate" 1 "Wed Oct 19 2016" "GDAL" \" -*- nroff -*-
 .ad l
 .nh
 .SH NAME
diff --git a/man/man1/gdal_utilities.1 b/man/man1/gdal_utilities.1
index ec316da..059ae10 100644
--- a/man/man1/gdal_utilities.1
+++ b/man/man1/gdal_utilities.1
@@ -1,4 +1,4 @@
-.TH "gdal_utilities" 1 "Fri Oct 14 2016" "GDAL" \" -*- nroff -*-
+.TH "gdal_utilities" 1 "Wed Oct 19 2016" "GDAL" \" -*- nroff -*-
 .ad l
 .nh
 .SH NAME
diff --git a/man/man1/gdaladdo.1 b/man/man1/gdaladdo.1
index 2fe4487..399f252 100644
--- a/man/man1/gdaladdo.1
+++ b/man/man1/gdaladdo.1
@@ -1,4 +1,4 @@
-.TH "gdaladdo" 1 "Fri Oct 14 2016" "GDAL" \" -*- nroff -*-
+.TH "gdaladdo" 1 "Wed Oct 19 2016" "GDAL" \" -*- nroff -*-
 .ad l
 .nh
 .SH NAME
diff --git a/man/man1/gdalbuildvrt.1 b/man/man1/gdalbuildvrt.1
index 4c0ded8..d07e8ee 100644
--- a/man/man1/gdalbuildvrt.1
+++ b/man/man1/gdalbuildvrt.1
@@ -1,4 +1,4 @@
-.TH "gdalbuildvrt" 1 "Fri Oct 14 2016" "GDAL" \" -*- nroff -*-
+.TH "gdalbuildvrt" 1 "Wed Oct 19 2016" "GDAL" \" -*- nroff -*-
 .ad l
 .nh
 .SH NAME
diff --git a/man/man1/gdalcompare.1 b/man/man1/gdalcompare.1
index 51e8fb4..38e1a6a 100644
--- a/man/man1/gdalcompare.1
+++ b/man/man1/gdalcompare.1
@@ -1,4 +1,4 @@
-.TH "gdalcompare" 1 "Fri Oct 14 2016" "GDAL" \" -*- nroff -*-
+.TH "gdalcompare" 1 "Wed Oct 19 2016" "GDAL" \" -*- nroff -*-
 .ad l
 .nh
 .SH NAME
diff --git a/man/man1/gdaldem.1 b/man/man1/gdaldem.1
index 613208b..99638ff 100644
--- a/man/man1/gdaldem.1
+++ b/man/man1/gdaldem.1
@@ -1,4 +1,4 @@
-.TH "gdaldem" 1 "Fri Oct 14 2016" "GDAL" \" -*- nroff -*-
+.TH "gdaldem" 1 "Wed Oct 19 2016" "GDAL" \" -*- nroff -*-
 .ad l
 .nh
 .SH NAME
diff --git a/man/man1/gdalinfo.1 b/man/man1/gdalinfo.1
index 26c555f..e75438f 100644
--- a/man/man1/gdalinfo.1
+++ b/man/man1/gdalinfo.1
@@ -1,4 +1,4 @@
-.TH "gdalinfo" 1 "Fri Oct 14 2016" "GDAL" \" -*- nroff -*-
+.TH "gdalinfo" 1 "Wed Oct 19 2016" "GDAL" \" -*- nroff -*-
 .ad l
 .nh
 .SH NAME
diff --git a/man/man1/gdallocationinfo.1 b/man/man1/gdallocationinfo.1
index 63d9bee..33b4783 100644
--- a/man/man1/gdallocationinfo.1
+++ b/man/man1/gdallocationinfo.1
@@ -1,4 +1,4 @@
-.TH "gdallocationinfo" 1 "Fri Oct 14 2016" "GDAL" \" -*- nroff -*-
+.TH "gdallocationinfo" 1 "Wed Oct 19 2016" "GDAL" \" -*- nroff -*-
 .ad l
 .nh
 .SH NAME
diff --git a/man/man1/gdalmanage.1 b/man/man1/gdalmanage.1
index 18441bf..1ba376d 100644
--- a/man/man1/gdalmanage.1
+++ b/man/man1/gdalmanage.1
@@ -1,4 +1,4 @@
-.TH "gdalmanage" 1 "Fri Oct 14 2016" "GDAL" \" -*- nroff -*-
+.TH "gdalmanage" 1 "Wed Oct 19 2016" "GDAL" \" -*- nroff -*-
 .ad l
 .nh
 .SH NAME
diff --git a/man/man1/gdalmove.1 b/man/man1/gdalmove.1
index 1bc40a0..662d764 100644
--- a/man/man1/gdalmove.1
+++ b/man/man1/gdalmove.1
@@ -1,4 +1,4 @@
-.TH "gdalmove" 1 "Fri Oct 14 2016" "GDAL" \" -*- nroff -*-
+.TH "gdalmove" 1 "Wed Oct 19 2016" "GDAL" \" -*- nroff -*-
 .ad l
 .nh
 .SH NAME
diff --git a/man/man1/gdalsrsinfo.1 b/man/man1/gdalsrsinfo.1
index 95ba6fc..daa3dbb 100644
--- a/man/man1/gdalsrsinfo.1
+++ b/man/man1/gdalsrsinfo.1
@@ -1,4 +1,4 @@
-.TH "gdalsrsinfo" 1 "Fri Oct 14 2016" "GDAL" \" -*- nroff -*-
+.TH "gdalsrsinfo" 1 "Wed Oct 19 2016" "GDAL" \" -*- nroff -*-
 .ad l
 .nh
 .SH NAME
diff --git a/man/man1/gdaltindex.1 b/man/man1/gdaltindex.1
index 7660a95..16875a2 100644
--- a/man/man1/gdaltindex.1
+++ b/man/man1/gdaltindex.1
@@ -1,4 +1,4 @@
-.TH "gdaltindex" 1 "Fri Oct 14 2016" "GDAL" \" -*- nroff -*-
+.TH "gdaltindex" 1 "Wed Oct 19 2016" "GDAL" \" -*- nroff -*-
 .ad l
 .nh
 .SH NAME
diff --git a/man/man1/gdaltransform.1 b/man/man1/gdaltransform.1
index 486f2e8..4270625 100644
--- a/man/man1/gdaltransform.1
+++ b/man/man1/gdaltransform.1
@@ -1,4 +1,4 @@
-.TH "gdaltransform" 1 "Fri Oct 14 2016" "GDAL" \" -*- nroff -*-
+.TH "gdaltransform" 1 "Wed Oct 19 2016" "GDAL" \" -*- nroff -*-
 .ad l
 .nh
 .SH NAME
diff --git a/man/man1/gdalwarp.1 b/man/man1/gdalwarp.1
index cc291b6..3044a4b 100644
--- a/man/man1/gdalwarp.1
+++ b/man/man1/gdalwarp.1
@@ -1,4 +1,4 @@
-.TH "gdalwarp" 1 "Fri Oct 14 2016" "GDAL" \" -*- nroff -*-
+.TH "gdalwarp" 1 "Wed Oct 19 2016" "GDAL" \" -*- nroff -*-
 .ad l
 .nh
 .SH NAME
diff --git a/man/man1/gnm_utilities.1 b/man/man1/gnm_utilities.1
index f4a4924..3c2b18e 100644
--- a/man/man1/gnm_utilities.1
+++ b/man/man1/gnm_utilities.1
@@ -1,4 +1,4 @@
-.TH "gnm_utilities" 1 "Fri Oct 14 2016" "GDAL" \" -*- nroff -*-
+.TH "gnm_utilities" 1 "Wed Oct 19 2016" "GDAL" \" -*- nroff -*-
 .ad l
 .nh
 .SH NAME
diff --git a/man/man1/gnmanalyse.1 b/man/man1/gnmanalyse.1
index c6875f2..6eb8d11 100644
--- a/man/man1/gnmanalyse.1
+++ b/man/man1/gnmanalyse.1
@@ -1,4 +1,4 @@
-.TH "gnmanalyse" 1 "Fri Oct 14 2016" "GDAL" \" -*- nroff -*-
+.TH "gnmanalyse" 1 "Wed Oct 19 2016" "GDAL" \" -*- nroff -*-
 .ad l
 .nh
 .SH NAME
diff --git a/man/man1/gnmmanage.1 b/man/man1/gnmmanage.1
index 19eedbf..45f90c0 100644
--- a/man/man1/gnmmanage.1
+++ b/man/man1/gnmmanage.1
@@ -1,4 +1,4 @@
-.TH "gnmmanage" 1 "Fri Oct 14 2016" "GDAL" \" -*- nroff -*-
+.TH "gnmmanage" 1 "Wed Oct 19 2016" "GDAL" \" -*- nroff -*-
 .ad l
 .nh
 .SH NAME
diff --git a/man/man1/nearblack.1 b/man/man1/nearblack.1
index 9517677..c69a7db 100644
--- a/man/man1/nearblack.1
+++ b/man/man1/nearblack.1
@@ -1,4 +1,4 @@
-.TH "nearblack" 1 "Fri Oct 14 2016" "GDAL" \" -*- nroff -*-
+.TH "nearblack" 1 "Wed Oct 19 2016" "GDAL" \" -*- nroff -*-
 .ad l
 .nh
 .SH NAME
diff --git a/man/man1/ogr2ogr.1 b/man/man1/ogr2ogr.1
index 952b2b0..dbf7fc8 100644
--- a/man/man1/ogr2ogr.1
+++ b/man/man1/ogr2ogr.1
@@ -1,4 +1,4 @@
-.TH "ogr2ogr" 1 "Fri Oct 14 2016" "GDAL" \" -*- nroff -*-
+.TH "ogr2ogr" 1 "Wed Oct 19 2016" "GDAL" \" -*- nroff -*-
 .ad l
 .nh
 .SH NAME
diff --git a/man/man1/ogr_utilities.1 b/man/man1/ogr_utilities.1
index b5451c7..bce54a8 100644
--- a/man/man1/ogr_utilities.1
+++ b/man/man1/ogr_utilities.1
@@ -1,4 +1,4 @@
-.TH "ogr_utilities" 1 "Fri Oct 14 2016" "GDAL" \" -*- nroff -*-
+.TH "ogr_utilities" 1 "Wed Oct 19 2016" "GDAL" \" -*- nroff -*-
 .ad l
 .nh
 .SH NAME
diff --git a/man/man1/ogrinfo.1 b/man/man1/ogrinfo.1
index b652fe1..7cec09e 100644
--- a/man/man1/ogrinfo.1
+++ b/man/man1/ogrinfo.1
@@ -1,4 +1,4 @@
-.TH "ogrinfo" 1 "Fri Oct 14 2016" "GDAL" \" -*- nroff -*-
+.TH "ogrinfo" 1 "Wed Oct 19 2016" "GDAL" \" -*- nroff -*-
 .ad l
 .nh
 .SH NAME
diff --git a/man/man1/ogrlineref.1 b/man/man1/ogrlineref.1
index c3a79a5..27e03e7 100644
--- a/man/man1/ogrlineref.1
+++ b/man/man1/ogrlineref.1
@@ -1,4 +1,4 @@
-.TH "ogrlineref" 1 "Fri Oct 14 2016" "GDAL" \" -*- nroff -*-
+.TH "ogrlineref" 1 "Wed Oct 19 2016" "GDAL" \" -*- nroff -*-
 .ad l
 .nh
 .SH NAME
diff --git a/man/man1/ogrtindex.1 b/man/man1/ogrtindex.1
index bc8bd80..bd9a5fd 100644
--- a/man/man1/ogrtindex.1
+++ b/man/man1/ogrtindex.1
@@ -1,4 +1,4 @@
-.TH "ogrtindex" 1 "Fri Oct 14 2016" "GDAL" \" -*- nroff -*-
+.TH "ogrtindex" 1 "Wed Oct 19 2016" "GDAL" \" -*- nroff -*-
 .ad l
 .nh
 .SH NAME
diff --git a/man/man1/pct2rgb.1 b/man/man1/pct2rgb.1
index 0793f2f..1a7d8ee 100644
--- a/man/man1/pct2rgb.1
+++ b/man/man1/pct2rgb.1
@@ -1,4 +1,4 @@
-.TH "pct2rgb" 1 "Fri Oct 14 2016" "GDAL" \" -*- nroff -*-
+.TH "pct2rgb" 1 "Wed Oct 19 2016" "GDAL" \" -*- nroff -*-
 .ad l
 .nh
 .SH NAME
diff --git a/man/man1/rgb2pct.1 b/man/man1/rgb2pct.1
index e46bffa..0eae71c 100644
--- a/man/man1/rgb2pct.1
+++ b/man/man1/rgb2pct.1
@@ -1,4 +1,4 @@
-.TH "rgb2pct" 1 "Fri Oct 14 2016" "GDAL" \" -*- nroff -*-
+.TH "rgb2pct" 1 "Wed Oct 19 2016" "GDAL" \" -*- nroff -*-
 .ad l
 .nh
 .SH NAME
diff --git a/ogr/ogrsf_frmts/filegdb/FGdbLayer.cpp b/ogr/ogrsf_frmts/filegdb/FGdbLayer.cpp
index d1ac7c8..0d359e5 100644
--- a/ogr/ogrsf_frmts/filegdb/FGdbLayer.cpp
+++ b/ogr/ogrsf_frmts/filegdb/FGdbLayer.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
-* $Id: FGdbLayer.cpp 33563 2016-02-26 14:57:06Z rouault $
+* $Id: FGdbLayer.cpp 35794 2016-10-17 19:29:48Z 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 33563 2016-02-26 14:57:06Z rouault $");
+CPL_CVSID("$Id: FGdbLayer.cpp 35794 2016-10-17 19:29:48Z rouault $");
 
 using std::string;
 using std::wstring;
@@ -1860,7 +1860,11 @@ OGRErr FGdbLayer::AlterFieldDefn( int iFieldToAlter, OGRFieldDefn* poNewFieldDef
     OGRFieldDefn oField(poFieldDefn);
 
     if (nFlags & ALTER_TYPE_FLAG)
+    {
+        oField.SetSubType(OFSTNone);
         oField.SetType(poNewFieldDefn->GetType());
+        oField.SetSubType(poNewFieldDefn->GetSubType());
+    }
     if (nFlags & ALTER_NAME_FLAG)
     {
         if (strcmp(poNewFieldDefn->GetNameRef(), oField.GetNameRef()) != 0)
@@ -1901,7 +1905,9 @@ OGRErr FGdbLayer::AlterFieldDefn( int iFieldToAlter, OGRFieldDefn* poNewFieldDef
 
     m_vOGRFieldToESRIFieldType[iFieldToAlter] = gdbFieldType;
 
+    poFieldDefn->SetSubType(OFSTNone);
     poFieldDefn->SetType(oField.GetType());
+    poFieldDefn->SetType(oField.GetSubType());
     poFieldDefn->SetWidth(oField.GetWidth());
     poFieldDefn->SetPrecision(oField.GetPrecision());
 
diff --git a/ogr/ogrsf_frmts/gpkg/ogrgeopackagetablelayer.cpp b/ogr/ogrsf_frmts/gpkg/ogrgeopackagetablelayer.cpp
index 155a36e..aed3869 100644
--- a/ogr/ogrsf_frmts/gpkg/ogrgeopackagetablelayer.cpp
+++ b/ogr/ogrsf_frmts/gpkg/ogrgeopackagetablelayer.cpp
@@ -3337,7 +3337,11 @@ OGRErr OGRGeoPackageTableLayer::AlterFieldDefn( int iFieldToAlter,
     if( (nFlagsIn & ALTER_NAME_FLAG) )
         oTmpFieldDefn.SetName(poNewFieldDefn->GetNameRef());
     if( (nFlagsIn & ALTER_TYPE_FLAG) )
+    {
+        oTmpFieldDefn.SetSubType(OFSTNone);
         oTmpFieldDefn.SetType(poNewFieldDefn->GetType());
+        oTmpFieldDefn.SetSubType(poNewFieldDefn->GetSubType());
+    }
     if (nFlagsIn & ALTER_WIDTH_PRECISION_FLAG)
     {
         oTmpFieldDefn.SetWidth(poNewFieldDefn->GetWidth());
@@ -3572,7 +3576,9 @@ OGRErr OGRGeoPackageTableLayer::AlterFieldDefn( int iFieldToAlter,
 
             if (nFlagsIn & ALTER_TYPE_FLAG)
             {
+                poFieldDefn->SetSubType(OFSTNone);
                 poFieldDefn->SetType(poNewFieldDefn->GetType());
+                poFieldDefn->SetSubType(poNewFieldDefn->GetSubType());
             }
             if (nFlagsIn & ALTER_NAME_FLAG)
             {
diff --git a/ogr/ogrsf_frmts/ili/ogrili1layer.cpp b/ogr/ogrsf_frmts/ili/ogrili1layer.cpp
index dd93ff8..23a19ac 100644
--- a/ogr/ogrsf_frmts/ili/ogrili1layer.cpp
+++ b/ogr/ogrsf_frmts/ili/ogrili1layer.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: ogrili1layer.cpp 33325 2016-02-02 14:30:48Z rouault $
+ * $Id: ogrili1layer.cpp 35780 2016-10-17 10:07:12Z rouault $
  *
  * Project:  Interlis 1 Translator
  * Purpose:  Implements OGRILI1Layer class.
@@ -33,7 +33,7 @@
 #include "ogr_geos.h"
 #include "ogr_ili1.h"
 
-CPL_CVSID("$Id: ogrili1layer.cpp 33325 2016-02-02 14:30:48Z rouault $");
+CPL_CVSID("$Id: ogrili1layer.cpp 35780 2016-10-17 10:07:12Z rouault $");
 
 /************************************************************************/
 /*                           OGRILI1Layer()                              */
@@ -524,7 +524,7 @@ void OGRILI1Layer::JoinSurfaceLayer( OGRILI1Layer* poSurfaceLineLayer,
                         feature->GetGeomFieldRef(nSurfaceFieldIndex) );
             OGRMultiCurve *lines = reinterpret_cast<OGRMultiCurve *>(
                 linefeature->GetGeomFieldRef(0) );
-            for( int i = 0; i < lines->getNumGeometries(); i++ ) {
+            for( int i = 0; lines != NULL && i < lines->getNumGeometries(); i++ ) {
                 OGRCurve *line = reinterpret_cast<OGRCurve*>(lines->getGeometryRef(i));
                 OGRCurve *ring = NULL;
                 if (surface_lines) {
diff --git a/ogr/ogrsf_frmts/mem/ogrmemlayer.cpp b/ogr/ogrsf_frmts/mem/ogrmemlayer.cpp
index 9953ff9..92bcb02 100644
--- a/ogr/ogrsf_frmts/mem/ogrmemlayer.cpp
+++ b/ogr/ogrsf_frmts/mem/ogrmemlayer.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: ogrmemlayer.cpp 33400 2016-02-10 07:55:48Z ajolma $
+ * $Id: ogrmemlayer.cpp 35794 2016-10-17 19:29:48Z rouault $
  *
  * Project:  OpenGIS Simple Features Reference Implementation
  * Purpose:  Implements OGRMemLayer class.
@@ -32,7 +32,7 @@
 #include "ogr_mem.h"
 #include "ogr_p.h"
 
-CPL_CVSID("$Id: ogrmemlayer.cpp 33400 2016-02-10 07:55:48Z ajolma $");
+CPL_CVSID("$Id: ogrmemlayer.cpp 35794 2016-10-17 19:29:48Z rouault $");
 
 /************************************************************************/
 /*                      IOGRMemLayerFeatureIterator                     */
@@ -678,7 +678,8 @@ OGRErr OGRMemLayer::AlterFieldDefn( int iField, OGRFieldDefn* poNewFieldDefn,
     OGRFieldDefn* poFieldDefn = m_poFeatureDefn->GetFieldDefn(iField);
 
     if ((nFlagsIn & ALTER_TYPE_FLAG) &&
-        poFieldDefn->GetType() != poNewFieldDefn->GetType())
+        (poFieldDefn->GetType() != poNewFieldDefn->GetType() ||
+         poFieldDefn->GetSubType() != poNewFieldDefn->GetSubType()) )
     {
         if ((poNewFieldDefn->GetType() == OFTDate ||
              poNewFieldDefn->GetType() == OFTTime ||
@@ -781,7 +782,9 @@ OGRErr OGRMemLayer::AlterFieldDefn( int iField, OGRFieldDefn* poNewFieldDefn,
             delete poIter;
         }
 
+        poFieldDefn->SetSubType(OFSTNone);
         poFieldDefn->SetType(poNewFieldDefn->GetType());
+        poFieldDefn->SetSubType(poNewFieldDefn->GetSubType());
     }
 
     if (nFlagsIn & ALTER_NAME_FLAG)
diff --git a/ogr/ogrsf_frmts/pg/ogrpgtablelayer.cpp b/ogr/ogrsf_frmts/pg/ogrpgtablelayer.cpp
index 134496b..62bce45 100644
--- a/ogr/ogrsf_frmts/pg/ogrpgtablelayer.cpp
+++ b/ogr/ogrsf_frmts/pg/ogrpgtablelayer.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: ogrpgtablelayer.cpp 35632 2016-10-07 13:45:42Z rouault $
+ * $Id: ogrpgtablelayer.cpp 35794 2016-10-17 19:29:48Z rouault $
 
  *
  * Project:  OpenGIS Simple Features Reference Implementation
@@ -37,7 +37,7 @@
 
 #define PQexec this_is_an_error
 
-CPL_CVSID("$Id: ogrpgtablelayer.cpp 35632 2016-10-07 13:45:42Z rouault $");
+CPL_CVSID("$Id: ogrpgtablelayer.cpp 35794 2016-10-17 19:29:48Z rouault $");
 
 
 #define USE_COPY_UNSET  -10
@@ -2523,7 +2523,11 @@ OGRErr OGRPGTableLayer::AlterFieldDefn( int iField, OGRFieldDefn* poNewFieldDefn
     poDS->SoftStartTransaction();
 
     if (!(nFlagsIn & ALTER_TYPE_FLAG))
+    {
+        oField.SetSubType(OFSTNone);
         oField.SetType(poFieldDefn->GetType());
+        oField.SetSubType(poFieldDefn->GetSubType());
+    }
 
     if (!(nFlagsIn & ALTER_WIDTH_PRECISION_FLAG))
     {
@@ -2677,7 +2681,11 @@ OGRErr OGRPGTableLayer::AlterFieldDefn( int iField, OGRFieldDefn* poNewFieldDefn
     if (nFlagsIn & ALTER_NAME_FLAG)
         poFieldDefn->SetName(oField.GetNameRef());
     if (nFlagsIn & ALTER_TYPE_FLAG)
+    {
+        poFieldDefn->SetSubType(OFSTNone);
         poFieldDefn->SetType(oField.GetType());
+        poFieldDefn->SetSubType(oField.GetSubType());
+    }
     if (nFlagsIn & ALTER_WIDTH_PRECISION_FLAG)
     {
         poFieldDefn->SetWidth(oField.GetWidth());
diff --git a/ogr/ogrsf_frmts/plscenes/ogrplscenesdataset.cpp b/ogr/ogrsf_frmts/plscenes/ogrplscenesdataset.cpp
index b365784..203e3d8 100644
--- a/ogr/ogrsf_frmts/plscenes/ogrplscenesdataset.cpp
+++ b/ogr/ogrsf_frmts/plscenes/ogrplscenesdataset.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: ogrplscenesdataset.cpp 35486 2016-09-17 16:39:10Z rouault $
+ * $Id: ogrplscenesdataset.cpp 35828 2016-10-19 23:23:39Z rouault $
  *
  * Project:  PlanetLabs scene driver
  * Purpose:  Implements OGRPLScenesDataset
@@ -29,7 +29,7 @@
 
 #include "ogr_plscenes.h"
 
-CPL_CVSID("$Id: ogrplscenesdataset.cpp 35486 2016-09-17 16:39:10Z rouault $");
+CPL_CVSID("$Id: ogrplscenesdataset.cpp 35828 2016-10-19 23:23:39Z rouault $");
 
 /************************************************************************/
 /*                         OGRPLScenesDataset()                         */
@@ -317,7 +317,8 @@ GDALDataset* OGRPLScenesDataset::OpenRasterScene(GDALOpenInfo* poOpenInfo,
 
     CPLString osRasterURL;
     osRasterURL = osBaseURL;
-    osRasterURL += "ortho/";
+    osRasterURL += CSLFetchNameValueDef(poOpenInfo->papszOpenOptions, "CATALOG", "ortho");
+    osRasterURL += "/";
     osRasterURL += osScene;
     json_object* poObj = RunRequest( osRasterURL );
     if( poObj == NULL )
@@ -378,13 +379,14 @@ GDALDataset* OGRPLScenesDataset::OpenRasterScene(GDALOpenInfo* poOpenInfo,
     }
 
     CPLString osOldHead(CPLGetConfigOption("CPL_VSIL_CURL_USE_HEAD", ""));
-    CPLString osOldExt(CPLGetConfigOption("CPL_VSIL_CURL_ALLOWED_EXTENSIONS", ""));
+    CPLString osOldAllowedFilename(CPLGetConfigOption("CPL_VSIL_CURL_ALLOWED_FILENAME", ""));
 
     int bUseVSICURL = CSLFetchBoolean(poOpenInfo->papszOpenOptions, "RANDOM_ACCESS", TRUE);
     if( bUseVSICURL && !(STARTS_WITH(osBaseURL, "/vsimem/")) )
     {
         CPLSetThreadLocalConfigOption("CPL_VSIL_CURL_USE_HEAD", "NO");
-        CPLSetThreadLocalConfigOption("CPL_VSIL_CURL_ALLOWED_EXTENSIONS", "{noext}");
+        CPLSetThreadLocalConfigOption("CPL_VSIL_CURL_ALLOWED_FILENAME",
+                                      ("/vsicurl/" + osRasterURL).c_str());
 
         VSIStatBufL sStat;
         if( VSIStatL(("/vsicurl/" + osRasterURL).c_str(), &sStat) == 0 &&
@@ -449,8 +451,8 @@ GDALDataset* OGRPLScenesDataset::OpenRasterScene(GDALOpenInfo* poOpenInfo,
     {
         CPLSetThreadLocalConfigOption("CPL_VSIL_CURL_USE_HEAD",
                                     osOldHead.size() ? osOldHead.c_str(): NULL);
-        CPLSetThreadLocalConfigOption("CPL_VSIL_CURL_ALLOWED_EXTENSIONS",
-                                    osOldExt.size() ? osOldExt.c_str(): NULL);
+        CPLSetThreadLocalConfigOption("CPL_VSIL_CURL_ALLOWED_FILENAME",
+                                    osOldAllowedFilename.size() ? osOldAllowedFilename.c_str(): NULL);
     }
 
     return poOutDS;
diff --git a/ogr/ogrsf_frmts/plscenes/ogrplscenesv1dataset.cpp b/ogr/ogrsf_frmts/plscenes/ogrplscenesv1dataset.cpp
index 9d54d9b..07492ba 100644
--- a/ogr/ogrsf_frmts/plscenes/ogrplscenesv1dataset.cpp
+++ b/ogr/ogrsf_frmts/plscenes/ogrplscenesv1dataset.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: ogrplscenesv1dataset.cpp 35486 2016-09-17 16:39:10Z rouault $
+ * $Id: ogrplscenesv1dataset.cpp 35828 2016-10-19 23:23:39Z rouault $
  *
  * Project:  PlanetLabs scene driver
  * Purpose:  Implements OGRPLScenesV1Dataset
@@ -30,7 +30,7 @@
 #include "ogr_plscenes.h"
 #include <time.h>
 
-CPL_CVSID("$Id: ogrplscenesv1dataset.cpp 35486 2016-09-17 16:39:10Z rouault $");
+CPL_CVSID("$Id: ogrplscenesv1dataset.cpp 35828 2016-10-19 23:23:39Z rouault $");
 
 /************************************************************************/
 /*                         OGRPLScenesV1Dataset()                       */
@@ -590,12 +590,14 @@ retry:
     osRasterURL = InsertAPIKeyInURL(osRasterURL);
 
     CPLString osOldHead(CPLGetConfigOption("CPL_VSIL_CURL_USE_HEAD", ""));
-    CPLString osOldExt(CPLGetConfigOption("CPL_VSIL_CURL_ALLOWED_EXTENSIONS", ""));
+    CPLString osOldAllowedFilename(CPLGetConfigOption("CPL_VSIL_CURL_ALLOWED_FILENAME", ""));
 
     int bUseVSICURL = CSLFetchBoolean(poOpenInfo->papszOpenOptions, "RANDOM_ACCESS", TRUE);
     if( bUseVSICURL && !(STARTS_WITH(m_osBaseURL, "/vsimem/")) )
     {
         CPLSetThreadLocalConfigOption("CPL_VSIL_CURL_USE_HEAD", "NO");
+        CPLSetThreadLocalConfigOption("CPL_VSIL_CURL_ALLOWED_FILENAME",
+                                      ("/vsicurl/" + osRasterURL).c_str());
 
         VSIStatBufL sStat;
         if( VSIStatL(("/vsicurl/" + osRasterURL).c_str(), &sStat) == 0 &&
@@ -607,10 +609,6 @@ retry:
         {
             CPLDebug("PLSCENES", "Cannot use random access for that file");
         }
-
-        // URLs with tokens can have . in them which confuses CPL_VSIL_CURL_ALLOWED_EXTENSIONS={noext} if
-        // it is run before the previous VSIStatL()
-        CPLSetThreadLocalConfigOption("CPL_VSIL_CURL_ALLOWED_EXTENSIONS", "{noext}");
     }
 
     GDALDataset* poOutDS = (GDALDataset*) GDALOpenEx(osRasterURL, GDAL_OF_RASTER, NULL, NULL, NULL);
@@ -675,8 +673,8 @@ retry:
     {
         CPLSetThreadLocalConfigOption("CPL_VSIL_CURL_USE_HEAD",
                                     osOldHead.size() ? osOldHead.c_str(): NULL);
-        CPLSetThreadLocalConfigOption("CPL_VSIL_CURL_ALLOWED_EXTENSIONS",
-                                    osOldExt.size() ? osOldExt.c_str(): NULL);
+        CPLSetThreadLocalConfigOption("CPL_VSIL_CURL_ALLOWED_FILENAME",
+                                    osOldAllowedFilename.size() ? osOldAllowedFilename.c_str(): NULL);
     }
 
     return poOutDS;
diff --git a/ogr/ogrsf_frmts/sqlite/ogrsqlitetablelayer.cpp b/ogr/ogrsf_frmts/sqlite/ogrsqlitetablelayer.cpp
index ce65689..e2f71cc 100644
--- a/ogr/ogrsf_frmts/sqlite/ogrsqlitetablelayer.cpp
+++ b/ogr/ogrsf_frmts/sqlite/ogrsqlitetablelayer.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: ogrsqlitetablelayer.cpp 35500 2016-09-23 14:10:22Z rouault $
+ * $Id: ogrsqlitetablelayer.cpp 35792 2016-10-17 19:19:40Z 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 35500 2016-09-23 14:10:22Z rouault $");
+CPL_CVSID("$Id: ogrsqlitetablelayer.cpp 35792 2016-10-17 19:19:40Z rouault $");
 
 /************************************************************************/
 /*                        OGRSQLiteTableLayer()                         */
@@ -2163,7 +2163,11 @@ OGRErr OGRSQLiteTableLayer::AlterFieldDefn( int iFieldToAlter, OGRFieldDefn* poN
             if( (nFlagsIn & ALTER_NAME_FLAG) )
                 oTmpFieldDefn.SetName(poNewFieldDefn->GetNameRef());
             if( (nFlagsIn & ALTER_TYPE_FLAG) )
+            {
+                oTmpFieldDefn.SetSubType(OFSTNone);
                 oTmpFieldDefn.SetType(poNewFieldDefn->GetType());
+                oTmpFieldDefn.SetSubType(poNewFieldDefn->GetSubType());
+            }
             if (nFlagsIn & ALTER_WIDTH_PRECISION_FLAG)
             {
                 oTmpFieldDefn.SetWidth(poNewFieldDefn->GetWidth());
@@ -2240,7 +2244,9 @@ OGRErr OGRSQLiteTableLayer::AlterFieldDefn( int iFieldToAlter, OGRFieldDefn* poN
             papszCompressedColumns = CSLRemoveStrings(papszCompressedColumns,
                                                       iIdx, 1, NULL);
         }
+        poFieldDefn->SetSubType(OFSTNone);
         poFieldDefn->SetType(poNewFieldDefn->GetType());
+        poFieldDefn->SetSubType(poNewFieldDefn->GetSubType());
     }
     if (nFlagsIn & ALTER_NAME_FLAG)
     {
diff --git a/port/cpl_vsi_mem.cpp b/port/cpl_vsi_mem.cpp
index 7fa4334..82fb27d 100644
--- a/port/cpl_vsi_mem.cpp
+++ b/port/cpl_vsi_mem.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: cpl_vsi_mem.cpp 33758 2016-03-21 09:06:22Z rouault $
+ * $Id: cpl_vsi_mem.cpp 35728 2016-10-14 16:17:28Z rouault $
  *
  * Project:  VSI Virtual File System
  * Purpose:  Implementation of Memory Buffer virtual IO functions.
@@ -31,10 +31,11 @@
 #include "cpl_vsi_virtual.h"
 #include "cpl_string.h"
 #include "cpl_multiproc.h"
+#include "cpl_atomic_ops.h"
 #include <time.h>
 #include <map>
 
-CPL_CVSID("$Id: cpl_vsi_mem.cpp 33758 2016-03-21 09:06:22Z rouault $");
+CPL_CVSID("$Id: cpl_vsi_mem.cpp 35728 2016-10-14 16:17:28Z rouault $");
 
 /*
 ** Notes on Multithreading:
@@ -73,7 +74,7 @@ class VSIMemFile
 {
 public:
     CPLString     osFilename;
-    int           nRefCount;
+    volatile int  nRefCount;
 
     int           bIsDirectory;
 
@@ -179,7 +180,8 @@ VSIMemFile::~VSIMemFile()
 
 {
     if( nRefCount != 0 )
-        CPLDebug( "VSIMemFile", "Memory file %s deleted with %d references.",
+        CPLError( CE_Warning, CPLE_AppDefined,
+                  "Memory file %s deleted with %d references.",
                   osFilename.c_str(), nRefCount );
 
     if( bOwnData && pabyData )
@@ -251,7 +253,7 @@ bool VSIMemFile::SetLength( vsi_l_offset nNewLength )
 int VSIMemHandle::Close()
 
 {
-    if( --(poFile->nRefCount) == 0 )
+    if( CPLAtomicDec(&(poFile->nRefCount)) == 0 )
         delete poFile;
 
     poFile = NULL;
@@ -434,7 +436,7 @@ VSIMemFilesystemHandler::~VSIMemFilesystemHandler()
          iter != oFileList.end();
          ++iter )
     {
-        iter->second->nRefCount--;
+        CPLAtomicDec(&(iter->second->nRefCount));
         delete iter->second;
     }
 
@@ -482,7 +484,7 @@ VSIMemFilesystemHandler::Open( const char *pszFilename,
         poFile = new VSIMemFile;
         poFile->osFilename = osFilename;
         oFileList[poFile->osFilename] = poFile;
-        poFile->nRefCount++; // for file list
+        CPLAtomicInc(&(poFile->nRefCount)); // for file list
     }
     // Overwrite
     else if( strstr(pszAccess, "w") )
@@ -510,7 +512,7 @@ VSIMemFilesystemHandler::Open( const char *pszFilename,
     else
         poHandle->bUpdate = FALSE;
 
-    poFile->nRefCount++;
+    CPLAtomicInc(&(poFile->nRefCount));
 
     if( strstr(pszAccess,"a") )
         poHandle->m_nOffset = poFile->nLength;
@@ -596,7 +598,7 @@ int VSIMemFilesystemHandler::Unlink_unlocked( const char * pszFilename )
 
     VSIMemFile *poFile = oFileList[osFilename];
 
-    if( --(poFile->nRefCount) == 0 )
+    if( CPLAtomicDec(&(poFile->nRefCount)) == 0 )
         delete poFile;
 
     oFileList.erase( oFileList.find(osFilename) );
@@ -629,7 +631,7 @@ int VSIMemFilesystemHandler::Mkdir( const char * pszPathname,
     poFile->osFilename = osPathname;
     poFile->bIsDirectory = TRUE;
     oFileList[osPathname] = poFile;
-    poFile->nRefCount++; /* referenced by file list */
+    CPLAtomicInc(&(poFile->nRefCount)); /* referenced by file list */
 
     return 0;
 }
@@ -891,7 +893,7 @@ VSILFILE *VSIFileFromMemBuffer( const char *pszFilename,
         CPLMutexHolder oHolder( &poHandler->hMutex );
         poHandler->Unlink_unlocked(osFilename);
         poHandler->oFileList[poFile->osFilename] = poFile;
-        poFile->nRefCount++;
+        CPLAtomicInc(&(poFile->nRefCount));
     }
 
     return (VSILFILE *) poHandler->Open( osFilename, "r+" );
@@ -949,7 +951,7 @@ GByte *VSIGetMemFileBuffer( const char *pszFilename,
             poFile->bOwnData = FALSE;
 
         poHandler->oFileList.erase( poHandler->oFileList.find(osFilename) );
-        --(poFile->nRefCount);
+        CPLAtomicDec(&(poFile->nRefCount));
         delete poFile;
     }
 
diff --git a/port/cpl_vsil_curl.cpp b/port/cpl_vsil_curl.cpp
index cc86618..e528c88 100644
--- a/port/cpl_vsil_curl.cpp
+++ b/port/cpl_vsil_curl.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: cpl_vsil_curl.cpp 35717 2016-10-13 18:59:41Z rouault $
+ * $Id: cpl_vsil_curl.cpp 35828 2016-10-19 23:23:39Z rouault $
  *
  * Project:  CPL - Common Portability Library
  * Purpose:  Implement VSI large file api for HTTP/FTP files
@@ -36,7 +36,7 @@
 #include "cpl_aws.h"
 #include "cpl_minixml.h"
 
-CPL_CVSID("$Id: cpl_vsil_curl.cpp 35717 2016-10-13 18:59:41Z rouault $");
+CPL_CVSID("$Id: cpl_vsil_curl.cpp 35828 2016-10-19 23:23:39Z rouault $");
 
 #ifndef HAVE_CURL
 
@@ -2058,11 +2058,18 @@ VSICurlHandle* VSICurlFilesystemHandler::CreateFileHandle(const char* pszURL)
 }
 
 /************************************************************************/
-/*                        IsAllowedExtension()                          */
+/*                        IsAllowedFilename()                           */
 /************************************************************************/
 
-static bool IsAllowedExtension( const char* pszFilename )
+static bool IsAllowedFilename( const char* pszFilename )
 {
+    const char* pszAllowedFilename = 
+        CPLGetConfigOption("CPL_VSIL_CURL_ALLOWED_FILENAME", NULL);
+    if( pszAllowedFilename != NULL )
+    {
+        return strcmp( pszFilename, pszAllowedFilename ) == 0;
+    }
+
     /* Consider that only the files whose extension ends up with one that is */
     /* listed in CPL_VSIL_CURL_ALLOWED_EXTENSIONS exist on the server */
     /* This can speeds up dramatically open experience, in case the server */
@@ -2119,7 +2126,7 @@ VSIVirtualHandle* VSICurlFilesystemHandler::Open( const char *pszFilename,
                  "Only read-only mode is supported for /vsicurl");
         return NULL;
     }
-    if( !IsAllowedExtension( pszFilename ) )
+    if( !IsAllowedFilename( pszFilename ) )
         return NULL;
 
     const char* pszOptionVal =
@@ -3011,7 +3018,7 @@ int VSICurlFilesystemHandler::Stat( const char *pszFilename, VSIStatBufL *pStatB
 
     memset(pStatBuf, 0, sizeof(VSIStatBufL));
 
-    if( !IsAllowedExtension( pszFilename ) )
+    if( !IsAllowedFilename( pszFilename ) )
         return -1;
 
     const char* pszOptionVal =

-- 
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