зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1565515 - Removed duplication between LengthOfEncodedBinary and CalcDecodedStringySize r=ttung,asuth
Differential Revision: https://phabricator.services.mozilla.com/D38173 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
aad3e51566
Коммит
ca5d9c23b2
|
@ -123,16 +123,12 @@ IDBResult<void, IDBSpecialValue::Invalid> Key::SetFromString(
|
||||||
// |aPos| should point to the type indicator.
|
// |aPos| should point to the type indicator.
|
||||||
// The returned length doesn't include the type indicator
|
// The returned length doesn't include the type indicator
|
||||||
// or the terminator.
|
// or the terminator.
|
||||||
static size_t LengthOfEncodedBinary(const unsigned char* aPos,
|
// static
|
||||||
const unsigned char* aEnd) {
|
uint32_t Key::LengthOfEncodedBinary(const EncodedDataType* aPos,
|
||||||
|
const EncodedDataType* aEnd) {
|
||||||
MOZ_ASSERT(*aPos % Key::eMaxType == Key::eBinary, "Don't call me!");
|
MOZ_ASSERT(*aPos % Key::eMaxType == Key::eBinary, "Don't call me!");
|
||||||
auto iter = ++aPos;
|
const EncodedDataType* encodedSectionEnd;
|
||||||
for (; iter < aEnd && *iter != Key::eTerminator; ++iter) {
|
return CalcDecodedStringySize<uint8_t>(aPos + 1, aEnd, &encodedSectionEnd);
|
||||||
if (*iter & 0x80) {
|
|
||||||
iter++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return iter - aPos;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
IDBResult<void, IDBSpecialValue::Invalid> Key::ToLocaleBasedKey(
|
IDBResult<void, IDBSpecialValue::Invalid> Key::ToLocaleBasedKey(
|
||||||
|
|
|
@ -330,6 +330,9 @@ class Key {
|
||||||
const EncodedDataType* aBegin, const EncodedDataType* aEnd,
|
const EncodedDataType* aBegin, const EncodedDataType* aEnd,
|
||||||
const EncodedDataType** aOutEncodedSectionEnd);
|
const EncodedDataType** aOutEncodedSectionEnd);
|
||||||
|
|
||||||
|
static uint32_t LengthOfEncodedBinary(const EncodedDataType* aPos,
|
||||||
|
const EncodedDataType* aEnd);
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
static void DecodeAsStringy(const EncodedDataType* aEncodedSectionBegin,
|
static void DecodeAsStringy(const EncodedDataType* aEncodedSectionBegin,
|
||||||
const EncodedDataType* aEncodedSectionEnd,
|
const EncodedDataType* aEncodedSectionEnd,
|
||||||
|
|
Загрузка…
Ссылка в новой задаче