aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit
diff options
context:
space:
mode:
authorShawn O. Pearce <spearce@spearce.org>2010-07-07 08:52:46 -0700
committerShawn O. Pearce <spearce@spearce.org>2010-07-07 09:52:09 -0700
commit711bd3e3d035b22e41bda32a9463cef3e2dca7a7 (patch)
tree11d9203f5f7f4412182907e153e8d2fa365a87ad /org.eclipse.jgit
parentcd7dd8591eccd093707c98bc68743dfae4f37b80 (diff)
downloadjgit-711bd3e3d035b22e41bda32a9463cef3e2dca7a7.tar.gz
jgit-711bd3e3d035b22e41bda32a9463cef3e2dca7a7.zip
Define a constant for 127 in DeltaEncoder
The special value 127 here means how many bytes we can put into a single insert command. Rather than use the magical value 127, lets name it to better document the code. Change-Id: I5a326f4380f6ac87987fa833e9477700e984a88e Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Diffstat (limited to 'org.eclipse.jgit')
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/DeltaEncoder.java5
1 files changed, 4 insertions, 1 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/DeltaEncoder.java b/org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/DeltaEncoder.java
index 9254acc1b8..9984eb1ff1 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/DeltaEncoder.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/DeltaEncoder.java
@@ -70,6 +70,9 @@ public class DeltaEncoder {
/** Maximum number of bytes used by a copy instruction. */
private static final int MAX_COPY_CMD_SIZE = 8;
+ /** Maximum length that an an insert command can encode at once. */
+ private static final int MAX_INSERT_DATA_SIZE = 127;
+
private final OutputStream out;
private final byte[] buf = new byte[MAX_COPY_CMD_SIZE * 4];
@@ -151,7 +154,7 @@ public class DeltaEncoder {
*/
public void insert(byte[] text, int off, int cnt) throws IOException {
while (0 < cnt) {
- int n = Math.min(127, cnt);
+ int n = Math.min(MAX_INSERT_DATA_SIZE, cnt);
out.write((byte) n);
out.write(text, off, n);
off += n;