summaryrefslogtreecommitdiff
path: root/difftool/compare_dir.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/compare_dir.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/compare_dir.c')
-rw-r--r--difftool/compare_dir.c26
1 files changed, 14 insertions, 12 deletions
diff --git a/difftool/compare_dir.c b/difftool/compare_dir.c
index 99a0a37..477346a 100644
--- a/difftool/compare_dir.c
+++ b/difftool/compare_dir.c
@@ -6,16 +6,18 @@
*/
#include "sqfsdiff.h"
-int compare_dir_entries(sqfsdiff_t *sd, tree_node_t *old, tree_node_t *new)
+int compare_dir_entries(sqfsdiff_t *sd, sqfs_tree_node_t *old,
+ sqfs_tree_node_t *new)
{
- tree_node_t *old_it = old->data.dir->children, *old_prev = NULL;
- tree_node_t *new_it = new->data.dir->children, *new_prev = NULL;
+ sqfs_tree_node_t *old_it = old->children, *old_prev = NULL;
+ sqfs_tree_node_t *new_it = new->children, *new_prev = NULL;
int ret, result = 0;
char *path;
while (old_it != NULL || new_it != NULL) {
if (old_it != NULL && new_it != NULL) {
- ret = strcmp(old_it->name, new_it->name);
+ ret = strcmp((const char *)old_it->name,
+ (const char *)new_it->name);
} else if (old_it == NULL) {
ret = 1;
} else {
@@ -29,8 +31,8 @@ int compare_dir_entries(sqfsdiff_t *sd, tree_node_t *old, tree_node_t *new)
return -1;
if ((sd->compare_flags & COMPARE_EXTRACT_FILES) &&
- S_ISREG(old_it->mode)) {
- if (extract_files(sd, old_it->data.file,
+ S_ISREG(old_it->inode->base.mode)) {
+ if (extract_files(sd, old_it->inode,
NULL, path)) {
free(path);
return -1;
@@ -41,9 +43,9 @@ int compare_dir_entries(sqfsdiff_t *sd, tree_node_t *old, tree_node_t *new)
free(path);
if (old_prev == NULL) {
- old->data.dir->children = old_it->next;
+ old->children = old_it->next;
free(old_it);
- old_it = old->data.dir->children;
+ old_it = old->children;
} else {
old_prev->next = old_it->next;
free(old_it);
@@ -56,8 +58,8 @@ int compare_dir_entries(sqfsdiff_t *sd, tree_node_t *old, tree_node_t *new)
return -1;
if ((sd->compare_flags & COMPARE_EXTRACT_FILES) &&
- S_ISREG(new_it->mode)) {
- if (extract_files(sd, NULL, new_it->data.file,
+ S_ISREG(new_it->inode->base.mode)) {
+ if (extract_files(sd, NULL, new_it->inode,
path)) {
free(path);
return -1;
@@ -68,9 +70,9 @@ int compare_dir_entries(sqfsdiff_t *sd, tree_node_t *old, tree_node_t *new)
free(path);
if (new_prev == NULL) {
- new->data.dir->children = new_it->next;
+ new->children = new_it->next;
free(new_it);
- new_it = new->data.dir->children;
+ new_it = new->children;
} else {
new_prev->next = new_it->next;
free(new_it);