mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 918612 - Stop masking the underlying Sqlite VFS version in the Telemetry VFS. r=bent
This commit is contained in:
parent
30c9d18caa
commit
1e61ddb0c4
@ -15,6 +15,12 @@
|
|||||||
#include "mozilla/dom/quota/QuotaObject.h"
|
#include "mozilla/dom/quota/QuotaObject.h"
|
||||||
#include "mozilla/IOInterposer.h"
|
#include "mozilla/IOInterposer.h"
|
||||||
|
|
||||||
|
// The last VFS version for which this file has been updated.
|
||||||
|
#define LAST_KNOWN_VFS_VERSION 3
|
||||||
|
|
||||||
|
// The last io_methods version for which this file has been updated.
|
||||||
|
#define LAST_KNOWN_IOMETHODS_VERSION 3
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This preference is a workaround to allow users/sysadmins to identify
|
* This preference is a workaround to allow users/sysadmins to identify
|
||||||
* that the profile exists on an NFS share whose implementation
|
* that the profile exists on an NFS share whose implementation
|
||||||
@ -400,10 +406,11 @@ xOpen(sqlite3_vfs* vfs, const char *zName, sqlite3_file* pFile,
|
|||||||
sqlite3_io_methods *pNew = new sqlite3_io_methods;
|
sqlite3_io_methods *pNew = new sqlite3_io_methods;
|
||||||
const sqlite3_io_methods *pSub = p->pReal->pMethods;
|
const sqlite3_io_methods *pSub = p->pReal->pMethods;
|
||||||
memset(pNew, 0, sizeof(*pNew));
|
memset(pNew, 0, sizeof(*pNew));
|
||||||
// If you update this version number, you must add appropriate IO methods
|
// If the io_methods version is higher than the last known one, you should
|
||||||
// for any methods added in the version change.
|
// update this VFS adding appropriate IO methods for any methods added in
|
||||||
pNew->iVersion = 3;
|
// the version change.
|
||||||
MOZ_ASSERT(pNew->iVersion >= pSub->iVersion);
|
pNew->iVersion = pSub->iVersion;
|
||||||
|
MOZ_ASSERT(pNew->iVersion <= LAST_KNOWN_IOMETHODS_VERSION);
|
||||||
pNew->xClose = xClose;
|
pNew->xClose = xClose;
|
||||||
pNew->xRead = xRead;
|
pNew->xRead = xRead;
|
||||||
pNew->xWrite = xWrite;
|
pNew->xWrite = xWrite;
|
||||||
@ -416,19 +423,23 @@ xOpen(sqlite3_vfs* vfs, const char *zName, sqlite3_file* pFile,
|
|||||||
pNew->xFileControl = xFileControl;
|
pNew->xFileControl = xFileControl;
|
||||||
pNew->xSectorSize = xSectorSize;
|
pNew->xSectorSize = xSectorSize;
|
||||||
pNew->xDeviceCharacteristics = xDeviceCharacteristics;
|
pNew->xDeviceCharacteristics = xDeviceCharacteristics;
|
||||||
// Methods added in version 2.
|
if (pNew->iVersion >= 2) {
|
||||||
pNew->xShmMap = pSub->xShmMap ? xShmMap : 0;
|
// Methods added in version 2.
|
||||||
pNew->xShmLock = pSub->xShmLock ? xShmLock : 0;
|
pNew->xShmMap = pSub->xShmMap ? xShmMap : 0;
|
||||||
pNew->xShmBarrier = pSub->xShmBarrier ? xShmBarrier : 0;
|
pNew->xShmLock = pSub->xShmLock ? xShmLock : 0;
|
||||||
pNew->xShmUnmap = pSub->xShmUnmap ? xShmUnmap : 0;
|
pNew->xShmBarrier = pSub->xShmBarrier ? xShmBarrier : 0;
|
||||||
// Methods added in version 3.
|
pNew->xShmUnmap = pSub->xShmUnmap ? xShmUnmap : 0;
|
||||||
// SQLite 3.7.17 calls these methods without checking for nullptr first,
|
}
|
||||||
// so we always define them. Verify that we're not going to call
|
if (pNew->iVersion >= 3) {
|
||||||
// nullptrs, though.
|
// Methods added in version 3.
|
||||||
MOZ_ASSERT(pSub->xFetch);
|
// SQLite 3.7.17 calls these methods without checking for nullptr first,
|
||||||
pNew->xFetch = xFetch;
|
// so we always define them. Verify that we're not going to call
|
||||||
MOZ_ASSERT(pSub->xUnfetch);
|
// nullptrs, though.
|
||||||
pNew->xUnfetch = xUnfetch;
|
MOZ_ASSERT(pSub->xFetch);
|
||||||
|
pNew->xFetch = xFetch;
|
||||||
|
MOZ_ASSERT(pSub->xUnfetch);
|
||||||
|
pNew->xUnfetch = xUnfetch;
|
||||||
|
}
|
||||||
pFile->pMethods = pNew;
|
pFile->pMethods = pNew;
|
||||||
}
|
}
|
||||||
return rc;
|
return rc;
|
||||||
@ -572,10 +583,11 @@ sqlite3_vfs* ConstructTelemetryVFS()
|
|||||||
|
|
||||||
sqlite3_vfs *tvfs = new ::sqlite3_vfs;
|
sqlite3_vfs *tvfs = new ::sqlite3_vfs;
|
||||||
memset(tvfs, 0, sizeof(::sqlite3_vfs));
|
memset(tvfs, 0, sizeof(::sqlite3_vfs));
|
||||||
// If you update this version number, you must add appropriate VFS methods
|
// If the VFS version is higher than the last known one, you should update
|
||||||
// for any methods added in the version change.
|
// this VFS adding appropriate methods for any methods added in the version
|
||||||
tvfs->iVersion = 3;
|
// change.
|
||||||
MOZ_ASSERT(vfs->iVersion == tvfs->iVersion);
|
tvfs->iVersion = vfs->iVersion;
|
||||||
|
MOZ_ASSERT(vfs->iVersion <= LAST_KNOWN_VFS_VERSION);
|
||||||
tvfs->szOsFile = sizeof(telemetry_file) - sizeof(sqlite3_file) + vfs->szOsFile;
|
tvfs->szOsFile = sizeof(telemetry_file) - sizeof(sqlite3_file) + vfs->szOsFile;
|
||||||
tvfs->mxPathname = vfs->mxPathname;
|
tvfs->mxPathname = vfs->mxPathname;
|
||||||
tvfs->zName = "telemetry-vfs";
|
tvfs->zName = "telemetry-vfs";
|
||||||
@ -592,13 +604,16 @@ sqlite3_vfs* ConstructTelemetryVFS()
|
|||||||
tvfs->xSleep = xSleep;
|
tvfs->xSleep = xSleep;
|
||||||
tvfs->xCurrentTime = xCurrentTime;
|
tvfs->xCurrentTime = xCurrentTime;
|
||||||
tvfs->xGetLastError = xGetLastError;
|
tvfs->xGetLastError = xGetLastError;
|
||||||
// Methods added in version 2.
|
if (tvfs->iVersion >= 2) {
|
||||||
tvfs->xCurrentTimeInt64 = xCurrentTimeInt64;
|
// Methods added in version 2.
|
||||||
// Methods added in version 3.
|
tvfs->xCurrentTimeInt64 = xCurrentTimeInt64;
|
||||||
tvfs->xSetSystemCall = xSetSystemCall;
|
}
|
||||||
tvfs->xGetSystemCall = xGetSystemCall;
|
if (tvfs->iVersion >= 3) {
|
||||||
tvfs->xNextSystemCall = xNextSystemCall;
|
// Methods added in version 3.
|
||||||
|
tvfs->xSetSystemCall = xSetSystemCall;
|
||||||
|
tvfs->xGetSystemCall = xGetSystemCall;
|
||||||
|
tvfs->xNextSystemCall = xNextSystemCall;
|
||||||
|
}
|
||||||
return tvfs;
|
return tvfs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user