[vlc-commits] [Git][videolan/vlc][master] vlcrs-macros: module: fix int usage in variadics

Steve Lhomme (@robUx4) gitlab at videolan.org
Sat Feb 22 14:47:27 UTC 2025



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
6ff47780 by Alexandre Janniaux at 2025-02-22T14:26:57+00:00
vlcrs-macros: module: fix int usage in variadics

On the C side, the category is read as an int type:

```c
        /* src/modules/entry.c */
        case VLC_CONFIG_CREATE:
        {
            int type = va_arg (ap, int);
```

On the Rust side, it is then incorrect to inject an i64:

```rust
        vlc_set(
                opaque,
                ::std::ptr::null_mut(),
                ::vlcrs_core::plugin::ModuleProperties::CONFIG_CREATE as _,
                // incorrect
                ::vlcrs_core::plugin::ConfigModule::SUBCATEGORY as i64,
                &mut config as *mut *mut ::vlcrs_core::plugin::vlc_param,
        )
```

It fixes such ABI error, and in particular a crash on android armv7.

- - - - -


1 changed file:

- src/rust/vlcrs-macros/src/module.rs


Changes:

=====================================
src/rust/vlcrs-macros/src/module.rs
=====================================
@@ -606,7 +606,7 @@ fn generate_module_code(module_info: &ModuleInfo) -> TokenStream2 {
                     opaque,
                     ::std::ptr::null_mut(),
                     ::vlcrs_core::plugin::ModuleProperties::CONFIG_CREATE as _,
-                    ::vlcrs_core::plugin::ConfigModule::SUBCATEGORY as i64,
+                    ::vlcrs_core::plugin::ConfigModule::SUBCATEGORY as std::ffi::c_int,
                     &mut config as *mut *mut ::vlcrs_core::plugin::vlc_param,
                 )
             } != 0
@@ -618,7 +618,7 @@ fn generate_module_code(module_info: &ModuleInfo) -> TokenStream2 {
                     opaque,
                     config as _,
                     ::vlcrs_core::plugin::ModuleProperties::CONFIG_VALUE as _,
-                    ::vlcrs_core::plugin::ConfigSubcategory::#category as i64,
+                    ::vlcrs_core::plugin::ConfigSubcategory::#category as std::ffi::c_int,
                 )
             } != 0
             {
@@ -665,7 +665,7 @@ fn generate_module_code(module_info: &ModuleInfo) -> TokenStream2 {
                             opaque,
                             ::std::ptr::null_mut(),
                             ::vlcrs_core::plugin::ModuleProperties::CONFIG_CREATE as _,
-                            ::vlcrs_core::plugin::ConfigModule::SECTION as i64,
+                            ::vlcrs_core::plugin::ConfigModule::SECTION as std::ffi::c_int,
                             &mut config as *mut *mut ::vlcrs_core::plugin::vlc_param,
                         )
                     } != 0
@@ -763,7 +763,7 @@ fn generate_module_code(module_info: &ModuleInfo) -> TokenStream2 {
                         opaque,
                         ::std::ptr::null_mut(),
                         ::vlcrs_core::plugin::ModuleProperties::CONFIG_CREATE as _,
-                        #item_type as i64,
+                        #item_type as std::ffi::c_int,
                         &mut config as *mut *mut ::vlcrs_core::plugin::vlc_param,
                     )
                 } != 0



View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/6ff47780a40332671a0d3b5ba0fad0fb45e03b20

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/6ff47780a40332671a0d3b5ba0fad0fb45e03b20
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the vlc-commits mailing list