src/keysym.c
static bool
parse_keysym_hex(const char *s, uint32_t *out)
{
    uint32_t result = 0;
    int i;
    for (i = 0; i < 8 && s[i] != '\0'; i++) {
        result <<= 4;
        if ('0' <= s[i] && s[i] <= '9')
            result += s[i] - '0';
        else if ('a' <= s[i] && s[i] <= 'f')
            result += 10 + s[i] - 'a';
        else if ('A' <= s[i] && s[i] <= 'F')
            result += 10 + s[i] - 'A';
        else
            return false;
    }
    *out = result;
    return s[i] == '\0' && i > 0;
}
/*
 * Parse the numeric part of a 0xXXXX and UXXXX keysym.
 * Not using strtoul -- it's slower and accepts a bunch of stuff
 * we don't want to allow, like signs, spaces, even locale stuff.
 */
Parse the numeric part of a 0xXXXX and UXXXX keysym.
Not using strtoul -- it's slower and accepts a bunch of stuff
we don't want to allow, like signs, spaces, even locale stuff.
Parse the numeric part of a 0xXXXX and UXXXX keysym . Not using strtoul -- it ' s slower and accepts a bunch of stuff we don ' t want to allow like signs spaces even locale stuff .
static bool
parse_keysym_hex(const char *s, uint32_t *out)
{
    uint32_t result = 0;
    int i;
    for (i = 0; i < 8 && s[i] != '\0'; i++) {
        result <<= 4;
        if ('0' <= s[i] && s[i] <= '9')
            result += s[i] - '0';
        else if ('a' <= s[i] && s[i] <= 'f')
            result += 10 + s[i] - 'a';
        else if ('A' <= s[i] && s[i] <= 'F')
            result += 10 + s[i] - 'A';
        else
            return false;
    }
    *out = result;
    return s[i] == '\0' && i > 0;
}
static bool parse_keysym_hex ( const char * s , uint32_t * out ) { uint32_t result = 0 ; int i ; for ( i = 0 ; i < 8 && s [ i ] != ' \0 ' ; i ++ ) { result <<= 4 ; if ( ' ' <= s [ i ] && s [ i ] <= ' ' ) result += s [ i ] - ' ' ; else if ( ' ' <= s [ i ] && s [ i ] <= ' ' ) result += 10 + s [ i ] - ' ' ; else if ( ' ' <= s [ i ] && s [ i ] <= ' ' ) result += 10 + s [ i ] - ' ' ; else return false ; } * out = result ; return s [ i ] == ' \0 ' && i > 0 ; }
Parse the numeric part of a 0xXXXX and UXXXX keysym.
Parse the numeric part of a 0xXXXX and UXXXX keysym .