make z_off_t into off_t, which used to be "long" by mistake.

backward compatibility functions are supplied.

XXX increase shlib major, or minor?
This commit is contained in:
itojun 1999-10-26 03:42:58 +00:00
parent 909f85b9dd
commit fb26763771
4 changed files with 88 additions and 6 deletions

View File

@ -1,4 +1,4 @@
# $NetBSD: Makefile,v 1.13 1999/07/09 07:07:13 garbled Exp $
# $NetBSD: Makefile,v 1.14 1999/10/26 03:42:58 itojun Exp $
LIB= z
MKMAN= no
@ -6,6 +6,7 @@ MKMAN= no
SRCS= adler32.c compress.c crc32.c deflate.c gzio.c infblock.c \
infcodes.c inffast.c inflate.c inftrees.c infutil.c trees.c uncompr.c \
zutil.c
SRCS+= gzio_compat.c
CPPFLAGS+= -I${.CURDIR}

55
lib/libz/gzio_compat.c Normal file
View File

@ -0,0 +1,55 @@
/* $NetBSD: gzio_compat.c,v 1.1 1999/10/26 03:42:58 itojun Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Jun-ichiro itojun Hagino <itojun@itojun.org>.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of The NetBSD Foundation nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
/*
* Backward compatibility wrapper for old (incorrect) z_off_t definition.
*/
#include <stdio.h>
#define __ZLIB_BACKWARD_COMPAT
#include "zutil.h"
long ZEXPORT gzseek (file, offset, whence)
gzFile file;
long offset;
int whence;
{
return (long)__gzseek15(file, (off_t)offset, whence);
}
long ZEXPORT gztell (file)
gzFile file;
{
return (long)__gztell15(file);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: zconf.h,v 1.7 1999/07/03 12:30:57 simonb Exp $ */
/* $NetBSD: zconf.h,v 1.8 1999/10/26 03:42:58 itojun Exp $ */
/* zconf.h -- configuration of the zlib compression library
* Copyright (C) 1995-1998 Jean-loup Gailly.
@ -242,7 +242,7 @@ typedef uLong FAR uLongf;
typedef Byte *voidp;
#endif
#ifdef HAVE_UNISTD_H
#if defined(HAVE_UNISTD_H) || defined(__NetBSD__)
# include <sys/types.h> /* for off_t */
# include <unistd.h> /* for SEEK_* and off_t */
# define z_off_t off_t

View File

@ -1,4 +1,4 @@
/* $NetBSD: zlib.h,v 1.7 1999/07/03 12:30:57 simonb Exp $ */
/* $NetBSD: zlib.h,v 1.8 1999/10/26 03:42:58 itojun Exp $ */
/* zlib.h -- interface of the 'zlib' general purpose compression library
version 1.1.3, July 9th, 1998
@ -33,6 +33,10 @@
#ifndef _ZLIB_H
#define _ZLIB_H
#ifdef __NetBSD__
#include <sys/cdefs.h>
#endif
#include "zconf.h"
#ifdef __cplusplus
@ -754,10 +758,23 @@ ZEXTERN int ZEXPORT gzflush OF((gzFile file, int flush));
the flush parameter is Z_FINISH and all output could be flushed.
gzflush should be called only when strictly necessary because it can
degrade compression.
*/
ZEXTERN z_off_t ZEXPORT gzseek OF((gzFile file,
/*
* NetBSD note:
* "long" gzseek has been there till Oct 1999 (1.4L), which was wrong.
*/
#ifdef __ZLIB_BACKWARD_COMPAT
ZEXTERN long ZEXPORT gzseek OF((gzFile file,
long offset, int whence));
ZEXTERN z_off_t ZEXPORT __gzseek15 OF((gzFile file,
z_off_t offset, int whence));
#else
ZEXTERN z_off_t ZEXPORT gzseek OF((gzFile file,
z_off_t offset, int whence))
__RENAME(__gzseek15);
#endif
/*
Sets the starting position for the next gzread or gzwrite on the
given compressed file. The offset represents a number of bytes in the
@ -781,7 +798,16 @@ ZEXTERN int ZEXPORT gzrewind OF((gzFile file));
gzrewind(file) is equivalent to (int)gzseek(file, 0L, SEEK_SET)
*/
ZEXTERN z_off_t ZEXPORT gztell OF((gzFile file));
/*
* NetBSD note:
* "long" gztell has been there till Oct 1999 (1.4L), which was wrong.
*/
#ifdef __ZLIB_BACKWARD_COMPAT
ZEXTERN long ZEXPORT gztell OF((gzFile file));
ZEXTERN z_off_t ZEXPORT __gztell15 OF((gzFile file));
#else
ZEXTERN z_off_t ZEXPORT gztell OF((gzFile file)) __RENAME(__gztell15);
#endif
/*
Returns the starting position for the next gzread or gzwrite on the
given compressed file. This position represents a number of bytes in the