diff options
Diffstat (limited to 'org.eclipse.jgit/src/org/eclipse/jgit/util/RawSubStringPattern.java')
-rw-r--r-- | org.eclipse.jgit/src/org/eclipse/jgit/util/RawSubStringPattern.java | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/util/RawSubStringPattern.java b/org.eclipse.jgit/src/org/eclipse/jgit/util/RawSubStringPattern.java index 2f7f486e91..bc101bd7d7 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/util/RawSubStringPattern.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/util/RawSubStringPattern.java @@ -95,21 +95,21 @@ public class RawSubStringPattern { int matchPos = rcs.startPtr; final int maxPos = rcs.endPtr - needleLen; - OUTER: for (; matchPos < maxPos; matchPos++) { + OUTER: for (; matchPos <= maxPos; matchPos++) { if (neq(first, text[matchPos])) { - while (++matchPos < maxPos && neq(first, text[matchPos])) { + while (++matchPos <= maxPos && neq(first, text[matchPos])) { /* skip */ } - if (matchPos == maxPos) + if (matchPos > maxPos) return -1; } - int si = ++matchPos; + int si = matchPos + 1; for (int j = 1; j < needleLen; j++, si++) { if (neq(needle[j], text[si])) continue OUTER; } - return matchPos - 1; + return matchPos; } return -1; } |