example.c (7648bc9fee8dec6cb3c4941e0165a930fbe8dcb0) example.c (cd8822075a38d0734e74b1735e4b5dbef9789170)
1/* example.c -- usage example of the zlib compression library
2 * Copyright (C) 1995-2006, 2011, 2016 Jean-loup Gailly
3 * For conditions of distribution and use, see copyright notice in zlib.h
4 */
5
6/* @(#) $Id$ */
7
8#include "zlib.h"

--- 426 unchanged lines hidden (view full) ---

435 err = inflate(&d_stream, Z_NO_FLUSH);
436 CHECK_ERR(err, "inflate");
437
438 d_stream.avail_in = (uInt)comprLen-2; /* read all compressed data */
439 err = inflateSync(&d_stream); /* but skip the damaged part */
440 CHECK_ERR(err, "inflateSync");
441
442 err = inflate(&d_stream, Z_FINISH);
1/* example.c -- usage example of the zlib compression library
2 * Copyright (C) 1995-2006, 2011, 2016 Jean-loup Gailly
3 * For conditions of distribution and use, see copyright notice in zlib.h
4 */
5
6/* @(#) $Id$ */
7
8#include "zlib.h"

--- 426 unchanged lines hidden (view full) ---

435 err = inflate(&d_stream, Z_NO_FLUSH);
436 CHECK_ERR(err, "inflate");
437
438 d_stream.avail_in = (uInt)comprLen-2; /* read all compressed data */
439 err = inflateSync(&d_stream); /* but skip the damaged part */
440 CHECK_ERR(err, "inflateSync");
441
442 err = inflate(&d_stream, Z_FINISH);
443 if (err != Z_DATA_ERROR) {
444 fprintf(stderr, "inflate should report DATA_ERROR\n");
445 /* Because of incorrect adler32 */
443 if (err != Z_STREAM_END) {
444 fprintf(stderr, "inflate should report Z_STREAM_END\n");
446 exit(1);
447 }
448 err = inflateEnd(&d_stream);
449 CHECK_ERR(err, "inflateEnd");
450
451 printf("after inflateSync(): hel%s\n", (char *)uncompr);
452}
453

--- 149 unchanged lines hidden ---
445 exit(1);
446 }
447 err = inflateEnd(&d_stream);
448 CHECK_ERR(err, "inflateEnd");
449
450 printf("after inflateSync(): hel%s\n", (char *)uncompr);
451}
452

--- 149 unchanged lines hidden ---