Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

str should not include NULL byte. #21

Merged
merged 2 commits into from
May 22, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 13 additions & 13 deletions ublox/src/ubx_packets/packets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -764,8 +764,8 @@ bitflags! {
flags = "default_for_builder"
)]
struct InfError{
#[ubx(map_type = Option<&str>,
may_fail,
#[ubx(map_type = Option<&str>,
may_fail,
is_valid = inf::is_valid,
from = inf::convert_to_str,
get_as_ref)]
Expand All @@ -780,8 +780,8 @@ struct InfError{
flags = "default_for_builder"
)]
struct InfNotice{
#[ubx(map_type = Option<&str>,
may_fail,
#[ubx(map_type = Option<&str>,
may_fail,
is_valid = inf::is_valid,
from = inf::convert_to_str,
get_as_ref)]
Expand All @@ -796,8 +796,8 @@ struct InfNotice{
flags = "default_for_builder"
)]
struct InfTest{
#[ubx(map_type = Option<&str>,
may_fail,
#[ubx(map_type = Option<&str>,
may_fail,
is_valid = inf::is_valid,
from = inf::convert_to_str,
get_as_ref)]
Expand All @@ -812,8 +812,8 @@ struct InfTest{
flags = "default_for_builder"
)]
struct InfWarning{
#[ubx(map_type = Option<&str>,
may_fail,
#[ubx(map_type = Option<&str>,
may_fail,
is_valid = inf::is_valid,
from = inf::convert_to_str,
get_as_ref)]
Expand All @@ -828,8 +828,8 @@ struct InfWarning{
flags = "default_for_builder"
)]
struct InfDebug{
#[ubx(map_type = Option<&str>,
may_fail,
#[ubx(map_type = Option<&str>,
may_fail,
is_valid = inf::is_valid,
from = inf::convert_to_str,
get_as_ref)]
Expand Down Expand Up @@ -1608,7 +1608,7 @@ struct CfgNavX5 {
reserved8: [u8; 4],
reserved9: [u8; 3],

/// Enable/disable ADR/UDR sensor fusion
/// Enable/disable ADR/UDR sensor fusion
use_adr: u8,
}

Expand Down Expand Up @@ -1783,7 +1783,7 @@ mod mon_ver {
.iter()
.position(|x| *x == 0)
.expect("is_cstr_valid bug?");
core::str::from_utf8(&bytes[0..=null_pos])
core::str::from_utf8(&bytes[0..null_pos])
.expect("is_cstr_valid should have prevented this code from running")
}

Expand All @@ -1794,7 +1794,7 @@ mod mon_ver {
return false;
}
};
core::str::from_utf8(&bytes[0..=null_pos]).is_ok()
core::str::from_utf8(&bytes[0..null_pos]).is_ok()
}

pub(crate) fn is_extension_valid(payload: &[u8]) -> bool {
Expand Down