cut around 30 bytes of code off of zlib mode (room for more tho)
git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@1226 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
parent
d85513f1c3
commit
49ff03bf0f
5 changed files with 39 additions and 11 deletions
|
@ -50,13 +50,26 @@ inflate_blocks_statef *s;
|
||||||
z_streamp z;
|
z_streamp z;
|
||||||
int r;
|
int r;
|
||||||
{
|
{
|
||||||
uInt t; /* temporary storage */
|
|
||||||
uLong b; /* bit buffer */
|
// lousy two bytes saved by doing this
|
||||||
uInt k; /* bits in bit buffer */
|
struct
|
||||||
Bytef *p; /* input data pointer */
|
{
|
||||||
uInt n; /* bytes available there */
|
uInt t; /* temporary storage */
|
||||||
Bytef *q; /* output window write pointer */
|
uLong b; /* bit buffer */
|
||||||
uInt m; /* bytes to end of window or read pointer */
|
uInt k; /* bits in bit buffer */
|
||||||
|
Bytef *p; /* input data pointer */
|
||||||
|
uInt n; /* bytes available there */
|
||||||
|
Bytef *q; /* output window write pointer */
|
||||||
|
uInt m; /* bytes to end of window or read pointer */
|
||||||
|
} _state;
|
||||||
|
|
||||||
|
#define t _state.t
|
||||||
|
#define b _state.b
|
||||||
|
#define k _state.k
|
||||||
|
#define p _state.p
|
||||||
|
#define n _state.n
|
||||||
|
#define q _state.q
|
||||||
|
#define m _state.m
|
||||||
|
|
||||||
/* copy input/output information to locals (UPDATE macro restores) */
|
/* copy input/output information to locals (UPDATE macro restores) */
|
||||||
LOAD
|
LOAD
|
||||||
|
|
|
@ -21,7 +21,6 @@ int ZEXPORT inflateReset(z_streamp z)
|
||||||
{
|
{
|
||||||
if (z == Z_NULL || z->state == Z_NULL)
|
if (z == Z_NULL || z->state == Z_NULL)
|
||||||
return Z_STREAM_ERROR;
|
return Z_STREAM_ERROR;
|
||||||
z->total_in = z->total_out = 0;
|
|
||||||
inflate_blocks_reset(&z->state->blocks, z, Z_NULL);
|
inflate_blocks_reset(&z->state->blocks, z, Z_NULL);
|
||||||
return Z_OK;
|
return Z_OK;
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,6 +20,18 @@ unsigned short inflate_mask[17] = {
|
||||||
0x01ff, 0x03ff, 0x07ff, 0x0fff, 0x1fff, 0x3fff, 0x7fff, 0xffff
|
0x01ff, 0x03ff, 0x07ff, 0x0fff, 0x1fff, 0x3fff, 0x7fff, 0xffff
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
void NSISCALL genrtable()
|
||||||
|
{
|
||||||
|
int x=17;
|
||||||
|
while (x>=0)
|
||||||
|
{
|
||||||
|
inflate_mask[x]=(1<<x)-1;
|
||||||
|
x--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
int __myleave(inflate_blocks_statef *s, z_streamp z, int r, int b, int k, Bytef *p, int n, Bytef *q)
|
int __myleave(inflate_blocks_statef *s, z_streamp z, int r, int b, int k, Bytef *p, int n, Bytef *q)
|
||||||
{
|
{
|
||||||
UPDATE
|
UPDATE
|
||||||
|
@ -47,7 +59,7 @@ int r;
|
||||||
|
|
||||||
/* update counters */
|
/* update counters */
|
||||||
z->avail_out -= n;
|
z->avail_out -= n;
|
||||||
z->total_out += n;
|
// z->total_out += n;
|
||||||
|
|
||||||
/* copy as far as end of window */
|
/* copy as far as end of window */
|
||||||
zmemcpy(p, q, n);
|
zmemcpy(p, q, n);
|
||||||
|
@ -69,7 +81,7 @@ int r;
|
||||||
|
|
||||||
/* update counters */
|
/* update counters */
|
||||||
z->avail_out -= n;
|
z->avail_out -= n;
|
||||||
z->total_out += n;
|
//z->total_out += n;
|
||||||
|
|
||||||
/* copy */
|
/* copy */
|
||||||
zmemcpy(p, q, n);
|
zmemcpy(p, q, n);
|
||||||
|
|
|
@ -58,7 +58,7 @@ struct inflate_blocks_state {
|
||||||
/* defines for inflate input/output */
|
/* defines for inflate input/output */
|
||||||
/* update pointers and return */
|
/* update pointers and return */
|
||||||
#define UPDBITS {s->bitb=b;s->bitk=k;}
|
#define UPDBITS {s->bitb=b;s->bitk=k;}
|
||||||
#define UPDIN {z->avail_in=n;z->total_in+=p-z->next_in;z->next_in=p;}
|
#define UPDIN {z->avail_in=n;z->next_in=p;}
|
||||||
#define UPDOUT {s->write=q;}
|
#define UPDOUT {s->write=q;}
|
||||||
#define UPDATE {UPDBITS UPDIN UPDOUT}
|
#define UPDATE {UPDBITS UPDIN UPDOUT}
|
||||||
#define LEAVE return __myleave(s,z,r,b,k,p,n,q);
|
#define LEAVE return __myleave(s,z,r,b,k,p,n,q);
|
||||||
|
|
|
@ -54,11 +54,15 @@ struct internal_state;
|
||||||
typedef struct z_stream_s {
|
typedef struct z_stream_s {
|
||||||
Bytef *next_in; /* next input byte */
|
Bytef *next_in; /* next input byte */
|
||||||
uInt avail_in; /* number of bytes available at next_in */
|
uInt avail_in; /* number of bytes available at next_in */
|
||||||
|
#ifndef EXEHEAD
|
||||||
uLong total_in; /* total nb of input bytes read so far */
|
uLong total_in; /* total nb of input bytes read so far */
|
||||||
|
#endif
|
||||||
|
|
||||||
Bytef *next_out; /* next output byte should be put there */
|
Bytef *next_out; /* next output byte should be put there */
|
||||||
uInt avail_out; /* remaining free space at next_out */
|
uInt avail_out; /* remaining free space at next_out */
|
||||||
|
#ifndef EXEHEAD
|
||||||
uLong total_out; /* total nb of bytes output so far */
|
uLong total_out; /* total nb of bytes output so far */
|
||||||
|
#endif
|
||||||
|
|
||||||
// char *msg; /* last error message, NULL if no error */
|
// char *msg; /* last error message, NULL if no error */
|
||||||
struct internal_state FAR *state; /* not visible by applications */
|
struct internal_state FAR *state; /* not visible by applications */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue