Merge "Fix Binary dict tests"
commit
03d1dff38d
|
@ -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();
|
||||
|
|
Loading…
Reference in New Issue