From 1da576fd0af93b82d9c1d4ddf29c2a6638b5467d Mon Sep 17 00:00:00 2001 From: Micah Snyder Date: Wed, 13 Dec 2023 20:04:02 -0500 Subject: [PATCH] Fix C/Rust FFI pointer type to resolve arm64 compatibility issue and update generated sys.rs --- libclamav_rust/src/sys.rs | 59 +++++++++++++++++++------------------- libclamav_rust/src/util.rs | 2 +- 2 files changed, 31 insertions(+), 30 deletions(-) diff --git a/libclamav_rust/src/sys.rs b/libclamav_rust/src/sys.rs index ccac0bb1de..6400b911ba 100644 --- a/libclamav_rust/src/sys.rs +++ b/libclamav_rust/src/sys.rs @@ -379,35 +379,36 @@ pub const cli_file_CL_TYPE_OOXML_HWP: cli_file = 551; pub const cli_file_CL_TYPE_PS: cli_file = 552; pub const cli_file_CL_TYPE_EGG: cli_file = 553; pub const cli_file_CL_TYPE_ONENOTE: cli_file = 554; -pub const cli_file_CL_TYPE_PART_ANY: cli_file = 555; -pub const cli_file_CL_TYPE_PART_HFSPLUS: cli_file = 556; -pub const cli_file_CL_TYPE_MBR: cli_file = 557; -pub const cli_file_CL_TYPE_HTML: cli_file = 558; -pub const cli_file_CL_TYPE_MAIL: cli_file = 559; -pub const cli_file_CL_TYPE_SFX: cli_file = 560; -pub const cli_file_CL_TYPE_ZIPSFX: cli_file = 561; -pub const cli_file_CL_TYPE_RARSFX: cli_file = 562; -pub const cli_file_CL_TYPE_7ZSFX: cli_file = 563; -pub const cli_file_CL_TYPE_CABSFX: cli_file = 564; -pub const cli_file_CL_TYPE_ARJSFX: cli_file = 565; -pub const cli_file_CL_TYPE_EGGSFX: cli_file = 566; -pub const cli_file_CL_TYPE_NULSFT: cli_file = 567; -pub const cli_file_CL_TYPE_AUTOIT: cli_file = 568; -pub const cli_file_CL_TYPE_ISHIELD_MSI: cli_file = 569; -pub const cli_file_CL_TYPE_ISO9660: cli_file = 570; -pub const cli_file_CL_TYPE_DMG: cli_file = 571; -pub const cli_file_CL_TYPE_GPT: cli_file = 572; -pub const cli_file_CL_TYPE_APM: cli_file = 573; -pub const cli_file_CL_TYPE_XDP: cli_file = 574; -pub const cli_file_CL_TYPE_XML_WORD: cli_file = 575; -pub const cli_file_CL_TYPE_XML_XL: cli_file = 576; -pub const cli_file_CL_TYPE_XML_HWP: cli_file = 577; -pub const cli_file_CL_TYPE_HWPOLE2: cli_file = 578; -pub const cli_file_CL_TYPE_MHTML: cli_file = 579; -pub const cli_file_CL_TYPE_LNK: cli_file = 580; -pub const cli_file_CL_TYPE_UDF: cli_file = 581; -pub const cli_file_CL_TYPE_OTHER: cli_file = 582; -pub const cli_file_CL_TYPE_IGNORED: cli_file = 583; +pub const cli_file_CL_TYPE_PYTHON_COMPILED: cli_file = 555; +pub const cli_file_CL_TYPE_PART_ANY: cli_file = 556; +pub const cli_file_CL_TYPE_PART_HFSPLUS: cli_file = 557; +pub const cli_file_CL_TYPE_MBR: cli_file = 558; +pub const cli_file_CL_TYPE_HTML: cli_file = 559; +pub const cli_file_CL_TYPE_MAIL: cli_file = 560; +pub const cli_file_CL_TYPE_SFX: cli_file = 561; +pub const cli_file_CL_TYPE_ZIPSFX: cli_file = 562; +pub const cli_file_CL_TYPE_RARSFX: cli_file = 563; +pub const cli_file_CL_TYPE_7ZSFX: cli_file = 564; +pub const cli_file_CL_TYPE_CABSFX: cli_file = 565; +pub const cli_file_CL_TYPE_ARJSFX: cli_file = 566; +pub const cli_file_CL_TYPE_EGGSFX: cli_file = 567; +pub const cli_file_CL_TYPE_NULSFT: cli_file = 568; +pub const cli_file_CL_TYPE_AUTOIT: cli_file = 569; +pub const cli_file_CL_TYPE_ISHIELD_MSI: cli_file = 570; +pub const cli_file_CL_TYPE_ISO9660: cli_file = 571; +pub const cli_file_CL_TYPE_DMG: cli_file = 572; +pub const cli_file_CL_TYPE_GPT: cli_file = 573; +pub const cli_file_CL_TYPE_APM: cli_file = 574; +pub const cli_file_CL_TYPE_XDP: cli_file = 575; +pub const cli_file_CL_TYPE_XML_WORD: cli_file = 576; +pub const cli_file_CL_TYPE_XML_XL: cli_file = 577; +pub const cli_file_CL_TYPE_XML_HWP: cli_file = 578; +pub const cli_file_CL_TYPE_HWPOLE2: cli_file = 579; +pub const cli_file_CL_TYPE_MHTML: cli_file = 580; +pub const cli_file_CL_TYPE_LNK: cli_file = 581; +pub const cli_file_CL_TYPE_UDF: cli_file = 582; +pub const cli_file_CL_TYPE_OTHER: cli_file = 583; +pub const cli_file_CL_TYPE_IGNORED: cli_file = 584; pub type cli_file = ::std::os::raw::c_uint; pub use self::cli_file as cli_file_t; #[repr(C)] diff --git a/libclamav_rust/src/util.rs b/libclamav_rust/src/util.rs index 47f2d8b4b3..fd15c3fe36 100644 --- a/libclamav_rust/src/util.rs +++ b/libclamav_rust/src/util.rs @@ -55,7 +55,7 @@ pub fn file_from_fd_or_handle(fd: i32) -> File { /// exceeds the lifetime of the output string. /// /// ptr must be a valid pointer to a C string. -pub unsafe fn str_from_ptr(ptr: *const i8) -> Result, std::str::Utf8Error> { +pub unsafe fn str_from_ptr(ptr: *const ::std::os::raw::c_char) -> Result, std::str::Utf8Error> { if ptr.is_null() { return Ok(None); }