Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

zlibx changes? #1

Open
bravepuzzle opened this issue Mar 29, 2018 · 1 comment
Open

zlibx changes? #1

bravepuzzle opened this issue Mar 29, 2018 · 1 comment

Comments

@bravepuzzle
Copy link

bravepuzzle commented Mar 29, 2018

Hi @DinoChiesa ,

I am not very knowledge in compression and if you could point me in the right direction I would greatly appreciate it!

I've came across what is called zlibx a variation of zlib, where it carries the inflate changes as follow:

#define MOVE_30_TO_288   288 // the original is 30, this is probably the max

/* extra bits and base tables for length codes */
unsigned char length_bits[MOVE_30_TO_288];
unsigned short length_base[MOVE_30_TO_288];

/* extra bits and base tables for distance codes */
unsigned char dist_bits[MOVE_30_TO_288];
unsigned short dist_base[MOVE_30_TO_288];


static void tinf_build_bits_base(unsigned char *bits, unsigned short *base, int delta, int first)
{
   int i, sum;

   /* build bits table */
   for (i = 0; i < delta; ++i) bits[i] = 0;
   for (i = 0; i < MOVE_30_TO_288 - delta; ++i) bits[i + delta] = i / delta;

   /* build base table */
   for (sum = first, i = 0; i < MOVE_30_TO_288; ++i)
   {
      base[i] = sum;
      sum += 1 << bits[i];
   }
}

So instead of using 30 it uses 288, the above code comes from https://bitbucket.org/jibsen/tinf/src/d4327ed5fe3826620e2c53c292d456d5cb6b5932/src/tinflate.c?at=default&fileviewer=file-view-default with the changes mentioned above for MOVE_30_TO_288.

I've looked at DotNetZip source of the Zlib portion but the code is so complex, I don't even know where to start, more over I do see some initializes with 288, for example

initWorkArea(288);
and
internal static readonly int D_CODES = 30;
which could be related to it but I am unsure.

I wanted to know if you could point me which parts of Zlib from DotNetZip I would have to change to reflect the above.

If you could share me anything on this matter I would appreciate.

Thanks.

@peter-dolkens
Copy link

I recommend checking https://github.com/haf/DotNetZip.Semverd as it appears this project is simply a snapshot, whilst the other project has full history, and at least a minimal amount of maintenance.

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

No branches or pull requests

2 participants