[JGIT PATCH 18/23] Correctly use a long for the offsets within a generated pack

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Pack files can be larger than 2 GiB, especially if the PackIndexV2
format is being used.

Signed-off-by: Shawn O. Pearce <spearce@xxxxxxxxxxx>
---
 .../tst/org/spearce/jgit/lib/PackWriterTest.java   |   12 ++++++------
 .../spearce/jgit/util/CountingOutputStream.java    |    5 ++---
 2 files changed, 8 insertions(+), 9 deletions(-)

diff --git a/org.spearce.jgit.test/tst/org/spearce/jgit/lib/PackWriterTest.java b/org.spearce.jgit.test/tst/org/spearce/jgit/lib/PackWriterTest.java
index ec138a0..98e0d3a 100644
--- a/org.spearce.jgit.test/tst/org/spearce/jgit/lib/PackWriterTest.java
+++ b/org.spearce.jgit.test/tst/org/spearce/jgit/lib/PackWriterTest.java
@@ -308,11 +308,11 @@ public void testWritePack4ThinPack() throws IOException {
 	 */
 	public void testWritePack2SizeDeltasVsNoDeltas() throws Exception {
 		testWritePack2();
-		final int sizePack2NoDeltas = cos.getCount();
+		final long sizePack2NoDeltas = cos.getCount();
 		tearDown();
 		setUp();
 		testWritePack2DeltasReuseRefs();
-		final int sizePack2DeltasRefs = cos.getCount();
+		final long sizePack2DeltasRefs = cos.getCount();
 
 		assertTrue(sizePack2NoDeltas > sizePack2DeltasRefs);
 	}
@@ -327,11 +327,11 @@ public void testWritePack2SizeDeltasVsNoDeltas() throws Exception {
 	 */
 	public void testWritePack2SizeOffsetsVsRefs() throws Exception {
 		testWritePack2DeltasReuseRefs();
-		final int sizePack2DeltasRefs = cos.getCount();
+		final long sizePack2DeltasRefs = cos.getCount();
 		tearDown();
 		setUp();
 		testWritePack2DeltasReuseOffsets();
-		final int sizePack2DeltasOffsets = cos.getCount();
+		final long sizePack2DeltasOffsets = cos.getCount();
 
 		assertTrue(sizePack2DeltasRefs > sizePack2DeltasOffsets);
 	}
@@ -345,11 +345,11 @@ public void testWritePack2SizeOffsetsVsRefs() throws Exception {
 	 */
 	public void testWritePack4SizeThinVsNoThin() throws Exception {
 		testWritePack4();
-		final int sizePack4 = cos.getCount();
+		final long sizePack4 = cos.getCount();
 		tearDown();
 		setUp();
 		testWritePack4ThinPack();
-		final int sizePack4Thin = cos.getCount();
+		final long sizePack4Thin = cos.getCount();
 
 		assertTrue(sizePack4 > sizePack4Thin);
 	}
diff --git a/org.spearce.jgit/src/org/spearce/jgit/util/CountingOutputStream.java b/org.spearce.jgit/src/org/spearce/jgit/util/CountingOutputStream.java
index 53935dc..b0b5f7d 100644
--- a/org.spearce.jgit/src/org/spearce/jgit/util/CountingOutputStream.java
+++ b/org.spearce.jgit/src/org/spearce/jgit/util/CountingOutputStream.java
@@ -45,8 +45,7 @@
  * Counting output stream decoration. Counts bytes written to stream.
  */
 public class CountingOutputStream extends FilterOutputStream {
-
-	private int count;
+	private long count;
 
 	/**
 	 * Create counting stream being decorated to provided real output stream.
@@ -76,7 +75,7 @@ public void write(byte[] b, int off, int len) throws IOException {
 	 * @return number of written bytes since last reset (object is reset upon
 	 *         creation)
 	 */
-	public int getCount() {
+	public long getCount() {
 		return count;
 	}
 
-- 
1.6.1.rc4.301.g5497a

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux