Changeset 6b13103 for lib


Ignore:
Timestamp:
2015-01-16T19:50:23Z (9 years ago)
Author:
dequis <dx@…>
Branches:
master
Children:
1065dd4, eabe6d4
Parents:
6f10697
Message:

Replace isdigit/isalpha/.../tolower/toupper with glib variants

This fixes warnings about passing signed chars to them (apparently they
are implemented as macros that do array lookups without checks in some
platforms, yay)

Specifically:

functions=isalnum|isalpha|isdigit|isspace|isxdigit|tolower|toupper
sed -ir "s/$functions/g_ascii_&/g" /*.c

Location:
lib
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • lib/http_client.c

    r6f10697 r6b13103  
    345345                /* Might be a \r\n from the last chunk. */
    346346                s = chunk;
    347                 while( isspace( *s ) )
     347                while( g_ascii_isspace( *s ) )
    348348                        s ++;
    349349                /* Chunk length. Might be incomplete. */
    350350                if( s < eos && sscanf( s, "%x", &clen ) != 1 )
    351351                        return CR_ERROR;
    352                 while( isxdigit( *s ) )
     352                while( g_ascii_isxdigit( *s ) )
    353353                        s ++;
    354354               
  • lib/ini.c

    r6f10697 r6b13103  
    6363        char *e;
    6464
    65         while( isspace( *in ) )
     65        while( g_ascii_isspace( *in ) )
    6666                in++;
    6767
    6868        e = in + strlen( in ) - 1;
    69         while( e > in && isspace( *e ) )
     69        while( e > in && g_ascii_isspace( *e ) )
    7070                e--;
    7171        e[1] = 0;
  • lib/json.c

    r6f10697 r6b13103  
    5353static unsigned char hex_value (json_char c)
    5454{
    55    if (isdigit(c))
     55   if (g_ascii_isdigit(c))
    5656      return c - '0';
    5757
     
    609609                     default:
    610610
    611                         if (isdigit (b) || b == '-')
     611                        if (g_ascii_isdigit (b) || b == '-')
    612612                        {
    613613                           if (!new_value (&state, &top, &root, &alloc, json_integer))
     
    616616                           if (!state.first_pass)
    617617                           {
    618                               while (isdigit (b) || b == '+' || b == '-'
     618                              while (g_ascii_isdigit (b) || b == '+' || b == '-'
    619619                                        || b == 'e' || b == 'E' || b == '.')
    620620                              {
     
    706706            case json_double:
    707707
    708                if (isdigit (b))
     708               if (g_ascii_isdigit (b))
    709709               {
    710710                  ++ num_digits;
  • lib/misc.c

    r6f10697 r6b13103  
    163163        while( *in )
    164164        {
    165                 if( *in == '<' && ( isalpha( *(in+1) ) || *(in+1) == '/' ) )
     165                if( *in == '<' && ( g_ascii_isalpha( *(in+1) ) || *(in+1) == '/' ) )
    166166                {
    167167                        /* If in points at a < and in+1 points at a letter or a slash, this is probably
     
    198198                {
    199199                        cs = ++in;
    200                         while( *in && isalpha( *in ) )
     200                        while( *in && g_ascii_isalpha( *in ) )
    201201                                in ++;
    202202                       
     
    314314        for( i = j = 0; t[i]; i ++, j ++ )
    315315        {
    316                 /* Warning: isalnum() is locale-aware, so don't use it here! */
     316                /* Warning: g_ascii_isalnum() is locale-aware, so don't use it here! */
    317317                if( ( t[i] >= 'A' && t[i] <= 'Z' ) ||
    318318                    ( t[i] >= 'a' && t[i] <= 'z' ) ||
     
    490490       
    491491        while( *value )
    492                 if( !isdigit( *value ) )
     492                if( !g_ascii_isdigit( *value ) )
    493493                        return 0;
    494494                else
  • lib/ssl_gnutls.c

    r6f10697 r6b13103  
    318318        gnutls_set_default_priority( conn->session );
    319319        gnutls_credentials_set( conn->session, GNUTLS_CRD_CERTIFICATE, xcred );
    320         if( conn->hostname && !isdigit( conn->hostname[0] ) )
     320        if( conn->hostname && !g_ascii_isdigit( conn->hostname[0] ) )
    321321                gnutls_server_name_set( conn->session, GNUTLS_NAME_DNS,
    322322                                        conn->hostname, strlen( conn->hostname ) );
  • lib/ssl_openssl.c

    r6f10697 r6b13103  
    159159        SSL_set_fd( conn->ssl, conn->fd );
    160160       
    161         if( conn->hostname && !isdigit( conn->hostname[0] ) )
     161        if( conn->hostname && !g_ascii_isdigit( conn->hostname[0] ) )
    162162                SSL_set_tlsext_host_name( conn->ssl, conn->hostname );
    163163       
Note: See TracChangeset for help on using the changeset viewer.