зеркало из 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:
Родитель
a1847f67e9
Коммит
943957f70b
|
@ -123,16 +123,12 @@ IDBResult<void, IDBSpecialValue::Invalid> Key::SetFromString(
|
|||
// |aPos| should point to the type indicator.
|
||||
// The returned length doesn't include the type indicator
|
||||
// or the terminator.
|
||||
static size_t LengthOfEncodedBinary(const unsigned char* aPos,
|
||||
const unsigned char* aEnd) {
|
||||
// static
|
||||
uint32_t Key::LengthOfEncodedBinary(const EncodedDataType* aPos,
|
||||
const EncodedDataType* aEnd) {
|
||||
MOZ_ASSERT(*aPos % Key::eMaxType == Key::eBinary, "Don't call me!");
|
||||
auto iter = ++aPos;
|
||||
for (; iter < aEnd && *iter != Key::eTerminator; ++iter) {
|
||||
if (*iter & 0x80) {
|
||||
iter++;
|
||||
}
|
||||
}
|
||||
return iter - aPos;
|
||||
const EncodedDataType* encodedSectionEnd;
|
||||
return CalcDecodedStringySize<uint8_t>(aPos + 1, aEnd, &encodedSectionEnd);
|
||||
}
|
||||
|
||||
IDBResult<void, IDBSpecialValue::Invalid> Key::ToLocaleBasedKey(
|
||||
|
|
|
@ -330,6 +330,9 @@ class Key {
|
|||
const EncodedDataType* aBegin, const EncodedDataType* aEnd,
|
||||
const EncodedDataType** aOutEncodedSectionEnd);
|
||||
|
||||
static uint32_t LengthOfEncodedBinary(const EncodedDataType* aPos,
|
||||
const EncodedDataType* aEnd);
|
||||
|
||||
template <typename T>
|
||||
static void DecodeAsStringy(const EncodedDataType* aEncodedSectionBegin,
|
||||
const EncodedDataType* aEncodedSectionEnd,
|
||||
|
|
Загрузка…
Ссылка в новой задаче