From ec4332f747425859f37641ecd249537efb338a90 Mon Sep 17 00:00:00 2001 From: David Oberhollenzer Date: Fri, 20 Sep 2019 17:48:33 +0200 Subject: 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 --- difftool/extract.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'difftool/extract.c') 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; } -- cgit v1.2.3