Changeset 9b0a6b4 in mainline for kernel/generic/src/lib/str.c


Ignore:
Timestamp:
2012-04-13T06:36:25Z (12 years ago)
Author:
Vojtech Horky <vojtechhorky@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
90f067d9
Parents:
e61aa80 (diff), d11a181 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge mainline changes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/src/lib/str.c

    re61aa80 r9b0a6b4  
    111111#include <debug.h>
    112112#include <macros.h>
     113
     114/** Check the condition if wchar_t is signed */
     115#ifdef WCHAR_IS_UNSIGNED
     116        #define WCHAR_SIGNED_CHECK(cond)  (true)
     117#else
     118        #define WCHAR_SIGNED_CHECK(cond)  (cond)
     119#endif
    113120
    114121/** Byte mask consisting of lowest @n bits (out of 8) */
     
    206213 *
    207214 * @return EOK if the character was encoded successfully, EOVERFLOW if there
    208  *         was not enough space in the output buffer or EINVAL if the character
    209  *         code was invalid.
    210  */
    211 int chr_encode(wchar_t ch, char *str, size_t *offset, size_t size)
     215 *         was not enough space in the output buffer or EINVAL if the character
     216 *         code was invalid.
     217 */
     218int chr_encode(const wchar_t ch, char *str, size_t *offset, size_t size)
    212219{
    213220        if (*offset >= size)
     
    427434bool ascii_check(wchar_t ch)
    428435{
    429         if ((ch >= 0) && (ch <= 127))
     436        if (WCHAR_SIGNED_CHECK(ch >= 0) && (ch <= 127))
    430437                return true;
    431438       
     
    440447bool chr_check(wchar_t ch)
    441448{
    442         if ((ch >= 0) && (ch <= 1114111))
     449        if (WCHAR_SIGNED_CHECK(ch >= 0) && (ch <= 1114111))
    443450                return true;
    444451       
Note: See TracChangeset for help on using the changeset viewer.