[evolution-data-server] Bug 738965 - [SQLite VFS] Crash due to missing xFetch definition
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-data-server] Bug 738965 - [SQLite VFS] Crash due to missing xFetch definition
- Date: Thu, 23 Oct 2014 10:00:27 +0000 (UTC)
commit 01cd4a6e7ab0ac5b92066e2fe2e9cc0e2ffd35c4
Author: Milan Crha <mcrha redhat com>
Date: Thu Oct 23 11:58:43 2014 +0200
Bug 738965 - [SQLite VFS] Crash due to missing xFetch definition
camel/camel-db.c | 37 +++++++++++++++++++++++++++++++++++++
libebackend/e-sqlite3-vfs.c | 37 +++++++++++++++++++++++++++++++++++++
2 files changed, 74 insertions(+), 0 deletions(-)
---
diff --git a/camel/camel-db.c b/camel/camel-db.c
index a93da08..e14f0ef 100644
--- a/camel/camel-db.c
+++ b/camel/camel-db.c
@@ -186,6 +186,20 @@ camel_sqlite3_file_ ## _nm _params \
return cFile->old_vfs_file->pMethods->_nm _call; \
}
+#define def_subclassed_void(_nm, _params, _call) \
+static void \
+camel_sqlite3_file_ ## _nm _params \
+{ \
+ CamelSqlite3File *cFile; \
+ \
+ g_return_if_fail (old_vfs != NULL); \
+ g_return_if_fail (pFile != NULL); \
+ \
+ cFile = (CamelSqlite3File *) pFile; \
+ g_return_if_fail (cFile->old_vfs_file->pMethods != NULL); \
+ cFile->old_vfs_file->pMethods->_nm _call; \
+}
+
def_subclassed (xRead, (sqlite3_file *pFile, gpointer pBuf, gint iAmt, sqlite3_int64 iOfst),
(cFile->old_vfs_file, pBuf, iAmt, iOfst))
def_subclassed (xWrite, (sqlite3_file *pFile, gconstpointer pBuf, gint iAmt, sqlite3_int64 iOfst),
(cFile->old_vfs_file, pBuf, iAmt, iOfst))
def_subclassed (xTruncate, (sqlite3_file *pFile, sqlite3_int64 size), (cFile->old_vfs_file, size))
@@ -195,6 +209,12 @@ def_subclassed (xUnlock, (sqlite3_file *pFile, gint lockType), (cFile->old_vfs_f
def_subclassed (xFileControl, (sqlite3_file *pFile, gint op, gpointer pArg), (cFile->old_vfs_file, op, pArg))
def_subclassed (xSectorSize, (sqlite3_file *pFile), (cFile->old_vfs_file))
def_subclassed (xDeviceCharacteristics, (sqlite3_file *pFile), (cFile->old_vfs_file))
+def_subclassed (xShmMap, (sqlite3_file *pFile, gint iPg, gint pgsz, gint n, void volatile **arr),
(cFile->old_vfs_file, iPg, pgsz, n, arr))
+def_subclassed (xShmLock, (sqlite3_file *pFile, gint offset, gint n, gint flags), (cFile->old_vfs_file,
offset, n, flags))
+def_subclassed_void (xShmBarrier, (sqlite3_file *pFile), (cFile->old_vfs_file))
+def_subclassed (xShmUnmap, (sqlite3_file *pFile, gint deleteFlag), (cFile->old_vfs_file, deleteFlag))
+def_subclassed (xFetch, (sqlite3_file *pFile, sqlite3_int64 iOfst, int iAmt, void **pp),
(cFile->old_vfs_file, iOfst, iAmt, pp))
+def_subclassed (xUnfetch, (sqlite3_file *pFile, sqlite3_int64 iOfst, void *p), (cFile->old_vfs_file, iOfst,
p))
#undef def_subclassed
@@ -343,6 +363,23 @@ camel_sqlite3_vfs_xOpen (sqlite3_vfs *pVfs,
use_subclassed (xFileControl);
use_subclassed (xSectorSize);
use_subclassed (xDeviceCharacteristics);
+
+ if (io_methods.iVersion > 1) {
+ use_subclassed (xShmMap);
+ use_subclassed (xShmLock);
+ use_subclassed (xShmBarrier);
+ use_subclassed (xShmUnmap);
+ }
+
+ if (io_methods.iVersion > 2) {
+ use_subclassed (xFetch);
+ use_subclassed (xUnfetch);
+ }
+
+ if (io_methods.iVersion > 3) {
+ g_warning ("%s: Unchecked IOMethods version %d, downgrading to version 3", G_STRFUNC,
io_methods.iVersion);
+ io_methods.iVersion = 3;
+ }
#undef use_subclassed
}
diff --git a/libebackend/e-sqlite3-vfs.c b/libebackend/e-sqlite3-vfs.c
index 495452a..bc1182d 100644
--- a/libebackend/e-sqlite3-vfs.c
+++ b/libebackend/e-sqlite3-vfs.c
@@ -152,6 +152,19 @@ e_sqlite3_file_ ## _nm _params \
g_return_val_if_fail (cFile->old_vfs_file->pMethods != NULL, SQLITE_ERROR); \
return cFile->old_vfs_file->pMethods->_nm _call; \
}
+#define def_subclassed_void(_nm, _params, _call) \
+static void \
+e_sqlite3_file_ ## _nm _params \
+{ \
+ ESqlite3File *cFile; \
+ \
+ g_return_if_fail (old_vfs != NULL); \
+ g_return_if_fail (pFile != NULL); \
+ \
+ cFile = (ESqlite3File *) pFile; \
+ g_return_if_fail (cFile->old_vfs_file->pMethods != NULL); \
+ cFile->old_vfs_file->pMethods->_nm _call; \
+}
def_subclassed (xRead, (sqlite3_file *pFile, gpointer pBuf, gint iAmt, sqlite3_int64 iOfst),
(cFile->old_vfs_file, pBuf, iAmt, iOfst))
def_subclassed (xWrite, (sqlite3_file *pFile, gconstpointer pBuf, gint iAmt, sqlite3_int64 iOfst),
(cFile->old_vfs_file, pBuf, iAmt, iOfst))
@@ -162,6 +175,12 @@ def_subclassed (xUnlock, (sqlite3_file *pFile, gint lockType), (cFile->old_vfs_f
def_subclassed (xFileControl, (sqlite3_file *pFile, gint op, gpointer pArg), (cFile->old_vfs_file, op, pArg))
def_subclassed (xSectorSize, (sqlite3_file *pFile), (cFile->old_vfs_file))
def_subclassed (xDeviceCharacteristics, (sqlite3_file *pFile), (cFile->old_vfs_file))
+def_subclassed (xShmMap, (sqlite3_file *pFile, gint iPg, gint pgsz, gint n, void volatile **arr),
(cFile->old_vfs_file, iPg, pgsz, n, arr))
+def_subclassed (xShmLock, (sqlite3_file *pFile, gint offset, gint n, gint flags), (cFile->old_vfs_file,
offset, n, flags))
+def_subclassed_void (xShmBarrier, (sqlite3_file *pFile), (cFile->old_vfs_file))
+def_subclassed (xShmUnmap, (sqlite3_file *pFile, gint deleteFlag), (cFile->old_vfs_file, deleteFlag))
+def_subclassed (xFetch, (sqlite3_file *pFile, sqlite3_int64 iOfst, gint iAmt, void **pp),
(cFile->old_vfs_file, iOfst, iAmt, pp))
+def_subclassed (xUnfetch, (sqlite3_file *pFile, sqlite3_int64 iOfst, void *p), (cFile->old_vfs_file, iOfst,
p))
#undef def_subclassed
@@ -306,6 +325,24 @@ e_sqlite3_vfs_xOpen (sqlite3_vfs *pVfs,
use_subclassed (xFileControl);
use_subclassed (xSectorSize);
use_subclassed (xDeviceCharacteristics);
+
+ if (io_methods.iVersion > 1) {
+ use_subclassed (xShmMap);
+ use_subclassed (xShmLock);
+ use_subclassed (xShmBarrier);
+ use_subclassed (xShmUnmap);
+ }
+
+ if (io_methods.iVersion > 2) {
+ use_subclassed (xFetch);
+ use_subclassed (xUnfetch);
+ }
+
+ if (io_methods.iVersion > 3) {
+ g_warning ("%s: Unchecked IOMethods version %d, downgrading to version 3", G_STRFUNC,
io_methods.iVersion);
+ io_methods.iVersion = 3;
+ }
+
#undef use_subclassed
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]