Initial step to support version 4 format in native code.
Bug: 11073222 Change-Id: I633229381b28cef23edef2b37e5b0bf6e15af468main
parent
d823988b53
commit
e1bd7d5d39
|
@ -42,6 +42,9 @@ namespace latinime {
|
||||||
return new PatriciaTriePolicy(mmapedBuffer);
|
return new PatriciaTriePolicy(mmapedBuffer);
|
||||||
case FormatUtils::VERSION_3:
|
case FormatUtils::VERSION_3:
|
||||||
return new DynamicPatriciaTriePolicy(mmapedBuffer);
|
return new DynamicPatriciaTriePolicy(mmapedBuffer);
|
||||||
|
case FormatUtils::VERSION_4:
|
||||||
|
// TODO: Support version 4 dictionary format.
|
||||||
|
// Fall through.
|
||||||
default:
|
default:
|
||||||
AKLOGE("DICT: dictionary format is unknown, bad magic number");
|
AKLOGE("DICT: dictionary format is unknown, bad magic number");
|
||||||
delete mmapedBuffer;
|
delete mmapedBuffer;
|
||||||
|
|
|
@ -118,6 +118,9 @@ const char *const HeaderReadWriteUtils::REQUIRES_FRENCH_LIGATURE_PROCESSING_KEY
|
||||||
case FormatUtils::VERSION_3:
|
case FormatUtils::VERSION_3:
|
||||||
return buffer->writeUintAndAdvancePosition(3 /* data */,
|
return buffer->writeUintAndAdvancePosition(3 /* data */,
|
||||||
HEADER_DICTIONARY_VERSION_SIZE, writingPos);
|
HEADER_DICTIONARY_VERSION_SIZE, writingPos);
|
||||||
|
case FormatUtils::VERSION_4:
|
||||||
|
return buffer->writeUintAndAdvancePosition(4 /* data */,
|
||||||
|
HEADER_DICTIONARY_VERSION_SIZE, writingPos);
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,6 +33,9 @@ const char *const DictFileWritingUtils::TEMP_FILE_SUFFIX_FOR_WRITING_DICT_FILE =
|
||||||
switch (dictVersion) {
|
switch (dictVersion) {
|
||||||
case 3:
|
case 3:
|
||||||
return createEmptyV3DictFile(filePath, attributeMap);
|
return createEmptyV3DictFile(filePath, attributeMap);
|
||||||
|
case 4:
|
||||||
|
// TODO: Support version 4 dictionary format.
|
||||||
|
return false;
|
||||||
default:
|
default:
|
||||||
// Only version 3 dictionary is supported for now.
|
// Only version 3 dictionary is supported for now.
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -45,6 +45,8 @@ const int FormatUtils::DICTIONARY_MINIMUM_SIZE = 12;
|
||||||
return VERSION_2;
|
return VERSION_2;
|
||||||
} else if (ByteArrayUtils::readUint16(dict, 4) == 3) {
|
} else if (ByteArrayUtils::readUint16(dict, 4) == 3) {
|
||||||
return VERSION_3;
|
return VERSION_3;
|
||||||
|
} else if (ByteArrayUtils::readUint16(dict, 4) == 4) {
|
||||||
|
return VERSION_4;
|
||||||
} else {
|
} else {
|
||||||
return UNKNOWN_VERSION;
|
return UNKNOWN_VERSION;
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,6 +31,7 @@ class FormatUtils {
|
||||||
enum FORMAT_VERSION {
|
enum FORMAT_VERSION {
|
||||||
VERSION_2,
|
VERSION_2,
|
||||||
VERSION_3,
|
VERSION_3,
|
||||||
|
VERSION_4,
|
||||||
UNKNOWN_VERSION
|
UNKNOWN_VERSION
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue