Source-Changes-HG archive

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

[src/trunk]: src/lib/libz make z_off_t into off_t, which used to be "long" by...



details:   https://anonhg.NetBSD.org/src/rev/7ee6ea3ca186
branches:  trunk
changeset: 477646:7ee6ea3ca186
user:      itojun <itojun%NetBSD.org@localhost>
date:      Tue Oct 26 03:42:58 1999 +0000

description:
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?

diffstat:

 lib/libz/Makefile      |   3 +-
 lib/libz/gzio_compat.c |  55 ++++++++++++++++++++++++++++++++++++++++++++++++++
 lib/libz/zconf.h       |   4 +-
 lib/libz/zlib.h        |  32 ++++++++++++++++++++++++++--
 4 files changed, 88 insertions(+), 6 deletions(-)

diffs (157 lines):

diff -r b53ea12a6a28 -r 7ee6ea3ca186 lib/libz/Makefile
--- a/lib/libz/Makefile Tue Oct 26 01:49:38 1999 +0000
+++ b/lib/libz/Makefile Tue Oct 26 03:42:58 1999 +0000
@@ -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 @@
 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}
 
diff -r b53ea12a6a28 -r 7ee6ea3ca186 lib/libz/gzio_compat.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/lib/libz/gzio_compat.c    Tue Oct 26 03:42:58 1999 +0000
@@ -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@localhost>.
+ *
+ * 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);
+}
diff -r b53ea12a6a28 -r 7ee6ea3ca186 lib/libz/zconf.h
--- a/lib/libz/zconf.h  Tue Oct 26 01:49:38 1999 +0000
+++ b/lib/libz/zconf.h  Tue Oct 26 03:42:58 1999 +0000
@@ -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 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
diff -r b53ea12a6a28 -r 7ee6ea3ca186 lib/libz/zlib.h
--- a/lib/libz/zlib.h   Tue Oct 26 01:49:38 1999 +0000
+++ b/lib/libz/zlib.h   Tue Oct 26 03:42:58 1999 +0000
@@ -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 @@
    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.
+
 */
 
+/* 
+ * 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));
+                                     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 @@
    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



Home | Main Index | Thread Index | Old Index