Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rename to just rpm #22

Merged
merged 2 commits into from
Nov 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
[package]
name = "rpm-rs"
version = "0.8.1"
name = "rpm"
version = "0.0.1"
authors = [
"René Richter <richterrettich@gmail.com>",
"Bernhard Schuster <bernhard@ahoi.io>",
"Max Dymond <cmeister2@gmail.com>",
"René Richter <richterrettich@gmail.com>",
"Bernhard Schuster <bernhard@ahoi.io>",
"Max Dymond <cmeister2@gmail.com>",
]
edition = "2018"
license = "Apache-2.0"
description = "A pure rust library for building and parsing RPMs"
homepage = "https://github.com/rpm-rs/rpm-rs"
repository = "https://github.com/rpm-rs/rpm-rs"
homepage = "https://github.com/rpm-rs/rpm"
repository = "https://github.com/rpm-rs/rpm"
readme = "README.md"
keywords = ["RPM", "packaging"]
categories = ["parsing", "development-tools"]
Expand Down
17 changes: 11 additions & 6 deletions src/sequential_cursor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,20 @@ impl<'s> std::io::Read for SeqCursor<'s> {
for cursor in self.cursors.iter_mut() {
let chunk_len = cursor.get_ref().len();
acc_offset += chunk_len;
if self.position < acc_offset as u64 {
let remaining_in_chunk = (acc_offset as u64 - self.position) as usize;
let start = (chunk_len - remaining_in_chunk) as u64;
let fin = std::cmp::min(total_read + remaining_in_chunk, buf.len());
cursor.seek(SeekFrom::Start(start))?;
if self.position <= acc_offset as u64 {
// remaining unread bytes
let rem_unread_in_chunk = (acc_offset as u64 - self.position) as usize;
// seek to the beginning of the currently first unread byte in the
// iterations cursor
cursor.seek(SeekFrom::Start(
chunk_len as u64 - rem_unread_in_chunk as u64,
))?;
let fin = std::cmp::min(total_read + rem_unread_in_chunk, buf.len());
let read = cursor.read(&mut buf[total_read..fin])?;
self.position += read as u64;
total_read += read;
if total_read == buf.len() {
if total_read >= buf.len() {
debug_assert_eq!(total_read, buf.len(), "Always equal. qed");
break;
}
}
Expand Down