Rev 4224 | Rev 4267 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 4224 | Rev 4234 | ||
|---|---|---|---|
| Line 204... | Line 204... | ||
| 204 | * |
204 | * |
| 205 | * @return EOK if the character was encoded successfully, EOVERFLOW if there |
205 | * @return EOK if the character was encoded successfully, EOVERFLOW if there |
| 206 | * was not enough space in the output buffer or EINVAL if the character |
206 | * was not enough space in the output buffer or EINVAL if the character |
| 207 | * code was invalid. |
207 | * code was invalid. |
| 208 | */ |
208 | */ |
| 209 | int chr_encode(const wchar_t ch, char *str, size_t *offset, size_t size) |
209 | int chr_encode(wchar_t ch, char *str, size_t *offset, size_t size) |
| 210 | { |
210 | { |
| 211 | if (*offset >= size) |
211 | if (*offset >= size) |
| 212 | return EOVERFLOW; |
212 | return EOVERFLOW; |
| 213 | 213 | ||
| 214 | if (!chr_check(ch)) |
214 | if (!chr_check(ch)) |
| Line 420... | Line 420... | ||
| 420 | /** Check whether character is plain ASCII. |
420 | /** Check whether character is plain ASCII. |
| 421 | * |
421 | * |
| 422 | * @return True if character is plain ASCII. |
422 | * @return True if character is plain ASCII. |
| 423 | * |
423 | * |
| 424 | */ |
424 | */ |
| 425 | bool ascii_check(const wchar_t ch) |
425 | bool ascii_check(wchar_t ch) |
| 426 | { |
426 | { |
| 427 | if ((ch >= 0) && (ch <= 127)) |
427 | if ((ch >= 0) && (ch <= 127)) |
| 428 | return true; |
428 | return true; |
| 429 | 429 | ||
| 430 | return false; |
430 | return false; |
| Line 433... | Line 433... | ||
| 433 | /** Check whether character is valid |
433 | /** Check whether character is valid |
| 434 | * |
434 | * |
| 435 | * @return True if character is a valid Unicode code point. |
435 | * @return True if character is a valid Unicode code point. |
| 436 | * |
436 | * |
| 437 | */ |
437 | */ |
| 438 | bool chr_check(const wchar_t ch) |
438 | bool chr_check(wchar_t ch) |
| 439 | { |
439 | { |
| 440 | if ((ch >= 0) && (ch <= 1114111)) |
440 | if ((ch >= 0) && (ch <= 1114111)) |
| 441 | return true; |
441 | return true; |
| 442 | 442 | ||
| 443 | return false; |
443 | return false; |