Minor tidy ups. Ran through converters for Modern Objective-C and ARC. Removed couple of depreciated warnings.

This commit is contained in:
Robert McGovern 2021-05-24 10:24:32 +01:00
parent def0536866
commit c78276aeeb
4 changed files with 49 additions and 49 deletions

View File

@ -521,6 +521,7 @@
isa = XCBuildConfiguration; isa = XCBuildConfiguration;
buildSettings = { buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO; ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_ENABLE_OBJC_WEAK = YES; CLANG_ENABLE_OBJC_WEAK = YES;
CODE_SIGN_IDENTITY = "-"; CODE_SIGN_IDENTITY = "-";
COPY_PHASE_STRIP = NO; COPY_PHASE_STRIP = NO;
@ -551,6 +552,7 @@
isa = XCBuildConfiguration; isa = XCBuildConfiguration;
buildSettings = { buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO; ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_ENABLE_OBJC_WEAK = YES; CLANG_ENABLE_OBJC_WEAK = YES;
CODE_SIGN_IDENTITY = "-"; CODE_SIGN_IDENTITY = "-";
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";

View File

@ -24,15 +24,15 @@ enum
#define BUF_LEN 64000 #define BUF_LEN 64000
@interface QuietUnrarAppDelegate : NSObject <NSApplicationDelegate> { @interface QuietUnrarAppDelegate : NSObject <NSApplicationDelegate> {
NSWindow *window; NSWindow *__weak window;
NSView *passwordView; NSView *__weak passwordView;
NSSecureTextField * passwordField; NSSecureTextField * __weak passwordField;
} }
@property (assign) IBOutlet NSWindow *window; @property (weak) IBOutlet NSWindow *window;
@property (assign) IBOutlet NSView *passwordView; @property (weak) IBOutlet NSView *passwordView;
@property (assign) IBOutlet NSSecureTextField * passwordField; @property (weak) IBOutlet NSSecureTextField * passwordField;
- (BOOL) extractRarWith:(NSString *) filename; - (BOOL) extractRarWith:(NSString *) filename;
- (BOOL) shouldFileBeReplaced:(NSString *) filename; - (BOOL) shouldFileBeReplaced:(NSString *) filename;

View File

@ -107,7 +107,6 @@ int callbackFunction(UINT message, LPARAM userData, LPARAM parameterOne, LPARAM
#pragma mark "Main" #pragma mark "Main"
- (BOOL) extractRarWith:(NSString *) filename { - (BOOL) extractRarWith:(NSString *) filename {
quietUnrar = (void *) self;
char commentBuffer[BUF_LEN]; char commentBuffer[BUF_LEN];
BOOL extractionSuccessful = YES; BOOL extractionSuccessful = YES;
struct RARHeaderData headerData; struct RARHeaderData headerData;
@ -189,14 +188,13 @@ int callbackFunction(UINT message, LPARAM userData, LPARAM parameterOne, LPARAM
NSButton * skipButton = [alert addButtonWithTitle:@"Skip"]; NSButton * skipButton = [alert addButtonWithTitle:@"Skip"];
[skipButton setKeyEquivalent:@"\e"]; [skipButton setKeyEquivalent:@"\e"];
[alert setMessageText:[NSString stringWithFormat:@"Overwrite %@?", filename]]; [alert setMessageText:[NSString stringWithFormat:@"Overwrite %@?", filename]];
[alert setInformativeText:[NSString stringWithFormat:@"The file already exists. Do you wish to extract it again, overwriting the original file?", filename]]; [alert setInformativeText:[NSString stringWithFormat:@"The file %@ already exists. Do you wish to extract it again, overwriting the original file?", filename]];
[alert setAlertStyle:NSWarningAlertStyle]; [alert setAlertStyle:NSAlertStyleWarning];
if ([alert runModal] == NSAlertFirstButtonReturn) { if ([alert runModal] == NSAlertFirstButtonReturn) {
result = YES; result = YES;
} }
[alert release];
return result; return result;
} }
@ -207,18 +205,20 @@ int callbackFunction(UINT message, LPARAM userData, LPARAM parameterOne, LPARAM
[alert addButtonWithTitle:@"OK"]; [alert addButtonWithTitle:@"OK"];
[alert setMessageText:[NSString stringWithFormat:@"Archive part %s is missing.", volume]]; [alert setMessageText:[NSString stringWithFormat:@"Archive part %s is missing.", volume]];
[alert setInformativeText:@"Unable to extract all files from RAR archive as part of it is missing"]; [alert setInformativeText:@"Unable to extract all files from RAR archive as part of it is missing"];
[alert setAlertStyle:NSCriticalAlertStyle]; [alert setAlertStyle:NSAlertStyleCritical];
[alert runModal]; [alert runModal];
[alert release];
} }
// Creates a dialog with a custom view with a NSSecureTextField which is displayed // Creates a dialog with a custom view with a NSSecureTextField which is displayed
// to the user so they can provide a password. Returns the entered password or nil // to the user so they can provide a password. Returns the entered password or nil
- (NSString *) requestArchivePassword { - (NSString *) requestArchivePassword {
if (!passwordView) { if (!passwordView) {
[NSBundle loadNibNamed:@"PasswordView" owner:self];
NSBundle* bundle = [NSBundle bundleForClass:[self class]];
[bundle loadNibNamed:@"PasswordView" owner:self topLevelObjects: nil];
} }
NSString * password = nil; NSString * password = nil;
@ -229,14 +229,12 @@ int callbackFunction(UINT message, LPARAM userData, LPARAM parameterOne, LPARAM
[alert setMessageText:@"Archive Requires a password"]; [alert setMessageText:@"Archive Requires a password"];
[alert setInformativeText:@"To extract the contents of this archive a password is required."]; [alert setInformativeText:@"To extract the contents of this archive a password is required."];
[alert setAccessoryView:passwordView]; [alert setAccessoryView:passwordView];
[alert setAlertStyle:NSWarningAlertStyle]; [alert setAlertStyle:NSAlertStyleWarning];
if ([alert runModal] == NSAlertFirstButtonReturn) { if ([alert runModal] == NSAlertFirstButtonReturn) {
password = [passwordField stringValue]; password = [passwordField stringValue];
[password autorelease];
} }
[alert release];
return password; return password;
} }

View File

@ -178,7 +178,7 @@ void PASCAL RARSetCallback(HANDLE hArcData,UNRARCALLBACK Callback,LPARAM UserD
void PASCAL RARSetChangeVolProc(HANDLE hArcData,CHANGEVOLPROC ChangeVolProc); void PASCAL RARSetChangeVolProc(HANDLE hArcData,CHANGEVOLPROC ChangeVolProc);
void PASCAL RARSetProcessDataProc(HANDLE hArcData,PROCESSDATAPROC ProcessDataProc); void PASCAL RARSetProcessDataProc(HANDLE hArcData,PROCESSDATAPROC ProcessDataProc);
void PASCAL RARSetPassword(HANDLE hArcData,char *Password); void PASCAL RARSetPassword(HANDLE hArcData,char *Password);
int PASCAL RARGetDllVersion(); int PASCAL RARGetDllVersion(void);
#ifdef __cplusplus #ifdef __cplusplus
} }