Skip to content

Implement clearing correctly for ZIP Shrink method#180

Open
chasonr wants to merge 1 commit intoMacPaw:masterfrom
chasonr:shrink-fix
Open

Implement clearing correctly for ZIP Shrink method#180
chasonr wants to merge 1 commit intoMacPaw:masterfrom
chasonr:shrink-fix

Conversation

@chasonr
Copy link
Copy Markdown

@chasonr chasonr commented Apr 19, 2026

The "clear" code for the ZIP Shrink method is not supposed to clear the entire LZW tree, but only the leaf nodes. This change correctly implements the clearing for Shrink.

A Zip that needs this change can be found at http://cd.textfiles.com/garbo/PC/FORMAT/MAXI161.ZIP .

Clearing only leaf nodes can leave the array in a state where the allocated nodes are not contiguous. Some changes to the data structure were necessary to allow this. The free nodes are kept on a linked list, which is built anew whenever the tree is either fully or partially cleared.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant