Changeset 9691


Ignore:
Timestamp:
Dec 9, 2009, 3:51:21 AM (12 years ago)
Author:
charles
Message:

(trunk libT) by request, remove a clientData argument from tr_torrentDeleteLocalData() (reverts r9690)

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/gtk/tr-torrent.c

    r9690 r9691  
    282282}
    283283
    284 static int
    285 deleteFile( const char * filename, void * unused UNUSED )
    286 {
    287     return tr_file_trash_or_remove( filename );
    288 }
    289 
    290284void
    291285tr_torrent_delete_files( TrTorrent * gtor )
    292286{
    293     tr_torrentDeleteLocalData( tr_torrent_handle( gtor ), deleteFile, NULL );
     287    tr_torrentDeleteLocalData( tr_torrent_handle( gtor ), tr_file_trash_or_remove );
    294288}
    295289
  • trunk/libtransmission/rpcimpl.c

    r9690 r9691  
    240240        tr_bool deleteFlag;
    241241        if( tr_bencDictFindBool( args_in, "delete-local-data", &deleteFlag ) && deleteFlag )
    242             tr_torrentDeleteLocalData( tor, NULL, NULL );
     242            tr_torrentDeleteLocalData( tor, NULL );
    243243        if( !( status & TR_RPC_NOREMOVE ) )
    244244            tr_torrentRemove( tor );
  • trunk/libtransmission/torrent.c

    r9690 r9691  
    23172317
    23182318static void
    2319 deleteLocalFile( const char * filename, tr_fileFunc fileFunc, void * fileFuncClientData )
     2319deleteLocalFile( const char * filename, tr_fileFunc fileFunc )
    23202320{
    23212321    struct stat sb;
    23222322    if( !stat( filename, &sb ) ) /* if file exists... */
    2323         fileFunc( filename, fileFuncClientData );
     2323        fileFunc( filename );
    23242324}
    23252325
    23262326static void
    2327 deleteLocalData( tr_torrent * tor, tr_fileFunc fileFunc, void * fileFuncClientData )
     2327deleteLocalData( tr_torrent * tor, tr_fileFunc fileFunc )
    23282328{
    23292329    int i, n;
     
    23532353    for( i=0; i<n; ++i )
    23542354        if( tr_ptrArrayFindSorted( &dirtyFolders, s[i], vstrcmp ) == NULL )
    2355             deleteLocalFile( s[i], fileFunc, fileFuncClientData );
     2355            deleteLocalFile( s[i], fileFunc );
    23562356
    23572357    /* now blow away any remaining torrent files, such as torrent files in dirty folders */
    23582358    for( f=0; f<tor->info.fileCount; ++f ) {
    23592359        char * path = tr_buildPath( tor->currentDir, tor->info.files[f].name, NULL );
    2360         deleteLocalFile( path, fileFunc, fileFuncClientData );
     2360        deleteLocalFile( path, fileFunc );
    23612361        tr_free( path );
    23622362    }
     
    23752375#ifdef SYS_DARWIN
    23762376            char * dsStore = tr_buildPath( s[i], ".DS_Store", NULL );
    2377             deleteLocalFile( dsStore, fileFunc, fileFuncClientData );
     2377            deleteLocalFile( dsStore, fileFunc );
    23782378            tr_free( dsStore );
    23792379#endif
    2380             deleteLocalFile( s[i], fileFunc, fileFuncClientData );
     2380            deleteLocalFile( s[i], fileFunc );
    23812381        }
    23822382        tr_ptrArrayDestruct( &cleanFolders, NULL );
     
    23912391}
    23922392
    2393 static int
    2394 removeFile( const char * filename, void * unused UNUSED )
    2395 {
    2396     return remove( filename );
    2397 }
    2398 
    2399 void
    2400 tr_torrentDeleteLocalData( tr_torrent * tor, tr_fileFunc fileFunc, void * fileFuncClientData )
     2393void
     2394tr_torrentDeleteLocalData( tr_torrent * tor, tr_fileFunc fileFunc )
    24012395{
    24022396    assert( tr_isTorrent( tor ) );
    24032397
    24042398    if( fileFunc == NULL )
    2405         fileFunc = removeFile;
     2399        fileFunc = remove;
    24062400
    24072401    /* close all the files because we're about to delete them */
     
    24102404    if( tor->info.fileCount > 1 )
    24112405    {
    2412         deleteLocalData( tor, fileFunc, fileFuncClientData );
     2406        deleteLocalData( tor, fileFunc );
    24132407    }
    24142408    else if( tor->info.fileCount == 1 )
     
    24182412        /* torrent only has one file */
    24192413        char * path = tr_buildPath( tor->currentDir, tor->info.files[0].name, NULL );
    2420         deleteLocalFile( path, fileFunc, fileFuncClientData );
     2414        deleteLocalFile( path, fileFunc );
    24212415        tr_free( path );
    24222416
    24232417        tmp = tr_torrentBuildPartial( tor, 0 );
    24242418        path = tr_buildPath( tor->currentDir, tmp, NULL );
    2425         deleteLocalFile( path, fileFunc, fileFuncClientData );
     2419        deleteLocalFile( path, fileFunc );
    24262420        tr_free( path );
    24272421        tr_free( tmp );
     
    25162510            /* blow away the leftover subdirectories in the old location */
    25172511            if( do_move )
    2518                 tr_torrentDeleteLocalData( tor, removeFile, NULL );
     2512                tr_torrentDeleteLocalData( tor, remove );
    25192513
    25202514            /* set the new location and reverify */
  • trunk/libtransmission/transmission.h

    r9690 r9691  
    10221022                            int         * setme_state );
    10231023
    1024 typedef int tr_fileFunc( const char * filename, void * clientData );
     1024typedef int tr_fileFunc( const char * filename );
    10251025
    10261026/**
     
    10311031 *                 tr_torrentDeleteLocalData() ignores fileFunc's return value.
    10321032 */
    1033 void tr_torrentDeleteLocalData( tr_torrent   * torrent,
    1034                                 tr_fileFunc    fileFunc,
    1035                                 void         * fileFuncClientData );
     1033void tr_torrentDeleteLocalData( tr_torrent * torrent, tr_fileFunc fileFunc );
    10361034
    10371035uint64_t tr_torrentGetBytesLeftToAllocate( const tr_torrent * torrent );
Note: See TracChangeset for help on using the changeset viewer.