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;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_ENABLE_OBJC_WEAK = YES;
CODE_SIGN_IDENTITY = "-";
COPY_PHASE_STRIP = NO;
@ -551,6 +552,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_ENABLE_OBJC_WEAK = YES;
CODE_SIGN_IDENTITY = "-";
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";

View File

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

View File

@ -107,7 +107,6 @@ int callbackFunction(UINT message, LPARAM userData, LPARAM parameterOne, LPARAM
#pragma mark "Main"
- (BOOL) extractRarWith:(NSString *) filename {
quietUnrar = (void *) self;
char commentBuffer[BUF_LEN];
BOOL extractionSuccessful = YES;
struct RARHeaderData headerData;
@ -189,14 +188,13 @@ int callbackFunction(UINT message, LPARAM userData, LPARAM parameterOne, LPARAM
NSButton * skipButton = [alert addButtonWithTitle:@"Skip"];
[skipButton setKeyEquivalent:@"\e"];
[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 setAlertStyle:NSWarningAlertStyle];
[alert setInformativeText:[NSString stringWithFormat:@"The file %@ already exists. Do you wish to extract it again, overwriting the original file?", filename]];
[alert setAlertStyle:NSAlertStyleWarning];
if ([alert runModal] == NSAlertFirstButtonReturn) {
result = YES;
}
[alert release];
return result;
}
@ -207,18 +205,20 @@ int callbackFunction(UINT message, LPARAM userData, LPARAM parameterOne, LPARAM
[alert addButtonWithTitle:@"OK"];
[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 setAlertStyle:NSCriticalAlertStyle];
[alert setAlertStyle:NSAlertStyleCritical];
[alert runModal];
[alert release];
}
// 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
- (NSString *) requestArchivePassword {
if (!passwordView) {
[NSBundle loadNibNamed:@"PasswordView" owner:self];
NSBundle* bundle = [NSBundle bundleForClass:[self class]];
[bundle loadNibNamed:@"PasswordView" owner:self topLevelObjects: nil];
}
NSString * password = nil;
@ -229,14 +229,12 @@ int callbackFunction(UINT message, LPARAM userData, LPARAM parameterOne, LPARAM
[alert setMessageText:@"Archive Requires a password"];
[alert setInformativeText:@"To extract the contents of this archive a password is required."];
[alert setAccessoryView:passwordView];
[alert setAlertStyle:NSWarningAlertStyle];
[alert setAlertStyle:NSAlertStyleWarning];
if ([alert runModal] == NSAlertFirstButtonReturn) {
password = [passwordField stringValue];
[password autorelease];
}
[alert release];
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 RARSetProcessDataProc(HANDLE hArcData,PROCESSDATAPROC ProcessDataProc);
void PASCAL RARSetPassword(HANDLE hArcData,char *Password);
int PASCAL RARGetDllVersion();
int PASCAL RARGetDllVersion(void);
#ifdef __cplusplus
}