mirror of
https://github.com/isar/rusqlite.git
synced 2025-09-16 20:52:19 +08:00
Avoid relying on sqlite to justify str::from_utf8_unchecked
This commit is contained in:
committed by
Thom Chiovoloni
parent
1b27ce0541
commit
cf9b6e9ae2
11
src/hooks.rs
11
src/hooks.rs
@@ -188,16 +188,21 @@ impl InnerConnection {
|
||||
let action = Action::from(action_code);
|
||||
let db_name = {
|
||||
let c_slice = CStr::from_ptr(db_str).to_bytes();
|
||||
str::from_utf8_unchecked(c_slice)
|
||||
str::from_utf8(c_slice)
|
||||
};
|
||||
let tbl_name = {
|
||||
let c_slice = CStr::from_ptr(tbl_str).to_bytes();
|
||||
str::from_utf8_unchecked(c_slice)
|
||||
str::from_utf8(c_slice)
|
||||
};
|
||||
|
||||
let _ = catch_unwind(|| {
|
||||
let boxed_hook: *mut F = p_arg as *mut F;
|
||||
(*boxed_hook)(action, db_name, tbl_name, row_id);
|
||||
(*boxed_hook)(
|
||||
action,
|
||||
db_name.expect("illegal db name"),
|
||||
tbl_name.expect("illegal table name"),
|
||||
row_id,
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user