static */
| 65 | |
| 66 | /* static */ |
| 67 | bool cCharUtil::PeekNextChar(const TSTRING::const_iterator& cur, |
| 68 | const TSTRING::const_iterator& end, |
| 69 | TSTRING::const_iterator& first, |
| 70 | TSTRING::const_iterator& last) |
| 71 | { |
| 72 | // |
| 73 | // do we have a valid string here? |
| 74 | // |
| 75 | if (cur > end) |
| 76 | { |
| 77 | return false; |
| 78 | } |
| 79 | |
| 80 | if (cur == end) |
| 81 | { |
| 82 | first = last = end; |
| 83 | return false; |
| 84 | } |
| 85 | |
| 86 | if (*cur == _T('\0')) |
| 87 | { |
| 88 | first = last = cur; |
| 89 | return false; |
| 90 | } |
| 91 | |
| 92 | first = cur; |
| 93 | |
| 94 | if (!(*cur)) |
| 95 | { |
| 96 | last = cur; |
| 97 | } |
| 98 | else |
| 99 | { |
| 100 | #if !IS_AROS |
| 101 | mblen(NULL, 0); |
| 102 | int len = mblen(&*cur, MB_CUR_MAX); |
| 103 | if (len < 0) //invalid multibyte sequence, but let's not blow up. |
| 104 | len = 1; |
| 105 | |
| 106 | last = cur + len; |
| 107 | #else // AROS mblen() seems broken (as of 6/2016) so don't use it. |
| 108 | last = cur + 1; |
| 109 | #endif |
| 110 | } |
| 111 | |
| 112 | return true; |
| 113 | } |
| 114 | |
| 115 | |
| 116 | //============================================================================= |