]> granicus.if.org Git - transmission/commitdiff
(trunk libT) add some new bugs to the code so that it will crash when vraa tries...
authorCharles Kerr <charles@transmissionbt.com>
Thu, 11 Nov 2010 15:31:11 +0000 (15:31 +0000)
committerCharles Kerr <charles@transmissionbt.com>
Thu, 11 Nov 2010 15:31:11 +0000 (15:31 +0000)
libtransmission/blocklist.c
libtransmission/cache.c
libtransmission/fdlimit.c
libtransmission/metainfo.c
libtransmission/peer-io.c
libtransmission/ptrarray.c
libtransmission/rpc-server.c
libtransmission/rpcimpl.c
libtransmission/utils.c
libtransmission/verify.c
libtransmission/web.c

index b96be009967868b618fb640279df8d65930a775d..1f66dec3d7dc3c0a7711b28307d45ec450deb472 100644 (file)
@@ -348,8 +348,8 @@ _tr_blocklistSetContent( tr_blocklist * b,
         ++inCount;
 
         /* zap the linefeed */
-        if(( walk = strchr( line, '\r' ))) *walk = '\0'; 
-        if(( walk = strchr( line, '\n' ))) *walk = '\0'; 
+        if(( walk = strchr( line, '\r' ))) *walk = '\0';
+        if(( walk = strchr( line, '\n' ))) *walk = '\0';
 
         if( !parseLine( line, &range ) )
         {
index df0cd0d29e2348c66daaa76358533239868b8e4b..063b31d063c7f8b7fcf1047f103a59cd26c66045 100644 (file)
@@ -303,7 +303,7 @@ cache_block_compare( const void * va, const void * vb )
 
 static struct cache_block *
 findBlock( tr_cache           * cache,
-           tr_torrent         * torrent, 
+           tr_torrent         * torrent,
            tr_piece_index_t     piece,
            uint32_t             offset )
 {
index 2deed8647dafa05b14253c7bbf650d67a13b1d8e..08b327149b55d9609fc57fd913d65f6c65b5b7f9 100644 (file)
@@ -399,7 +399,7 @@ TrOpenFile( tr_session             * session,
     }
 #endif
 
-#if defined( SYS_DARWIN ) 
+#if defined( SYS_DARWIN )
     /**
      * 1. Enable readahead for reasons described above w/POSIX_FADV_SEQUENTIAL.
      *
@@ -411,8 +411,8 @@ TrOpenFile( tr_session             * session,
      */
     {
         const int err = errno;
-        fcntl( file->fd, F_NOCACHE, 1 ); 
-        fcntl( file->fd, F_RDAHEAD, 1 ); 
+        fcntl( file->fd, F_NOCACHE, 1 );
+        fcntl( file->fd, F_RDAHEAD, 1 );
         errno = err;
     }
 #endif
index 8f3f53ce1acfe6b6d242435637f457327921be48..db77d8d6286b014aada108b5d62304b1ddb21bbc 100644 (file)
@@ -42,7 +42,7 @@ tr_metainfoGetBasename( const tr_info * inf )
     for( pch=name; pch && *pch; ++pch )
         if( *pch == '/' )
             *pch = '_';
-   
+
     ret = tr_strdup_printf( "%s.%16.16s", name, inf->hashString );
 
     tr_free( name );
@@ -447,7 +447,6 @@ tr_metainfoParseImpl( const tr_session  * session,
             escape( inf->hashEscaped, inf->hash, SHA_DIGEST_LENGTH );
 
             /* maybe get the display name */
-          
             if( tr_bencDictFindStr( d, "display-name", &str ) ) {
                 tr_free( inf->name );
                 inf->name = tr_strdup( str );
index 1eeea1e28ae10a571925b7fef39b08911b91db20..56bbff42e325f18a2204e0ee89fca6e06bb7519c 100644 (file)
@@ -260,7 +260,7 @@ event_read_cb( int fd, short event UNUSED, void * vio )
             what |= EVBUFFER_ERROR;
         }
 
-        tr_net_strerror( errstr, sizeof( errstr ), e ); 
+        tr_net_strerror( errstr, sizeof( errstr ), e );
         dbgmsg( io, "event_read_cb got an error. res is %d, what is %hd, errno is %d (%s)", res, what, e, errstr );
 
         if( io->gotError != NULL )
@@ -400,7 +400,7 @@ tr_peerIoNew( tr_session       * session,
         tr_netSetTOS( socket, session->peerSocketTOS );
         maybeSetCongestionAlgorithm( socket, session->peer_congestion_algorithm );
     }
-    
+
     io = tr_new0( tr_peerIo, 1 );
     io->magicNumber = MAGIC_NUMBER;
     io->refCount = 1;
@@ -945,7 +945,7 @@ tr_peerIoTryRead( tr_peerIo * io, size_t howmuch )
             short what = EVBUFFER_READ | EVBUFFER_ERROR;
             if( res == 0 )
                 what |= EVBUFFER_EOF;
-            tr_net_strerror( errstr, sizeof( errstr ), e ); 
+            tr_net_strerror( errstr, sizeof( errstr ), e );
             dbgmsg( io, "tr_peerIoTryRead got an error. res is %d, what is %hd, errno is %d (%s)", res, what, e, errstr );
             io->gotError( io, what, io->userData );
         }
@@ -974,7 +974,7 @@ tr_peerIoTryWrite( tr_peerIo * io, size_t howmuch )
             char errstr[512];
             const short what = EVBUFFER_WRITE | EVBUFFER_ERROR;
 
-            tr_net_strerror( errstr, sizeof( errstr ), e ); 
+            tr_net_strerror( errstr, sizeof( errstr ), e );
             dbgmsg( io, "tr_peerIoTryWrite got an error. res is %d, what is %hd, errno is %d (%s)", n, what, e, errstr );
 
             if( io->gotError != NULL )
index ed697b477f9e971b60107f60dea2135f829e8886..2cb892d47652cb6b432b0e8272e78c73bc14cbdf 100644 (file)
@@ -216,4 +216,3 @@ tr_ptrArrayRemoveSorted( tr_ptrArray * t,
     assertSortedAndUnique( t, compare );
     return ret;
 }
-
index 252d8357ceec8e276a8c4764685ae921caeed1b2..1e045c4a900c70acfa7b3561b77c4972ec2ea5b7 100644 (file)
@@ -386,7 +386,7 @@ add_response( struct evhttp_request * req,
             EVBUFFER_LENGTH( out ) = content_len - server->stream.avail_out;
 
 #if 0
-            fprintf( stderr, "compressed response is %.2f of original (raw==%zu bytes; compressed==%zu)\n", 
+            fprintf( stderr, "compressed response is %.2f of original (raw==%zu bytes; compressed==%zu)\n",
                              (double)EVBUFFER_LENGTH(out)/content_len,
                              content_len, EVBUFFER_LENGTH(out) );
 #endif
index ccd253e0d18d149d76c7d8808601665751397f22..60274d698cc1914d52c1748967a0edc7bf5b3952 100644 (file)
@@ -786,8 +786,8 @@ copyTrackers( tr_tracker_info * tgt, const tr_tracker_info * src, int n )
 {
     int i;
     int maxTier = -1;
-   
-    for( i=0; i<n; ++i ) 
+
+    for( i=0; i<n; ++i )
     {
         tgt[i].tier = src[i].tier;
         tgt[i].announce = tr_strdup( src[i].announce );
index 03cff6c971b6a6d89b7f4dc7b3566e8582f72365..ea12d2a0d73e6a29019e568e12cdb2d44d873b17 100644 (file)
@@ -451,7 +451,7 @@ tr_strip_positional_args( const char* str )
 
         if( ( *str == '%' ) && ( str[1] == '\'' ) )
             str = str + 1;
+
     }
     *out = '\0';
 
@@ -1222,7 +1222,7 @@ strip_non_utf8( const char * in, size_t inlen )
     const char * end;
     const char zero = '\0';
     struct evbuffer * buf = evbuffer_new( );
+
     while( !tr_utf8_validate( in, inlen, &end ) )
     {
         const int good_len = end - in;
@@ -1232,7 +1232,7 @@ strip_non_utf8( const char * in, size_t inlen )
         in += ( good_len + 1 );
         evbuffer_add( buf, "?", 1 );
     }
+
     evbuffer_add( buf, in, inlen );
     evbuffer_add( buf, &zero, 1 );
     ret = tr_memdup( EVBUFFER_DATA( buf ), EVBUFFER_LENGTH( buf ) );
@@ -1437,8 +1437,8 @@ tr_truncd( double x, int precision )
 {
     char * pt;
     char buf[128];
-    const int max_precision = (int) log10( 1.0 / DBL_EPSILON ) - 1; 
-    tr_snprintf( buf, sizeof( buf ), "%.*f", max_precision, x ); 
+    const int max_precision = (int) log10( 1.0 / DBL_EPSILON ) - 1;
+    tr_snprintf( buf, sizeof( buf ), "%.*f", max_precision, x );
     if(( pt = strstr( buf, localeconv()->decimal_point )))
         pt[precision ? precision+1 : 0] = '\0';
     return atof(buf);
@@ -1608,7 +1608,7 @@ struct formatter_unit
     char * name;
     uint64_t value;
 };
-  
+
 struct formatter_units
 {
     struct formatter_unit units[4];
@@ -1720,7 +1720,7 @@ tr_formatter_speed_KBps( char * buf, double KBps, size_t buflen )
 static struct formatter_units mem_units;
 
 unsigned int tr_mem_K = 0u;
+
 void
 tr_formatter_mem_init( unsigned int kilo,
                        const char * kb, const char * mb,
index c04973716d0b620e5ac061e7940e26024a1625d6..2cd3ec9a5947756875df1816e215ef1d62152cfd 100644 (file)
@@ -272,11 +272,11 @@ getCurrentSize( tr_torrent * tor )
     return byte_count;
 }
 
-static int 
-compareVerifyByPriorityAndSize( const void * va, const void * vb ) 
-{ 
-    const struct verify_node * a = va; 
-    const struct verify_node * b = vb; 
+static int
+compareVerifyByPriorityAndSize( const void * va, const void * vb )
+{
+    const struct verify_node * a = va;
+    const struct verify_node * b = vb;
 
     /* higher priority comes before lower priority */
     const tr_priority_t pa =  tr_torrentGetPriority( a->torrent );
@@ -288,7 +288,7 @@ compareVerifyByPriorityAndSize( const void * va, const void * vb )
     if( a->current_size < b->current_size ) return -1;
     if( a->current_size > b->current_size ) return  1;
     return 0;
-} 
+}
 
 void
 tr_verifyAdd( tr_torrent *      tor,
index 0102f71ad5a268d2a74807b0e8f6fbe57c03eb72..29b46cc81a7268b186d63ec2cda14476f175d49e 100644 (file)
@@ -144,10 +144,10 @@ createEasy( tr_session * s, struct tr_web_task * task )
     const tr_address * addr;
     CURL * e = curl_easy_init( );
     const long verbose = getenv( "TR_CURL_VERBOSE" ) != NULL;
-    char * cookie_filename = tr_buildPath( s->configDir, "cookies.txt", NULL );          
+    char * cookie_filename = tr_buildPath( s->configDir, "cookies.txt", NULL );
 
     curl_easy_setopt( e, CURLOPT_AUTOREFERER, 1L );
-    curl_easy_setopt( e, CURLOPT_COOKIEFILE, cookie_filename ); 
+    curl_easy_setopt( e, CURLOPT_COOKIEFILE, cookie_filename );
     curl_easy_setopt( e, CURLOPT_ENCODING, "gzip;q=1.0, deflate, identity" );
     curl_easy_setopt( e, CURLOPT_FOLLOWLOCATION, 1L );
     curl_easy_setopt( e, CURLOPT_MAXREDIRS, -1L );
@@ -172,7 +172,7 @@ createEasy( tr_session * s, struct tr_web_task * task )
     if( task->range )
         curl_easy_setopt( e, CURLOPT_RANGE, task->range );
 
-    tr_free( cookie_filename ); 
+    tr_free( cookie_filename );
     return e;
 }
 
@@ -232,7 +232,7 @@ tr_webRun( tr_session         * session,
  * http://msdn.microsoft.com/en-us/library/ms740141%28VS.85%29.aspx
  * On win32, any two of the parameters, readfds, writefds, or exceptfds,
  * can be given as null. At least one must be non-null, and any non-null
- * descriptor set must contain at least one handle to a socket. 
+ * descriptor set must contain at least one handle to a socket.
  */
 static void
 tr_select( int nfds,
@@ -252,7 +252,7 @@ tr_select( int nfds,
         char errstr[512];
         const int e = EVUTIL_SOCKET_ERROR( );
         tr_net_strerror( errstr, sizeof( errstr ), e );
-        dbgmsg( "Error: select (%d) %s", e, errstr ); 
+        dbgmsg( "Error: select (%d) %s", e, errstr );
     }
 #else
     select( nfds, r_fd_set, w_fd_set, c_fd_set, t );