hm
This commit is contained in:
@@ -146,11 +146,7 @@ impl MathApp {
|
||||
|
||||
fn get_storage_decompressed() -> Option<Vec<u8>> {
|
||||
let data = get_localstorage().get_item(DATA_NAME).ok()??;
|
||||
if crate::misc::HASH_LENGTH >= data.len() {
|
||||
return None;
|
||||
}
|
||||
|
||||
let (commit, cached_data) = crate::misc::hashed_storage_read(data)?;
|
||||
let (commit, cached_data) = crate::misc::hashed_storage_read(&data)?;
|
||||
|
||||
debug_assert!(!commit.is_empty());
|
||||
debug_assert!(!cached_data.is_empty());
|
||||
@@ -188,7 +184,7 @@ impl MathApp {
|
||||
return None;
|
||||
}
|
||||
|
||||
let (commit, func_data) = crate::misc::hashed_storage_read(data)?;
|
||||
let (commit, func_data) = crate::misc::hashed_storage_read(&data)?;
|
||||
|
||||
debug_assert!(!commit.is_empty());
|
||||
debug_assert!(!func_data.is_empty());
|
||||
|
||||
@@ -324,7 +324,7 @@ pub fn hashed_storage_create(hash: HashBytes, data: &[u8]) -> String {
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub fn hashed_storage_read(data: String) -> Option<(HashBytes, Vec<u8>)> {
|
||||
pub fn hashed_storage_read(data: &str) -> Option<(HashBytes, Vec<u8>)> {
|
||||
if HASH_LENGTH >= data.len() {
|
||||
return None;
|
||||
}
|
||||
@@ -335,6 +335,7 @@ pub fn hashed_storage_read(data: String) -> Option<(HashBytes, Vec<u8>)> {
|
||||
}
|
||||
|
||||
// can't use data.as_bytes() here for some reason, seems to break on wasm?
|
||||
// Other memory trickery seems to not worm on wasm. so I was unable to implement a more effecient manner of doing this
|
||||
let decoded_1 = data.chars().map(|c| c as u8).collect::<Vec<u8>>();
|
||||
|
||||
let (hash, cached_data) = {
|
||||
|
||||
Reference in New Issue
Block a user