diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-30 18:31:44 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-30 18:31:44 +0000 |
commit | c23a457e72abe608715ac76f076f47dc42af07a5 (patch) | |
tree | 2772049aaf84b5c9d0ed12ec8d86812f7a7904b6 /vendor/gix-odb/src/sink.rs | |
parent | Releasing progress-linux version 1.73.0+dfsg1-1~progress7.99u1. (diff) | |
download | rustc-c23a457e72abe608715ac76f076f47dc42af07a5.tar.xz rustc-c23a457e72abe608715ac76f076f47dc42af07a5.zip |
Merging upstream version 1.74.1+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'vendor/gix-odb/src/sink.rs')
-rw-r--r-- | vendor/gix-odb/src/sink.rs | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/vendor/gix-odb/src/sink.rs b/vendor/gix-odb/src/sink.rs index 44a406151..f6334a51c 100644 --- a/vendor/gix-odb/src/sink.rs +++ b/vendor/gix-odb/src/sink.rs @@ -21,14 +21,12 @@ impl Sink { } impl crate::traits::Write for Sink { - type Error = io::Error; - fn write_stream( &self, kind: gix_object::Kind, size: u64, - mut from: impl io::Read, - ) -> Result<gix_hash::ObjectId, Self::Error> { + from: &mut dyn io::Read, + ) -> Result<gix_hash::ObjectId, crate::write::Error> { let mut size = size.try_into().expect("object size to fit into usize"); let mut buf = [0u8; 8096]; let header = gix_object::encode::loose_header(kind, size); @@ -42,18 +40,18 @@ impl crate::traits::Write for Sink { let mut hasher = gix_features::hash::hasher(self.object_hash); hasher.update(&header); - possibly_compress(&header)?; + possibly_compress(&header).map_err(Box::new)?; while size != 0 { let bytes = size.min(buf.len()); - from.read_exact(&mut buf[..bytes])?; + from.read_exact(&mut buf[..bytes]).map_err(Box::new)?; hasher.update(&buf[..bytes]); - possibly_compress(&buf[..bytes])?; + possibly_compress(&buf[..bytes]).map_err(Box::new)?; size -= bytes; } if let Some(compressor) = self.compressor.as_ref() { let mut c = compressor.borrow_mut(); - c.flush()?; + c.flush().map_err(Box::new)?; c.reset(); } |