diff --git a/gtk/tr-torrent.c b/gtk/tr-torrent.c index 6b34a5bfb..3f6b97388 100644 --- a/gtk/tr-torrent.c +++ b/gtk/tr-torrent.c @@ -281,16 +281,10 @@ tr_torrent_set_remove_flag( TrTorrent * gtor, gtor->priv->do_remove = do_remove; } -static int -deleteFile( const char * filename, void * unused UNUSED ) -{ - return tr_file_trash_or_remove( filename ); -} - void tr_torrent_delete_files( TrTorrent * gtor ) { - tr_torrentDeleteLocalData( tr_torrent_handle( gtor ), deleteFile, NULL ); + tr_torrentDeleteLocalData( tr_torrent_handle( gtor ), tr_file_trash_or_remove ); } void diff --git a/libtransmission/rpcimpl.c b/libtransmission/rpcimpl.c index 3c8da3348..a85790b15 100644 --- a/libtransmission/rpcimpl.c +++ b/libtransmission/rpcimpl.c @@ -239,7 +239,7 @@ torrentRemove( tr_session * session, const tr_rpc_callback_status status = notify( session, TR_RPC_TORRENT_REMOVING, tor ); tr_bool deleteFlag; if( tr_bencDictFindBool( args_in, "delete-local-data", &deleteFlag ) && deleteFlag ) - tr_torrentDeleteLocalData( tor, NULL, NULL ); + tr_torrentDeleteLocalData( tor, NULL ); if( !( status & TR_RPC_NOREMOVE ) ) tr_torrentRemove( tor ); } diff --git a/libtransmission/torrent.c b/libtransmission/torrent.c index 145380fc9..65f963388 100644 --- a/libtransmission/torrent.c +++ b/libtransmission/torrent.c @@ -2316,15 +2316,15 @@ walkLocalData( const tr_torrent * tor, } static void -deleteLocalFile( const char * filename, tr_fileFunc fileFunc, void * fileFuncClientData ) +deleteLocalFile( const char * filename, tr_fileFunc fileFunc ) { struct stat sb; if( !stat( filename, &sb ) ) /* if file exists... */ - fileFunc( filename, fileFuncClientData ); + fileFunc( filename ); } static void -deleteLocalData( tr_torrent * tor, tr_fileFunc fileFunc, void * fileFuncClientData ) +deleteLocalData( tr_torrent * tor, tr_fileFunc fileFunc ) { int i, n; char ** s; @@ -2352,12 +2352,12 @@ deleteLocalData( tr_torrent * tor, tr_fileFunc fileFunc, void * fileFuncClientDa s = (char**) tr_ptrArrayPeek( &folders, &n ); for( i=0; iinfo.fileCount; ++f ) { char * path = tr_buildPath( tor->currentDir, tor->info.files[f].name, NULL ); - deleteLocalFile( path, fileFunc, fileFuncClientData ); + deleteLocalFile( path, fileFunc ); tr_free( path ); } @@ -2374,10 +2374,10 @@ deleteLocalData( tr_torrent * tor, tr_fileFunc fileFunc, void * fileFuncClientDa for( i=0; isession, tor->uniqueId ); if( tor->info.fileCount > 1 ) { - deleteLocalData( tor, fileFunc, fileFuncClientData ); + deleteLocalData( tor, fileFunc ); } else if( tor->info.fileCount == 1 ) { @@ -2417,12 +2411,12 @@ tr_torrentDeleteLocalData( tr_torrent * tor, tr_fileFunc fileFunc, void * fileFu /* torrent only has one file */ char * path = tr_buildPath( tor->currentDir, tor->info.files[0].name, NULL ); - deleteLocalFile( path, fileFunc, fileFuncClientData ); + deleteLocalFile( path, fileFunc ); tr_free( path ); tmp = tr_torrentBuildPartial( tor, 0 ); path = tr_buildPath( tor->currentDir, tmp, NULL ); - deleteLocalFile( path, fileFunc, fileFuncClientData ); + deleteLocalFile( path, fileFunc ); tr_free( path ); tr_free( tmp ); } @@ -2515,7 +2509,7 @@ setLocation( void * vdata ) { /* blow away the leftover subdirectories in the old location */ if( do_move ) - tr_torrentDeleteLocalData( tor, removeFile, NULL ); + tr_torrentDeleteLocalData( tor, remove ); /* set the new location and reverify */ tr_torrentSetDownloadDir( tor, location ); diff --git a/libtransmission/transmission.h b/libtransmission/transmission.h index bfe083c70..62dc4fcf1 100644 --- a/libtransmission/transmission.h +++ b/libtransmission/transmission.h @@ -1021,7 +1021,7 @@ void tr_torrentSetLocation( tr_torrent * torrent, double * setme_progress, int * setme_state ); -typedef int tr_fileFunc( const char * filename, void * clientData ); +typedef int tr_fileFunc( const char * filename ); /** * @brief Deletes the torrent's local data. @@ -1030,9 +1030,7 @@ typedef int tr_fileFunc( const char * filename, void * clientData ); * recycle bins, pass in a function that uses it instead. * tr_torrentDeleteLocalData() ignores fileFunc's return value. */ -void tr_torrentDeleteLocalData( tr_torrent * torrent, - tr_fileFunc fileFunc, - void * fileFuncClientData ); +void tr_torrentDeleteLocalData( tr_torrent * torrent, tr_fileFunc fileFunc ); uint64_t tr_torrentGetBytesLeftToAllocate( const tr_torrent * torrent );