Changeset 80

Show
Ignore:
Timestamp:
12/27/05 15:12:36 (3 years ago)
Author:
mrowe
Message:

Remove unused variables and ensure variables are initialized before use to prevent GCC warnings. While doing this I simplified the nested-ifs in the start of -[Controller askPassphrase:withInteraction:] to make it more obvious which conditions lead to which variables being set.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/AgentController.m

    r77 r80  
    197197- (void)appleKeychainNotification:(NSNotification *)notification 
    198198{ 
    199         SecKeychainStatus status; 
    200          
    201199        if(([[notification name] isEqualToString:@"AppleKeychainLocked"]) 
    202200        && (([[NSUserDefaults standardUserDefaults] integerForKey:FollowKeychainString] == 2) 
  • trunk/Controller.m

    r78 r80  
    323323{ 
    324324        ProcessSerialNumber focusSerialNumber; 
    325         BOOL giveFocusBack = NO; 
    326325 
    327326        [appleKeychainUnlockedLock lock]; 
     
    348347{ 
    349348        char *serviceName; 
    350         const char *accountName
     349        const char *accountName = nil
    351350        char *kcPassword; 
    352351        UInt32 passwordLength; 
    353352        SecKeychainStatus keychainStatus; 
    354         OSStatus returnStatus
     353        OSStatus returnStatus = noErr
    355354        SecKeychainRef keychain; 
    356355 
     
    373372                 
    374373        [passphraseIsRequestedLock lock]; 
    375         if(passphraseIsRequested == YES
     374        if (passphraseIsRequested
    376375        { 
    377376                [passphraseIsRequestedLock unlock]; 
     
    385384        firstQuestion = @"Enter passphrase for "; 
    386385 
    387         if([question hasPrefix:firstQuestion]) 
     386        if ([question hasPrefix:firstQuestion]) 
    388387        { 
    389388                consultKeychain = YES; 
     
    392391        } 
    393392 
    394         else 
    395         { 
    396                 if([question hasSuffix:@"'s password: "]) 
    397                 { 
    398                         consultKeychain = [[NSUserDefaults standardUserDefaults] boolForKey:AddInteractivePasswordString]; 
    399                         accountName = [[[question componentsSeparatedByString:@"'s"] objectAtIndex:0] UTF8String]; 
    400                 } 
    401  
    402                 else 
    403                 { 
    404                         if([question hasPrefix:@"The authenticity of host"]) 
    405                         { 
    406                                 [passphraseIsRequestedLock lock]; 
    407                                 passphraseIsRequested = NO; 
    408                                 [passphraseIsRequestedLock unlock]; 
    409  
    410                                 if(interaction) 
    411                                 { 
    412                                         int r = NSRunAlertPanel(local(@"UnknownHostKey"), question, local(@"No"), local(@"Yes"), nil); 
    413                                         NSString *response = ( r == NSAlertAlternateReturn) ? @"yes" : @"no"; 
    414                                         return response; 
    415                                 } 
    416  
    417                                 else 
    418                                 { 
    419                                         return @"no"; 
    420                                 } 
    421                         } 
    422                 }  
    423         } 
     393        else if ([question hasSuffix:@"'s password: "]) 
     394        { 
     395                consultKeychain = [[NSUserDefaults standardUserDefaults] boolForKey:AddInteractivePasswordString]; 
     396                accountName = [[[question componentsSeparatedByString:@"'s"] objectAtIndex:0] UTF8String]; 
     397        } 
     398 
     399        else if ([question hasPrefix:@"The authenticity of host"]) 
     400        { 
     401                [passphraseIsRequestedLock lock]; 
     402                passphraseIsRequested = NO; 
     403                [passphraseIsRequestedLock unlock]; 
     404                 
     405                if (! interaction) 
     406                        return @"no"; 
     407                 
     408                int r = NSRunAlertPanel(local(@"UnknownHostKey"), question, local(@"No"), local(@"Yes"), nil); 
     409                NSString *response = ( r == NSAlertAlternateReturn) ? @"yes" : @"no"; 
     410                return response; 
     411        }  
    424412         
    425413        if(consultKeychain)