Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/crypto/external/bsd/netpgp/dist/src/lib Make bz2 {de, }compre...



details:   https://anonhg.NetBSD.org/src/rev/44584671c131
branches:  trunk
changeset: 758298:44584671c131
user:      agc <agc%NetBSD.org@localhost>
date:      Sun Oct 31 18:31:03 2010 +0000

description:
Make bz2 {de,}compression dependent on the header file being available.
Fixes an error reported by Anthony Bentley when compiling on OpenBSD,
which apparently lacks bzlib.h (and bz2).

Tests run to completion successfully both with and without bz2 being
available.

diffstat:

 crypto/external/bsd/netpgp/dist/src/lib/compress.c |  14 +++++++++++++-
 1 files changed, 13 insertions(+), 1 deletions(-)

diffs (98 lines):

diff -r f8addf84098f -r 44584671c131 crypto/external/bsd/netpgp/dist/src/lib/compress.c
--- a/crypto/external/bsd/netpgp/dist/src/lib/compress.c        Sun Oct 31 17:17:45 2010 +0000
+++ b/crypto/external/bsd/netpgp/dist/src/lib/compress.c        Sun Oct 31 18:31:03 2010 +0000
@@ -57,7 +57,7 @@
 
 #if defined(__NetBSD__)
 __COPYRIGHT("@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved.");
-__RCSID("$NetBSD: compress.c,v 1.17 2010/08/15 16:10:56 agc Exp $");
+__RCSID("$NetBSD: compress.c,v 1.18 2010/10/31 18:31:03 agc Exp $");
 #endif
 
 #ifdef HAVE_ZLIB_H
@@ -89,6 +89,7 @@
        int             inflate_ret;
 } z_decompress_t;
 
+#ifdef HAVE_BZLIB_H
 typedef struct {
        __ops_compression_type_t type;
        __ops_region_t   *region;
@@ -98,6 +99,7 @@
        size_t          offset;
        int             inflate_ret;
 } bz_decompress_t;
+#endif
 
 typedef struct {
        z_stream        stream;
@@ -202,6 +204,7 @@
        return (int)length;
 }
 
+#ifdef HAVE_BZLIB_H
 /* \todo remove code duplication between this and zlib_compressed_data_reader */
 static int 
 bzip2_compressed_data_reader(void *dest, size_t length,
@@ -285,6 +288,7 @@
 
        return (int)length;
 }
+#endif
 
 /**
  * \ingroup Core_Compress
@@ -299,7 +303,9 @@
               __ops_compression_type_t type)
 {
        z_decompress_t z;
+#ifdef HAVE_BZLIB_H
        bz_decompress_t bz;
+#endif
        const int       printerrors = 1;
        int             ret;
 
@@ -321,6 +327,7 @@
 
                break;
 
+#ifdef HAVE_BZLIB_H
        case OPS_C_BZIP2:
                (void) memset(&bz, 0x0, sizeof(bz));
 
@@ -334,6 +341,7 @@
                bz.bzstream.bzalloc = NULL;
                bz.bzstream.bzfree = NULL;
                bz.bzstream.opaque = NULL;
+#endif
 
                break;
 
@@ -355,9 +363,11 @@
                ret = (int)inflateInit(&z.zstream);
                break;
 
+#ifdef HAVE_BZLIB_H
        case OPS_C_BZIP2:
                ret = BZ2_bzDecompressInit(&bz.bzstream, 1, 0);
                break;
+#endif
 
        default:
                OPS_ERROR_1(&stream->errors,
@@ -379,6 +389,7 @@
                                        NULL, &z);
                break;
 
+#ifdef HAVE_BZLIB_H
        case OPS_C_BZIP2:
                if (ret != BZ_OK) {
                        OPS_ERROR_1(&stream->errors,
@@ -389,6 +400,7 @@
                __ops_reader_push(stream, bzip2_compressed_data_reader,
                                        NULL, &bz);
                break;
+#endif
 
        default:
                OPS_ERROR_1(&stream->errors,



Home | Main Index | Thread Index | Old Index