mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-19 09:00:54 +00:00
fix lines that missed the regex in DNS
This commit is contained in:
parent
15aaf55e93
commit
e423bfd347
3 changed files with 23 additions and 23 deletions
|
|
@ -27,7 +27,7 @@ impl Dns {
|
||||||
if let Ok(simple_ip) = name.parse::<IpAddr>() {
|
if let Ok(simple_ip) = name.parse::<IpAddr>() {
|
||||||
Ok(NetIpAddr::from(simple_ip))
|
Ok(NetIpAddr::from(simple_ip))
|
||||||
} else {
|
} else {
|
||||||
let alloc_name = String::<DNS_NAME_LENGTH_LIMIT>::from_str(name);
|
let alloc_name = String::from(name);
|
||||||
let mut buf = Buffer::into_buf(alloc_name).or(Err(DnsResponseCode::UnknownError))?;
|
let mut buf = Buffer::into_buf(alloc_name).or(Err(DnsResponseCode::UnknownError))?;
|
||||||
buf.lend_mut(self.conn, Opcode::Lookup.to_u32().unwrap())
|
buf.lend_mut(self.conn, Opcode::Lookup.to_u32().unwrap())
|
||||||
.or(Err(DnsResponseCode::UnknownError))?;
|
.or(Err(DnsResponseCode::UnknownError))?;
|
||||||
|
|
|
||||||
|
|
@ -542,7 +542,7 @@ fn main() -> ! {
|
||||||
Some(Opcode::Lookup) => {
|
Some(Opcode::Lookup) => {
|
||||||
let mut buf =
|
let mut buf =
|
||||||
unsafe { Buffer::from_memory_message_mut(msg.body.memory_message_mut().unwrap()) };
|
unsafe { Buffer::from_memory_message_mut(msg.body.memory_message_mut().unwrap()) };
|
||||||
let name = buf.to_original::<String<DNS_NAME_LENGTH_LIMIT>, _>().unwrap();
|
let name = buf.to_original::<String, _>().unwrap();
|
||||||
let name_std = std::string::String::from(name.as_str());
|
let name_std = std::string::String::from(name.as_str());
|
||||||
if let Some(cache_entry) = dns_cache.get(&name_std) {
|
if let Some(cache_entry) = dns_cache.get(&name_std) {
|
||||||
// pick a random entry
|
// pick a random entry
|
||||||
|
|
|
||||||
|
|
@ -822,105 +822,105 @@ pub(crate) enum ValidatorOp {
|
||||||
UxSeconds,
|
UxSeconds,
|
||||||
}
|
}
|
||||||
|
|
||||||
fn tz_ux_validator(input: TextEntryPayload) -> Option<ValidatorErr> {
|
fn tz_ux_validator(input: &TextEntryPayload) -> Option<ValidatorErr> {
|
||||||
let text_str = input.as_str();
|
let text_str = input.as_str();
|
||||||
|
|
||||||
match simple_kilofloat_parse(text_str) {
|
match simple_kilofloat_parse(text_str) {
|
||||||
Ok(input) => {
|
Ok(input) => {
|
||||||
if input < -12_000 || input > 14_000 {
|
if input < -12_000 || input > 14_000 {
|
||||||
return Some(ValidatorErr::from_str(t!("rtc.range_err", locales::LANG)));
|
return Some(ValidatorErr::from(t!("rtc.range_err", locales::LANG)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_ => return Some(ValidatorErr::from_str(t!("rtc.integer_err", locales::LANG))),
|
_ => return Some(ValidatorErr::from(t!("rtc.integer_err", locales::LANG))),
|
||||||
}
|
}
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
|
|
||||||
fn rtc_ux_validate_month(input: TextEntryPayload) -> Option<ValidatorErr> {
|
fn rtc_ux_validate_month(input: &TextEntryPayload) -> Option<ValidatorErr> {
|
||||||
let text_str = input.as_str();
|
let text_str = input.as_str();
|
||||||
|
|
||||||
let input = match text_str.parse::<u32>() {
|
let input = match text_str.parse::<u32>() {
|
||||||
Ok(input_int) => input_int,
|
Ok(input_int) => input_int,
|
||||||
_ => return Some(ValidatorErr::from_str(t!("rtc.integer_err", locales::LANG))),
|
_ => return Some(ValidatorErr::from(t!("rtc.integer_err", locales::LANG))),
|
||||||
};
|
};
|
||||||
|
|
||||||
if input < 1 || input > 12 {
|
if input < 1 || input > 12 {
|
||||||
return Some(ValidatorErr::from_str(t!("rtc.range_err", locales::LANG)));
|
return Some(ValidatorErr::from(t!("rtc.range_err", locales::LANG)));
|
||||||
}
|
}
|
||||||
|
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
|
|
||||||
fn rtc_ux_validate_day(input: TextEntryPayload) -> Option<ValidatorErr> {
|
fn rtc_ux_validate_day(input: &TextEntryPayload) -> Option<ValidatorErr> {
|
||||||
let text_str = input.as_str();
|
let text_str = input.as_str();
|
||||||
|
|
||||||
let input = match text_str.parse::<u32>() {
|
let input = match text_str.parse::<u32>() {
|
||||||
Ok(input_int) => input_int,
|
Ok(input_int) => input_int,
|
||||||
_ => return Some(ValidatorErr::from_str(t!("rtc.integer_err", locales::LANG))),
|
_ => return Some(ValidatorErr::from(t!("rtc.integer_err", locales::LANG))),
|
||||||
};
|
};
|
||||||
|
|
||||||
if input < 1 || input > 31 {
|
if input < 1 || input > 31 {
|
||||||
return Some(ValidatorErr::from_str(t!("rtc.range_err", locales::LANG)));
|
return Some(ValidatorErr::from(t!("rtc.range_err", locales::LANG)));
|
||||||
}
|
}
|
||||||
|
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
|
|
||||||
fn rtc_ux_validate_year(input: TextEntryPayload) -> Option<ValidatorErr> {
|
fn rtc_ux_validate_year(input: &TextEntryPayload) -> Option<ValidatorErr> {
|
||||||
let text_str = input.as_str();
|
let text_str = input.as_str();
|
||||||
|
|
||||||
let input = match text_str.parse::<u32>() {
|
let input = match text_str.parse::<u32>() {
|
||||||
Ok(input_int) => input_int,
|
Ok(input_int) => input_int,
|
||||||
_ => return Some(ValidatorErr::from_str(t!("rtc.integer_err", locales::LANG))),
|
_ => return Some(ValidatorErr::from(t!("rtc.integer_err", locales::LANG))),
|
||||||
};
|
};
|
||||||
|
|
||||||
if input > 99 {
|
if input > 99 {
|
||||||
return Some(ValidatorErr::from_str(t!("rtc.range_err", locales::LANG)));
|
return Some(ValidatorErr::from(t!("rtc.range_err", locales::LANG)));
|
||||||
}
|
}
|
||||||
|
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
|
|
||||||
fn rtc_ux_validate_hour(input: TextEntryPayload) -> Option<ValidatorErr> {
|
fn rtc_ux_validate_hour(input: &TextEntryPayload) -> Option<ValidatorErr> {
|
||||||
let text_str = input.as_str();
|
let text_str = input.as_str();
|
||||||
|
|
||||||
let input = match text_str.parse::<u32>() {
|
let input = match text_str.parse::<u32>() {
|
||||||
Ok(input_int) => input_int,
|
Ok(input_int) => input_int,
|
||||||
_ => return Some(ValidatorErr::from_str(t!("rtc.integer_err", locales::LANG))),
|
_ => return Some(ValidatorErr::from(t!("rtc.integer_err", locales::LANG))),
|
||||||
};
|
};
|
||||||
|
|
||||||
if input > 23 {
|
if input > 23 {
|
||||||
return Some(ValidatorErr::from_str(t!("rtc.range_err", locales::LANG)));
|
return Some(ValidatorErr::from(t!("rtc.range_err", locales::LANG)));
|
||||||
}
|
}
|
||||||
|
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
|
|
||||||
fn rtc_ux_validate_minute(input: TextEntryPayload) -> Option<ValidatorErr> {
|
fn rtc_ux_validate_minute(input: &TextEntryPayload) -> Option<ValidatorErr> {
|
||||||
let text_str = input.as_str();
|
let text_str = input.as_str();
|
||||||
|
|
||||||
let input = match text_str.parse::<u32>() {
|
let input = match text_str.parse::<u32>() {
|
||||||
Ok(input_int) => input_int,
|
Ok(input_int) => input_int,
|
||||||
_ => return Some(ValidatorErr::from_str(t!("rtc.integer_err", locales::LANG))),
|
_ => return Some(ValidatorErr::from(t!("rtc.integer_err", locales::LANG))),
|
||||||
};
|
};
|
||||||
|
|
||||||
if input > 59 {
|
if input > 59 {
|
||||||
return Some(ValidatorErr::from_str(t!("rtc.range_err", locales::LANG)));
|
return Some(ValidatorErr::from(t!("rtc.range_err", locales::LANG)));
|
||||||
}
|
}
|
||||||
|
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
|
|
||||||
fn rtc_ux_validate_seconds(input: TextEntryPayload) -> Option<ValidatorErr> {
|
fn rtc_ux_validate_seconds(input: &TextEntryPayload) -> Option<ValidatorErr> {
|
||||||
let text_str = input.as_str();
|
let text_str = input.as_str();
|
||||||
|
|
||||||
let input = match text_str.parse::<u32>() {
|
let input = match text_str.parse::<u32>() {
|
||||||
Ok(input_int) => input_int,
|
Ok(input_int) => input_int,
|
||||||
_ => return Some(ValidatorErr::from_str(t!("rtc.integer_err", locales::LANG))),
|
_ => return Some(ValidatorErr::from(t!("rtc.integer_err", locales::LANG))),
|
||||||
};
|
};
|
||||||
|
|
||||||
if input > 59 {
|
if input > 59 {
|
||||||
return Some(ValidatorErr::from_str(t!("rtc.range_err", locales::LANG)));
|
return Some(ValidatorErr::from(t!("rtc.range_err", locales::LANG)));
|
||||||
}
|
}
|
||||||
|
|
||||||
None
|
None
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue