mirror of
https://github.com/vasi/pixz
synced 2024-11-18 15:26:46 +00:00
Work again without file index
This commit is contained in:
parent
bd678c0924
commit
7fb3234f93
25
pread.c
25
pread.c
@ -95,17 +95,24 @@ static ssize_t tar_read(struct archive *ar, void *ref, const void **bufp) {
|
||||
if (!tar_next_block())
|
||||
return 0;
|
||||
|
||||
size_t off, size;
|
||||
io_block_t *ib = (io_block_t*)(gArItem->data);
|
||||
ssize_t off = gArWanted->start - ib->uoffset, size = gArWanted->size;
|
||||
if (off < 0) {
|
||||
size += off;
|
||||
off = 0;
|
||||
}
|
||||
if (off + size > ib->outsize) {
|
||||
size = ib->outsize - off;
|
||||
gArNextItem = true; // force the end of this block
|
||||
if (gWantedFiles) {
|
||||
off = gArWanted->start - ib->uoffset;
|
||||
size = gArWanted->size;
|
||||
if (off < 0) {
|
||||
size += off;
|
||||
off = 0;
|
||||
}
|
||||
if (off + size > ib->outsize) {
|
||||
size = ib->outsize - off;
|
||||
gArNextItem = true; // force the end of this block
|
||||
} else {
|
||||
gArWanted = gArWanted->next;
|
||||
}
|
||||
} else {
|
||||
gArWanted = gArWanted->next;
|
||||
off = 0;
|
||||
size = ib->outsize;
|
||||
}
|
||||
|
||||
gArLastOffset = off;
|
||||
|
Loading…
Reference in New Issue
Block a user