summaryrefslogtreecommitdiff
path: root/difftool/extract.c
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-09-20 17:48:33 +0200
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-09-20 18:34:17 +0200
commitec4332f747425859f37641ecd249537efb338a90 (patch)
tree9a5765fc0a9c2322c3aaf5718cdec9a653896e3d /difftool/extract.c
parentec70d9ffa6913c6643d25f9115830fd89b6ddfa7 (diff)
Move data_reader_dump function out of data reader
This commit adds two new functions for getting a file block by index, or a files fragment. The data_reader_dump function is rewritten in terms of those two functions and moved to a seperate file. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'difftool/extract.c')
-rw-r--r--difftool/extract.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/difftool/extract.c b/difftool/extract.c
index 45c5560..94477b1 100644
--- a/difftool/extract.c
+++ b/difftool/extract.c
@@ -7,7 +7,7 @@
#include "sqfsdiff.h"
static int extract(data_reader_t *data, const sqfs_inode_generic_t *inode,
- const char *prefix, const char *path)
+ const char *prefix, const char *path, size_t block_size)
{
char *ptr, *temp;
int fd;
@@ -27,7 +27,7 @@ static int extract(data_reader_t *data, const sqfs_inode_generic_t *inode,
return -1;
}
- if (data_reader_dump(data, inode, fd, true)) {
+ if (data_reader_dump(data, inode, fd, block_size, true)) {
close(fd);
return -1;
}
@@ -41,12 +41,14 @@ int extract_files(sqfsdiff_t *sd, const sqfs_inode_generic_t *old,
const char *path)
{
if (old != NULL) {
- if (extract(sd->sqfs_old.data, old, "old", path))
+ if (extract(sd->sqfs_old.data, old, "old",
+ path, sd->sqfs_old.super.block_size))
return -1;
}
if (new != NULL) {
- if (extract(sd->sqfs_new.data, new, "new", path))
+ if (extract(sd->sqfs_new.data, new, "new",
+ path, sd->sqfs_new.super.block_size))
return -1;
}