rust-lv2 icon indicating copy to clipboard operation
rust-lv2 copied to clipboard

atom: tests: Don't assume char signedness

Open andhe opened this issue 2 years ago • 1 comments

For example on aarch64/arm64:

error[E0308]: mismatched types
  --> tests/atom_integration.rs:91:14
   |
91 |         URI: LV2Map::URI.as_ptr() as *const i8,
   |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `*const u8`, found `*const i8`
   |
   = note: expected raw pointer `*const u8`
              found raw pointer `*const i8`

error[E0308]: mismatched types
   --> tests/atom_integration.rs:144:13
    |
141 |         let plugin = (plugin_descriptor.instantiate.unwrap())(
    |                      ---------------------------------------- arguments to this function are incorrect
...
144 |             b"\0".as_ptr() as *const i8,
    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `*const u8`, found `*const i8`
    |
    = note: expected raw pointer `*const u8`
               found raw pointer `*const i8`

For more information about this error, try `rustc --explain E0308`.
error: could not compile `lv2-atom` due to 2 previous errors

andhe avatar Dec 14 '23 11:12 andhe

This looks good to me: the field URI of the struct LV2_Feature has type *const c_char, but we're passing a *const i8. On machines where c_char is defined as i8, this will work, but on other machines it will not. As far as I understand, this pull request will resolve that issue.

I don't have merging powers, but I have no objections against approving this PR.

PieterPenninckx avatar Dec 18 '23 10:12 PieterPenninckx