michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #ifndef utfstrings_h__ michael@0: #define utfstrings_h__ michael@0: michael@0: struct UTFStringsStringPair michael@0: { michael@0: char16_t m16[16]; michael@0: char m8[16]; michael@0: }; michael@0: michael@0: static const UTFStringsStringPair ValidStrings[] = michael@0: { michael@0: { { 'a', 'b', 'c', 'd' }, michael@0: { 'a', 'b', 'c', 'd' } }, michael@0: { { '1', '2', '3', '4' }, michael@0: { '1', '2', '3', '4' } }, michael@0: { { 0x7F, 'A', 0x80, 'B', 0x101, 0x200 }, michael@0: { 0x7F, 'A', 0xC2, 0x80, 'B', 0xC4, 0x81, 0xC8, 0x80 } }, michael@0: { { 0x7FF, 0x800, 0x1000 }, michael@0: { 0xDF, 0xBF, 0xE0, 0xA0, 0x80, 0xE1, 0x80, 0x80 } }, michael@0: { { 0xD7FF, 0xE000, 0xF00F, 'A', 0xFFF0 }, michael@0: { 0xED, 0x9F, 0xBF, 0xEE, 0x80, 0x80, 0xEF, 0x80, 0x8F, 'A', 0xEF, 0xBF, 0xB0 } }, michael@0: { { 0xFFF7, 0xFFFC, 0xFFFD, 0xFFFD }, michael@0: { 0xEF, 0xBF, 0xB7, 0xEF, 0xBF, 0xBC, 0xEF, 0xBF, 0xBD, 0xEF, 0xBF, 0xBD } }, michael@0: { { 0xD800, 0xDC00, 0xD800, 0xDCFF }, michael@0: { 0xF0, 0x90, 0x80, 0x80, 0xF0, 0x90, 0x83, 0xBF } }, michael@0: { { 0xDBFF, 0xDFFF, 0xDBB7, 0xDCBA }, michael@0: { 0xF4, 0x8F, 0xBF, 0xBF, 0xF3, 0xBD, 0xB2, 0xBA } }, michael@0: { { 0xFFFD, 0xFFFF }, michael@0: { 0xEF, 0xBF, 0xBD, 0xEF, 0xBF, 0xBF } }, michael@0: { { 0xFFFD, 0xFFFE, 0xFFFF }, michael@0: { 0xEF, 0xBF, 0xBD, 0xEF, 0xBF, 0xBE, 0xEF, 0xBF, 0xBF } }, michael@0: }; michael@0: michael@0: static const UTFStringsStringPair Invalid16Strings[] = michael@0: { michael@0: { { 'a', 'b', 0xD800 }, michael@0: { 'a', 'b', 0xEF, 0xBF, 0xBD } }, michael@0: { { 0xD8FF, 'b' }, michael@0: { 0xEF, 0xBF, 0xBD, 'b' } }, michael@0: { { 0xD821 }, michael@0: { 0xEF, 0xBF, 0xBD } }, michael@0: { { 0xDC21 }, michael@0: { 0xEF, 0xBF, 0xBD } }, michael@0: { { 0xDC00, 0xD800, 'b' }, michael@0: { 0xEF, 0xBF, 0xBD, 0xEF, 0xBF, 0xBD, 'b' } }, michael@0: { { 'b', 0xDC00, 0xD800 }, michael@0: { 'b', 0xEF, 0xBF, 0xBD, 0xEF, 0xBF, 0xBD } }, michael@0: { { 0xDC00, 0xD800 }, michael@0: { 0xEF, 0xBF, 0xBD, 0xEF, 0xBF, 0xBD } }, michael@0: { { 0xDC00, 0xD800, 0xDC00, 0xD800 }, michael@0: { 0xEF, 0xBF, 0xBD, 0xF0, 0x90, 0x80, 0x80, 0xEF, 0xBF, 0xBD } }, michael@0: { { 0xDC00, 0xD800, 0xD800, 0xDC00 }, michael@0: { 0xEF, 0xBF, 0xBD, 0xEF, 0xBF, 0xBD, 0xF0, 0x90, 0x80, 0x80 } }, michael@0: }; michael@0: michael@0: static const UTFStringsStringPair Invalid8Strings[] = michael@0: { michael@0: { { 'a', 0xFFFD, 'b' }, michael@0: { 'a', 0xC0, 0x80, 'b' } }, michael@0: { { 0xFFFD, 0x80 }, michael@0: { 0xC1, 0xBF, 0xC2, 0x80 } }, michael@0: { { 0xFFFD }, michael@0: { 0xC1, 0xBF } }, michael@0: { { 0xFFFD, 'x', 0x0800 }, michael@0: { 0xE0, 0x80, 0x80, 'x', 0xE0, 0xA0, 0x80 } }, michael@0: { { 0xFFFD, 'x', 0xFFFD }, michael@0: { 0xF0, 0x80, 0x80, 0x80, 'x', 0xF0, 0x80, 0x8F, 0x80 } }, michael@0: { { 0xFFFD, 0xFFFD }, michael@0: { 0xF4, 0x90, 0x80, 0x80, 0xF7, 0xBF, 0xBF, 0xBF } }, michael@0: { { 0xFFFD, 'x', 0xD800, 0xDC00, 0xFFFD }, michael@0: { 0xF0, 0x8F, 0xBF, 0xBF, 'x', 0xF0, 0x90, 0x80, 0x80, 0xF0, 0x8F, 0xBF, 0xBF } }, michael@0: { { 0xFFFD, 'x', 0xFFFD }, michael@0: { 0xF8, 0x80, 0x80, 0x80, 0x80, 'x', 0xF8, 0x88, 0x80, 0x80, 0x80 } }, michael@0: { { 0xFFFD, 0xFFFD }, michael@0: { 0xFB, 0xBF, 0xBF, 0xBF, 0xBF, 0xFC, 0xA0, 0x80, 0x80, 0x80, 0x80 } }, michael@0: { { 0xFFFD, 0xFFFD }, michael@0: { 0xFC, 0x80, 0x80, 0x80, 0x80, 0x80, 0xFD, 0xBF, 0xBF, 0xBF, 0xBF, 0xBF } }, michael@0: }; michael@0: michael@0: // Don't use this array in debug builds as that intentionally asserts. michael@0: #ifndef DEBUG michael@0: static const char Malformed8Strings[][16] = michael@0: { michael@0: { 0x80 }, michael@0: { 'a', 0xC8, 'c' }, michael@0: { 'a', 0xC0 }, michael@0: { 'a', 0xE8, 'c' }, michael@0: { 'a', 0xE8, 0x80, 'c' }, michael@0: { 'a', 0xE8, 0x80 }, michael@0: { 0xE8, 0x7F, 0x80 }, michael@0: { 'a', 0xE8, 0xE8, 0x80 }, michael@0: { 'a', 0xF4 }, michael@0: { 'a', 0xF4, 0x80, 0x80, 'c', 'c' }, michael@0: { 'a', 0xF4, 0x80, 'x', 0x80 }, michael@0: { 0xF4, 0x80, 0x80, 0x80, 0x80 }, michael@0: { 'a', 0xFA, 'c' }, michael@0: { 'a', 0xFA, 0x80, 0x80, 0x7F, 0x80, 'c' }, michael@0: { 'a', 0xFA, 0x80, 0x80, 0x80, 0x80, 0x80, 'c' }, michael@0: { 'a', 0xFD }, michael@0: { 'a', 0xFD, 0x80, 0x80, 0x80, 0x80, 'c' }, michael@0: { 'a', 0xFD, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80 }, michael@0: { 'a', 0xFC, 0x80, 0x80, 0x40, 0x80, 0x80, 'c' }, michael@0: }; michael@0: #endif michael@0: michael@0: #endif