Home | History | Annotate | Download | only in bzip2
      1 /*
      2  * CDDL HEADER START
      3  *
      4  * The contents of this file are subject to the terms of the
      5  * Common Development and Distribution License (the "License").
      6  * You may not use this file except in compliance with the License.
      7  *
      8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
      9  * or http://www.opensolaris.org/os/licensing.
     10  * See the License for the specific language governing permissions
     11  * and limitations under the License.
     12  *
     13  * When distributing Covered Code, include this CDDL HEADER in each
     14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
     15  * If applicable, add the following below this CDDL HEADER, with the
     16  * fields enclosed by brackets "[]" replaced with your own identifying
     17  * information: Portions Copyright [yyyy] [name of copyright owner]
     18  *
     19  * CDDL HEADER END
     20  */
     21 /*
     22  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
     23  * Use is subject to license terms.
     24  */
     25 
     26 #pragma ident	"@(#)oldapi.c	1.2	07/04/02 SMI"
     27 
     28 #include <stdio.h>
     29 #include "bzlib.h"
     30 
     31 /*
     32  * Wrappers for the old names. For compatibility with Solaris 8.
     33  */
     34 
     35 int
     36 bzCompressInit(bz_stream *strm, int blockSize100k, int verbosity,
     37     int workFactor)
     38 {
     39 	return (BZ2_bzCompressInit(strm, blockSize100k, verbosity, workFactor));
     40 }
     41 
     42 int
     43 bzCompress(bz_stream *strm, int action)
     44 {
     45 	return (BZ2_bzCompress(strm, action));
     46 }
     47 
     48 int
     49 bzCompressEnd(bz_stream *strm)
     50 {
     51 	return (BZ2_bzCompressEnd(strm));
     52 }
     53 
     54 int
     55 bzDecompressInit(bz_stream *strm, int verbosity, int small)
     56 {
     57 	return (BZ2_bzDecompressInit(strm, verbosity, small));
     58 }
     59 
     60 int
     61 bzDecompress(bz_stream *strm)
     62 {
     63 	return (BZ2_bzDecompress(strm));
     64 }
     65 
     66 int
     67 bzDecompressEnd(bz_stream *strm)
     68 {
     69 	return (BZ2_bzDecompressEnd(strm));
     70 }
     71 
     72 BZFILE *
     73 bzReadOpen(int *bzerror, FILE *f, int verbosity, int small, void *unused,
     74     int nUnused)
     75 {
     76 	return (BZ2_bzReadOpen(bzerror, f, verbosity, small, unused, nUnused));
     77 }
     78 
     79 void
     80 bzReadClose(int *bzerror, BZFILE *b)
     81 {
     82 	BZ2_bzReadClose(bzerror, b);
     83 }
     84 
     85 void
     86 bzReadGetUnused(int *bzerror, BZFILE *b, void **unused, int *nUnused)
     87 {
     88 	BZ2_bzReadGetUnused(bzerror, b, unused, nUnused);
     89 }
     90 
     91 int
     92 bzRead(int *bzerror, BZFILE *b, void *buf, int len)
     93 {
     94 	return (BZ2_bzRead(bzerror, b, buf, len));
     95 }
     96 
     97 BZFILE *
     98 bzWriteOpen(int *bzerror, FILE *f, int blockSize100k, int verbosity,
     99     int workFactor)
    100 {
    101 	return (BZ2_bzWriteOpen(bzerror, f, blockSize100k, verbosity,
    102 	    workFactor));
    103 }
    104 
    105 void
    106 bzWrite(int *bzerror, BZFILE *b, void *buf, int len)
    107 {
    108 	BZ2_bzWrite(bzerror, b, buf, len);
    109 }
    110 
    111 void
    112 bzWriteClose(int *bzerror, BZFILE *b, int abandon, unsigned int *nbytes_in,
    113     unsigned int *nbytes_out)
    114 {
    115 	BZ2_bzWriteClose(bzerror, b, abandon, nbytes_in, nbytes_out);
    116 }
    117 
    118 int
    119 bzBuffToBuffCompress(char *dest, unsigned int *destLen, char *source,
    120     unsigned int sourceLen, int blockSize100k, int verbosity, int workFactor)
    121 {
    122 	return (BZ2_bzBuffToBuffCompress(dest, destLen, source, sourceLen,
    123 	    blockSize100k, verbosity, workFactor));
    124 }
    125 
    126 int
    127 bzBuffToBuffDecompress(char *dest, unsigned int *destLen, char *source,
    128     unsigned int sourceLen, int small, int verbosity)
    129 {
    130 	return (BZ2_bzBuffToBuffDecompress(dest, destLen, source, sourceLen,
    131 	    small, verbosity));
    132 }
    133 
    134 
    135 const char *
    136 bzlibVersion(void)
    137 {
    138 	return (BZ2_bzlibVersion());
    139 }
    140 
    141 BZFILE *
    142 bzopen(const char *path, const char *mode)
    143 {
    144 	return (BZ2_bzopen(path, mode));
    145 }
    146 
    147 BZFILE *
    148 bzdopen(int fd, const char *mode)
    149 {
    150 	return (BZ2_bzdopen(fd, mode));
    151 }
    152 
    153 int
    154 bzread(BZFILE *b, void *buf, int len)
    155 {
    156 	return (BZ2_bzread(b, buf, len));
    157 }
    158 
    159 int
    160 bzwrite(BZFILE *b, void *buf, int len)
    161 {
    162 	return (BZ2_bzwrite(b, buf, len));
    163 }
    164 
    165 int
    166 bzflush(BZFILE *b)
    167 {
    168 	return (BZ2_bzflush(b));
    169 }
    170 
    171 void
    172 bzclose(BZFILE *b)
    173 {
    174 	BZ2_bzclose(b);
    175 }
    176 
    177 const char *
    178 bzerror(BZFILE *b, int *errnum)
    179 {
    180 	return (BZ2_bzerror(b, errnum));
    181 }
    182