New version 1.11.4 plus fix for GDAL #6360

This commit is contained in:
Volker Fröhlich 2016-02-14 02:00:34 +01:00
parent 6bf0232d5c
commit bbf038cd7f
5 changed files with 95 additions and 5 deletions

2
.gitignore vendored
View File

@ -17,3 +17,5 @@ gdalautotest-1.7.0.tar.gz
/gdal-1.11.2-fedora.tar.xz
/gdalautotest-1.11.3.tar.gz
/gdal-1.11.3-fedora.tar.xz
/gdalautotest-1.11.4.tar.gz
/gdal-1.11.4-fedora.tar.xz

View File

@ -0,0 +1,79 @@
Index: /branches/1.11/gdal/ogr/ogrsf_frmts/sqlite/ogrsqlitevfs.cpp
===================================================================
--- /branches/1.11/gdal/ogr/ogrsf_frmts/sqlite/ogrsqlitevfs.cpp (revision 33411)
+++ /branches/1.11/gdal/ogr/ogrsf_frmts/sqlite/ogrsqlitevfs.cpp (revision 33412)
@@ -423,9 +423,49 @@
}
-static int OGRSQLiteVFSCurrentTime (sqlite3_vfs* pVFS, double* p1)
-{
- sqlite3_vfs* pUnderlyingVFS = GET_UNDERLYING_VFS(pVFS);
- //CPLDebug("SQLITE", "OGRSQLiteVFSCurrentTime()");
- return pUnderlyingVFS->xCurrentTime(pUnderlyingVFS, p1);
+// Derived for sqlite3.c implementation of unixCurrentTime64 and winCurrentTime64
+#ifdef WIN32
+#include <windows.h>
+static int OGRSQLiteVFSCurrentTimeInt64 (sqlite3_vfs* /*pVFS*/, sqlite3_int64 *piNow)
+{
+ FILETIME ft;
+ static const sqlite3_int64 winFiletimeEpoch = 23058135*(sqlite3_int64)8640000;
+ static const sqlite3_int64 max32BitValue =
+ (sqlite3_int64)2000000000 + (sqlite3_int64)2000000000 +
+ (sqlite3_int64)294967296;
+
+#if defined(_WIN32_WCE)
+ SYSTEMTIME time;
+ GetSystemTime(&time);
+ /* if SystemTimeToFileTime() fails, it returns zero. */
+ if (!SystemTimeToFileTime(&time,&ft)){
+ return SQLITE_ERROR;
+ }
+#else
+ GetSystemTimeAsFileTime( &ft );
+#endif
+ *piNow = winFiletimeEpoch +
+ ((((sqlite3_int64)ft.dwHighDateTime)*max32BitValue) +
+ (sqlite3_int64)ft.dwLowDateTime)/(sqlite3_int64)10000;
+ return SQLITE_OK;
+}
+#else
+#include <sys/time.h>
+static int OGRSQLiteVFSCurrentTimeInt64 (sqlite3_vfs* /*pVFS*/, sqlite3_int64 *piNow)
+{
+ struct timeval sNow;
+ static const sqlite3_int64 unixEpoch = 24405875*(sqlite3_int64)8640000;
+ (void)gettimeofday(&sNow, NULL); /* Cannot fail given valid arguments */
+ *piNow = unixEpoch + 1000*(sqlite3_int64)sNow.tv_sec + sNow.tv_usec/1000;
+
+ return SQLITE_OK;
+}
+#endif
+
+static int OGRSQLiteVFSCurrentTime (sqlite3_vfs* /*pVFS*/, double* p1)
+{
+ sqlite3_int64 i = 0;
+ int rc = OGRSQLiteVFSCurrentTimeInt64(NULL, &i);
+ *p1 = i/86400000.0;
+ return rc;
}
@@ -450,5 +490,9 @@
pVFSAppData->nCounter = 0;
+#if SQLITE_VERSION_NUMBER >= 3008000L /* perhaps not the minimal version that defines xCurrentTimeInt64, but who cares */
+ pMyVFS->iVersion = 2;
+#else
pMyVFS->iVersion = 1;
+#endif
pMyVFS->szOsFile = sizeof(OGRSQLiteFileStruct);
pMyVFS->mxPathname = pDefaultVFS->mxPathname;
@@ -467,4 +511,9 @@
pMyVFS->xCurrentTime = OGRSQLiteVFSCurrentTime;
pMyVFS->xGetLastError = OGRSQLiteVFSGetLastError;
+#if SQLITE_VERSION_NUMBER >= 3008000L /* perhaps not the minimal version that defines xCurrentTimeInt64, but who cares */
+ if( pMyVFS->iVersion >= 2 )
+ pMyVFS->xCurrentTimeInt64 = OGRSQLiteVFSCurrentTimeInt64;
+#endif
+
return pMyVFS;
}

View File

@ -1,6 +1,6 @@
#!/bin/bash
# Volker Fröhlich
VERSION="1.11.3"
VERSION="1.11.4"
tar xvf gdal-"${VERSION}".tar.xz

View File

@ -22,7 +22,7 @@
# Tests can be of a different version
%global testversion 1.11.3
%global testversion 1.11.4
%global run_tests 1
%global with_spatialite 1
@ -39,7 +39,7 @@
Name: gdal
Version: 1.11.3
Version: 1.11.4
Release: 1%{?dist}
Summary: GIS file format library
Group: System Environment/Libraries
@ -65,6 +65,9 @@ Patch2: %{name}-jni.patch
# https://trac.osgeo.org/gdal/ticket/6159#ticket
Patch3: %{name}-2.0.1-iso8211-include.patch
# https://trac.osgeo.org/gdal/ticket/6360
Patch4: %{name}-1.11.4-sqlite-crash.patch
# Fedora uses Alternatives for Java
Patch8: %{name}-1.9.0-java.patch
@ -269,6 +272,7 @@ rm -r frmts/grib/degrib18/g2clib-1.0.4
%patch1 -p1 -b .g2clib~
%patch2 -p1 -b .jni~
%patch3 -p1 -b .iso8211~
%patch4 -p4 -b .sqlite~
%patch8 -p1 -b .java~
# Copy in PROVENANCE.TXT-fedora
@ -655,6 +659,7 @@ for f in 'GDAL*' BandProperty ColorAssociation CutlineTransformer DatasetPropert
done
#TODO: What's that?
rm -f %{buildroot}%{_mandir}/man1/*_%{name}-%{version}-fedora_apps_*
rm -f %{buildroot}%{_mandir}/man1/_home_rouault_dist_wrk_gdal_apps_.1*
%check
%if %{run_tests}
@ -783,6 +788,10 @@ popd
#Or as before, using ldconfig
%changelog
* Wed Oct 21 2015 Volker Froehlich <volker27@gmx.at> - 1.11.4-1
- New release
- Patch for GDAL issue #6360
* Wed Oct 21 2015 Volker Froehlich <volker27@gmx.at> - 1.11.3-1
- New release

View File

@ -1,2 +1,2 @@
2b6ba83e78a3ce5ffbed8f14ddd0029a gdalautotest-1.11.3.tar.gz
b07d7f7d1c0032fb8207df477644534a gdal-1.11.3-fedora.tar.xz
8b63eaff1df4d8ccd1a17b497b189282 gdalautotest-1.11.4.tar.gz
4003b0a4c6c3eb603cd63e61fb9416e2 gdal-1.11.4-fedora.tar.xz