Changes in / [a65ccc4:fb75979] in mainline
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
common/include/str.h
ra65ccc4 rfb75979 149 149 extern char *str_tok(char *, const char *, char **); 150 150 151 extern size_t str_sanitize(char *, size_t, uint8_t);152 153 151 extern errno_t str_uint8_t(const char *, const char **, unsigned int, bool, 154 152 uint8_t *); … … 167 165 extern void bin_order_suffix(const uint64_t, uint64_t *, const char **, bool); 168 166 167 extern size_t str_sanitize(char *str, size_t n, uint8_t replacement); 168 169 169 /* 170 170 * TODO: Get rid of this. -
common/str.c
ra65ccc4 rfb75979 547 547 548 548 for (; n > 0 && b[0]; b++, n--) { 549 if (b[0] < ' ') {550 /* C0 control codes */551 b[0] = replacement;552 count++;553 continue;554 }555 556 549 int cont = _continuation_bytes(b[0]); 557 550 if (__builtin_expect(cont, 0) == 0) … … 591 584 } 592 585 593 bool c1_control = (b[0] == 0b11000010 && b[1] < 0b10100000);594 if (cont == 1 && c1_control) {595 b[0] = replacement;596 count++;597 continue;598 }599 600 586 /* 0b1110!!!! 0b10!xxxxx 0b10xxxxxx */ 601 587 if (cont == 2 && !(b[0] & 0b00001111) && !(b[1] & 0b00100000)) { … … 633 619 } 634 620 635 /** Replaces any byte that's not part of a complete valid UTF-8 character636 * encoding with a replacement byte.637 * Also replaces C0 and C1 control codes.638 */639 621 size_t str_sanitize(char *str, size_t n, uint8_t replacement) 640 622 { -
kernel/generic/src/console/console.c
ra65ccc4 rfb75979 384 384 data[size] = 0; 385 385 386 uint8_t substitute = '\x1a';387 str_sanitize(data, size, substitute);388 389 386 switch (cmd) { 390 387 case KIO_WRITE:
Note:
See TracChangeset
for help on using the changeset viewer.