From c07d040476ad052aa1961f1029082ad0f7b76039 Mon Sep 17 00:00:00 2001 From: Markus Mittendrein Date: Thu, 23 Apr 2020 00:17:34 +0200 Subject: Fix nested cc4group.openAsChild --- src/cc4group.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'src/cc4group.c') diff --git a/src/cc4group.c b/src/cc4group.c index ff42e51..a92b2b9 100644 --- a/src/cc4group.c +++ b/src/cc4group.c @@ -683,6 +683,12 @@ static bool cc4group_uncompressUntilPosition(CC4Group* const this, size_t const rootGroup->readState.position = position; } + + // update for child groups + if(this != rootGroup) + { + this->readState.position = position; + } return true; } @@ -3276,15 +3282,13 @@ static bool cc4group_openAsChildOn(CC4Group* const this, const char* const path, GroupEntryList* children = cc4group_getChildren(this, entry); // this also loads the header of entry child->root = *entry; + child->readState.position = this->readState.position; child->root.parent = NULL; child->root.core.FileName[0] = '\0'; child->root.children = children; child->uncompressedData = this->uncompressedData; - if(child->root.children == NULL) - { - return false; - } + assert(child->root.children); child->parent = this; child->name = strdup(entry->core.FileName); -- cgit v1.2.3-54-g00ecf