Showing the changes to src/vm/utf8.cpp (1 of 16 files). Show all
Unified · Split
| @@ -40,15 +40,15 @@ namespace · 39 unmodified lines | ||
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | // See http://bjoern.hoehrmann.de/utf-8/decoder/dfa/ for details. |
| 43 | −utf8::decode_state disvm::runtime::utf8::decode_step(utf8::decode_state &state, rune_t &codepoint, uint8_t byte) | |
| 43 | +utf8::decode_state_t disvm::runtime::utf8::decode_step(utf8::decode_state_t &state, rune_t &codepoint, uint8_t byte) | |
| 44 | 44 | { |
| 45 | 45 | auto type = uint32_t{ utf8d[byte] }; |
| 46 | 46 | |
| 47 | − codepoint = (state != utf8::decode_state::accept) ? | |
| 47 | + codepoint = (state != utf8::decode_state_t::accept) ? | |
| 48 | 48 | (byte & 0x3fu) | (codepoint << 6) : |
| 49 | 49 | (0xff >> type) & (byte); |
| 50 | 50 | |
| 51 | − state = static_cast<utf8::decode_state>(utf8d[256 + static_cast<uint32_t>(state) + type]); | |
| 51 | + state = static_cast<utf8::decode_state_t>(utf8d[256 + static_cast<uint32_t>(state) + type]); | |
| 52 | 52 | return state; |
| 53 | 53 | } |
| 54 | 54 | |
| @@ -59,15 +59,15 @@ std::size_t disvm::runtime::utf8::count_codepoints(const uint8_t *str, const std · 4 unmodified lines | ||
| 59 | 59 | assert(str != nullptr); |
| 60 | 60 | auto single_character = rune_t{}; |
| 61 | 61 | auto points = std::size_t{ 0 }; |
| 62 | − auto state = utf8::decode_state::accept; | |
| 62 | + auto state = utf8::decode_state_t::accept; | |
| 63 | 63 | |
| 64 | 64 | for (auto i = std::size_t{ 0 }; i < max_len; ++i) |
| 65 | 65 | { |
| 66 | − if (utf8::decode_state::accept == utf8::decode_step(state, single_character, str[i])) | |
| 66 | + if (utf8::decode_state_t::accept == utf8::decode_step(state, single_character, str[i])) | |
| 67 | 67 | points++; |
| 68 | 68 | } |
| 69 | 69 | |
| 70 | − if (state != utf8::decode_state::accept) | |
| 70 | + if (state != utf8::decode_state_t::accept) | |
| 71 | 71 | throw invalid_utf8{}; |
| 72 | 72 | |
| 73 | 73 | return points; |
| @@ -76,7 +76,7 @@ std::size_t disvm::runtime::utf8::count_codepoints(const uint8_t *str, const std · 2 unmodified lines | ||
| 76 | 76 | std::size_t disvm::runtime::utf8::decode(const uint8_t *str, rune_t &codepoint) |
| 77 | 77 | { |
| 78 | 78 | assert(str != nullptr); |
| 79 | − auto state = utf8::decode_state::accept; | |
| 79 | + auto state = utf8::decode_state_t::accept; | |
| 80 | 80 | |
| 81 | 81 | codepoint = 0; |
| 82 | 82 | auto begin = str; |
| @@ -86,7 +86,7 @@ std::size_t disvm::runtime::utf8::decode(const uint8_t *str, rune_t &codepoint) · 3 unmodified lines | ||
| 86 | 86 | { |
| 87 | 87 | curr++; |
| 88 | 88 | state = utf8::decode_step(state, codepoint, c); |
| 89 | − if (state == utf8::decode_state::accept) | |
| 89 | + if (state == utf8::decode_state_t::accept) | |
| 90 | 90 | return (curr - begin); |
| 91 | 91 | } |
| 92 | 92 | |