Skip to content
Snippets Groups Projects
Commit ae972e77 authored by Shawn Pearce's avatar Shawn Pearce
Browse files

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: default avatarShawn O. Pearce <spearce@spearce.org>
parent b6d0586b
No related branches found
No related tags found
No related merge requests found
......@@ -270,7 +270,7 @@ final void copyRawData(final PackedObjectLoader loader,
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 @@ final void copyRawData(final PackedObjectLoader loader,
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 @@ final void copyRawData(final PackedObjectLoader loader,
coe.initCause(dfe);
throw coe;
}
copyToStream(dataOffset, buf, cnt, out, curs);
copyToStream(dataOffset, buf, sz, out, curs);
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment