Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 34045200C48 for ; Thu, 6 Apr 2017 15:18:32 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 328E0160BA4; Thu, 6 Apr 2017 13:18:32 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 79EB0160B83 for ; Thu, 6 Apr 2017 15:18:31 +0200 (CEST) Received: (qmail 64134 invoked by uid 500); 6 Apr 2017 13:18:30 -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 64124 invoked by uid 99); 6 Apr 2017 13:18:30 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 06 Apr 2017 13:18:30 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 07057DFE5C; Thu, 6 Apr 2017 13:18:30 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: bodewig@apache.org To: commits@commons.apache.org Date: Thu, 06 Apr 2017 13:18:30 -0000 Message-Id: <8aa3ee4b00f24431a86926507e940397@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [1/3] commons-compress git commit: cosmetics archived-at: Thu, 06 Apr 2017 13:18:32 -0000 Repository: commons-compress Updated Branches: refs/heads/master 3381e41ab -> 5ce60be9d cosmetics Project: http://git-wip-us.apache.org/repos/asf/commons-compress/repo Commit: http://git-wip-us.apache.org/repos/asf/commons-compress/commit/47213feb Tree: http://git-wip-us.apache.org/repos/asf/commons-compress/tree/47213feb Diff: http://git-wip-us.apache.org/repos/asf/commons-compress/diff/47213feb Branch: refs/heads/master Commit: 47213feb954bef78d646da4f4ffe6a8156c7d3f5 Parents: 3381e41 Author: Stefan Bodewig Authored: Thu Apr 6 10:32:33 2017 +0200 Committer: Stefan Bodewig Committed: Thu Apr 6 10:32:33 2017 +0200 ---------------------------------------------------------------------- .../lz4/BlockLZ4CompressorOutputStream.java | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/commons-compress/blob/47213feb/src/main/java/org/apache/commons/compress/compressors/lz4/BlockLZ4CompressorOutputStream.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/commons/compress/compressors/lz4/BlockLZ4CompressorOutputStream.java b/src/main/java/org/apache/commons/compress/compressors/lz4/BlockLZ4CompressorOutputStream.java index d3249db..dfce36e 100644 --- a/src/main/java/org/apache/commons/compress/compressors/lz4/BlockLZ4CompressorOutputStream.java +++ b/src/main/java/org/apache/commons/compress/compressors/lz4/BlockLZ4CompressorOutputStream.java @@ -385,14 +385,12 @@ public class BlockLZ4CompressorOutputStream extends CompressorOutputStream { } Pair splitCandidate = lastPairs.get(0); int stillNeeded = MIN_OFFSET_OF_LAST_BACK_REFERENCE - toExpand; - if (splitCandidate.hasBackReference() - && splitCandidate.backReferenceLength() >= MIN_BACK_REFERENCE_LENGTH + stillNeeded) { + int brLen = splitCandidate.hasBackReference() ? splitCandidate.backReferenceLength() : 0; + if (splitCandidate.hasBackReference() && brLen >= MIN_BACK_REFERENCE_LENGTH + stillNeeded) { replacement.prependLiteral(expand(toExpand + stillNeeded, stillNeeded)); - pairs.add(splitCandidate.splitWithNewBackReferenceLengthOf(splitCandidate.backReferenceLength() - - stillNeeded)); + pairs.add(splitCandidate.splitWithNewBackReferenceLengthOf(brLen - stillNeeded)); } else { if (splitCandidate.hasBackReference()) { - int brLen = splitCandidate.backReferenceLength(); replacement.prependLiteral(expand(toExpand + brLen, brLen)); } splitCandidate.prependTo(replacement); @@ -487,9 +485,9 @@ public class BlockLZ4CompressorOutputStream extends CompressorOutputStream { return brLength; } private void prependTo(Pair other) { - Iterator litsBackwards = literals.descendingIterator(); - while (litsBackwards.hasNext()) { - other.prependLiteral(litsBackwards.next()); + Iterator listBackwards = literals.descendingIterator(); + while (listBackwards.hasNext()) { + other.prependLiteral(listBackwards.next()); } } private Pair splitWithNewBackReferenceLengthOf(int newBackReferenceLength) {