From bee08cbdf10560649d31f4ce6be361b717542298 Mon Sep 17 00:00:00 2001 From: Jeremy Soller Date: Wed, 28 Apr 2021 20:42:59 -0600 Subject: [PATCH] Update dependencies --- Cargo.lock | 14 +++++++------- Cargo.toml | 4 ++-- src/scheme.rs | 13 +++++++------ 3 files changed, 16 insertions(+), 15 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index cc42ae0a07..f6880932c8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -15,7 +15,7 @@ name = "chrono" version = "0.4.19" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.82 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.94 (registry+https://github.com/rust-lang/crates.io-index)", "num-integer 0.1.44 (registry+https://github.com/rust-lang/crates.io-index)", "num-traits 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.44 (registry+https://github.com/rust-lang/crates.io-index)", @@ -24,7 +24,7 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.82" +version = "0.2.94" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -32,7 +32,7 @@ name = "logd" version = "0.1.0" dependencies = [ "chrono 0.4.19 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_syscall 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -54,7 +54,7 @@ dependencies = [ [[package]] name = "redox_syscall" -version = "0.2.4" +version = "0.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -65,7 +65,7 @@ name = "time" version = "0.1.44" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.82 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.94 (registry+https://github.com/rust-lang/crates.io-index)", "wasi 0.10.0+wasi-snapshot-preview1 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -98,10 +98,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum autocfg 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a" "checksum bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693" "checksum chrono 0.4.19 (registry+https://github.com/rust-lang/crates.io-index)" = "670ad68c9088c2a963aaa298cb369688cf3f9465ce5e2d4ca10e6e0098a1ce73" -"checksum libc 0.2.82 (registry+https://github.com/rust-lang/crates.io-index)" = "89203f3fba0a3795506acaad8ebce3c80c0af93f994d5a1d7a0b1eeb23271929" +"checksum libc 0.2.94 (registry+https://github.com/rust-lang/crates.io-index)" = "18794a8ad5b29321f790b55d93dfba91e125cb1a9edbd4f8e3150acc771c1a5e" "checksum num-integer 0.1.44 (registry+https://github.com/rust-lang/crates.io-index)" = "d2cc698a63b549a70bc047073d2949cce27cd1c7b0a4a862d08a8031bc2801db" "checksum num-traits 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)" = "9a64b1ec5cda2586e284722486d802acf1f7dbdc623e2bfc57e65ca1cd099290" -"checksum redox_syscall 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)" = "05ec8ca9416c5ea37062b502703cd7fcb207736bc294f6e0cf367ac6fc234570" +"checksum redox_syscall 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)" = "85dd92e586f7355c633911e11f77f3d12f04b1b1bd76a198bd34ae3af8341ef2" "checksum time 0.1.44 (registry+https://github.com/rust-lang/crates.io-index)" = "6db9e6914ab8b1ae1c260a4ae7a49b6c5611b40328a735b21862567685e73255" "checksum wasi 0.10.0+wasi-snapshot-preview1 (registry+https://github.com/rust-lang/crates.io-index)" = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f" "checksum winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" diff --git a/Cargo.toml b/Cargo.toml index dfc22e0d07..4a4cb14f2b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,5 +4,5 @@ version = "0.1.0" authors = ["Jeremy Soller "] [dependencies] -chrono = "0.4.11" -redox_syscall = "0.2.4" +chrono = "0.4.19" +redox_syscall = "0.2.7" diff --git a/src/scheme.rs b/src/scheme.rs index a6c3677b72..b12d46a746 100644 --- a/src/scheme.rs +++ b/src/scheme.rs @@ -5,7 +5,7 @@ use syscall::error::*; use syscall::scheme::SchemeMut; pub struct LogHandle { - context: Box<[u8]>, + context: Box, buf: Vec, } @@ -24,12 +24,12 @@ impl LogScheme { } impl SchemeMut for LogScheme { - fn open(&mut self, path: &[u8], _flags: usize, _uid: u32, _gid: u32) -> Result { + fn open(&mut self, path: &str, _flags: usize, _uid: u32, _gid: u32) -> Result { let id = self.next_id; self.next_id += 1; self.handles.insert(id, LogHandle { - context: path.to_vec().into_boxed_slice(), + context: path.to_string().into_boxed_str(), buf: Vec::new() }); @@ -64,7 +64,7 @@ impl SchemeMut for LogScheme { if handle.buf.is_empty() { let timestamp = Local::now(); let _ = write!(handle.buf, "{}", timestamp.format("%F %T%.f ")); - handle.buf.extend_from_slice(&handle.context); + handle.buf.extend_from_slice(handle.context.as_bytes()); handle.buf.extend_from_slice(b": "); } @@ -101,8 +101,9 @@ impl SchemeMut for LogScheme { } let mut j = 0; - while i < buf.len() && j < handle.context.len() { - buf[i] = handle.context[j]; + let context_bytes = handle.context.as_bytes(); + while i < buf.len() && j < context_bytes.len() { + buf[i] = context_bytes[j]; i += 1; j += 1; }