Changeset 958


Ignore:
Timestamp:
Sep 28, 2006, 9:54:23 PM (15 years ago)
Author:
livings124
Message:

Make code match the rest of the mac style.

Location:
trunk/macosx
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/macosx/PortChecker.m

    r956 r958  
    2828@implementation PortChecker
    2929
    30 - (id) initWithDelegate: (id) delegate {
    31     self = [super init];
    32     if (self != nil)
     30- (id) initWithDelegate: (id) delegate
     31{
     32    if ((self = [super init]))
     33    {
    3334        fDelegate = delegate;
     35    }
    3436   
    3537    return self;
     
    4345- (void) probePort: (int) portNumber
    4446{
    45     NSURLRequest * portProbeRequest;
     47    NSURLRequest * portProbeRequest = [NSURLRequest requestWithURL: [NSURL URLWithString:
     48                                [NSString stringWithFormat: @"https://www.grc.com/x/portprobe=%d", portNumber]]
     49                                cachePolicy: NSURLRequestReloadIgnoringCacheData timeoutInterval: 15.0];
    4650   
    47     portProbeRequest = [NSURLRequest requestWithURL: [NSURL URLWithString: [NSString stringWithFormat: @"https://www.grc.com/x/portprobe=%d", portNumber]]
    48                                         cachePolicy: NSURLRequestReloadIgnoringCacheData
    49                                     timeoutInterval: 15.0];
    50    
    51     NSURLConnection *portProbeConnection = [NSURLConnection connectionWithRequest: portProbeRequest delegate: self];
    52    
    53     if (portProbeConnection)
     51    NSURLConnection * portProbeConnection;
     52    if ((portProbeConnection = [NSURLConnection connectionWithRequest: portProbeRequest delegate: self]))
    5453        fPortProbeData = [[NSMutableData data] retain];
    5554    else
     
    6059}
    6160
    62 - (void) callBackWithStatus: (port_status_t) status {
     61- (void) callBackWithStatus: (port_status_t) status
     62{
    6363    fStatus = status;
    6464   
     
    6969#pragma mark NSURLConnection delegate methods
    7070
    71 - (void)connection: (NSURLConnection *) connection didReceiveResponse: (NSURLResponse *) response
     71- (void) connection: (NSURLConnection *) connection didReceiveResponse: (NSURLResponse *) response
    7272{
    7373    [fPortProbeData setLength: 0];
    7474}
    7575
    76 - (void)connection: (NSURLConnection *) connection didReceiveData: (NSData *) data
     76- (void) connection: (NSURLConnection *) connection didReceiveData: (NSData *) data
    7777{
    7878    [fPortProbeData appendData: data];
    7979}
    8080
    81 - (void)connection: (NSURLConnection *) connection didFailWithError: (NSError *) error
     81- (void) connection: (NSURLConnection *) connection didFailWithError: (NSError *) error
    8282{
    8383    NSLog(@"Unable to get port status: connection failed (%@)", [error localizedDescription]);
     
    8686}
    8787
    88 - (void)connectionDidFinishLoading: (NSURLConnection *) connection
     88- (void) connectionDidFinishLoading: (NSURLConnection *) connection
    8989{
    90     NSXMLDocument *shieldsUpProbe;
    91     shieldsUpProbe = [[NSXMLDocument alloc] initWithData: fPortProbeData options: NSXMLDocumentTidyHTML error: nil];
     90    NSXMLDocument * shieldsUpProbe = [[NSXMLDocument alloc] initWithData: fPortProbeData
     91                                        options: NSXMLDocumentTidyHTML error: nil];
    9292   
    93     if (shieldsUpProbe == nil)
     93    if (shieldsUpProbe)
    9494    {
    95         NSLog(@"Unable to get port status: failed to create xml document");
    96         [self callBackWithStatus: PORT_STATUS_ERROR];
    97     }
    98     else
    99     {
    100         NSArray *nodes = [shieldsUpProbe nodesForXPath: @"/html/body/center/table[3]/tr/td[2]" error: nil];
     95        NSArray * nodes = [shieldsUpProbe nodesForXPath: @"/html/body/center/table[3]/tr/td[2]" error: nil];
    10196        if ([nodes count] != 1)
    10297        {
     
    106101        else
    107102        {
    108             NSString *portStatus = [[[[nodes objectAtIndex: 0] stringValue] stringByTrimmingCharactersInSet:
     103            NSString * portStatus = [[[[nodes objectAtIndex: 0] stringValue] stringByTrimmingCharactersInSet:
    109104                                                [[NSCharacterSet letterCharacterSet] invertedSet]] lowercaseString];
    110105           
     
    121116        }
    122117    }
     118    else
     119    {
     120        NSLog(@"Unable to get port status: failed to create xml document");
     121        [self callBackWithStatus: PORT_STATUS_ERROR];
     122    }
    123123
    124124    [fPortProbeData release];
  • trunk/macosx/PrefsController.m

    r957 r958  
    896896    [self setPrefView: fNetworkView];
    897897   
    898     //get around bug in apple code
     898    //make sure progress indicator hides itself
    899899    if ([fPortStatusImage image])
    900900        [fPortStatusProgress setDisplayedWhenStopped: NO];
Note: See TracChangeset for help on using the changeset viewer.