Skip to content

Commit

Permalink
Remove null terminators from other extensions
Browse files Browse the repository at this point in the history
  • Loading branch information
rasmusgo committed May 7, 2024
1 parent b06d06c commit 43af161
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
6 changes: 5 additions & 1 deletion generator/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1518,7 +1518,11 @@ impl Parser {
#(#ext_set_inits)*
bytes => {
if let Ok(name) = std::str::from_utf8(bytes) {
out.other.push(name.into());
if bytes.last() == Some(&0) {
out.other.push(name[0..(bytes.len() - 1)].into());
} else {
out.other.push(name.into());
}
}
}
}
Expand Down
6 changes: 5 additions & 1 deletion openxr/src/generated.rs
Original file line number Diff line number Diff line change
Expand Up @@ -687,7 +687,11 @@ impl ExtensionSet {
}
bytes => {
if let Ok(name) = std::str::from_utf8(bytes) {
out.other.push(name.into());
if bytes.last() == Some(&0) {
out.other.push(name[0..(bytes.len() - 1)].into());
} else {
out.other.push(name.into());
}
}
}
}
Expand Down

0 comments on commit 43af161

Please sign in to comment.