Skip to content
Snippets Groups Projects
Commit ba5e450e authored by Jean Chalard's avatar Jean Chalard Committed by Android Git Automerger
Browse files

am 69ffa8b0: am 03d1dff3: Merge "Fix Binary dict tests"

* commit '69ffa8b0':
  Fix Binary dict tests
parents e157fa50 69ffa8b0
No related branches found
No related tags found
No related merge requests found
......@@ -1467,8 +1467,8 @@ public final class BinaryDictInputOutput {
if (null == last) continue;
builder.append(new String(last.mCharacters, 0, last.mCharacters.length));
buffer.position(last.mChildrenAddress + headerSize);
groupOffset = last.mChildrenAddress + 1;
i = buffer.readUnsignedByte();
i = readCharGroupCount(buffer);
groupOffset = last.mChildrenAddress + getGroupCountSize(i);
last = null;
continue;
}
......@@ -1477,8 +1477,8 @@ public final class BinaryDictInputOutput {
if (0 == i && hasChildrenAddress(last.mChildrenAddress)) {
builder.append(new String(last.mCharacters, 0, last.mCharacters.length));
buffer.position(last.mChildrenAddress + headerSize);
groupOffset = last.mChildrenAddress + 1;
i = buffer.readUnsignedByte();
i = readCharGroupCount(buffer);
groupOffset = last.mChildrenAddress + getGroupCountSize(i);
last = null;
continue;
}
......
......@@ -137,7 +137,10 @@ public class BinaryDictIOTests extends AndroidTestCase {
if (r < 0) continue;
// Don't insert 0~20, but insert any other code point.
// Code points are in the range 0~0x10FFFF.
builder.appendCodePoint((int)(20 + r % (0x10FFFF - 20)));
final int candidateCodePoint = (int)(20 + r % (0x10FFFF - 20));
// Code points between 0xD800 and 0xDFFF are not valid.
if (candidateCodePoint >= 0xD800 && candidateCodePoint <= 0xDFFF) continue;
builder.appendCodePoint(candidadeCodePoint);
--count;
}
return builder.toString();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment