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:
justin1014 2002-09-30 16:49:43 +00:00
parent d85513f1c3
commit 49ff03bf0f
5 changed files with 39 additions and 11 deletions

View file

@ -50,13 +50,26 @@ inflate_blocks_statef *s;
z_streamp z;
int r;
{
uInt t; /* temporary storage */
uLong b; /* bit buffer */
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 */
// lousy two bytes saved by doing this
struct
{
uInt t; /* temporary storage */
uLong b; /* bit buffer */
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) */
LOAD

View file

@ -21,7 +21,6 @@ int ZEXPORT inflateReset(z_streamp z)
{
if (z == Z_NULL || z->state == Z_NULL)
return Z_STREAM_ERROR;
z->total_in = z->total_out = 0;
inflate_blocks_reset(&z->state->blocks, z, Z_NULL);
return Z_OK;
}

View file

@ -20,6 +20,18 @@ unsigned short inflate_mask[17] = {
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)
{
UPDATE
@ -47,7 +59,7 @@ int r;
/* update counters */
z->avail_out -= n;
z->total_out += n;
// z->total_out += n;
/* copy as far as end of window */
zmemcpy(p, q, n);
@ -69,7 +81,7 @@ int r;
/* update counters */
z->avail_out -= n;
z->total_out += n;
//z->total_out += n;
/* copy */
zmemcpy(p, q, n);

View file

@ -58,7 +58,7 @@ struct inflate_blocks_state {
/* defines for inflate input/output */
/* update pointers and return */
#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 UPDATE {UPDBITS UPDIN UPDOUT}
#define LEAVE return __myleave(s,z,r,b,k,p,n,q);

View file

@ -54,11 +54,15 @@ struct internal_state;
typedef struct z_stream_s {
Bytef *next_in; /* next input byte */
uInt avail_in; /* number of bytes available at next_in */
#ifndef EXEHEAD
uLong total_in; /* total nb of input bytes read so far */
#endif
Bytef *next_out; /* next output byte should be put there */
uInt avail_out; /* remaining free space at next_out */
#ifndef EXEHEAD
uLong total_out; /* total nb of bytes output so far */
#endif
// char *msg; /* last error message, NULL if no error */
struct internal_state FAR *state; /* not visible by applications */