From f29741d1d86ea9baa7a37545da29be38a9d1af02 Mon Sep 17 00:00:00 2001 From: "Shawn O. Pearce" Date: Tue, 6 Jul 2010 19:38:39 -0700 Subject: [PATCH] amend commit: Support large delta packed objects as streams Rename the ByteWindow's inflate() method to setInput. We have completely refactored the purpose of this method to be feeding part (or all) of the window as input to the Inflater, and the actual inflate activity happens in the caller. Change-Id: Ie93a5bae0e9e637b5e822d56993ce6b562c6ad15 Signed-off-by: Shawn O. Pearce --- .../src/org/eclipse/jgit/storage/file/ByteArrayWindow.java | 2 +- .../src/org/eclipse/jgit/storage/file/ByteBufferWindow.java | 2 +- .../src/org/eclipse/jgit/storage/file/ByteWindow.java | 6 +++--- .../src/org/eclipse/jgit/storage/file/WindowCursor.java | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/ByteArrayWindow.java b/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/ByteArrayWindow.java index 0e85c58dc..457c8dc90 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/ByteArrayWindow.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/ByteArrayWindow.java @@ -70,7 +70,7 @@ final class ByteArrayWindow extends ByteWindow { } @Override - protected int inflate(final int pos, final Inflater inf) + protected int setInput(final int pos, final Inflater inf) throws DataFormatException { int n = array.length - pos; inf.setInput(array, pos, n); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/ByteBufferWindow.java b/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/ByteBufferWindow.java index c6308cc1d..29a015995 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/ByteBufferWindow.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/ByteBufferWindow.java @@ -72,7 +72,7 @@ final class ByteBufferWindow extends ByteWindow { } @Override - protected int inflate(final int pos, final Inflater inf) + protected int setInput(final int pos, final Inflater inf) throws DataFormatException { final ByteBuffer s = buffer.slice(); s.position(pos); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/ByteWindow.java b/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/ByteWindow.java index e95dfd30f..f92efb4ac 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/ByteWindow.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/ByteWindow.java @@ -117,10 +117,10 @@ abstract class ByteWindow { */ protected abstract int copy(int pos, byte[] dstbuf, int dstoff, int cnt); - final int inflate(long pos, Inflater inf) throws DataFormatException { - return inflate((int) (pos - start), inf); + final int setInput(long pos, Inflater inf) throws DataFormatException { + return setInput((int) (pos - start), inf); } - protected abstract int inflate(int pos, Inflater inf) + protected abstract int setInput(int pos, Inflater inf) throws DataFormatException; } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/WindowCursor.java b/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/WindowCursor.java index 33ca006e7..6f4e72a82 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/WindowCursor.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/WindowCursor.java @@ -171,13 +171,13 @@ final class WindowCursor extends ObjectReader implements ObjectReuseAsIs { int dstoff) throws IOException, DataFormatException { prepareInflater(); pin(pack, position); - position += window.inflate(position, inf); + position += window.setInput(position, inf); do { int n = inf.inflate(dstbuf, dstoff, dstbuf.length - dstoff); if (n == 0) { if (inf.needsInput()) { pin(pack, position); - position += window.inflate(position, inf); + position += window.setInput(position, inf); } else if (inf.finished()) return dstoff; else