Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShawn O. Pearce2010-05-16 02:10:47 +0000
committerShawn O. Pearce2010-05-17 14:13:55 +0000
commitae972e774e2eb8c72585ad3d4e02687a5c2df66f (patch)
treed520e80d33fc6cc9c1d25d163bc8360df05f137f
parentb6d0586befb3417a72730443770abb223b9cae83 (diff)
downloadjgit-ae972e774e2eb8c72585ad3d4e02687a5c2df66f.tar.gz
jgit-ae972e774e2eb8c72585ad3d4e02687a5c2df66f.tar.xz
jgit-ae972e774e2eb8c72585ad3d4e02687a5c2df66f.zip
Remove unnecessary truncation of in-pack size during copy
The number of bytes to copy was truncated to an int, but the pack's copyToStream() method expected to be passed a long here. Pass through the long so we don't truncate a giant object. Change-Id: I0786ad60a3a33f84d8746efe51f68d64e127c332 Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/lib/PackFile.java6
1 files changed, 3 insertions, 3 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/PackFile.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/PackFile.java
index 28edf30cd3..63f5162631 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/PackFile.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/PackFile.java
@@ -270,7 +270,7 @@ public class PackFile implements Iterable<PackIndex.MutableEntry> {
throws IOException {
final long objectOffset = loader.objectOffset;
final long dataOffset = objectOffset + loader.headerSize;
- final int cnt = (int) (findEndOffset(objectOffset) - dataOffset);
+ final long sz = findEndOffset(objectOffset) - dataOffset;
final PackIndex idx = idx();
if (idx.hasCRC32Support()) {
@@ -283,7 +283,7 @@ public class PackFile implements Iterable<PackIndex.MutableEntry> {
headerCnt -= toRead;
}
final CheckedOutputStream crcOut = new CheckedOutputStream(out, crc);
- copyToStream(dataOffset, buf, cnt, crcOut, curs);
+ copyToStream(dataOffset, buf, sz, crcOut, curs);
final long computed = crc.getValue();
final ObjectId id = findObjectForOffset(objectOffset);
@@ -301,7 +301,7 @@ public class PackFile implements Iterable<PackIndex.MutableEntry> {
coe.initCause(dfe);
throw coe;
}
- copyToStream(dataOffset, buf, cnt, out, curs);
+ copyToStream(dataOffset, buf, sz, out, curs);
}
}

Back to the top