Rev 4581 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 4581 | Rev 4718 | ||
---|---|---|---|
Line 587... | Line 587... | ||
587 | * @param str String to search. |
587 | * @param str String to search. |
588 | * @param ch Character to look for. |
588 | * @param ch Character to look for. |
589 | * |
589 | * |
590 | * @return Pointer to character in @a str or NULL if not found. |
590 | * @return Pointer to character in @a str or NULL if not found. |
591 | */ |
591 | */ |
592 | const char *str_chr(const char *str, wchar_t ch) |
592 | char *str_chr(const char *str, wchar_t ch) |
593 | { |
593 | { |
594 | wchar_t acc; |
594 | wchar_t acc; |
595 | size_t off = 0; |
595 | size_t off = 0; |
596 | size_t last = 0; |
596 | size_t last = 0; |
597 | 597 | ||
598 | while ((acc = str_decode(str, &off, STR_NO_LIMIT)) != 0) { |
598 | while ((acc = str_decode(str, &off, STR_NO_LIMIT)) != 0) { |
599 | if (acc == ch) |
599 | if (acc == ch) |
600 | return (str + last); |
600 | return (char *) (str + last); |
601 | last = off; |
601 | last = off; |
602 | } |
602 | } |
603 | 603 | ||
604 | return NULL; |
604 | return NULL; |
605 | } |
605 | } |
Line 609... | Line 609... | ||
609 | * @param str String to search. |
609 | * @param str String to search. |
610 | * @param ch Character to look for. |
610 | * @param ch Character to look for. |
611 | * |
611 | * |
612 | * @return Pointer to character in @a str or NULL if not found. |
612 | * @return Pointer to character in @a str or NULL if not found. |
613 | */ |
613 | */ |
614 | const char *str_rchr(const char *str, wchar_t ch) |
614 | char *str_rchr(const char *str, wchar_t ch) |
615 | { |
615 | { |
616 | wchar_t acc; |
616 | wchar_t acc; |
617 | size_t off = 0; |
617 | size_t off = 0; |
618 | size_t last = 0; |
618 | size_t last = 0; |
619 | const char *res = NULL; |
619 | const char *res = NULL; |
Line 622... | Line 622... | ||
622 | if (acc == ch) |
622 | if (acc == ch) |
623 | res = (str + last); |
623 | res = (str + last); |
624 | last = off; |
624 | last = off; |
625 | } |
625 | } |
626 | 626 | ||
627 | return res; |
627 | return (char *) res; |
628 | } |
628 | } |
629 | 629 | ||
630 | /** Insert a wide character into a wide string. |
630 | /** Insert a wide character into a wide string. |
631 | * |
631 | * |
632 | * Insert a wide character into a wide string at position |
632 | * Insert a wide character into a wide string at position |