aboutsummaryrefslogtreecommitdiff
path: root/src/xz/file_io.h
diff options
context:
space:
mode:
authorLasse Collin <lasse.collin@tukaani.org>2011-05-01 12:24:23 +0300
committerLasse Collin <lasse.collin@tukaani.org>2011-05-01 12:24:23 +0300
commit7a480e485938884ef3021b48c3b0b9f9699dc9b6 (patch)
tree21d5755f218c14d35905a516a7ff07dd46872254 /src/xz/file_io.h
parentxz: Print the maximum number of worker threads in xz -vv. (diff)
downloadxz-7a480e485938884ef3021b48c3b0b9f9699dc9b6.tar.xz
xz: Fix input file position when --single-stream is used.
Now the following works as you would expect: echo foo | xz > foo.xz echo bar | xz >> foo.xz ( xz -dc --single-stream ; xz -dc --single-stream ) < foo.xz Note that it doesn't work if the input is not seekable or if there is Stream Padding between the concatenated .xz Streams.
Diffstat (limited to 'src/xz/file_io.h')
-rw-r--r--src/xz/file_io.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/xz/file_io.h b/src/xz/file_io.h
index 967da868..ef639324 100644
--- a/src/xz/file_io.h
+++ b/src/xz/file_io.h
@@ -102,6 +102,19 @@ extern void io_close(file_pair *pair, bool success);
extern size_t io_read(file_pair *pair, io_buf *buf, size_t size);
+/// \brief Fix the position in src_fd
+///
+/// This is used when --single-thream has been specified and decompression
+/// is successful. If the input file descriptor supports seeking, this
+/// function fixes the input position to point to the next byte after the
+/// decompressed stream.
+///
+/// \param pair File pair having the source file open for reading
+/// \param rewind_size How many bytes of extra have been read i.e.
+/// how much to seek backwards.
+extern void io_fix_src_pos(file_pair *pair, size_t rewind_size);
+
+
/// \brief Read from source file from given offset to a buffer
///
/// This is remotely similar to standard pread(). This uses lseek() though,