clean up more warnings and errors

This commit is contained in:
bunnie 2022-01-02 15:31:56 +08:00
parent 421a3814d8
commit 350276c08a
4 changed files with 8 additions and 4 deletions

View file

@ -59,4 +59,4 @@ mbbb = []
deterministic = [] deterministic = []
# this flag adds CI tests to the build # this flag adds CI tests to the build
ci = [] ci = []
default = ["mbbb", "deterministic", "ci"] default = ["mbbb"]

View file

@ -887,6 +887,7 @@ impl BasisCache {
Ok(()) Ok(())
} }
#[allow(dead_code)]
pub(crate) fn basis_list(&self) -> Vec<String> { pub(crate) fn basis_list(&self) -> Vec<String> {
let mut ret = Vec::new(); let mut ret = Vec::new();
for bcache in &self.cache { for bcache in &self.cache {
@ -913,6 +914,7 @@ impl BasisCache {
/// note: you can "delete" a basis simply by forgetting its password, but this is more thorough. /// note: you can "delete" a basis simply by forgetting its password, but this is more thorough.
/// there might also need to be a variant to make which is a "change my password" function, but that is actually /// there might also need to be a variant to make which is a "change my password" function, but that is actually
/// surprisingly hard. /// surprisingly hard.
#[allow(dead_code)]
pub(crate) fn basis_delete(&mut self, hw: &mut PddbOs, mut basis: BasisCacheEntry) { pub(crate) fn basis_delete(&mut self, hw: &mut PddbOs, mut basis: BasisCacheEntry) {
let mut temp: [u8; PAGE_SIZE] = [0; PAGE_SIZE]; let mut temp: [u8; PAGE_SIZE] = [0; PAGE_SIZE];
for page in basis.v2p_map.values_mut() { for page in basis.v2p_map.values_mut() {

View file

@ -410,6 +410,8 @@ fn xmain() -> ! {
// OS-specific PDDB driver // OS-specific PDDB driver
let mut pddb_os = PddbOs::new(Rc::clone(&entropy)); let mut pddb_os = PddbOs::new(Rc::clone(&entropy));
// run the CI tests if the option has been selected
#[cfg(all( #[cfg(all(
not(any(target_os = "none", target_os = "xous")), not(any(target_os = "none", target_os = "xous")),
feature = "ci" feature = "ci"

View file

@ -2,8 +2,8 @@ use rand::prelude::*;
use rand_chacha::ChaCha8Rng; use rand_chacha::ChaCha8Rng;
use crate::*; use crate::*;
use core::sync::atomic::{AtomicU64, Ordering}; use core::sync::atomic::{AtomicU64, Ordering};
use std::collections::BTreeSet; use std::collections::{BTreeSet, HashSet};
use std::io::{Result, Error, ErrorKind}; use std::io::Result;
const UPPER_BOUND: usize = 9000; const UPPER_BOUND: usize = 9000;
const LOWER_BOUND: usize = 12; // needs to be big enough to compute murmur3 hash + hold checksum const LOWER_BOUND: usize = 12; // needs to be big enough to compute murmur3 hash + hold checksum
@ -282,7 +282,7 @@ pub(crate) fn delete_pattern(hw: &mut PddbOs, basis_cache: &mut BasisCache,
let (keyname, keydata) = gen_key(dictname, keynum, key_lower_bound, key_upper_bound); let (keyname, keydata) = gen_key(dictname, keynum, key_lower_bound, key_upper_bound);
// now we're ready to write it out // now we're ready to write it out
match basis_cache.key_attributes(hw, dictname, &keyname, None) { match basis_cache.key_attributes(hw, dictname, &keyname, None) {
Ok(ka) => { Ok(_ka) => {
log::warn!("rng collision on keygen: {}, deleting key", keyname); log::warn!("rng collision on keygen: {}, deleting key", keyname);
basis_cache.key_remove(hw, dictname, &keyname, None, false)?; basis_cache.key_remove(hw, dictname, &keyname, None, false)?;
} }