From e18e9a706fa9a4a678f5a895630062bb7d572413 Mon Sep 17 00:00:00 2001 From: Mitchell Livingston Date: Fri, 27 Jul 2007 21:01:48 +0000 Subject: [PATCH] don't allow creation of torrent files with total size of zero bytes --- macosx/CreatorWindowController.m | 17 +++++++++++++++++ macosx/English.lproj/Localizable.strings | Bin 41392 -> 42050 bytes 2 files changed, 17 insertions(+) diff --git a/macosx/CreatorWindowController.m b/macosx/CreatorWindowController.m index 5db54d7a9..07692549f 100644 --- a/macosx/CreatorWindowController.m +++ b/macosx/CreatorWindowController.m @@ -61,6 +61,7 @@ fPath = [path retain]; fInfo = tr_metaInfoBuilderCreate(handle, [fPath UTF8String]); + if (fInfo->fileCount == 0) { NSAlert * alert = [[NSAlert alloc] init]; @@ -77,6 +78,22 @@ [self release]; return nil; } + if (fInfo->totalSize == 0) + { + NSAlert * alert = [[NSAlert alloc] init]; + [alert addButtonWithTitle: NSLocalizedString(@"OK", "Create torrent -> zero size -> button")]; + [alert setMessageText: NSLocalizedString(@"The total file size is zero bytes.", + "Create torrent -> zero size -> title")]; + [alert setInformativeText: NSLocalizedString(@"A torrent file cannot be created for files with no size.", + "Create torrent -> zero size -> warning")]; + [alert setAlertStyle: NSWarningAlertStyle]; + + [alert runModal]; + [alert release]; + + [self release]; + return nil; + } fDefaults = [NSUserDefaults standardUserDefaults]; } diff --git a/macosx/English.lproj/Localizable.strings b/macosx/English.lproj/Localizable.strings index 06bf93cfc722535176599acab6233066ee1ff81c..3b719670757e93a87f99d3c255d906a47e306231 100644 GIT binary patch delta 379 zcmdmRnCZ|7rVXibf>jKu3`Gq23fUx2a08aJ%JyJAnry Dt&}Hg