From a814d843adf07207386513a1fa8d28685487332f Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Sun, 15 Jul 2007 22:18:49 +0000 Subject: [PATCH] get UPNP working again. huge thanks to BigBossman and persept for doggedly tracking down this bug. --- libtransmission/utils.c | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/libtransmission/utils.c b/libtransmission/utils.c index f92f3ac6e..4dd1d8eb0 100644 --- a/libtransmission/utils.c +++ b/libtransmission/utils.c @@ -168,6 +168,7 @@ int tr_rand( int sup ) } +#if 0 void* tr_memmem( const void* haystack, size_t hl, const void* needle, size_t nl) @@ -186,6 +187,38 @@ tr_memmem( const void* haystack, size_t hl, return NULL; } +#else +void * tr_memmem ( const void *vbig, size_t big_len, + const void *vlittle, size_t little_len ) +{ + const char *big = vbig; + const char *little = vlittle; + size_t ii, jj; + + if( 0 == big_len || 0 == little_len ) + { + return NULL; + } + + for( ii = 0; ii + little_len <= big_len; ii++ ) + { + for( jj = 0; jj < little_len; jj++ ) + { + if( big[ii + jj] != little[jj] ) + { + break; + } + } + if( jj == little_len ) + { + return (char*)big + ii; + } + } + + return NULL; +} +#endif + int tr_mkdir( char * path ) {