deflate.c (292dd876ee765c478b27c93cc51e93a558ed58bf) | deflate.c (4f3865fb57a04db7cca068fed1c15badc064a302) |
---|---|
1/* +++ deflate.c */ 2/* deflate.c -- compress data using the deflation algorithm 3 * Copyright (C) 1995-1996 Jean-loup Gailly. 4 * For conditions of distribution and use, see copyright notice in zlib.h 5 */ 6 7/* 8 * ALGORITHM --- 150 unchanged lines hidden (view full) --- 159 * Initialize the hash table (avoiding 64K overflow for 16 bit systems). 160 * prev[] will be initialized on the fly. 161 */ 162#define CLEAR_HASH(s) \ 163 s->head[s->hash_size-1] = NIL; \ 164 memset((char *)s->head, 0, (unsigned)(s->hash_size-1)*sizeof(*s->head)); 165 166/* ========================================================================= */ | 1/* +++ deflate.c */ 2/* deflate.c -- compress data using the deflation algorithm 3 * Copyright (C) 1995-1996 Jean-loup Gailly. 4 * For conditions of distribution and use, see copyright notice in zlib.h 5 */ 6 7/* 8 * ALGORITHM --- 150 unchanged lines hidden (view full) --- 159 * Initialize the hash table (avoiding 64K overflow for 16 bit systems). 160 * prev[] will be initialized on the fly. 161 */ 162#define CLEAR_HASH(s) \ 163 s->head[s->hash_size-1] = NIL; \ 164 memset((char *)s->head, 0, (unsigned)(s->hash_size-1)*sizeof(*s->head)); 165 166/* ========================================================================= */ |
167int zlib_deflateInit_( | 167int zlib_deflateInit2( |
168 z_streamp strm, | 168 z_streamp strm, |
169 int level, 170 const char *version, 171 int stream_size 172) 173{ 174 return zlib_deflateInit2_(strm, level, Z_DEFLATED, MAX_WBITS, 175 DEF_MEM_LEVEL, 176 Z_DEFAULT_STRATEGY, version, stream_size); 177 /* To do: ignore strm->next_in if we use it as window */ 178} 179 180/* ========================================================================= */ 181int zlib_deflateInit2_( 182 z_streamp strm, | |
183 int level, 184 int method, 185 int windowBits, 186 int memLevel, | 169 int level, 170 int method, 171 int windowBits, 172 int memLevel, |
187 int strategy, 188 const char *version, 189 int stream_size | 173 int strategy |
190) 191{ 192 deflate_state *s; 193 int noheader = 0; | 174) 175{ 176 deflate_state *s; 177 int noheader = 0; |
194 static char* my_version = ZLIB_VERSION; | |
195 deflate_workspace *mem; 196 197 ush *overlay; 198 /* We overlay pending_buf and d_buf+l_buf. This works since the average 199 * output size for (length,distance) codes is <= 24 bits. 200 */ 201 | 178 deflate_workspace *mem; 179 180 ush *overlay; 181 /* We overlay pending_buf and d_buf+l_buf. This works since the average 182 * output size for (length,distance) codes is <= 24 bits. 183 */ 184 |
202 if (version == NULL || version[0] != my_version[0] || 203 stream_size != sizeof(z_stream)) { 204 return Z_VERSION_ERROR; 205 } | |
206 if (strm == NULL) return Z_STREAM_ERROR; 207 208 strm->msg = NULL; 209 210 if (level == Z_DEFAULT_COMPRESSION) level = 6; 211 212 mem = (deflate_workspace *) strm->workspace; 213 --- 1061 unchanged lines hidden --- | 185 if (strm == NULL) return Z_STREAM_ERROR; 186 187 strm->msg = NULL; 188 189 if (level == Z_DEFAULT_COMPRESSION) level = 6; 190 191 mem = (deflate_workspace *) strm->workspace; 192 --- 1061 unchanged lines hidden --- |