{"thread":{"id":"18269","subject":"Re: [PATCH JGIT] fix for 'negative position' error","startedAt":"2009-03-11T15:19:31Z","lastAt":"2009-03-11T15:51:05Z","messageCount":3,"participants":["Shawn O. Pearce","Ruth Alkema"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"107701","messageId":"49B7D683.1070805@diasoft.nl","threadId":"18269","inReplyTo":null,"subject":"[PATCH JGIT] fix for 'negative position' error","fromName":"Ruth Alkema","fromEmail":"ruth@diasoft.nl","sentAt":"2009-03-11T15:19:31Z","receivedAt":"2009-03-11T15:19:31Z","isPatch":true,"sender":{"key":"ruth@diasoft.nl","avatar":null},"body":">From 78972d51ddd6bcbdf25bd49d2a033c005cf301b1 \nFrom: Ruth Alkema <ruth@diasoft.nl>\nDate: Wed, 11 Mar 2009 15:49:22 +0100\n\nSigned-off-by: Ruth Alkema <ruth@diasoft.nl>\n---\n .../src/org/spearce/jgit/lib/WindowCache.java      |    2 +-\n 1 files changed, 1 insertions(+), 1 deletions(-)\n\ndiff --git a/org.spearce.jgit/src/org/spearce/jgit/lib/WindowCache.java b/org.spearce.jgit/src/org/spearce/jgit/lib/WindowCache.java\nindex 4b7e10d..5340da9 100644\n--- a/org.spearce.jgit/src/org/spearce/jgit/lib/WindowCache.java\n+++ b/org.spearce.jgit/src/org/spearce/jgit/lib/WindowCache.java\n@@ -253,7 +253,7 @@ private static synchronized final void getImpl(final WindowCursor curs,\n \t\treleaseMemory();\n \t\trunClearedWindowQueue();\n \n-\t\twp.allocWindow(curs, id, id << windowSizeShift, wsz);\n+\t\twp.allocWindow(curs, id, ((long) id) << windowSizeShift, wsz);\n \t\tfinal ByteWindow<?> e = curs.window;\n \t\te.chainNext = cache[idx];\n \t\tcache[idx] = e;\n-- \n1.6.0.6\n"},{"id":"107700","messageId":"20090311152442.GS11989@spearce.org","threadId":"18269","inReplyTo":"49B7D683.1070805@diasoft.nl","subject":"Re: [PATCH JGIT] fix for 'negative position' error","fromName":"Shawn O. Pearce","fromEmail":"spearce@spearce.org","sentAt":"2009-03-11T15:24:42Z","receivedAt":"2009-03-11T15:24:42Z","isPatch":true,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"Ruth Alkema <ruth@diasoft.nl> wrote:\n> diff --git a/org.spearce.jgit/src/org/spearce/jgit/lib/WindowCache.java b/org.spearce.jgit/src/org/spearce/jgit/lib/WindowCache.java\n> index 4b7e10d..5340da9 100644\n> --- a/org.spearce.jgit/src/org/spearce/jgit/lib/WindowCache.java\n> +++ b/org.spearce.jgit/src/org/spearce/jgit/lib/WindowCache.java\n> @@ -253,7 +253,7 @@ private static synchronized final void getImpl(final WindowCursor curs,\n>  \t\treleaseMemory();\n>  \t\trunClearedWindowQueue();\n>  \n> -\t\twp.allocWindow(curs, id, id << windowSizeShift, wsz);\n> +\t\twp.allocWindow(curs, id, ((long) id) << windowSizeShift, wsz);\n\nOuch.\n\nThanks for the fix!\n\n-- \nShawn.\n"},{"id":"107706","messageId":"49B7DDE9.7070407@diasoft.nl","threadId":"18269","inReplyTo":"20090311152442.GS11989@spearce.org","subject":"Re: [PATCH JGIT] fix for 'negative position' error","fromName":"Ruth Alkema","fromEmail":"ruth@diasoft.nl","sentAt":"2009-03-11T15:51:05Z","receivedAt":"2009-03-11T15:51:05Z","isPatch":true,"sender":{"key":"ruth@diasoft.nl","avatar":null},"body":"On second thought, I think that my previous patch can still go wrong for large values in 'position' \nI think the following patch should work.\n\nKind regards, I hope the email is according to the guidelines for submitting patches, I am new to git, I used 'amend previous commit', I am not sure if that is correct in this case.\n\nRuth Alkema\n\n\n>From 5e7200f02f91d948278fb515be59bfe2db535b66 Mon Sep 17 00:00:00 2001\nFrom: Ruth Alkema <ruth@diasoft.nl>\nDate: Wed, 11 Mar 2009 16:42:45 +0100\nSubject: [PATCH] fix for 'negative position' error\n\nSigned-off-by: Ruth Alkema <ruth@diasoft.nl>\n---\n .../src/org/spearce/jgit/lib/WindowCache.java      |    2 +-\n 1 files changed, 1 insertions(+), 1 deletions(-)\n\ndiff --git a/org.spearce.jgit/src/org/spearce/jgit/lib/WindowCache.java b/org.spearce.jgit/src/org/spearce/jgit/lib/WindowCache.java\nindex 4b7e10d..597ad61 100644\n--- a/org.spearce.jgit/src/org/spearce/jgit/lib/WindowCache.java\n+++ b/org.spearce.jgit/src/org/spearce/jgit/lib/WindowCache.java\n@@ -253,7 +253,7 @@ private static synchronized final void getImpl(final WindowCursor curs,\n \t\treleaseMemory();\n \t\trunClearedWindowQueue();\n \n-\t\twp.allocWindow(curs, id, id << windowSizeShift, wsz);\n+\t\twp.allocWindow(curs, id, (position >> windowSizeShift) << windowSizeShift, wsz);\n \t\tfinal ByteWindow<?> e = curs.window;\n \t\te.chainNext = cache[idx];\n \t\tcache[idx] = e;\n-- \n1.6.0.6\n\n\nShawn O. Pearce wrote:\n> Ruth Alkema <ruth@diasoft.nl> wrote:\n>> diff --git a/org.spearce.jgit/src/org/spearce/jgit/lib/WindowCache.java b/org.spearce.jgit/src/org/spearce/jgit/lib/WindowCache.java\n>> index 4b7e10d..5340da9 100644\n>> --- a/org.spearce.jgit/src/org/spearce/jgit/lib/WindowCache.java\n>> +++ b/org.spearce.jgit/src/org/spearce/jgit/lib/WindowCache.java\n>> @@ -253,7 +253,7 @@ private static synchronized final void getImpl(final WindowCursor curs,\n>>  \t\treleaseMemory();\n>>  \t\trunClearedWindowQueue();\n>>  \n>> -\t\twp.allocWindow(curs, id, id << windowSizeShift, wsz);\n>> +\t\twp.allocWindow(curs, id, ((long) id) << windowSizeShift, wsz);\n> \n> Ouch.\n> \n> Thanks for the fix!\n> \n"}]}