Skip to content

Commit

Permalink
Fix NbglGenericReview
Browse files Browse the repository at this point in the history
  • Loading branch information
yogh333 committed Sep 9, 2024
1 parent 3446a42 commit 393c8bc
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions ledger_device_sdk/src/nbgl/nbgl_generic_review.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,8 @@ impl InfoButton {
/// using the NbglGenericReview struct.
pub struct TagValueList {
pairs: Vec<nbgl_contentTagValue_t>,
items: Vec<CString>,
values: Vec<CString>,
nb_max_lines_for_value: u8,
small_case_for_value: bool,
wrapping: bool,
Expand All @@ -124,6 +126,8 @@ impl TagValueList {
wrapping: bool,
) -> TagValueList {
let mut c_field_strings: Vec<nbgl_contentTagValue_t> = Vec::with_capacity(pairs.len());
let mut c_field_names: Vec<CString> = Vec::with_capacity(pairs.len());
let mut c_field_values: Vec<CString> = Vec::with_capacity(pairs.len());
for field in pairs {
let name = CString::new(field.name).unwrap();
let value = CString::new(field.value).unwrap();
Expand All @@ -133,9 +137,13 @@ impl TagValueList {
..Default::default()
};
c_field_strings.push(tag_value);
c_field_names.push(name);
c_field_values.push(value);
}
TagValueList {
pairs: c_field_strings,
items: c_field_names,
values: c_field_values,
nb_max_lines_for_value,
small_case_for_value,
wrapping,
Expand Down Expand Up @@ -191,6 +199,7 @@ impl TagValueConfirm {
/// when using the NbglGenericReview struct.
pub struct InfosList {
info_types_cstrings: Vec<CString>,
info_contents_cstrings: Vec<CString>,
info_types_ptr: Vec<*const c_char>,
info_contents_ptr: Vec<*const c_char>,
}
Expand All @@ -211,6 +220,7 @@ impl InfosList {
info_contents_cstrings.iter().map(|s| s.as_ptr()).collect();
InfosList {
info_types_cstrings: info_types_cstrings,
info_contents_cstrings: info_contents_cstrings,
info_types_ptr: info_types_ptr,
info_contents_ptr: info_contents_ptr,
}
Expand Down

0 comments on commit 393c8bc

Please sign in to comment.