From e4b17f9473f88c3acd98e22b5a7e5e3d18b478ec Mon Sep 17 00:00:00 2001 From: pca006132 Date: Mon, 15 Jun 2020 10:40:27 +0800 Subject: [PATCH] Fixed incorrect byte_addr after multiple block read... --- src/runtime/src/sd_reader.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/runtime/src/sd_reader.rs b/src/runtime/src/sd_reader.rs index f810405..4400501 100644 --- a/src/runtime/src/sd_reader.rs +++ b/src/runtime/src/sd_reader.rs @@ -185,6 +185,7 @@ impl<'a> Read for SdReader<'a> { // we have to allow partial read, as per the trait required return Ok(a.len()); } + self.byte_addr += b.len() as u32; } if let Err(_) = self.read_unaligned(c) { // we have to allow partial read, as per the trait required @@ -229,6 +230,7 @@ impl<'a> Write for SdReader<'a> { ) { return Ok(a.len()); } + self.byte_addr += b.len() as u32; } if let Err(_) = self.write_unaligned(c) { return Ok(a.len() + b.len()); @@ -283,4 +285,3 @@ impl<'a> Drop for SdReader<'a> { self.flush().unwrap_or(()); } } -