From 09ca9f6dda48284bd5203edf8bb50d6ca585e3f2 Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Thu, 3 Jan 2008 17:49:45 +0000 Subject: [PATCH] maybe fix i18n tracker error reported by haktar --- libtransmission/tracker.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/libtransmission/tracker.c b/libtransmission/tracker.c index 332a9fb88..284337374 100644 --- a/libtransmission/tracker.c +++ b/libtransmission/tracker.c @@ -11,7 +11,6 @@ */ #include -#include /* isalnum */ #include /* snprintf */ #include #include /* strcmp, strchr */ @@ -973,12 +972,20 @@ generateKeyParam( char * msg, int len ) *msg = '\0'; } +static int +is_rfc2396_alnum( char ch ) +{ + return strchr( "abcdefghijklmnopqrstuvwxyz" + "ABCDEFGHIJKLMNOPQRSTUVWXYZ" + "0123456789", ch ) != NULL; +} + static void escape( char * out, const uint8_t * in, int in_len ) /* rfc2396 */ { const uint8_t *end = in + in_len; while( in != end ) - if( isalnum(*in) ) + if( is_rfc2396_alnum(*in) ) *out++ = (char) *in++; else out += snprintf( out, 4, "%%%02X", (unsigned int)*in++ );