| 134 | static bool initialisedBytesOfLead = false; |
| 135 | |
| 136 | static int BytesFromLead(int leadByte) { |
| 137 | if (leadByte < 0xC2) { |
| 138 | // Single byte or invalid |
| 139 | return 1; |
| 140 | } else if (leadByte < 0xE0) { |
| 141 | return 2; |
| 142 | } else if (leadByte < 0xF0) { |
| 143 | return 3; |
| 144 | } else if (leadByte < 0xF5) { |
| 145 | return 4; |
| 146 | } else { |
| 147 | // Characters longer than 4 bytes not possible in current UTF-8 |
| 148 | return 1; |
| 149 | } |
| 150 | } |
| 151 | |
| 152 | void UTF8BytesOfLeadInitialise() { |
| 153 | if (!initialisedBytesOfLead) { |
no outgoing calls
no test coverage detected