Rev 4296 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 4296 | Rev 4420 | ||
---|---|---|---|
Line 591... | Line 591... | ||
591 | */ |
591 | */ |
592 | const char *str_chr(const char *str, wchar_t ch) |
592 | const 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 | 597 | ||
597 | while ((acc = str_decode(str, &off, STR_NO_LIMIT)) != 0) { |
598 | while ((acc = str_decode(str, &off, STR_NO_LIMIT)) != 0) { |
598 | if (acc == ch) |
599 | if (acc == ch) |
599 | return (str + off); |
600 | return (str + last); |
- | 601 | last = off; |
|
600 | } |
602 | } |
601 | 603 | ||
602 | return NULL; |
604 | return NULL; |
603 | } |
605 | } |
604 | 606 | ||
Line 611... | Line 613... | ||
611 | */ |
613 | */ |
612 | const char *str_rchr(const char *str, wchar_t ch) |
614 | const char *str_rchr(const char *str, wchar_t ch) |
613 | { |
615 | { |
614 | wchar_t acc; |
616 | wchar_t acc; |
615 | size_t off = 0; |
617 | size_t off = 0; |
- | 618 | size_t last = 0; |
|
616 | char *res; |
619 | char *res = NULL; |
617 | 620 | ||
618 | res = NULL; |
- | |
619 | while ((acc = str_decode(str, &off, STR_NO_LIMIT)) != 0) { |
621 | while ((acc = str_decode(str, &off, STR_NO_LIMIT)) != 0) { |
620 | if (acc == ch) |
622 | if (acc == ch) |
621 | res = (str + off); |
623 | res = (str + last); |
- | 624 | last = off; |
|
622 | } |
625 | } |
623 | 626 | ||
624 | return res; |
627 | return res; |
625 | } |
628 | } |
626 | 629 | ||
627 | /** Insert a wide character into a wide string. |
630 | /** Insert a wide character into a wide string. |
628 | * |
631 | * |