Skip to content

Commit

Permalink
Merge pull request dbus2#506 from nagatavit/🐛/zbus_xmlgen_stopping_ea…
Browse files Browse the repository at this point in the history
…rly_in_nested_structures

🐛 zbus_xmlgen: Fix nested signature parser
  • Loading branch information
zeenix authored Nov 7, 2023
2 parents ce40dfb + 47cbdf4 commit f68e0df
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
6 changes: 5 additions & 1 deletion zbus_xmlgen/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,11 @@ fn to_rust_type(ty: &CompleteType, input: bool, as_ref: bool) -> String {
loop {
let c = it.peek().unwrap();
match **c as char {
STRUCT_SIG_END_CHAR | DICT_ENTRY_SIG_END_CHAR => break,
STRUCT_SIG_END_CHAR | DICT_ENTRY_SIG_END_CHAR => {
// consume the closing character
it.next().unwrap();
break;
}
_ => vec.push(iter_to_rust_type(it, input, false)),
}
}
Expand Down
3 changes: 3 additions & 0 deletions zbus_xmlgen/tests/data/sample_object0.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
#[dbus_proxy(interface = "com.example.SampleInterface0", assume_defaults = true)]
trait SampleInterface0 {

/// BarplexSig method
fn barplex_sig(&self, rule: &(&[i32], i32, std::collections::HashMap<&str, &str>, i32, &[i32], i32, &[&str], i32, bool)) -> zbus::Result<Vec<(String, zbus::zvariant::OwnedObjectPath)>>;

/// Bazify method
fn bazify(&self, bar: &(i32, i32, u32)) -> zbus::Result<zbus::zvariant::OwnedValue>;

Expand Down
4 changes: 4 additions & 0 deletions zbus_xmlgen/tests/data/sample_object0.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@
<method name="MogrifyMe">
<arg name="bar" type="(iiav)" direction="in"/>
</method>
<method name="BarplexSig">
<arg direction="in" name="rule" type="(aiia{ss}iaiiasib)"/>
<arg direction="out" type="a(so)"/>
</method>
<signal name="Changed">
<arg name="new_value" type="b"/>
</signal>
Expand Down

0 comments on commit f68e0df

Please sign in to comment.