mirror of
https://github.com/ckolivas/lrzip.git
synced 2025-12-06 07:12:00 +01:00
Remove seeks that aren't required and don't work on tmp input buffers.
Clean up open_stream_in.
This commit is contained in:
parent
c832e80085
commit
3a8c0b6689
7
runzip.c
7
runzip.c
|
|
@ -299,7 +299,7 @@ static i64 runzip_chunk(rzip_control *control, int fd_in, int fd_out, int fd_his
|
|||
print_maxverbose("Checksum for block: 0x%08x\n", cksum);
|
||||
}
|
||||
|
||||
if (unlikely(close_stream_in(control, ss)))
|
||||
if (unlikely(close_stream_in(ss)))
|
||||
fatal("Failed to close stream!\n");
|
||||
|
||||
return total;
|
||||
|
|
@ -336,9 +336,12 @@ i64 runzip_fd(rzip_control *control, int fd_in, int fd_out, int fd_hist, i64 exp
|
|||
|
||||
md5_finish_ctx (&control->ctx, md5_resblock);
|
||||
if (HAS_MD5) {
|
||||
#if 0
|
||||
/* Unnecessary, we should already be there */
|
||||
if (unlikely(lseek(fd_in, -MD5_DIGEST_SIZE, SEEK_END)) == -1)
|
||||
fatal("Failed to seek to md5 data in runzip_fd\n");
|
||||
if (unlikely(read(fd_in, md5_stored, MD5_DIGEST_SIZE) != MD5_DIGEST_SIZE))
|
||||
#endif
|
||||
if (unlikely(read_1g(control, fd_in, md5_stored, MD5_DIGEST_SIZE) != MD5_DIGEST_SIZE))
|
||||
fatal("Failed to read md5 data in runzip_fd\n");
|
||||
for (i = 0; i < MD5_DIGEST_SIZE; i++)
|
||||
if (md5_stored[i] != md5_resblock[i]) {
|
||||
|
|
|
|||
11
stream.c
11
stream.c
|
|
@ -1539,14 +1539,17 @@ int close_stream_out(rzip_control *control, void *ss)
|
|||
}
|
||||
|
||||
/* close down an input stream */
|
||||
int close_stream_in(rzip_control *control, void *ss)
|
||||
int close_stream_in(void *ss)
|
||||
{
|
||||
struct stream_info *sinfo = ss;
|
||||
int i;
|
||||
|
||||
if (unlikely(read_seekto(control, sinfo, sinfo->initial_pos + sinfo->total_read)))
|
||||
return -1;
|
||||
|
||||
#if 0
|
||||
/* Unnecessary, we should already be here */
|
||||
if (unlikely(lseek(sinfo->fd, sinfo->initial_pos + sinfo->total_read,
|
||||
SEEK_SET) != sinfo->initial_pos + sinfo->total_read))
|
||||
return -1;
|
||||
#endif
|
||||
for (i = 0; i < sinfo->num_streams; i++)
|
||||
free(sinfo->s[i].buf);
|
||||
|
||||
|
|
|
|||
2
stream.h
2
stream.h
|
|
@ -36,7 +36,7 @@ void flush_buffer(rzip_control *control, struct stream_info *sinfo, int stream);
|
|||
int write_stream(rzip_control *control, void *ss, int streamno, uchar *p, i64 len);
|
||||
i64 read_stream(rzip_control *control, void *ss, int streamno, uchar *p, i64 len);
|
||||
int close_stream_out(rzip_control *control, void *ss);
|
||||
int close_stream_in(rzip_control *control, void *ss);
|
||||
int close_stream_in(void *ss);
|
||||
const i64 one_g;
|
||||
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Reference in a new issue