Changeset 8889


Ignore:
Timestamp:
Aug 10, 2009, 8:04:08 PM (13 years ago)
Author:
charles
Message:

(trunk) remove trailing spaces

Location:
trunk
Files:
44 edited

Legend:

Unmodified
Added
Removed
  • trunk/cli/cli.c

    r8875 r8889  
    301301    tr_benc       settings;
    302302    const char  * configDir;
    303     tr_bool       haveSource; 
    304     tr_bool       haveAnnounce; 
     303    tr_bool       haveSource;
     304    tr_bool       haveAnnounce;
    305305
    306306    printf( "Transmission %s - http://www.transmissionbt.com/\n",
  • trunk/daemon/remote.c

    r8875 r8889  
    789789        case TR_STATUS_DOWNLOAD:
    790790        case TR_STATUS_SEED: {
    791             int64_t fromUs = 0; 
    792             int64_t toUs = 0; 
    793             tr_bencDictFindInt( t, "peersGettingFromUs", &fromUs ); 
    794             tr_bencDictFindInt( t, "peersSendingToUs", &toUs ); 
    795             if( fromUs && toUs ) 
    796                 tr_strlcpy( buf, "Up & Down", buflen ); 
    797             else if( toUs ) 
    798                 tr_strlcpy( buf, "Downloading", buflen ); 
    799             else if( fromUs ) { 
    800                 int64_t leftUntilDone = 0; 
    801                 tr_bencDictFindInt( t, "leftUntilDone", &leftUntilDone ); 
     791            int64_t fromUs = 0;
     792            int64_t toUs = 0;
     793            tr_bencDictFindInt( t, "peersGettingFromUs", &fromUs );
     794            tr_bencDictFindInt( t, "peersSendingToUs", &toUs );
     795            if( fromUs && toUs )
     796                tr_strlcpy( buf, "Up & Down", buflen );
     797            else if( toUs )
     798                tr_strlcpy( buf, "Downloading", buflen );
     799            else if( fromUs ) {
     800                int64_t leftUntilDone = 0;
     801                tr_bencDictFindInt( t, "leftUntilDone", &leftUntilDone );
    802802                if( leftUntilDone > 0 )
    803                     tr_strlcpy( buf, "Uploading", buflen ); 
     803                    tr_strlcpy( buf, "Uploading", buflen );
    804804                else
    805                     tr_strlcpy( buf, "Seeding", buflen ); 
     805                    tr_strlcpy( buf, "Seeding", buflen );
    806806            } else {
    807                 tr_strlcpy( buf, "Idle", buflen ); 
     807                tr_strlcpy( buf, "Idle", buflen );
    808808            }
    809809            break;
     
    14301430    return curl;
    14311431}
    1432    
     1432
    14331433
    14341434static int
     
    15201520        return EXIT_FAILURE;
    15211521    }
    1522        
     1522
    15231523
    15241524    for( i=0; i<reqCount; ++i )
  • trunk/gtk/conf.c

    r8847 r8889  
    167167#endif
    168168
     169    tr_bencDictAddBool( d, PREF_KEY_LEGAL_DIALOG_ON_STARTUP, TRUE );
    169170    tr_bencDictAddBool( d, PREF_KEY_INHIBIT_HIBERNATION, FALSE );
    170171    tr_bencDictAddBool( d, PREF_KEY_BLOCKLIST_UPDATES_ENABLED, TRUE );
  • trunk/gtk/details.c

    r8868 r8889  
    232232                                           di->honorLimitsCheckTag, baseline );
    233233    }
    234    
     234
    235235    /* downLimitedCheck */
    236236    if( n ) {
     
    256256                                       di->downLimitSpinTag, baseline );
    257257    }
    258    
     258
    259259    /* upLimitedCheck */
    260260    if( n ) {
     
    577577    d->seedCustomSpin = w;
    578578    d->seedCustomSpinTag = tag;
    579    
     579
    580580    hig_workarea_add_section_divider( t, &row );
    581581    hig_workarea_add_section_title( t, &row, _( "Peer Connections" ) );
     
    688688    gtk_text_buffer_set_text( di->comment_buffer, str, -1 );
    689689
    690     /* destination_lb */       
     690    /* destination_lb */
    691691    if( n<=0 )
    692692        str = none;
     
    806806    gtk_label_set_text( GTK_LABEL( di->have_lb ), str );
    807807
    808    
     808
    809809    /* dl_lb */
    810810    if( n <= 0 )
     
    827827    gtk_label_set_text( GTK_LABEL( di->dl_lb ), str );
    828828
    829    
     829
    830830    /* ul_lb */
    831831    if( n <= 0 )
     
    857857        str = none;
    858858    else if ( n==1 )
    859         str = infos[0]->hashString; 
     859        str = infos[0]->hashString;
    860860    else
    861861        str = mixed;
     
    12551255    GtkListStore * store = di->webseed_store;
    12561256    GtkTreeModel * model = GTK_TREE_MODEL( store );
    1257    
     1257
    12581258    /* step 1: mark all webseeds as not-updated */
    12591259    if( gtk_tree_model_get_iter_first( model, &iter ) ) do
     
    14061406                case 'D': s = _( "Downloading from this peer" ); break;
    14071407                case 'd': s = _( "We would download from this peer if they would let us" ); break;
    1408                 case 'U': s = _( "Uploading to peer" ); break; 
     1408                case 'U': s = _( "Uploading to peer" ); break;
    14091409                case 'u': s = _( "We would upload to this peer if they asked" ); break;
    14101410                case 'K': s = _( "Peer has unchoked us, but we're not interested" ); break;
    14111411                case '?': s = _( "We unchoked this peer, but they're not interested" ); break;
    1412                 case 'E': s = _( "Encrypted connection" ); break; 
     1412                case 'E': s = _( "Encrypted connection" ); break;
    14131413                case 'X': s = _( "Peer was discovered through Peer Exchange (PEX)" ); break;
    14141414                case 'H': s = _( "Peer was discovered through DHT" ); break;
     
    19641964        file_list_set_torrent( di->file_list, id );
    19651965        tracker_list_set_torrent( di->tracker_list, id );
    1966        
    19671966    }
    19681967   else
  • trunk/gtk/dialogs.c

    r8656 r8889  
    271271        if( counts.connected && counts.incomplete )
    272272            g_string_append( secondary_text, "\n" );
    273  
     273
    274274        if( counts.incomplete )
    275275            g_string_assign( secondary_text, ngettext( "One of these torrents has not finished downloading.",
  • trunk/gtk/file-list.c

    r8808 r8889  
    382382
    383383    const char * mime_type = isLeaf ? get_mime_type_from_filename( child_data->name ) : DIRECTORY_MIME_TYPE;
    384     GdkPixbuf * icon = get_mime_type_icon( mime_type, GTK_ICON_SIZE_MENU, build->w ); 
     384    GdkPixbuf * icon = get_mime_type_icon( mime_type, GTK_ICON_SIZE_MENU, build->w );
    385385    const int priority = isLeaf ? tr_torrentGetFilePriority( build->tor, child_data->index ) : 0;
    386386    const gboolean enabled = isLeaf ? tr_torrentGetFileDL( build->tor, child_data->index ) : TRUE;
     
    416416
    417417    g_object_unref( icon );
    418  
     418
    419419    /* we're done with this node */
    420420    g_free( child_data->name );
  • trunk/gtk/main.c

    r8871 r8889  
    543543                                          cbdata->icon != NULL );
    544544    }
     545
     546    if( pref_flag_get( PREF_KEY_LEGAL_DIALOG_ON_STARTUP ) )
     547    {
     548        /* show the legal dialog */
     549        GtkWidget * w = gtk_message_dialog_new( GTK_WINDOW( wind ),
     550                                                GTK_DIALOG_DESTROY_WITH_PARENT,
     551                                                GTK_MESSAGE_INFO,
     552                                                GTK_BUTTONS_OK,
     553                                                "%s",
     554                                                _( "Notice for first-time users" ) );
     555        gtk_message_dialog_format_secondary_text( GTK_MESSAGE_DIALOG( w ),
     556                                                  "%s",
     557                                                  _( "Transmission should only be used for legal file transfers.  "
     558                                                     "Please respect other peoples' property." ) );
     559        g_signal_connect_swapped( w, "response", G_CALLBACK( gtk_widget_destroy ), w );
     560        gtk_widget_show( w );
     561
     562        /* only show it once */
     563        pref_flag_set( PREF_KEY_LEGAL_DIALOG_ON_STARTUP, FALSE );
     564    }
    545565}
    546566
  • trunk/gtk/makemeta-ui.c

    r8757 r8889  
    433433        int trackerCount = 0;
    434434        tr_tracker_info * trackers = g_new0( tr_tracker_info, n );
    435          
     435
    436436        for( i=0; i<n; ++i )
    437437        {
  • trunk/gtk/torrent-cell-renderer.c

    r8882 r8889  
    5353    char           buf1[32], buf2[32], buf3[32], buf4[32];
    5454    char *         str;
    55     double         seedRatio; 
     55    double         seedRatio;
    5656    gboolean       hasSeedRatio = FALSE;
    5757
     
    362362    stat_area.width = w;
    363363    stat_area.height = h;
    364    
     364
    365365    /**
    366366    *** LAYOUT
     
    424424    stat_area.width = w;
    425425    stat_area.height = h;
    426    
     426
    427427    /**
    428428    *** LAYOUT
     
    555555    *** RENDER
    556556    **/
    557    
     557
    558558    g_object_set( p->icon_renderer, "pixbuf", icon, "sensitive", active, NULL );
    559559    gtk_cell_renderer_render( p->icon_renderer, window, widget, &icon_area, &icon_area, &icon_area, flags );
     
    622622    stat_area.width = w;
    623623    stat_area.height = h;
    624    
     624
    625625    /**
    626626    *** LAYOUT
     
    661661    *** RENDER
    662662    **/
    663    
     663
    664664    g_object_set( p->icon_renderer, "pixbuf", icon, "sensitive", active, NULL );
    665665    gtk_cell_renderer_render( p->icon_renderer, window, widget, &icon_area, &icon_area, &icon_area, flags );
  • trunk/gtk/tr-core.h

    r8882 r8889  
    140140
    141141/** Present the main window */
    142 gboolean tr_core_present_window( TrCore*, gboolean * setme_success, GError ** err ); 
     142gboolean tr_core_present_window( TrCore*, gboolean * setme_success, GError ** err );
    143143
    144144
  • trunk/gtk/tr-icon.c

    r8763 r8889  
    8484        tr_strlspeed( down, d, sizeof( down ) );
    8585
    86     /* down limit */   
     86    /* down limit */
    8787    if( !tr_sessionGetActiveSpeedLimit( session, TR_DOWN, &limit ) )
    8888        *downLimit = '\0';
  • trunk/gtk/tr-prefs.c

    r8763 r8889  
    12181218        hig_workarea_add_row( t, &row, s, w, NULL );
    12191219
    1220         s = _( "_Scheduled times:" ); 
     1220        s = _( "_Scheduled times:" );
    12211221        h = gtk_hbox_new( FALSE, 0 );
    12221222        w2 = new_time_combo( core, TR_PREFS_KEY_ALT_SPEED_TIME_BEGIN );
  • trunk/gtk/tr-prefs.h

    r8673 r8889  
    2222 * default in tr_prefs_init_defaults( void ) */
    2323
     24#define PREF_KEY_LEGAL_DIALOG_ON_STARTUP    "show-legal-dialog-on-startup"
    2425#define PREF_KEY_OPTIONS_PROMPT             "show-options-window"
    2526#define PREF_KEY_OPEN_DIALOG_FOLDER         "open-dialog-dir"
  • trunk/gtk/tr-window.c

    r8882 r8889  
    188188    p->selection = gtk_tree_view_get_selection( GTK_TREE_VIEW( view ) );
    189189
    190     p->column = col = GTK_TREE_VIEW_COLUMN (g_object_new (GTK_TYPE_TREE_VIEW_COLUMN,                 
     190    p->column = col = GTK_TREE_VIEW_COLUMN (g_object_new (GTK_TYPE_TREE_VIEW_COLUMN,
    191191        "title", _("Torrent"),
    192192        "resizable", TRUE,
     
    199199    gtk_tree_view_column_add_attribute( col, r, "piece-upload-speed", MC_SPEED_UP );
    200200    gtk_tree_view_column_add_attribute( col, r, "piece-download-speed", MC_SPEED_DOWN );
    201    
     201
    202202    gtk_tree_view_append_column( GTK_TREE_VIEW( view ), col );
    203203    g_object_set( r, "xpad", GUI_PAD_SMALL, "ypad", GUI_PAD_SMALL, NULL );
     
    357357    tr_core_set_pref_bool( p->core, TR_PREFS_KEY_ALT_SPEED_ENABLED,  b );
    358358}
    359    
     359
    360360/***
    361361****  FILTER
     
    491491    }
    492492}
    493  
     493
    494494
    495495static void
     
    623623
    624624static void
    625 onSpeedToggled( GtkCheckMenuItem * check, gpointer vp ) 
     625onSpeedToggled( GtkCheckMenuItem * check, gpointer vp )
    626626{
    627627    PrivateData * p = vp;
     
    637637
    638638static void
    639 onSpeedSet( GtkCheckMenuItem * check, gpointer vp ) 
     639onSpeedSet( GtkCheckMenuItem * check, gpointer vp )
    640640{
    641641    const char * key;
     
    701701
    702702static void
    703 onRatioToggled( GtkCheckMenuItem * check, gpointer vp ) 
     703onRatioToggled( GtkCheckMenuItem * check, gpointer vp )
    704704{
    705705    PrivateData * p = vp;
     
    711711}
    712712static void
    713 onRatioSet( GtkCheckMenuItem * check, gpointer vp ) 
     713onRatioSet( GtkCheckMenuItem * check, gpointer vp )
    714714{
    715715    PrivateData * p = vp;
     
    972972            gtk_box_pack_start( GTK_BOX( hbox ), w, FALSE, FALSE, 0 );
    973973            w = p->ul_lb = gtk_label_new( NULL );
    974             gtk_box_pack_start( GTK_BOX( hbox ), w, FALSE, FALSE, 0 ); 
     974            gtk_box_pack_start( GTK_BOX( hbox ), w, FALSE, FALSE, 0 );
    975975        gtk_box_pack_end( GTK_BOX( h ), hbox, FALSE, FALSE, 0 );
    976976
     
    982982            gtk_box_pack_start( GTK_BOX( hbox ), w, FALSE, FALSE, 0 );
    983983            w = p->dl_lb = gtk_label_new( NULL );
    984             gtk_box_pack_start( GTK_BOX( hbox ), w, FALSE, FALSE, 0 ); 
     984            gtk_box_pack_start( GTK_BOX( hbox ), w, FALSE, FALSE, 0 );
    985985        gtk_box_pack_end( GTK_BOX( h ), hbox, FALSE, FALSE, 0 );
    986986
  • trunk/gtk/util.c

    r8871 r8889  
    44 * This file is licensed by the GPL version 2.  Works owned by the
    55 * Transmission project are granted a special exemption to clause 2(b)
    6  * so that the bulk of its code can remain under the MIT license. 
     6 * so that the bulk of its code can remain under the MIT license.
    77 * This exemption does not extend to derived works not owned by
    88 * the Transmission project.
  • trunk/gtk/util.h

    r8847 r8889  
    44 * This file is licensed by the GPL version 2.  Works owned by the
    55 * Transmission project are granted a special exemption to clause 2(b)
    6  * so that the bulk of its code can remain under the MIT license. 
     6 * so that the bulk of its code can remain under the MIT license.
    77 * This exemption does not extend to derived works not owned by
    88 * the Transmission project.
  • trunk/libtransmission/bandwidth.h

    r8709 r8889  
    7777 *   I/O can be counted in the global raw totals.  When the handshake is done,
    7878 *   the bandwidth's ownership passes to a tr_peer.
    79  * 
     79 *
    8080 * MEASURING
    8181 *
     
    8686 *
    8787 * CONSTRAINING
    88  * 
     88 *
    8989 *   Call tr_bandwidthAllocate() periodically.  tr_bandwidth knows its current
    9090 *   speed and will decide how many bytes to make available over the
    9191 *   user-specified period to reach the user-specified desired speed.
    9292 *   If appropriate, it notifies its peer-ios that new bandwidth is available.
    93  * 
    94  *   tr_bandwidthAllocate() operates on the tr_bandwidth subtree, so usually 
     93 *
     94 *   tr_bandwidthAllocate() operates on the tr_bandwidth subtree, so usually
    9595 *   you'll only need to invoke it for the top-level tr_session bandwidth.
    9696 *
    9797 *   The peer-ios all have a pointer to their associated tr_bandwidth object,
    98  *   and call tr_bandwidthClamp() before performing I/O to see how much 
     98 *   and call tr_bandwidthClamp() before performing I/O to see how much
    9999 *   bandwidth they can safely use.
    100100 */
  • trunk/libtransmission/bencode-test.c

    r8685 r8889  
    375375}
    376376
    377 static int 
     377static int
    378378testMerge( void )
    379 { 
    380     tr_benc dest, src; 
    381     int64_t i; 
    382     const char * s; 
     379{
     380    tr_benc dest, src;
     381    int64_t i;
     382    const char * s;
    383383
    384384    /* initial dictionary (default values)  */
    385     tr_bencInitDict( &dest, 10 ); 
    386     tr_bencDictAddInt( &dest, "i1", 1 ); 
    387     tr_bencDictAddInt( &dest, "i2", 2 ); 
     385    tr_bencInitDict( &dest, 10 );
     386    tr_bencDictAddInt( &dest, "i1", 1 );
     387    tr_bencDictAddInt( &dest, "i2", 2 );
    388388    tr_bencDictAddInt( &dest, "i4", -35 ); /* remains untouched */
    389     tr_bencDictAddStr( &dest, "s5", "abc" ); 
    390     tr_bencDictAddStr( &dest, "s6", "def" ); 
     389    tr_bencDictAddStr( &dest, "s5", "abc" );
     390    tr_bencDictAddStr( &dest, "s6", "def" );
    391391    tr_bencDictAddStr( &dest, "s7", "127.0.0.1" ); /* remains untouched */
    392392
    393393    /* new dictionary, will overwrite items in dest  */
    394     tr_bencInitDict( &src, 10 ); 
     394    tr_bencInitDict( &src, 10 );
    395395    tr_bencDictAddInt( &src, "i1", 1 );     /* same value */
    396396    tr_bencDictAddInt( &src, "i2", 4 );     /* new value */
     
    400400    tr_bencDictAddStr( &src, "s8", "ghi" ); /* new key:value */
    401401
    402     tr_bencMergeDicts( &dest, /*const*/ &src ); 
    403 
    404     check( tr_bencDictFindInt( &dest, "i1", &i )); 
    405     check( i == 1); 
    406     check( tr_bencDictFindInt( &dest, "i2", &i )); 
    407     check( i == 4); 
    408     check( tr_bencDictFindInt( &dest, "i3", &i )); 
    409     check( i == 3); 
    410     check( tr_bencDictFindInt( &dest, "i4", &i )); 
    411     check( i == -35); 
    412     check( tr_bencDictFindStr( &dest, "s5", &s )); 
    413     check( strcmp( "abc", s ) == 0 ); 
    414     check( tr_bencDictFindStr( &dest, "s6", &s )); 
    415     check( strcmp( "xyz", s ) == 0 ); 
    416     check( tr_bencDictFindStr( &dest, "s7", &s )); 
    417     check( strcmp( "127.0.0.1", s ) == 0 ); 
    418     check( tr_bencDictFindStr( &dest, "s8", &s )); 
    419     check( strcmp( "ghi", s ) == 0 ); 
    420 
    421     tr_bencFree( &dest ); 
    422     tr_bencFree( &src ); 
    423     return 0; 
    424 } 
     402    tr_bencMergeDicts( &dest, /*const*/ &src );
     403
     404    check( tr_bencDictFindInt( &dest, "i1", &i ));
     405    check( i == 1);
     406    check( tr_bencDictFindInt( &dest, "i2", &i ));
     407    check( i == 4);
     408    check( tr_bencDictFindInt( &dest, "i3", &i ));
     409    check( i == 3);
     410    check( tr_bencDictFindInt( &dest, "i4", &i ));
     411    check( i == -35);
     412    check( tr_bencDictFindStr( &dest, "s5", &s ));
     413    check( strcmp( "abc", s ) == 0 );
     414    check( tr_bencDictFindStr( &dest, "s6", &s ));
     415    check( strcmp( "xyz", s ) == 0 );
     416    check( tr_bencDictFindStr( &dest, "s7", &s ));
     417    check( strcmp( "127.0.0.1", s ) == 0 );
     418    check( tr_bencDictFindStr( &dest, "s8", &s ));
     419    check( strcmp( "ghi", s ) == 0 );
     420
     421    tr_bencFree( &dest );
     422    tr_bencFree( &src );
     423    return 0;
     424}
    425425
    426426static int
  • trunk/libtransmission/bencode.h

    r8592 r8889  
    2727 * An object that acts like a union for
    2828 * integers, strings, lists, dictionaries, booleans, and floating-point numbers.
    29  * The structure is named tr_benc due to the historical reason that it was 
     29 * The structure is named tr_benc due to the historical reason that it was
    3030 * originally tightly coupled with bencoded data.  It currently supports
    3131 * being parsed from, and serialized to, both bencoded notation and json notation.
     
    4646    TR_TYPE_REAL = 32
    4747};
    48    
     48
    4949/* These are PRIVATE IMPLEMENTATION details that should not be touched.
    5050 * I'll probably change them just to break your code! HA HA HA!
  • trunk/libtransmission/bitfield.h

    r8695 r8889  
    44 * This file is licensed by the GPL version 2.  Works owned by the
    55 * Transmission project are granted a special exemption to clause 2(b)
    6  * so that the bulk of its code can remain under the MIT license. 
     6 * so that the bulk of its code can remain under the MIT license.
    77 * This exemption does not extend to derived works not owned by
    88 * the Transmission project.
  • trunk/libtransmission/clients.c

    r8599 r8889  
    44 * This file is licensed by the GPL version 2.  Works owned by the
    55 * Transmission project are granted a special exemption to clause 2(b)
    6  * so that the bulk of its code can remain under the MIT license. 
     6 * so that the bulk of its code can remain under the MIT license.
    77 * This exemption does not extend to derived works not owned by
    88 * the Transmission project.
     
    3333}
    3434
    35 static int 
    36 getShadowInt( char ch, int * setme ) 
    37 { 
    38     const char * str = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz.-"; 
    39     const char * pch = strchr( str, ch ); 
    40     if( !pch ) 
    41     return 0; 
    42         *setme = pch - str; 
    43     return 1; 
    44 } 
     35static int
     36getShadowInt( char ch, int * setme )
     37{
     38    const char * str = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz.-";
     39    const char * pch = strchr( str, ch );
     40    if( !pch )
     41    return 0;
     42        *setme = pch - str;
     43    return 1;
     44}
    4545
    4646static int
     
    111111     *   Mx-y-z--
    112112     *   Mx-yy-z-
    113      */ 
     113     */
    114114    return peer_id[2]=='-'
    115115        && peer_id[7]=='-'
     
    182182                          id[6]=='Z' || id[6]=='X' ? "+" : "" );
    183183        }
    184        
     184
    185185        else if( !memcmp( id+1, "UT", 2 ) )
    186186        {
     
    193193                         strint(id+3,1), strint(id+4,1), strint(id+5,1), getMnemonicEnd(id[6]) );
    194194        }
    195        
     195
    196196        else if( !memcmp( id+1, "AZ", 2 ) )
    197197        {
     
    201201                four_digits( buf, buflen, "Azureus", id+3 );
    202202        }
    203        
     203
    204204        else if( !memcmp( id+1, "KT", 2 ) )
    205205        {
     
    328328    else if( !memcmp( id, "-aria2-", 7 ) )   no_version( buf, buflen, "aria2" );
    329329    else if( !memcmp( id, "-FG", 3 ) )       two_major_two_minor( buf, buflen, "FlashGet", id+3 );
    330    
    331     /* Everything else */ 
     330
     331    /* Everything else */
    332332    else if( !memcmp( id, "S3", 2 ) && id[2] == '-' && id[4] == '-' && id[6] == '-' )
    333333    {
  • trunk/libtransmission/clients.h

    r8561 r8889  
    44 * This file is licensed by the GPL version 2.  Works owned by the
    55 * Transmission project are granted a special exemption to clause 2(b)
    6  * so that the bulk of its code can remain under the MIT license. 
     6 * so that the bulk of its code can remain under the MIT license.
    77 * This exemption does not extend to derived works not owned by
    88 * the Transmission project.
  • trunk/libtransmission/completion.h

    r8695 r8889  
    44 * This file is licensed by the GPL version 2.  Works owned by the
    55 * Transmission project are granted a special exemption to clause 2(b)
    6  * so that the bulk of its code can remain under the MIT license. 
     6 * so that the bulk of its code can remain under the MIT license.
    77 * This exemption does not extend to derived works not owned by
    88 * the Transmission project.
  • trunk/libtransmission/fdlimit.c

    r8823 r8889  
    182182        if( !success ) /* if nothing else works, do it the old-fashioned way */
    183183        {
    184             uint8_t buf[ 4096 ]; 
    185             memset( buf, 0, sizeof( buf ) ); 
    186             success = TRUE; 
    187             while ( success && ( length > 0 ) ) 
    188             { 
    189                 const int thisPass = MIN( length, sizeof( buf ) ); 
    190                 success = write( fd, buf, thisPass ) == thisPass; 
    191                 length -= thisPass; 
    192             } 
     184            uint8_t buf[ 4096 ];
     185            memset( buf, 0, sizeof( buf ) );
     186            success = TRUE;
     187            while ( success && ( length > 0 ) )
     188            {
     189                const int thisPass = MIN( length, sizeof( buf ) );
     190                success = write( fd, buf, thisPass ) == thisPass;
     191                length -= thisPass;
     192            }
    193193        }
    194194
     
    317317        if( preallocateFileFull( filename, desiredFileSize ) )
    318318            tr_inf( _( "Preallocated file \"%s\"" ), filename );
    319    
     319
    320320    /* open the file */
    321321    flags = doWrite ? ( O_RDWR | O_CREAT ) : O_RDONLY;
     
    447447
    448448        assert( winner >= 0 );
    449        
     449
    450450        if( fileIsOpen( &gFd->openFiles[winner] ) )
    451451        {
     
    577577    if( s >= 0 )
    578578    {
    579         /* "The ss_family field of the sockaddr_storage structure will always 
    580          * align with the family field of any protocol-specific structure." */ 
    581         if( sock.ss_family == AF_INET ) 
     579        /* "The ss_family field of the sockaddr_storage structure will always
     580         * align with the family field of any protocol-specific structure." */
     581        if( sock.ss_family == AF_INET )
    582582        {
    583583            struct sockaddr_in *si;
     
    585585            s.dummy = sock;
    586586            si = &s.si;
    587             addr->type = TR_AF_INET; 
    588             addr->addr.addr4.s_addr = si->sin_addr.s_addr; 
    589             *port = si->sin_port; 
    590         } 
    591         else 
    592         { 
     587            addr->type = TR_AF_INET;
     588            addr->addr.addr4.s_addr = si->sin_addr.s_addr;
     589            *port = si->sin_port;
     590        }
     591        else
     592        {
    593593            struct sockaddr_in6 *si;
    594594            union { struct sockaddr_storage dummy; struct sockaddr_in6 si; } s;
    595595            s.dummy = sock;
    596596            si = &s.si;
    597             addr->type = TR_AF_INET6; 
     597            addr->type = TR_AF_INET6;
    598598            addr->addr.addr6 = si->sin6_addr;
    599             *port = si->sin6_port; 
    600         } 
     599            *port = si->sin6_port;
     600        }
    601601        ++gFd->socketCount;
    602602    }
  • trunk/libtransmission/handshake.c

    r8767 r8889  
    7777#endif
    7878
    79 #ifdef ENABLE_FAST 
    80  #define HANDSHAKE_HAS_FASTEXT( bits ) ( ( ( bits )[7] & 0x04 ) ? 1 : 0 ) 
    81  #define HANDSHAKE_SET_FASTEXT( bits ) ( ( bits )[7] |= 0x04 ) 
    82 #else 
    83  #define HANDSHAKE_HAS_FASTEXT( bits ) ( 0 ) 
    84  #define HANDSHAKE_SET_FASTEXT( bits ) ( (void)0 ) 
    85 #endif 
     79#ifdef ENABLE_FAST
     80 #define HANDSHAKE_HAS_FASTEXT( bits ) ( ( ( bits )[7] & 0x04 ) ? 1 : 0 )
     81 #define HANDSHAKE_SET_FASTEXT( bits ) ( ( bits )[7] |= 0x04 )
     82#else
     83 #define HANDSHAKE_HAS_FASTEXT( bits ) ( 0 )
     84 #define HANDSHAKE_SET_FASTEXT( bits ) ( (void)0 )
     85#endif
    8686
    8787#ifdef ENABLE_DHT
     
    9191 #define HANDSHAKE_HAS_DHT( bits ) ( 0 )
    9292 #define HANDSHAKE_SET_DHT( bits ) ( (void)0 )
    93 #endif 
     93#endif
    9494
    9595/* http://www.azureuswiki.com/index.php/Extension_negotiation_protocol
     
    11281128    success = fireDoneFunc( handshake, isOK );
    11291129
    1130     tr_handshakeFree( handshake );   
     1130    tr_handshakeFree( handshake );
    11311131
    11321132    return success ? READ_LATER : READ_ERR;
  • trunk/libtransmission/list.c

    r8762 r8889  
    186186}
    187187
    188  
    189188void
    190189__tr_list_remove( struct __tr_list * head )
  • trunk/libtransmission/list.h

    r8762 r8889  
    126126 *    __tr_list_remove()
    127127 *
    128  * Remove @head from the list it is in. 
     128 * Remove @head from the list it is in.
    129129 */
    130130void
  • trunk/libtransmission/metainfo.c

    r8871 r8889  
    296296                        t->announce = tr_strdup( url );
    297297                        t->scrape = announceToScrape( url );
    298                        
     298
    299299                        anyAdded = TRUE;
    300300                    }
     
    302302                }
    303303            }
    304            
     304
    305305            if( anyAdded )
    306306                ++validTiers;
  • trunk/libtransmission/net.c

    r8791 r8889  
    5757#endif
    5858
    59 const tr_address tr_in6addr_any = { TR_AF_INET6, { IN6ADDR_ANY_INIT } }; 
    60 const tr_address tr_inaddr_any = { TR_AF_INET, { { { { INADDR_ANY, 0x00, 0x00, 0x00 } } } } }; 
     59const tr_address tr_in6addr_any = { TR_AF_INET6, { IN6ADDR_ANY_INIT } };
     60const tr_address tr_inaddr_any = { TR_AF_INET, { { { { INADDR_ANY, 0x00, 0x00, 0x00 } } } } };
    6161
    6262#ifdef WIN32
     
    130130}
    131131
    132 const char * 
    133 tr_ntop( const tr_address * src, char * dst, int size ) 
     132const char *
     133tr_ntop( const tr_address * src, char * dst, int size )
    134134{
    135135    assert( tr_isAddress( src ) );
    136136
    137     if( src->type == TR_AF_INET ) 
    138         return inet_ntop( AF_INET, &src->addr, dst, size ); 
    139     else 
    140         return inet_ntop( AF_INET6, &src->addr, dst, size ); 
    141 } 
    142 
    143 /* 
    144  * Non-threadsafe version of tr_ntop, which uses a static memory area for a buffer. 
    145  * This function is suitable to be called from libTransmission's networking code, 
    146  * which is single-threaded. 
    147  */ 
    148 const char * 
    149 tr_ntop_non_ts( const tr_address * src ) 
    150 { 
    151     static char buf[INET6_ADDRSTRLEN]; 
    152     return tr_ntop( src, buf, sizeof( buf ) ); 
    153 } 
    154 
    155 tr_address * 
    156 tr_pton( const char * src, tr_address * dst ) 
    157 { 
    158     int retval = inet_pton( AF_INET, src, &dst->addr ); 
     137    if( src->type == TR_AF_INET )
     138        return inet_ntop( AF_INET, &src->addr, dst, size );
     139    else
     140        return inet_ntop( AF_INET6, &src->addr, dst, size );
     141}
     142
     143/*
     144 * Non-threadsafe version of tr_ntop, which uses a static memory area for a buffer.
     145 * This function is suitable to be called from libTransmission's networking code,
     146 * which is single-threaded.
     147 */
     148const char *
     149tr_ntop_non_ts( const tr_address * src )
     150{
     151    static char buf[INET6_ADDRSTRLEN];
     152    return tr_ntop( src, buf, sizeof( buf ) );
     153}
     154
     155tr_address *
     156tr_pton( const char * src, tr_address * dst )
     157{
     158    int retval = inet_pton( AF_INET, src, &dst->addr );
    159159    assert( dst );
    160     if( retval < 0 ) 
    161         return NULL; 
    162     else if( retval == 0 ) 
    163         retval = inet_pton( AF_INET6, src, &dst->addr ); 
     160    if( retval < 0 )
     161        return NULL;
     162    else if( retval == 0 )
     163        retval = inet_pton( AF_INET6, src, &dst->addr );
    164164    else
    165     { 
    166         dst->type = TR_AF_INET; 
    167         return dst; 
    168     } 
    169 
    170     if( retval < 1 ) 
    171         return NULL; 
    172     dst->type = TR_AF_INET6; 
    173     return dst; 
    174 }
    175 
    176 /* 
    177  * Compare two tr_address structures. 
    178  * Returns: 
    179  * <0 if a < b 
    180  * >0 if a > b 
    181  * 0  if a == b 
    182  */ 
     165    {
     166        dst->type = TR_AF_INET;
     167        return dst;
     168    }
     169
     170    if( retval < 1 )
     171        return NULL;
     172    dst->type = TR_AF_INET6;
     173    return dst;
     174}
     175
     176/*
     177 * Compare two tr_address structures.
     178 * Returns:
     179 * <0 if a < b
     180 * >0 if a > b
     181 * 0  if a == b
     182 */
    183183int
    184184tr_compareAddresses( const tr_address * a, const tr_address * b)
     
    189189    assert( tr_isAddress( b ) );
    190190
    191     /* IPv6 addresses are always "greater than" IPv4 */ 
     191    /* IPv6 addresses are always "greater than" IPv4 */
    192192    if( a->type != b->type )
    193193        return a->type == TR_AF_INET ? 1 : -1;
    194194
    195195    return memcmp( &a->addr, &b->addr, sizes[a->type] );
    196 } 
     196}
    197197
    198198/***********************************************************************
     
    314314
    315315    addrlen = setup_sockaddr( addr, port, &sock );
    316    
     316
    317317    /* set source address */
    318318    source_addr = tr_sessionGetPublicAddress( session, addr->type );
  • trunk/libtransmission/peer-io.c

    r8831 r8889  
    100100        if( io->didWrite )
    101101            io->didWrite( io, payload, next->isPieceData, io->userData );
    102        
     102
    103103        if( tr_isPeerIo( io ) )
    104104        {
     
    455455    __tr_list_destroy( &io->outbuf_datatypes, trDatatypeFree );
    456456
    457     memset( io, ~0, sizeof( tr_peerIo ) ); 
     457    memset( io, ~0, sizeof( tr_peerIo ) );
    458458    tr_free( io );
    459459}
     
    511511    static char buf[512];
    512512
    513     if( addr->type == TR_AF_INET ) 
    514         tr_snprintf( buf, sizeof( buf ), "%s:%u", tr_ntop_non_ts( addr ), ntohs( port ) ); 
    515     else 
    516         tr_snprintf( buf, sizeof( buf ), "[%s]:%u", tr_ntop_non_ts( addr ), ntohs( port ) ); 
     513    if( addr->type == TR_AF_INET )
     514        tr_snprintf( buf, sizeof( buf ), "%s:%u", tr_ntop_non_ts( addr ), ntohs( port ) );
     515    else
     516        tr_snprintf( buf, sizeof( buf ), "[%s]:%u", tr_ntop_non_ts( addr ), ntohs( port ) );
    517517    return buf;
    518518}
     
    547547        tr_netClose( io->socket );
    548548
    549     io->socket = tr_netOpenTCP( io->session, &io->addr, io->port ); 
     549    io->socket = tr_netOpenTCP( io->session, &io->addr, io->port );
    550550    if( io->socket >= 0 )
    551551    {
  • trunk/libtransmission/peer-mgr.c

    r8879 r8889  
    4848    /* minimum interval for refilling peers' request lists */
    4949    REFILL_PERIOD_MSEC = 400,
    50    
     50
    5151    /* how frequently to reallocate bandwidth */
    5252    BANDWIDTH_PERIOD_MSEC = 500,
     
    10791079            }
    10801080
    1081             /* update the stats */ 
     1081            /* update the stats */
    10821082            if( e->wasPieceData )
    10831083                tr_statsAddDownloaded( tor->session, e->length );
     
    14311431    const uint8_t * walk = compact;
    14321432    tr_pex *        pex = tr_new0( tr_pex, n );
    1433    
     1433
    14341434    for( i = 0; i < n; ++i )
    14351435    {
     
    14401440            pex[i].flags = added_f[i];
    14411441    }
    1442    
     1442
    14431443    *pexCount = n;
    14441444    return pex;
     
    14551455    const uint8_t * walk = array;
    14561456    tr_pex        * pex = tr_new0( tr_pex, n );
    1457    
     1457
    14581458    for( i = 0 ; i < n ; i++ ) {
    14591459        memcpy( &pex[i].addr, walk, sizeof( tr_address ) );
     
    14621462        walk += sizeof( tr_address ) + 2;
    14631463    }
    1464    
     1464
    14651465    *pexCount = n;
    14661466    return pex;
     
    25092509        n += tr_ptrArraySize( &tor->torrentPeers->peers );
    25102510
    2511     /* if there are too many, prune out the worst */ 
     2511    /* if there are too many, prune out the worst */
    25122512    if( n > max )
    25132513    {
     
    25272527            }
    25282528        }
    2529        
     2529
    25302530        /* sort 'em */
    25312531        sortPeersByLiveliness( peers, (void**)torrents, n, now );
  • trunk/libtransmission/peer-msgs.c

    r8767 r8889  
    11011101            tr_free( pex );
    11021102        }
    1103        
     1103
    11041104        if( tr_bencDictFindRaw( &val, "added6", &added, &added_len ) )
    11051105        {
     
    11161116            tr_free( pex );
    11171117        }
    1118        
    11191118    }
    11201119
     
    17541753            else
    17551754            {
    1756                 dbgmsg( msgs, "sending block %u:%u->%u", req.index, req.offset, req.length ); 
     1755                dbgmsg( msgs, "sending block %u:%u->%u", req.index, req.offset, req.length );
    17571756                EVBUFFER_LENGTH(out) += req.length;
    17581757                assert( EVBUFFER_LENGTH( out ) == msglen );
     
    20592058            tr_bencDictAddRaw( &val, "dropped", tmp, walk - tmp );
    20602059            tr_free( tmp );
    2061            
     2060
    20622061            /* "added6" */
    20632062            tmp = walk = tr_new( uint8_t, diffs6.addedCount * 18 );
     
    20722071            tr_bencDictAddRaw( &val, "added6", tmp, walk - tmp );
    20732072            tr_free( tmp );
    2074            
     2073
    20752074            /* "added6.f" */
    20762075            tmp = walk = tr_new( uint8_t, diffs6.addedCount );
     
    20802079            tr_bencDictAddRaw( &val, "added6.f", tmp, walk - tmp );
    20812080            tr_free( tmp );
    2082            
     2081
    20832082            /* "dropped6" */
    20842083            tmp = walk = tr_new( uint8_t, diffs6.droppedCount * 18 );
  • trunk/libtransmission/platform.c

    r8792 r8889  
    523523    tr_free( tmp );
    524524    return ret;
    525    
    526525}
    527526
     
    555554
    556555            s = tr_buildPath( appString, "Contents", "Resources", "web", NULL );
    557            
     556
    558557            if( !isClutchDir( s ) ) {
    559558                tr_free( s );
    560                
     559
    561560                /* Fallback to the Application Support folder */
    562561                s = tr_buildPath( tr_sessionGetConfigDir( session ), "web", NULL );
     
    571570            /* SHGetFolderPath explicitly requires MAX_PATH length */
    572571            char dir[MAX_PATH];
    573            
     572
    574573            /* Generally, Web interface should be stored in a Web subdir of
    575574             * calling executable dir. */
    576575
    577             if( s == NULL ) { 
     576            if( s == NULL ) {
    578577                /* First, we should check personal AppData/Transmission/Web */
    579578                SHGetFolderPath( NULL, CSIDL_COMMON_APPDATA, NULL, 0, dir );
  • trunk/libtransmission/platform.h

    r8561 r8889  
    44 * This file is licensed by the GPL version 2.  Works owned by the
    55 * Transmission project are granted a special exemption to clause 2(b)
    6  * so that the bulk of its code can remain under the MIT license. 
     6 * so that the bulk of its code can remain under the MIT license.
    77 * This exemption does not extend to derived works not owned by
    88 * the Transmission project.
     
    3333/**
    3434 * @addtogroup utils Utilities
    35  * @{ 
     35 * @{
    3636 */
    3737
  • trunk/libtransmission/request-list.c

    r7622 r8889  
    7070                          list->sort,
    7171                          list->len,
    72                           sizeof( struct peer_request ), 
     72                          sizeof( struct peer_request ),
    7373                          (compareFunc)compareRequests,
    7474                          exactMatch );
  • trunk/libtransmission/resume.c

    r8878 r8889  
    8888    if( count > 0 )
    8989        tr_bencDictAddRaw( dict, KEY_PEERS6, pex, sizeof( tr_pex ) * count );
    90    
     90
    9191    tr_free( pex );
    9292}
     
    113113        ret = TR_FR_PEERS;
    114114    }
    115    
     115
    116116    if( tr_bencDictFindRaw( dict, KEY_PEERS6, &str, &len ) )
    117117    {
     
    639639    if( fieldsToLoad & TR_FR_SPEEDLIMIT )
    640640        fieldsLoaded |= loadSpeedLimits( &top, tor );
    641    
     641
    642642    if( fieldsToLoad & TR_FR_RATIOLIMIT )
    643643        fieldsLoaded |= loadRatioLimits( &top, tor );
  • trunk/libtransmission/rpcimpl.c

    r8871 r8889  
    11791179    int running = 0;
    11801180    int total = 0;
    1181     tr_benc * d; 
    1182     tr_session_stats currentStats = { 0.0f, 0, 0, 0, 0, 0 }; 
    1183     tr_session_stats cumulativeStats = { 0.0f, 0, 0, 0, 0, 0 }; 
     1181    tr_benc * d;
     1182    tr_session_stats currentStats = { 0.0f, 0, 0, 0, 0, 0 };
     1183    tr_session_stats cumulativeStats = { 0.0f, 0, 0, 0, 0, 0 };
    11841184    tr_torrent * tor = NULL;
    11851185
     
    11921192    }
    11931193
    1194     tr_sessionGetStats( session, &currentStats ); 
    1195     tr_sessionGetCumulativeStats( session, &cumulativeStats ); 
     1194    tr_sessionGetStats( session, &currentStats );
     1195    tr_sessionGetCumulativeStats( session, &cumulativeStats );
    11961196
    11971197    tr_bencDictAddInt( args_out, "activeTorrentCount", running );
     
    12011201    tr_bencDictAddInt( args_out, "uploadSpeed", (int)( tr_sessionGetPieceSpeed( session, TR_UP ) * 1024 ) );
    12021202
    1203     d = tr_bencDictAddDict( args_out, "cumulative-stats", 5 ); 
    1204     tr_bencDictAddInt( d, "downloadedBytes", cumulativeStats.downloadedBytes ); 
    1205     tr_bencDictAddInt( d, "filesAdded", cumulativeStats.filesAdded ); 
    1206     tr_bencDictAddInt( d, "secondsActive", cumulativeStats.secondsActive ); 
    1207     tr_bencDictAddInt( d, "sessionCount", cumulativeStats.sessionCount ); 
    1208     tr_bencDictAddInt( d, "uploadedBytes", cumulativeStats.uploadedBytes ); 
    1209 
    1210     d = tr_bencDictAddDict( args_out, "current-stats", 5 ); 
    1211     tr_bencDictAddInt( d, "downloadedBytes", currentStats.downloadedBytes ); 
    1212     tr_bencDictAddInt( d, "filesAdded", currentStats.filesAdded ); 
    1213     tr_bencDictAddInt( d, "secondsActive", currentStats.secondsActive ); 
    1214     tr_bencDictAddInt( d, "sessionCount", currentStats.sessionCount ); 
    1215     tr_bencDictAddInt( d, "uploadedBytes", currentStats.uploadedBytes ); 
     1203    d = tr_bencDictAddDict( args_out, "cumulative-stats", 5 );
     1204    tr_bencDictAddInt( d, "downloadedBytes", cumulativeStats.downloadedBytes );
     1205    tr_bencDictAddInt( d, "filesAdded", cumulativeStats.filesAdded );
     1206    tr_bencDictAddInt( d, "secondsActive", cumulativeStats.secondsActive );
     1207    tr_bencDictAddInt( d, "sessionCount", cumulativeStats.sessionCount );
     1208    tr_bencDictAddInt( d, "uploadedBytes", cumulativeStats.uploadedBytes );
     1209
     1210    d = tr_bencDictAddDict( args_out, "current-stats", 5 );
     1211    tr_bencDictAddInt( d, "downloadedBytes", currentStats.downloadedBytes );
     1212    tr_bencDictAddInt( d, "filesAdded", currentStats.filesAdded );
     1213    tr_bencDictAddInt( d, "secondsActive", currentStats.secondsActive );
     1214    tr_bencDictAddInt( d, "sessionCount", currentStats.sessionCount );
     1215    tr_bencDictAddInt( d, "uploadedBytes", currentStats.uploadedBytes );
    12161216
    12171217    return NULL;
     
    12561256    switch( tr_sessionGetEncryption( s ) ) {
    12571257        case TR_CLEAR_PREFERRED: str = "tolerated"; break;
    1258         case TR_ENCRYPTION_REQUIRED: str = "required"; break; 
     1258        case TR_ENCRYPTION_REQUIRED: str = "required"; break;
    12591259        default: str = "preferred"; break;
    12601260    }
  • trunk/libtransmission/session.c

    r8888 r8889  
    316316    minutes = tm.tm_hour*60 + tm.tm_min;
    317317    day = tm.tm_wday;
    318    
     318
    319319    if( !toNextDay )
    320320        withinTime = ( begin <= minutes ) && ( minutes < end );
    321321    else /* goes past midnight */
    322322        withinTime = ( begin <= minutes ) || ( minutes < end );
    323    
     323
    324324    if( !withinTime )
    325325        return FALSE;
    326    
     326
    327327    if( toNextDay && (minutes < end) )
    328328        day = (day - 1) % 7;
     
    795795    assert( found );
    796796    session->altSpeedTimeEnd = i;
    797    
     797
    798798    found = tr_bencDictFindInt( &settings, TR_PREFS_KEY_ALT_SPEED_TIME_DAY, &i );
    799799    assert( found );
     
    11021102        currentMinute = tm.tm_hour*60 + tm.tm_min;
    11031103        day = tm.tm_wday;
    1104        
     1104
    11051105        isBeginTime = currentMinute == session->altSpeedTimeBegin;
    11061106        isEndTime = currentMinute == session->altSpeedTimeEnd;
     
    11101110            if( isEndTime && !isBeginTime && session->altSpeedTimeEnd < session->altSpeedTimeBegin )
    11111111                day = (day - 1) % 7;
    1112            
     1112
    11131113            isDay = ((1<<day) & session->altSpeedTimeDay) != 0;
    11141114
     
    11681168
    11691169/***
    1170 ****  Alternative speed limits that are used during scheduled times 
     1170****  Alternative speed limits that are used during scheduled times
    11711171***/
    11721172
     
    11891189    assert( tr_isDirection( d ) );
    11901190
    1191     return s->altSpeed[d]; 
     1191    return s->altSpeed[d];
    11921192}
    11931193
     
    13021302        s->altSpeedEnabled = enabled;
    13031303        s->altSpeedChangedByUser = byUser;
    1304    
     1304
    13051305        tr_runInEventThread( s, altSpeedToggled, s );
    13061306    }
  • trunk/libtransmission/torrent.c

    r8878 r8889  
    992992    else if( s->ratio == TR_RATIO_NA )
    993993        s->percentRatio = 0.0;
    994     else 
     994    else
    995995        s->percentRatio = s->ratio / seedRatio;
    996996
     
    22832283            char * oldpath = tr_buildPath( tor->downloadDir, f->name, NULL );
    22842284            char * newpath = tr_buildPath( location, f->name, NULL );
    2285            
     2285
    22862286            if( do_move )
    22872287            {
  • trunk/libtransmission/tracker.c

    r8878 r8889  
    254254    tr_address addr;
    255255    tr_port port;
    256    
     256
    257257    addr.type = TR_AF_INET;
    258258    memset( &addr.addr, 0x00, sizeof( addr.addr ) );
     
    262262        memcpy( &addr.addr.addr4, compactWalk, 4 );
    263263        memcpy( &port, compactWalk + 4, 2 );
    264        
     264
    265265        memcpy( walk, &addr, sizeof( addr ) );
    266266        memcpy( walk + sizeof( addr ), &port, 2 );
    267        
     267
    268268        walk += sizeof( tr_address ) + 2;
    269269        compactWalk += 6;
     
    286286    tr_address addr;
    287287    tr_port port;
    288    
     288
    289289    addr.type = TR_AF_INET6;
    290290    memset( &addr.addr, 0x00, sizeof( addr.addr ) );
     
    295295        memcpy( &port, compactWalk + 16, 2 );
    296296        compactWalk += 18;
    297        
     297
    298298        memcpy( walk, &addr, sizeof( addr ) );
    299299        memcpy( walk + sizeof( addr ), &port, 2 );
  • trunk/libtransmission/trevent.c

    r8681 r8889  
    2424#ifdef WIN32
    2525
    26 #include <WinSock2.h> 
    27  
    28 static int 
    29 pgpipe( int handles[2] ) 
     26#include <WinSock2.h>
     27
     28static int
     29pgpipe( int handles[2] )
    3030{
    3131        SOCKET s;
    3232        struct sockaddr_in serv_addr;
    3333        int len = sizeof( serv_addr );
    34  
     34
    3535        handles[0] = handles[1] = INVALID_SOCKET;
    36  
     36
    3737        if ( ( s = socket( AF_INET, SOCK_STREAM, 0 ) ) == INVALID_SOCKET )
    3838        {
     
    4040                return -1;
    4141        }
    42  
     42
    4343        memset( &serv_addr, 0, sizeof( serv_addr ) );
    4444        serv_addr.sin_family = AF_INET;
     
    6969                return -1;
    7070        }
    71  
     71
    7272        if (connect(handles[1], (SOCKADDR *) & serv_addr, len) == SOCKET_ERROR)
    7373        {
     
    8787        return 0;
    8888}
    89  
    90 static int 
    91 piperead( int s, char *buf, int len ) 
    92 { 
    93         int ret = recv(s, buf, len, 0); 
    94  
    95         if (ret < 0 && WSAGetLastError() == WSAECONNRESET) 
    96                 /* EOF on the pipe! (win32 socket based implementation) */ 
    97                 ret = 0; 
    98         return ret; 
    99 } 
    100  
    101 #define pipe(a) pgpipe(a) 
    102 #define pipewrite(a,b,c) send(a,(char*)b,c,0) 
     89
     90static int
     91piperead( int s, char *buf, int len )
     92{
     93        int ret = recv(s, buf, len, 0);
     94
     95        if (ret < 0 && WSAGetLastError() == WSAECONNRESET)
     96                /* EOF on the pipe! (win32 socket based implementation) */
     97                ret = 0;
     98        return ret;
     99}
     100
     101#define pipe(a) pgpipe(a)
     102#define pipewrite(a,b,c) send(a,(char*)b,c,0)
    103103
    104104#else
    105 #define piperead(a,b,c) read(a,b,c) 
    106 #define pipewrite(a,b,c) write(a,b,c) 
     105#define piperead(a,b,c) read(a,b,c)
     106#define pipewrite(a,b,c) write(a,b,c)
    107107#endif
    108108
    109 #include <unistd.h> 
     109#include <unistd.h>
    110110
    111111#include <event.h>
  • trunk/libtransmission/utils.c

    r8808 r8889  
    285285****
    286286***/
    287    
    288287
    289288int
     
    12491248 * array of setmeCount ints of all the values in the array.
    12501249 * For example, "5-8" will return [ 5, 6, 7, 8 ] and setmeCount will be 4.
    1251  * It's the caller's responsibility to call tr_free() on the returned array. 
     1250 * It's the caller's responsibility to call tr_free() on the returned array.
    12521251 * If a fragment of the string can't be parsed, NULL is returned.
    12531252 */
  • trunk/libtransmission/utils.h

    r8825 r8889  
    44 * This file is licensed by the GPL version 2.  Works owned by the
    55 * Transmission project are granted a special exemption to clause 2(b)
    6  * so that the bulk of its code can remain under the MIT license. 
     6 * so that the bulk of its code can remain under the MIT license.
    77 * This exemption does not extend to derived works not owned by
    88 * the Transmission project.
     
    3434/**
    3535 * @addtogroup utils Utilities
    36  * @{ 
     36 * @{
    3737 */
    3838
     
    115115    do { if( ! ( test ) ) tr_assertImpl( __FILE__, __LINE__, #test, fmt, __VA_ARGS__ ); } while( 0 )
    116116#endif
    117        
     117
    118118int            tr_msgLoggingIsActive( int level );
    119119
     
    397397   call with the decimal_places argument equal to the number of
    398398   decimal places in the printf()'s precision:
    399    
     399
    400400   - printf("%.2f%%",           99.999    ) ==> "100.00%"
    401401
  • trunk/libtransmission/web.c

    r8767 r8889  
    44 * This file is licensed by the GPL version 2.  Works owned by the
    55 * Transmission project are granted a special exemption to clause 2(b)
    6  * so that the bulk of its code can remain under the MIT license. 
     6 * so that the bulk of its code can remain under the MIT license.
    77 * This exemption does not extend to derived works not owned by
    88 * the Transmission project.
     
    333333add_tasks_from_queue( tr_web * g )
    334334{
    335     while( ( g->still_running < MAX_CONCURRENT_TASKS ) 
     335    while( ( g->still_running < MAX_CONCURRENT_TASKS )
    336336        && ( tr_list_size( g->easy_queue ) > 0 ) )
    337337    {
     
    525525    /* call curl_global_init if we haven't done it already.
    526526     * try to enable ssl for https support; but if that fails,
    527      * try a plain vanilla init */ 
     527     * try a plain vanilla init */
    528528    if( curlInited == FALSE ) {
    529529        curlInited = TRUE;
     
    531531            curl_global_init( 0 );
    532532    }
    533    
     533
    534534    web = tr_new0( struct tr_web, 1 );
    535535    web->multi = curl_multi_init( );
     
    625625{
    626626    struct http_msg * msg = bsearch( &code,
    627                                      http_msg, 
     627                                     http_msg,
    628628                                     sizeof( http_msg ) / sizeof( http_msg[0] ),
    629629                                     sizeof( http_msg[0] ),
Note: See TracChangeset for help on using the changeset viewer.