Ignore:
Timestamp:
Sep 23, 2008, 7:11:04 PM (13 years ago)
Author:
charles
Message:

run libT, cli, daemon, gtk through the source-code formatter "uncrustify" as promised/threatened

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/verify.c

    r6498 r6795  
    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.
     
    2929struct verify_node
    3030{
    31     tr_torrent * torrent;
    32     tr_verify_done_cb verify_done_cb;
     31    tr_torrent *         torrent;
     32    tr_verify_done_cb    verify_done_cb;
    3333};
    3434
    3535static void
    36 fireCheckDone( tr_torrent          * torrent,
    37                tr_verify_done_cb     verify_done_cb )
     36fireCheckDone( tr_torrent *      torrent,
     37               tr_verify_done_cb verify_done_cb )
    3838{
    3939    if( verify_done_cb )
     
    4343static struct verify_node currentNode;
    4444
    45 static tr_list * verifyList = NULL;
    46 
    47 static tr_thread * verifyThread = NULL;
    48 
    49 static int stopCurrent = FALSE;
    50 
    51 static tr_lock* getVerifyLock( void )
     45static tr_list *          verifyList = NULL;
     46
     47static tr_thread *        verifyThread = NULL;
     48
     49static int                stopCurrent = FALSE;
     50
     51static tr_lock*
     52getVerifyLock( void )
    5253{
    5354    static tr_lock * lock = NULL;
     55
    5456    if( lock == NULL )
    5557        lock = tr_lockNew( );
     
    5860
    5961static int
    60 checkFile( tr_torrent       * tor,
    61            tr_file_index_t    fileIndex,
    62            int              * abortFlag )
     62checkFile( tr_torrent *    tor,
     63           tr_file_index_t fileIndex,
     64           int *          abortFlag )
    6365{
    6466    tr_piece_index_t i;
    65     int changed = FALSE;
    66     int nofile;
    67     struct stat sb;
    68     char path[MAX_PATH_LENGTH];
    69     const tr_file * file = &tor->info.files[fileIndex];
    70 
    71     tr_buildPath ( path, sizeof(path), tor->downloadDir, file->name, NULL );
     67    int              changed = FALSE;
     68    int              nofile;
     69    struct stat      sb;
     70    char             path[MAX_PATH_LENGTH];
     71    const tr_file *  file = &tor->info.files[fileIndex];
     72
     73    tr_buildPath ( path, sizeof( path ), tor->downloadDir, file->name, NULL );
    7274    nofile = stat( path, &sb ) || !S_ISREG( sb.st_mode );
    7375
    74     for( i=file->firstPiece; i<=file->lastPiece && i<tor->info.pieceCount && (!*abortFlag); ++i )
     76    for( i = file->firstPiece;
     77         i <= file->lastPiece && i < tor->info.pieceCount && ( !*abortFlag );
     78         ++i )
    7579    {
    7680        if( nofile )
     
    8084        else if( !tr_torrentIsPieceChecked( tor, i ) )
    8185        {
    82             const int wasComplete = tr_cpPieceIsComplete( tor->completion, i );
     86            const int      wasComplete = tr_cpPieceIsComplete(
     87                tor->completion, i );
    8388            const tr_errno err = tr_ioTestPiece( tor, i );
    8489
     
    96101                 * want to lose blocks in those incomplete pieces */
    97102
    98                 if( wasComplete ) {
     103                if( wasComplete )
     104                {
    99105                    tr_torrentSetHasPiece( tor, i, FALSE );
    100106                    changed = TRUE;
     
    112118verifyThreadFunc( void * unused UNUSED )
    113119{
    114     for( ;; )
    115     {
    116         int changed = 0;
    117         tr_file_index_t i;
    118         tr_torrent * tor;
     120    for( ; ; )
     121    {
     122        int                  changed = 0;
     123        tr_file_index_t      i;
     124        tr_torrent *         tor;
    119125        struct verify_node * node;
    120126
     
    122128        stopCurrent = FALSE;
    123129        node = (struct verify_node*) verifyList ? verifyList->data : NULL;
    124         if( node == NULL ) {
     130        if( node == NULL )
     131        {
    125132            currentNode.torrent = NULL;
    126133            break;
     
    136143
    137144        tr_torinf( tor, _( "Verifying torrent" ) );
    138         for( i=0; i<tor->info.fileCount && !stopCurrent; ++i )
     145        for( i = 0; i < tor->info.fileCount && !stopCurrent; ++i )
    139146            changed |= checkFile( tor, i, &stopCurrent );
    140147
     
    154161
    155162void
    156 tr_verifyAdd( tr_torrent          * tor,
    157               tr_verify_done_cb    verify_done_cb )
     163tr_verifyAdd( tr_torrent *      tor,
     164              tr_verify_done_cb verify_done_cb )
    158165{
    159166    const int uncheckedCount = tr_torrentCountUncheckedPieces( tor );
     
    184191
    185192static int
    186 compareVerifyByTorrent( const void * va, const void * vb )
     193compareVerifyByTorrent( const void * va,
     194                        const void * vb )
    187195{
    188196    const struct verify_node * a = va;
    189     const tr_torrent * b = vb;
     197    const tr_torrent *         b = vb;
     198
    190199    return a->torrent - b;
    191200}
     
    195204{
    196205    tr_lock * lock = getVerifyLock( );
     206
    197207    tr_lockLock( lock );
    198208
     
    215225    tr_lockUnlock( lock );
    216226}
     227
Note: See TracChangeset for help on using the changeset viewer.