refactor: tr_torrentRemove() now takes std::function args (#8229)

This commit is contained in:
Charles Kerr
2026-01-27 14:37:11 -06:00
committed by GitHub
parent cbc4e9dc3a
commit 68e9049b17
13 changed files with 104 additions and 112 deletions

View File

@@ -77,9 +77,9 @@ void renameCallback(tr_torrent* /*torrent*/, char const* oldPathCharString, char
}
}
bool trashDataFile(char const* filename, void* /*user_data*/, tr_error* error)
bool trashDataFile(std::string_view const filename, tr_error* error)
{
if (filename == NULL)
if (std::empty(filename))
{
return false;
}
@@ -87,9 +87,12 @@ bool trashDataFile(char const* filename, void* /*user_data*/, tr_error* error)
@autoreleasepool
{
NSError* localError;
if (![Torrent trashFile:@(filename) error:&localError])
if (![Torrent trashFile:tr_strv_to_utf8_nsstring(filename) error:&localError])
{
error->set(static_cast<int>(localError.code), localError.description.UTF8String);
if (error != nullptr)
{
error->set(static_cast<int>(localError.code), localError.description.UTF8String);
}
return false;
}
}
@@ -193,7 +196,7 @@ bool trashDataFile(char const* filename, void* /*user_data*/, tr_error* error)
//allow the file to be indexed by Time Machine
[self setTimeMachineExclude:NO];
tr_torrentRemove(self.fHandle, trashFiles, trashDataFile, nullptr, nullptr, nullptr);
tr_torrentRemove(self.fHandle, trashFiles, trashDataFile);
}
- (void)changeDownloadFolderBeforeUsing:(NSString*)folder determinationType:(TorrentDeterminationType)determinationType