Changeset 5724


Ignore:
Timestamp:
Apr 29, 2008, 5:23:33 PM (14 years ago)
Author:
charles
Message:

tweak the last commit: when parsing peer-ids we don't want locales to postentially change the behavior of isalpha/isdigit/etc

Location:
trunk/libtransmission
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/clients.c

    r5723 r5724  
    3737charint( char ch )
    3838{
    39     if( isdigit( ch ) ) return ch - '0';
    40     if( isupper( ch ) ) return 10 + ch - 'A';
    41     if( islower( ch ) ) return 36 + ch - 'a';
     39    if( '0' <= ch && ch <= '9' ) return      ch - '0';
     40    if( 'A' <= ch && ch <= 'Z' ) return 10 + ch - 'A';
     41    if( 'a' <= ch && ch <= 'z' ) return 36 + ch - 'a';
    4242    return 0;
    4343}
  • trunk/libtransmission/tracker.c

    r5719 r5724  
    842842is_rfc2396_alnum( char ch )
    843843{
    844     return ( (ch >= 'a' && ch <= 'z' )
    845             || (ch >= 'A' && ch <= 'Z' )
    846             || (ch >= '0' && ch <= '9' ) );
     844    return     ( '0' <= ch && ch <= '9' )
     845            || ( 'A' <= ch && ch <= 'Z' )
     846            || ( 'a' <= ch && ch <= 'z' );
    847847}
    848848
Note: See TracChangeset for help on using the changeset viewer.