From d623913535906739c31dc9838cdf1db4b975fb46 Mon Sep 17 00:00:00 2001 From: pca006132 Date: Wed, 4 Nov 2020 20:47:40 +0800 Subject: [PATCH] libconfig: fixed szl build. to_lowercase would handle unicode which causes a huge increase in rodata size, we have to use to_ascii_lowercase. --- libconfig/src/lib.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libconfig/src/lib.rs b/libconfig/src/lib.rs index d0543a9..e5eaac0 100644 --- a/libconfig/src/lib.rs +++ b/libconfig/src/lib.rs @@ -56,9 +56,9 @@ fn parse_config<'a>( buffer: &mut Vec, file: fatfs::File, ) -> Result<'a, ()> { - let prefix = [key, "="].concat().to_lowercase(); + let prefix = [key, "="].concat().to_ascii_lowercase(); for line in BufReader::new(file).lines() { - let line = line?.to_lowercase(); + let line = line?.to_ascii_lowercase(); if line.starts_with(&prefix) { buffer.extend(line[prefix.len()..].as_bytes()); return Ok(()); @@ -121,7 +121,7 @@ impl Config { match root_dir.remove(&["/CONFIG/", key, ".BIN"].concat()) { Ok(()) => Ok(()), Err(_) => { - let prefix = [key, "="].concat().to_lowercase(); + let prefix = [key, "="].concat().to_ascii_lowercase(); match root_dir.create_file("/CONFIG.TXT") { Ok(mut f) => { let mut buffer = String::new(); @@ -129,7 +129,7 @@ impl Config { f.seek(SeekFrom::Start(0))?; f.truncate()?; for line in buffer.lines() { - if line.len() > 0 && !line.to_lowercase().starts_with(&prefix) { + if line.len() > 0 && !line.to_ascii_lowercase().starts_with(&prefix) { f.write(line.as_bytes())?; f.write(NEWLINE)?; }