]> source.dussan.org Git - jgit.git/commitdiff
amend commit: Support large delta packed objects as streams 73/1073/2
authorShawn O. Pearce <spearce@spearce.org>
Wed, 7 Jul 2010 02:38:39 +0000 (19:38 -0700)
committerShawn O. Pearce <spearce@spearce.org>
Wed, 7 Jul 2010 02:41:06 +0000 (19:41 -0700)
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 <spearce@spearce.org>
org.eclipse.jgit/src/org/eclipse/jgit/storage/file/ByteArrayWindow.java
org.eclipse.jgit/src/org/eclipse/jgit/storage/file/ByteBufferWindow.java
org.eclipse.jgit/src/org/eclipse/jgit/storage/file/ByteWindow.java
org.eclipse.jgit/src/org/eclipse/jgit/storage/file/WindowCursor.java

index 0e85c58dc21207a6f2b290cc494c430d0ee38225..457c8dc90a082f6609a5eaad5f23fec8a3ff0a71 100644 (file)
@@ -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);
index c6308cc1d763aa953d6d794fe56584147a9c1b1e..29a0159950f3d0053a1f746265bcfefb2a2ed884 100644 (file)
@@ -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);
index e95dfd30f7f622f6170a7a65bc78b6c5a218e8ee..f92efb4ac900ba15e06e06233024f2737f0c7996 100644 (file)
@@ -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;
 }
index 33ca006e7c95756ae73bb733a2d3616624ac84bb..6f4e72a82fd74ef05bc76908957a23065507a982 100644 (file)
@@ -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