Change VTabCursor::filter signature

This commit is contained in:
gwenn 2016-08-13 13:12:48 +02:00
parent 59ad638875
commit 0a19cbd16a
3 changed files with 6 additions and 7 deletions

View File

@ -174,8 +174,7 @@ impl VTabCursor<CSVTab> for CSVTabCursor {
fn filter(&mut self, fn filter(&mut self,
_idx_num: libc::c_int, _idx_num: libc::c_int,
_idx_str: *const libc::c_char, _idx_str: *const libc::c_char,
_argc: libc::c_int, _args: &mut[*mut ffi::sqlite3_value])
_argv: *mut *mut ffi::sqlite3_value)
-> Result<()> { -> Result<()> {
{ {
let offset_first_row = self.vtab().offset_first_row; let offset_first_row = self.vtab().offset_first_row;

View File

@ -103,8 +103,7 @@ impl VTabCursor<IntArrayVTab> for IntArrayVTabCursor {
fn filter(&mut self, fn filter(&mut self,
_idx_num: libc::c_int, _idx_num: libc::c_int,
_idx_str: *const libc::c_char, _idx_str: *const libc::c_char,
_argc: libc::c_int, _args: &mut[*mut ffi::sqlite3_value])
_argv: *mut *mut ffi::sqlite3_value)
-> Result<()> { -> Result<()> {
self.i = 0; self.i = 0;
Ok(()) Ok(())

View File

@ -60,8 +60,7 @@ pub trait VTabCursor<V: VTab<Self>>: Sized {
fn filter(&mut self, fn filter(&mut self,
idx_num: libc::c_int, idx_num: libc::c_int,
idx_str: *const libc::c_char, idx_str: *const libc::c_char,
argc: libc::c_int, args: &mut[*mut ffi::sqlite3_value])
argv: *mut *mut ffi::sqlite3_value)
-> Result<()>; -> Result<()>;
/// Advance cursor to the next row of a result set initiated by `filter`. /// Advance cursor to the next row of a result set initiated by `filter`.
fn next(&mut self) -> Result<()>; fn next(&mut self) -> Result<()>;
@ -259,9 +258,11 @@ unsafe extern "C" fn $filter(cursor: *mut ffi::sqlite3_vtab_cursor,
argc: libc::c_int, argc: libc::c_int,
argv: *mut *mut ffi::sqlite3_value) argv: *mut *mut ffi::sqlite3_value)
-> libc::c_int { -> libc::c_int {
use std::slice;
use vtab::cursor_error; use vtab::cursor_error;
let mut args = slice::from_raw_parts_mut(argv, argc as usize);
let cr = cursor as *mut $cursor; let cr = cursor as *mut $cursor;
cursor_error(cursor, (*cr).filter(idx_num, idx_str, argc, argv)) cursor_error(cursor, (*cr).filter(idx_num, idx_str, &mut args))
} }
unsafe extern "C" fn $next(cursor: *mut ffi::sqlite3_vtab_cursor) -> libc::c_int { unsafe extern "C" fn $next(cursor: *mut ffi::sqlite3_vtab_cursor) -> libc::c_int {
use vtab::cursor_error; use vtab::cursor_error;