| 135 | } |
| 136 | |
| 137 | const char *regex_error::disppos(const char *s, size_t k) |
| 138 | { |
| 139 | while (k > 0 && *s != '\0') |
| 140 | { |
| 141 | unsigned char c = *s++; |
| 142 | if (c >= 0x80) |
| 143 | { |
| 144 | if (c >= 0xf0 && |
| 145 | (c > 0xf0 || |
| 146 | (static_cast<unsigned char>(s[0]) >= 0x9f && |
| 147 | (static_cast<unsigned char>(s[0]) > 0x9f || |
| 148 | (static_cast<unsigned char>(s[1]) >= 0x86 && |
| 149 | (static_cast<unsigned char>(s[1]) > 0x86 || |
| 150 | static_cast<unsigned char>(s[2]) >= 0x8e)))))) |
| 151 | { |
| 152 | // U+1F18E (UTF-8 F0 9F 86 8E) and higher is usually double width |
| 153 | if (k < 4) |
| 154 | break; |
| 155 | s += (s[0] != '\0') + (s[1] != '\0') + (s[2] != 0); |
| 156 | k -= 3; |
| 157 | } |
| 158 | else |
| 159 | { |
| 160 | while (k > 1 && (*s & 0xc0) == 0x80) |
| 161 | { |
| 162 | ++s; |
| 163 | --k; |
| 164 | } |
| 165 | } |
| 166 | } |
| 167 | --k; |
| 168 | } |
| 169 | return s; |
| 170 | } |
| 171 | |
| 172 | } // namespace reflex |
nothing calls this directly
no outgoing calls
no test coverage detected