1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/security/nss/lib/zlib/example.c Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,565 @@ 1.4 +/* example.c -- usage example of the zlib compression library 1.5 + * Copyright (C) 1995-2006 Jean-loup Gailly. 1.6 + * For conditions of distribution and use, see copyright notice in zlib.h 1.7 + */ 1.8 + 1.9 +/* @(#) $Id$ */ 1.10 + 1.11 +#include "zlib.h" 1.12 +#include <stdio.h> 1.13 + 1.14 +#ifdef STDC 1.15 +# include <string.h> 1.16 +# include <stdlib.h> 1.17 +#endif 1.18 + 1.19 +#if defined(VMS) || defined(RISCOS) 1.20 +# define TESTFILE "foo-gz" 1.21 +#else 1.22 +# define TESTFILE "foo.gz" 1.23 +#endif 1.24 + 1.25 +#define CHECK_ERR(err, msg) { \ 1.26 + if (err != Z_OK) { \ 1.27 + fprintf(stderr, "%s error: %d\n", msg, err); \ 1.28 + exit(1); \ 1.29 + } \ 1.30 +} 1.31 + 1.32 +const char hello[] = "hello, hello!"; 1.33 +/* "hello world" would be more standard, but the repeated "hello" 1.34 + * stresses the compression code better, sorry... 1.35 + */ 1.36 + 1.37 +const char dictionary[] = "hello"; 1.38 +uLong dictId; /* Adler32 value of the dictionary */ 1.39 + 1.40 +void test_compress OF((Byte *compr, uLong comprLen, 1.41 + Byte *uncompr, uLong uncomprLen)); 1.42 +void test_gzio OF((const char *fname, 1.43 + Byte *uncompr, uLong uncomprLen)); 1.44 +void test_deflate OF((Byte *compr, uLong comprLen)); 1.45 +void test_inflate OF((Byte *compr, uLong comprLen, 1.46 + Byte *uncompr, uLong uncomprLen)); 1.47 +void test_large_deflate OF((Byte *compr, uLong comprLen, 1.48 + Byte *uncompr, uLong uncomprLen)); 1.49 +void test_large_inflate OF((Byte *compr, uLong comprLen, 1.50 + Byte *uncompr, uLong uncomprLen)); 1.51 +void test_flush OF((Byte *compr, uLong *comprLen)); 1.52 +void test_sync OF((Byte *compr, uLong comprLen, 1.53 + Byte *uncompr, uLong uncomprLen)); 1.54 +void test_dict_deflate OF((Byte *compr, uLong comprLen)); 1.55 +void test_dict_inflate OF((Byte *compr, uLong comprLen, 1.56 + Byte *uncompr, uLong uncomprLen)); 1.57 +int main OF((int argc, char *argv[])); 1.58 + 1.59 +/* =========================================================================== 1.60 + * Test compress() and uncompress() 1.61 + */ 1.62 +void test_compress(compr, comprLen, uncompr, uncomprLen) 1.63 + Byte *compr, *uncompr; 1.64 + uLong comprLen, uncomprLen; 1.65 +{ 1.66 + int err; 1.67 + uLong len = (uLong)strlen(hello)+1; 1.68 + 1.69 + err = compress(compr, &comprLen, (const Bytef*)hello, len); 1.70 + CHECK_ERR(err, "compress"); 1.71 + 1.72 + strcpy((char*)uncompr, "garbage"); 1.73 + 1.74 + err = uncompress(uncompr, &uncomprLen, compr, comprLen); 1.75 + CHECK_ERR(err, "uncompress"); 1.76 + 1.77 + if (strcmp((char*)uncompr, hello)) { 1.78 + fprintf(stderr, "bad uncompress\n"); 1.79 + exit(1); 1.80 + } else { 1.81 + printf("uncompress(): %s\n", (char *)uncompr); 1.82 + } 1.83 +} 1.84 + 1.85 +/* =========================================================================== 1.86 + * Test read/write of .gz files 1.87 + */ 1.88 +void test_gzio(fname, uncompr, uncomprLen) 1.89 + const char *fname; /* compressed file name */ 1.90 + Byte *uncompr; 1.91 + uLong uncomprLen; 1.92 +{ 1.93 +#ifdef NO_GZCOMPRESS 1.94 + fprintf(stderr, "NO_GZCOMPRESS -- gz* functions cannot compress\n"); 1.95 +#else 1.96 + int err; 1.97 + int len = (int)strlen(hello)+1; 1.98 + gzFile file; 1.99 + z_off_t pos; 1.100 + 1.101 + file = gzopen(fname, "wb"); 1.102 + if (file == NULL) { 1.103 + fprintf(stderr, "gzopen error\n"); 1.104 + exit(1); 1.105 + } 1.106 + gzputc(file, 'h'); 1.107 + if (gzputs(file, "ello") != 4) { 1.108 + fprintf(stderr, "gzputs err: %s\n", gzerror(file, &err)); 1.109 + exit(1); 1.110 + } 1.111 + if (gzprintf(file, ", %s!", "hello") != 8) { 1.112 + fprintf(stderr, "gzprintf err: %s\n", gzerror(file, &err)); 1.113 + exit(1); 1.114 + } 1.115 + gzseek(file, 1L, SEEK_CUR); /* add one zero byte */ 1.116 + gzclose(file); 1.117 + 1.118 + file = gzopen(fname, "rb"); 1.119 + if (file == NULL) { 1.120 + fprintf(stderr, "gzopen error\n"); 1.121 + exit(1); 1.122 + } 1.123 + strcpy((char*)uncompr, "garbage"); 1.124 + 1.125 + if (gzread(file, uncompr, (unsigned)uncomprLen) != len) { 1.126 + fprintf(stderr, "gzread err: %s\n", gzerror(file, &err)); 1.127 + exit(1); 1.128 + } 1.129 + if (strcmp((char*)uncompr, hello)) { 1.130 + fprintf(stderr, "bad gzread: %s\n", (char*)uncompr); 1.131 + exit(1); 1.132 + } else { 1.133 + printf("gzread(): %s\n", (char*)uncompr); 1.134 + } 1.135 + 1.136 + pos = gzseek(file, -8L, SEEK_CUR); 1.137 + if (pos != 6 || gztell(file) != pos) { 1.138 + fprintf(stderr, "gzseek error, pos=%ld, gztell=%ld\n", 1.139 + (long)pos, (long)gztell(file)); 1.140 + exit(1); 1.141 + } 1.142 + 1.143 + if (gzgetc(file) != ' ') { 1.144 + fprintf(stderr, "gzgetc error\n"); 1.145 + exit(1); 1.146 + } 1.147 + 1.148 + if (gzungetc(' ', file) != ' ') { 1.149 + fprintf(stderr, "gzungetc error\n"); 1.150 + exit(1); 1.151 + } 1.152 + 1.153 + gzgets(file, (char*)uncompr, (int)uncomprLen); 1.154 + if (strlen((char*)uncompr) != 7) { /* " hello!" */ 1.155 + fprintf(stderr, "gzgets err after gzseek: %s\n", gzerror(file, &err)); 1.156 + exit(1); 1.157 + } 1.158 + if (strcmp((char*)uncompr, hello + 6)) { 1.159 + fprintf(stderr, "bad gzgets after gzseek\n"); 1.160 + exit(1); 1.161 + } else { 1.162 + printf("gzgets() after gzseek: %s\n", (char*)uncompr); 1.163 + } 1.164 + 1.165 + gzclose(file); 1.166 +#endif 1.167 +} 1.168 + 1.169 +/* =========================================================================== 1.170 + * Test deflate() with small buffers 1.171 + */ 1.172 +void test_deflate(compr, comprLen) 1.173 + Byte *compr; 1.174 + uLong comprLen; 1.175 +{ 1.176 + z_stream c_stream; /* compression stream */ 1.177 + int err; 1.178 + uLong len = (uLong)strlen(hello)+1; 1.179 + 1.180 + c_stream.zalloc = (alloc_func)0; 1.181 + c_stream.zfree = (free_func)0; 1.182 + c_stream.opaque = (voidpf)0; 1.183 + 1.184 + err = deflateInit(&c_stream, Z_DEFAULT_COMPRESSION); 1.185 + CHECK_ERR(err, "deflateInit"); 1.186 + 1.187 + c_stream.next_in = (Bytef*)hello; 1.188 + c_stream.next_out = compr; 1.189 + 1.190 + while (c_stream.total_in != len && c_stream.total_out < comprLen) { 1.191 + c_stream.avail_in = c_stream.avail_out = 1; /* force small buffers */ 1.192 + err = deflate(&c_stream, Z_NO_FLUSH); 1.193 + CHECK_ERR(err, "deflate"); 1.194 + } 1.195 + /* Finish the stream, still forcing small buffers: */ 1.196 + for (;;) { 1.197 + c_stream.avail_out = 1; 1.198 + err = deflate(&c_stream, Z_FINISH); 1.199 + if (err == Z_STREAM_END) break; 1.200 + CHECK_ERR(err, "deflate"); 1.201 + } 1.202 + 1.203 + err = deflateEnd(&c_stream); 1.204 + CHECK_ERR(err, "deflateEnd"); 1.205 +} 1.206 + 1.207 +/* =========================================================================== 1.208 + * Test inflate() with small buffers 1.209 + */ 1.210 +void test_inflate(compr, comprLen, uncompr, uncomprLen) 1.211 + Byte *compr, *uncompr; 1.212 + uLong comprLen, uncomprLen; 1.213 +{ 1.214 + int err; 1.215 + z_stream d_stream; /* decompression stream */ 1.216 + 1.217 + strcpy((char*)uncompr, "garbage"); 1.218 + 1.219 + d_stream.zalloc = (alloc_func)0; 1.220 + d_stream.zfree = (free_func)0; 1.221 + d_stream.opaque = (voidpf)0; 1.222 + 1.223 + d_stream.next_in = compr; 1.224 + d_stream.avail_in = 0; 1.225 + d_stream.next_out = uncompr; 1.226 + 1.227 + err = inflateInit(&d_stream); 1.228 + CHECK_ERR(err, "inflateInit"); 1.229 + 1.230 + while (d_stream.total_out < uncomprLen && d_stream.total_in < comprLen) { 1.231 + d_stream.avail_in = d_stream.avail_out = 1; /* force small buffers */ 1.232 + err = inflate(&d_stream, Z_NO_FLUSH); 1.233 + if (err == Z_STREAM_END) break; 1.234 + CHECK_ERR(err, "inflate"); 1.235 + } 1.236 + 1.237 + err = inflateEnd(&d_stream); 1.238 + CHECK_ERR(err, "inflateEnd"); 1.239 + 1.240 + if (strcmp((char*)uncompr, hello)) { 1.241 + fprintf(stderr, "bad inflate\n"); 1.242 + exit(1); 1.243 + } else { 1.244 + printf("inflate(): %s\n", (char *)uncompr); 1.245 + } 1.246 +} 1.247 + 1.248 +/* =========================================================================== 1.249 + * Test deflate() with large buffers and dynamic change of compression level 1.250 + */ 1.251 +void test_large_deflate(compr, comprLen, uncompr, uncomprLen) 1.252 + Byte *compr, *uncompr; 1.253 + uLong comprLen, uncomprLen; 1.254 +{ 1.255 + z_stream c_stream; /* compression stream */ 1.256 + int err; 1.257 + 1.258 + c_stream.zalloc = (alloc_func)0; 1.259 + c_stream.zfree = (free_func)0; 1.260 + c_stream.opaque = (voidpf)0; 1.261 + 1.262 + err = deflateInit(&c_stream, Z_BEST_SPEED); 1.263 + CHECK_ERR(err, "deflateInit"); 1.264 + 1.265 + c_stream.next_out = compr; 1.266 + c_stream.avail_out = (uInt)comprLen; 1.267 + 1.268 + /* At this point, uncompr is still mostly zeroes, so it should compress 1.269 + * very well: 1.270 + */ 1.271 + c_stream.next_in = uncompr; 1.272 + c_stream.avail_in = (uInt)uncomprLen; 1.273 + err = deflate(&c_stream, Z_NO_FLUSH); 1.274 + CHECK_ERR(err, "deflate"); 1.275 + if (c_stream.avail_in != 0) { 1.276 + fprintf(stderr, "deflate not greedy\n"); 1.277 + exit(1); 1.278 + } 1.279 + 1.280 + /* Feed in already compressed data and switch to no compression: */ 1.281 + deflateParams(&c_stream, Z_NO_COMPRESSION, Z_DEFAULT_STRATEGY); 1.282 + c_stream.next_in = compr; 1.283 + c_stream.avail_in = (uInt)comprLen/2; 1.284 + err = deflate(&c_stream, Z_NO_FLUSH); 1.285 + CHECK_ERR(err, "deflate"); 1.286 + 1.287 + /* Switch back to compressing mode: */ 1.288 + deflateParams(&c_stream, Z_BEST_COMPRESSION, Z_FILTERED); 1.289 + c_stream.next_in = uncompr; 1.290 + c_stream.avail_in = (uInt)uncomprLen; 1.291 + err = deflate(&c_stream, Z_NO_FLUSH); 1.292 + CHECK_ERR(err, "deflate"); 1.293 + 1.294 + err = deflate(&c_stream, Z_FINISH); 1.295 + if (err != Z_STREAM_END) { 1.296 + fprintf(stderr, "deflate should report Z_STREAM_END\n"); 1.297 + exit(1); 1.298 + } 1.299 + err = deflateEnd(&c_stream); 1.300 + CHECK_ERR(err, "deflateEnd"); 1.301 +} 1.302 + 1.303 +/* =========================================================================== 1.304 + * Test inflate() with large buffers 1.305 + */ 1.306 +void test_large_inflate(compr, comprLen, uncompr, uncomprLen) 1.307 + Byte *compr, *uncompr; 1.308 + uLong comprLen, uncomprLen; 1.309 +{ 1.310 + int err; 1.311 + z_stream d_stream; /* decompression stream */ 1.312 + 1.313 + strcpy((char*)uncompr, "garbage"); 1.314 + 1.315 + d_stream.zalloc = (alloc_func)0; 1.316 + d_stream.zfree = (free_func)0; 1.317 + d_stream.opaque = (voidpf)0; 1.318 + 1.319 + d_stream.next_in = compr; 1.320 + d_stream.avail_in = (uInt)comprLen; 1.321 + 1.322 + err = inflateInit(&d_stream); 1.323 + CHECK_ERR(err, "inflateInit"); 1.324 + 1.325 + for (;;) { 1.326 + d_stream.next_out = uncompr; /* discard the output */ 1.327 + d_stream.avail_out = (uInt)uncomprLen; 1.328 + err = inflate(&d_stream, Z_NO_FLUSH); 1.329 + if (err == Z_STREAM_END) break; 1.330 + CHECK_ERR(err, "large inflate"); 1.331 + } 1.332 + 1.333 + err = inflateEnd(&d_stream); 1.334 + CHECK_ERR(err, "inflateEnd"); 1.335 + 1.336 + if (d_stream.total_out != 2*uncomprLen + comprLen/2) { 1.337 + fprintf(stderr, "bad large inflate: %ld\n", d_stream.total_out); 1.338 + exit(1); 1.339 + } else { 1.340 + printf("large_inflate(): OK\n"); 1.341 + } 1.342 +} 1.343 + 1.344 +/* =========================================================================== 1.345 + * Test deflate() with full flush 1.346 + */ 1.347 +void test_flush(compr, comprLen) 1.348 + Byte *compr; 1.349 + uLong *comprLen; 1.350 +{ 1.351 + z_stream c_stream; /* compression stream */ 1.352 + int err; 1.353 + uInt len = (uInt)strlen(hello)+1; 1.354 + 1.355 + c_stream.zalloc = (alloc_func)0; 1.356 + c_stream.zfree = (free_func)0; 1.357 + c_stream.opaque = (voidpf)0; 1.358 + 1.359 + err = deflateInit(&c_stream, Z_DEFAULT_COMPRESSION); 1.360 + CHECK_ERR(err, "deflateInit"); 1.361 + 1.362 + c_stream.next_in = (Bytef*)hello; 1.363 + c_stream.next_out = compr; 1.364 + c_stream.avail_in = 3; 1.365 + c_stream.avail_out = (uInt)*comprLen; 1.366 + err = deflate(&c_stream, Z_FULL_FLUSH); 1.367 + CHECK_ERR(err, "deflate"); 1.368 + 1.369 + compr[3]++; /* force an error in first compressed block */ 1.370 + c_stream.avail_in = len - 3; 1.371 + 1.372 + err = deflate(&c_stream, Z_FINISH); 1.373 + if (err != Z_STREAM_END) { 1.374 + CHECK_ERR(err, "deflate"); 1.375 + } 1.376 + err = deflateEnd(&c_stream); 1.377 + CHECK_ERR(err, "deflateEnd"); 1.378 + 1.379 + *comprLen = c_stream.total_out; 1.380 +} 1.381 + 1.382 +/* =========================================================================== 1.383 + * Test inflateSync() 1.384 + */ 1.385 +void test_sync(compr, comprLen, uncompr, uncomprLen) 1.386 + Byte *compr, *uncompr; 1.387 + uLong comprLen, uncomprLen; 1.388 +{ 1.389 + int err; 1.390 + z_stream d_stream; /* decompression stream */ 1.391 + 1.392 + strcpy((char*)uncompr, "garbage"); 1.393 + 1.394 + d_stream.zalloc = (alloc_func)0; 1.395 + d_stream.zfree = (free_func)0; 1.396 + d_stream.opaque = (voidpf)0; 1.397 + 1.398 + d_stream.next_in = compr; 1.399 + d_stream.avail_in = 2; /* just read the zlib header */ 1.400 + 1.401 + err = inflateInit(&d_stream); 1.402 + CHECK_ERR(err, "inflateInit"); 1.403 + 1.404 + d_stream.next_out = uncompr; 1.405 + d_stream.avail_out = (uInt)uncomprLen; 1.406 + 1.407 + inflate(&d_stream, Z_NO_FLUSH); 1.408 + CHECK_ERR(err, "inflate"); 1.409 + 1.410 + d_stream.avail_in = (uInt)comprLen-2; /* read all compressed data */ 1.411 + err = inflateSync(&d_stream); /* but skip the damaged part */ 1.412 + CHECK_ERR(err, "inflateSync"); 1.413 + 1.414 + err = inflate(&d_stream, Z_FINISH); 1.415 + if (err != Z_DATA_ERROR) { 1.416 + fprintf(stderr, "inflate should report DATA_ERROR\n"); 1.417 + /* Because of incorrect adler32 */ 1.418 + exit(1); 1.419 + } 1.420 + err = inflateEnd(&d_stream); 1.421 + CHECK_ERR(err, "inflateEnd"); 1.422 + 1.423 + printf("after inflateSync(): hel%s\n", (char *)uncompr); 1.424 +} 1.425 + 1.426 +/* =========================================================================== 1.427 + * Test deflate() with preset dictionary 1.428 + */ 1.429 +void test_dict_deflate(compr, comprLen) 1.430 + Byte *compr; 1.431 + uLong comprLen; 1.432 +{ 1.433 + z_stream c_stream; /* compression stream */ 1.434 + int err; 1.435 + 1.436 + c_stream.zalloc = (alloc_func)0; 1.437 + c_stream.zfree = (free_func)0; 1.438 + c_stream.opaque = (voidpf)0; 1.439 + 1.440 + err = deflateInit(&c_stream, Z_BEST_COMPRESSION); 1.441 + CHECK_ERR(err, "deflateInit"); 1.442 + 1.443 + err = deflateSetDictionary(&c_stream, 1.444 + (const Bytef*)dictionary, sizeof(dictionary)); 1.445 + CHECK_ERR(err, "deflateSetDictionary"); 1.446 + 1.447 + dictId = c_stream.adler; 1.448 + c_stream.next_out = compr; 1.449 + c_stream.avail_out = (uInt)comprLen; 1.450 + 1.451 + c_stream.next_in = (Bytef*)hello; 1.452 + c_stream.avail_in = (uInt)strlen(hello)+1; 1.453 + 1.454 + err = deflate(&c_stream, Z_FINISH); 1.455 + if (err != Z_STREAM_END) { 1.456 + fprintf(stderr, "deflate should report Z_STREAM_END\n"); 1.457 + exit(1); 1.458 + } 1.459 + err = deflateEnd(&c_stream); 1.460 + CHECK_ERR(err, "deflateEnd"); 1.461 +} 1.462 + 1.463 +/* =========================================================================== 1.464 + * Test inflate() with a preset dictionary 1.465 + */ 1.466 +void test_dict_inflate(compr, comprLen, uncompr, uncomprLen) 1.467 + Byte *compr, *uncompr; 1.468 + uLong comprLen, uncomprLen; 1.469 +{ 1.470 + int err; 1.471 + z_stream d_stream; /* decompression stream */ 1.472 + 1.473 + strcpy((char*)uncompr, "garbage"); 1.474 + 1.475 + d_stream.zalloc = (alloc_func)0; 1.476 + d_stream.zfree = (free_func)0; 1.477 + d_stream.opaque = (voidpf)0; 1.478 + 1.479 + d_stream.next_in = compr; 1.480 + d_stream.avail_in = (uInt)comprLen; 1.481 + 1.482 + err = inflateInit(&d_stream); 1.483 + CHECK_ERR(err, "inflateInit"); 1.484 + 1.485 + d_stream.next_out = uncompr; 1.486 + d_stream.avail_out = (uInt)uncomprLen; 1.487 + 1.488 + for (;;) { 1.489 + err = inflate(&d_stream, Z_NO_FLUSH); 1.490 + if (err == Z_STREAM_END) break; 1.491 + if (err == Z_NEED_DICT) { 1.492 + if (d_stream.adler != dictId) { 1.493 + fprintf(stderr, "unexpected dictionary"); 1.494 + exit(1); 1.495 + } 1.496 + err = inflateSetDictionary(&d_stream, (const Bytef*)dictionary, 1.497 + sizeof(dictionary)); 1.498 + } 1.499 + CHECK_ERR(err, "inflate with dict"); 1.500 + } 1.501 + 1.502 + err = inflateEnd(&d_stream); 1.503 + CHECK_ERR(err, "inflateEnd"); 1.504 + 1.505 + if (strcmp((char*)uncompr, hello)) { 1.506 + fprintf(stderr, "bad inflate with dict\n"); 1.507 + exit(1); 1.508 + } else { 1.509 + printf("inflate with dictionary: %s\n", (char *)uncompr); 1.510 + } 1.511 +} 1.512 + 1.513 +/* =========================================================================== 1.514 + * Usage: example [output.gz [input.gz]] 1.515 + */ 1.516 + 1.517 +int main(argc, argv) 1.518 + int argc; 1.519 + char *argv[]; 1.520 +{ 1.521 + Byte *compr, *uncompr; 1.522 + uLong comprLen = 10000*sizeof(int); /* don't overflow on MSDOS */ 1.523 + uLong uncomprLen = comprLen; 1.524 + static const char* myVersion = ZLIB_VERSION; 1.525 + 1.526 + if (zlibVersion()[0] != myVersion[0]) { 1.527 + fprintf(stderr, "incompatible zlib version\n"); 1.528 + exit(1); 1.529 + 1.530 + } else if (strcmp(zlibVersion(), ZLIB_VERSION) != 0) { 1.531 + fprintf(stderr, "warning: different zlib version\n"); 1.532 + } 1.533 + 1.534 + printf("zlib version %s = 0x%04x, compile flags = 0x%lx\n", 1.535 + ZLIB_VERSION, ZLIB_VERNUM, zlibCompileFlags()); 1.536 + 1.537 + compr = (Byte*)calloc((uInt)comprLen, 1); 1.538 + uncompr = (Byte*)calloc((uInt)uncomprLen, 1); 1.539 + /* compr and uncompr are cleared to avoid reading uninitialized 1.540 + * data and to ensure that uncompr compresses well. 1.541 + */ 1.542 + if (compr == Z_NULL || uncompr == Z_NULL) { 1.543 + printf("out of memory\n"); 1.544 + exit(1); 1.545 + } 1.546 + test_compress(compr, comprLen, uncompr, uncomprLen); 1.547 + 1.548 + test_gzio((argc > 1 ? argv[1] : TESTFILE), 1.549 + uncompr, uncomprLen); 1.550 + 1.551 + test_deflate(compr, comprLen); 1.552 + test_inflate(compr, comprLen, uncompr, uncomprLen); 1.553 + 1.554 + test_large_deflate(compr, comprLen, uncompr, uncomprLen); 1.555 + test_large_inflate(compr, comprLen, uncompr, uncomprLen); 1.556 + 1.557 + test_flush(compr, &comprLen); 1.558 + test_sync(compr, comprLen, uncompr, uncomprLen); 1.559 + comprLen = uncomprLen; 1.560 + 1.561 + test_dict_deflate(compr, comprLen); 1.562 + test_dict_inflate(compr, comprLen, uncompr, uncomprLen); 1.563 + 1.564 + free(compr); 1.565 + free(uncompr); 1.566 + 1.567 + return 0; 1.568 +}