From d57efdfa0b7420dabf97335ffe3a8b391b9f54b3 Mon Sep 17 00:00:00 2001 From: David Oberhollenzer Date: Fri, 20 Sep 2019 16:31:31 +0200 Subject: Remove sqfs reader & fstree usage from sqfsdiff Replace with direct usage of the dir reader and lower level data structures. Signed-off-by: David Oberhollenzer --- difftool/extract.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) (limited to 'difftool/extract.c') diff --git a/difftool/extract.c b/difftool/extract.c index 2e92710..45c5560 100644 --- a/difftool/extract.c +++ b/difftool/extract.c @@ -6,7 +6,7 @@ */ #include "sqfsdiff.h" -static int extract(data_reader_t *data, file_info_t *fi, +static int extract(data_reader_t *data, const sqfs_inode_generic_t *inode, const char *prefix, const char *path) { char *ptr, *temp; @@ -27,7 +27,7 @@ static int extract(data_reader_t *data, file_info_t *fi, return -1; } - if (data_reader_dump_file(data, fi, fd, true)) { + if (data_reader_dump(data, inode, fd, true)) { close(fd); return -1; } @@ -36,14 +36,19 @@ static int extract(data_reader_t *data, file_info_t *fi, return 0; } -int extract_files(sqfsdiff_t *sd, file_info_t *old, file_info_t *new, +int extract_files(sqfsdiff_t *sd, const sqfs_inode_generic_t *old, + const sqfs_inode_generic_t *new, const char *path) { - if (extract(sd->sqfs_old.data, old, "old", path)) - return -1; + if (old != NULL) { + if (extract(sd->sqfs_old.data, old, "old", path)) + return -1; + } - if (extract(sd->sqfs_new.data, new, "new", path)) - return -1; + if (new != NULL) { + if (extract(sd->sqfs_new.data, new, "new", path)) + return -1; + } return 0; } -- cgit v1.2.3