Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
m00sey committed Feb 9, 2023
1 parent d250457 commit 4cf13ab
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/core/indexer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,7 @@ impl Indexer {
return err!(Error::EmptyMaterial("empty code".to_string()));
}

let code = code.to_string();
let szg = tables::sizage(&code)?;
let szg = tables::sizage(code)?;

// both hard + soft code size
let cs = szg.hs + szg.ss;
Expand All @@ -66,14 +65,14 @@ impl Indexer {
}
}

if CurrentSigCodex::has_code(&code) && ondex.is_some() {
if CurrentSigCodex::has_code(code) && ondex.is_some() {
return err!(Error::InvalidVarIndex(format!(
"Non None ondex '{o}' for code '{code}'",
o = ondex.unwrap()
)));
}

if BothSigCodex::has_code(&code) {
if BothSigCodex::has_code(code) {
if ondex.is_none() {
// when not provided make ondex match index
ondex = Some(index);
Expand Down Expand Up @@ -113,7 +112,7 @@ impl Indexer {
)));
}

Ok(Indexer { code, raw: raw[..rize as usize].to_vec(), index, ondex })
Ok(Indexer { code: code.to_string(), raw: raw[..rize as usize].to_vec(), index, ondex })
}

pub fn new_with_qb64(qb64: &str) -> Result<Self> {
Expand Down Expand Up @@ -169,7 +168,7 @@ impl Indexer {
}

let index = util::b64_to_u32(&qb64[hs..(hs + ms as usize)])?;
let odx = &qb64[(hs + ms as usize)..(hs + ms as usize + szg.os as usize)];
let odx = &qb64[(hs + ms as usize)..(hs + (ms + szg.os) as usize)];

let mut ondex: Option<u32> = None;
if CurrentSigCodex::has_code(hard) {
Expand Down

0 comments on commit 4cf13ab

Please sign in to comment.