Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@5725 6c8d7289-2bf4-0310-a012-ef5d649a1542
  • Loading branch information
orbiter committed Mar 17, 2009
1 parent a9cea41 commit 0c3ab29
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions source/de/anomic/kelondro/order/Base64Order.java
Expand Up @@ -258,7 +258,14 @@ private final long cardinalI(final byte[] key, int off, int len) {
long c = 0;
int lim = off + Math.min(10, len);
int lim10 = off + 10;
while (off < lim) c = (c << 6) | ahpla[key[off++]];
byte b;
while (off < lim) {
b = key[off++];
if (b < 0) return -1;
b = ahpla[b];
if (b < 0) return -1;
c = (c << 6) | b;
}
while (off++ < lim10) c = (c << 6);
c = c << 3;
assert c >= 0;
Expand All @@ -281,7 +288,12 @@ private final long cardinalI(final String key) {
// returns a cardinal number in the range of 0 .. Long.MAX_VALUE
long c = 0;
int p = 0;
while ((p < 10) && (p < key.length())) c = (c << 6) | ahpla[key.charAt(p++)];
byte b;
while ((p < 10) && (p < key.length())) {
b = ahpla[key.charAt(p++)];
if (b < 0) return -1;
c = (c << 6) |b;
}
while (p++ < 10) c = (c << 6);
c = c << 3;
assert c >= 0;
Expand Down

0 comments on commit 0c3ab29

Please sign in to comment.