1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2024-12-25 01:03:01 +00:00

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

This commit is contained in:
Charles Kerr 2008-04-29 17:23:33 +00:00
parent a362df0a14
commit e18414ad0b
2 changed files with 6 additions and 6 deletions

View file

@ -36,9 +36,9 @@
static int static int
charint( char ch ) charint( char ch )
{ {
if( isdigit( ch ) ) return ch - '0'; if( '0' <= ch && ch <= '9' ) return ch - '0';
if( isupper( ch ) ) return 10 + ch - 'A'; if( 'A' <= ch && ch <= 'Z' ) return 10 + ch - 'A';
if( islower( ch ) ) return 36 + ch - 'a'; if( 'a' <= ch && ch <= 'z' ) return 36 + ch - 'a';
return 0; return 0;
} }

View file

@ -841,9 +841,9 @@ generateKeyParam( char * msg, int len )
static int static int
is_rfc2396_alnum( char ch ) is_rfc2396_alnum( char ch )
{ {
return ( (ch >= 'a' && ch <= 'z' ) return ( '0' <= ch && ch <= '9' )
|| (ch >= 'A' && ch <= 'Z' ) || ( 'A' <= ch && ch <= 'Z' )
|| (ch >= '0' && ch <= '9' ) ); || ( 'a' <= ch && ch <= 'z' );
} }
static void static void