aboutsummaryrefslogtreecommitdiff
path: root/difftool/extract.c
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-09-20 16:31:31 +0200
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-09-20 18:34:17 +0200
commitd57efdfa0b7420dabf97335ffe3a8b391b9f54b3 (patch)
treef42eed71fc5c4a07ef03696c9953da7d4e860095 /difftool/extract.c
parentc106a290ed07fa89b39072925b1a2258071511a8 (diff)
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 <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'difftool/extract.c')
-rw-r--r--difftool/extract.c19
1 files changed, 12 insertions, 7 deletions
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;
}