From 6e9d8eafde3aee5d4bb55f7deab6f1f20d8c0c70 Mon Sep 17 00:00:00 2001 From: gwenn Date: Sun, 4 Jun 2023 10:31:44 +0000 Subject: [PATCH] Fix type of SQLITE_DESERIALIZE_*, SQLITE_PREPARE_*, SQLITE_SERIALIZE_* --- libsqlite3-sys/build.rs | 9 +++++++-- libsqlite3-sys/sqlite3/bindgen_bundled_version.rs | 14 +++++++------- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/libsqlite3-sys/build.rs b/libsqlite3-sys/build.rs index e3d61d4..3009edf 100644 --- a/libsqlite3-sys/build.rs +++ b/libsqlite3-sys/build.rs @@ -499,8 +499,13 @@ mod bindings { struct SqliteTypeChooser; impl ParseCallbacks for SqliteTypeChooser { - fn int_macro(&self, _name: &str, value: i64) -> Option { - if value >= i32::MIN as i64 && value <= i32::MAX as i64 { + fn int_macro(&self, name: &str, value: i64) -> Option { + if name == "SQLITE_SERIALIZE_NOCOPY" + || name.starts_with("SQLITE_DESERIALIZE_") + || name.starts_with("SQLITE_PREPARE_") + { + Some(IntKind::UInt) + } else if value >= i32::MIN as i64 && value <= i32::MAX as i64 { Some(IntKind::I32) } else { None diff --git a/libsqlite3-sys/sqlite3/bindgen_bundled_version.rs b/libsqlite3-sys/sqlite3/bindgen_bundled_version.rs index de8b8b6..83e0e01 100644 --- a/libsqlite3-sys/sqlite3/bindgen_bundled_version.rs +++ b/libsqlite3-sys/sqlite3/bindgen_bundled_version.rs @@ -333,9 +333,9 @@ pub const SQLITE_LIMIT_LIKE_PATTERN_LENGTH: i32 = 8; pub const SQLITE_LIMIT_VARIABLE_NUMBER: i32 = 9; pub const SQLITE_LIMIT_TRIGGER_DEPTH: i32 = 10; pub const SQLITE_LIMIT_WORKER_THREADS: i32 = 11; -pub const SQLITE_PREPARE_PERSISTENT: i32 = 1; -pub const SQLITE_PREPARE_NORMALIZE: i32 = 2; -pub const SQLITE_PREPARE_NO_VTAB: i32 = 4; +pub const SQLITE_PREPARE_PERSISTENT: ::std::os::raw::c_uint = 1; +pub const SQLITE_PREPARE_NORMALIZE: ::std::os::raw::c_uint = 2; +pub const SQLITE_PREPARE_NO_VTAB: ::std::os::raw::c_uint = 4; pub const SQLITE_INTEGER: i32 = 1; pub const SQLITE_FLOAT: i32 = 2; pub const SQLITE_BLOB: i32 = 4; @@ -478,10 +478,10 @@ pub const SQLITE_SCANSTAT_SELECTID: i32 = 5; pub const SQLITE_SCANSTAT_PARENTID: i32 = 6; pub const SQLITE_SCANSTAT_NCYCLE: i32 = 7; pub const SQLITE_SCANSTAT_COMPLEX: i32 = 1; -pub const SQLITE_SERIALIZE_NOCOPY: i32 = 1; -pub const SQLITE_DESERIALIZE_FREEONCLOSE: i32 = 1; -pub const SQLITE_DESERIALIZE_RESIZEABLE: i32 = 2; -pub const SQLITE_DESERIALIZE_READONLY: i32 = 4; +pub const SQLITE_SERIALIZE_NOCOPY: ::std::os::raw::c_uint = 1; +pub const SQLITE_DESERIALIZE_FREEONCLOSE: ::std::os::raw::c_uint = 1; +pub const SQLITE_DESERIALIZE_RESIZEABLE: ::std::os::raw::c_uint = 2; +pub const SQLITE_DESERIALIZE_READONLY: ::std::os::raw::c_uint = 4; pub const NOT_WITHIN: i32 = 0; pub const PARTLY_WITHIN: i32 = 1; pub const FULLY_WITHIN: i32 = 2;