Return-Path: X-Original-To: apmail-commons-commits-archive@minotaur.apache.org Delivered-To: apmail-commons-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 0AB3810E89 for ; Thu, 19 Dec 2013 00:31:39 +0000 (UTC) Received: (qmail 44182 invoked by uid 500); 19 Dec 2013 00:31:38 -0000 Delivered-To: apmail-commons-commits-archive@commons.apache.org Received: (qmail 44094 invoked by uid 500); 19 Dec 2013 00:31:38 -0000 Mailing-List: contact commits-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@commons.apache.org Delivered-To: mailing list commits@commons.apache.org Received: (qmail 44087 invoked by uid 99); 19 Dec 2013 00:31:38 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 19 Dec 2013 00:31:38 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 19 Dec 2013 00:31:35 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 678FF2388993; Thu, 19 Dec 2013 00:31:14 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1552179 - /commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveInputStream.java Date: Thu, 19 Dec 2013 00:31:14 -0000 To: commits@commons.apache.org From: ebourg@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20131219003114.678FF2388993@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: ebourg Date: Thu Dec 19 00:31:14 2013 New Revision: 1552179 URL: http://svn.apache.org/r1552179 Log: Renamed the 'start' parameter in the read methods to 'offset' for consistency with the standard terminology Modified: commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveInputStream.java Modified: commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveInputStream.java URL: http://svn.apache.org/viewvc/commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveInputStream.java?rev=1552179&r1=1552178&r2=1552179&view=diff ============================================================================== --- commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveInputStream.java (original) +++ commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveInputStream.java Thu Dec 19 00:31:14 2013 @@ -375,7 +375,7 @@ public class ZipArchiveInputStream exten } @Override - public int read(byte[] buffer, int start, int length) throws IOException { + public int read(byte[] buffer, int offset, int length) throws IOException { if (closed) { throw new IOException("The stream is closed"); } @@ -384,8 +384,8 @@ public class ZipArchiveInputStream exten } // avoid int overflow, check null buffer - if (start <= buffer.length && length >= 0 && start >= 0 - && buffer.length - start >= length) { + if (offset <= buffer.length && length >= 0 && offset >= 0 + && buffer.length - offset >= length) { ZipUtil.checkRequestedFeatures(current.entry); if (!supportsDataDescriptorFor(current.entry)) { throw new UnsupportedZipFeatureException(UnsupportedZipFeatureException @@ -395,13 +395,13 @@ public class ZipArchiveInputStream exten } if (current.entry.getMethod() == ZipArchiveOutputStream.STORED) { - return readStored(buffer, start, length); + return readStored(buffer, offset, length); } if (current.entry.getMethod() == ZipMethod.UNSHRINKING.getCode()) { throw new UnsupportedZipFeatureException(ZipMethod.UNSHRINKING, current.entry); } - return readDeflated(buffer, start, length); + return readDeflated(buffer, offset, length); } throw new ArrayIndexOutOfBoundsException(); } @@ -409,14 +409,14 @@ public class ZipArchiveInputStream exten /** * Implementation of read for STORED entries. */ - private int readStored(byte[] buffer, int start, int length) + private int readStored(byte[] buffer, int offset, int length) throws IOException { if (current.hasDataDescriptor) { if (lastStoredEntry == null) { readStoredEntry(); } - return lastStoredEntry.read(buffer, start, length); + return lastStoredEntry.read(buffer, offset, length); } long csize = current.entry.getSize(); @@ -441,18 +441,18 @@ public class ZipArchiveInputStream exten // if it is smaller than toRead then it fits into an int toRead = (int) (csize - current.bytesRead); } - buf.get(buffer, start, toRead); + buf.get(buffer, offset, toRead); current.bytesRead += toRead; - crc.update(buffer, start, toRead); + crc.update(buffer, offset, toRead); return toRead; } /** * Implementation of read for DEFLATED entries. */ - private int readDeflated(byte[] buffer, int start, int length) + private int readDeflated(byte[] buffer, int offset, int length) throws IOException { - int read = readFromInflater(buffer, start, length); + int read = readFromInflater(buffer, offset, length); if (read <= 0) { if (inf.finished()) { return -1; @@ -464,7 +464,7 @@ public class ZipArchiveInputStream exten throw new IOException("Truncated ZIP file"); } } - crc.update(buffer, start, read); + crc.update(buffer, offset, read); return read; } @@ -472,7 +472,7 @@ public class ZipArchiveInputStream exten * Potentially reads more bytes to fill the inflater's buffer and * reads from it. */ - private int readFromInflater(byte[] buffer, int start, int length) + private int readFromInflater(byte[] buffer, int offset, int length) throws IOException { int read = 0; do { @@ -487,7 +487,7 @@ public class ZipArchiveInputStream exten } } try { - read = inf.inflate(buffer, start, length); + read = inf.inflate(buffer, offset, length); } catch (DataFormatException e) { throw (IOException) new ZipException(e.getMessage()).initCause(e); }