* [PATCH JGIT] fix for 'negative position' error @ 2009-03-11 15:19 Ruth Alkema 2009-03-11 15:24 ` Shawn O. Pearce 0 siblings, 1 reply; 3+ messages in thread From: Ruth Alkema @ 2009-03-11 15:19 UTC (permalink / raw) To: Shawn O. Pearce, Robin Rosenberg; +Cc: git >From 78972d51ddd6bcbdf25bd49d2a033c005cf301b1 From: Ruth Alkema <ruth@diasoft.nl> Date: Wed, 11 Mar 2009 15:49:22 +0100 Signed-off-by: Ruth Alkema <ruth@diasoft.nl> --- .../src/org/spearce/jgit/lib/WindowCache.java | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/org.spearce.jgit/src/org/spearce/jgit/lib/WindowCache.java b/org.spearce.jgit/src/org/spearce/jgit/lib/WindowCache.java index 4b7e10d..5340da9 100644 --- a/org.spearce.jgit/src/org/spearce/jgit/lib/WindowCache.java +++ b/org.spearce.jgit/src/org/spearce/jgit/lib/WindowCache.java @@ -253,7 +253,7 @@ private static synchronized final void getImpl(final WindowCursor curs, releaseMemory(); runClearedWindowQueue(); - wp.allocWindow(curs, id, id << windowSizeShift, wsz); + wp.allocWindow(curs, id, ((long) id) << windowSizeShift, wsz); final ByteWindow<?> e = curs.window; e.chainNext = cache[idx]; cache[idx] = e; -- 1.6.0.6 ^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH JGIT] fix for 'negative position' error 2009-03-11 15:19 [PATCH JGIT] fix for 'negative position' error Ruth Alkema @ 2009-03-11 15:24 ` Shawn O. Pearce 2009-03-11 15:51 ` Ruth Alkema 0 siblings, 1 reply; 3+ messages in thread From: Shawn O. Pearce @ 2009-03-11 15:24 UTC (permalink / raw) To: Ruth Alkema; +Cc: Robin Rosenberg, git Ruth Alkema <ruth@diasoft.nl> wrote: > diff --git a/org.spearce.jgit/src/org/spearce/jgit/lib/WindowCache.java b/org.spearce.jgit/src/org/spearce/jgit/lib/WindowCache.java > index 4b7e10d..5340da9 100644 > --- a/org.spearce.jgit/src/org/spearce/jgit/lib/WindowCache.java > +++ b/org.spearce.jgit/src/org/spearce/jgit/lib/WindowCache.java > @@ -253,7 +253,7 @@ private static synchronized final void getImpl(final WindowCursor curs, > releaseMemory(); > runClearedWindowQueue(); > > - wp.allocWindow(curs, id, id << windowSizeShift, wsz); > + wp.allocWindow(curs, id, ((long) id) << windowSizeShift, wsz); Ouch. Thanks for the fix! -- Shawn. ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH JGIT] fix for 'negative position' error 2009-03-11 15:24 ` Shawn O. Pearce @ 2009-03-11 15:51 ` Ruth Alkema 0 siblings, 0 replies; 3+ messages in thread From: Ruth Alkema @ 2009-03-11 15:51 UTC (permalink / raw) To: Shawn O. Pearce; +Cc: Robin Rosenberg, git On second thought, I think that my previous patch can still go wrong for large values in 'position' I think the following patch should work. Kind 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. Ruth Alkema >From 5e7200f02f91d948278fb515be59bfe2db535b66 Mon Sep 17 00:00:00 2001 From: Ruth Alkema <ruth@diasoft.nl> Date: Wed, 11 Mar 2009 16:42:45 +0100 Subject: [PATCH] fix for 'negative position' error Signed-off-by: Ruth Alkema <ruth@diasoft.nl> --- .../src/org/spearce/jgit/lib/WindowCache.java | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/org.spearce.jgit/src/org/spearce/jgit/lib/WindowCache.java b/org.spearce.jgit/src/org/spearce/jgit/lib/WindowCache.java index 4b7e10d..597ad61 100644 --- a/org.spearce.jgit/src/org/spearce/jgit/lib/WindowCache.java +++ b/org.spearce.jgit/src/org/spearce/jgit/lib/WindowCache.java @@ -253,7 +253,7 @@ private static synchronized final void getImpl(final WindowCursor curs, releaseMemory(); runClearedWindowQueue(); - wp.allocWindow(curs, id, id << windowSizeShift, wsz); + wp.allocWindow(curs, id, (position >> windowSizeShift) << windowSizeShift, wsz); final ByteWindow<?> e = curs.window; e.chainNext = cache[idx]; cache[idx] = e; -- 1.6.0.6 Shawn O. Pearce wrote: > Ruth Alkema <ruth@diasoft.nl> wrote: >> diff --git a/org.spearce.jgit/src/org/spearce/jgit/lib/WindowCache.java b/org.spearce.jgit/src/org/spearce/jgit/lib/WindowCache.java >> index 4b7e10d..5340da9 100644 >> --- a/org.spearce.jgit/src/org/spearce/jgit/lib/WindowCache.java >> +++ b/org.spearce.jgit/src/org/spearce/jgit/lib/WindowCache.java >> @@ -253,7 +253,7 @@ private static synchronized final void getImpl(final WindowCursor curs, >> releaseMemory(); >> runClearedWindowQueue(); >> >> - wp.allocWindow(curs, id, id << windowSizeShift, wsz); >> + wp.allocWindow(curs, id, ((long) id) << windowSizeShift, wsz); > > Ouch. > > Thanks for the fix! > ^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2009-03-11 15:52 UTC | newest] Thread overview: 3+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2009-03-11 15:19 [PATCH JGIT] fix for 'negative position' error Ruth Alkema 2009-03-11 15:24 ` Shawn O. Pearce 2009-03-11 15:51 ` Ruth Alkema
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).