-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Commit 0109aa6
Simplify decoding filter for UTF-8
When decoding a 3-byte UTF-8 code unit, redundant checks for overlong
code unit and for illegal codepoints from U+D800-DFFF were included.
Both of these conditions are caught by the line which reads:
if ((c2 & 0xC0) != 0x80 || (c == 0xF0 && c2 < 0x90) || (c == 0xF4 && c2 >= 0x90)) {
As such, there is no reason to check for the same error conditions again.
Likewise, when decoding a 4-byte UTF-8 code unit, there was a
redundant check for overlong code unit. That was already caught by the
line which reads:
if ((c2 & 0xC0) != 0x80 || (c == 0xF0 && c2 < 0x90) || (c == 0xF4 && c2 >= 0x90)) {1 parent 50e3201 commit 0109aa6
1 file changed
+5
-6
lines changedOriginal file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
249 | 249 |
| |
250 | 250 |
| |
251 | 251 |
| |
252 | - | ||
253 | - | ||
254 | - | ||
255 | - | ||
256 | - | ||
252 | + | ||
253 | + | ||
254 | + | ||
257 | 255 |
| |
258 | 256 |
| |
259 | 257 |
| |
| |||
283 | 281 |
| |
284 | 282 |
| |
285 | 283 |
| |
286 | - | ||
284 | + | ||
285 | + | ||
287 | 286 |
| |
288 | 287 |
| |
289 | 288 |
| |
|
0 commit comments