* Pick the next char from the stream, ignoring codepoints an HFS+ would. * Note that this is _not_ complete by any means. It's just enough * to make is_hfs_dotgit() work, and should not be used otherwise. */
| 701 | * to make is_hfs_dotgit() work, and should not be used otherwise. |
| 702 | */ |
| 703 | static ucs_char_t next_hfs_char(const char **in) |
| 704 | { |
| 705 | while (1) { |
| 706 | ucs_char_t out = pick_one_utf8_char(in, NULL); |
| 707 | /* |
| 708 | * check for malformed utf8. Technically this |
| 709 | * gets converted to a percent-sequence, but |
| 710 | * returning 0 is good enough for is_hfs_dotgit |
| 711 | * to realize it cannot be .git |
| 712 | */ |
| 713 | if (!*in) |
| 714 | return 0; |
| 715 | |
| 716 | /* these code points are ignored completely */ |
| 717 | switch (out) { |
| 718 | case 0x200c: /* ZERO WIDTH NON-JOINER */ |
| 719 | case 0x200d: /* ZERO WIDTH JOINER */ |
| 720 | case 0x200e: /* LEFT-TO-RIGHT MARK */ |
| 721 | case 0x200f: /* RIGHT-TO-LEFT MARK */ |
| 722 | case 0x202a: /* LEFT-TO-RIGHT EMBEDDING */ |
| 723 | case 0x202b: /* RIGHT-TO-LEFT EMBEDDING */ |
| 724 | case 0x202c: /* POP DIRECTIONAL FORMATTING */ |
| 725 | case 0x202d: /* LEFT-TO-RIGHT OVERRIDE */ |
| 726 | case 0x202e: /* RIGHT-TO-LEFT OVERRIDE */ |
| 727 | case 0x206a: /* INHIBIT SYMMETRIC SWAPPING */ |
| 728 | case 0x206b: /* ACTIVATE SYMMETRIC SWAPPING */ |
| 729 | case 0x206c: /* INHIBIT ARABIC FORM SHAPING */ |
| 730 | case 0x206d: /* ACTIVATE ARABIC FORM SHAPING */ |
| 731 | case 0x206e: /* NATIONAL DIGIT SHAPES */ |
| 732 | case 0x206f: /* NOMINAL DIGIT SHAPES */ |
| 733 | case 0xfeff: /* ZERO WIDTH NO-BREAK SPACE */ |
| 734 | continue; |
| 735 | } |
| 736 | |
| 737 | return out; |
| 738 | } |
| 739 | } |
| 740 | |
| 741 | static int is_hfs_dot_generic(const char *path, |
| 742 | const char *needle, size_t needle_len) |
no test coverage detected