From 3a941f4ae2213f26118f5cfde03ca793b31ca838 Mon Sep 17 00:00:00 2001 From: Jonathan McCrohan Date: Tue, 8 May 2012 14:52:05 +0100 Subject: Imported Upstream version 2.2.3 --- zipio.c | 50 ++++++++++++++++++++++++++------------------------ 1 file changed, 26 insertions(+), 24 deletions(-) (limited to 'zipio.c') diff --git a/zipio.c b/zipio.c index 6ed67e0..f7406d9 100644 --- a/zipio.c +++ b/zipio.c @@ -1,32 +1,29 @@ /* * zipio.c - stdio emulation library for reading zip files * - * Version 1.1.1 + * Version 1.1.2 */ /* - * Copyright (c) 1995, Edward B. Hamrick + * Copyright (C) 1995, Edward B. Hamrick * - * Permission to use, copy, modify, distribute, and sell this software and - * its documentation for any purpose is hereby granted without fee, provided - * that + * Permission to use, copy, modify, and distribute this software and + * its documentation for any purpose and without fee is hereby granted, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear in + * supporting documentation, and that the name of the copyright holders + * not be used in advertising or publicity pertaining to distribution of + * the software without specific, written prior permission. The copyright + * holders makes no representations about the suitability of this software + * for any purpose. It is provided "as is" without express or implied warranty. * - * (i) the above copyright notice and the text in this "C" comment block - * appear in all copies of the software and related documentation, and - * - * (ii) any modifications to this source file must be sent, via e-mail - * to the copyright owner (currently hamrick@primenet.com) within - * 30 days of such modification. - * - * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, - * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY - * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - * - * IN NO EVENT SHALL EDWARD B. HAMRICK BE LIABLE FOR ANY SPECIAL, INCIDENTAL, - * INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES WHATSOEVER - * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER OR NOT ADVISED OF - * THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF LIABILITY, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS + * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, + * IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT + * OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF + * USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THIS SOFTWARE. */ /* @@ -35,6 +32,11 @@ * Added "zungetc" macro. * Added definitions of SEEK_SET, SEEK_CUR, SEEK_END for the Posixly challenged * John Cowan + * + * Changes from 1.1.1 to 1.1.2: + * Relicensed under the MIT license, with consent of the copyright holders. + * Avoid usage of unitialized "length" variable in _Zgetc + * Claudio Matsuoka (Jan 11 2011) */ /* @@ -680,11 +682,11 @@ int _Zgetc(ZFILE *stream) /* If data isn't in current outbuf, get it */ offset = ZS->fileposition & ~((long) (OUTBUFSIZE-1)); + length = ZS->usiz - offset; + if (length > OUTBUFSIZE) length = OUTBUFSIZE; + if (ZS->getoff != offset) { - length = ZS->usiz - offset; - if (length > OUTBUFSIZE) length = OUTBUFSIZE; - if (BufferRead(ZS, offset, ZS->getbuf, length)) return -1; ZS->getoff = offset; -- cgit v1.2.3