From 6a6260aeb61e5fd73217f74014bce7c47fa588d0 Mon Sep 17 00:00:00 2001 From: justin1014 Date: Fri, 27 Sep 2002 05:17:56 +0000 Subject: [PATCH] reduced zlib size by 16 or so git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@1208 212acab6-be3b-0410-9dea-997c60f758d6 --- Source/zlib/INFBLOCK.C | 8 ++------ Source/zlib/INFLATE.C | 32 +++++++++----------------------- Source/zlib/INFUTIL.H | 15 ++++++++++++++- 3 files changed, 25 insertions(+), 30 deletions(-) diff --git a/Source/zlib/INFBLOCK.C b/Source/zlib/INFBLOCK.C index 685ffa6b..252aa9bc 100644 --- a/Source/zlib/INFBLOCK.C +++ b/Source/zlib/INFBLOCK.C @@ -38,11 +38,6 @@ uLongf *c; Tracev((stderr, "inflate: blocks reset\n")); } -int inflate_blocks_getssize() -{ - return sizeof(struct inflate_blocks_state); -} - void inflate_blocks_init(z_streamp z,inflate_blocks_statef *s) { s->end = s->window + (1 << DEF_WBITS); @@ -297,7 +292,7 @@ int r; } -int inflate_blocks_free(s, z) +/*int inflate_blocks_free(s, z) inflate_blocks_statef *s; z_streamp z; { @@ -306,4 +301,5 @@ z_streamp z; Tracev((stderr, "inflate: blocks freed\n")); return Z_OK; } +*/ #endif \ No newline at end of file diff --git a/Source/zlib/INFLATE.C b/Source/zlib/INFLATE.C index 0ead3090..cbd0150d 100644 --- a/Source/zlib/INFLATE.C +++ b/Source/zlib/INFLATE.C @@ -11,25 +11,10 @@ #include "zutil.h" #include "infblock.h" +#include "inftrees.h" +#include "infcodes.h" +#include "infutil.h" -struct inflate_blocks_state { int dummy; }; /* for buggy compilers */ - - -/* inflate private state */ -struct internal_state { - - /* mode dependent information */ - union { - uInt method; /* if FLAGS, method byte */ - struct { - uLong was; /* computed check value */ - uLong need; /* stream check value */ - } check; /* if CHECK, check values to compare */ - uInt marker; /* if BAD, inflateSync's marker bytes count */ - } sub; /* submode */ - - inflate_blocks_statef blocks; /* current inflate_blocks state */ -}; int ZEXPORT inflateReset(z_streamp z) @@ -41,15 +26,16 @@ int ZEXPORT inflateReset(z_streamp z) return Z_OK; } +static struct internal_state __mstate; int ZEXPORT inflateInit(z_streamp z) { - int inflate_blocks_getssize(void); - void inflate_blocks_init(z_streamp z,inflate_blocks_statef *s); + void inflate_blocks_init(z_streamp z,struct inflate_blocks_state *s); - if ((z->state = - (struct internal_state FAR *) ZALLOC(z,1,sizeof(struct internal_state)+inflate_blocks_getssize())) == Z_NULL) - return Z_MEM_ERROR; + z->state=&__mstate; +// if ((z->state = + // (struct internal_state FAR *) ZALLOC(z,1,sizeof(struct internal_state))) == Z_NULL) + //return Z_MEM_ERROR; inflate_blocks_init(z,&z->state->blocks); diff --git a/Source/zlib/INFUTIL.H b/Source/zlib/INFUTIL.H index bd950394..7ccf8d71 100644 --- a/Source/zlib/INFUTIL.H +++ b/Source/zlib/INFUTIL.H @@ -92,6 +92,19 @@ extern int inflate_flush OF(( z_streamp , int)); -struct internal_state {int dummy;}; /* for buggy compilers */ +struct internal_state { + + /* mode dependent information */ + union { + uInt method; /* if FLAGS, method byte */ + struct { + uLong was; /* computed check value */ + uLong need; /* stream check value */ + } check; /* if CHECK, check values to compare */ + uInt marker; /* if BAD, inflateSync's marker bytes count */ + } sub; /* submode */ + + struct inflate_blocks_state blocks; /* current inflate_blocks state */ +}; #endif