Bug 1294940 - Part 0.1: Capitalize template parameter "action" of InflateUTF8StringToBuffer. r=jwalden

--HG--
extra : rebase_source : b30dea0109cef5a03d36ff8179a13f835e63c6e3
This commit is contained in:
Tooru Fujisawa 2016-08-15 14:52:55 +09:00
Родитель af1a0c5fd5
Коммит ad712d491e
1 изменённых файлов: 8 добавлений и 8 удалений

Просмотреть файл

@ -256,7 +256,7 @@ static const uint32_t REPLACE_UTF8 = 0xFFFD;
// If making changes to this algorithm, make sure to also update // If making changes to this algorithm, make sure to also update
// LossyConvertUTF8toUTF16() in dom/wifi/WifiUtils.cpp // LossyConvertUTF8toUTF16() in dom/wifi/WifiUtils.cpp
template <InflateUTF8Action action> template <InflateUTF8Action Action>
static bool static bool
InflateUTF8StringToBuffer(JSContext* cx, const UTF8Chars src, char16_t* dst, size_t* dstlenp, InflateUTF8StringToBuffer(JSContext* cx, const UTF8Chars src, char16_t* dst, size_t* dstlenp,
bool* isAsciip) bool* isAsciip)
@ -271,7 +271,7 @@ InflateUTF8StringToBuffer(JSContext* cx, const UTF8Chars src, char16_t* dst, siz
uint32_t v = uint32_t(src[i]); uint32_t v = uint32_t(src[i]);
if (!(v & 0x80)) { if (!(v & 0x80)) {
// ASCII code unit. Simple copy. // ASCII code unit. Simple copy.
if (action == Copy) if (Action == Copy)
dst[j] = char16_t(v); dst[j] = char16_t(v);
} else { } else {
@ -283,14 +283,14 @@ InflateUTF8StringToBuffer(JSContext* cx, const UTF8Chars src, char16_t* dst, siz
#define INVALID(report, arg, n2) \ #define INVALID(report, arg, n2) \
do { \ do { \
if (action == CountAndReportInvalids) { \ if (Action == CountAndReportInvalids) { \
report(cx, arg); \ report(cx, arg); \
return false; \ return false; \
} else { \ } else { \
if (action == Copy) \ if (Action == Copy) \
dst[j] = char16_t(REPLACE_UTF8); \ dst[j] = char16_t(REPLACE_UTF8); \
else \ else \
MOZ_ASSERT(action == CountAndIgnoreInvalids); \ MOZ_ASSERT(Action == CountAndIgnoreInvalids); \
n = n2; \ n = n2; \
goto invalidMultiByteCodeUnit; \ goto invalidMultiByteCodeUnit; \
} \ } \
@ -323,17 +323,17 @@ InflateUTF8StringToBuffer(JSContext* cx, const UTF8Chars src, char16_t* dst, siz
v = JS::Utf8ToOneUcs4Char((uint8_t*)&src[i], n); v = JS::Utf8ToOneUcs4Char((uint8_t*)&src[i], n);
if (v < 0x10000) { if (v < 0x10000) {
// The n-byte UTF8 code unit will fit in a single char16_t. // The n-byte UTF8 code unit will fit in a single char16_t.
if (action == Copy) if (Action == Copy)
dst[j] = char16_t(v); dst[j] = char16_t(v);
} else { } else {
v -= 0x10000; v -= 0x10000;
if (v <= 0xFFFFF) { if (v <= 0xFFFFF) {
// The n-byte UTF8 code unit will fit in two char16_t units. // The n-byte UTF8 code unit will fit in two char16_t units.
if (action == Copy) if (Action == Copy)
dst[j] = char16_t((v >> 10) + 0xD800); dst[j] = char16_t((v >> 10) + 0xD800);
j++; j++;
if (action == Copy) if (Action == Copy)
dst[j] = char16_t((v & 0x3FF) + 0xDC00); dst[j] = char16_t((v & 0x3FF) + 0xDC00);
} else { } else {